Skip to content

Instantly share code, notes, and snippets.

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:
#from pexpect import *
from commands import getoutput
from struct import pack, unpack
from subprocess import Popen, PIPE
from time import sleep
from fcntl import fcntl, F_GETFL, F_SETFL
from os import O_NONBLOCK, read
from os import putenv, environ
libc_base = 0x555a2000
@potetisensei
potetisensei / 1180.cpp
Last active August 29, 2015 14:25
POJ 1180
#include <cstdio>
#include <vector>
#include <deque>
#include <utility>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long int LLI;
typedef pair<LLI, LLI> Pair; // (a, b) := ax+b
@potetisensei
potetisensei / 3180.cpp
Last active August 29, 2015 14:25
POJ 3180
#include <cstdio>
#include <cassert>
#include <vector>
using namespace std;
int ans;
int n;
int m;
int t;
bool used[10000];
@potetisensei
potetisensei / 2100.cpp
Last active August 29, 2015 14:25
POJ 2100
#include <cstdio>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int, int> Pair;
int maxt;
int s;
@potetisensei
potetisensei / 1759.cpp
Last active August 29, 2015 14:25
POJ 1759
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define EPS 10e-3
int N;
double A;
double high;
@potetisensei
potetisensei / weff.py
Last active August 29, 2015 14:25
Weff - CODEGATE 2015
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:
@potetisensei
potetisensei / gist:09b7265bc95dfb000a7c
Last active August 29, 2015 14:24
for this: http://shindanmaker.com/549065 TODO: append CODEGATE 2014 Finals, SECUINSIDE 2014 Finals, DEFCON 2014 Finals, and so on
PlaidDB - Plaid 2015
Prodmanager - Plaid 2015
qttpd - Plaid 2015
tp - Plaid 2015
traveller - Plaid 2015
Weff - CODEGATE 2015
icbm - CODEGATE 2015
beef_steak - CODEGATE 2015
Bookstore - CODEGATE 2015
Olive and Mushroom Pizza - CODEGATE 2015
@potetisensei
potetisensei / J2.cpp
Last active August 29, 2015 14:23
Internet Problem Solving Contest 2015 J2
#include <cstdio>
bool check(unsigned short ax, unsigned short bx) {
unsigned short tmp;
for (int i=0; i<23; i++) {
if (bx < ax) return false;
if (ax == 0) return false;
bx -= ax;
tmp = ax;
@potetisensei
potetisensei / M.py
Last active August 29, 2015 14:23
Internet Problem Solving Contest 2015 M
# encoding: utf-8
from commands import getoutput
from math import sqrt
# numbers: DPテーブルっぽいもの。numbers[i]は数値iを作れるJSの最小コードをもつ。
# 生成される数を短くする都合上、numbers[0]とnumbers[1]は単体では数値にならないようになっている(後で変更)
numbers = ["[]", "!+[]"] + [""]*999;
# 0から9までを予め生成