Skip to content

Instantly share code, notes, and snippets.

#include<bits/stdc++.h>
#define XX first
#define YY second
#define pb emplace_back
#define eb pb
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,b) FOR(i,0,b)
#define REP rep
#define all(a) (a).begin(),(a).end()
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 December 1, 2018 10:45
Script for create scoring functions in CODE BLUE CTF 2018 Finals
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 08:50
Codeforces Round #415 (Div. 1) C. Find a car
#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
from socket import *
from struct import pack, unpack
from commands import getoutput
from time import sleep
buf_clone = 0x080CB960
p = socket(AF_INET, SOCK_STREAM)
p.connect(("ropi.pwn.seccon.jp", 10000))
@potetisensei
potetisensei / 3689.cpp
Last active February 12, 2017 07:17
POJ 3689
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
using namespace std;
#define EPS 1e-8
#define INF 1e10
@potetisensei
potetisensei / 6.c
Created August 21, 2016 08:48
LEGIT_00006 pov
#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 March 9, 2016 06:00
Boston key Party 2016 spacerex
int main() {
double hoge;
scanf("%llu", ((long long int*)&hoge));
printf("%e\n", hoge);
}
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int u, v;
int high, low;
int n, k;
int g_x;
int as[200000];
char [AudioManager loadBgmData:](struct AudioManager *self, SEL selector, id bgm_data)
{
NSError *has_occured;
if (bgm_data == nil) return 0;
self._bgmPlayer = [AVAudioPlayer alloc];
[self._bgmPlayer initWithData: bgm_data error: &has_occured];
if (has_occured == nil) {