This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <vector> | |
template <typename T> | |
struct RMQ { | |
using Index = int; | |
using BitIndex = int; | |
const std::vector<T>& A; | |
const int N, S, L; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fractions import gcd | |
import random | |
from typing import Optional, Tuple | |
def given_d(n: int, e: int, d: int) -> Optional[Tuple[int, int]]: | |
ktot = e * d - 1 | |
s = (ktot & -ktot).bit_length() - 1 | |
t = ktot >> s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<div id="timer-wrapper"> | |
<h1 id="timer" style="font-size: 74pt;">00:00</h1> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clang.cindex | |
from clang.cindex import Index | |
def gen_stream_operator(cur): | |
if cur.kind.name == "STRUCT_DECL": | |
print("std::ostream& operator<<(std::ostream& os, const %s& rhs) {" % cur.displayname) | |
for child in cur.get_children(): | |
if child.kind.name == "FIELD_DECL": | |
print(' os << "{member}:" << rhs.{member} << std::endl;'.format(member=child.displayname)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array_sample(arr, k) | |
rng = Random.new | |
sample = Array.new k | |
sample[0] = arr[0] | |
(1...k).each {|i| | |
r = rng.rand(i + 1) | |
sample[i] = sample[r] | |
sample[r] = arr[i] | |
} | |
(k...arr.size).each {|i| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pwn import * | |
context.arch = "amd64" | |
elf = ELF("./jmper") | |
if args["REMOTE"]: | |
HOST = "jmper.pwn.seccon.jp" | |
PORT = 5656 | |
libc = ELF("./libc-2.19.so") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
decahook.h | |
easy function hooking macros for DECAF. | |
support to stdcall only. | |
Copyright (c) 2016 Nao Yonashiro | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
*/ | |
#ifndef DECAHOOK_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> // {{{ | |
#define ARG4(_1, _2, _3, _4, ...) _4 | |
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__) | |
#define REP(i, a) FOR(i, 0, a) | |
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i) | |
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__) | |
#define RREP(i, a) RFOR(i, 0, a) | |
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i) | |
#define ALL(c) (c).begin(), (c).end() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "DECAF_types.h" | |
#include "DECAF_main.h" | |
#include "DECAF_callback.h" | |
#include "DECAF_callback_common.h" | |
#include "vmi_callback.h" | |
#include "utils/Output.h" | |
#include "DECAF_target.h" | |
#include "hookapi.h" | |
static plugin_interface_t geteip_interface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <utility> | |
#include <vector> | |
using Graph = std::vector<std::vector<int>>; | |
using Edge = std::pair<int, int>; | |
class BridgeHelper { | |
const Graph& graph; | |
std::vector<int> ord, low; |