s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s942051716 | p01371 | u109084363 | 1361955653 | Python | Python | py | Runtime Error | 19930 | 4616 | 749 | import sys
import collections
sys.setrecursionlimit(10000)
while True:
N = int(raw_input())
if N == 0:
break
time = []
for i in xrange(N):
time.append(map(int, raw_input().split()))
def dp(state):
L = len(state)
if L <= 1:
return time[state[0]][0]
else:
temp = []
for i in state:
copy = state[:]
copy.remove(i)
min_time = time[i][0]
for j in xrange(len(time[i])):
if j in copy:
min_time = min(min_time, time[i][j + 1])
temp.append(dp(copy) + min_time)
return min(temp)
state = range(N)
print dp(state) | File "/tmp/tmpvk1fs_4o/tmpqppz5vm4.py", line 31
print dp(state)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s478974746 | p01371 | u109084363 | 1362900710 | Python | Python | py | Runtime Error | 20000 | 4612 | 719 | import sys
import collections
while True:
N = int(raw_input())
if N == 0:
break
time = []
for i in xrange(N):
time.append(map(int, raw_input().split()))
def dp(state):
L = len(state)
if L <= 1:
return time[state[0]][0]
else:
temp = []
for i in state:
copy = state[:]
copy.remove(i)
min_time = time[i][0]
for j in xrange(len(time[i])):
if j in copy:
min_time = min(min_time, time[i][j + 1])
temp.append(dp(copy) + min_time)
return min(temp)
state = range(N)
print dp(state) | File "/tmp/tmpdt418itw/tmpztsghaul.py", line 29
print dp(state)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s643058756 | p01371 | u109084363 | 1362902300 | Python | Python | py | Runtime Error | 20000 | 4616 | 723 | import sys
import collections
while True:
N = int(raw_input())
if N == 0:
break
time = []
for i in xrange(N):
time.append(map(int, raw_input().split()))
def dp(state):
L = len(state)
if L <= 1:
return time[state[0]][0]
else:
temp = []
for i in state:
copy = state[:]
copy.remove(i)
min_time = time[i][0]
for j in xrange(len(time[i]) - 1):
if j in copy:
min_time = min(min_time, time[i][j + 1])
temp.append(dp(copy) + min_time)
return min(temp)
state = range(N)
print dp(state) | File "/tmp/tmpnw0x4ckf/tmp3gi0pzs8.py", line 29
print dp(state)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s932863322 | p01371 | u109084363 | 1362903237 | Python | Python | py | Runtime Error | 20000 | 18300 | 869 | import sys
import collections
while True:
N = int(raw_input())
if N == 0:
break
time = []
for i in xrange(N):
time.append(map(int, raw_input().split()))
memo = {}
def dp(state):
if tuple(state) in memo:
return memo[tuple(state)]
L = len(state)
if L <= 1:
return time[state[0]][0]
else:
temp = []
for i in state:
copy = state[:]
copy.remove(i)
min_time = time[i][0]
for j in xrange(len(time[i]) - 1):
if j in copy:
min_time = min(min_time, time[i][j + 1])
temp.append(dp(copy) + min_time)
memo[tuple(state)] = min(temp)
return memo[tuple(state)]
state = range(N)
print dp(state) | File "/tmp/tmpbyblg1my/tmpuzags1nx.py", line 34
print dp(state)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s146657557 | p01376 | u633068244 | 1398863452 | Python | Python | py | Runtime Error | 0 | 0 | 93 | print max([sum(map(int,raw_input().split())) for i in range(map(int,raw_input().split())[0])] | File "/tmp/tmp3iupof24/tmp1b0coyjo.py", line 1
print max([sum(map(int,raw_input().split())) for i in range(map(int,raw_input().split())[0])]
^
SyntaxError: '(' was never closed
| |
s294866696 | p01379 | u586434734 | 1422635421 | Python | Python | py | Runtime Error | 80 | 28644 | 2382 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from random import random
import sys
# 再帰の最大回数を設定
LIMIT = 100000
sys.setrecursionlimit(LIMIT)
LEFT = (-1, 0)
RIGHT = (1, 0)
UP = (0, -1)
DOWN = (0, 1)
NONE = (0, 0)
def main():
# 入力
(R, C) = map(int, raw_input().split())
data = [raw_input() for x in xrange(R)]
print(defunga(data, R, C))
def defunga(data, R, C):
mem = [0]
memoize = set()
def nextState(operator, state):
if operator == '<':
return LEFT
elif operator == '>':
return RIGHT
elif operator == '^':
return UP
elif operator == 'v':
return DOWN
elif operator == '_':
if mem[0] == 0:
return RIGHT
else:
return LEFT
elif operator == '|':
if mem[0] == 0:
return DOWN
else:
return UP
elif operator == '.':
return state
elif operator == '+':
if mem[0] == 15:
mem[0] = 0
else:
mem[0] += 1
return state
elif operator == '-':
if mem[0] == 0:
mem[0] = 15
else:
mem[0] -= 1
return state
else:
mem[0] = int(operator)
return state
def searchStop(xy, state):
operator = data[xy[1]][xy[0]]
if operator == '@':
return 'YES'
if operator == '?':
ret = [searchStop(moveXY(xy, x), x) for x in [RIGHT, LEFT, UP, DOWN]]
if 'YES' in ret:
return 'YES'
else:
return 'NO'
if (xy, state, mem[0]) in memoize:
return 'NO'
memoize.add((xy, state, mem[0]))
next_state = nextState(operator, state)
next_xy = moveXY(xy, next_state)
return searchStop(next_xy, next_state)
def moveXY(xy, next_state):
return xychech(*map(sum, zip(xy, next_state)))
def xychech(x, y):
x_ = x
y_ = y
if x < 0:
x_ = x + C
elif x >= C:
x_ = x - C
if y < 0:
y_ = y + R
elif y >= R:
y_ = y - R
return (x_, y_)
return searchStop((0, 0), RIGHT)
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpaa7cvf1m/tmpuiegd30c.py", line 105, in <module>
main()
File "/tmp/tmpaa7cvf1m/tmpuiegd30c.py", line 19, in main
(R, C) = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s744630600 | p01379 | u586434734 | 1422636360 | Python | Python | py | Runtime Error | 80 | 28376 | 2397 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from random import random
import sys
# 再帰の最大回数を設定
LIMIT = 100000
sys.setrecursionlimit(LIMIT)
LEFT = (-1, 0)
RIGHT = (1, 0)
UP = (0, -1)
DOWN = (0, 1)
NONE = (0, 0)
def main():
# 入力
(R, C) = map(int, raw_input().split())
data = [raw_input() for x in xrange(R)]
print(defunga(data, R, C))
def defunga(data, R, C):
mem = [0]
memoize = set()
def nextState(operator, state):
if operator == '<':
return LEFT
elif operator == '>':
return RIGHT
elif operator == '^':
return UP
elif operator == 'v':
return DOWN
elif operator == '_':
if mem[0] == 0:
return RIGHT
else:
return LEFT
elif operator == '|':
if mem[0] == 0:
return DOWN
else:
return UP
elif operator == '.':
return state
elif operator == '+':
if mem[0] == 15:
mem[0] = 0
else:
mem[0] += 1
return state
elif operator == '-':
if mem[0] == 0:
mem[0] = 15
else:
mem[0] -= 1
return state
else:
mem[0] = int(operator)
return state
def searchStop(xy, state):
while(True):
operator = data[xy[1]][xy[0]]
if operator == '@':
return 'YES'
if operator == '?':
ret = [searchStop(moveXY(xy, x), x) for x in [RIGHT, LEFT, UP, DOWN]]
if 'YES' in ret:
return 'YES'
else:
return 'NO'
if (xy, state, mem[0]) in memoize:
return 'NO'
memoize.add((xy, state, mem[0]))
state = nextState(operator, state)
xy = moveXY(xy, state)
def moveXY(xy, next_state):
return xychech(*map(sum, zip(xy, next_state)))
def xychech(x, y):
x_ = x
y_ = y
if x < 0:
x_ = x + C
elif x >= C:
x_ = x - C
if y < 0:
y_ = y + R
elif y >= R:
y_ = y - R
return (x_, y_)
return searchStop((0, 0), RIGHT)
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpahrmdda_/tmp1vjzq9d0.py", line 105, in <module>
main()
File "/tmp/tmpahrmdda_/tmp1vjzq9d0.py", line 19, in main
(R, C) = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s884227934 | p01379 | u724548524 | 1526783298 | Python | Python3 | py | Runtime Error | 1850 | 8244 | 1251 | import random
h, w = map(int, input().split())
area = [input() for _ in range(h)]
xyds = [[0, 0, 1, 0, 0]]
for _ in range(1000000):
for xyd in xyds:
x = xyd[0]
y = xyd[1]
if area[y][x] == "<":xyd[2], xyd[3] = -1, 0
elif area[y][x] == ">":xyd[2], xyd[3] = 1, 0
elif area[y][x] == "^":xyd[2], xyd[3] = 0, -1
elif area[y][x] == "v":xyd[2], xyd[3] = 0, 1
elif area[y][x] == "_":xyd[2], xyd[3] = 1, 0 if m == 0 else -1, 0
elif area[y][x] == "|":xyd[2], xyd[3] = 0, 1 if m == 0 else 0, -1
elif area[y][x] == "?":
xyds.append([(x + 1) % w, y, 1, 0, xyd[4]])
xyds.append([(x - 1) % w, y, -1, 0, xyd[4]])
xyds.append([x, (y + 1) % h, 0, 1, xyd[4]])
xyds.append([x, (y - 1) % h, 0, -1, xyd[4]])
xyds.remove(xyd)
elif area[y][x] == ".":pass
elif area[y][x] == "@":
print("YES")
break
elif area[y][x] == "+":xyd[4] = (xyd[4] + 1) % 16
elif area[y][x] == "-":xyd[4] = (xyd[4] - 1) % 16
else:xyd[4] = int(area[y][x])
xyd[0] = (x + xyd[2]) % w
xyd[1] = (y + xyd[3]) % h
else:
continue
break
else:
print("NO")
| Traceback (most recent call last):
File "/tmp/tmp2nivduu_/tmpaf2cpjjd.py", line 2, in <module>
h, w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s668580308 | p01379 | u724548524 | 1526783340 | Python | Python3 | py | Runtime Error | 1830 | 8244 | 1261 | import random
h, w = map(int, input().split())
area = [input() for _ in range(h)]
xyds = [[0, 0, 1, 0, 0]]
for _ in range(1000000):
for xyd in xyds:
x = xyd[0]
y = xyd[1]
if area[y][x] == "<":xyd[2], xyd[3] = -1, 0
elif area[y][x] == ">":xyd[2], xyd[3] = 1, 0
elif area[y][x] == "^":xyd[2], xyd[3] = 0, -1
elif area[y][x] == "v":xyd[2], xyd[3] = 0, 1
elif area[y][x] == "_":xyd[2], xyd[3] = 1, 0 if xyd[4] == 0 else -1, 0
elif area[y][x] == "|":xyd[2], xyd[3] = 0, 1 if xyd[4] == 0 else 0, -1
elif area[y][x] == "?":
xyds.append([(x + 1) % w, y, 1, 0, xyd[4]])
xyds.append([(x - 1) % w, y, -1, 0, xyd[4]])
xyds.append([x, (y + 1) % h, 0, 1, xyd[4]])
xyds.append([x, (y - 1) % h, 0, -1, xyd[4]])
xyds.remove(xyd)
elif area[y][x] == ".":pass
elif area[y][x] == "@":
print("YES")
break
elif area[y][x] == "+":xyd[4] = (xyd[4] + 1) % 16
elif area[y][x] == "-":xyd[4] = (xyd[4] - 1) % 16
else:xyd[4] = int(area[y][x])
xyd[0] = (x + xyd[2]) % w
xyd[1] = (y + xyd[3]) % h
else:
continue
break
else:
print("NO")
| Traceback (most recent call last):
File "/tmp/tmp7yz1jhq_/tmpuhxrjos7.py", line 2, in <module>
h, w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s463173876 | p01386 | u019169314 | 1529576138 | Python | Python3 | py | Runtime Error | 240 | 5640 | 1289 | # n=nodes, m=edges
n,m = map(int, input().split())
neighborCost = {i: dict() for i in range(1,n+1)}
fullCost = {i: float('inf') for i in range(1,n+1)}
fullCost[1] = 0
for i in range(m):
fro, to, cost = map(int, input().split())
try:
if cost < neighborCost[fro][to]:
neighborCost[fro][to] = cost
except KeyError:
neighborCost[fro][to] = cost
def minCostNode(fullCost, visited):
neededNodes = {node: cost for node,cost in fullCost.items() if node not in visited}
return min(neededNodes, key=neededNodes.get) if neededNodes else None
def calcFullCost(fullCost, start, goal):
visited = set()
hub = start
while hub:
for neighbor,cost in neighborCost[hub].items():
newCost = fullCost[hub] + cost
if newCost < fullCost[neighbor]:
fullCost[neighbor] = newCost
visited.add(hub)
hub = minCostNode(fullCost, visited)
fullCost = {node: float("inf") if node != goal else cost for node,cost in fullCost.items() }
# print(fullCost)
return fullCost
direction = list(range(1,n+1)) + [1]
# print(direction)
for i in range(len(direction)-1):
fullCost = calcFullCost(fullCost, direction[i], direction[i+1])
print(fullCost[1] if fullCost[1] != float('inf') else -1)
| Traceback (most recent call last):
File "/tmp/tmpf02oo5gq/tmprhfn3mwc.py", line 2, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s230396740 | p01386 | u019169314 | 1529761650 | Python | Python3 | py | Runtime Error | 160 | 6324 | 1287 | import functools as fn
import time
from collections import defaultdict
# n=nodes, m=edges
n,m = map(int, input().split())
graph = defaultdict(lambda: defaultdict(lambda: None))
for i in range(m):
fro, to, cost = map(int, input().split())
if graph[fro][to] is None or graph[fro][to] > cost:
graph[fro][to] = cost
def minCostNode(totCost, visited):
lis = totCost.items()
fil = filter(lambda t: t[0] not in visited, lis)
mi = fn.reduce(lambda a,b: a if a[1]<b[1] else b, fil, (None,float('inf')))
return mi[0] # maybe None
def dijkstra(fro, froCost, to):
visited = set()
totCost = defaultdict(lambda: None)
totCost[fro] = froCost
hub = fro
while hub and hub != to:
# time.sleep(0.1)
# print(hub,totCost.items())
for neighbor,cost in graph[hub].items():
newCost = totCost[hub] + cost
if totCost[neighbor] is None or newCost < totCost[neighbor]:
totCost[neighbor] = newCost
visited.add(hub)
hub = minCostNode(totCost, visited)
toCost = totCost[to]
return toCost # maybe None
froCost = 0
for fro, to in zip(range(1,n), range(2,n+1)):
froCost = dijkstra(fro, froCost, to)
finalCost = dijkstra(n, froCost, 1)
print(finalCost if finalCost else -1)
| Traceback (most recent call last):
File "/tmp/tmp8pytrt3g/tmpmi35u5mu.py", line 5, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s974248494 | p01388 | u633068244 | 1414922596 | Python | Python | py | Runtime Error | 0 | 0 | 47 | print min(raw_input().count(i) for i in "KUPC") | File "/tmp/tmp9nc7hk4g/tmp59oj3k_3.py", line 1
print min(raw_input().count(i) for i in "KUPC")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s860234184 | p01388 | u073628131 | 1477965469 | Python | Python3 | py | Runtime Error | 0 | 0 | 217 | # coding: utf-8
s = raw_input();
k = u = p = c = 0;
for a in s:
if a == 'K':
k += 1;
if a == 'U':
u += 1;
if a == 'P':
p += 1;
if a == 'C':
c += 1;
print min(k,u,p,c); | File "/tmp/tmpeiox1pba/tmplrhegvgd.py", line 15
print min(k,u,p,c);
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s388117273 | p01390 | u352394527 | 1546142990 | Python | Python3 | py | Runtime Error | 0 | 0 | 424 | dic = {}
for num1 in range(ord("a"), ord("z") + 1):
c1 = chr(num1)
dic[c1] = []
for num2 in range(ord("a"), ord("z") + 1):
c2 = chr(num2)
for num3 in range(ord("a"), ord("z") + 1):
c3 = chr(num3)
dic[c1].append(c1 + c2 + c3 + "a")
print("?" + dic["a"].pop())
used = set()
while True:
s = input()
if s in used or s[0] != "a":
print("!OUT")
break
used.add(s)
print(dic[s[-1]].pop())
| Traceback (most recent call last):
File "/tmp/tmprn6nthus/tmpecizkvuo.py", line 14, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| ?azza
|
s188281449 | p01401 | u647766105 | 1390055352 | Python | Python | py | Runtime Error | 0 | 0 | 560 | s2i = lambda x: 0 if x == "S" else -1 if x == "G" else int(x)
while True:
w, h = map(int, raw_input().split())
if w | h == 0:
break
V = sorted(reduce(lambda a, b: a + b,[[(s2i(c), x, y) for x, c in enumerate(raw_input().split()) if c != "."] for y in xrange(h)]))
dp = [[] for _ in xrange(V[-1][0] + 1)]
dp[0] += [(0, V[1][0], V[1][2])]
for i, x, y in V[2:]:
dp[i] += [(min(c + abs(x - xx) + abs(y - yy) for c, xx, yy in dp[i - 1]), x, y)]
print min(c + abs(V[0][1] - xx) + abs(V[0][2] - yy) for c, xx, yy in dp[-1]) | File "/tmp/tmpo_7jeo2j/tmptjyu0m_j.py", line 11
print min(c + abs(V[0][1] - xx) + abs(V[0][2] - yy) for c, xx, yy in dp[-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s329842473 | p01403 | u023846178 | 1387109290 | Python | Python | py | Runtime Error | 39860 | 44060 | 332 | p = [1] * 1000001
for i in range(3, 1001, 2):
if p[i] == 0:
continue
for j in range(2, 1000001/i):
p[i*j] = 0
t = int(raw_input())
for i in range(t):
n = int(raw_input())
res = n * (n-1) / 2 + 2
for j in range(2, n+1):
if p[j] == 1:
res -= (n / j - 1) * (j - 1)
print res | File "/tmp/tmpt_dosea3/tmpp4ddqfdh.py", line 15
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s211825691 | p01403 | u023846178 | 1387109604 | Python | Python | py | Runtime Error | 39860 | 44064 | 329 | p = [1] * 1000001
for i in range(2, 1001):
if p[i] == 0:
continue
for j in range(2, 1000001/i):
p[i*j] = 0
t = int(raw_input())
for i in range(t):
n = int(raw_input())
res = n * (n-1) / 2 + 2
for j in range(2, n+1):
if p[j] == 1:
res -= (n / j - 1) * (j - 1)
print res | File "/tmp/tmp3wduee45/tmpurg1c2pw.py", line 15
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s333010025 | p01403 | u023846178 | 1387110055 | Python | Python | py | Runtime Error | 39850 | 44064 | 331 | p = [1] * 1000001
for i in range(2, 1001):
if p[i] == 0:
continue
for j in range(2, 1000000/i+1):
p[i*j] = 0
t = int(raw_input())
for i in range(t):
n = int(raw_input())
res = n * (n-1) / 2 + 2
for j in range(2, n+1):
if p[j] == 1:
res -= (n / j - 1) * (j - 1)
print res | File "/tmp/tmplhm7p213/tmpjl8cm80s.py", line 15
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s347143810 | p01417 | u506554532 | 1514191808 | Python | Python3 | py | Runtime Error | 20 | 5676 | 612 | import itertools
N,M = map(int,input().split())
src = [tuple(map(float,input().split())) for i in range(N)]
if M <= 1:
print(0)
exit()
dists = [[None for j in range(N)] for i in range(N)]
for i in range(N-1):
for j in range(i+1,N):
l1,a1,b1 = src[i]
l2,a2,b2 = src[j]
dist = 0
dist += (l1-l2)**2 + (a1-a2)**2 + (b1-b2)**2
dists[i][j] = dists[j][i] = dist
ans = 0
for ptn in itertools.permutations(range(N),M):
total = 0
for i in range(M-1):
for j in range(i+1,M):
total += dists[ptn[i]][ptn[j]]
ans = max(ans, total)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpdnr5016n/tmpvf7266pz.py", line 2, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s608857707 | p01417 | u104911888 | 1373024965 | Python | Python | py | Runtime Error | 20000 | 4432 | 421 | import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxInt=0
for comb in itertools.permutations(range(N),M):
dist=0
for i in range(M-1):
for j in range(i+1,M):
t=comb[i]
s=comb[j]
dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
maxInt=max(maxInt,dist)
print maxInt | File "/tmp/tmp3hwd458y/tmpfsulamvq.py", line 14
print maxInt
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s466240505 | p01417 | u104911888 | 1373025233 | Python | Python | py | Runtime Error | 20000 | 4432 | 417 | import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxV=0.0
for comb in itertools.permutations(range(N),M):
dist=0.0
for i in range(M-1):
for j in range(i+1,M):
t=comb[i]
s=comb[j]
dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
maxV=max(maxV,dist)
print maxV | File "/tmp/tmp4dy1rr80/tmp6diiasjs.py", line 14
print maxV
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s027570437 | p01418 | u509278866 | 1530785771 | Python | Python3 | py | Runtime Error | 60 | 9024 | 1142 | 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 = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def main():
k,r,l = LI()
p = F()
e = F()
t = F()
def f(k,r,l):
if abs(r-t) <= e and abs(t-l) <= e:
return 1
if k == 0:
if abs(t - (r+l) / 2) <= e:
return 1
return 0
h = (r+l) / 2
if h >= t:
return f(k-1,r,h) * (1-p) + f(k-1,h,l) * p
return f(k-1,r,h) * p + f(k-1,h,l) * (1-p)
tr = f(k,r,l)
return '{:0.9f}'.format(tr)
print(main())
| Traceback (most recent call last):
File "/tmp/tmphrky6_i_/tmphn7cyq1i.py", line 45, in <module>
print(main())
^^^^^^
File "/tmp/tmphrky6_i_/tmphn7cyq1i.py", line 21, in main
k,r,l = LI()
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s425799855 | p01420 | u509278866 | 1535438003 | Python | Python3 | py | Runtime Error | 360 | 9424 | 1877 | 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**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
nm = {}
def nCr(n, b):
if b > n - b:
b = n - b
key = (n,b)
if key in nm:
return nm[key]
r = 1
for k in range(n, n-b, -1):
r = r * k
d = 1
for k in range(1, b+1):
d = d * k
nm[key] = r / d
return nm[key]
def main():
rr = []
n,m,l = LI()
ps = [LI() for _ in range(n)]
ts = []
rs = []
us = []
for p,t,v in ps:
p /= 100
u = l / v
ti = []
ri = []
for i in range(m+1):
ti.append(u+t*i)
k = pow(1-p, m-i) * pow(p, i) * nCr(m, i)
ri.append(k)
ts.append(ti)
rs.append(ri)
ui = ri[:]
for i in range(1,m+1):
ui[i] += ui[i-1]
us.append(ui)
for i in range(n):
r = 0
for j in range(m+1):
tr = rs[i][j]
tt = ts[i][j] + 1.0 / 10**10
for k in range(n):
if i == k:
continue
bi = bisect.bisect_left(ts[k], tt)
if bi > 0:
tr *= 1 - us[k][bi-1]
r += tr
rr.append('{:.9f}'.format(r))
return '\n'.join(map(str,rr))
print(main())
| Traceback (most recent call last):
File "/tmp/tmpg16818w6/tmpyllw0pkw.py", line 79, in <module>
print(main())
^^^^^^
File "/tmp/tmpg16818w6/tmpyllw0pkw.py", line 40, in main
n,m,l = LI()
^^^^^
ValueError: not enough values to unpack (expected 3, got 0)
| |
s719243895 | p01420 | u811434779 | 1454996347 | Python | Python | py | Runtime Error | 0 | 0 | 1001 | def upper_bound(arr, v)
l = -1
r = arr.size
while l + 1 < r
m = (l + r) / 2
if arr[m] <= v then l = m
else r = m
end
end
r
end
EPS = 1e-9
Factorial = (1..50).each_with_object([1]) { |i, arr| arr << arr[-1] * i }
n, m, l = gets.split.map(&:to_i)
p, t, v = n.times.map{ gets.split.map(&:to_i) }.transpose
time_set = n.times.map{ [0] * (m + 1) }
prob_set = n.times.map{ [0] * (m + 1) }
n.times do |i|
s = v[i] == 0 ? Float::INFINITY : l / v[i].to_f
(m + 1).times do |j|
time_set[i][j] = s + t[i] * j
prob_set[i][j] = (p[i] / 100.0) ** j * (1 - p[i] / 100.0) ** (m - j) * Factorial[m] / Factorial[m - j] / Factorial[j]
end
end
n.times do |i|
ret = 0
(m + 1).times do |j|
prob = prob_set[i][j]
n.times do |k|
next if i == k
idx = upper_bound(time_set[k], time_set[i][j] + EPS)
if idx == m + 1
prob = 0
break
end
prob *= prob_set[k][idx..-1].reduce(:+)
end
ret += prob
end
puts '%.8f' % ret
end | File "/tmp/tmpqlyebg7n/tmp4xicdrq6.py", line 1
def upper_bound(arr, v)
^
SyntaxError: expected ':'
| |
s405589902 | p01420 | u467175809 | 1529699205 | Python | Python | py | Runtime Error | 10 | 5008 | 1344 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
sys.setrecursionlimit(1000000)
N, M, L = map(int, raw_input().split())
def fact(n):
if n <= 1:
return 1
return fact(n - 1) * n
MC = []
for i in range(M + 1):
MC.append(fact(M) / fact(i) / fact(M - i))
p_lst = []
P_val = []
P_sum = []
for i in range(N):
P, T, V = map(int, raw_input().split())
p_lst.append((T, V))
PP = []
for k in range(M + 1):
PP.append(MC[k] * (P ** k) * ((100 - P) ** (M - k)))
P_val.append(list(PP))
for k in range(M, 0, -1):
PP[k - 1] += PP[k]
P_sum.append(PP)
def comp(p1, p2, k1, k2):
T1, V1 = p1
T2, V2 = p2
return L * (V2 - V1) < V1 * V2 * (k2 * T2 - k1 * T1)
for i in range(N):
ans = 0
index_lst = [0 for j in range(N)]
for k1 in range(M + 1):
ret = P_val[i][k1]
for j in range(N):
if i == j:
continue
flag = True
while True:
k2 = index_lst[j]
if k2 > M:
ret *= 0
break
if comp(p_lst[i], p_lst[j], k1, k2):
ret *= P_sum[j][k2]
break
index_lst[j] += 1
ans += ret
ans = float(ans) / 100 ** (N * M)
print ans
| File "/tmp/tmpzbcd_of4/tmpl1y5s1cj.py", line 59
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s313049371 | p01425 | u695154284 | 1499780331 | Python | Python | py | Runtime Error | 0 | 0 | 1919 | import math
g = 9.8
ESP = 1e-6
def calc(vy, t):
return vy * t - g * t * t / 2
def cmp(lb, ub, a):
if a < lb + ESP:
return -1
elif ub - ESP < a:
return 1
else:
return 0
def check(qx, qy):
a = (g * g) / 4
b = g * qy - V * V
c = qx * qx + qy * qy
D = b * b - 4 * a * c
if D < 0 and -ESP < D:
D = 0
if D < 0:
return False
for d in range(-1, 2, 2):
t2 = (-b + d * math.sqrt(D)) / (2 * a)
if t2 <= 0:
continue
t = math.sqrt(t2)
vx = qx / t
vy = (qy + g * t * t / 2) / t
yt = calc(vy, X / vx)
if yt < Y - ESP:
continue
ok = True
for i in range(0, N):
if L[i] >= X:
continue
if R[i] == X and Y <= T[i] and B[i] <= yt:
ok = False
yL = cmp(B[i], T[i], calc(vy, L[i] / vx))
yR = cmp(B[i], T[i], calc(vy, R[i] / vx))
xH = cmp(L[i], R[i], vx * (vy / g))
yH = cmp(B[i], T[i], calc(vy, vy / g))
if xH == 0 and yH >= 0 and yL < 0:
ok = False
if yL * yR <= 0:
ok = False
if ok:
return True
return False
if __name__ == '__main__':
N, V, X, Y = list(map(int, input().split()))
L = []
B = []
R = []
T = []
for i in range(N):
tmp_L, tmp_B, tmp_R, tmp_T = list(map(int, input().split()))
L.append(tmp_L)
B.append(tmp_B)
R.append(tmp_R)
T.append(tmp_T)
for i in range(0, N):
R[i] = min(R[i], X)
ok = check(X, Y)
for i in range(0, N):
if L[i] == 0 and T[i] != 0:
pass
else:
ok |= check(L[i], T[i])
if R[i] == 0 and T[i] != 0:
pass
else:
ok |= check(R[i], T[i])
print("Yes" if ok else 'No') | Traceback (most recent call last):
File "/tmp/tmpgo68crre/tmpbo0qjmc8.py", line 68, in <module>
N, V, X, Y = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s351712796 | p01437 | u467175809 | 1529161242 | Python | Python | py | Runtime Error | 0 | 0 | 1600 | #!/usr/bin/env python
from collections import deque
while True:
c_ = []
H, W, L = map(int, raw_input().split())
if H == 0:
break
m = {}
start = 0
for i in range(H):
S = raw_input()
c_.append(S)
for d in ['N', 'E', 'S', 'W']:
index = S.find(d)
if index != -1:
start = (i, index, d)
def c(y, x):
if y < 0 or x < 0 or y >= H or x >= W:
return '#'
if c_[y][x] == '#':
return '#'
return '.'
def func(y, x, d, step):
if step == 0:
print str(y + 1) + " " + str(x + 1) + " " + d
return
if (y, x, d) in m and step < m[(y, x, d)]:
step %= m[(y, x, d)] - step
m[(y, x, d)] = step
if d == 'N':
if c(y - 1, x) == '#':
d = 'E'
return func(y, x, d, step)
else:
return func(y - 1, x, d, step - 1)
if d == 'E':
if c(y, x + 1) == '#':
d = 'S'
return func(y, x, d, step)
else:
return func(y, x + 1, d, step - 1)
if d == 'S':
if c(y + 1, x) == '#':
d = 'W'
return func(y, x, d, step)
else:
return func(y + 1, x, d, step - 1)
if d == 'W':
if c(y, x - 1) == '#':
d = 'N'
return func(y, x, d, step)
else:
return func(y, x - 1, d, step - 1)
func(start[0], start[1], start[2], L)
| File "/tmp/tmpr30txg96/tmpr0ezgsri.py", line 29
print str(y + 1) + " " + str(x + 1) + " " + d
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s538411185 | p01438 | u633068244 | 1424448381 | Python | Python | py | Runtime Error | 19930 | 198788 | 674 | while 1:
n = int(raw_input())
if n == 0: break
L = [0]*n
D = [0]*n
for man in xrange(n):
m,l = map(int,raw_input().split())
L[man] = l
t = 0
for date in xrange(m):
s,e = map(int,raw_input().split())
t ^= ((1 << (e-6))-1) ^ ((1 << (s-6))-1)
D[man] = t
dp = [[0]*(1 << 17) for i in xrange(n)]
dp[0][D[0]] = L[0]
for i in xrange(1,n):
for bit in xrange(1 << 17):
if dp[i-1][bit] and bit&D[i] == 0:
dp[i][bit|D[i]] = max(dp[i][bit|D[i]], dp[i-1][bit]+L[i])
dp[i][D[i]] = max(dp[i][D[i]], L[i])
print max(max(dp[i]) for i in xrange(n)) | File "/tmp/tmpzmezhznz/tmpcjl_3kjx.py", line 21
print max(max(dp[i]) for i in xrange(n))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s634454355 | p01438 | u509278866 | 1528872613 | Python | Python3 | py | Runtime Error | 0 | 0 | 1581 | 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 = 998244353
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.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def main():
rr = []
while True:
n = I()
if n == 0:
break
ms = []
for _ in range(n):
m,l = LI()
a = [LI() for _ in range(m)]
b = []
for s,e in a:
f = 0
for i in range(s,e):
f |= 2**(i-6)
b.append(f)
ms.append((l,b))
d = collections.defaultdict(int)
d[0] = 0
for l,b in ms:
g = collections.defaultdict(int)
for k,v in d.items():
for f in b:
if f&k > 0:
continue
if g[f|k] < v + l:
g[f|k] = v + l
for k,v in g.items():
if d[k] < v:
d[k] = v
rr.append(max(d.values()))
return '\n'.join(map(str, rr))
print(main())
| Traceback (most recent call last):
File "/tmp/tmpdhrwhl3_/tmpvfztc9an.py", line 57, in <module>
print(main())
^^^^^^
File "/tmp/tmpdhrwhl3_/tmpvfztc9an.py", line 24, in main
n = I()
^^^
File "/tmp/tmpdhrwhl3_/tmpvfztc9an.py", line 14, in I
def I(): return int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s376813219 | p01440 | u338373191 | 1476655142 | Python | Python | py | Runtime Error | 0 | 0 | 6213 | # ???????????????????°?? ???????????´?????°??????????????????
#?????????????? ?±???????????????????? ???????????????? ???????????´?????°??????????????????, ???±???°???????°???????? ?????????????°???????? ???????????´?????°?????????????? ?????????¶???????????????? ??????????:
# S = 123456789101112131415...
#?????????´?????????? ???????????? ???????¶?´???????? ???°?´?°???????? ?????´???????????´?????°?????????????????? A ?? ?±???????????????????? ???????????´?????°?????????????????? S (???????????°?????? ???°???????°???????? ?? 1).
#???????????°?????° ?´?????¶???° ???????°???? ?´?°???????? ???? stdin ?? ?????????´?????? ???????????? ?? stdout.
#???????????? ???????´?????? ?´?°???????? (???? ???´?????? ?????´???????????´?????°?????????????????? ???° ????????????, ???°?????????°???????°?? ?´???????° ?????´???????????´?????°?????????????????? ??? 50 ????????????????):
#6789
#111
#???????????? ?????????´?????? ?´?°????????:
#6
#12
# ?????????????? ?????????????????? ?´?? ?????????° ????????????, ?????? ?????? ???????????´?????°?????????????????? ???? ???°???´???????????? ??????????
def prov(pos,s):
ch = int(s[:pos])+1
k1 = pos
k2 = pos + len(str(ch))
while k2 < len(s):
if str(ch) == s[k1:k2]:
ch = ch +1
k1 = k2
k2 = k1 + len(str(ch))
else:
return -1
if str(ch)[:len(s)-k1]!=s[k1:]:
return -1
return 0
#?????????????? ?????????????????? ?´???? ?????????????? ???????????????° ?????????° ?????? ?????????? ?? ???????????´?????°??????????????????
def sf(ch):
#print(ch)
s = '1'
for i in range(len(str(ch)) - 1):
s = s + '0'
l = len(str(ch))
otv = (ch - int(s)) * l + 1
l = l - 1
while l > 0:
otv = otv + (int(s[:l + 1]) - int(s[:l])) * l
l = l - 1
return otv
# ??-?????? ?????±?????????????? ???°???±?????°???? ???????????? ???° ???????????????? ???????????´?????°??????????????????
def last(s):
if (len(s) == 1) & (s != '0'):
return int(s)
if (s == '0'):
return 11
for pos in range(1,len(s)): # pos - ?????????´?????????? ?????????´???? ?????????°
for start in range (pos+1): # start - ???°???°???? ?????????????? ???? ???°???±?????????? ???????????´?????°???????????????????? ?????????°
if start == 0: # ???????? ???????°???°????, ?????? ???????????´?????°?????????????????? ???°???????°???????? ?? ?????????°
if prov(pos,s)!= -1:
return sf(int(s[start:start+pos]))
if s[:1] == '0': # ???????? ?????? ???????????° ????????
if s == '0'*len(s):
return sf(int('1'+s))+1
else: # ???????? ???????? ???????????? ?????????? ???? ?????°???°???° ???????????´?????°??????????????????
if start + pos <len(s):
if (s[:start] == str(int(s[start:start+pos])-1)[len(str(int(s[start:start+pos])-1))-start:]):
if prov(pos, s[start:]) != -1:
return sf(int(s[start:start + pos])-1)+len(str(int(s[start:start + pos])-1))-start
else:
if (pos + start > len(s) - 1) & (start > 0): # ?´???? ?????????°???? ???????´?° ???????????° ?????´?????¶???? ?????????? ?´???° ?????????° ?? ?????? ???±?° ???? ????????????
ch = str(int(s[:start]) + 1)
if len(ch) > len(s[:start]):
ch = ch[1:]
ch1 = s[start:]
i = len(ch)
if ch == ch1[len(ch1) - len(ch):]:
return sf(int(ch1)-1)+len(str(int(ch1)-1))-start
while (i > 0) & (ch[:i] != ch1[len(ch1) - i:]):
i = i - 1
ich = -1
if s[:len(ch[:i])] == ch[:len(ch[:i])]:
ich = int(s[:len(s)-len(ch[:i])])
s1 = s[len(ch[:i])+1:len(s)-len((ch[:i]))]
k = len(ch[:i])+1
else:
s1 = s[len(ch[:i]):len(s)-len((ch[:i]))]
k = len(ch[:i])
if i != 0:
x = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
for j in range(9):
if s1.find(x[j])!= -1:
k = k + s1.find(x[j])
break
if (ich!=-1)&(ich<int(s[k:len(s)-len((ch[:i]))]+s[:k])):
return sf(ich)
else:
return sf(int(s[k:len(s)-len((ch[:i]))]+s[:k]))+len(str(int(s[k:len(s)-len((ch[:i]))]+s[:k])))-k
x = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] #???????? ???? ???°?????? ???°???????° ???° ???????????´?????°??????????????????, ???????????? ???? ???????????????????? ???????????°?????????? ??????????
for i in range(9):
if s.find(x[i]) != -1:
ch = int(s[s.find(x[i]):] + s[:s.find(x[i])])
k = s.find(x[i])
pos = k
while s[k:].find(x[i]) != -1:
if int(s[s[k:].find(x[i]):] + s[:s[k:].find(x[i])]) < ch:
ch = int(s[s[k:].find(x[i]):] + s[:s[k:].find(x[i])])
pos = k
k = k + s[k:].find(x[i]) + 1
return sf(int(s[s.find(x[i]):] + s[:s.find(x[i])]))+len(s[s.find(x[i]):] + s[:s.find(x[i])]) - pos
return 0
m = [] #???°???????? ???????´?????? ?´?°????????
s = str(input()) #???????°???? ??????????????????
while s!='': # ???????????? ?´?°???????? ?´?? ???????????? ????????????
if s.isdigit(): #???????? ???????????° ?????´?????¶???? ???????????? ?????????°, ???°???????????°???? ????
m.append(s)
else:
print('String is not a sequence of numbers')
s = str(input())
for i in range(len(m)): # ?????????°???? ?´???? ???°?¶?´???? ????????????
print(last(m[i])) | Traceback (most recent call last):
File "/tmp/tmppgtikv37/tmp79cw972a.py", line 111, in <module>
s = str(input()) #???????°???? ??????????????????
^^^^^^^
EOFError: EOF when reading a line
| |
s753812683 | p01440 | u338373191 | 1476655507 | Python | Python | py | Runtime Error | 0 | 0 | 5824 | # ???????????????????°?? ???????????´?????°??????????????????
#?????????????? ?±???????????????????? ???????????????? ???????????´?????°??????????????????, ???±???°???????°???????? ?????????????°???????? ???????????´?????°?????????????? ?????????¶???????????????? ??????????:
# S = 123456789101112131415...
#?????????´?????????? ???????????? ???????¶?´???????? ???°?´?°???????? ?????´???????????´?????°?????????????????? A ?? ?±???????????????????? ???????????´?????°?????????????????? S (???????????°?????? ???°???????°???????? ?? 1).
#???????????°?????° ?´?????¶???° ???????°???? ?´?°???????? ???? stdin ?? ?????????´?????? ???????????? ?? stdout.
#???????????? ???????´?????? ?´?°???????? (???? ???´?????? ?????´???????????´?????°?????????????????? ???° ????????????, ???°?????????°???????°?? ?´???????° ?????´???????????´?????°?????????????????? ??? 50 ????????????????):
#6789
#111
#???????????? ?????????´?????? ?´?°????????:
#6
#12
# ?????????????? ?????????????????? ?´?? ?????????° ????????????, ?????? ?????? ???????????´?????°?????????????????? ???? ???°???´???????????? ??????????
def prov(pos,s):
ch = int(s[:pos])+1
k1 = pos
k2 = pos + len(str(ch))
while k2 < len(s):
if str(ch) == s[k1:k2]:
ch = ch +1
k1 = k2
k2 = k1 + len(str(ch))
else:
return -1
if str(ch)[:len(s)-k1]!=s[k1:]:
return -1
return 0
#?????????????? ?????????????????? ?´???? ?????????????? ???????????????° ?????????° ?????? ?????????? ?? ???????????´?????°??????????????????
def sf(ch):
#print(ch)
s = '1'
for i in range(len(str(ch)) - 1):
s = s + '0'
l = len(str(ch))
otv = (ch - int(s)) * l + 1
l = l - 1
while l > 0:
otv = otv + (int(s[:l + 1]) - int(s[:l])) * l
l = l - 1
return otv
# ??-?????? ?????±?????????????? ???°???±?????°???? ???????????? ???° ???????????????? ???????????´?????°??????????????????
def last(s):
if (len(s) == 1) & (s != '0'):
return int(s)
if (s == '0'):
return 11
for pos in range(1,len(s)): # pos - ?????????´?????????? ?????????´???? ?????????°
for start in range (pos+1): # start - ???°???°???? ?????????????? ???? ???°???±?????????? ???????????´?????°???????????????????? ?????????°
if start == 0: # ???????? ???????°???°????, ?????? ???????????´?????°?????????????????? ???°???????°???????? ?? ?????????°
if prov(pos,s)!= -1:
return sf(int(s[start:start+pos]))
if s[:1] == '0': # ???????? ?????? ???????????° ????????
if s == '0'*len(s):
return sf(int('1'+s))+1
else: # ???????? ???????? ???????????? ?????????? ???? ?????°???°???° ???????????´?????°??????????????????
if start + pos <len(s):
if (s[:start] == str(int(s[start:start+pos])-1)[len(str(int(s[start:start+pos])-1))-start:]):
if prov(pos, s[start:]) != -1:
return sf(int(s[start:start + pos])-1)+len(str(int(s[start:start + pos])-1))-start
else:
if (pos + start > len(s) - 1) & (start > 0): # ?´???? ?????????°???? ???????´?° ???????????° ?????´?????¶???? ?????????? ?´???° ?????????° ?? ?????? ???±?° ???? ????????????
ch = str(int(s[:start]) + 1)
if len(ch) > len(s[:start]):
ch = ch[1:]
ch1 = s[start:]
i = len(ch)
if ch == ch1[len(ch1) - len(ch):]:
return sf(int(ch1)-1)+len(str(int(ch1)-1))-start
while (i > 0) & (ch[:i] != ch1[len(ch1) - i:]):
i = i - 1
ich = -1
if s[:len(ch[:i])] == ch[:len(ch[:i])]:
ich = int(s[:len(s)-len(ch[:i])])
s1 = s[len(ch[:i])+1:len(s)-len((ch[:i]))]
k = len(ch[:i])+1
else:
s1 = s[len(ch[:i]):len(s)-len((ch[:i]))]
k = len(ch[:i])
if i != 0:
x = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
for j in range(9):
if s1.find(x[j])!= -1:
k = k + s1.find(x[j])
break
if (ich!=-1)&(ich<int(s[k:len(s)-len((ch[:i]))]+s[:k])):
return sf(ich)
else:
return sf(int(s[k:len(s)-len((ch[:i]))]+s[:k]))+len(str(int(s[k:len(s)-len((ch[:i]))]+s[:k])))-k
x = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] #???????? ???? ???°?????? ???°???????° ???° ???????????´?????°??????????????????, ???????????? ???? ???????????????????? ???????????°?????????? ??????????
for i in range(9):
if s.find(x[i]) != -1:
ch = int(s[s.find(x[i]):] + s[:s.find(x[i])])
k = s.find(x[i])
pos = k
while s[k:].find(x[i]) != -1:
if int(s[s[k:].find(x[i]):] + s[:s[k:].find(x[i])]) < ch:
ch = int(s[s[k:].find(x[i]):] + s[:s[k:].find(x[i])])
pos = k
k = k + s[k:].find(x[i]) + 1
return sf(int(s[s.find(x[i]):] + s[:s.find(x[i])]))+len(s[s.find(x[i]):] + s[:s.find(x[i])]) - pos
return 0
m = [] #???°???????? ???????´?????? ?´?°????????
s = str(input()) #???????°???? ??????????????????
print(s) | Traceback (most recent call last):
File "/tmp/tmp4opfgaaf/tmpdzapxlux.py", line 111, in <module>
s = str(input()) #???????°???? ??????????????????
^^^^^^^
EOFError: EOF when reading a line
| |
s354283492 | p01447 | u835866094 | 1412110242 | Python | Python | py | Runtime Error | 0 | 0 | 1221 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#t
field = [int(n) for n in line.split()]
# *&
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
#*&
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
#*?&k??WfDO
if i == 0 :
# j
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
#?LjD
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left >> the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | File "/tmp/tmpbznacwn2/tmpb5qpeigg.py", line 33
#
SyntaxError: source code cannot contain null bytes
| |
s396810472 | p01447 | u835866094 | 1412110320 | Python | Python | py | Runtime Error | 0 | 0 | 1128 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
field = [int(n) for n in line.split()]
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
if i == 0 :
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
#?LjD
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpg1glymdu/tmpb6fm_723.py", line 44, in <module>
main()
File "/tmp/tmpg1glymdu/tmpb6fm_723.py", line 9, in main
analy(line)
File "/tmp/tmpg1glymdu/tmpb6fm_723.py", line 15, in analy
num = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s068503281 | p01447 | u835866094 | 1412110498 | Python | Python | py | Runtime Error | 0 | 0 | 1098 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
field = [int(n) for n in line.split()]
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
if i == 0 :
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpj46hjij9/tmprbs9gipc.py", line 43, in <module>
main()
File "/tmp/tmpj46hjij9/tmprbs9gipc.py", line 9, in main
analy(line)
File "/tmp/tmpj46hjij9/tmprbs9gipc.py", line 15, in analy
num = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s017276939 | p01447 | u835866094 | 1412110582 | Python | Python3 | py | Runtime Error | 0 | 0 | 1136 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
field = [int(n) for n in line.split()]
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
if i == 0 :
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
#左がない
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpcm9cd0an/tmpe6b51fgd.py", line 44, in <module>
main()
File "/tmp/tmpcm9cd0an/tmpe6b51fgd.py", line 9, in main
analy(line)
File "/tmp/tmpcm9cd0an/tmpe6b51fgd.py", line 15, in analy
num = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s430272661 | p01447 | u835866094 | 1412110608 | Python | Python3 | py | Runtime Error | 0 | 0 | 1098 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
field = [int(n) for n in line.split()]
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
if i == 0 :
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmplgypgelo/tmpmps4djq0.py", line 43, in <module>
main()
File "/tmp/tmplgypgelo/tmpmps4djq0.py", line 9, in main
analy(line)
File "/tmp/tmplgypgelo/tmpmps4djq0.py", line 15, in analy
num = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s025412685 | p01447 | u835866094 | 1412116239 | Python | Python | py | Runtime Error | 0 | 0 | 1260 | #coding:utf-8
import sys
import copy
def main():
line = sys.stdin.readline()
#case
while line.split() != ["0","0"]:
analy(line)
line = sys.stdin.readline()
return
def analy(line):
#????
field = [int(n) for n in line.split()]
# ???A?c
num = int(sys.stdin.readline())
data = []
for i in range(num):
a = sys.stdin.readline()
b = [int(n) for n in a.split()]
#???A?c
data.append(b)
print (compute(field, data))
def compute(field, ng):
list = []
for i in range(field[1]):
for j in range(field[0]):
#???¨?c???????????¢??
if i == 0 :
#??????
if [j+1,i+1] in ng:
list.append(0)
elif j == 0:
#?¶?????¢
list.append(1)
else:
list.append(list[j-1])
else:
if [j+1,i+1] in ng:
list[j] = 0
elif j != 0:
#no left >> the same.
list[j] = list[j-1] + list[j]
return list[len(list)-1]
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpbxpdz3xf/tmpb1k8c5ey.py", line 50, in <module>
main()
File "/tmp/tmpbxpdz3xf/tmpb1k8c5ey.py", line 10, in main
analy(line)
File "/tmp/tmpbxpdz3xf/tmpb1k8c5ey.py", line 18, in analy
num = int(sys.stdin.readline())
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s636595400 | p01448 | u266872031 | 1437617380 | Python | Python | py | Runtime Error | 39830 | 26384 | 417 | import bisect
N=int(raw_input())
tlist=[]
for i in range(N):
[a,b]=[int(x) for x in raw_input().split()]
tlist.append([a,b])
tlist.sort(key=lambda x:x[1])
blist=[x[1] for x in tlist]
#case N
for k in range(N,0,-1):
alist=sorted([x[0] for x in tlist[bisect.bisect_left(blist,k+1):]])
alist=alist[:bisect.bisect(alist,k+1)]
if len(alist)>=k:
print k
break
else:
print 0
| File "/tmp/tmphr0cz4b3/tmpchr_036t.py", line 15
print k
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s875159538 | p01448 | u266872031 | 1437618138 | Python | Python | py | Runtime Error | 39840 | 25740 | 756 | import bisect
N=int(raw_input())
tlist=[]
for i in range(N):
[a,b]=[int(x) for x in raw_input().split()]
tlist.append([a,b])
tlist.sort(key=lambda x:x[1])
blist=[x[1] for x in tlist]
#case N
bb=bisect.bisect_left(blist,N+1)
alist=sorted([x[0] for x in tlist[bb:]])
tlist=tlist[:bb]
blist=blist[:bb]
alist=alist[:bisect.bisect(alist,N+1)]
if len(alist)>=N:
print N
else:
for k in range(N-1,0,-1):
bb=bisect.bisect_left(blist,k+1)
newa=[x[0] for x in tlist[bb:]]
tlist=tlist[:bb]
blist=blist[:bb]
for a in newa:
bisect.insort_left(alist,a)
alist=alist[:bisect.bisect(alist,k+1)]
if len(alist)>=k:
print k
break
else:
print 0
| File "/tmp/tmphu0ffdo5/tmpgw76izzt.py", line 17
print N
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s986298598 | p01448 | u572790226 | 1466138045 | Python | Python3 | py | Runtime Error | 40000 | 21176 | 286 | N = int(input())
P = []
for i in range(N):
a, b = map(int, input().split())
P.append((a, b))
Fmaxim = 0
for i in range(N+1):
Pcount = 1
for a, b in P:
if a <= i+1 <= b:
Pcount += 1
if Pcount >= i+1:
Fmaxim = max(Fmaxim, i)
print(Fmaxim) | Traceback (most recent call last):
File "/tmp/tmparvx8iua/tmp9v5h_nxb.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s361152854 | p01448 | u572790226 | 1466138668 | Python | Python3 | py | Runtime Error | 40000 | 20936 | 358 | N = int(input())
P = []
for i in range(N):
a, b = map(int, input().split())
if a <= N+1:
P.append((a, b))
if len(P) > 0:
for i in range(len(P), -1, -1):
Pcount = 1
for a, b in P:
if a <= i+1 <= b:
Pcount += 1
if Pcount >= i+1:
print(i)
break
else:
print('0') | Traceback (most recent call last):
File "/tmp/tmpjgimyfte/tmp6co1yk7w.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s013074755 | p01448 | u572790226 | 1466139921 | Python | Python3 | py | Runtime Error | 40000 | 20996 | 402 | N = int(input())
P = []
bmax = 0
for i in range(N):
a, b = map(int, input().split())
bmax = max(bmax, b)
if a <= N+1:
P.append((a, b))
if len(P) > 0:
for i in range(min(len(P), bmax), -1, -1):
Pcount = 1
for a, b in P:
if a <= i+1 <= b:
Pcount += 1
if Pcount >= i+1:
print(i)
break
else:
print('0') | Traceback (most recent call last):
File "/tmp/tmpp9oegbju/tmp_dxecp23.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s393130121 | p01448 | u371539389 | 1495904871 | Python | Python3 | py | Runtime Error | 40000 | 9792 | 287 | N=int(input())
friendlist=[0 for i in range(N+2)]
for i in range(N):
a,b=[int(j) for j in input().split(" ")]
for k in range(a,min(N+2,b+1)):
friendlist[k]+=1
k=N+1
i=0
while k>=0:
if friendlist[k]>=k-1:
i=k-1
break
k-=1
print(i)
| Traceback (most recent call last):
File "/tmp/tmpvuapaf5a/tmpvobxubu0.py", line 1, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s570011144 | p01448 | u371539389 | 1496026080 | Python | Python3 | py | Runtime Error | 40000 | 9700 | 363 | N=int(input())
friendlist=[0 for i in range(N+2)]
for i in range(N):
a,b=[int(j) for j in input().split(" ")]
for k in range(a,min(b+1,N+2)):
friendlist[k]+=1
#ab=[[int(i) for i in input().split(" ")] for j in range(N)]
#print(ab)
k=N+1
i=0
while k>=0:
if friendlist[k]>=k-1:
i=k-1
break
k-=1
print(i)
| Traceback (most recent call last):
File "/tmp/tmpelcn5pki/tmp5g12uc4h.py", line 1, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s776244099 | p01448 | u826975654 | 1496913044 | Python | Python | py | Runtime Error | 0 | 0 | 466 | def appoint(x, l, h):
if l <= x <= h:
return 1
else:
return 0
N = int(input())
friends = [list(map(int, input().split())) for i in range(N)]
min_group = min(x[0] for x in friends)
max_group = max(x[0] for x in friends)
t = 0
ans = 1
for i in range(min_group, max_group):
z = sum([appoint(i + 1, lo, hi) for lo, hi in friends])
if i + 1 == z:
ans = z
t = 1
if t == 1 and i + 1 != z:
break
print(ans - 1) | Traceback (most recent call last):
File "/tmp/tmps7p_kf77/tmpd0vash8v.py", line 8, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s629505188 | p01448 | u826975654 | 1496914233 | Python | Python | py | Runtime Error | 0 | 0 | 579 | def appoint(x, l, h):
if l <= x <= h:
return 1
else:
return 0
N = int(raw_input())
friends = [list(map(int, raw_input().split())) for i in range(N)]
min_group = min(x[0] for x in friends)
max_group = max(x[0] for x in friends)
t = 0
ans = 1
for i in range(min_group, max_group):
z = sum([appoint(i + 1, lo, hi) for lo, hi in friends])
if i + 1 == z:
ans = z
t = 1
if t == 1 and i + 1 != z:
break
ans = ans - 1
print ans | File "/tmp/tmp2v02ux1p/tmpox9iae0b.py", line 8
N = int(raw_input())
^
IndentationError: unindent does not match any outer indentation level
| |
s785931196 | p01448 | u192570203 | 1504266203 | Python | Python3 | py | Runtime Error | 30 | 8492 | 301 | N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
diff = [0] * 100001
for k in l :
diff[k[0] - 1] += 1
diff[k[1]] -= 1
hist = [0,0]
for i in range(2, N + 1) :
hist.append(hist[-1] + diff[i-1])
print(max([y - 1 for (x,y) in zip(hist, range(N + 1)) if x + 1 >= y])) | Traceback (most recent call last):
File "/tmp/tmp4t299qfc/tmpe1tkv2ue.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s717952327 | p01448 | u192570203 | 1504266326 | Python | Python3 | py | Runtime Error | 40 | 8332 | 307 | N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
diff = [0] * 100001
for k in l :
diff[k[0] - 1] += 1
diff[k[1]] -= 1
hist = [0,0]
for i in range(2, N + 1) :
hist.append(hist[-1] + diff[i-1])
print(max([0] + [y - 1 for (x,y) in zip(hist, range(N + 1)) if x + 1 >= y])) | Traceback (most recent call last):
File "/tmp/tmp38hcp86d/tmpyk7h5mm4.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s262987631 | p01448 | u591052358 | 1528982018 | Python | Python3 | py | Runtime Error | 80 | 6272 | 248 | N = int(input())
t = [0 for i in range(100001)]
for i in range(N):
a,b = [int(i) for i in input().split(' ')]
t[a-1] +=1
t[b] -= 1
ans = 0
for i in range(1,100001):
t[i] += t[i-1]
if (t[i] > i):
ans = i
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpj0zbz0wx/tmpx900uqcs.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s999928933 | p01449 | u633068244 | 1424751201 | Python | Python | py | Runtime Error | 19920 | 10648 | 631 | inf = 1 << 28
N = int(raw_input())
p = [int(raw_input()) for i in xrange(N)]
to = [i for i in xrange(N+6)]
used = [False]*N
for i in xrange(N):
if used[i]: continue
seq = []
while 1:
used[i] = True
if i in seq:
for j in seq: to[j] = 0
break
elif p[i] == 0:
for j in seq: to[j] = i
break
else:
seq.append(i)
i += p[i]
dp = [inf]*(N+6)
dp[0] = 0
for i in xrange(N):
for j in xrange(1,7):
dp[to[i+j]] = min(dp[to[i+j]], dp[i]+1)
print dp[N-1] | File "/tmp/tmpw0f_xqkn/tmp7zwckmfd.py", line 25
print dp[N-1]
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s192631523 | p01449 | u633068244 | 1424754740 | Python | Python | py | Runtime Error | 19930 | 4268 | 732 | inf = 10**9
N = int(raw_input())
p = [int(raw_input()) for i in xrange(N)]
to = [i for i in xrange(N)]
for i in xrange(N):
if to[i] != i: continue
seq = set([])
while 1:
if to[i] != i:
for j in seq: to[j] = to[i]
elif i in seq:
for j in seq: to[j] = -1
break
elif p[i] == 0:
for j in seq: to[j] = i
break
else:
seq.add(i)
i += p[i]
dp = [inf]*N
dp[0] = 0
for i in xrange(N):
if dp[i] == inf: continue
for j in xrange(i+1,min(N,i+7)):
if to[j] < j: continue
dp[to[j]] = min(dp[to[j]], dp[i]+1)
print dp[N-1] | File "/tmp/tmpnbwwjkor/tmpgx3an79k.py", line 28
print dp[N-1]
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s061144980 | p01449 | u633068244 | 1424878075 | Python | Python | py | Runtime Error | 19930 | 4272 | 732 | inf = 10**9
N = int(raw_input())
p = [int(raw_input()) for i in xrange(N)]
to = [i for i in xrange(N)]
for i in xrange(N):
if to[i] != i: continue
seq = set([])
while 1:
if to[i] != i:
for j in seq: to[j] = to[i]
elif i in seq:
for j in seq: to[j] = -1
break
elif p[i] == 0:
for j in seq: to[j] = i
break
else:
seq.add(i)
i += p[i]
dp = [inf]*N
dp[0] = 0
for i in xrange(N):
if dp[i] == inf: continue
for j in xrange(i+1,min(N,i+7)):
if to[j] < j: continue
dp[to[j]] = min(dp[to[j]], dp[i]+1)
print dp[N-1] | File "/tmp/tmpt5k5hp67/tmp8943sa0_.py", line 28
print dp[N-1]
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s966996933 | p01449 | u260980560 | 1430137392 | Python | Python | py | Runtime Error | 19930 | 7564 | 688 | import Queue
n = input()
p = []
for i in xrange(n):
p.append(int(raw_input()))
dist = [10**7] * n
mark = [0]*n
que = Queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
idx = 0
while not que.empty():
co, v = que.get()
if dist[v] < co:
continue
for k in xrange(1, 7):
idx += 1
go = v+k
while p[go]:
go += p[go]
if mark[go] == idx:
go = -1
break
mark[go] = idx
if go==-1:
continue
if go==n-1:
print dist[v] + 1
exit(0)
if dist[v] + 1 < dist[go]:
dist[go] = dist[v] + 1
que.put((dist[go], go)) | File "/tmp/tmptra44v_v/tmp5wx3whve.py", line 28
print dist[v] + 1
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s219191321 | p01449 | u260980560 | 1430139947 | Python | Python | py | Runtime Error | 20 | 4876 | 981 | import Queue
INF = 10**9+7
n = input()
p = []
for i in xrange(n):
p.append(int(raw_input()))
dist = [10**7] * n
calc = [-1] * n
used = [False] * n
que = Queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
def dfs(pos, calc, used, f):
if p[pos]==0:
return pos
if calc[pos]!=-1:
return calc[pos]
if used[pos]:
return INF
used[pos] = True
calc[pos] = dfs(pos+p[pos], calc, used, p[pos])
used[pos] = False
return calc[pos]
while not que.empty():
co, v = que.get()
if dist[v] < co:
continue
for k in xrange(1, 7):
go = v+k
if go>=n:
break
if p[go] != 0:
if calc[go]==-1:
dfs(go, calc, used, 0)
if calc[go]==INF:
continue
go = calc[go]
if go==n-1:
print dist[v]+1
exit(0)
if dist[v] + 1 < dist[go]:
dist[go] = dist[v] + 1
que.put((dist[go], go)) | File "/tmp/tmp90lr72_y/tmpx4vfcccs.py", line 39
print dist[v]+1
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s734310997 | p01449 | u260980560 | 1430140091 | Python | Python | py | Runtime Error | 170 | 29808 | 1017 | import Queue, sys
INF = 10**9+7
n = input()
p = []
for i in xrange(n):
p.append(int(raw_input()))
dist = [10**7] * n
calc = [-1] * n
used = [False] * n
que = Queue.PriorityQueue()
que.put((0, 0))
dist[0] = 0
sys.setrecursionlimit(10**5+7)
def dfs(pos, calc, used, f):
if p[pos]==0:
return pos
if calc[pos]!=-1:
return calc[pos]
if used[pos]:
return INF
used[pos] = True
calc[pos] = dfs(pos+p[pos], calc, used, p[pos])
used[pos] = False
return calc[pos]
while not que.empty():
co, v = que.get()
if dist[v] < co:
continue
for k in xrange(1, 7):
go = v+k
if go>=n:
break
if p[go] != 0:
if calc[go]==-1:
dfs(go, calc, used, 0)
if calc[go]==INF:
continue
go = calc[go]
if go==n-1:
print dist[v]+1
exit(0)
if dist[v] + 1 < dist[go]:
dist[go] = dist[v] + 1
que.put((dist[go], go)) | File "/tmp/tmptk3k5mw1/tmplyagont8.py", line 40
print dist[v]+1
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s990452106 | p01449 | u999854911 | 1490368015 | Python | Python3 | py | Runtime Error | 40 | 8648 | 1427 | import sys
import queue
ISLOOP = 999999999
def next_position(sugoroku, visited, curr, edges):
if edges[curr] != -1:
return edges[curr]
if curr in visited:
return ISLOOP
if sugoroku[curr] == 0:
return curr
# ?????????????????§?????????????????????????????´???????????????????§????????????¨????????????????????¨????????????
visited.append( curr )
edges[curr] = next_position(sugoroku, visited, curr + sugoroku[curr], edges)
return edges[curr]
def main():
n = int(input())
sugoroku = []
for i in range(n):
sugoroku.append( int(sys.stdin.readline()) )
# ????????????????????????????????????????¨??????????
edges = [-1] * n
for i in range(n):
visited = []
edges[i] = next_position(sugoroku, visited, i, edges)
visited = [False] * n
visited[0] = True
q = queue.Queue()
q.put( (0, 0) )
ans = -1
while not q.empty():
curr,step = q.get()
for k in range(1,7):
if curr + k >= n - 1:
ans = step + 1
break
j = edges[curr + k]
if j == n - 1:
ans = step + 1
break
if j == ISLOOP or visited[j]:
continue
q.put( (j, step + 1) )
visited[j] = True
if ans != -1:
break
print(ans)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpsrcxyi1y/tmp0p0bd73l.py", line 56, in <module>
main()
File "/tmp/tmpsrcxyi1y/tmp0p0bd73l.py", line 19, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s258529166 | p01449 | u999854911 | 1490368782 | Python | Python3 | py | Runtime Error | 40 | 8704 | 1330 | import sys
import queue
ISLOOP = 999999999
def next_position(n, sugoroku, visited, curr, edges):
if edges[curr] != -1:
return edges[curr]
if curr in visited:
return ISLOOP
if sugoroku[curr] == 0:
return curr
visited.append( curr )
edges[curr] = next_position(n, sugoroku, visited, max(0, min(n - 1, curr + sugoroku[curr])), edges)
return edges[curr]
def main():
n = int(input())
sugoroku = []
for i in range(n):
sugoroku.append( int(sys.stdin.readline()) )
# ????????????????????????????????????????¨??????????
edges = [-1] * n
for i in range(n):
visited = []
edges[i] = next_position(n, sugoroku, visited, i, edges)
visited = [False] * n
visited[0] = True
q = queue.Queue()
q.put( (0, 0) )
ans = -1
while not q.empty():
curr,step = q.get()
for k in range(1,7):
if curr + k >= n - 1:
ans = step + 1
break
j = edges[curr + k]
if j == n - 1:
ans = step + 1
break
if j == ISLOOP or visited[j]:
continue
q.put( (j, step + 1) )
visited[j] = True
if ans != -1:
break
print(ans)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmpq475mw30/tmpxd2sghpw.py", line 55, in <module>
main()
File "/tmp/tmpq475mw30/tmpxd2sghpw.py", line 18, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s690201137 | p01449 | u999854911 | 1490368942 | Python | Python3 | py | Runtime Error | 33050 | 56300 | 1487 | import sys
import queue
ISLOOP = 999999999
sys.setrecursionlimit(100000)
def next_position(n, sugoroku, visited, curr, edges):
if edges[curr] != -1:
return edges[curr]
if curr in visited:
return ISLOOP
if sugoroku[curr] == 0:
return curr
# ?????????????????§?????????????????????????????´???????????????????§????????????¨????????????????????¨????????????
visited.append( curr )
edges[curr] = next_position(n, sugoroku, visited, max(0, min(n - 1, curr + sugoroku[curr])), edges)
return edges[curr]
def main():
n = int(input())
sugoroku = []
for i in range(n):
sugoroku.append( int(sys.stdin.readline()) )
# ????????????????????????????????????????¨??????????
edges = [-1] * n
for i in range(n):
visited = []
edges[i] = next_position(n, sugoroku, visited, i, edges)
visited = [False] * n
visited[0] = True
q = queue.Queue()
q.put( (0, 0) )
ans = -1
while not q.empty():
curr,step = q.get()
for k in range(1,7):
if curr + k >= n - 1:
ans = step + 1
break
j = edges[curr + k]
if j == n - 1:
ans = step + 1
break
if j == ISLOOP or visited[j]:
continue
q.put( (j, step + 1) )
visited[j] = True
if ans != -1:
break
print(ans)
if __name__ == "__main__":
main() | Traceback (most recent call last):
File "/tmp/tmppxx_96cs/tmpy3992fcy.py", line 58, in <module>
main()
File "/tmp/tmppxx_96cs/tmpy3992fcy.py", line 21, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s429653415 | p01453 | u352394527 | 1545503163 | Python | Python3 | py | Runtime Error | 1420 | 43556 | 1793 | from collections import deque
w, h = map(int, input().split())
mp = [input() for _ in range(h)]
springs = []
tile_cnt = 0
for y in range(h):
for x in range(w):
if mp[y][x] == "*":
springs.append((x, y))
if mp[y][x] == "g":
gx, gy = x, y
if mp[y][x] == "s":
sx, sy = x, y
tile_cnt += 1
if mp[y][x] == ".":
tile_cnt += 1
vec = ((1, 0), (0, -1), (-1, 0), (0, 1))
INF = 10 ** 10
g_dist = [[INF] * w for _ in range(h)]
que = deque()
que.append((0, gx, gy))
g_dist[gy][gx] = 0
while que:
score, x, y = que.popleft()
for dx, dy in vec:
nx, ny = x + dx, y + dy
if mp[ny][nx] in (".", "s"):
if g_dist[ny][nx] == INF:
g_dist[ny][nx] = score + 1
que.append((score + 1, nx, ny))
s_dist = [[INF] * w for _ in range(h)]
que = deque()
for x, y in springs:
s_dist[y][x] = 0
que.append((0, x, y))
while que:
score, x, y = que.popleft()
for dx, dy in vec:
nx, ny = x + dx, y + dy
if mp[ny][nx] in (".", "s"):
if s_dist[ny][nx] == INF:
s_dist[ny][nx] = score + 1
que.append((score + 1, nx, ny))
sorted_tiles = sorted([(g_dist[y][x] - s_dist[y][x] if g_dist[y][x] != INF else INF, x, y) for y in range(h) for x in range(w) if mp[y][x] in (".", "s")])
acc_g = 0
acc_s = 0
acc_t = 0
acc_g_dic = {}
acc_s_dic = {}
acc_t_dic = {}
keys = set()
for key, x, y in sorted_tiles:
acc_g += g_dist[y][x]
acc_s += s_dist[y][x]
acc_t += 1
acc_g_dic[key] = acc_g
acc_s_dic[key] = acc_s
acc_t_dic[key] = acc_t
keys.add(key)
keys = sorted(list(keys))
length = len(keys)
for i in range(length - 1):
key = keys[i]
next_key = keys[i + 1]
E = (acc_g_dic[key] + acc_s - acc_s_dic[key]) / acc_t_dic[key]
if key <= E < next_key:
break
print(min(g_dist[sy][sx], s_dist[sy][sx] + E))
| Traceback (most recent call last):
File "/tmp/tmpiyf2y5b7/tmpwuoikz3v.py", line 3, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s706330737 | p01470 | u352394527 | 1545514767 | Python | Python3 | py | Runtime Error | 20 | 5680 | 231 | import operator
n = int(input())
ops = {1:operator.add,
2:operator.sub,
3:operator.mul,
4:operator.truediv}
ans = 0
for _ in range(n):
o, y = map(int, input().split())
ans = ops[o](ans, y)
print(int(ans))
| Traceback (most recent call last):
File "/tmp/tmpfetx9hsz/tmpc1pujp8p.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s161552118 | p01470 | u078042885 | 1484494863 | Python | Python3 | py | Runtime Error | 20 | 7676 | 149 | x=0
for _ in range(int(input())):
o,y=map(int,input().split())
if o==1:x+=y
elif o==2:x-=y
elif o==3:x*=y
else:x/=y
print(int(x)) | Traceback (most recent call last):
File "/tmp/tmpc8_mqru2/tmpgaxeo6i2.py", line 2, in <module>
for _ in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s904543155 | p01470 | u116766943 | 1360130776 | Python | Python | py | Runtime Error | 10 | 4264 | 266 | n = input()
x = 0.0
for i in range(0,n):
line = raw_input().split()
if line[0] == "1":
x += int(line[1])
elif line[0] == "2":
x -= int(line[1])
elif line[0] == "3":
x *= float(line[1])
elif line[0] == "4":
x /= float(line[1])
print int(x) | File "/tmp/tmpqe4gcceu/tmplsj8o4mh.py", line 13
print int(x)
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s756649413 | p01470 | u116766943 | 1360130816 | Python | Python | py | Runtime Error | 10 | 4272 | 267 | n = input()
x = 0.0
for i in range(0,n):
line = raw_input().split()
if line[0] == "1":
x += int(line[1])
elif line[0] == "2":
x -= int(line[1])
elif line[0] == "3":
x *= float(line[1])
elif line[0] == "4":
x /= float(line[1])
print long(x) | File "/tmp/tmpxbepv12s/tmpd7meud4_.py", line 13
print long(x)
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s158662720 | p01473 | u633068244 | 1398759034 | Python | Python | py | Runtime Error | 10 | 4264 | 531 | def fact(n):
return 1 if n == 0 else n*fact(n-1)
S = raw_input()
l,s = len(S),set(list(S))
lens = len(s)
d = [S.count(i) for i in s]
if l%2 == 0:
for i in range(lens):
if d[i]%2 == 1:
print 0
break
else:
denomi = 1
for i in range(lens):
denomi *= fact(d[i]/2)
print fact(l/2)/denomi
else:
for i in range(m):
if sum([d[i]%2 for i in range(lens)]) != 1:
print 0
break
else:
denomi = 1
for i in range(lens):
denomi *= fact(d[i]/2) if d[i]%2 == 0 else fact((d[i]-1)/2)
print fact((l-1)/2)/denomi | File "/tmp/tmp34od1mbw/tmpt3s5l8rs.py", line 11
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s663643574 | p01479 | u633068244 | 1399701379 | Python | Python | py | Runtime Error | 0 | 0 | 247 | a = raw_input().replace("egg","0").replace("chicken","1")
for i in range(len(a)-1):
if a[i] == a[i+1]:
if len(a[:i+1]) >= len(a[i+1:]):
ans = a[:i+1][-1]
break
else:
ans = a[i+1:][-1]
break
print "egg" if ans == "0" else "chicken" | File "/tmp/tmpcm40k9a3/tmpoazb323t.py", line 10
print "egg" if ans == "0" else "chicken"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s125324447 | p01486 | u011621222 | 1527244459 | Python | Python3 | py | Runtime Error | 0 | 0 | 427 |
#include <iostream>
#include <regex>
using namespace std;
int main(void){
string s;
cin >> s;
bool isCat = false;
while(true){
if(s == "mew"){
isCat = true;
break;
}
string buf_s = s;
s = regex_replace(s, regex("mmewe"), "me");
s = regex_replace(s, regex("emeww"), "ew");
if(buf_s == s) break;
}
if(isCat) cout << "Cat" << endl;
else cout << "Rabbit" << endl;
return 0;
}
| File "/tmp/tmpqfisvq6t/tmpjac0z2bs.py", line 5
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s871793992 | p01486 | u467175809 | 1529069965 | Python | Python | py | Runtime Error | 10 | 4720 | 480 | #!/usr/bin/env python
S = raw_input()
def func(lst):
if type(lst) == type(0):
return True
if len(lst) > 2:
return False
ret = True
for l in lst:
ret = (ret or func(l))
return ret
S = S.replace('mew', '[1]')
S = S.replace('me', 'm[1]e')
S = S.replace('m', '[')
S = S.replace('e', ',')
S = S.replace('w', ']')
try:
exec('piyo = ' + S)
except:
print 'Rabbit'
exit()
if func(piyo):
print 'Cat'
else:
print 'Rabbit'
| File "/tmp/tmplypxk_6b/tmpq5yfwinn.py", line 24
print 'Rabbit'
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s953587271 | p01489 | u182677953 | 1463766020 | Python | Python | py | Runtime Error | 40000 | 35316 | 733 | k = int(raw_input())
l,r = 0,k
while (r-l)>1:
m = (l+r)/2
if (m * (m + 1)) < k:
l = m
else:
r = m
b = l
#print b
ad = k - (b * (b + 1))
d = ((ad - 1) % (b + 1)) + 1
#print ad,d
x = 2 * b + 1
y = 1
if (ad - d) > 0:
x += 1
if d <= (b + 1 + 1) / 2:
dd = d * 2 - 1
else:
dz = (b + 1 - d)
dd = dz * 2 + 2
x -= (dd-1)
y += (dd-1)
def mul(a,b):
res = [[0,0],[0,0]]
p,q,r = 2,2,2
for s in xrange(p):
for t in xrange(q):
res[s][t] = 0
for u in xrange(r):
y = a[s][u] * b[u][t]
res[s][t] += y
return res
def fib(x):
bt = [[1,1],[1,0]]
r = [[1,1],[1,0]]
while x > 0:
if x % 2 != 0:
r = mul(r,bt)
bt = mul(bt,bt)
x /= 2
return r[0][0]
#print x,y
ans = fib(x-1) * fib(y-1)
print ans | File "/tmp/tmpuc91pkg6/tmpmvbrqr_f.py", line 62
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s017211882 | p01490 | u214600613 | 1451142607 | Python | Python | py | Runtime Error | 0 | 0 | 3 | p 0 | File "/tmp/tmpyffne_3a/tmp6gt08pak.py", line 1
p 0
^
SyntaxError: invalid syntax
| |
s349110408 | p01499 | u633068244 | 1425218346 | Python | Python | py | Runtime Error | 19930 | 8184 | 241 | import bisect
mod = 10**9+7
N,T = map(int,raw_input().split())
D = sorted(int(raw_input()) for i in xrange(N))
ans = 1
for i in xrange(N):
ans = ans * (bisect.bisect_right(D[:i],D[i]) - bisect.bisect_left(D[:i],D[i]-T)+1) % mod
print ans | File "/tmp/tmpqyf30rty/tmpb6s4dzwr.py", line 8
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s709660853 | p01513 | u506554532 | 1513159964 | Python | Python3 | py | Runtime Error | 0 | 0 | 513 | while True:
N = int(input())
if N == 0:break
flgs = [0 for i in range(N)]
for i in range(N):
src = map(int,input().split())
for k in src[1:]:
flgs[i] |= (1 << k)
target = 0
src = map(int,input().split())
for k in src[1:]:
target |= (1 << k)
ans = -1
for i in range(N):
if (flgs[i] | target) == flgs[i]:
if ans < 0:
ans = i+1
else:
ans = -1
break
print(ans) | Traceback (most recent call last):
File "/tmp/tmp6xgas6rs/tmp5pmd1d_j.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s769179320 | p01514 | u023471147 | 1527079887 | Python | Python3 | py | Runtime Error | 0 | 0 | 695 | while True:
t, p, r = map(int, input().split())
if t == p == r = 0:
break
data = [[0 for i in range(p + 1)] for i in range(t + 1)]
for i in range(r):
li = input().split()
tid, pid, time = map(int, li[:3])
if li[3] == "WRONG":
data[tid][pid] -= 1
else:
data[tid][pid] = time - data[tid][pid] * 1200
rank = list()
for tid in range(1, t + 1):
ans, pen = 0, 0
for pid in range(1, p + 1):
if data[tid][pid] > 0:
ans -= 1
pen += data[tid][pid]
rank.append((ans, pen, tid))
for ans, pen, tid in sorted(rank):
print(tid, -ans, pen)
| File "/tmp/tmpdxwv11a0/tmpj927ri75.py", line 3
if t == p == r = 0:
^
SyntaxError: invalid syntax
| |
s988185448 | p01515 | u633068244 | 1425208411 | Python | Python | py | Runtime Error | 0 | 0 | 401 | import itertools as it
T,F = True,False
while 1:
s = raw_input()
if s == "#": break
for b,a in zip(["=","->","*","+","-"],[" == "," <= "," and "," or "," not "]):
s = s.replace(b,a)
for v in xrange(2**11):
a,b,c,d,e,f,g,h,i,j,k = map(int,list(format(v,"b").zfill(11)))
if not eval(s):
print "NO"
break
else:
print "YES" | File "/tmp/tmpdb8chhh6/tmpf_jahpyv.py", line 13
print "NO"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s527699365 | p01515 | u214600613 | 1498470688 | Python | Python | py | Runtime Error | 0 | 0 | 270 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=map(int,a.split(':'));
d,e,f=map(int,d.split(':'));
dp[a*3600+b*60+c]+=1
dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpjw39hr2a/tmpzfge5gds.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s626226104 | p01515 | u759949288 | 1363897850 | Python | Python | py | Runtime Error | 0 | 0 | 4293 | class TerminalNode(object):
def __init__(self, value):
self.index = int(value)
self.value = value
def __call__(self, assign):
return self.value
def printTree(self, visited=set(), indent=0):
print("\t" * indent, self)
def _getNextThen(self, index):
return self
def _getNextElse(self, index):
return self
def ITE(self, thenNode, elseNode):
if self.value:
return thenNode
else:
return elseNode
def __eq__(self, other):
return isinstance(other, TerminalNode) and self.value == other.value
def __neq__(self, other):
return not self.__eq__(other)
class DiagramNode(object):
def __init__(self, label, bdd, thenNode, elseNode):
self.index = bdd.variable_counter
bdd.variable_counter += 1
self.label = label
self.thenNode = thenNode
self.elseNode = elseNode
self.bdd = bdd
def _getNextThen(self, label):
if label == self.label:
return self.thenNode
return self
def _getNextElse(self, label):
if label == self.label:
return self.elseNode
return self
def ITE(self, thenNode, elseNode):
compute_key = (self.label, thenNode.index, elseNode.index)
if compute_key in self.bdd.compute_table:
return self.bdd.compute_table[compute_key]
v = max([x for x in [self, thenNode, elseNode] if isinstance(x, DiagramNode)],
key=lambda x: x.label)
T = self._getNextThen(v.label).ITE(thenNode._getNextThen(v.label),
elseNode._getNextThen(v.label))
E = self._getNextElse(v.label).ITE(thenNode._getNextElse(v.label),
elseNode._getNextElse(v.label))
if T == E: return T
unique_key = (v.label, T.index, E.index)
if unique_key in self.bdd.unique_table:
R = self.bdd.unique_table[unique_key]
else:
R = DiagramNode(v.label, self.bdd, T, E)
self.bdd.unique_table[unique_key] = R
self.bdd.compute_table[compute_key] = R
return R
def __eq__(self, other):
return isinstance(other, DiagramNode) and\
self.label == other.label and\
self.thenNode is other.thenNode and\
self.elseNode is other.elseNode
def __neq__(self, other):
return not self.__eq__(other)
class BinaryDecisionDiagram(object):
termTrue = TerminalNode(True)
termFalse = TerminalNode(False)
def __init__(self):
self.unique_table = {}
self.variable_counter = 2
self.last = None
def newVariable(self, label):
unique_key = (label, 1, 0)
if unique_key in self.unique_table:
self.last = self.unique_table[unique_key]
return self.last
self.last = DiagramNode(label, self, self.termTrue, self.termFalse)
self.unique_table[unique_key] = self.last
return self.last
def apply_not(self, a):
self.compute_table = {}
res = a.ITE(self.termFalse, self.termTrue)
self.last = res
return res
def apply_and(self, a, b):
self.compute_table = {}
res = a.ITE(b, self.termFalse)
self.last = res
return res
def apply_or(self, a, b):
self.compute_table = {}
res = a.ITE(self.termTrue, b)
self.last = res
return res
def apply_imp(self, a, b):
self.compute_table = {}
res = a.ITE(b, self.termTrue)
self.last = res
return res
class Parser(object):
def __init__(self, bdd):
self.bdd = bdd
def parse(self, expr):
self.expr = expr
self.index = 0
return self.formula()
def formula(self):
if self.expr[self.index] == 'T':
self.index += 1
return self.bdd.termTrue
if self.expr[self.index] == 'F':
self.index += 1
return self.bdd.termFalse
if self.expr[self.index].isalpha():
self.index += 1
return self.bdd.newVariable(self.expr[self.index - 1])
if self.expr[self.index] == "-":
self.index += 1
return self.bdd.apply_not(self.formula())
if self.expr[self.index] == "(":
self.index += 1
f = self.formula()
op = self.expr[self.index]
if op == "*":
self.index += 1
f = self.bdd.apply_and(f, self.formula())
self.index += 1
return f
if op == "+":
self.index += 1
f = self.bdd.apply_or(f, self.formula())
self.index += 1
return f
if op == "-":
self.index += 2
f = self.bdd.apply_imp(f, self.formula())
self.index += 1
return f
print "error: " + self.expr[self.index:]
while True:
line = raw_input()
if line == "#": break
bdd = BinaryDecisionDiagram()
parser = Parser(bdd)
a, b = line.split("=")
if parser.parse(a + ";") == parser.parse(b + ";"):
print "YES"
else:
print "NO" | File "/tmp/tmp4n7sieq7/tmpep2xv2xi.py", line 141
print "error: " + self.expr[self.index:]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s087269363 | p01515 | u759949288 | 1363905989 | Python | Python | py | Runtime Error | 0 | 0 | 5352 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10000)
class TerminalNode(object):
def __init__(self, value):
self.index = int(value)
self.value = value
def __call__(self, assign):
return self.value
def printTree(self, visited=set(), indent=0):
print "\t" * indent, self
def _getNextThen(self, index):
return self
def _getNextElse(self, index):
return self
def ITE(self, thenNode, elseNode):
if self.value:
return thenNode
else:
return elseNode
def __eq__(self, other):
return isinstance(other, TerminalNode) and self.value == other.value
def __neq__(self, other):
return not self.__eq__(other)
def __repr__(self):
return "<TerminalNode: %s>" % self.value
class DiagramNode(object):
def __init__(self, label, bdd, thenNode, elseNode):
self.index = bdd.variable_counter
bdd.variable_counter += 1
self.label = label
self.thenNode = thenNode
self.elseNode = elseNode
self.bdd = bdd
def __call__(self, assign):
if assign[self.label]:
return self.thenNode(assign)
else:
return self.elseNode(assign)
def printTree(self, visited=set(), indent=0):
print "\t" * indent, self
# if self.index not in visited:
# visited.add(self.index)
self.thenNode.printTree(visited, indent + 1)
self.elseNode.printTree(visited, indent + 1)
def _getNextThen(self, label):
if label == self.label:
return self.thenNode
return self
def _getNextElse(self, label):
if label == self.label:
return self.elseNode
return self
def ITE(self, thenNode, elseNode):
# 計算済みなら計算したサブグラフを返す
compute_key = (self.index, thenNode.index, elseNode.index)
if compute_key in self.bdd.compute_table:
return self.bdd.compute_table[compute_key]
# 最も計算順序の早い変数
v = max([x for x in [self, thenNode, elseNode] if isinstance(x, DiagramNode)],
key=lambda x: x.label)
# 1枝側のサブグラフ
T = self._getNextThen(v.label).ITE(thenNode._getNextThen(v.label),
elseNode._getNextThen(v.label))
# 0枝側のサブグラフ
E = self._getNextElse(v.label).ITE(thenNode._getNextElse(v.label),
elseNode._getNextElse(v.label))
if T == E: return T
unique_key = (v.label, T.index, E.index)
if unique_key in self.bdd.unique_table:
R = self.bdd.unique_table[unique_key]
else:
R = DiagramNode(v.label, self.bdd, T, E)
self.bdd.unique_table[unique_key] = R
self.bdd.compute_table[compute_key] = R
return R
def noneGC(self, visited):
visited.add(self.index)
for v in (self.thenNode, self.elseNode):
if isinstance(v, DiagramNode) and v.index not in visited:
v.noneGC(visited)
def __eq__(self, other):
return isinstance(other, DiagramNode) and\
self.label == other.label and\
self.thenNode is other.thenNode and\
self.elseNode is other.elseNode
def __neq__(self, other):
return not self.__eq__(other)
def __repr__(self):
return "<DiagramNode: %s(%d)>" % (self.label, self.index)
class BinaryDecisionDiagram(object):
termTrue = TerminalNode(True)
termFalse = TerminalNode(False)
def __init__(self):
self.unique_table = {}
self.variable_counter = 2
self.last = None
def newVariable(self, label):
unique_key = (label, 1, 0)
if unique_key in self.unique_table:
self.last = self.unique_table[unique_key]
return self.last
self.last = DiagramNode(label, self, self.termTrue, self.termFalse)
self.unique_table[unique_key] = self.last
return self.last
def apply_not(self, a):
res = a.ITE(self.termFalse, self.termTrue)
self.last = res
return res
def apply_and(self, a, b):
res = a.ITE(b, self.termFalse)
self.last = res
return res
def apply_or(self, a, b):
res = a.ITE(self.termTrue, b)
self.last = res
return res
def gc(self, active=[]):
if self.last is not None:
visited = set()
for v in [self.last] + active:
v.noneGC(visited)
for key, value in self.unique_table.items():
if value.index not in visited:
del self.unique_table[key]
def apply_imp(self, a, b):
self.compute_table = {}
res = a.ITE(b, self.termTrue)
self.last = res
return res
class Parser(object):
def __init__(self, bdd):
self.bdd = bdd
def parse(self, expr):
self.expr = expr
self.index = 0
return self.formula()
def formula(self):
if self.expr[self.index] == 'T':
self.index += 1
return self.bdd.termTrue
if self.expr[self.index] == 'F':
self.index += 1
return self.bdd.termFalse
if self.expr[self.index].isalpha():
c = self.expr[self.index]
self.index += 1
return self.bdd.newVariable(c)
if self.expr[self.index] == "-":
self.index += 1
return self.bdd.apply_not(self.formula())
if self.expr[self.index] == "(":
self.index += 1
f = self.formula()
op = self.expr[self.index]
if op == "*":
self.index += 1
f = self.bdd.apply_and(f, self.formula())
self.index += 1
return f
if op == "+":
self.index += 1
f = self.bdd.apply_or(f, self.formula())
self.index += 1
return f
if op == "-":
self.index += 2
f = self.bdd.apply_imp(f, self.formula())
self.index += 1
return f
while True:
line = raw_input()
if line == "#": break
bdd = BinaryDecisionDiagram()
parser = Parser(bdd)
a, b = line.split("=")
a = parser.parse(a + ";")
b = parser.parse(b + ";")
if a == b:
print "YES"
else:
print "NO" | File "/tmp/tmpbpov4l5l/tmpzukos8aq.py", line 13
print "\t" * indent, self
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s316335056 | p01531 | u352394527 | 1546246985 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 | c = {"1":"", "2":"k", "3":"s", "4":"t", "5":"n",
"6":"h","7":"m", "8":"y", "9":"r", "0":"w"}
m = {"T":"a", "L":"i", "U":"u", "R":"e", "D":"o"}
s = input()
ans = ""
for i in range(0, len(s), 2):
if com == "0U":ans += "nn"
else:ans += c[com[0]] + m[com[1]]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpj8xwohf4/tmp2dxzg_7z.py", line 4, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s068740998 | p01538 | u615353970 | 1411443821 | Python | Python | py | Runtime Error | 0 | 0 | 798 | #include<iostream>
#include<string>
#include<vector>
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef long long int ll;
int main(void){
ll Q;
cin>>Q;
while(Q--){
string str;
int cnt = 0;
cin>>str;
vector<int> n(str.size());
rep(i,str.size())n[i]=str[i]-'0';
while(n.size()>1){
double num=0;
if(n[0]<=n[n.size()]){
loop(i,1,n.size())num=num*10+(n[i]);
num = num * (n[0]);
}else{
rep(i,n.size()-1){
num=num*10+n[i];
}num = num * (n[n.size()-1]);
}
int size=1;
rep(i,n.size()-1)size*=10;
n.clear();
if((int)num/size==0)size/=10;
while(num!=0){
int no=(int)num/size;
num=(int)num%size;
size=size/10;
n.push_back(no);
}
cnt++;
}
cout<<cnt<<endl;
}
} | File "/tmp/tmpax5zbuad/tmpfogxq6vt.py", line 8
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s885708977 | p01538 | u226964304 | 1413368432 | Python | Python3 | py | Runtime Error | 30 | 6828 | 512 | import sys
import math
Q = sys.stdin.readline()
for _ in range(int(Q)):
cnt = 0
N = int(sys.stdin.readline())
digLeng = int(math.log10(N)) + 1
while digLeng > 1:
Nmax = 0
for dig in range(digLeng):
lNum = N // int(math.pow(10,dig))
rNum = N % int(math.pow(10,dig))
Nmax = max(Nmax,lNum * rNum)
N = Nmax
cnt += 1
if N != 0:
digLeng = int(math.log10(N)) + 1
else:
digLeng = 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmp0vnmgtxv/tmpo3s5a7uj.py", line 4, in <module>
for _ in range(int(Q)):
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s455780406 | p01538 | u844945939 | 1414061912 | Python | Python3 | py | Runtime Error | 0 | 0 | 208 | for i in range(int(input())):
n = int(input())
j = 0
while n >= 10:
n = max((n // (10**k)) * (n % (10**k))
for k in range(1, int(log10(n)) + 1))
j += 1
print(j) | Traceback (most recent call last):
File "/tmp/tmpt9ucle46/tmpgewty5yp.py", line 1, in <module>
for i in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s984855703 | p01538 | u844945939 | 1414062742 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | for i in range(int(input())):
n = int(input())
j = 0
while n >= 10:
L = [(n // (10**k)) * (n % (10**k))
for k in range(1, int(log10(n)) + 1)]
n = max(L)
j += 1
print(j) | Traceback (most recent call last):
File "/tmp/tmpyhhu2d4e/tmpmv177giz.py", line 1, in <module>
for i in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s782160147 | p01538 | u844945939 | 1414063133 | Python | Python3 | py | Runtime Error | 0 | 0 | 289 | for i in range(int(input())):
n = int(input())
j = 0
while n >= 10:
m_max = 0
for k in range(1, int(log10(n)) + 1):
m = (n // (10**k)) * (n % (10**k))
if m >= m_max:
m_max = m
n = m_max
j += 1
print(j) | Traceback (most recent call last):
File "/tmp/tmplskk3uy_/tmpb9q346lo.py", line 1, in <module>
for i in range(int(input())):
^^^^^^^
EOFError: EOF when reading a line
| |
s567348913 | p01538 | u659034691 | 1503648803 | Python | Python3 | py | Runtime Error | 20 | 7720 | 932 | #times volume24 2424
Q=int(input())
for i in range(Q):
N=str(input())
c=0
while len(N)>1 and c<15:
M=0
for j in range(1,len(N)):
# print(N[:j])
l=int(N[:j])
r=int(N[j:])
l*=r
if M<l:
M=l
# print(M)
N=str(M)
c+=1
if c>=15:
d=[int(N)]
while c>=0 and c<50:
while len(N)>1 and c<50:
M=0
for j in range(1,len(N)):
# print(N[:j])
l=int(N[:j])
r=int(N[j:])
l*=r
if M<l:
M=l
# print(M)
k=0
while k<len(d) and M<d[k]:
k+=1
if M==d[k]:
c=-1
else:
d.insert(j,M)
N=str(N)
print(c) | Traceback (most recent call last):
File "/tmp/tmpjs7ioj1f/tmpnpfq323h.py", line 2, in <module>
Q=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s119763696 | p01538 | u591052358 | 1528779355 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | Q = int(input())
def solve(x,ans):
X = str(x)
if len(X) == 1:
print(ans)
return
ret= 0
for i in range(1,len(X)):
n = int(X[i:]) * int(X[:i])
ret = max(ans,n)
#print(ret)
return solve(ret,ans + 1)
for i in range(Q):
solve(int(input()),0)
| Traceback (most recent call last):
File "/tmp/tmpk03btxzv/tmp6cfj7md2.py", line 1, in <module>
Q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s698132933 | p01538 | u591052358 | 1528779632 | Python | Python3 | py | Runtime Error | 0 | 0 | 309 | Q = int(input())
def solve(x,ans):
X = str(x)
if len(X) == 1:
print(ans)
return
ret= 0
for i in range(1,len(X)):
n = int(X[i:]) * int(X[:i])
ret = max(ans,n)
#print(ret)
return solve(ret,ans + 1)
for i in range(Q):
solve(int(input()),0)
| Traceback (most recent call last):
File "/tmp/tmpm5u2jyvx/tmpukde2_6s.py", line 1, in <module>
Q = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s217985597 | p01545 | u408260374 | 1493938641 | Python | Python | py | Runtime Error | 0 | 0 | 1052 | import math
import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
class FenwickTree:
def __init__(self, a_list, f, default):
# 0-indexed
self.N = len(a_list)
self.bit = a_list[:]
self.f = f
self.default = default
for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):
self.bit.append(self.default)
for i in range(self.N - 1):
self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])
def update(self, i, val):
while i < self.N:
self.bit[i] = self.f(self.bit[i], val)
i |= i + 1
def query(self, n):
# [0, n]
ret = 0
while n >= 0:
ret = self.f(ret, self.bit[n])
n = (n & (n + 1)) - 1
return ret
N = int(input())
X = [int(x) for x in input().split()]
dp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)
for x, i in sorted((x, i) for i, x in enumerate(X)):
dp.update(i, dp.query(i) + x)
print(N * (N + 1) // 2 - dp.query(N - 1)) | Traceback (most recent call last):
File "/tmp/tmpit2oil66/tmp1fn3dbc2.py", line 33, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s498534095 | p01551 | u591052358 | 1530692279 | Python | Python3 | py | Runtime Error | 0 | 0 | 2323 | table= {}
def solve(dict,key):
global table
if key in table:
# print('key=',key)
return table[key]
ret = []
#print(key)
for i in dict[key]:
if i[0] == '[':
ret.append(i[1:-1])
else:
ret += (solve(dict, i))
if len(ret) > 200:
for i in table.keys():
table[i]=''
return ''
table[key] = ret
#print(key)
return ret
Na, Nt, Ng, Nc = [int(i) for i in input().split()]
m = int(input())
dict = {}
for i in range(m):
key, value = [i for i in input().split(': ')]
if i == 0:
aa = key
value = value.split()
dict[key] = value
lis = solve(dict, aa)
if len(lis)==Na+Nt+Ng+Nc:
DP = [[[[0 for i in range(Nc+1)]for j in range(Ng+1)]for k in range(N+1)]for l in range(len(lis)+1)]
#print(DP[4])
DP[0][0][0][0] = 1
#print(DP)
for i in range(len(lis)):
str = lis[i]
for a in range(i+1):
if a > Na:
break
for t in range(i-a+1):
if t > Nt:
break
for g in range(i-a-t+1):
if g > Ng:
break
# print(i,a,t,g)
if i-a-t-g > Nc:
continue
ans = DP[a][t][g][c] % 1000000007
# print(ans)
for char in str:
# print(i,a,t,g)
if char == 'A':
if a+1 > Na:
continue
DP[a+1][t][g][c] += ans
elif char == 'T':
if t+1 > Nt:
continue
DP[a][t+1][g][c] += ans
elif char == 'G':
if g+1 > Ng:
continue
DP[a][t][g+1][c] += ans
elif char == 'C':
if i-a-t-g+1> Nc:
continue
DP[a][t][g][c+1] += ans
# print(DP)
#DP[i][a][t][g] = ans % 1000000007
print(DP[len(lis)][Na][Nt][Ng]%1000000007)
else:
print(0)
| Traceback (most recent call last):
File "/tmp/tmpqhh1yft5/tmpz3_50386.py", line 22, in <module>
Na, Nt, Ng, Nc = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s687964027 | p01554 | u859393176 | 1466501687 | Python | Python3 | py | Runtime Error | 0 | 0 | 254 | n = int)input())
xs = []
for i in range(n): xs.append(input())
m = int(input())
flag = 1
for i in range(m):
s = input()
if s in l:
print("Opened" if flag == 1 else "Closed", "by", s)
flag ^= 1
else:
print("Unknown", s) | File "/tmp/tmp3khxw8z8/tmpjupzecuy.py", line 1
n = int)input())
^
SyntaxError: unmatched ')'
| |
s808999802 | p01554 | u859393176 | 1466501741 | Python | Python3 | py | Runtime Error | 0 | 0 | 255 | n = int)input())
xs = []
for i in range(n): xs.append(input())
m = int(input())
flag = 1
for i in range(m):
s = input()
if s in xs:
print("Opened" if flag == 1 else "Closed", "by", s)
flag ^= 1
else:
print("Unknown", s) | File "/tmp/tmpjn08l951/tmp8qkao1cj.py", line 1
n = int)input())
^
SyntaxError: unmatched ')'
| |
s308125029 | p01554 | u616098312 | 1466502009 | Python | Python3 | py | Runtime Error | 0 | 0 | 295 | now=False
N=int(input())
for k in range(N):
lst=lst.append(input())
M=int(input())
for t in range(M):
ID=input()
if ID in lst:
now=not(now)
if now:
print("Opened by",ID)
else:
print("Closed by",ID)
else:
print("Unknown",ID) | Traceback (most recent call last):
File "/tmp/tmpwawec9zm/tmpg8tjc537.py", line 2, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s789194819 | p01554 | u616098312 | 1466502138 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | now=False
lst=[]
N=int(input())
for k in range(N):
lst=lst.append(input())
M=int(input())
for t in range(M):
ID=input()
if ID in lst:
now=not(now)
if now:
print("Opened by",ID)
else:
print("Closed by",ID)
else:
print("Unknown",ID) | Traceback (most recent call last):
File "/tmp/tmpc7yj3eo8/tmpx88do0_n.py", line 3, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s916258031 | p01554 | u633333374 | 1502755528 | Python | Python | py | Runtime Error | 0 | 0 | 549 | def OorC():
if (T in lst) == True:
if lst2[lst.index(T)] % 2 == 0:
lst2[lst.index(T)] += 1
print "Opened by " + T
else:
lst2[lst.index(T)] += 1
print "Closed by " + T
else:
print "Unknown " + T
while 1:
N = int(input())
if N == 0:
break
lst = []
lst2 = []
for i in range(N):
lst.append(str(raw_input()))
lst2.append(0)
M = int(input())
for j in range(M):
T = str(raw_input())
OorC()
| File "/tmp/tmpshng6itx/tmp7ayce_gz.py", line 5
print "Opened by " + T
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s867488545 | p01554 | u633333374 | 1502755695 | Python | Python | py | Runtime Error | 0 | 0 | 511 | def OorC():
if (T in lst) == True:
if lst2[lst.index(T)] % 2 == 0:
lst2[lst.index(T)] += 1
print "Opened by " + T
else:
lst2[lst.index(T)] += 1
print "Closed by " + T
else:
print "Unknown " + T
while 1:
N = int(input())
lst = []
lst2 = []
for i in range(N):
lst.append(str(raw_input()))
lst2.append(0)
M = int(input())
for j in range(M):
T = str(raw_input())
OorC() | File "/tmp/tmp9fa6gc0k/tmp239c_rmh.py", line 5
print "Opened by " + T
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s335102612 | p01554 | u633333374 | 1502756417 | Python | Python | py | Runtime Error | 0 | 0 | 435 | while 1:
N = int(input())
a = 0
lst = []
for i in range(N):
lst.append(str(raw_input()))
M = int(input())
for j in range(M):
T = str(raw_input())
if (T in lst) == True:
if a == 0:
a = 1
print "Opened by " + T
else:
a = 0
print "Closed by " + T
else:
print "Unknown " + T
| File "/tmp/tmpfzsjjrnb/tmpx9vygbrx.py", line 13
print "Opened by " + T
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s628963025 | p01554 | u633333374 | 1502756697 | Python | Python | py | Runtime Error | 0 | 0 | 435 | while 1:
N = int(input())
a = 0
lst = []
for i in range(N):
lst.append(str(raw_input()))
M = int(input())
for j in range(M):
T = str(raw_input())
if (T in lst) == True:
if a == 0:
a = 1
print "Opened by " + T
else:
a = 0
print "Closed by " + T
else:
print "Unknown " + T
| File "/tmp/tmp1hk_3okp/tmp96_0fb4t.py", line 13
print "Opened by " + T
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s996701477 | p01554 | u633333374 | 1502842188 | Python | Python | py | Runtime Error | 0 | 0 | 418 |
N = int(input())
a = 0
lst = []
for i in range(N):
lst.append(str(raw_input()))
M = int(input())
for j in range(M):
T = str(raw_input())
if (T in lst) == True:
if a == 0:
a = 1
print "Opened by " + T
else:
a = 0
print "Closed by " + T
else:
print "Unknown " + T | File "/tmp/tmp91rou9gc/tmpt1hhrvn5.py", line 2
N = int(input())
IndentationError: unexpected indent
| |
s758692515 | p01554 | u187648898 | 1525691130 | Python | Python | py | Runtime Error | 0 | 0 | 317 | N = int(input())
U = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
opened = False
for T_i in T:
if T_i in U:
if opened == True:
print('Closed by ' + T_i)
opened == False
else:
print('Opened by ' + T_i)
opened == True
| Traceback (most recent call last):
File "/tmp/tmpfd2dt0jo/tmpjdu3_e0c.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s795172668 | p01554 | u187648898 | 1525691161 | Python | Python | py | Runtime Error | 0 | 0 | 317 | N = int(input())
U = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
opened = False
for T_i in T:
if T_i in U:
if opened == True:
print('Closed by ' + T_i)
opened == False
else:
print('Opened by ' + T_i)
opened == True
| Traceback (most recent call last):
File "/tmp/tmp0u5tuflu/tmp4_mjb6i_.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s785275228 | p01554 | u187648898 | 1525691170 | Python | Python | py | Runtime Error | 0 | 0 | 315 | N = int(input())
U = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
opened = False
for T_i in T:
if T_i in U:
if opened == True:
print('Closed by ' + T_i)
opened = False
else:
print('Opened by ' + T_i)
opened = True
| Traceback (most recent call last):
File "/tmp/tmp1x87hicb/tmpfkrrhhs9.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s618276833 | p01554 | u187648898 | 1525691253 | Python | Python | py | Runtime Error | 0 | 0 | 315 | N = int(input())
U = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
opened = False
for T_i in T:
if T_i in U:
if opened == True:
print('Closed by ' + T_i)
opened = False
else:
print('Opened by ' + T_i)
opened = True
| Traceback (most recent call last):
File "/tmp/tmp3m2nqbfk/tmp6qwczeic.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.