s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s933634297 | p00884 | u633068244 | 1399617522 | Python | Python | py | Runtime Error | 0 | 0 | 425 | while 1:
n = input()
if n == 0: break
ans = {}
for i in range(n):
group,name = raw_input().split(":")
if i == 0: first = group
ans[group] = set(name[:-1].split(","))
while 1:
for key in ans:
flag = 0
for key1 in ans:
if key in ans[key1]:
ans[key1] |= ans[key]
ans[key1].discard(ke... |
s490519104 | p00894 | u633068244 | 1424619584 | Python | Python | py | Runtime Error | 0 | 0 | 572 | while 1:
n = int(raw_input())
if n == 0: break
exist = set([])
enter = [0]*1000
bless = [0]*1000
for loop in xrange(n):
md,hm,io,p = raw_input().split()
h,m = map(int,hm.split(":"))
t = 60*h+m
p = int(p)
if io == "I":
time[p] = t
ex... |
s462455219 | p00894 | u260980560 | 1482842703 | Python | Python | py | Runtime Error | 0 | 0 | 731 | while 1:
n = input()
if n == 0:
break
status = {}
god_st = 0
res = {}
for i in xrange(n):
s = raw_input().split()
#M, D = map(int, s[0].split("/"))
h, m = map(int, s[1].split(":"))
mi = 60*h + m
st = s[2] == 'I'
ID = s[3]
if ID == ... |
s930765000 | p00895 | u629779621 | 1529955204 | Python | Python3 | py | Runtime Error | 0 | 0 | 2587 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_diag = ... |
s548258430 | p00895 | u629779621 | 1529955284 | Python | Python3 | py | Runtime Error | 0 | 0 | 2558 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_diag = ... |
s497116500 | p00895 | u629779621 | 1529955665 | Python | Python3 | py | Runtime Error | 0 | 0 | 2599 |
from sys import stdin
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0]... |
s283017292 | p00895 | u629779621 | 1529955823 | Python | Python3 | py | Runtime Error | 0 | 0 | 2536 |
from sys import stdin
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0]... |
s973340339 | p00895 | u629779621 | 1529956025 | Python | Python3 | py | Runtime Error | 0 | 0 | 2558 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_diag = ... |
s696798564 | p00895 | u629779621 | 1529956108 | Python | Python3 | py | Runtime Error | 0 | 0 | 2495 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_diag = ... |
s665688929 | p00895 | u629779621 | 1529957902 | Python | Python3 | py | Runtime Error | 0 | 0 | 3570 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_i = sel... |
s107621202 | p00895 | u629779621 | 1529961247 | Python | Python3 | py | Runtime Error | 0 | 0 | 3573 |
def gcd_recursive(a, b):
if b == 0:
return a
else:
return gcd_recursive(b, a % b)
def modulo(x, base):
return (x % base + base) % base
class Donut:
def __init__(self, letters):
self.letters = letters
self.lengths = [len(letters), len(letters[0])]
max_i = sel... |
s467037642 | p00899 | u260980560 | 1507908789 | Python | Python3 | py | Runtime Error | 40000 | 30964 | 1138 | while 1:
n = int(input())
if n == 0:
break
S = [input() for i in range(n)]
dup = [0]*n
for i in range(n):
for j in range(i+1, n):
if S[i].find(S[j])+1:
dup[j] = 1
if S[j].find(S[i])+1:
dup[i] = 1
S = [S[i] for i in range(n)... |
s891555390 | p00899 | u260980560 | 1507909804 | Python | Python3 | py | Runtime Error | 40000 | 37084 | 1305 | from heapq import heappush, heappop, heapify
while 1:
n = int(input())
if n == 0:
break
S = [input() for i in range(n)]
dup = [0]*n
for i in range(n):
for j in range(i+1, n):
if S[i].find(S[j])+1:
dup[j] = 1
if S[j].find(S[i])+1:
... |
s174941496 | p00899 | u260980560 | 1507912058 | Python | Python3 | py | Runtime Error | 40000 | 45968 | 1615 | while 1:
n = int(input())
if n == 0:
break
S = [input() for i in range(n)]
dup = [0]*n
for i in range(n):
si = S[i]
for j in range(i+1, n):
sj = S[j]
if si.find(sj)+1:
dup[j] = 1
if sj.find(si)+1:
dup[i] = 1... |
s776493512 | p00899 | u467175809 | 1530176083 | Python | Python | py | Runtime Error | 0 | 0 | 1516 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
while True:
N = input()
if N == 0:
break
lst = []
for i in range(N):
S = raw_input()
flag = True
for SS ... |
s752940283 | p00899 | u467175809 | 1530176495 | Python | Python | py | Runtime Error | 0 | 0 | 1696 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
while True:
N = input()
if N == 0:
break
lst_input = []
lst = []
for i in range(N):
S = raw_input()
lst_inpu... |
s105468905 | p00899 | u467175809 | 1530176777 | Python | Python | py | Runtime Error | 0 | 0 | 1690 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
while True:
N = input()
if N == 0:
break
lst_input = []
lst = []
for i in range(N):
S = raw_input()
lst_inpu... |
s393013625 | p00899 | u467175809 | 1530176844 | Python | Python | py | Runtime Error | 0 | 0 | 1475 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
while True:
N = input()
if N == 0:
break
lst_input = []
lst = []
for i in range(N):
S = raw_input()
lst_input.append(S)
for i in range(N):
... |
s324289445 | p00899 | u467175809 | 1530177978 | Python | Python | py | Runtime Error | 0 | 0 | 1857 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s355717785 | p00899 | u467175809 | 1530178161 | Python | Python | py | Runtime Error | 0 | 0 | 1863 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s053746619 | p00899 | u467175809 | 1530178202 | Python | Python | py | Runtime Error | 0 | 0 | 1897 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s994483678 | p00899 | u467175809 | 1530178216 | Python | Python | py | Runtime Error | 0 | 0 | 1857 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s686073402 | p00899 | u467175809 | 1530178281 | Python | Python | py | Runtime Error | 0 | 0 | 1874 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s184543481 | p00899 | u467175809 | 1530178373 | Python | Python | py | Runtime Error | 0 | 0 | 1928 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s819379037 | p00899 | u467175809 | 1530178436 | Python | Python | py | Runtime Error | 0 | 0 | 1928 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s811501697 | p00899 | u467175809 | 1530178535 | Python | Python | py | Runtime Error | 0 | 0 | 1928 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
N = int(... |
s992156172 | p00899 | u467175809 | 1530178613 | Python | Python | py | Runtime Error | 0 | 0 | 1890 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ = list(reversed(input_))
while True:
pass
... |
s977957748 | p00899 | u467175809 | 1530178674 | Python | Python | py | Runtime Error | 0 | 0 | 1890 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
while True:
pass
input_ = list(reversed(input_))
... |
s051933231 | p00899 | u467175809 | 1530178737 | Python | Python | py | Runtime Error | 0 | 0 | 1916 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
a = 0
for i in range(2 ** 100):
a += i
input_ = ... |
s730805989 | p00899 | u467175809 | 1530178784 | Python | Python | py | Runtime Error | 0 | 0 | 1902 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
a = 0
while True:
a += 1
input_ = list(reversed(... |
s972655483 | p00899 | u467175809 | 1530178981 | Python | Python | py | Runtime Error | 0 | 0 | 1956 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
DP = [[1e9 for i in range((2 ** N))] for j in range(N)]
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input_ ... |
s690757765 | p00899 | u467175809 | 1530179020 | Python | Python | py | Runtime Error | 0 | 0 | 1958 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
DP = [[1e9 for i in range((2 ** 14))] for j in range(14)]
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input... |
s548803951 | p00899 | u467175809 | 1530179227 | Python | Python | py | Runtime Error | 0 | 0 | 2002 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
DP = [[1e9 for i in range((2 ** 14))] for j in range(14)]
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
if S == '0':
break
input... |
s481138522 | p00899 | u467175809 | 1530179590 | Python | Python | py | Runtime Error | 0 | 0 | 1979 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
DP = [[1e9 for i in range((2 ** 14))] for j in range(14)]
R = [range(2 ** i) for i in range(14)]
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
i... |
s592984943 | p00899 | u467175809 | 1530180053 | Python | Python | py | Runtime Error | 0 | 0 | 1979 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
DP = [[1e9 for i in range((2 ** 15))] for j in range(15)]
R = [range(2 ** i) for i in range(15)]
def hoge():
input_ = []
while True:
S = raw_input()
input_.append(S)
i... |
s421386567 | p00906 | u509278866 | 1529915103 | Python | Python3 | py | Runtime Error | 0 | 0 | 1447 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [int(x) for x in sys.stdin.... |
s158654014 | p00906 | u509278866 | 1529917150 | Python | Python3 | py | Runtime Error | 0 | 0 | 2885 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [int(x) for x in sys.stdin.... |
s260611928 | p00906 | u509278866 | 1529917478 | Python | Python3 | py | Runtime Error | 0 | 0 | 2881 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [int(x) for x in sys.stdin.... |
s052473099 | p00906 | u509278866 | 1529917604 | Python | Python3 | py | Runtime Error | 0 | 0 | 936 | # ittan copy & paste
def mul(A, B, N, M):
result = [[0]*N for i in range(N)]
for i in range(N):
for j in range(N):
tmp = 0
for k in range(N):
tmp += A[i][k] * B[k][j]
tmp %= M
result[i][j] = tmp
return result
while 1:
N, M, A... |
s577976815 | p00906 | u633068244 | 1399618932 | Python | Python | py | Runtime Error | 39870 | 4216 | 277 | while 1:
N,M,A,B,C,T = map(int,raw_input().split())
if N == 0: break
S = [0] + map(int,raw_input().split()) + [0]
t = 0
while t < T:
SS = [0]*(N + 2)
for i in range(1,N+1):
SS[i] = (A*S[i-1] + B*S[i] + C*S[i+1])%M
S = SS
t += 1
print " ".join(map(str,S[1:-1])) |
s647035030 | p00907 | u467175809 | 1530608184 | Python | Python3 | py | Runtime Error | 0 | 0 | 20 | import numpy as np
|
s244230929 | p00909 | u260980560 | 1510331849 | Python | Python3 | py | Runtime Error | 0 | 0 | 824 | def root(x):
if x == parent[x]:
return x
y = root(parent[x])
relative[x] += relative[parent[x]]
parent[x] = y
return y
def unite(a, b, w):
pa = root(a); pb = root(b)
if pa < pb:
parent[pb] = pa
relative[pb] = relative[a] + w
else:
parent[pa] = pb
r... |
s959954627 | p00909 | u792145349 | 1517477373 | Python | Python3 | py | Runtime Error | 0 | 0 | 1643 | class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n + 1)
self.weight = [0] * (n+1)
# 検索
def find(self, x):
if self.par[x] == x:
return x
else:
self.weight[x] += self.weight[self.par[x]]
... |
s602470618 | p00910 | u260980560 | 1510328425 | Python | Python3 | py | Runtime Error | 40000 | 9424 | 1762 | from itertools import product
def dist2(x0, y0, z0, x1, y1, z1):
return (x0 - x1)**2 + (y0 - y1)**2 + (z0 - z1)**2
def dot(x0, y0, z0, x1, y1, z1):
return x0*x1 + y0*y1 + z0*z1
def cross2(x0, y0, z0, x1, y1, z1):
return (y0*z1 - y1*z0)**2 + (z0*x1 - z1*x0)**2 + (x0*y1 - x1*y0)**2
while 1:
N, M, R = ma... |
s686576203 | p00910 | u260980560 | 1510329016 | Python | Python3 | py | Runtime Error | 40000 | 9356 | 1719 | from itertools import product
def dist2(x0, y0, z0, x1, y1, z1):
return (x0 - x1)**2 + (y0 - y1)**2 + (z0 - z1)**2
def dot(x0, y0, z0, x1, y1, z1):
return x0*x1 + y0*y1 + z0*z1
def cross2(x0, y0, z0, x1, y1, z1):
return (y0*z1 - y1*z0)**2 + (z0*x1 - z1*x0)**2 + (x0*y1 - x1*y0)**2
while 1:
N, M, R = ma... |
s757246880 | p00910 | u260980560 | 1510329270 | Python | Python3 | py | Runtime Error | 40000 | 9372 | 1811 | from itertools import product
from sys import stdin, stdout
readline = stdin.readline
write = stdout.write
def dist2(x0, y0, z0, x1, y1, z1):
return (x0 - x1)**2 + (y0 - y1)**2 + (z0 - z1)**2
def dot(x0, y0, z0, x1, y1, z1):
return x0*x1 + y0*y1 + z0*z1
def cross2(x0, y0, z0, x1, y1, z1):
return (y0*z1 - ... |
s522234784 | p00914 | u731235119 | 1422155924 | Python | Python | py | Runtime Error | 0 | 0 | 294 | while 1:
n, k, s = map(int,raw_input().split())
if (n, k, s) == (0, 0, 0):
break
dp = [[0 for i in range(s)] for j in range(k)]
for x in range(1,n+1):
for j in range(k-1):
for i in range(s-x):
if dp[j+1][i] >= 1:
dp[j][i+x] += dp[j+1][i]
dp[k-1][x-1] = 1
print dp[0][s-1] |
s399826690 | p00920 | u647766105 | 1393758091 | Python | Python | py | Runtime Error | 39860 | 23672 | 779 | #Longest Chain: O(n^2)
def R(A, B):
a, b = A, B
C, M = ~(1 << 31), (1 << 16) - 1
while True:
a = 3696 * (a & M) + (a >> 16)
b = 1800 * (b & M) + (b >> 16)
yield (C & ((a << 16) + b)) % 1000000
def check(p1, p2):
return all(map(lambda (x, y): x <= y, zip(p1, p2)))
def solve():
... |
s761755013 | p00920 | u647766105 | 1397033368 | Python | Python | py | Runtime Error | 39860 | 75968 | 1068 | #Longest Chain: O(NlogN + ??)
def R(A, B):
a, b = A, B
C, M = ~(1 << 31), (1 << 16) - 1
while True:
a = 3696 * (a & M) + (a >> 16)
b = 1800 * (b & M) + (b >> 16)
yield (C & ((a << 16) + b)) % 1000000
def compare(a, b):
return all(aa < bb for aa, bb in zip(a, b))
def upper_boun... |
s320400392 | p00935 | u546285759 | 1491214157 | Python | Python3 | py | Runtime Error | 30 | 7748 | 779 | import sys
n = int(input())
length = int(n / 19) + 1
d = []
for i in range(length):
d += list(map(int, input().split()))
start, end = 1, 10
l = []
flag = False
for j in range(1, len(d)+1):
for i in range(0, len(d)):
tmp = ''.join(map(str, d[i:i+j]))
if len(tmp) > 1 and tmp[0] == '0':
... |
s522109018 | p00935 | u546285759 | 1491214602 | Python | Python3 | py | Runtime Error | 30 | 7784 | 770 | n = int(input())
length = int(n / 19) + 1
d = []
for i in range(length):
d += list(map(int, input().split()))
start, end = 1, 10
l = []
flag = False
for j in range(1, len(d)+1):
for i in range(0, len(d)):
tmp = ''.join(map(str, d[i:i+j]))
if len(tmp) > 1 and tmp[0] == '0':
pass
... |
s366303400 | p00935 | u728992264 | 1491833835 | Python | Python3 | py | Runtime Error | 30 | 7600 | 142 | n=int(input())
d=''.join([''.join(input().split())for i in range(n//19+1)])
i=0
while True:
if d.find(str(i))==-1:
print(i)
exit()
i+=1 |
s636025174 | p00943 | u078042885 | 1486575616 | Python | Python3 | py | Runtime Error | 0 | 0 | 167 | n,m=map(int,input().split())
a=[0]*(n+1);
b=[int(input()) for _ in range(m)]
for x in b[::-1]:
if a[x]==0:a[x]=1;print(x)
[print(i)for i in range(1,n+1)if a[i]==0] |
s196829264 | p00949 | u467175809 | 1530004187 | Python | Python | py | Runtime Error | 11670 | 1172916 | 524 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
S1 = raw_input()
S2 = raw_input()
m = {}
for i in range(len(S1)):
val = 0
for j in range(i, len(S1)):
val += 10000 ** (ord(S1[j]) - ord('a'))
m[val] = j - i + 1
ans = 0
for... |
s762781666 | p00949 | u467175809 | 1530004229 | Python | Python | py | Runtime Error | 11410 | 852112 | 525 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
S1 = raw_input()
S2 = raw_input()
m = {}
for i in range(len(S1)):
val = 0
for j in range(i, len(S1)):
val += 10000 ** (ord(S1[j]) - ord('a'))
m[hash(val)] = j - i + 1
ans = ... |
s066754776 | p00962 | u260980560 | 1514554873 | Python | Python3 | py | Runtime Error | 0 | 0 | 2043 | from heapq import heappush, heappop
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
E = []
G = [[] for i in range(n)]
RG = [[] for i in range(n)]
for i in range(m):
a, b, c = map(int, input().split())
E.append((a-1, b-1, c))
G[a-1].append((b-1, c, i))
... |
s758569233 | p00962 | u260980560 | 1514554960 | Python | Python3 | py | Runtime Error | 0 | 0 | 2027 | from heapq import heappush, heappop
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
E = []
G = [[] for i in range(n)]
RG = [[] for i in range(n)]
for i in range(m):
a, b, c = map(int, input().split())
E.append((a-1, b-1, c))
G[a-1].append((b-1, c, i))
... |
s298480504 | p00962 | u260980560 | 1514555104 | Python | Python3 | py | Runtime Error | 0 | 0 | 2027 | from heapq import heappush, heappop
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
E = []
G = [[] for i in range(n)]
RG = [[] for i in range(n)]
for i in range(m):
a, b, c = map(int, input().split())
E.append((a-1, b-1, c))
G[a-1].append((b-1, c, i))
... |
s732088672 | p00962 | u260980560 | 1514555382 | Python | Python3 | py | Runtime Error | 0 | 0 | 2102 | from heapq import heappush, heappop
from collections import deque
import sys
sys.setrecursionlimit(5*10**5)
n, m = map(int, input().split())
E = []
G = [[] for i in range(n)]
RG = [[] for i in range(n)]
for i in range(m):
while 1:
try:
a, b, c = map(int, input().split())
break
... |
s373972886 | p00962 | u260980560 | 1514555761 | Python | Python3 | py | Runtime Error | 0 | 0 | 2119 | from heapq import heappush, heappop
from collections import deque
import sys
sys.setrecursionlimit(10**6)
*ipts, = map(int, open(0).read().split())
n, m = ipts[:2]
#n, m = map(int, input().split())
E = []
G = [[] for i in range(n)]
RG = [[] for i in range(n)]
for i in range(m):
#a, b, c = map(int, input().split())
... |
s555058570 | p00966 | u260980560 | 1514547083 | Python | Python3 | py | Runtime Error | 90 | 6684 | 1073 | from bisect import bisect
n, a, b, q = map(int, input().split())
W = [input().split() for i in range(a)]
X = [int(x) for x, c in W]
C = [c for x, c in W]
P = [list(map(int, input().split())) for i in range(b)]
Y = [y for y, h in P] + [n+1]
D = [0]*b
for i in range(b):
y0, h = P[i]
y1 = Y[i+1]
l = y1 - y0... |
s033881197 | p00991 | u186082958 | 1480443090 | Python | Python3 | py | Runtime Error | 50 | 7844 | 307 | def func (x):
if x:
return int(x)*func(x-1)
else:
return (1)
def comb (x,y):
return func(x)//func(x-y)//func(y)
w,h,ax,ay,bx,by=map(int,input().split())
dx=min(w-abs(ax-bx),abs(ax-bx))
dy=min(h-abs(ay-by),abs(ay-by))
ans=1
if dx*2==w:ans*=2
if dy*2==h:ans*=2
ans*=comb(dx+dy,dx)
print(ans%100000007) |
s656843945 | p00991 | u186082958 | 1480443832 | Python | Python3 | py | Runtime Error | 0 | 0 | 267 | import math
def comb (x,y):
return factorial(x)//factorial(x-y)//factorial(y)
w,h,ax,ay,bx,by=map(int,input().split())
dx=min(w-abs(ax-bx),abs(ax-bx))
dy=min(h-abs(ay-by),abs(ay-by))
ans=1
if dx*2==w:ans*=2
if dy*2==h:ans*=2
ans*=comb(dx+dy,dx)
print(ans%100000007) |
s438399428 | p00992 | u696166817 | 1410700496 | Python | Python | py | Runtime Error | 0 | 0 | 567 | n = int(input())
# print("n:",n)
hl = []
for i in range(n):
hl.append(int(input()))
#print(hl)
#hl = [5, 5]
#hl = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
# hl = [1,2,3,4,5]
#hl = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
i = 0
ans = 1
"""
for h in hl:
d = i/... |
s446591472 | p00993 | u399892098 | 1511248959 | Python | Python | py | Runtime Error | 30 | 6504 | 751 | import math
li = [i for i in xrange(4,1501)]
def prime_check(num):
temp = 1
flag = False
while True:
temp += 1
if(temp > math.sqrt(num)):
break
if(num % temp == 0):
flag = True
break
return flag
for i in li:
if(prime_check(i) == False):
... |
s558493573 | p00993 | u399892098 | 1511249050 | Python | Python | py | Runtime Error | 10 | 7204 | 7088 | import math
li = [4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 102, 104... |
s974364221 | p01000 | u847467233 | 1531457685 | Python | Python3 | py | Runtime Error | 0 | 0 | 1252 | # AOJ 1510 Independent Research
# Python3 2018.7.13 bal4u
mv = [[-1,-1,-1],[-1,-1,0],[-1,-1,1],[-1,0,-1],[-1,0,0],[-1,0,1],[-1,1,-1],[-1,1,0],[-1,1,1],
[0,-1,-1],[0,-1,0],[0,-1,1],[0,0,-1],[0,0,1],[0,1,-1],[0,1,0],[0,1,1],
[1,-1,-1],[1,-1,0],[1,-1,1],[1,0,-1],[1,0,0],[1,0,1],[1,1,-1],[1,1,0],[1,1,1]]
... |
s276344889 | p01000 | u847467233 | 1531458012 | Python | Python3 | py | Runtime Error | 2240 | 5644 | 1262 | # AOJ 1510 Independent Research
# Python3 2018.7.13 bal4u
mv = [[-1,-1,-1],[-1,-1,0],[-1,-1,1],[-1,0,-1],[-1,0,0],[-1,0,1],[-1,1,-1],[-1,1,0],[-1,1,1],
[0,-1,-1],[0,-1,0],[0,-1,1],[0,0,-1],[0,0,1],[0,1,-1],[0,1,0],[0,1,1],
[1,-1,-1],[1,-1,0],[1,-1,1],[1,0,-1],[1,0,0],[1,0,1],[1,1,-1],[1,1,0],[1,1,1]]
... |
s098882809 | p01006 | u605365762 | 1478082397 | Python | Python | py | Runtime Error | 0 | 0 | 1218 | # -*- coding:utf-8 -*-
import sys
def main():
data = []
while(True):
line = raw_input()
if not line: break
data.append(line)
for answer in proc(data):
print answer
def proc(data):
return [passwd for passwd in data if is_hitofude(passwd)]
def is_hitofude(text):
for ... |
s335409842 | p01006 | u605365762 | 1478082508 | Python | Python | py | Runtime Error | 0 | 0 | 1231 | # -*- coding:utf-8 -*-
import sys
def main():
data = []
while(True):
line = raw_input()
if not line: break
data.append(line)
for answer in proc(data):
print answer
return 0
def proc(data):
return [passwd for passwd in data if is_hitofude(passwd)]
def is_hitofude(te... |
s554284939 | p01006 | u605365762 | 1478082639 | Python | Python | py | Runtime Error | 0 | 0 | 1231 | # -*- coding:utf-8 -*-
import sys
def main():
data = []
while(True):
line = raw_input()
if not line: break
data.append(line)
for answer in proc(data):
print answer
return 0
def proc(data):
return [passwd for passwd in data if is_hitofude(passwd)]
def is_hitofude(te... |
s275221049 | p01006 | u605365762 | 1478082711 | Python | Python | py | Runtime Error | 0 | 0 | 1208 | import sys
def main():
data = []
while(True):
line = raw_input()
if not line: break
data.append(line)
for answer in proc(data):
print answer
return 0
def proc(data):
return [passwd for passwd in data if is_hitofude(passwd)]
def is_hitofude(text):
for first, sec... |
s029438092 | p01006 | u633068244 | 1397005662 | Python | Python | py | Runtime Error | 0 | 0 | 214 | ref={"A":"BD","B":"ACE","C":"BF","D":"AEG","E":"BDFH","F":"CEI","G":"DH","H":"EGI","J":"HF"}
for i in range(1000):
p=raw_input()
for i in range(len(p)-1):
if p[i+1] not in ref[p[i]]:
break
else:
print p
|
s485008599 | p01008 | u847467233 | 1531466911 | Python | Python3 | py | Runtime Error | 410 | 5612 | 303 | # AOJ 1518: Last One
# Python3 2018.7.13 bal4u
ans = 0;
n = int(input())
for i in range(n):
p, ms = input().split();
ms = list(ms)
s = 0
for m in ms:
if m.isdigit(): s += int(m)
elif m.isupper(): s += ord(m)-ord('A')+10
else: s += ord(m)-ord('a')+36
ans ^= s
print("win" if ans else "lose")
|
s062955929 | p01040 | u539753516 | 1535989202 | Python | Python3 | py | Runtime Error | 30 | 6048 | 236 | import datetime
y1,m1,d1,y2,m2,d2=map(int,input().split())
q=(y2-y1)//400
y2-=400*q
a=688*q
d=datetime.date(y1,m1,d1)
while d<=datetime.date(y2,m2,d2):
if d.day==13 and d.weekday()==4:a+=1
d+=datetime.timedelta(days=1)
print(a)
|
s381107673 | p01040 | u539753516 | 1535989266 | Python | Python3 | py | Runtime Error | 30 | 6044 | 236 | import datetime
y1,m1,d1,y2,m2,d2=map(int,input().split())
q=(y2-y1)//400
y2-=400*q
a=688*q
d=datetime.date(y1,m1,d1)
while d<=datetime.date(y2,m2,d2):
if d.day==13 and d.weekday()==4:a+=1
d+=datetime.timedelta(days=1)
print(a)
|
s472119324 | p01048 | u885631908 | 1442946655 | Python | Python3 | py | Runtime Error | 20 | 7636 | 359 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
i = 1
num = [0] * 13 #num[i] -> ?´???°???i???????????°??§????°??????°
while True:
cnt = 0
for j in range(1, i+1):
if i % j == 0:
cnt += 1
if num[cnt] == 0:
num[cnt] = i
if num[n] > 0:
ans = num[n]
... |
s691926428 | p01052 | u847467233 | 1531481277 | Python | Python3 | py | Runtime Error | 20 | 5600 | 362 | # AOJ 1566 Movie
# Python3 2018.7.13 bal4u
n = int(input())
tbl = []
for i in range(n):
a, b = map(int, input().split())
tbl.append([b, a])
tbl.sort()
ans = saw = 0
seen = [0]*32
for i in range(1, 32):
for j in range(n):
if i < tbl[j][1] or tbl[j][0] < i: continue
if seen[j]: continue
ans += 100; seen[j] = 1;... |
s141453435 | p01085 | u946263060 | 1530610989 | Python | Python3 | py | Runtime Error | 0 | 0 | 338 | N = input().split(" ")
a = [input() for i in range(int(N[0]))]
ma =int(N[2])
mi =int(N[1])
gap = []
x = mi
while x != ma + 1:
value = int(a[x - 1]) - int(a[x])
gap.append(value)
x = x + 1
import numpy as np
gapIndex = np.array(gap)
maxIndex = [i for i, x in enumerate(gapIndex) if x == max(gapIndex)]
print(int(... |
s636481102 | p01085 | u946263060 | 1530613319 | Python | Python3 | py | Runtime Error | 0 | 0 | 546 | import numpy as np
while true:
N = input().split(" ")
if N[0] == 0:
break
a = [input() for i in range(int(N[0]))]
print(N)
print(a)
#b = int(a[int(N[1]) - 1]) - int(a[int(N[1])])
#print(b)
ma = int(N[2])
mi = int(N[1])
gap = []
x = mi
while x != ma + 1:
va... |
s523785562 | p01085 | u100935362 | 1530663920 | Python | Python3 | py | Runtime Error | 0 | 0 | 504 | head = input().split(" ")
while head != "0 0 0":
num = int(head[0])
mini = int(head[1])
maxi = int(head[2])
scores = []
gaps = []
for i in range(int(head[0])):
scores.append(int(input()))
for i in range(mini, maxi):
oks = scores[:i]
ngs = scores[i:]
g... |
s887273046 | p01085 | u100935362 | 1530664538 | Python | Python3 | py | Runtime Error | 0 | 0 | 527 | head = input().split(" ")
while head != "0 0 0":
num = int(head[0])
mini = int(head[1])
maxi = int(head[2])
scores = []
gaps = []
for _ in range(int(head[0])):
scores.append(int(input()))
for i in range(mini, maxi + 1):
oks = scores[:i]
ngs = scores[i:]
... |
s139021500 | p01085 | u100935362 | 1530664642 | Python | Python3 | py | Runtime Error | 0 | 0 | 531 | head = input().split(" ")
while head != "0 0 0":
num = int(head[0])
mini = int(head[1])
maxi = int(head[2])
scores = []
gaps = []
for _ in range(int(head[0]) + 1):
scores.append(int(input()))
for i in range(mini, maxi + 1):
oks = scores[:i]
ngs = scores[i:]
... |
s192556215 | p01085 | u100935362 | 1530664887 | Python | Python3 | py | Runtime Error | 0 | 0 | 628 | answers = []
while True:
head = input()
if head == "0 0 0":
break
nums = head.split(" ")
num = int(head[0])
mini = int(head[1])
maxi = int(head[2])
scores = []
gaps = []
for _ in range(int(head[0])):
scores.append(int(input()))
for i in range(mini, maxi +... |
s025189554 | p01085 | u100935362 | 1530664917 | Python | Python3 | py | Runtime Error | 0 | 0 | 628 | answers = []
while True:
head = input()
if head == "0 0 0":
break
nums = head.split(" ")
num = int(nums[0])
mini = int(nums[1])
maxi = int(nums[2])
scores = []
gaps = []
for _ in range(int(head[0])):
scores.append(int(input()))
for i in range(mini, maxi +... |
s589918536 | p01085 | u100935362 | 1530665231 | Python | Python3 | py | Runtime Error | 0 | 0 | 671 | answers = []
while True:
head = input()
if head == "0 0 0":
break
nums = head.split(" ")
num = int(nums[0])
mini = int(nums[1])
maxi = int(nums[2])
scores = []
gaps = []
for _ in range(int(head[0])):
scores.append(int(input()))
for i in range(mini, maxi +... |
s786122745 | p01086 | u572046143 | 1527956780 | Python | Python3 | py | Runtime Error | 0 | 0 | 1335 | def main():
while True:
n = int(input().strip())
if n == 0:
break
phrases = []
for _ in range(n):
word = input().strip()
phrases.append(word)
PHRASE_LEN = [5,7,5,7,7]
found_flag = False
for i in range(n):
acc... |
s047049858 | p01086 | u572046143 | 1527956866 | Python | Python3 | py | Runtime Error | 0 | 0 | 1335 | def main():
while True:
n = int(input().strip())
if n == 0:
break
phrases = []
for _ in range(n):
word = input().strip()
phrases.append(word)
PHRASE_LEN = [5,7,5,7,7]
found_flag = False
for i in range(n):
acc... |
s390056250 | p01087 | u724963150 | 1496327175 | Python | Python3 | py | Runtime Error | 0 | 0 | 1379 | while True:
n=int(input())
if n==0:
break;
li=[input() for i in range(n)]
index=0
def pls(depth):
k=0
global index
while len(li[index])>depth and li[index][depth-1]=='.':
if (not li[index][depth]=='+') and (not li[index][depth]=='*'):
k+=in... |
s247136782 | p01087 | u731941832 | 1530458160 | Python | Python3 | py | Runtime Error | 0 | 0 | 824 | while True:
n = int(input())
if n == 0:break
a = [input() for _ in range(n)]
while True:
if len(a) == 1:break
c = 0
s = 0
for i in range(len(a)):
if a[i].count('.') > c:
c = a[i].count('.')
s = i
e = s
while e < ... |
s680831152 | p01087 | u731941832 | 1530458477 | Python | Python3 | py | Runtime Error | 0 | 0 | 807 | while True:
n = int(input())
if n == 0:break
a = [input() for _ in range(n)]
while True:
if len(a) == 1:break
c = 0
s = 0
for i in range(len(a)):
if a[i].count('.') > c:
c = a[i].count('.')
s = i
e = s
while e < ... |
s925622797 | p01087 | u731941832 | 1530458526 | Python | Python3 | py | Runtime Error | 0 | 0 | 814 | while True:
n = int(input())
if n == 0:break
a = [input() for _ in range(n)]
while True:
if len(a) == 1:break
c = 0
s = 0
for i in range(len(a)):
if a[i].count('.') > c:
c = a[i].count('.')
s = i
e = s
while e < ... |
s516783726 | p01087 | u467175809 | 1530533849 | Python | Python | py | Runtime Error | 0 | 0 | 1096 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
while True:
n = input()
lst = []
if n == 0:
break
if n == 1:
num = input()
print num
continue
for loop in range(n):
S = raw_input()
lst.append((len(S), ... |
s225659316 | p01088 | u659302741 | 1479646266 | Python | Python3 | py | Runtime Error | 40000 | 156120 | 3326 | from operator import itemgetter
def compute(prices, max_sum_having_coin):
"""
DP
t?????????????????????????????????????????????????????£???????????????t??¨?????¶???
????????§??????????????\???????????????
??????t???????????????500?????????????????°???ct???????????\????????¬??¨???????¨????st??§?????... |
s787818687 | p01088 | u659302741 | 1479652250 | Python | Python3 | py | Runtime Error | 40000 | 84348 | 3772 | from operator import itemgetter
def compare(state1, state2):
if state1 == None:
return False
if state2 == None:
return True
return state1[0] > state2[0] or (state1[0] == state2[0] and state1[1] < state2[1])
def compute(prices, max_sum_having_coin):
"""
DP
t?????????????????????... |
s055263711 | p01088 | u408260374 | 1495271269 | Python | Python3 | py | Runtime Error | 40000 | 198036 | 887 | MAX_COINS = 500 * 100
INF = 10 ** 9
def dfs(idx, coins):
if idx == N:
return 0, 0
elif dp[idx][coins] != -1:
return dp[idx][coins]
ret = (0, -INF)
# not buy
ret = max(ret, dfs(idx + 1, coins))
# buy using only bills
change = (1000 - P[idx] % 1000) % 1000
cand, money ... |
s249232320 | p01088 | u408260374 | 1495271393 | Python | Python | py | Runtime Error | 40000 | 197036 | 961 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
MAX_COINS = 500 * 100
INF = 10 ** 9
def dfs(idx, coins):
if idx == N:
return 0, 0
elif dp[idx][coins] != -1:
return dp[idx][coins]
ret = (0, -INF)
# not buy
ret = max(ret, dfs(idx + 1, coins))
# buy us... |
s727032503 | p01088 | u408260374 | 1495271478 | Python | Python3 | py | Runtime Error | 40000 | 198080 | 992 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
sys.setrecursionlimit(10 ** 6)
MAX_COINS = 500 * 100
INF = 10 ** 9
def dfs(idx, coins):
if idx == N:
return 0, 0
elif dp[idx][coins] != -1:
return dp[idx][coins]
ret = (0, -INF)
# not buy
ret = max(ret, dfs... |
s301182263 | p01088 | u408260374 | 1495271529 | Python | Python | py | Runtime Error | 40000 | 196968 | 992 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
sys.setrecursionlimit(10 ** 6)
MAX_COINS = 500 * 100
INF = 10 ** 9
def dfs(idx, coins):
if idx == N:
return 0, 0
elif dp[idx][coins] != -1:
return dp[idx][coins]
ret = (0, -INF)
# not buy
ret = max(ret, dfs... |
s232447923 | p01088 | u339921062 | 1499236979 | Python | Python | py | Runtime Error | 0 | 0 | 876 | while 1:
n = input()
if n == 0:
break
dp = [[None]*2001 for i in xrange(n+1)]
dp[0][0] = (0, 0)
for i in xrange(n):
cost = int(raw_input())
dost = cost % 1000
for j in xrange(2001):
if dp[i][j] is None:
continue
c, s = dp[i][j]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.