This file contains 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 sys | |
lines = words = bytes = 0 | |
for L in sys.stdin: | |
bytes += len(L) | |
words += len(L.split()) | |
lines += 1 | |
print 'bytes', bytes | |
print 'words', words | |
print 'lines', lines |
This file contains 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
package jp.ac.nii.icpc2010.players; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Queue; | |
import java.util.ArrayDeque; | |
import java.util.PriorityQueue; | |
import jp.ac.nii.icpc2010.players.BasePlayer; | |
import jp.ac.nii.icpc2010.playfield.FieldDirection; | |
import jp.ac.nii.icpc2010.playfield.IPlayField; |
This file contains 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
あーほ |
This file contains 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
X = 233 | |
Y = 456 | |
Z = 787 | |
TARGET = 10000000000 | |
def gcd(x, y): # x >= y | |
mod = x%y | |
if mod == 0: return y | |
return gcd(y, x%y) |
This file contains 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
#http://googledevjp.blogspot.com/2011/04/google-code-jam-2011.html | |
def solve(rest, boards, counts): | |
if boards == []: | |
return rest == 0 | |
board = boards[-1] | |
count = rest / board | |
rest = rest % board | |
while count >= 0: | |
if solve(rest, boards[0:-1], counts): |
This file contains 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
inada-n@sag15:~$ cat send_magic.py | |
import socket | |
s = socket.socket() | |
s.connect(('127.0.0.1', 8000)) | |
s.sendall("fff4fffd06".decode('hex')) | |
s.shutdown(socket.SHUT_WR) | |
dat = s.recv(1024) | |
try: | |
dat.decode('ascii') | |
print dat |
This file contains 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 zlib import compress, decompress | |
from time import time | |
import threading | |
import random | |
import string | |
#DAT = ''.join(random.choice(string.letters) for _ in xrange(8*1024)) | |
DAT = 'hello' | |
#DAT = compress(DAT) |
This file contains 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 check_route(board, route): | |
w = board.w | |
h = board.h | |
state = bytearray(board.state) | |
pos = board.state.index(b'0') | |
try: | |
for c in route: | |
if c == 'D': | |
npos = pos+w |
This file contains 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
#!/usr/bin/env python | |
import tobikko | |
import tobikko.socket as socket | |
def handler(sock): | |
try: | |
print "start handler" | |
recv=sock.recv | |
send=sock.send | |
while 1: |
This file contains 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
2011-10-02 13:38:58 +0900: adding match pattern="debug.**" type="stdout" | |
2011-10-02 13:38:58 +0900: running fluent-0.9.14 | |
2011-10-02 13:39:16 +0900 debug.hoge: {"foo":"bar"} |
OlderNewer