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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s701460795 | p01088 | u339921062 | 1499237013 | Python | Python | py | Runtime Error | 0 | 0 | 858 | while 1:
n = input()
if n == 0:
break
dp = [[None]*2001 for i in xrange(n+1)]
dp[0][0] = (0, 0)
for i in xrange(n):
cost = int(raw_input())
dost = cost % 1000
for j in xrange(2001):
if dp[i][j] is None:
continue
c, s = dp[i][j]
dp[i+1][j] = max(dp[i][j], dp[i+1][j])
if dost == 0:
if j >= 500:
dp[i+1][j - 500] = max(dp[i+1][j - 500], (c+1, s-cost))
else:
dp[i+1][j] = max(dp[i+1][j], (c, s-cost))
elif 1 <= dost <= 500+j:
dp[i+1][j + (500 - dost)] = max(dp[i+1][j + (500 - dost)], (c+1, s-cost))
else:
dp[i+1][j + (1000 - dost)] = max(dp[i+1][j + (1000 - dost)], (c, s-cost))
c, s = max(dp[n])
print c, -s | File "/tmp/tmp3imchk_y/tmpas5tuj9i.py", line 25
print c, -s
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s747885339 | p01088 | u339921062 | 1499237069 | Python | Python | py | Runtime Error | 0 | 0 | 860 | while 1:
n = input()
if n == 0:
break
dp = [[None]*10001 for i in xrange(n+1)]
dp[0][0] = (0, 0)
for i in xrange(n):
cost = int(raw_input())
dost = cost % 1000
for j in xrange(10001):
if dp[i][j] is None:
continue
c, s = dp[i][j]
dp[i+1][j] = max(dp[i][j], dp[i+1][j])
if dost == 0:
if j >= 500:
dp[i+1][j - 500] = max(dp[i+1][j - 500], (c+1, s-cost))
else:
dp[i+1][j] = max(dp[i+1][j], (c, s-cost))
elif 1 <= dost <= 500+j:
dp[i+1][j + (500 - dost)] = max(dp[i+1][j + (500 - dost)], (c+1, s-cost))
else:
dp[i+1][j + (1000 - dost)] = max(dp[i+1][j + (1000 - dost)], (c, s-cost))
c, s = max(dp[n])
print c, -s | File "/tmp/tmpn02gcxgj/tmp3fq01rji.py", line 25
print c, -s
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s013891867 | p01088 | u339921062 | 1499237564 | Python | Python | py | Runtime Error | 40000 | 193872 | 862 | while 1:
n = input()
if n == 0:
break
dp = [[None]*100001 for i in xrange(n+1)]
dp[0][0] = (0, 0)
for i in xrange(n):
cost = int(raw_input())
dost = cost % 1000
for j in xrange(100001):
if dp[i][j] is None:
continue
c, s = dp[i][j]
dp[i+1][j] = max(dp[i][j], dp[i+1][j])
if dost == 0:
if j >= 500:
dp[i+1][j - 500] = max(dp[i+1][j - 500], (c+1, s-cost))
else:
dp[i+1][j] = max(dp[i+1][j], (c, s-cost))
elif 1 <= dost <= 500+j:
dp[i+1][j + (500 - dost)] = max(dp[i+1][j + (500 - dost)], (c+1, s-cost))
else:
dp[i+1][j + (1000 - dost)] = max(dp[i+1][j + (1000 - dost)], (c, s-cost))
c, s = max(dp[n])
print c, -s | File "/tmp/tmp3_yl94pn/tmpeze8kwo3.py", line 25
print c, -s
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s620419307 | p01089 | u260980560 | 1499251330 | Python | Python | py | Runtime Error | 40000 | 9072 | 758 | while 1:
n = input()
if n == 0:
break
s = raw_input()
lock = 0
P = set()
for c in s:
if c is 'u':
lock = 0
else:
P.add((lock, 1 << int(c)))
lock |= 1 << int(c)
while 1:
Q = set()
for lock1, c1 in P:
for lock2, c2 in P:
if lock1 & lock2 == 0 and c1 & lock2 == c1:
Q.add((lock1 | lock2, c2))
if not Q - P:
break
P |= Q
ok = 1
for lock1, c1 in P:
for lock2, c2 in P:
if lock1 & lock2 == 0 and c1 & lock2 == c1 and c2 & lock1 == c2:
ok = 0
for lock, c in P:
if lock & c == c:
ok = 0
print "SAFE"*ok or "UNSAFE" | File "/tmp/tmp3dpc71zh/tmp83_b6015.py", line 31
print "SAFE"*ok or "UNSAFE"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s125765327 | p01089 | u260980560 | 1499251614 | Python | Python | py | Runtime Error | 40000 | 8260 | 819 | while 1:
n = input()
if n == 0:
break
s = raw_input()
lock = 0
P = set()
for c in s:
if c is 'u':
lock = 0
else:
P.add((lock, 1 << int(c)))
lock |= 1 << int(c)
while 1:
Q = set()
for lock1, c1 in P:
for lock2, c2 in P:
if lock1 & lock2 == 0 and c1 & lock2 == c1:
v = (lock1 | lock2, c2)
if v not in P:
Q.add(v)
if not Q:
break
P |= Q
ok = 1
for lock1, c1 in P:
for lock2, c2 in P:
if lock1 & lock2 == 0 and c1 & lock2 == c1 and c2 & lock1 == c2:
ok = 0
for lock, c in P:
if lock & c == c:
ok = 0
print "SAFE"*ok or "UNSAFE" | File "/tmp/tmp0fe_tr_q/tmpkiu8vm2z.py", line 33
print "SAFE"*ok or "UNSAFE"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s860278814 | p01089 | u260980560 | 1499251906 | Python | Python | py | Runtime Error | 40000 | 468092 | 807 | while 1:
n = input()
if n == 0:
break
s = raw_input()
lock = 0
P = []
for c in s:
if c is 'u':
lock = 0
else:
P.append((lock, 1 << int(c)))
lock |= 1 << int(c)
Q = set()
i = 0
while i < len(P):
lock1, t1 = P[i]
for j in xrange(i):
lock2, t2 = P[j]
if lock1 & lock2 == 0 and t1 & lock2 == t1:
v = (lock1 | lock2, t2)
if v not in Q:
P.append(v)
i += 1
ok = 1
for lock1, c1 in P:
for lock2, c2 in P:
if lock1 & lock2 == 0 and c1 & lock2 == c1 and c2 & lock1 == c2:
ok = 0
for lock, c in P:
if lock & c == c:
ok = 0
print "SAFE"*ok or "UNSAFE" | File "/tmp/tmp46q4966w/tmpwy2unu68.py", line 33
print "SAFE"*ok or "UNSAFE"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s797200585 | p01089 | u260980560 | 1499252091 | Python | Python | py | Runtime Error | 40000 | 468200 | 704 | while 1:
n = input()
if n == 0:
break
s = raw_input()
lock = 0
P = []
for c in s:
if c is 'u':
lock = 0
else:
P.append((lock, 1 << int(c)))
lock |= 1 << int(c)
Q = set()
i = 0; ok = 1
while i < len(P) and ok:
lock1, t1 = P[i]
if lock1 & t1 == t1:
ok = 0
for j in xrange(i):
lock2, t2 = P[j]
if lock1 & lock2 == 0 and t1 & lock2 == t1:
if t2 & lock1 == t2:
ok = 0
v = (lock1 | lock2, t2)
if v not in Q:
P.append(v)
i += 1
print "SAFE"*ok or "UNSAFE" | File "/tmp/tmpf2yr4td9/tmpnrg2q4ew.py", line 29
print "SAFE"*ok or "UNSAFE"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s895497682 | p01089 | u260980560 | 1499252279 | Python | Python | py | Runtime Error | 40000 | 7044 | 772 | while 1:
n = input()
if n == 0:
break
s = raw_input()
Q = set()
lock = 0
P = []
for c in s:
if c is 'u':
lock = 0
else:
v = (lock, 1 << int(c))
P.append(v)
Q.add(v)
lock |= 1 << int(c)
i = 0; ok = 1
while i < len(P) and ok:
lock1, t1 = P[i]
if lock1 & t1 == t1:
ok = 0
for j in xrange(i):
lock2, t2 = P[j]
if lock1 & lock2 == 0 and t1 & lock2 == t1:
if t2 & lock1 == t2:
ok = 0
v = (lock1 | lock2, t2)
if v not in Q:
P.append(v)
Q.add(v)
i += 1
print "SAFE"*ok or "UNSAFE" | File "/tmp/tmphbgemg23/tmppc_7c77t.py", line 32
print "SAFE"*ok or "UNSAFE"
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s133907467 | p01093 | u777299405 | 1480060950 | Python | Python3 | py | Runtime Error | 0 | 0 | 234 | while True:
n = int(input())
a = sorted(list(map(int, input().split())))
if n == 0:
break
ans = 1000
for i in range(n - 1):
j = a[i + 1] - a[i]
if j < ans:
ans = j
print(ans) | Traceback (most recent call last):
File "/tmp/tmpx2xbd9v4/tmpxu5vlnn1.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s767639648 | p01093 | u284260266 | 1526900845 | Python | Python3 | py | Runtime Error | 0 | 0 | 236 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
l = []
for i in range(1, len(a)):
for j in range(i+1,len(a)):
l.append(abs(a[i]-a[j]))
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmpgeacfon1/tmp55i47bu6.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s667027367 | p01093 | u284260266 | 1526900944 | Python | Python3 | py | Runtime Error | 0 | 0 | 236 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
l = []
for i in range(1, len(a)):
for j in range(i+1,len(a)):
l.append(abs(a[i]-a[j]))
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmpot7muzyw/tmp6xtgcyqm.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s213841414 | p01093 | u284260266 | 1526901170 | Python | Python3 | py | Runtime Error | 0 | 0 | 238 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
l = []
for i in range(1, len(a)-1):
for j in range(i+1,len(a)):
l.append(abs(a[i]-a[j]))
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmp4w7v6fcz/tmpmi0_ki05.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s850642771 | p01093 | u284260266 | 1526902123 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
l = []
for i in range(1, n-1):
for j in range(i+1,n):
l.append(abs(a[i]-a[j]))
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmpl8tguria/tmps8gdly3k.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s526466677 | p01093 | u284260266 | 1526982829 | Python | Python3 | py | Runtime Error | 0 | 0 | 262 | while True:
n = int(input())
a = list(map(int, input().split()))
l = list()
for i in range(1, n-1):
for j in range(i+1,n):
l.append(abs(a[i]-a[j]))
if l = []:
break
if n == 0:
break
print(min(l))
| File "/tmp/tmpkfw4kq8a/tmpc_yx37qy.py", line 9
if l = []:
^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s600872361 | p01093 | u951968562 | 1526986328 | Python | Python3 | py | Runtime Error | 0 | 0 | 350 | while True:
n,m = map(int,input().split())
if n == 0 and m == 0:
break
a = list(map(int,input().split()))
a.sort()
list1 = []
for i in range(n):
for j in range(i + 1, n):
price1 = a[i] + a[j]
list1.append(price1)
list1.sort()
list2 = list(filter(lambda p: m >= p, list1))
if list2:
print(max(list2))
else:
print("NONE")
| Traceback (most recent call last):
File "/tmp/tmpe3j6rr14/tmpca265li8.py", line 2, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s953547515 | p01093 | u284260266 | 1527049504 | Python | Python3 | py | Runtime Error | 0 | 0 | 266 | while True:
n = int(input())
a = list(map(int, input().split()))
l = list()
for i in range(1, n-1):
for j in range(i+1,n):
l.append(abs(a[i]-a[j]))
if l == []:
continue
if n == 0:
break
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmpe7u58bjz/tmptl88ue50.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s987877818 | p01093 | u284260266 | 1527053496 | Python | Python3 | py | Runtime Error | 0 | 0 | 326 | flg = True
while flg:
n = int(input())
if n == 0:
flg = False
a = list(map(int, input().split()))
l = list()
for i in range(0, n):
for j in range(0,n):
if i == j:
continue
l.append(abs(a[i]-a[j]))
if l == []:
continue
print(min(l))
| Traceback (most recent call last):
File "/tmp/tmpbnvd6fl7/tmpb0685cq_.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s984575841 | p01095 | u847467233 | 1531446110 | Python | Python3 | py | Runtime Error | 0 | 0 | 302 | # AOJ 1610: Bamboo Blossoms
# Python3 2018.7.13 bal4u
MAX = 7368792
cno = 0
tbl = [0]*MAX
while True:
m, n = map(int, input().split())
if m == 0: break
cno += 1
for i in range(n):
for j in range(m, MAX, m): tbl[j] = cno;
for j in range(m, MAX):
if tbl[j] != cno: break
m += 1
print(m)
| Traceback (most recent call last):
File "/tmp/tmpy9esvifq/tmpigdmxy41.py", line 8, in <module>
m, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s205726612 | p01095 | u847467233 | 1531446292 | Python | Python3 | py | Runtime Error | 0 | 0 | 306 | # AOJ 1610: Bamboo Blossoms
# Python3 2018.7.13 bal4u
MAX = 7368792
cno = 0
tbl = [0]*(MAX+2)
while True:
m, n = map(int, input().split())
if m == 0: break
cno += 1
for i in range(n):
for j in range(m, MAX, m): tbl[j] = cno;
for j in range(m, MAX):
if tbl[j] != cno: break
m += 1
print(m)
| Traceback (most recent call last):
File "/tmp/tmpe4tihaxo/tmp1mfq8rmw.py", line 8, in <module>
m, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s766713576 | p01095 | u847467233 | 1531446921 | Python | Python3 | py | Runtime Error | 0 | 0 | 327 | # AOJ 1610: Bamboo Blossoms
# Python3 2018.7.13 bal4u
MAX = 7368792
cno = 0
tbl = [0]*(MAX+2)
while True:
m, n = map(int, input().split())
if m == 0: break
tbl = [0] * (MAX+1)
for i in range(n):
for j in range(m, MAX, m): tbl[j] = 1
k = m
for j in range(m, MAX):
if not tbl[j]: break
k += 1
m = k
print(m)
| Traceback (most recent call last):
File "/tmp/tmpqroczz22/tmp6uudl39z.py", line 8, in <module>
m, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s216514586 | p01095 | u260980560 | 1482767311 | Python | Python | py | Runtime Error | 40000 | 162372 | 329 | while 1:
m, n = map(int, raw_input().split())
if m == 0:
break
MAX = 10**7
p= [0]*(MAX+1)
i = m
cnt = 0
while 1:
if not p[i]:
if cnt == n:
break
for j in xrange(i, MAX, i):
p[j] = 1
cnt += 1
i += 1
print i | File "/tmp/tmp5mlyw005/tmpl0mfnzey.py", line 17
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s622334924 | p01095 | u260980560 | 1482767560 | Python | Python | py | Runtime Error | 40000 | 84448 | 340 | MAX = 10**7
p = [0]*(MAX+1)
t = 1
while 1:
m, n = map(int, raw_input().split())
if m == 0:
break
i = m
cnt = 0
while 1:
if p[i] != t:
if cnt == n:
break
for j in xrange(i, MAX, i):
p[j] = t
cnt += 1
i += 1
print i
t += 1 | File "/tmp/tmpi00u7p5g/tmpuzte3m0e.py", line 18
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s402507140 | p01095 | u260980560 | 1482768650 | Python | Python | py | Runtime Error | 0 | 0 | 756 | import math
MAX = 7400000
prime = [1]*MAX
prime[0] = prime[1] = 0
res = []
sq = int(math.sqrt(MAX))
for i in xrange(2, sq+1):
q = len(res)
if prime[i]:
res.append(i)
for j in xrange(i*i, MAX, i):
prime[j] = 0
prime[i] = q
for i in xrange(sq+1, MAX):
q = len(res)
if prime[i]:
res.append(i)
prime[i] = q
def solve(m, n):
# [m,m*m)
sat = [0]*(m*m)
for i in xrange(m, m*m):
if not sat[i]:
if n == 0:
return i
n -= 1
for j in xrange(i, m*m, i):
sat[j] = 1
# [m*m,\inf)
idx = prime[m*m]
print m*m, res[idx]
return res[idx+n]
while 1:
m, n = map(int, raw_input().split())
print solve(m, n) | File "/tmp/tmpefh3gg7o/tmpchjoxfns.py", line 32
print m*m, res[idx]
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s304227547 | p01095 | u260980560 | 1482769086 | Python | Python | py | Runtime Error | 40000 | 84316 | 368 | MAX = 10**7
p = [0]*(MAX+1)
t = 1
while 1:
m, n = map(int, raw_input().split())
if m == 0:
break
i = m
cnt = 0
while 1:
if p[i] != t:
if cnt == n:
break
j = i
while j < MAX:
p[j] = t
j += i
cnt += 1
i += 1
print i
t += 1 | File "/tmp/tmpx9svfmc9/tmpru6nlhdg.py", line 20
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s463498969 | p01095 | u078042885 | 1483690624 | Python | Python3 | py | Runtime Error | 40000 | 122688 | 281 | while 1:
m,n=map(int,input().split())
if n==0:break
a=[0]*7368792
b,c=m,0
while c!=n:
if a[b]==0:
i=1
c+=1
while i*b<7368792:
a[i*b]=1
i+=1
b+=1
while a[b]:b+=1
print(b) | Traceback (most recent call last):
File "/tmp/tmpxvl2ebmk/tmpypty97q_.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s681865966 | p01095 | u078042885 | 1483690938 | Python | Python3 | py | Runtime Error | 40000 | 122652 | 281 | while 1:
m,n=map(int,input().split())
if m==0:break
a=[0]*7368792
b,c=m,0
while c!=n:
if a[b]==0:
i=1
c+=1
while i*b<7368792:
a[i*b]=1
i+=1
b+=1
while a[b]:b+=1
print(b) | Traceback (most recent call last):
File "/tmp/tmp_jx_ju82/tmpyx1mkqdl.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s360718062 | p01095 | u078042885 | 1483691007 | Python | Python3 | py | Runtime Error | 40000 | 122672 | 284 | while 1:
m,n=map(int,input().split())
if m==n==0:break
a=[0]*7368792
b,c=m,0
while c!=n:
if a[b]==0:
i=1
c+=1
while i*b<7368792:
a[i*b]=1
i+=1
b+=1
while a[b]:b+=1
print(b) | Traceback (most recent call last):
File "/tmp/tmp3w5mewzm/tmpdcosvvt1.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s179609452 | p01095 | u078042885 | 1483691188 | Python | Python3 | py | Runtime Error | 40000 | 294560 | 285 | while 1:
m,n=map(int,input().split())
if m==n==0:break
a=[0]*18368792
b,c=m,0
while c!=n:
if a[b]==0:
i=1
c+=1
while i*b<7368792:
a[i*b]=1
i+=1
b+=1
while a[b]:b+=1
print(b) | Traceback (most recent call last):
File "/tmp/tmpyb2_j8wz/tmpuh2z4br_.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s561124578 | p01095 | u078042885 | 1483692610 | Python | Python3 | py | Runtime Error | 40000 | 122764 | 282 | while 1:
m,n=map(int,input().split())
if m==0:break
a=[0]*7368792
b=m
while 1:
if not a[b]:
if n==0:
print(b)
break
n-=1
for i in range(b,7368792,b):
a[i]=1
b+=1 | Traceback (most recent call last):
File "/tmp/tmp2s711176/tmprzikdlb6.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s935009943 | p01095 | u078042885 | 1483693762 | Python | Python3 | py | Runtime Error | 40000 | 123320 | 263 | while 1:
m,n=map(int,input().split())
if m==0:break
a=[0]*7400000
b=m
while 1:
if 0==a[b]:
if n==0:
print(b)
break
n-=1
for i in range(b,7368792,b):a[i]=1
b+=1 | Traceback (most recent call last):
File "/tmp/tmpq1ebpzxy/tmp78o2pzta.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s538086341 | p01095 | u078042885 | 1483801061 | Python | Python3 | py | Runtime Error | 40000 | 123236 | 261 | while 1:
m,n=map(int,input().split())
if m==0:break
a=[True]*7400000
while 1:
if a[m]:
if n==0:
print(m)
break
n-=1
for i in range(m*2,7368792,m):a[i]=False
m+=1 | Traceback (most recent call last):
File "/tmp/tmpfe9xvu1l/tmpy6a6940w.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s264343171 | p01095 | u078042885 | 1484579425 | Python | Python3 | py | Runtime Error | 40000 | 123236 | 215 | while 1:
m,n=map(int,input().split())
if n==0:break
a=[False]*7400000
while n:
while a[m]:m+=1
n-=1
for i in range(m,7368792,m):a[i]=True
while a[m]:m+=1
print(m) | Traceback (most recent call last):
File "/tmp/tmpdea72dxe/tmpq2b_p4sz.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s793450632 | p01095 | u078042885 | 1484579639 | Python | Python3 | py | Runtime Error | 40000 | 123156 | 218 | while 1:
m,n=map(int,input().split())
if n==m==0:break
a=[False]*7400000
while n:
while a[m]:m+=1
n-=1
for i in range(m,7368792,m):a[i]=True
while a[m]:m+=1
print(m) | Traceback (most recent call last):
File "/tmp/tmpwwhb_af6/tmpa_rzkq_r.py", line 2, in <module>
m,n=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s729632731 | p01095 | u408260374 | 1493397915 | Python | Python3 | py | Runtime Error | 40000 | 122764 | 416 | while True:
M, N = map(int, input().split())
if M == N == 0:
break
INF = 7368791
P = [False] * (INF + 1)
cnt = 0
for i in range(M, INF + 1):
if cnt >= N:
break
if not P[i]:
for j in range(i, INF + 1, i):
P[j] = True
cnt += 1
for i in range(M, INF + 1):
if not P[i]:
print(i)
break | Traceback (most recent call last):
File "/tmp/tmpmed0j1iv/tmpw1i93wf4.py", line 2, in <module>
M, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s094907007 | p01095 | u408260374 | 1493398093 | Python | Python3 | py | Runtime Error | 40000 | 555476 | 558 | memo = dict()
while True:
M, N = map(int, input().split())
if M == N == 0:
break
if (M, N) in memo:
print(memo[(M, N)])
continue
INF = 7368791
P = [False] * (INF + 1)
cnt = 0
for i in range(M, INF + 1):
if cnt >= N:
break
if not P[i]:
memo[(M, cnt)] = i
for j in range(i, INF + 1, i):
P[j] = True
cnt += 1
for i in range(M, INF + 1):
if not P[i]:
memo[(M, N)] = i
print(i)
break | Traceback (most recent call last):
File "/tmp/tmp7u1tx17f/tmpycnzhcld.py", line 3, in <module>
M, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s526846216 | p01095 | u408260374 | 1493398194 | Python | Python | py | Runtime Error | 40000 | 744472 | 632 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
memo = dict()
while True:
M, N = map(int, input().split())
if M == N == 0:
break
if (M, N) in memo:
print(memo[(M, N)])
continue
INF = 7368791
P = [False] * (INF + 1)
cnt = 0
for i in range(M, INF + 1):
if cnt >= N:
break
if not P[i]:
memo[(M, cnt)] = i
for j in range(i, INF + 1, i):
P[j] = True
cnt += 1
for i in range(M, INF + 1):
if not P[i]:
memo[(M, N)] = i
print(i)
break | Traceback (most recent call last):
File "/tmp/tmph3c25ud8/tmpbgbxdsq4.py", line 6, in <module>
M, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s778795368 | p01095 | u408260374 | 1493398357 | Python | Python3 | py | Runtime Error | 40000 | 432020 | 674 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
memo = dict()
INF = 7368791
P = [False] * (INF + 1)
while True:
M, N = map(int, input().split())
if M == N == 0:
break
if (M, N) in memo:
print(memo[(M, N)])
continue
for i in range(INF + 1):
P[i] = False
cnt = 0
for i in range(M, INF + 1):
if cnt >= N:
break
if not P[i]:
memo[(M, cnt)] = i
for j in range(i, INF + 1, i):
P[j] = True
cnt += 1
for i in range(M, INF + 1):
if not P[i]:
memo[(M, N)] = i
print(i)
break | Traceback (most recent call last):
File "/tmp/tmpxyvig4de/tmpmk5bq9dd.py", line 8, in <module>
M, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s311452541 | p01095 | u408260374 | 1493398411 | Python | Python | py | Runtime Error | 40000 | 477004 | 674 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
memo = dict()
INF = 7368791
P = [False] * (INF + 1)
while True:
M, N = map(int, input().split())
if M == N == 0:
break
if (M, N) in memo:
print(memo[(M, N)])
continue
for i in range(INF + 1):
P[i] = False
cnt = 0
for i in range(M, INF + 1):
if cnt >= N:
break
if not P[i]:
memo[(M, cnt)] = i
for j in range(i, INF + 1, i):
P[j] = True
cnt += 1
for i in range(M, INF + 1):
if not P[i]:
memo[(M, N)] = i
print(i)
break | Traceback (most recent call last):
File "/tmp/tmpb6gh7nat/tmpkse9dfwp.py", line 8, in <module>
M, N = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s121273934 | p01095 | u506554532 | 1514541539 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | MAX = 7368800
while True:
M,N = map(int,input().split())
if M == 0: break
sieve = [0,0] + [1]*MAX
m = M
cnt = 0
while True:
if sieve[m]:
if cnt < N:
cnt += 1
for n in range(2*m,MAX+1,m):
sieve[n] = 0
else:
print(m)
break
m += 1 | Traceback (most recent call last):
File "/tmp/tmptd3uvrvd/tmp801qh8g0.py", line 4, in <module>
M,N = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s727504191 | p01095 | u506554532 | 1514551383 | Python | Python3 | py | Runtime Error | 0 | 0 | 556 | MAX = 7368800
src = [[] for i in range(101)]
i = 0
while True:
m,n = map(int,input().split())
if m == 0: break
src[m].append((n,i))
i += 1
Q = i
ans = [None] * Q
for m,qs in enumerate(src):
if len(qs) == 0: continue
qs.sort()
sieve = [0,0] + [1]*MAX
maxn = qs[-1][0]
tmp = []
n = m
while len(tmp) <= maxn:
if sieve[n]:
tmp.append(n)
for nn in range(2*n,MAX+1,n):
sieve[nn] = 0
n += 1
for n,i in qs:
ans[i] = tmp[n]
for a in ans:
print(a) | Traceback (most recent call last):
File "/tmp/tmp37ji1usl/tmpzx8lcqnw.py", line 6, in <module>
m,n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s707051112 | p01095 | u506554532 | 1514551585 | Python | Python3 | py | Runtime Error | 0 | 0 | 569 | MAX = 7368800
src = [[] for i in range(101)]
i = 0
while True:
m,n = map(int,input().split())
if m == 0: break
src[m].append((n,i))
i += 1
Q = i
ans = [None] * Q
for m,qs in enumerate(src):
if len(qs) == 0: continue
qs.sort()
sieve = [0,0] + [1]*MAX
maxn = qs[-1][0]
tmp = []
n = m
while len(tmp) <= maxn:
if sieve[n]:
tmp.append(n)
for nn in range(2*n,min(maxn*15,MAX+1),n):
sieve[nn] = 0
n += 1
for n,i in qs:
ans[i] = tmp[n]
for a in ans:
print(a) | Traceback (most recent call last):
File "/tmp/tmpwzxb6_r1/tmp2b0c7263.py", line 6, in <module>
m,n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s929453667 | p01095 | u269391636 | 1523370470 | Python | Python3 | py | Runtime Error | 0 | 0 | 230 | while(True):
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
break
lis = [i for i in range(m,n * 16)]
for i in range(n):
lis = [i for i in lis if i % lis[0]]
print(lis[0])
| Traceback (most recent call last):
File "/tmp/tmp2trfnahk/tmpgnjrymol.py", line 2, in <module>
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s277780564 | p01095 | u269391636 | 1523376465 | Python | Python3 | py | Runtime Error | 0 | 0 | 528 | def main():
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return 1
print(sieve(m,n)[0])
return 0
def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
if main():
break
| Traceback (most recent call last):
File "/tmp/tmpq__tdlu0/tmp3almuhth.py", line 25, in <module>
if main():
^^^^^^
File "/tmp/tmpq__tdlu0/tmp3almuhth.py", line 2, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s060387343 | p01095 | u269391636 | 1523376595 | Python | Python3 | py | Runtime Error | 0 | 0 | 527 | def main():
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return 1
print(sieve(m,n)[0])
return 0
def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 8):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
if main():
break
| Traceback (most recent call last):
File "/tmp/tmpmzdsg094/tmp2gkvi3uf.py", line 25, in <module>
if main():
^^^^^^
File "/tmp/tmpmzdsg094/tmp2gkvi3uf.py", line 2, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s752960040 | p01095 | u269391636 | 1523376762 | Python | Python3 | py | Runtime Error | 0 | 0 | 528 | def main():
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return 1
print(sieve(m,n)[0])
return 0
def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
if main():
break
| Traceback (most recent call last):
File "/tmp/tmp6ls6k0y2/tmpr1n2a7s8.py", line 25, in <module>
if main():
^^^^^^
File "/tmp/tmp6ls6k0y2/tmpr1n2a7s8.py", line 2, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s190001670 | p01095 | u269391636 | 1523376870 | Python | Python | py | Runtime Error | 0 | 0 | 528 | def main():
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return 1
print(sieve(m,n)[0])
return 0
def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
if main():
break
| Traceback (most recent call last):
File "/tmp/tmp8x3x6fkr/tmpkkg07tda.py", line 25, in <module>
if main():
^^^^^^
File "/tmp/tmp8x3x6fkr/tmpkkg07tda.py", line 2, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s169063043 | p01095 | u269391636 | 1523376889 | Python | Python3 | py | Runtime Error | 0 | 0 | 528 | def main():
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return 1
print(sieve(m,n)[0])
return 0
def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
if main():
break
| Traceback (most recent call last):
File "/tmp/tmpawl_w_5v/tmp0glw3n_0.py", line 25, in <module>
if main():
^^^^^^
File "/tmp/tmpawl_w_5v/tmp0glw3n_0.py", line 2, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s457611758 | p01095 | u269391636 | 1523377054 | Python | Python3 | py | Runtime Error | 0 | 0 | 470 | def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
while(True):
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
break
print(sieve(m,n)[0])
| Traceback (most recent call last):
File "/tmp/tmpey17c30o/tmp0dpy7ty5.py", line 17, in <module>
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s049190757 | p01095 | u269391636 | 1523377302 | Python | Python3 | py | Runtime Error | 0 | 0 | 518 | def mark(s, x):
for i in range(x, len(s), x):
s[i] = False
def sieve(m,n):
s = [False] * m + [True] * 16 * n
count = 0
for x in range(m,n * 16):
if s[x]:
mark(s, x)
count += 1
if count == n:
break
return [i for i in range(len(s)) if s[i] and i > 1]
def main():
while(True):
a = list(map(int, input().split()))
m , n = a[0], a[1]
if m == 0:
return(0)
print(sieve(m,n)[0])
main()
| Traceback (most recent call last):
File "/tmp/tmpzrammq_m/tmpn3la7_p_.py", line 25, in <module>
main()
File "/tmp/tmpzrammq_m/tmpn3la7_p_.py", line 19, in main
a = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s373325765 | p01095 | u011621222 | 1526636874 | Python | Python3 | py | Runtime Error | 0 | 0 | 471 | import sys
sys.setrecursionlimit(10000)
def f(start, goal):
global C
for i in range(start, goal):
for j in range(m, (i//2)+1):
if (i%j == 0):
C += 1
f(i+1, C)
while 1:
m, n = map(int, input().split())
if (m == 0 and n == 0):
break;
if (n < m):
print(m + n)
elif (n == m):
print(m + n + 1)
else:
C = m+n+1
f(2*m, C)
c = int(C)
while 1:
for i in range(m, C):
if (c%i == 0):
break
else:
print(c)
break
c += 1
| Traceback (most recent call last):
File "/tmp/tmpajogfh8e/tmppivu4j7e.py", line 12, in <module>
m, n = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s133708705 | p01095 | u509278866 | 1528185186 | Python | Python3 | py | Runtime Error | 0 | 0 | 1016 | 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
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:
m,n = LI()
if n == 0 and m == 0:
break
l = 7368792
a = [None] * l
j = m
for i in range(n):
while not a[j] is None:
j += 1
for k in range(j,l,j):
a[k] = 1
while not a[j] is None:
j += 1
rr.append(j)
return '\n'.join(map(str, rr))
print(main())
| Traceback (most recent call last):
File "/tmp/tmp62yardp_/tmphwmcwoni.py", line 42, in <module>
print(main())
^^^^^^
File "/tmp/tmp62yardp_/tmphwmcwoni.py", line 22, in main
m,n = LI()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s786971577 | p01095 | u509278866 | 1528186389 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | 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
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:
m,n = LI()
if n == 0 and m == 0:
break
l = 7368792
a = [None] * l
j = m
for i in range(n):
while a[j]:
j += 1
for k in range(j,l,j):
a[k] = True
while a[j]:
j += 1
print(j)
return
main()
| Traceback (most recent call last):
File "/tmp/tmpus9h_d4m/tmp7psx7gqe.py", line 42, in <module>
main()
File "/tmp/tmpus9h_d4m/tmp7psx7gqe.py", line 22, in main
m,n = LI()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s290890615 | p01095 | u509278866 | 1528186671 | Python | Python3 | py | Runtime Error | 0 | 0 | 970 | 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
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:
m,n = LI()
if n == 0 and m == 0:
break
l = min(7368792,n*20)
a = [None] * l
j = m
for i in range(n):
while a[j]:
j += 1
for k in range(j,l,j):
a[k] = True
while a[j]:
j += 1
print(j)
return
main()
| Traceback (most recent call last):
File "/tmp/tmpr744ns6t/tmpl5a0_bbl.py", line 42, in <module>
main()
File "/tmp/tmpr744ns6t/tmpl5a0_bbl.py", line 22, in main
m,n = LI()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s950475272 | p01095 | u509278866 | 1528186757 | Python | Python3 | py | Runtime Error | 0 | 0 | 960 | 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
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:
m,n = LI()
if n == 0 and m == 0:
break
l = 8368792
a = [None] * l
j = m
for i in range(n):
while a[j]:
j += 1
for k in range(j,l,j):
a[k] = True
while a[j]:
j += 1
print(j)
return
main()
| Traceback (most recent call last):
File "/tmp/tmp1wf_cxqd/tmpik3oi63b.py", line 42, in <module>
main()
File "/tmp/tmp1wf_cxqd/tmpik3oi63b.py", line 22, in main
m,n = LI()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s261075656 | p01095 | u284260266 | 1529038218 | Python | Python3 | py | Runtime Error | 0 | 0 | 356 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
den = [m]
for i in range(m+1, 1000000, 1):
den.append(i)
for j in range(0, len(den)-1, 1):
if i%den[j] == 0:
den.remove(i)
break
if len(den) > n:
print(den[-1])
break
| Traceback (most recent call last):
File "/tmp/tmp_xrcoxg_/tmpt1uy_2ot.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s409084010 | p01095 | u531592024 | 1529656813 | Python | Python3 | py | Runtime Error | 0 | 0 | 433 | while True:
(n, m) = list(map(int, input().split()))
if n == 0:
break
arr = [n]
app = arr.append
arrsize = 1
i = n + 1
while True:
ge = True
for e in arr:
if i % e == 0:
ge = False
break
if ge:
app(i)
arrsize += 1
if arrsize > m:
print(i)
break
i += 1
| Traceback (most recent call last):
File "/tmp/tmp93f1317f/tmp4o5t8tof.py", line 2, in <module>
(n, m) = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s186776166 | p01095 | u284260266 | 1529820855 | Python | Python3 | py | Runtime Error | 0 | 0 | 464 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
pri = []
for i in range(m, 7368792):
sea.append(True)
for i in range(0, m):
sea[i] = False
for i in range(m, len(sea)):
if sea[i] == True:
pri.append(i)
if len(pri) > n:
print(pri[-1])
break
for j in range(i, len(sea), i):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmpza_hytil/tmp10_rayia.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s721795918 | p01095 | u284260266 | 1529820980 | Python | Python3 | py | Runtime Error | 0 | 0 | 491 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = list()
pri = list()
for i in range(m, 7368792):
sea.append(True)
#print(sea)
for i in range(0, m):
sea[i] = False
for i in range(m, len(sea)):
if sea[i] == True:
pri.append(i)
if len(pri) > n:
print(pri[-1])
break
for j in range(i, len(sea), i):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmpez8t_pgv/tmptztyb7wy.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s526095847 | p01095 | u284260266 | 1529821777 | Python | Python3 | py | Runtime Error | 0 | 0 | 1525 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
pri = []
for i in range(0, 7368792):
sea.append(True)
#print(sea)
"""くそ長すぎて笑える
for i in range(0, 7368792-m):
pri.append(sea[i])
print(sea[i], i,"in")
for i in range(0, 7368792-m):
pri.append(sea[0])
for j in range(0, len(sea)):
if sea[j]%pri[i] == 0:
#print(pri[i], "m")
#print(sea[j], "del")
sea.remove(sea[j])
#break
if len(pri) > n:
print(pri[-1])
break
"""
#nが500000になると死ぬ
for i in range(0, m):
sea[i] = False
for i in range(m, len(sea)):
if sea[i] == True:
pri.append(i)
if len(pri) > n:
print(pri[-1])
break
for j in range(i, len(sea), i):
sea[j] = False
"""removeするとindexずれるわ
while True:#ver_Sieve_of_Eratosthenes
m, n = map(int,input().split())
if m == 0 and n == 0:
break
pri = list()
sea = list()
for i in range(2, 7368792):
sea.append(i)
for i in range(m, 7368792):
pri.append(sea[i-2])
print(pri)
for j in range(0,len(sea)):
if sea[j]%i == 0:
sea.remove(sea[j])
break
if len(pri) > n:
print(pri)
print(pri[-1])
break
"""
| Traceback (most recent call last):
File "/tmp/tmpry8_8ic1/tmptc2gu1ww.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s173148869 | p01095 | u284260266 | 1529822493 | Python | Python3 | py | Runtime Error | 0 | 0 | 483 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
pri = []
for i in range(0, 7368792):
sea.append(True)
#print(sea)
for i in range(0, m):
sea[i] = False
for i in range(m, len(sea)):
if sea[i] == True:
pri.append(i)
if len(pri) > n:
print(pri[-1])
break
for j in range(i, len(sea), i):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmps3nyxmrr/tmpabmr09ug.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s460192466 | p01095 | u284260266 | 1529823607 | Python | Python3 | py | Runtime Error | 0 | 0 | 503 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
#pri = []
co = 0
for i in range(0, 7368792):
sea.append(True)
for i in range(0, m):
sea[i] = False
for i in range(m, len(sea)):
if sea[i] == True:
co = co + 1
#pri.append(i)
if co > n:
print(sea.index(True))
break
for j in range(i, len(sea), i):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmpeugkuac0/tmpka94etbg.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s363386788 | p01095 | u284260266 | 1529824946 | Python | Python3 | py | Runtime Error | 0 | 0 | 458 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
#pri = []
co = 0
for i in range(m, 7368792):
sea.append(True)
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
#pri.append(i)
if co > n:
print(sea.index(True)+m)
break
for j in range(i, len(sea), i+m):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmppu_cwij5/tmp_ex9qmlw.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s118576174 | p01095 | u284260266 | 1530088061 | Python | Python3 | py | Runtime Error | 0 | 0 | 430 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = []
#pri = []
co = 0
sea = [True]*(7368792-m)
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
#pri.append(i)
if co > n:
print(sea.index(True)+m)
break
for j in range(i, len(sea), i+m):
sea[j] = False
| Traceback (most recent call last):
File "/tmp/tmprxidff04/tmpvi2q9ys8.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s895266960 | p01095 | u284260266 | 1530090613 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmphw_s4b8q/tmphdjqcoi4.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s445116206 | p01095 | u284260266 | 1530150221 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmposl22ko0/tmpts4qokzx.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s627146919 | p01095 | u284260266 | 1530170958 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp8zbzczct/tmp8qptm73m.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s960042212 | p01095 | u284260266 | 1530172336 | Python | Python3 | py | Runtime Error | 0 | 0 | 453 | a = 0
while True:
m, n = map(int,input().split())
if m == 0 and n == 0 and a == 0:
a = a+1
continue
elif m == 0 and n == 0 and a == 1:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp8q0gkfnf/tmp6saxlix0.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s748788803 | p01095 | u284260266 | 1530172443 | Python | Python3 | py | Runtime Error | 0 | 0 | 353 | while True:
m, n = map(int,input().split())
if m == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpv9kk_kp3/tmpk5s07xyr.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s477768220 | p01095 | u284260266 | 1530172568 | Python | Python3 | py | Runtime Error | 0 | 0 | 353 | while True:
m, n = map(int,input().split())
if m == 0:
break
sea = [True]*(7500111-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp28taq1hc/tmp06oq_18a.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s976131361 | p01095 | u284260266 | 1530181060 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpuodde974/tmpiczpysr3.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s653917404 | p01095 | u012868265 | 1530181545 | Python | Python3 | py | Runtime Error | 0 | 0 | 376 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp2y5dlztl/tmp4lw305_g.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s218562894 | p01095 | u012868265 | 1530181578 | Python | Python | py | Runtime Error | 0 | 0 | 376 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmprmphzhqm/tmpsq2ljdp8.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s154876218 | p01095 | u012868265 | 1530181731 | Python | Python | py | Runtime Error | 0 | 0 | 385 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = 8000000 #[True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpx84zekph/tmpbfatv516.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s535437423 | p01095 | u012868265 | 1530181751 | Python | Python | py | Runtime Error | 0 | 0 | 392 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*8000000 #[True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpu3odu46u/tmp529_fs3u.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s869909357 | p01095 | u012868265 | 1530181760 | Python | Python | py | Runtime Error | 0 | 0 | 372 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*8000000
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp6h8xnpyc/tmpxzq1p2wg.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s099581370 | p01095 | u012868265 | 1530181769 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*8000000
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp03zjpj98/tmpy7_3tf_4.py", line 3, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s337696279 | p01095 | u012868265 | 1530182276 | Python | Python3 | py | Runtime Error | 0 | 0 | 364 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpxj9ov1_n/tmpe6_yli6j.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s446664490 | p01095 | u012868265 | 1530184183 | Python | Python3 | py | Runtime Error | 0 | 0 | 370 | while True:
m, n = list(map(int,input().split()))
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp4bwxifnc/tmpj3gz5_pi.py", line 2, in <module>
m, n = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s982432252 | p01095 | u284260266 | 1530184200 | Python | Python3 | py | Runtime Error | 0 | 0 | 477 | while True:
m, n = map(int,input().split())
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
for i in range(0,len(sea)):
if sea[i] == True:
co = i+m
break
#print(sea.index(True)+m)
print(co)
| Traceback (most recent call last):
File "/tmp/tmp5xg_q7j9/tmpybvjmti4.py", line 2, in <module>
m, n = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s957325362 | p01095 | u012868265 | 1530185310 | Python | Python3 | py | Runtime Error | 0 | 0 | 373 | while True:
m, n = [int(i) for i in input().split()]
if m == 0 and n == 0:
break
sea = [True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpp5tyszxp/tmpcc4us_vp.py", line 2, in <module>
m, n = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s253069351 | p01095 | u012868265 | 1530185575 | Python | Python3 | py | Runtime Error | 0 | 0 | 408 | while True:
m, n = [int(i) for i in input().split()]
if m == 0 and n == 0:
break
sea = [True for i in range(0,7368792-m)]#[True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmp942i5s9d/tmpveisplq3.py", line 2, in <module>
m, n = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s331555246 | p01095 | u012868265 | 1530185801 | Python | Python3 | py | Runtime Error | 0 | 0 | 501 | while True:
m, n = [int(i) for i in input().split()]
if m == 0 and n == 0:
break
sea = [True for i in range(0,7368792-m)]#[True]*(7368792-m)
co = 0
for i in range(0, len(sea)):
if sea[i] == True:
co = co + 1
if co > n:
break
for j in range(i, len(sea), i+m):
sea[j] = False
for i in range(0,len(sea)):
if sea[i]:
print(i+m)
break
#print(sea.index(True)+m)
| Traceback (most recent call last):
File "/tmp/tmpn7wgm0v7/tmpchdr9jgn.py", line 2, in <module>
m, n = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s428545267 | p01095 | u855199458 | 1530256460 | Python | Python3 | py | Runtime Error | 0 | 0 | 355 | def inpl(): return list(map(int, input().split()))
M, N = inpl()
lim = 7368791 + 1
while N:
years = [False]*(lim)
for i in range(M, lim):
if years[i] == False:
if N == 0:
print(i)
break
for j in range(i, lim, i):
years[j] = True
N -= 1
M, N = inpl()
| Traceback (most recent call last):
File "/tmp/tmp0q23y_98/tmpx9wqk2fh.py", line 2, in <module>
M, N = inpl()
^^^^^^
File "/tmp/tmp0q23y_98/tmpx9wqk2fh.py", line 1, in inpl
def inpl(): return list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s268746049 | p01096 | u808689778 | 1535692617 | Python | Python3 | py | Runtime Error | 0 | 0 | 610 | n = int(input())
if n == 0:
break
w = list(map(int, input().split()))
dp = [[-1 for j in range(n + 1)] for i in range(n + 1)]
def rec(l, r):
# 既に計算済み?
if dp[l][r] != -1:
return dp[l][r]
# これ以上取り除けない?
if abs(l - r) <= 1:
return 0
res = 0
# パターン1.
if abs(w[l] - w[r - 1]) <= 1 and rec(l + 1, r - 1) == r - l - 2:
res = r - l
# パターン2.区間を分ける
for mid in range(l + 1, r - 1):
res = max(res, rec(l, mid) + rec(mid, r))
dp[l][r] = res
return res
print(rec(0, n))
| File "/tmp/tmpuyv2k16f/tmpyycypwy6.py", line 3
break
^^^^^
SyntaxError: 'break' outside loop
| |
s069161768 | p01096 | u408260374 | 1493641783 | Python | Python3 | py | Runtime Error | 40000 | 9108 | 572 | while True:
N = int(input())
if not N:
break
W = [int(x) for x in input().split()]
dp = [[0] * N for _ in range(N)]
for w in range(2, N + 1):
for left in range(N - w + 1):
# [left, right]
right = left + w - 1
for mid in range(left + 1, right):
dp[left][right] = max(dp[left][right], dp[left][mid] + dp[mid + 1][right])
if right - left - 1 == dp[left + 1][right - 1] and abs(W[left] - W[right]) <= 1:
dp[left][right] = right - left + 1
print(dp[0][N-1]) | Traceback (most recent call last):
File "/tmp/tmp3gcdif22/tmpu91x2h2q.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s278654131 | p01096 | u408260374 | 1493641896 | Python | Python3 | py | Runtime Error | 40000 | 9140 | 597 | while True:
N = int(input())
if not N:
break
W = [int(x) for x in input().split()]
dp = [[0] * N for _ in range(N)]
for w in range(2, N + 1):
for left in range(N - w + 1):
# [left, right]
right = left + w - 1
if right - left - 1 == dp[left + 1][right - 1] and abs(W[left] - W[right]) <= 1:
dp[left][right] = right - left + 1
continue
for mid in range(left + 1, right):
dp[left][right] = max(dp[left][right], dp[left][mid] + dp[mid + 1][right])
print(dp[0][N-1]) | Traceback (most recent call last):
File "/tmp/tmpwbm2aar4/tmpf5l744fm.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s629616152 | p01096 | u408260374 | 1493641938 | Python | Python | py | Runtime Error | 40000 | 7728 | 671 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
while True:
N = int(input())
if not N:
break
W = [int(x) for x in input().split()]
dp = [[0] * N for _ in range(N)]
for w in range(2, N + 1):
for left in range(N - w + 1):
# [left, right]
right = left + w - 1
if right - left - 1 == dp[left + 1][right - 1] and abs(W[left] - W[right]) <= 1:
dp[left][right] = right - left + 1
continue
for mid in range(left + 1, right):
dp[left][right] = max(dp[left][right], dp[left][mid] + dp[mid + 1][right])
print(dp[0][N-1]) | Traceback (most recent call last):
File "/tmp/tmp3hkd9ppq/tmp82d6zj3w.py", line 5, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s432813408 | p01096 | u408260374 | 1493642473 | Python | Python | py | Runtime Error | 40000 | 7732 | 807 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
while True:
N = int(input())
if not N:
break
W = [int(x) for x in input().split()]
dp = [[0] * N for _ in range(N)]
for i in range(N-1):
if abs(W[i] - W[i + 1]) <= 1:
dp[i][i + 1] = 2
for w in range(3, N + 1):
for left in range(N - w + 1):
# [left, right]
right = left + w - 1
if right - left - 1 == dp[left + 1][right - 1] and abs(W[left] - W[right]) <= 1:
dp[left][right] = right - left + 1
continue
for mid in range(left + 1, right):
m = dp[left][mid] + dp[mid + 1][right]
if m > dp[left][right]:
dp[left][right] = m
print(dp[0][N-1]) | Traceback (most recent call last):
File "/tmp/tmpues6x2jk/tmppww_42iv.py", line 5, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s743607675 | p01096 | u408260374 | 1493643617 | Python | Python | py | Runtime Error | 0 | 0 | 956 | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
ans = []
idx = [x for x in reversed(range(300))]
for i in range(299):
idx[i + 1] += idx[i]
def dec(l, r):
return idx[l] + r - l
while True:
N = int(input())
if not N:
break
W = [int(x) for x in input().split()]
dp = [0] * (N * (N + 1) // 2)
for i in range(N-1):
if abs(W[i] - W[i + 1]) <= 1:
dp[dec(i, i + 1)] = 2
for w in range(3, N + 1):
for left in range(N - w + 1):
# [left, right]
right = left + w - 1
if w - 2 == dp[dec(left + 1, right - 1)] and abs(W[left] - W[right]) <= 1:
dp[dec(left, right)] = w
continue
for mid in range(left + 1, right):
m = dp[dec(left, mid)] + dp[dec(mid + 1, right)]
if m > dp[dec(left, right)]:
dp[dec(left, right)] = m
print(dp[dec(0, N-1)]) | Traceback (most recent call last):
File "/tmp/tmpy2vyr_s2/tmpv9a576o7.py", line 13, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s566194934 | p01096 | u667806071 | 1496732499 | Python | Python3 | py | Runtime Error | 0 | 0 | 674 | def shot(i, daruma):
if i >= len(daruma):
results.append(n - len(daruma))
return
string = "_".join(map(str, daruma))
if dp[i].get(string):
return
dp[i][string] = True
shot(i + 1, daruma[:])
if abs(daruma[i - 1] - daruma[i]) <= 1:
del daruma[i]
del daruma[i - 1]
shot(1, daruma[:])
dp = []
results = []
n = 0
def resolve():
global results
global n
global dp
n = int(input())
if n == 0: return False
dp = [{} for x in range(n)]
daruma = list(map(int, input().split()))
results = []
shot(1, daruma[:])
print(max(results))
return True
while resolve(): pass | Traceback (most recent call last):
File "/tmp/tmpbmuuuy51/tmp4sicq8lh.py", line 35, in <module>
while resolve(): pass
^^^^^^^^^
File "/tmp/tmpbmuuuy51/tmp4sicq8lh.py", line 24, in resolve
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s527730074 | p01096 | u766926358 | 1526645568 | Python | Python3 | py | Runtime Error | 0 | 0 | 512 | def f(daruma):
global flag, min
if (flag):
return
length = len(daruma)
if (daruma == 0 or daruma == 1):
print(n - length)
flag = true
return
for i in range(length-1):
diff = abs(daruma[i] - daruma[i+1])
if (diff < 2):
kari_daruma = daruma[:i] + daruma[i+2:]
f(kari_daruma)
else:
min = (min if min <= length else length)
return
while 1:
count = 0
flag = False
n = int(input())
if (n == 0):
break
min = n
daruma = list(map(int, input().split()))
f(daruma)
print(n - min)
| Traceback (most recent call last):
File "/tmp/tmp17ylcbqe/tmpbatovu2a.py", line 25, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s044055955 | p01096 | u766926358 | 1526645712 | Python | Python3 | py | Runtime Error | 0 | 0 | 552 | import sys
sys.setrecursionlimit(10000)
def f(daruma):
global flag, min
if (flag):
return
length = len(daruma)
if (daruma == 0 or daruma == 1):
print(n - length)
flag = true
return
for i in range(length-1):
diff = abs(daruma[i] - daruma[i+1])
if (diff < 2):
kari_daruma = daruma[:i] + daruma[i+2:]
f(kari_daruma)
else:
min = (min if min <= length else length)
return
while 1:
count = 0
flag = False
n = int(input())
if (n == 0):
break
min = n
daruma = list(map(int, input().split()))
f(daruma)
print(n - min)
| Traceback (most recent call last):
File "/tmp/tmph68g03t0/tmppunut1yc.py", line 27, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s018241908 | p01096 | u766926358 | 1526646185 | Python | Python3 | py | Runtime Error | 0 | 0 | 553 | import sys
sys.setrecursionlimit(10000)
def f(daruma):
global flag, min
if (flag):
return
length = len(daruma)
if (daruma == 0 or daruma == 1):
print(n - length)
flag = true
return
for i in range(length-1):
diff = abs(daruma[i] - daruma[i+1])
if (diff < 2):
kari_daruma = daruma[:i] + daruma[i+2:]
f(kari_daruma)
else:
min = (min if min <= length else length)
return
while 1:
count = 0
flag = False
n = int(input())
if (n == 0):
break
min = n
daruma = list(map(int, input().split()))
f(daruma)
print(n - min)
| Traceback (most recent call last):
File "/tmp/tmpia6h1o32/tmpt851cgtu.py", line 28, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s904457969 | p01096 | u766926358 | 1526646248 | Python | Python3 | py | Runtime Error | 0 | 0 | 553 | import sys
sys.setrecursionlimit(10000)
def f(daruma):
global flag, min
if (flag):
return
length = len(daruma)
if (daruma == 0 or daruma == 1):
print(n - length)
flag = true
return
for i in range(length-1):
diff = abs(daruma[i] - daruma[i+1])
if (diff < 2):
kari_daruma = daruma[:i] + daruma[i+2:]
f(kari_daruma)
else:
min = (min if min <= length else length)
return
while 1:
count = 0
flag = False
n = int(input())
if (n == 0):
break
min = n
daruma = list(map(int, input().split()))
f(daruma)
print(n - min)
| Traceback (most recent call last):
File "/tmp/tmpyu6klmqc/tmpnxeosol0.py", line 28, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s987518138 | p01097 | u260980560 | 1482762240 | Python | Python | py | Runtime Error | 0 | 0 | 2724 | from collections import deque
while 1:
n, k, s = map(int, raw_input().split())
if n==0:
break
ps = [map(int, raw_input().split()) for i in xrange(n)]
G = [[] for i in xrange(n)]
for i in xrange(n):
xi, yi, zi = ps[i]
for j in xrange(i, n):
if i==j: continue
xj, yj, zj = ps[j]
dx = abs(xi-xj)
dy = abs(yi-yj)
dz = abs(zi-zj)
if dx < s and dy < s and dz < s:
cost = 2*((s-dx)*(s-dy)+(s-dy)*(s-dz)+(s-dz)*(s-dx))
G[i].append((j, cost))
G[j].append((i, cost))
print i, j, cost
ans = -1
used = [0]*n
for i in xrange(n):
if not used[i]:
used[i] = 1
deq = deque()
deq.append((i, -1))
loop = 0
cnt = 1
leaf = i
while deq:
v, prev = deq.popleft()
if len(G[v]) == 1:
leaf = v
for t, co in G[v]:
if not used[t]:
used[t] = 1
deq.append((t, v))
cnt += 1
elif prev != t:
loop = 1
d_used = [0]*n
if cnt < k:
continue
deq_c = deque()
res = 0
if not loop:
deq.append(leaf)
d_used[leaf] = 1
while deq:
v = deq.popleft()
for t, co in G[v]:
if not d_used[t]:
deq.append(t)
d_used[t] = 1
if len(deq_c) >= k-1:
res -= deq_c.popleft()
res += co
ans = max(ans, res)
deq_c.append(co)
else:
t, co = G[i][0]
d_used[t] = 1
res = co
deq.append((t, i))
deq_c.append(co)
ans = max(ans, res)
while deq:
v, prev = deq.popleft()
for t, co in G[v]:
if not d_used[t] and t != prev:
deq.append((t, v))
d_used[t] = 1
if len(deq_c) >= k-1 and cnt > k:
res -= deq_c.popleft()
res += co
ans = max(ans, res)
deq_c.append(co)
if ans == -1:
print -1
else:
print 6*k*s*s - ans | File "/tmp/tmpwt6t78df/tmptuyk8227.py", line 23
print i, j, cost
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s547854722 | p01097 | u260980560 | 1482762379 | Python | Python | py | Runtime Error | 0 | 0 | 2791 | from collections import deque
def ipt():
while 1:
try:
return raw_input()
except:pass
while 1:
n, k, s = map(int, ipt().split())
if n==0:break
ps = [map(int, ipt().split()) for i in xrange(n)]
G = [[] for i in xrange(n)]
for i in xrange(n):
xi, yi, zi = ps[i]
for j in xrange(i, n):
if i==j: continue
xj, yj, zj = ps[j]
dx = abs(xi-xj)
dy = abs(yi-yj)
dz = abs(zi-zj)
if dx < s and dy < s and dz < s:
cost = 2*((s-dx)*(s-dy)+(s-dy)*(s-dz)+(s-dz)*(s-dx))
G[i].append((j, cost))
G[j].append((i, cost))
print i, j, cost
ans = -1
used = [0]*n
for i in xrange(n):
if not used[i]:
used[i] = 1
deq = deque()
deq.append((i, -1))
loop = 0
cnt = 1
leaf = i
while deq:
v, prev = deq.popleft()
if len(G[v]) == 1:
leaf = v
for t, co in G[v]:
if not used[t]:
used[t] = 1
deq.append((t, v))
cnt += 1
elif prev != t:
loop = 1
d_used = [0]*n
if cnt < k:
continue
deq_c = deque()
res = 0
if not loop:
deq.append(leaf)
d_used[leaf] = 1
while deq:
v = deq.popleft()
for t, co in G[v]:
if not d_used[t]:
deq.append(t)
d_used[t] = 1
if len(deq_c) >= k-1:
res -= deq_c.popleft()
res += co
ans = max(ans, res)
deq_c.append(co)
else:
t, co = G[i][0]
d_used[t] = 1
res = co
deq.append((t, i))
deq_c.append(co)
ans = max(ans, res)
while deq:
v, prev = deq.popleft()
for t, co in G[v]:
if not d_used[t] and t != prev:
deq.append((t, v))
d_used[t] = 1
if len(deq_c) >= k-1 and cnt > k:
res -= deq_c.popleft()
res += co
ans = max(ans, res)
deq_c.append(co)
if ans == -1:
print -1
else:
print 6*k*s*s - ans | File "/tmp/tmputqgvex3/tmpw6nu8zpw.py", line 27
print i, j, cost
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s335048086 | p01097 | u408260374 | 1495152573 | Python | Python3 | py | Runtime Error | 0 | 0 | 3717 | class Cube:
def __init__(self, x, y, z, s):
self.x, self.y, self.z = x, y, z
self.s = s
def is_in_cube(self, x, y, z):
return self.x <= x <= self.x + self.s and self.y <= y <= self.y + self.s and self.z <= z <= self.z + self.s
def intersect(self, C):
dxyz = [(0, 0, 0),
(C.s, 0, 0), (0, C.s, 0), (0, 0, C.s),
(C.s, C.s, 0), (C.s, 0, C.s), (0, C.s, C.s),
(C.s, C.s, C.s)]
for dx1, dy1, dz1 in dxyz:
nx1, ny1, nz1 = C.x + dx1, C.y + dy1, C.z + dz1
if self.is_in_cube(nx1, ny1, nz1):
for dx2, dy2, dz2 in dxyz:
nx2, ny2, nz2 = self.x + dx2, self.y + dy2, self.z + dz2
if C.is_in_cube(nx2, ny2, nz2):
a, b, c = abs(nx1 - nx2), abs(ny1 - ny2), abs(nz1 - nz2)
if a * b * c == 0:
continue
# print(a, b, c, end=':')
return 2 * (a * b + b * c + c * a)
return 0
INF = 10 ** 9
while True:
N, K, S = map(int, input().split())
# print((N, K, S))
if not (N | K | S):
break
cubes = [Cube(*map(int, input().split()), S) for _ in range(N)]
if K == 1:
# print(6 * S ** 2)
continue
edge = [[] for _ in range(N)]
for i in range(N):
for j in range(i + 1, N):
if cubes[i].intersect(cubes[j]):
# print(i, j, cubes[i].intersect(cubes[j]))
edge[i].append(j)
edge[j].append(i)
ans = INF
used = [False] * N
for i in range(N):
if not used[i] and len(edge[i]) == 1:
con_c = [i]
used[i] = True
now = edge[i][0]
while not used[now]:
used[now] = True
con_c.append(now)
for e in edge[now]:
if not used[e]:
now = e
# print(con_c, now, len(edge[i]), len(edge[now]))
if len(con_c) < K:
continue
con_s = [0]
for i in range(len(con_c) - 1):
a, b = cubes[con_c[i]], cubes[con_c[i + 1]]
con_s.append(a.intersect(b))
# print(con_s)
base = 6 * (S ** 2) * K
for i in range(len(con_s) - 1):
con_s[i + 1] += con_s[i]
for i in range(len(con_s) - K + 1):
ans = min(ans, base - (con_s[i + K - 1] - con_s[i]))
for i in range(N):
if not used[i] and len(edge[i]) == 2:
con_c = [i]
used[i] = True
now = edge[i][0]
while not used[now]:
used[now] = True
con_c.append(now)
for e in edge[now]:
if not used[e]:
now = e
# print(con_c, now, len(edge[i]), len(edge[now]))
if len(con_c) < K:
continue
con_s = [0]
for i in range(len(con_c) - 1):
a, b = cubes[con_c[i]], cubes[con_c[i + 1]]
con_s.append(a.intersect(b))
a, b = cubes[con_c[0]], cubes[con_c[-1]]
con_s.append(a.intersect(b))
# print(con_s)
if len(con_c) == K:
ans = min(ans, base - sum(con_s))
continue
con_s += con_s[1:]
for i in range(len(con_s) - 1):
con_s[i + 1] += con_s[i]
base = 6 * (S ** 2) * K
for i in range(len(con_c)):
ans = min(ans, base - (con_s[i + K - 1] - con_s[i]))
print(ans if ans != INF else -1) | Traceback (most recent call last):
File "/tmp/tmp2pii9oyz/tmpxcadsx2v.py", line 29, in <module>
N, K, S = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s194927511 | p01097 | u260980560 | 1499912738 | Python | Python | py | Runtime Error | 0 | 0 | 2538 | from collections import deque
while 1:
n, k, s = map(int, raw_input().split())
if n==0:break
ps = [map(int, raw_input().split()) for i in xrange(n)]
G = [[] for i in xrange(n)]
for i in xrange(n):
xi, yi, zi = ps[i]
for j in xrange(i+1, n):
if i==j: continue
xj, yj, zj = ps[j]
dx = abs(xi-xj)
dy = abs(yi-yj)
dz = abs(zi-zj)
if dx < s and dy < s and dz < s:
cost = 2*((s-dx)*(s-dy)+(s-dy)*(s-dz)+(s-dz)*(s-dx))
G[i].append((j, cost))
G[j].append((i, cost))
ans = -1
leaf = set()
used = [0]*n
for i in xrange(n):
if len(G[i]) == 0:
if k == 1:
ans = 0
used[i] = 1
elif len(G[i]) == 1:
leaf.add(i)
for v in leaf:
if used[v]:
continue
used[v] = 1
prev = t = None
deq = deque()
su = 0
while 1:
if prev is not None and len(G[v]) == 1:
break
for t, cost in G[v]:
if t == prev:
continue
used[t] = 1
if len(deq) < k-1:
deq.append(cost)
su += cost
else:
su -= deq.popleft()
deq.append(cost)
su += cost
break
if len(deq) == k-1:
ans = max(ans, su)
v, prev = t, v
for v in xrange(n):
if used[v]:
continue
prev = t = None
used[v] = 1
u = set([v])
while used[v] < 3:
for t, cost in G[v]:
if t == prev:
continue
used[t] += 1
u.add(t)
break
v, prev = t, v
cont = k if len(u) == k else k-1
prev = t = None
deq = deque(); su = 0
for i in xrange(2*len(u)):
for t, cost in G[v]:
if t == prev:
continue
if len(deq) < cont:
deq.append(cost)
su += cost
else:
su -= deq.popleft()
su += cost
deq.append(cost)
break
if len(deq) == cont:
ans = max(ans, su)
v, prev = t, v
if ans == -1:
print -1
else:
print 6*k*s*s - ans | File "/tmp/tmp2u6voeii/tmpvrfr0io8.py", line 91
print -1
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s885597924 | p01101 | u866872417 | 1530964195 | Python | Python3 | py | Runtime Error | 0 | 0 | 371 | while(True):
n,m=map(int,input().split(" "))
if(n==0):
break
things = map(int,input().split(" "))
_max=0
for i in range(len(things)):
for j in range(i+1,len(things)):
ifthings[ i]+things[j] <= m:
_max = max(things[i]+things[j],_max):
if _max != None:
print(_max)
else:
print("NONE")
| File "/tmp/tmp89lss1t4/tmppklbp9z1.py", line 9
ifthings[ i]+things[j] <= m:
^
SyntaxError: invalid syntax
| |
s717113790 | p01101 | u595788415 | 1555901613 | Python | Python | py | Runtime Error | 0 | 0 | 442 | while True:
n, m = map(int, input().split())
if n == 0:
break
a = sorted(map(int, input().split()))
index = bisect.bisect_left(a, m) - 1
if index <= 0:
print("NONE")
continue
ans = 0
for i in range(index, 0, -1):
for j in range(i-1, -1, -1):
if a[i] + a[j] <= m:
ans = max(ans, a[i] + a[j])
if ans:
print(ans)
else:
print("NONE")
| Traceback (most recent call last):
File "/tmp/tmpsb6_43mc/tmp9lpi0spt.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
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.