Skip to content

Instantly share code, notes, and snippets.

#coding=utf-8
import sys,os
import re
from collections import defaultdict,namedtuple
from itertools import *
def scc(edges,redges):
def dfs(v):
used.add(v)
if v in edges:
2 4
XXXX
XOOO
4 4
XXXX
OOOO
XXXX
OOOO
#coding=utf-8
import os
import socket
import select
from time import sleep
import binascii
from subprocess import Popen,STDOUT,PIPE # Python 2.4以上が必要
import os
from math import *
#coding=utf-8
import os
import socket
import select
from time import sleep
import binascii
from subprocess import Popen,STDOUT,PIPE
import os
import math
import itertools
@math314
math314 / psi.py
Created September 22, 2014 14:06
CSAW 2014 crypto 200
#coding=utf-8
import os
import socket
import select
from time import sleep
import binascii
from subprocess import Popen,STDOUT,PIPE
import os
from math import *
import string
// 1-indexed
template<class T>
class BIT_2D {
T bit[512 + 1][512 + 1];
int h, w;
public:
BIT_2D() {}
BIT_2D(int H, int W) {
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
using System.IO;
using System.Drawing;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Linq;
using System.Net.Sockets;
#coding=utf-8
import os
import socket
import select
from time import sleep
import binascii
class Client(object):
def __init__(self):
import hashlib
PRIME = 10162817389166932304743927803664677577393035849460315554227038992256439669168822924924642681859165915398841119695331997622323074382673543580118593098794075768017359068156207668418577358758037040886636583057751950491466568754968161402970164774854422196808968101372380404300325099055524339557705423721707
G = 1323857230486534278
def get_salt(m):
for _ in range(1000):
m = hashlib.sha512(m).hexdigest()
return m
@math314
math314 / ntt.cpp
Last active September 21, 2020 05:05
#include <cstdio>
#include <cassert>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;
#define FOR(i,n) for(int i = 0; i < (n); i++)