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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s900640077 | p00659 | u957028788 | 1502073437 | Python | Python3 | py | Runtime Error | 0 | 0 | 1010 | while True:
player_nun = int(input())
player_nun = 4
if player_nun == 0:
break
#?????????????????????
whole_data = []
for i in (0, player_nun):
dat = input().split()
p_data = []
p_data.append(dat[0])
for x in dat[1:]:
p_data.append(int(x))
whole_data.append(p_data)
#???????????????????????????????????????
xel = {}
for i in whole_data:
for x in i[2:]:
if x in xel:
xel[x] += 1
else:
xel[x] = 1
#??????????????????????????¢?????????
score = {}
for y in xel.keys():
score[y] = 5 - xel[y]
#????????¢??¨????????????????????????????????????
result = []
for i in whole_data:
player_score = []
player_score.append(i[0])
player_score.append(0)
for x in i[2:]:
player_score[1] += score[x]
result.append(player_score)
#?????????????????????????¬?????????????????±???????
min_score = min(x[1] for x in result)
winners = []
for x in result:
if x[1] == min_score:
winners.append(x[0])
print(str(min_score) + " " + sorted(winners)[0]) | Traceback (most recent call last):
File "/tmp/tmp6785u4sg/tmpmh_c5b4x.py", line 2, in <module>
player_nun = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s268000803 | p00659 | u957028788 | 1502073734 | Python | Python3 | py | Runtime Error | 0 | 0 | 1031 | while True:
player_nun = int(input())
player_nun = 4
if player_nun == 0:
break
#?????????????????????
whole_data = []
for i in range(0, player_nun):
dat = input().split()
p_data = []
p_data.append(dat[0])
for x in dat[1:]:
p_data.append(int(x))
whole_data.append(p_data)
print(whole_data)
#???????????????????????????????????????
xel = {}
for i in whole_data:
for x in i[2:]:
if x in xel:
xel[x] += 1
else:
xel[x] = 1
#??????????????????????????¢?????????
score = {}
for y in xel.keys():
score[y] = 5 - xel[y]
#????????¢??¨????????????????????????????????????
result = []
for i in whole_data:
player_score = []
player_score.append(i[0])
player_score.append(0)
for x in i[2:]:
player_score[1] += score[x]
result.append(player_score)
#?????????????????????????¬?????????????????±???????
min_score = min(x[1] for x in result)
winners = []
for x in result:
if x[1] == min_score:
winners.append(x[0])
print(str(min_score) + " " + sorted(winners)[0]) | Traceback (most recent call last):
File "/tmp/tmpn9dx_xsx/tmp0s9e1jyi.py", line 2, in <module>
player_nun = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s059284963 | p00659 | u957028788 | 1502073781 | Python | Python3 | py | Runtime Error | 0 | 0 | 1031 | while True:
player_nun = int(input())
player_nun = 4
if player_nun == 0:
break
#?????????????????????
whole_data = []
for i in range(0, player_nun):
dat = input().split()
p_data = []
p_data.append(dat[0])
for x in dat[1:]:
p_data.append(int(x))
whole_data.append(p_data)
print(whole_data)
#???????????????????????????????????????
xel = {}
for i in whole_data:
for x in i[2:]:
if x in xel:
xel[x] += 1
else:
xel[x] = 1
#??????????????????????????¢?????????
score = {}
for y in xel.keys():
score[y] = 5 - xel[y]
#????????¢??¨????????????????????????????????????
result = []
for i in whole_data:
player_score = []
player_score.append(i[0])
player_score.append(0)
for x in i[2:]:
player_score[1] += score[x]
result.append(player_score)
#?????????????????????????¬?????????????????±???????
min_score = min(x[1] for x in result)
winners = []
for x in result:
if x[1] == min_score:
winners.append(x[0])
print(str(min_score) + " " + sorted(winners)[0]) | Traceback (most recent call last):
File "/tmp/tmpit9y8l94/tmp6dwoxep5.py", line 2, in <module>
player_nun = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s500271573 | p00661 | u546285759 | 1491192425 | Python | Python3 | py | Runtime Error | 0 | 0 | 212 | while True:
n, m = map(int, input().split())
if n == 0:
break
flag = 1
for i in range(m):
if int(input()) == 1:
flag = 0
print('{:.10f}'.format(n/2 if flag else 0)) | Traceback (most recent call last):
File "/tmp/tmp5lvm137u/tmp6gb5hyok.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s129996966 | p00661 | u633068244 | 1399377642 | Python | Python | py | Runtime Error | 20 | 4240 | 232 | while 1:
n,m = map(int,raw_input().split())
if n == 0: break
p = map(int,raw_input().split())
sp = set()
for pi in p: sp |= set([pi*j for j in range(1,n/pi+1)])
print (n*(n+1)/2-sum(sp))*1.0/(n-len(sp)) if n-len(sp) > 0 else 0 | Traceback (most recent call last):
File "/tmp/tmpzj3u6_7s/tmptzhol2gv.py", line 2, in <module>
n,m = map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s013616837 | p00661 | u633068244 | 1399379639 | Python | Python | py | Runtime Error | 10 | 4440 | 694 | import itertools
def prdct(array):
ref = 1
for a in array: ref *= a
return ref
while 1:
n,m = map(int,raw_input().split())
if n == 0: break
p = sorted(map(int,raw_input().split()))
if 1 in p:
print 0.0
continue
for i in range(len(p)-1,0,-1):
for j in range(i):
while 1:
if p[i] == p[j]:
del p[i]
break
elif p[i]%p[j] == 0:
p[i] /= p[j]
else:
break
d = sum(pi*(n/pi*(n/pi+1))/2 for pi in p)
m = sum(n/pi for pi in p)
q = []
for i in range(2,len(p)+1):
q += [prdct(element) for element in itertools.combinations(p,i)]
d -= sum(qi*(n/qi*(n/qi+1))/2 for qi in q)
m -= sum(n/qi for qi in q)
print (n*(n+1)/2-d)*1.0/(n-m) if n-m > 0 else 0.0 | File "/tmp/tmp768cuatl/tmpqiccvp9l.py", line 12
print 0.0
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s592414572 | p00662 | u633068244 | 1399376434 | Python | Python | py | Runtime Error | 0 | 0 | 224 | while 1:
N = map(int,raw_input().split())
if sum(N) == 0: break
md,gg,go = N[0]+N[3],N[1]+N[4],N[2]+N[5]
mn = min(md,gg,go)
ans = 0
for i in range(max(0,w-2),w):
ans = max(ans,i+(md-i)/3+(gg-i)/3+(go-i)/3)
print ans | File "/tmp/tmpfm70z0_c/tmptws81mgx.py", line 9
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s111072805 | p00664 | u633068244 | 1400142073 | Python | Python | py | Runtime Error | 0 | 0 | 374 | while 1:
r,c,q = map(int,raw_input().split())
if r == 0: break
R = [[0,0] for i in range(r)]
C = [[0,0] for i in range(r)]
for i in range(1,q+1):
A,B,order = map(int,raw_input().split())
if A == 0:
R[B] = [i,order]
else:
C[B] = [i,order]
ans = 0
for ri in range(r):
ans += sum(R[ri][1] if R[ri][0] > C[ci][0] else C[ci][1] for ci in range(c))
print ans | File "/tmp/tmpevwy5jc6/tmp2zbozrln.py", line 15
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s905133307 | p00670 | u041086527 | 1416069287 | Python | Python | py | Runtime Error | 0 | 0 | 600 | import bisect
while True:
n,S = map(int, raw_input().split())
if n == 0 and S == 0:
break
r = [input() for i in range(n)]
ans = 0
r.sort()
for i in range(n):
tmp = S - r[i] + 1
if (tmp <= 0):
ans += n - 1
else:
d = r[0:i] + r[i + 1:]
left,right = 0,n
while (right - left > 1):
med = (right + left) / 2
if (d[med] <= tmp):
left = med
else:
right = med
ans += (len(d) - left) - 1
print ans / 2 | File "/tmp/tmpvaxgq5f8/tmplyq2ivqm.py", line 23
print ans / 2
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s323784507 | p00670 | u041086527 | 1416069315 | Python | Python | py | Runtime Error | 0 | 0 | 600 | import bisect
while True:
n,S = map(int, raw_input().split())
if n == 0 and S == 0:
break
r = [input() for i in range(n)]
ans = 0
r.sort()
for i in range(n):
tmp = S - r[i] + 1
if (tmp <= 0):
ans += n - 1
else:
d = r[0:i] + r[i + 1:]
left,right = 0,n
while (right - left > 1):
med = (right + left) / 2
if (d[med] <= tmp):
left = med
else:
right = med
ans += (len(d) - left) - 1
print ans / 2 | File "/tmp/tmpdo8_qeg9/tmpc3az7tle.py", line 23
print ans / 2
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s582049578 | p00670 | u041086527 | 1416069414 | Python | Python | py | Runtime Error | 0 | 0 | 586 | while True:
n,S = map(int, raw_input().split())
if n == 0 and S == 0:
break
r = [input() for i in range(n)]
ans = 0
r.sort()
for i in range(n):
tmp = S - r[i] + 1
if (tmp <= 0):
ans += n - 1
else:
d = r[0:i] + r[i + 1:]
left,right = 0,n
while (right - left > 1):
med = (right + left) / 2
if (d[med] <= tmp):
left = med
else:
right = med
ans += (len(d) - left) - 1
print ans / 2 | File "/tmp/tmpj5phujg_/tmpsk0skkl2.py", line 22
print ans / 2
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s375118333 | p00670 | u633068244 | 1399102157 | Python | Python | py | Runtime Error | 0 | 0 | 267 | R = 101
while 1:
n,S = map(int,raw_input().split())
if n == 0: break
r = [0]*R
for i in range(n):
r[int(raw_input())] += 1
ans = 0
for i in range(R):
if 2*i > S:
ans += r[i]*(r[i]-1)/2
ans += r[i]*sum([r[j] for j in range(max(i+1,S-j+1),R)])
print ans | File "/tmp/tmpojqh5vvs/tmp3oc882fe.py", line 13
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s625141861 | p00670 | u633068244 | 1399102416 | Python | Python | py | Runtime Error | 0 | 0 | 285 | R = 101
while 1:
n,S = map(int,raw_input().split())
if n == 0: break
d = [int(raw_input()) for i in range(n)]
r = [d.count(i) for i in set(d)]
ans = 0
for i in range(R):
if 2*i > S:
ans += r[i]*(r[i]-1)/2
ans += r[i]*sum([r[j] for j in range(max(i+1,S-i+1),R)])
print ans | File "/tmp/tmp02wko9pz/tmpeie5uyly.py", line 12
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s098731759 | p00677 | u827448139 | 1417437517 | Python | Python | py | Runtime Error | 0 | 0 | 449 | while True:
s,d,m=map(int,input().split())
ws,ps=[0]*s,[0]*s
for i in range(s):
k=int(input())
tmp=list(map(int,input().split()))
ws[i],ps[i]=tmp[0::2],tmp[1::2]
f=list(map(int,input().split()));
dp=[0]*(m+1)
for i in f:
for p,w in zip(ps[i],ws[i]):
for x in reversed(range(p,m+1)):
dp[x]=max(dp[x],dp[x-p]+w)
print(max(dp),dp.index(max(dp)))
try: s=input();
except EOFError: raise SystemExit | Traceback (most recent call last):
File "/tmp/tmpcj499lho/tmp8wpo9xft.py", line 2, in <module>
s,d,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s436439590 | p00682 | u296492699 | 1404745977 | Python | Python | py | Runtime Error | 0 | 0 | 343 | c=0
while True:
n=input()
if n==0:
break
c+=1
a0, b0=map(int,raw_input().split())
prev_a, prev_b=a, b
tmp=0
for i in range(n):
a, b=map(int,raw_input().split())
tmp+=(a-prev_a)**2+(b-prev_b)**2
prev_a, prev_b=a, b
tmp+=(prev_a-a0)**2+(prev_b-b0)**2
print c, tmp**0.5
| File "/tmp/tmpu6_iv66o/tmpgfl5uoz6.py", line 15
print c, tmp**0.5
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s103333148 | p00682 | u296492699 | 1404746028 | Python | Python | py | Runtime Error | 0 | 0 | 345 | c=0
while True:
n=input()
if n==0:
break
c+=1
a0, b0=map(int,raw_input().split())
prev_a, prev_b=a0, b0
tmp=0
for i in range(n):
a, b=map(int,raw_input().split())
tmp+=(a-prev_a)**2+(b-prev_b)**2
prev_a, prev_b=a, b
tmp+=(prev_a-a0)**2+(prev_b-b0)**2
print c, tmp**0.5
| File "/tmp/tmp852x1csb/tmpbm6y1fbh.py", line 15
print c, tmp**0.5
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s805579221 | p00682 | u296492699 | 1404747151 | Python | Python | py | Runtime Error | 0 | 0 | 332 | c=0
while True:
n=input()
if n==0:
break
c+=1
x0, y0=map(int,raw_input().split())
prev_x, prev_y=x0, y0
tmp=0
for i in range(n):
x,y=map(int,raw_input().split())
tmp+=prev_x*y - prev_y*x
prev_x, prev_y=x, y
tmp+=prev_x*y0 - prev_y*x0
print c, 0.5*abs(tmp)
| File "/tmp/tmp8fdolie_/tmp0l44zqvf.py", line 15
print c, 0.5*abs(tmp)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s306943555 | p00682 | u296492699 | 1404747301 | Python | Python | py | Runtime Error | 0 | 0 | 334 | c=0
while True:
n=input()
if n==0:
break
c+=1
x0, y0=map(int,raw_input().split())
prev_x, prev_y=x0, y0
tmp=0
for i in range(n-1):
x,y=map(int,raw_input().split())
tmp+=prev_x*y - prev_y*x
prev_x, prev_y=x, y
tmp+=prev_x*y0 - prev_y*x0
print c, 0.5*abs(tmp)
| File "/tmp/tmpee94j3k1/tmpy52l7apk.py", line 15
print c, 0.5*abs(tmp)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s200677614 | p00682 | u296492699 | 1404747561 | Python | Python | py | Runtime Error | 0 | 0 | 346 | c=0
while True:
n=input()
if n==0:
break
c+=1
x0, y0=map(int,raw_input().split())
prev_x, prev_y=x0, y0
tmp=0
for i in range(n-1):
x,y=map(int,raw_input().split())
tmp+=prev_x*y - prev_y*x
prev_x, prev_y=x, y
tmp+=prev_x*y0 - prev_y*x0
print c, 0.5*abs(tmp)
input()
| File "/tmp/tmpuf9dsxcp/tmpogvvmz_y.py", line 15
print c, 0.5*abs(tmp)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s211074087 | p00682 | u296492699 | 1404747675 | Python | Python | py | Runtime Error | 0 | 0 | 351 | c=0
while True:
n=input()
if n==0:
break
c+=1
x0, y0=map(int,raw_input().split())
prev_x, prev_y=x0, y0
tmp=0
for i in range(n-1):
x,y=map(int,raw_input().split())
tmp+=prev_x*y - prev_y*x
prev_x, prev_y=x, y
tmp+=prev_x*y0 - prev_y*x0
print c, 0.5*abs(tmp)
skip=input()
| File "/tmp/tmpgqk396y4/tmpkkxnrfnk.py", line 15
print c, 0.5*abs(tmp)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s569358249 | p00682 | u809815599 | 1472307657 | Python | Python3 | py | Runtime Error | 0 | 0 | 25 | import numpy
import scipy | ||
s890458354 | p00682 | u809815599 | 1472307775 | Python | Python3 | py | Runtime Error | 0 | 0 | 27 | import numpy
print("hello") | hello
| |
s172909969 | p00683 | u797673668 | 1488441672 | Python | Python3 | py | Runtime Error | 0 | 0 | 3178 | class TextEditor:
cur_w = 0
cur_c = 0
def __init__(self, txt):
self.words = txt.split(' ')
self.queries = {
'forward char': self.forward_char,
'forward word': self.forward_word,
'backward char': self.backward_char,
'backward word': self.backward_word,
'delete char': self.delete_char,
'delete word': self.delete_word
}
def query(self, q):
if q[0] == 'i':
txt = q.split(maxsplit=1)[1][1:-1]
self.insert(txt)
else:
self.queries[q]()
def forward_word(self):
cw = self.words[self.cur_w]
if self.cur_c < len(cw):
self.cur_c = len(cw)
elif self.cur_w < len(self.words) - 1:
self.cur_w += 1
self.cur_c = len(self.words[self.cur_w])
else:
pass
def forward_char(self):
if self.cur_c < len(self.words[self.cur_w]):
self.cur_c += 1
elif self.cur_w < len(self.words) - 1:
self.cur_w += 1
self.cur_c = 0
else:
pass
def backward_char(self):
if self.cur_c > 0:
self.cur_c -= 1
elif self.cur_w > 0:
self.cur_w -= 1
self.cur_c = len(self.words[self.cur_w])
else:
pass
def backward_word(self):
if self.cur_w > 0:
self.cur_w -= 1
self.cur_c = len(self.words[self.cur_w])
else:
self.cur_c = 0
def insert(self, txt):
st = txt.split(' ')
new_words = self.words[:self.cur_w]
if len(st) > 1:
cw = self.words[self.cur_w]
new_words.append(cw[:self.cur_c] + st[0])
new_words.extend(st[1:-1])
new_words.append(st[-1] + cw[self.cur_c:])
else:
cw = self.words[self.cur_w]
new_words.append(cw[:self.cur_c] + st[0] + cw[self.cur_c:])
new_words.extend(self.words[self.cur_w + 1:])
self.cur_w = self.cur_w + len(st) - 1
self.cur_c = self.cur_c + len(st[-1])
self.words = new_words
def delete_char(self):
cw = self.words[self.cur_w]
if len(cw) == 0:
self.words.pop(self.cur_w)
elif self.cur_c < len(cw):
self.words[self.cur_w] = cw[:self.cur_c] + cw[self.cur_c + 1:]
elif self.cur_w < len(self.words) - 1:
nw = self.words.pop(self.cur_w + 1)
self.words[self.cur_w] = cw + nw
else:
pass
def delete_word(self):
while not len(self.words[self.cur_w]) and len(self.words) > 1:
self.words.pop(self.cur_w)
self.cur_c = 0
self.words[self.cur_w] = self.words[self.cur_w][:self.cur_c]
def output(self):
words = self.words.copy()
words[self.cur_w] = self.words[self.cur_w][:self.cur_c] + '^' + \
self.words[self.cur_w][self.cur_c:]
print(*words)
n = int(input())
for _ in range(n):
te = TextEditor(input().strip())
q = int(input())
for _ in range(q):
te.query(input().strip())
te.output() | Traceback (most recent call last):
File "/tmp/tmps0zcr74u/tmp_bo6b412.py", line 99, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s481326348 | p00683 | u104911888 | 1373879857 | Python | Python | py | Runtime Error | 0 | 0 | 1115 | for i in range(input()):
s=raw_input()
cur=0
for j in range(input()):
temp=raw_input()
cmd,obj=temp.replace('"',"").split()
if cmd=="forward":
if obj=="char":
cur+=1
cur=min(cur,len(s))
else:
while cur<len(s):
if s[cur]==" ":
break
cur+=1
elif cmd=="backward":
if obj=="char":
cur-=1
cur=max(cur,0)
else:
while cur>0:
cur-=1
if s[cur]==" ":
break
elif cmd=="delete":
if obj=="char":
if cur!=len(s):
s=s[:cur]+s[cur+1:]
else:
end=s.find(" ",cur)
if end==-1:
end=len(s)
s=s[:cur]+s[end+1:]
elif cmd=="insert":
idx=temp.find('"')+1
s=s[:cur]+temp[idx:-1]+s[cur:]
cur=len(s[:cur]+temp[idx:-1])
print s[:cur]+"^"+s[cur:] | File "/tmp/tmpmz8_7e88/tmp3tebnlvp.py", line 38
print s[:cur]+"^"+s[cur:]
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s334709879 | p00683 | u104911888 | 1373881381 | Python | Python | py | Runtime Error | 0 | 0 | 1195 | for i in range(input()):
s=raw_input()
cur=0
for j in range(input()):
cmd=raw_input()
if cmd=="forward char":
cur=min(cur+1,len(s))
elif cmd=="forward word":
while cur<len(s) and s[cur]==" ":
cur+=1
while cur<len(s) and s[cur]!=" ":
cur+=1
elif cmd=="backward char":
cur=max(cur-1,0)
elif cmd=="backward word":
while cur>0 and s[cur-1]==" ":
cur-=1
while cur>0 and s[cur-1]!=" ":
cur-=1
elif cmd=="delete char":
if cur!=len(s):
s=s[:cur]+s[cur+1:]
elif cmd=="delete word":
temp=cur
if temp>=len(s):
continue
while s[temp]==" ":
temp+=1
if temp>=len(s):
continue
while s[temp]!=" " and temp<len(s):
temp+=1
s=s[:cur]+s[temp:]
elif "insert" in cmd:
idx1=cmd.find('"')
idx2=cmd.find('"',idx1+1)
s=s[:cur]+cmd[idx1+1:-1]+s[cur:]
cur+=idx2-idx1-1
print s[:cur]+"^"+s[cur:] | File "/tmp/tmpteqei0n_/tmpzew6sa5_.py", line 39
print s[:cur]+"^"+s[cur:]
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s257534612 | p00683 | u104911888 | 1373881467 | Python | Python | py | Runtime Error | 0 | 0 | 1195 | for i in range(input()):
s=raw_input()
cur=0
for j in range(input()):
cmd=raw_input()
if cmd=="forward char":
cur=min(cur+1,len(s))
elif cmd=="forward word":
while cur<len(s) and s[cur]==" ":
cur+=1
while cur<len(s) and s[cur]!=" ":
cur+=1
elif cmd=="backward char":
cur=max(cur-1,0)
elif cmd=="backward word":
while cur>0 and s[cur-1]==" ":
cur-=1
while cur>0 and s[cur-1]!=" ":
cur-=1
elif cmd=="delete char":
if cur!=len(s):
s=s[:cur]+s[cur+1:]
elif cmd=="delete word":
temp=cur
if temp>=len(s):
continue
while s[temp]==" ":
temp+=1
if temp>=len(s):
continue
while temp<len(s) and s[temp]!=" ":
temp+=1
s=s[:cur]+s[temp:]
elif "insert" in cmd:
idx1=cmd.find('"')
idx2=cmd.find('"',idx1+1)
s=s[:cur]+cmd[idx1+1:-1]+s[cur:]
cur+=idx2-idx1-1
print s[:cur]+"^"+s[cur:] | File "/tmp/tmp0uqam1ij/tmpofu966xb.py", line 39
print s[:cur]+"^"+s[cur:]
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s283229828 | p00683 | u858885710 | 1397896774 | Python | Python | py | Runtime Error | 0 | 0 | 1252 | def operate( cmd, text, cur ):
lentxt = len(text)
if cmd == "forward char":
if cur < lentxt: cur += 1
elif cmd == "backward char":
if cur > 0: cur -= 1
elif cmd == "forward word":
while cur < lentxt and text[cur] == ' ': cur += 1
while cur < lentxt and text[cur] != ' ': cur += 1
elif cmd == "backward word":
while cur > 0 and text[cur - 1] == ' ': cur -= 1
while cur > 0 and text[cur - 1] != ' ': cur -= 1
elif cmd == "delete char":
text = text[:cur] + text[cur + 1:]
elif cmd == "delete word":
d = 0
while cur + d < lentxt and text[cur + d] == ' ': d += 1
if cur + d == lentxt: break
while cur + d < lentxt and text[cur + d] != ' ': d += 1
text = text[:cur] + text[cur + d:]
else:
ins = cmd[8:-1]
text = text[:cur] + ins + text[cur:]
cur += len(ins)
return cur, text
if __name__ == "__main__":
a = int(raw_input())
for i in range(a):
text = raw_input()
cnt = int(raw_input())
cursor = 0
for j in range(cnt):
command = raw_input()
cursor, text = operate( command, text, cursor )
print (text[:cursor] + '^' + text[cursor:]) | File "/tmp/tmppw8i8p12/tmp_wwd9cyt.py", line 18
if cur + d == lentxt: break
^^^^^
SyntaxError: 'break' outside loop
| |
s767324038 | p00684 | u858885710 | 1397990496 | Python | Python | py | Runtime Error | 0 | 0 | 983 | i = 1j
s = None
while True:
try:
s = raw_input()
except EOFError:
break
k, len_s, overflow = 0, len(s), False
while k < len_s:
while k < len_s and not s[k].isdigit(): k += 1
begin = k
while k < len_s and s[k].isdigit(): k += 1
end = k
if begin == len_s: break
while s[begin] == '0':
s = s[:begin] + s[begin+1:]
end -= 1
len_s -= 1
if abs( int( s[begin : end] ) ) > 10000:
overflow = True
break
k = end
if not overflow:
z = eval(s)
Rez, Imz = z.real, z.imag
if abs( Rez ) > 10000 or abs( Imz ) > 10000: overflow = True
else:
res = ''
if Rez != 0: res += str( int(Rez) )
if Imz > 0 and res != '': res += '+'
if Imz != 0: res += str( int(Imz) )+'i'
if z == 0: res += '0'
print res
if overflow:
print 'overflow' | File "/tmp/tmpipx1u3cm/tmp1cv2e8kz.py", line 33
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s140669451 | p00686 | u266872031 | 1385450326 | Python | Python | py | Runtime Error | 0 | 0 | 769 | import sys
checksize=0
place=[]
face=0 #N=0 E=1 S=2 W=3
X=0
Y=0
for l in sys.stdin:
line=l.split()
if checksize==0:
checksize=1
A=map(int,line)
X=A[0]
Y=A[1]
place=[1,1]
elif line[0]=="STOP":
checksize=0
elif line[0]=="LEFT":
face=(face-1)%4
elif line[0]=="RIGHT":
face=(face+1)%4
elif line[0]=="FORWARD":
susumu=int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
elif line[0]=="BACKWARD":
susumu=-int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
if place[0]<0:
place[0]=0
if place[0]>X:
place[0]=X
if place[1]<0:
place[1]=0
if place[1]>Y:
place[1]=Y | ||
s311310134 | p00686 | u266872031 | 1385450468 | Python | Python | py | Runtime Error | 0 | 0 | 811 | import sys
checksize=0
place=[]
face=0 #N=0 E=1 S=2 W=3
X=0
Y=0
for l in sys.stdin:
line=l.split()
if checksize==0:
checksize=1
A=map(int,line)
X=A[0]
Y=A[1]
place=[1,1]
elif line[0]=="STOP":
checksize=0
print str(place[0])+" "+str(place[1])
elif line[0]=="LEFT":
face=(face-1)%4
elif line[0]=="RIGHT":
face=(face+1)%4
elif line[0]=="FORWARD":
susumu=int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
elif line[0]=="BACKWARD":
susumu=-int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
if place[0]<0:
place[0]=0
if place[0]>X:
place[0]=X
if place[1]<0:
place[1]=0
if place[1]>Y:
place[1]=Y | File "/tmp/tmpyt7mz5hi/tmpqf5h3zks.py", line 18
print str(place[0])+" "+str(place[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s799492286 | p00686 | u266872031 | 1385465547 | Python | Python | py | Runtime Error | 0 | 0 | 811 | import sys
checksize=0
place=[]
face=0 #N=0 E=1 S=2 W=3
X=0
Y=0
for l in sys.stdin:
line=l.split()
if checksize==0:
checksize=1
A=map(int,line)
X=A[0]
Y=A[1]
place=[1,1]
elif line[0]=="STOP":
checksize=0
print str(place[0])+" "+str(place[1])
elif line[0]=="LEFT":
face=(face-1)%4
elif line[0]=="RIGHT":
face=(face+1)%4
elif line[0]=="FORWARD":
susumu=int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
elif line[0]=="BACKWARD":
susumu=-int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
if place[0]<1:
place[0]=1
if place[0]>X:
place[0]=X
if place[1]<1:
place[1]=1
if place[1]>Y:
place[1]=Y | File "/tmp/tmpzbrqpbil/tmp3xticzke.py", line 18
print str(place[0])+" "+str(place[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s982364121 | p00686 | u266872031 | 1385566719 | Python | Python | py | Runtime Error | 0 | 0 | 846 | import sys
checksize=0
place=[]
face=0 #N=0 E=1 S=2 W=3
X=0
Y=0
for l in sys.stdin:
line=l.split()
if line[0]==0:
break
elif checksize==0:
checksize=1
A=map(int,line)
X=A[0]
Y=A[1]
place=[1,1]
elif line[0]=="STOP":
checksize=0
print str(place[0])+" "+str(place[1])
elif line[0]=="LEFT":
face=(face-1)%4
elif line[0]=="RIGHT":
face=(face+1)%4
elif line[0]=="FORWARD":
susumu=int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
elif line[0]=="BACKWARD":
susumu=-int(line[1])
place[(face+1)%2]=place[(face+1)%2]+susumu*(1-(face/2)*2)
if place[0]<1:
place[0]=1
if place[0]>X:
place[0]=X
if place[1]<1:
place[1]=1
if place[1]>Y:
place[1]=Y | File "/tmp/tmp65wwvkxo/tmp_7gghsfh.py", line 20
print str(place[0])+" "+str(place[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s487108356 | p00687 | u847467233 | 1531529587 | Python | Python3 | py | Runtime Error | 0 | 0 | 218 | # AOJ 1105: Unable Count
# Python3 2018.7.14 bal4u
while True:
n, a, b = map(int, input().split())
if n == 0: break
f = [0]*(n+1)
for x in range(0, n, a):
for y in range(0, n+1, b): f[x+y] = 1
print(n-sum(f))
| Traceback (most recent call last):
File "/tmp/tmp2wpnyrcl/tmp3x4y6rnr.py", line 5, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s262371115 | p00687 | u847467233 | 1531529828 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | # AOJ 1105: Unable Count
# Python3 2018.7.14 bal4u
while True:
n, a, b = map(int, input().split())
if n == 0: break
f = [0]*(n>>1)
for x in range(0, n, a):
for y in range(0, n+1, b): f[x+y] = 1
print(n-sum(f[1:n+1]))
| Traceback (most recent call last):
File "/tmp/tmppu06gksj/tmpdbiepubt.py", line 5, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s060796466 | p00687 | u633068244 | 1400321585 | Python | Python | py | Runtime Error | 0 | 0 | 215 | while 1:
n,a,b = map(int,raw_input().split())
if n == 0: break
dp = [0]*(n+1)
dp[a] = dp[b] = 1
for i in range(n+1):
if dp[i] == 1:
if i+a < n+1: dp[i+a] = 1
if i+b < n+1: dp[i+b] = 1
print n - sum(dp) | File "/tmp/tmp5305b79l/tmpk8w71a3z.py", line 10
print n - sum(dp)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s351385448 | p00687 | u633068244 | 1400322123 | Python | Python | py | Runtime Error | 0 | 0 | 201 | while 1:
n,a,b = map(int,raw_input().split())
if n == 0: break
dp = [0]*(max(n,a,b)+1)
dp[a] = dp[b] = 1
for i in range(n+1-min(a,b)):
if dp[i]:
dp[i+a] = dp[i+b] = 1
print n - sum(dp[:n+1]) | File "/tmp/tmpou6vzw0w/tmpbcm4b3lc.py", line 9
print n - sum(dp[:n+1])
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s949290515 | p00688 | u797673668 | 1490618463 | Python | Python3 | py | Runtime Error | 0 | 0 | 406 | from math import gcd
while True:
a, b, c = map(int, input().split())
if not a:
break
d = (b ** 2 - 4 * a * c) ** 0.5
if isinstance(d, complex) or d - int(d) > 1e-6:
print('Impossible')
continue
num1, num2 = -b + int(d), -b - int(d)
den = 2 * a
cmn1, cmn2 = gcd(num1, den), gcd(num2, den)
print(den // cmn1, -num1 // cmn1, den // cmn2, -num2 // cmn2) | Traceback (most recent call last):
File "/tmp/tmppxpeg3ox/tmpzuvrv3f9.py", line 4, in <module>
a, b, c = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s487984757 | p00691 | u633068244 | 1396535165 | Python | Python | py | Runtime Error | 0 | 0 | 147 | while 1:
n=input()**3
if n==0:break
mn=n
for i in range(1,n):
for j in range(i,n):
m=n-i**3-j**3
if m<0:break
if m<mn:mn=m
print mn | File "/tmp/tmpw2gnebby/tmpkdi8he7n.py", line 10
print mn
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s021356063 | p00691 | u633068244 | 1396536850 | Python | Python | py | Runtime Error | 0 | 0 | 150 | while 1:
z3=m=input()**3
if z3==0:break
x=0
while 1:
x+=1
x3=x**3
y=int((n3-i3)**(1/3.))
if y<x:break
n=z3-x3-y**3
if n<m:m=n
print m | File "/tmp/tmpb7b9srvq/tmp3abnmtxe.py", line 12
print m
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s714311728 | p00693 | u633068244 | 1400154015 | Python | Python | py | Runtime Error | 0 | 0 | 374 | import re
while 1:
n,m = map(int,raw_input().split())
P = []; D = []
for i in range(n):
p,s,d = raw_input().replace("?","[0-9]").split()
r = re.compile(s+d)
if p[0] == "p":
P.append(r)
else:
D.append(r)
for i in range(m):
s,d,name = raw_input().split()
tf = any(r.search(s+d) for r in P) and not any(r.search(s+d) for r in D)
if tf:
print s,d,name | File "/tmp/tmpdc3l1ef5/tmp7noyz9zm.py", line 16
print s,d,name
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s112134907 | p00698 | u647766105 | 1427981247 | Python | Python | py | Runtime Error | 0 | 0 | 1337 | from copy import deepcopy
answer = ""
while True:
line = raw_input()
while line.isspace() or not line: #!?!?!!!
line = raw_input()
if line == "0":
break
P, S = map(int, line.split())
def check(data):
return reduce(lambda a, b: a+b, data).count("?")
def calc(seq):
if "?" not in seq or not(0 <= seq.count("?") <= 1) :
return seq
if seq[-1] == "?":
return seq[:-1] + sum(seq[:-1])
a = seq[-1] - sum(s for s in seq[:-1] if s != "?")
return [s if s != "?" else a for s in seq]
def update(data):
data = deepcopy(data)
t_data = zip(*data)
for i in xrange(P):
for j, d in enumerate(calc(data[i])):
data[i][j] = d
for j, d in enumerate(calc(t_data[i])):
data[j][i] = d
return data
data = [map(lambda x: int(x) if x.isdigit() else x, raw_input().split())
for _ in xrange(P+1)]
cdata = deepcopy(data)
for _ in xrange(check(cdata)):
cdata = update(cdata)
ans = ""
if check(cdata) == 0:
for d in zip(data, cdata):
for e1, e2 in zip(*d):
if e1 == "?":
ans += "{}\n".format(e2)
else:
ans += "NO\n"
answer += ans + "\n"
print answer.strip("\n") | File "/tmp/tmpawz9wwcp/tmpbtp0ztkv.py", line 42
print answer.strip("\n")
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s511165798 | p00705 | u046108504 | 1555867190 | Python | Python3 | py | Runtime Error | 0 | 0 | 368 | import collections
while True:
N, Q = map(int, input().split())
if N == 0 and Q == 0:
break
D = []
for _ in range(N):
i = list(map(int, input().split()))
del i[0]
[D.append(ii) for ii in i]
c = collections.Counter(D)
cc = c.most_common()
if cc[0][1] >= Q:
print(cc[0][0])
else:
print(0)
| Traceback (most recent call last):
File "/tmp/tmpob8ebqs3/tmpslnne3ds.py", line 4, in <module>
N, Q = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s248635401 | p00705 | u546285759 | 1486804682 | Python | Python3 | py | Runtime Error | 0 | 0 | 383 | from collections import Counter
while 1:
N,Q=map(int,input().split())
if N==0: break
M,l=[list(map(int,input().split())) for _ in range(N)],[]
for mm in M:
if len(mm)!=1:
for i in range(1,len(mm)):
l.append(mm[i])
c=Counter(l)
_,mv=c.most_common(1)[0]
print(min([k for k,v in c.most_common() if mv==v]) if mv>=Q else 0) | Traceback (most recent call last):
File "/tmp/tmp3mlqjtdl/tmpodb8v68x.py", line 3, in <module>
N,Q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s161863883 | p00705 | u546285759 | 1486804779 | Python | Python3 | py | Runtime Error | 0 | 0 | 383 | from collections import Counter
while 1:
N,Q=map(int,input().split())
if N==0: break
M,l=[list(map(int,input().split())) for _ in range(N)],[]
for mm in M:
if len(mm)!=1:
for i in range(1,len(mm)):
l.append(mm[i])
c=Counter(l)
_,mv=c.most_common(1)[0]
print(min([k for k,v in c.most_common() if mv==v]) if mv>=Q else 0) | Traceback (most recent call last):
File "/tmp/tmpcgumpl92/tmpec84hd9q.py", line 3, in <module>
N,Q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s572096381 | p00705 | u546285759 | 1486804820 | Python | Python3 | py | Runtime Error | 0 | 0 | 391 | from collections import Counter
while 1:
N,Q=map(int,input().split())
if (N,Q)==(0,0): break
M,l=[list(map(int,input().split())) for _ in range(N)],[]
for mm in M:
if len(mm)!=1:
for i in range(1,len(mm)):
l.append(mm[i])
c=Counter(l)
_,mv=c.most_common(1)[0]
print(min([k for k,v in c.most_common() if mv==v]) if mv>=Q else 0) | Traceback (most recent call last):
File "/tmp/tmpek1inhh9/tmpeo123yrx.py", line 3, in <module>
N,Q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s513648608 | p00705 | u546285759 | 1486804870 | Python | Python3 | py | Runtime Error | 0 | 0 | 398 | from collections import Counter
while 1:
N,Q=map(int,input().split())
if (N,Q)==(0,0): break
M,l=[list(map(int,input().split())) for _ in range(N)],[]
for mm in M:
if len(mm)!=1:
for i in range(1,len(mm)):
l.append(mm[i])
c=Counter(l)
_,mv=c.most_common(1)[0]
print(str(min([k for k,v in c.most_common() if mv==v])) if mv>=Q else '0') | Traceback (most recent call last):
File "/tmp/tmp75mu9e_h/tmpudyksq6s.py", line 3, in <module>
N,Q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s453051750 | p00705 | u146816547 | 1524749303 | Python | Python | py | Runtime Error | 0 | 0 | 364 | while True:
N, Q = map(int, raw_input().split())
if N == 0 and Q == 0:
break
t = [map(int, raw_input().split())[1:] for _ in range(N)]
table = [[i, 0] for i in range(10)]
for i in t:
for j in i:
table[j][1] += 1
table.sort(reverse=True, key=lambda x: x[1])
print table[0][0] if table[0][1] >= Q else 0
| File "/tmp/tmpg2yr8tff/tmp9ths1rny.py", line 16
print table[0][0] if table[0][1] >= Q else 0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s038284954 | p00705 | u109084363 | 1359198933 | Python | Python | py | Runtime Error | 0 | 0 | 610 | import sys
import collections
while True:
N, Q = map(int, sys.stdin.readline().split())
if N == 0:
break
counter = collections.Counter()
for i in xrange(N):
date = map(int, sys.stdin.readline().split())
if date[0] != 0:
counter.update(date[1:])
result = counter.most_common()
largest = result[0][1]
ret = -1
if largest < Q:
print 0
else:
smallest = 100
for n, c in result:
if c < largest:
break
if n < smallest:
smallest = n
print smallest | File "/tmp/tmpcddwg8w2/tmpw72ah3df.py", line 19
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s197974344 | p00705 | u104911888 | 1369792443 | Python | Python | py | Runtime Error | 0 | 0 | 236 | while True:
N,Q=map(int,raw_input().split())
if N==Q==0:break
T=[0]*51
for i in range(N):
L=map(int,raw_input().split())
for j in L[1:]:
T[j]+=1
m=max(T)
print 0 if m<Q else T.index(m) | File "/tmp/tmpyrpulleu/tmpbm9eaoy_.py", line 10
print 0 if m<Q else T.index(m)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s592788340 | p00706 | u798803522 | 1468421119 | Python | Python3 | py | Runtime Error | 0 | 0 | 929 | trial = int(input())
while True:
area = [int(n) for n in input().split(" ")]
trees = []
for t in range(trial):
trees.append(int(n) for n in input().split(" "))
cnt,answer = 0,0
trees = sorted(trees,key=lambda x:(x[0],x[1]))
building = [int(n) for n in input().split(" ")]
for x in range(1,1+area[0]-building[0]):
for y in range(1,1+area[1]-building[1]):
cnt = 0
for tree in trees:
if x <= tree[0] <= x+building[0] and y <= tree[1] <= y+building[1]:
cnt += 1
elif x+building[0] < tree[0] and y+building[1] < tree[1]:
if answer < cnt:
answer = cnt
break
else:
if answer < cnt:
answer = cnt
else:
print(answer)
trial = int(input())
if trial == 0:
break | Traceback (most recent call last):
File "/tmp/tmpqmcwf5sg/tmpcznxnriq.py", line 1, in <module>
trial = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s533947681 | p00706 | u798803522 | 1468423334 | Python | Python3 | py | Runtime Error | 0 | 0 | 1186 | with open("input1(1).txt") as files:
trial = int(files.readline())
while True:
area = [int(n) for n in files.readline().split(" ")]
trees = []
for t in range(trial):
trees.append([int(n) for n in files.readline().split(" ")])
cnt,answer = 0,0
trees = sorted(trees,key=lambda x:(x[0],x[1]))
building = [int(n) for n in files.readline().split(" ")]
for x in range(1,area[0]-building[0]+2):
for y in range(1,area[1]-building[1]+2):
cnt = 0
for tree in trees:
if x <= tree[0] < x+building[0] and y <= tree[1] < y+building[1]:
#print(tree,x,y)
cnt += 1
elif x+building[0] < tree[0] and y+building[1] < tree[1]:
if answer < cnt:
answer = cnt
break
else:
print("")
if answer < cnt:
answer = cnt
else:
print(answer)
trial = int(files.readline())
if trial == 0:
break | Traceback (most recent call last):
File "/tmp/tmpp_96tli7/tmp_lli_rze.py", line 1, in <module>
with open("input1(1).txt") as files:
^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'input1(1).txt'
| |
s190017676 | p00706 | u506554532 | 1512979486 | Python | Python3 | py | Runtime Error | 0 | 0 | 637 | while True:
N = int(input())
if N == 0: break
W,H = map(int,input().split())
fld = [[0 for w in range(W)] for h in range(H)]
for i in range(N):
x,y = map(lambda s:int(s)-1,raw_input().split())
fld[y][x] = 1
cums = [[0 for w in range(W+1)] for h in range(H+1)]
for y in range(H):
for x in range(W):
cums[y+1][x+1] = fld[y][x] + cums[y][x+1] + cums[y+1][x] - cums[y][x]
S,T = map(int,input().split())
ans = 0
for y in range(H-T+1):
for x in range(W-S+1):
ans = max(ans, cums[y+T][x+S] - cums[y+T][x] - cums[y][x+S] + cums[y][x])
print(ans) | Traceback (most recent call last):
File "/tmp/tmpfapnx8ra/tmpexebd12e.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s154983868 | p00706 | u506554532 | 1512979560 | Python | Python3 | py | Runtime Error | 0 | 0 | 637 | while True:
N = int(input())
if N == 0: break
W,H = map(int,input().split())
fld = [[0 for w in range(W)] for h in range(H)]
for i in range(N):
x,y = map(lambda s:int(s)-1,raw_input().split())
fld[y][x] = 1
cums = [[0 for w in range(W+1)] for h in range(H+1)]
for y in range(H):
for x in range(W):
cums[y+1][x+1] = fld[y][x] + cums[y][x+1] + cums[y+1][x] - cums[y][x]
S,T = map(int,input().split())
ans = 0
for y in range(H-T+1):
for x in range(W-S+1):
ans = max(ans, cums[y+T][x+S] - cums[y+T][x] - cums[y][x+S] + cums[y][x])
print(ans) | Traceback (most recent call last):
File "/tmp/tmp3bvc36on/tmpd8oil58m.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s941015625 | p00708 | u633068244 | 1400158920 | Python | Python | py | Runtime Error | 0 | 0 | 599 | def R(xyrz,xyrz1):
x, y, z, r = xyrz
x1,y1,z1,r1 = xyrz1
return max(0,((x-x1)**2 + (y-y1)**2 + (z-z1)**2)**0.5 - r - r1)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e12
for i in range(n):
for j in range(i+1,n):
l = R(xyzr[i],xyzr[j])
if l < ans:
ans = l
s = [i,j]
chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
while xyzr:
pipe = 1e12
for i in range(len(xyzr)):
for j in range(len(chain)):
l = R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmp4dfrz358/tmpyanbzdkv.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s817911233 | p00708 | u633068244 | 1400159008 | Python | Python | py | Runtime Error | 0 | 0 | 585 | def R(xyrz,xyrz1):
x, y, z, r = xyrz
x1,y1,z1,r1 = xyrz1
return max(0,((x-x1)**2 + (y-y1)**2 + (z-z1)**2)**0.5 - r - r1)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ml = 1e12
for i in range(n):
for j in range(i+1,n):
l = R(xyzr[i],xyzr[j])
if l < ml:
ml = l
s = i
ans = 0.0
chain = [xyzr.pop(s)]
while xyzr:
pipe = 1e12
for i in range(len(xyzr)):
for j in range(len(chain)):
l = R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmpu4tua__6/tmpmftzqlvn.py", line 29
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s774901935 | p00708 | u633068244 | 1400159056 | Python | Python | py | Runtime Error | 0 | 0 | 603 | def R(xyrz,xyrz1):
x, y, z, r = xyrz
x1,y1,z1,r1 = xyrz1
return max(0,((x-x1)**2 + (y-y1)**2 + (z-z1)**2)**0.5 - r - r1)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e12
for i in range(n):
for j in range(i+1,n):
l = 1#R(xyzr[i],xyzr[j])
if l < ans:
ans = l
s = [i,j]
chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
while xyzr:
pipe = 1e12
for i in range(len(xyzr)):
for j in range(len(chain)):
l = 1#R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmp985ntnez/tmpm_8d360e.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s910356741 | p00708 | u633068244 | 1400159213 | Python | Python | py | Runtime Error | 0 | 0 | 605 | def R(xyzr1,xyzr2):
x1,y1,z1,r1 = xyzr1
x2,y2,z2,r2 = xyzr2
return max(0,((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)**0.5 - r1 - r2)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e10
for i in range(n):
for j in range(i+1,n):
l = R(xyzr[i],xyzr[j])
if l < ans:
ans = l
s = [i,j]
chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
while xyzr:
pipe = 1e10
for i in range(len(xyzr)):
for j in range(len(chain)):
l = R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmp1wkzimll/tmpj3n8vrbu.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s039742867 | p00708 | u633068244 | 1400159370 | Python | Python | py | Runtime Error | 0 | 0 | 605 | def R(xyzr1,xyzr2):
x1,y1,z1,r1 = xyzr1
x2,y2,z2,r2 = xyzr2
return max(0,((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)**0.5 - r1 - r2)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e10
for i in range(n):
for j in range(i+1,n):
l = R(xyzr[i],xyzr[j])
if l < ans:
ans = l
s = [i,j]
chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
while xyzr:
pipe = 1e10
for i in range(len(xyzr)):
for j in range(len(chain)):
l = R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmpirey195c/tmpznfm_5bb.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s626351376 | p00708 | u633068244 | 1400159414 | Python | Python | py | Runtime Error | 0 | 0 | 583 | def R(xyzr1,xyzr2):
x1,y1,z1,r1 = xyzr1
x2,y2,z2,r2 = xyzr2
return max(0,((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)**0.5 - r1 - r2)
while 1:
n = input()
if n == 0: break
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e10
for i in range(n):
for j in range(i+1,n):
l = R(xyzr[i],xyzr[j])
if l < ans:
ans = l
s = i
chain = [xyzr.pop(s)]
while xyzr:
pipe = 1e10
for i in range(len(xyzr)):
for j in range(len(chain)):
l = R(xyzr[i],chain[j])
if l < pipe:
pipe = l
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmpa1pz2hlr/tmp_gj1zl21.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s364294754 | p00708 | u633068244 | 1400159723 | Python | Python | py | Runtime Error | 0 | 0 | 639 | def R(xyzr1,xyzr2):
x1,y1,z1,r1 = xyzr1
x2,y2,z2,r2 = xyzr2
return max(0,((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)**0.5 - r1 - r2)
while 1:
n = input()
if n == 0: break
if n == 1:
print 0.0
continue
xyzr = [map(float,raw_input().split()) for i in range(n)]
ans = 1e10
for i in range(n):
for j in range(i+1,n):
L = R(xyzr[i],xyzr[j])
if L < ans:
ans = L
s = [i,j]
chain = [xyzr.pop(s[1]),xyzr.pop(s[0])]
while xyzr:
pipe = 1e10
for i in range(len(xyzr)):
for j in range(len(chain)):
L = R(xyzr[i],chain[j])
if L < pipe:
pipe = L
p = i
ans += pipe
chain.append(xyzr.pop(p))
print ans | File "/tmp/tmpsyd8s5cb/tmpoz6o33ak.py", line 9
print 0.0
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s361047229 | p00710 | u966364923 | 1419218331 | Python | Python3 | py | Runtime Error | 0 | 0 | 289 | while True:
(n, r) = [int(x) for x in input().split()]
if n==0 and r==0:
exit()
cards = [n-i for i in range(n)]
for _ in range(r):
(p, c) = [int(x) for x in input().split()]
cards = cards[p-1:c] + cards[p-1:p-1+c] + cards[p-1+c:]
print(cards[0]) | Traceback (most recent call last):
File "/tmp/tmp5cepzmuw/tmprs7u5bsy.py", line 2, in <module>
(n, r) = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s721509319 | p00710 | u998188826 | 1441280809 | Python | Python | py | Runtime Error | 0 | 0 | 255 |
while True:
n, r = map(int, input().split())
if (n, r) == (0, 0):
break
cards = list(range(1, n+1))[::-1]
print(cards)
for i in range(r):
p, c = map(int, input().split())
cards = cards[p-1:p-1+c] + cards[:p-1] + cards[p-1+c:]
print(cards[0]) | Traceback (most recent call last):
File "/tmp/tmpvabq038k/tmp02zce80l.py", line 3, in <module>
n, r = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s935510928 | p00710 | u488601719 | 1451131882 | Python | Python | py | Runtime Error | 0 | 0 | 359 | while True:
n, r = map(int, input().split())
if n == 0 and r == 0:
break
l = []
for i in range(1, n + 1):
l.append(i)
for i in range(0, r):
p, c = map(int, input().split())
tmp = l[len(l) - p + 1:len(l)]
del l[len(l) - p + 1:len(l)]
l[len(l) - c:len(l) - c] = tmp
print(l[len(l) - 1]) | Traceback (most recent call last):
File "/tmp/tmpa3ifeows/tmpbcs3uq9t.py", line 2, in <module>
n, r = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s228883470 | p00710 | u616098312 | 1466500361 | Python | Python3 | py | Runtime Error | 0 | 0 | 311 | x=0
while True:
sousa=input().sprit() #?????????
sousa=[int(sousa[0]),int(sousa[1])]
if sousa==[0,0]:break
yama=[]
for k in range(sousa[1]):yama.append(k+1)
yama=yama[::-1]
for r in range(sousa[1]):
[p,c]=input().sprit()
[p,c]=[int(p),int(c)]
yama[:p+c-1]=yama[p-1:p+c-1]+yama[:p-2]
print(yama[0]) | Traceback (most recent call last):
File "/tmp/tmp_8na162c/tmppbon7gxc.py", line 3, in <module>
sousa=input().sprit() #?????????
^^^^^^^
EOFError: EOF when reading a line
| |
s474932279 | p00710 | u616098312 | 1466500498 | Python | Python3 | py | Runtime Error | 0 | 0 | 307 | while True:
sousa=input().sprit() #?????????
sousa=[int(sousa[0]),int(sousa[1])]
if sousa==[0,0]:break
yama=[]
for k in range(sousa[0]):yama.append(k+1)
yama=yama[::-1]
for r in range(sousa[1]):
[p,c]=input().sprit()
[p,c]=[int(p),int(c)]
yama[:p+c-1]=yama[p-1:p+c-1]+yama[:p-2]
print(yama[0]) | Traceback (most recent call last):
File "/tmp/tmp9sdircfm/tmp8i_pnxg3.py", line 2, in <module>
sousa=input().sprit() #?????????
^^^^^^^
EOFError: EOF when reading a line
| |
s910262628 | p00710 | u653710476 | 1466502177 | Python | Python3 | py | Runtime Error | 0 | 0 | 366 | first = input().split()
n = int(first[0])
r = int(first[1])
while n != 0 or r != 0:
i = 0
card = list(range(n))
while i < r:
sh = input().split()
p, c = list(map(int,sh))
card = card[p-1:p+c-2:] + card[0:p-2:] + card[p+c-1:n:]
i = i + 1
print(n - int(card[0]))
next = input().split()
n, r = list(map(int,next)) | Traceback (most recent call last):
File "/tmp/tmp7mhu4n6x/tmph15zyqvj.py", line 1, in <module>
first = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s149680011 | p00710 | u798803522 | 1468136132 | Python | Python3 | py | Runtime Error | 0 | 0 | 543 | cond = [int(n) for n in input().split(" ")]
while True:
case = []
cards = [n for n in range(1,cond[0] + 1)]
for c in range(cond[1]):
case = ([int(n) for n in input().split(" ")]
disp = cards[case[0]:case[0]+case[1]]
cards[case[0]:case[0]+case[1]] = cards[case[0]-case[1]:case[0]]
cards[case[0]-case[1]:case[0]] = disp
else:
print(cards[0])
cond = [int(n) for n in input().split(" ")]
if cond[0] == 0 and cond[1] == 0:
break
else:
continue | File "/tmp/tmpll8kvhhk/tmpd4k_gi0g.py", line 7
case = ([int(n) for n in input().split(" ")]
^
SyntaxError: '(' was never closed
| |
s816116747 | p00710 | u798803522 | 1468136181 | Python | Python3 | py | Runtime Error | 0 | 0 | 542 | cond = [int(n) for n in input().split(" ")]
while True:
case = []
cards = [n for n in range(1,cond[0] + 1)]
for c in range(cond[1]):
case = [int(n) for n in input().split(" ")]
disp = cards[case[0]:case[0]+case[1]]
cards[case[0]:case[0]+case[1]] = cards[case[0]-case[1]:case[0]]
cards[case[0]-case[1]:case[0]] = disp
else:
print(cards[0])
cond = [int(n) for n in input().split(" ")]
if cond[0] == 0 and cond[1] == 0:
break
else:
continue | Traceback (most recent call last):
File "/tmp/tmp68ta3sng/tmpffx147qj.py", line 1, in <module>
cond = [int(n) for n in input().split(" ")]
^^^^^^^
EOFError: EOF when reading a line
| |
s338045982 | p00710 | u963883732 | 1518517357 | Python | Python3 | py | Runtime Error | 0 | 0 | 366 | l = input()
L = l.split()
for i in range(len(L)):
L[i] = int(L[i])
while True:
if L[0] == 0:
break
a = [L[0]-number for number in range(L[0])]
for j in range(L[1]):
r = input()
R = r.split()
for k in range(len(R)):
R[k] = int(R[k])
b = []
b += a[R[0]-1:R[0]+R[1]-1]
b += a[:R[0]-1]
b += a[R[0]+R[1]-1:]
a.clear()
a = b.copy()
print(a[0])
| Traceback (most recent call last):
File "/tmp/tmpi7339nzb/tmp752jzvpy.py", line 1, in <module>
l = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s653586413 | p00710 | u500292616 | 1530624332 | Python | Python3 | py | Runtime Error | 0 | 0 | 379 | n=1
r=1
while n !=0 and r!=0:
n,r=input().split()
n,r=int(n),int(r)
card= [[int(i) for i in input().split()] for i in range(r)]
yama= list(range(n,0,-1))
for i in range(r):
p=card[i][0]
c=card[i][1]
x=yama[:p-1]
y=yama[p-1:p-1+c]
z=yama[p-1+c:]
yama=(y+x+z)
print(yama[0])
| Traceback (most recent call last):
File "/tmp/tmpn57l4oiw/tmpud7od0oq.py", line 4, in <module>
n,r=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s641538142 | p00711 | u124909914 | 1426121130 | Python | Python3 | py | Runtime Error | 0 | 0 | 501 | def search(x, y, m):
if x >= len(m[0]) or y >= len(m):
return 0
if m[y][x] == '#':
return 0
m[y][x] = '#'
return 1 + search(x+1,y, m) + search(x-1,y,m) \
+ search(x,y+1,m) + search(x,y-1,m)
while True:
w, h = map(int, input().split())
if w == 0: break
room = []
for i in range(h):
tmp = list(input())
room.append(tmp[:w])
if '@' in tmp:
y = i
x = tmp.index('@')
print(search(x, y, room)) | Traceback (most recent call last):
File "/tmp/tmp_jz_htmt/tmp7q_f6dkd.py", line 11, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s464988959 | p00711 | u966364923 | 1427445776 | Python | Python3 | py | Runtime Error | 0 | 0 | 1211 | while True:
W,H = [int(x) for x in input().split()]
if W==0 and H==0:
exit()
tiles = []
X = 0
Y = 0
for i in range(H):
tiles.append(input())
if '@' in tiles[i]:
Y = i
X = tiles[i].index('@')
d = [[9999 for j in range(H*W)] for i in range(H*W)]
for i in range(H*W):
d[i][i] = 0
for i in range(H):
for j in range(W):
if j>0:
if tiles[i][j] in '.@' and tiles[i][j-1] in '.@':
d[W*i+j][W*i+j-1] = 1
if j<W-1:
if tiles[i][j] in '.@' and tiles[i][j+1] in '.@':
d[W*i+j][W*i+j+1] = 1
if i>0:
if tiles[i][j] in '.@' and tiles[i-1][j] in '.@':
d[W*i+j][W*i+j-W] = 1
if j<H-1:
if tiles[i][j] in '.@' and tiles[i+1][j] in '.@':
d[W*i+j][W*i+j+W] = 1
for k in range(H*W):
for i in range(H*W):
for j in range(H*W):
if d[i][j] > d[i][k]+d[k][j]:
d[i][j] = d[i][k]+d[k][j]
cnt = 0
for i in range(H*W):
if d[X+Y*H][i]<9999:
cnt += 1
print(cnt) | Traceback (most recent call last):
File "/tmp/tmp0bsochbj/tmpm7_i2_pr.py", line 2, in <module>
W,H = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s747321407 | p00711 | u667806071 | 1464097275 | Python | Python | py | Runtime Error | 0 | 0 | 812 | re = open("input")
count = 0
role = {".": True, "@": False, "#": False}
def now(xpoint, ypoint):
return role[room[ypoint][xpoint]]
def search(xpoint, ypoint):
global count
if 0 <= xpoint < wh[0] and 0 <= ypoint < wh[1] and now(xpoint, ypoint):
count += 1
room[ypoint][xpoint] = "@"
search(xpoint - 1, ypoint)
search(xpoint + 1, ypoint)
search(xpoint, ypoint + 1)
search(xpoint, ypoint - 1)
while True:
wh = map(int, re.readline().split())
room = []
count = 0
for ypoint in range(wh[1]):
line = re.readline().replace("\n", "")
if "@" in line:
xp = line.index("@")
yp = ypoint
room.append([x for x in line])
if not room: break
room[yp][xp] = "."
search(xp, yp)
print count | File "/tmp/tmp4n9aclb2/tmpt9l_f0gx.py", line 30
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s387907789 | p00711 | u798803522 | 1469203070 | Python | Python3 | py | Runtime Error | 0 | 0 | 848 | def getter(targ,x,y):
#print(x,y,len(targ[0]),len(targ))
if 0 > x or x >= len(targ) or 0 > y or y >= len(targ[0]) or targ[x][y] == '#':
return 0
else:
targ[x][y] = '#'
return 1 + getter(targ,x+1,y) + getter(targ,x-1,y) + getter(targ,x,y+1) + getter(targ,x,y-1)
with open("input1.txt") as f:
width,height = [int(n) for n in f.readline().split(" ")]
global lab
while True:
lab,start = [],[]
for a in range(height):
disp = [n for n in f.readline().rstrip('\n')]
if '@' in disp:
start.extend([disp.index('@'),a])
lab.append(disp)
else:
a,b = start
print(getter(lab,b,a))
width,height = [int(n) for n in f.readline().split(" ")]
if width == 0 and height == 0:
break | Traceback (most recent call last):
File "/tmp/tmp9b70iltl/tmply1ejneu.py", line 8, in <module>
with open("input1.txt") as f:
^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'input1.txt'
| |
s027978566 | p00711 | u358919705 | 1481546272 | Python | Python3 | py | Runtime Error | 0 | 0 | 664 | data, res
def valid(x, y):
global data
return 0 <= x < W and 0 <= y < H and data[y][x] != '#'
def dfs(x, y):
global data, res
if valid(x, y):
res += 1
data[y][x] = '#'
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(4):
dfs(x + dx[i], y + dy[i])
else:
return
while True:
global data, res
W, H = map(int, input().split())
if W == 0 and H == 0:
break
data = [list(input()) for _ in range(H)]
res = 0
for i in range(W):
for j in range(H):
if data[j][i] == '@':
dfs(i, j)
break
print(res) | File "/tmp/tmpblbzjy80/tmp_pj2hzab.py", line 20
global data, res
^^^^^^^^^^^^^^^^
SyntaxError: name 'data' is used prior to global declaration
| |
s533503240 | p00711 | u358919705 | 1481546434 | Python | Python3 | py | Runtime Error | 0 | 0 | 652 | data, res
def valid(x, y):
global data
return 0 <= x < W and 0 <= y < H and data[y][x] != '#'
def dfs(x, y):
global data, res
if valid(x, y):
res += 1
data[y][x] = '#'
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(4):
dfs(x + dx[i], y + dy[i])
else:
return
while True:
global data, res
W, H = map(int, input().split())
if not W:
break
data = [list(input()) for _ in range(H)]
res = 0
for i in range(W):
for j in range(H):
if data[j][i] == '@':
dfs(i, j)
break
print(res) | File "/tmp/tmp018j44n2/tmp59q7yiho.py", line 20
global data, res
^^^^^^^^^^^^^^^^
SyntaxError: name 'data' is used prior to global declaration
| |
s297098570 | p00711 | u358919705 | 1481546533 | Python | Python3 | py | Runtime Error | 0 | 0 | 660 | data, res = [], 0
def valid(x, y):
global data
return 0 <= x < W and 0 <= y < H and data[y][x] != '#'
def dfs(x, y):
global data, res
if valid(x, y):
res += 1
data[y][x] = '#'
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
for i in range(4):
dfs(x + dx[i], y + dy[i])
else:
return
while True:
global data, res
W, H = map(int, input().split())
if not W:
break
data = [list(input()) for _ in range(H)]
res = 0
for i in range(W):
for j in range(H):
if data[j][i] == '@':
dfs(i, j)
break
print(res) | File "/tmp/tmppne7gk08/tmph0jxtn8d.py", line 20
global data, res
^^^^^^^^^^^^^^^^
SyntaxError: name 'data' is assigned to before global declaration
| |
s291409473 | p00711 | u635391238 | 1508564227 | Python | Python3 | py | Runtime Error | 0 | 0 | 1806 |
def depth_first_search(x, y):
"""
??±???????????¢?´¢?????????
:param x: ?????¨??°????¨?
:param y: ?????¨??°??????
:return: ?????°
"""
# ????????????????????§?¢??????????
# ??????x ,y+1
# ??????x+1,y
# ??????x ,y-1
# ??????x-1,y
move_list = [[0,1],[1,0],[0,-1],[-1,0]]
for i in range(0,4,1):
next_x = x+move_list[i][0]
next_y = y+move_list[i][1]
# tile_map??????????§??????§????????´??????'.'???
if 0 <= next_x and 0 <= next_y and \
next_x < W and next_y < H and \
tile_map[next_y][next_x] != '#':
# ?§?????????????????????¨??°????§??????§??????????????????"#"??????????????????
tile_map[y][x] = '#'
import __main__
__main__.move_point = __main__.move_point+1
depth_first_search(next_x, next_y)
def get_start_point(tile_map):
"""
@????????????????????????
:param tile_map:
:return:
"""
for i, y in enumerate(tile_map):
for j, x in enumerate(y):
if x == '@':
return i, j
if __name__ == "__main__":
move_point = 0
first = True
while (True):
# input_1 : tile????????????
tile_size = input('').split(' ')
W, H = [int(x) for x in tile_size]
if W == 0 and H == 0:
break
if first:
first = False
else:
print('')
tile_map=[''] * H
for i in range(0, H, 1):
# input_2 : tile???????????????????????????
map_line = list(input(''))
tile_map[i] = map_line
start_H, start_W = get_start_point(tile_map)
depth_first_search(start_W, start_H)
import ipdb;ipdb.set_trace()
print(move_point) | Traceback (most recent call last):
File "/tmp/tmpk8dn836_/tmp_oy0vd1c.py", line 49, in <module>
tile_size = input('').split(' ')
^^^^^^^^^
EOFError: EOF when reading a line
| |
s900394523 | p00711 | u228488524 | 1508828744 | Python | Python3 | py | Runtime Error | 0 | 0 | 724 | def search(M, l, walkable):
i, j = (l.pop(0))
nexts = []
if i !=0:
nexts.append((i-1, j))
if i != len(M)-1:
nexts.append((i+1, j))
if j != 0:
nexts.append((i, j-1))
if j != len(M[0])-1:
nexts.append((i, j+1))
for nex in nexts:
x, y = nex
if M[x][y] == '.' and not nex in walkable:
l.append(nex)
walkable.append(nex)
inp = ''
while '0 0' != (inp = input()):
i, j = [int(x) for x in inp.split()]
M = []
l = []
for n in range(j):
M.append(input())
if '@' in M[n]:
l.append((n, M[n].find('@')))
walkable = []
while l:
search(M, l, walkable)
print(len(walkable)) | File "/tmp/tmpuuyfgz7f/tmpo_5ullea.py", line 20
while '0 0' != (inp = input()):
^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s556463444 | p00711 | u228488524 | 1508829211 | Python | Python3 | py | Runtime Error | 0 | 0 | 723 | def search(M, l, walkable):
i, j = (l.pop(0))
nexts = []
if i !=0:
nexts.append((i-1, j))
if i != len(M)-1:
nexts.append((i+1, j))
if j != 0:
nexts.append((i, j-1))
if j != len(M[0])-1:
nexts.append((i, j+1))
for nex in nexts:
x, y = nex
if M[x][y] == '.' and not nex in walkable:
l.append(nex)
walkable.append(nex)
inp = ''
while '0 0' != (inp = input()):
i, j = [int(x) for x in inp.split()]
M = [input() for i in range(j)]
l = []
for n in len(M):
if '@' in M[n]:
l.append((n, M[n].find('@')))
walkable = []
while l:
search(M, l, walkable)
print(len(walkable)+1) | File "/tmp/tmpjoc37ttu/tmp737wrbsc.py", line 20
while '0 0' != (inp = input()):
^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s562147048 | p00711 | u228488524 | 1509429944 | Python | Python3 | py | Runtime Error | 0 | 0 | 729 | import queue
def solve(w, h):
q = queue.Queue()
m = [['#' for i in range(w+2)] for j in range(h+2)]
for i in range(h):
inp = input()
for j in range(w):
m[i+1][j+1] = inp[j]
if m[i+1][j+1] == '@':
start = [i+1,j+1]
q.put(start)
c = 1
while not q.empty():
cur = q.get()
XY = [(1,0), (-1, 0), (0, 1), (0, -1)]
for x, y in XY:
cx = cur[0]+x
cy = cur[1]+y
if m[cx][cy] == '.':
m[cx][cy] = '#'
q.put([cx, cy])
c+=1
return c
while True:
w, h = [int(i) for i in input().split()]
if w == 0 and h == 0:
break
print solve(w,h) | File "/tmp/tmpy85idfnw/tmphvdf1_kf.py", line 30
print solve(w,h)
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s722581822 | p00711 | u228488524 | 1512972253 | Python | Python3 | py | Runtime Error | 0 | 0 | 723 | def search(M, l, walkable):
i, j = (l.pop(0))
nexts = []
if i !=0:
nexts.append((i-1, j))
if i != len(M)-1:
nexts.append((i+1, j))
if j != 0:
nexts.append((i, j-1))
if j != len(M[0])-1:
nexts.append((i, j+1))
for nex in nexts:
x, y = nex
if M[x][y] == '.' and not nex in walkable:
l.append(nex)
walkable.append(nex)
inp = ''
while '0 0' != (inp = input()):
i, j = [int(x) for x in inp.split()]
M = [input() for i in range(j)]
l = []
for n in len(M):
if '@' in M[n]:
l.append((n, M[n].find('@')))
walkable = []
while l:
search(M, l, walkable)
print(len(walkable)+1) | File "/tmp/tmpfd9lcv1m/tmp4nff2p4w.py", line 20
while '0 0' != (inp = input()):
^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s517947745 | p00711 | u228488524 | 1512972667 | Python | Python3 | py | Runtime Error | 0 | 0 | 725 | def search(M, l, walkable):
i, j = (l.pop(0))
nexts = []
if i !=0:
nexts.append((i-1, j))
if i != len(M)-1:
nexts.append((i+1, j))
if j != 0:
nexts.append((i, j-1))
if j != len(M[0])-1:
nexts.append((i, j+1))
for nex in nexts:
x, y = nex
if M[x][y] == '.' and not nex in walkable:
l.append(nex)
walkable.append(nex)
inp = ''
while '0 0' != (inp = input()):
i, j = [int(x) for x in inp.split()]
M = [input() for k in range(j)]
l = []
for n in range(j):
if '@' in M[n]:
l.append((n, M[n].find('@')))
walkable = []
while l:
search(M, l, walkable)
print(len(walkable)+1) | File "/tmp/tmpi_hecgul/tmpvfr0rx9d.py", line 20
while '0 0' != (inp = input()):
^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s368225366 | p00711 | u228488524 | 1512974039 | Python | Python3 | py | Runtime Error | 0 | 0 | 734 | def search(M, l, walkable):
i, j = (l.pop(0))
nexts = []
if i !=0:
nexts.append((i-1, j))
if i != len(M)-1:
nexts.append((i+1, j))
if j != 0:
nexts.append((i, j-1))
if j != len(M[0])-1:
nexts.append((i, j+1))
for nex in nexts:
x, y = nex
if M[x][y] == '.' and not nex in walkable:
l.append(nex)
walkable.append(nex)
inp = ''
while '0 0' != (inp = input().rstrip()):
i, j = [int(x) for x in inp.split()]
M = [input() for k in range(j)]
l = []
for n in range(j):
if '@' in M[n]:
l.append((n, M[n].find('@')))
walkable = []
while l:
search(M, l, walkable)
print(len(walkable)+1) | File "/tmp/tmpl72x7h88/tmp2mrjtxk9.py", line 20
while '0 0' != (inp = input().rstrip()):
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s901870521 | p00711 | u209989098 | 1529216678 | Python | Python3 | py | Runtime Error | 0 | 0 | 459 | while 1:
x,y = list(map(int,input()split()))
if x == 0:
break
pp = [1,-1,0,0]
qq = [0,0,1,-1]
m = []
for i in range(y):
m.append(list(input()))
if '@' in m[-1]:
ss = m[-1].index('@')
tt = i
cnt = 0
def move (cx,cy):
global cnt
if cy >= y or cy < 0 or cx >= x or cx < 0:
return
if m[cy][cx] = '.'v or m[cy][cx] = '@'
cnt += 1
m[cy][cx] = '0'
for i in range(4):
move(cx + pp[i],cy + qq[i])
move(ss,tt)
print(cnt)
| File "/tmp/tmpz370c_yj/tmpyc4fsb6b.py", line 2
x,y = list(map(int,input()split()))
^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
| |
s896409084 | p00711 | u209989098 | 1529216711 | Python | Python3 | py | Runtime Error | 0 | 0 | 461 | while 1:
x,y = list(map(int,input()split()))
if x == 0:
break
pp = [1,-1,0,0]
qq = [0,0,1,-1]
m = []
for i in range(y):
m.append(list(input()))
if '@' in m[-1]:
ss = m[-1].index('@')
tt = i
cnt = 0
def move (cx,cy):
global cnt
if cy >= y or cy < 0 or cx >= x or cx < 0:
return 0
if m[cy][cx] = '.'v or m[cy][cx] = '@'
cnt += 1
m[cy][cx] = '0'
for i in range(4):
move(cx + pp[i],cy + qq[i])
move(ss,tt)
print(cnt)
| File "/tmp/tmpdqg2lb6z/tmp0_q_naea.py", line 2
x,y = list(map(int,input()split()))
^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
| |
s244721465 | p00711 | u209989098 | 1529216865 | Python | Python3 | py | Runtime Error | 0 | 0 | 460 | while 1:
x,y = list(map(int,input().split()))
if x == 0:
break
pp = [1,-1,0,0]
qq = [0,0,1,-1]
m = []
for i in range(y):
m.append(list(input()))
if '@' in m[-1]:
ss = m[-1].index('@')
tt = i
cnt = 0
def move (cx,cy):
global cnt
if cy >= y or cy < 0 or cx >= x or cx < 0:
return
if m[cy][cx] = '.'v or m[cy][cx] = '@'
cnt += 1
m[cy][cx] = '0'
for i in range(4):
move(cx + pp[i],cy + qq[i])
move(ss,tt)
print(cnt)
| File "/tmp/tmpgrl89562/tmpc553hfrs.py", line 20
if m[cy][cx] = '.'v or m[cy][cx] = '@'
^^^^^^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s861849096 | p00711 | u209989098 | 1529216940 | Python | Python3 | py | Runtime Error | 0 | 0 | 462 | while 1:
x,y = list(map(int,input().split()))
if x == 0:
break
pp = [1,-1,0,0]
qq = [0,0,1,-1]
m = []
for i in range(y):
m.append(list(input()))
if '@' in m[-1]:
ss = m[-1].index('@')
tt = i
cnt = 0
def move (cx,cy):
global cnt
if cy >= y or cy < 0 or cx >= x or cx < 0:
return
if m[cy][cx] == '.'v or m[cy][cx] == '@'
cnt += 1
m[cy][cx] = '0'
for i in range(4):
move(cx + pp[i],cy + qq[i])
move(ss,tt)
print(cnt)
| File "/tmp/tmpoaunp7du/tmp4n89fror.py", line 20
if m[cy][cx] == '.'v or m[cy][cx] == '@'
^
SyntaxError: invalid syntax
| |
s563104688 | p00711 | u209989098 | 1529216956 | Python | Python3 | py | Runtime Error | 0 | 0 | 461 | while 1:
x,y = list(map(int,input().split()))
if x == 0:
break
pp = [1,-1,0,0]
qq = [0,0,1,-1]
m = []
for i in range(y):
m.append(list(input()))
if '@' in m[-1]:
ss = m[-1].index('@')
tt = i
cnt = 0
def move (cx,cy):
global cnt
if cy >= y or cy < 0 or cx >= x or cx < 0:
return
if m[cy][cx] == '.' or m[cy][cx] == '@'
cnt += 1
m[cy][cx] = '0'
for i in range(4):
move(cx + pp[i],cy + qq[i])
move(ss,tt)
print(cnt)
| File "/tmp/tmpxt7_m6f4/tmpgr0y39n0.py", line 20
if m[cy][cx] == '.' or m[cy][cx] == '@'
^
SyntaxError: expected ':'
| |
s075045253 | p00711 | u500292616 | 1530672286 | Python | Python3 | py | Runtime Error | 0 | 0 | 1005 | # -*- coding: utf-8 -*-
#rea and blac
h,w=1,1
count=0
def search(x,y):
#マップの外側か壁の場合は何もしない
#print(x,y)
global count
if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]=='#':
return
#以前に到達していたら何もしない
if reached[y][x]:
return
reached[y][x]=1
count+=1
#print("aa")
search(x+1,y)#右
search(x-1,y)#左
search(x,y+1)#上
search(x,y-1)#下
while h!=0 and w!=0:
count=0
#グラフの入力方法------
w,h=map(int ,raw_input().split())
if h==0 and w==0:
break
map_data = [[0]*w for _ in range(h)]
reached = [[0]*w for _ in range(h)]
for i in range(h):
ct = raw_input()
#print(len(ct))
for j in range(w):
map_data[i][j] = ct[j]
if ct[j]=="@":
sx=j
sy=i
#------
search(sx,sy)
print(count)
count=0
w=1
h=1
| Traceback (most recent call last):
File "/tmp/tmpwpe7flyd/tmpaztauzsg.py", line 39, in <module>
w,h=map(int ,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s964474388 | p00711 | u500292616 | 1530672307 | Python | Python3 | py | Runtime Error | 0 | 0 | 1005 | # -*- coding: utf-8 -*-
#rea and blac
h,w=1,1
count=0
def search(x,y):
#マップの外側か壁の場合は何もしない
#print(x,y)
global count
if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]=='#':
return
#以前に到達していたら何もしない
if reached[y][x]:
return
reached[y][x]=1
count+=1
#print("aa")
search(x+1,y)#右
search(x-1,y)#左
search(x,y+1)#上
search(x,y-1)#下
while h!=0 and w!=0:
count=0
#グラフの入力方法------
w,h=map(int ,raw_input().split())
if h==0 and w==0:
break
map_data = [[0]*w for _ in range(h)]
reached = [[0]*w for _ in range(h)]
for i in range(h):
ct = raw_input()
#print(len(ct))
for j in range(w):
map_data[i][j] = ct[j]
if ct[j]=="@":
sx=j
sy=i
#------
search(sx,sy)
print(count)
count=0
w=1
h=1
| Traceback (most recent call last):
File "/tmp/tmpwz3as7tv/tmpt99ut7ga.py", line 39, in <module>
w,h=map(int ,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s176034487 | p00711 | u500292616 | 1530684034 | Python | Python3 | py | Runtime Error | 0 | 0 | 1005 | # -*- coding: utf-8 -*-
#rea and blac
h,w=1,1
count=0
def search(x,y):
#マップの外側か壁の場合は何もしない
#print(x,y)
global count
if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]=='#':
return
#以前に到達していたら何もしない
if reached[y][x]:
return
reached[y][x]=1
count+=1
#print("aa")
search(x+1,y)#右
search(x-1,y)#左
search(x,y+1)#上
search(x,y-1)#下
while h!=0 and w!=0:
count=0
#グラフの入力方法------
w,h=map(int ,raw_input().split())
if h==0 and w==0:
break
map_data = [[0]*w for _ in range(h)]
reached = [[0]*w for _ in range(h)]
for i in range(h):
ct = raw_input()
#print(len(ct))
for j in range(w):
map_data[i][j] = ct[j]
if ct[j]=="@":
sx=j
sy=i
#------
search(sx,sy)
print(count)
count=0
w=1
h=1
| Traceback (most recent call last):
File "/tmp/tmp0eppt8t2/tmpgcegkg11.py", line 39, in <module>
w,h=map(int ,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s323550655 | p00711 | u500292616 | 1530684069 | Python | Python3 | py | Runtime Error | 0 | 0 | 1005 | # -*- coding: utf-8 -*-
#rea and blac
h,w=1,1
count=0
def search(x,y):
#マップの外側か壁の場合は何もしない
#print(x,y)
global count
if x<0 or x>w-1 or y<0 or y>h-1 or map_data[y][x]=='#':
return
#以前に到達していたら何もしない
if reached[y][x]:
return
reached[y][x]=1
count+=1
#print("aa")
search(x+1,y)#右
search(x-1,y)#左
search(x,y+1)#上
search(x,y-1)#下
while h!=0 and w!=0:
count=0
#グラフの入力方法------
w,h=map(int ,raw_input().split())
if h==0 and w==0:
break
map_data = [[0]*w for _ in range(h)]
reached = [[0]*w for _ in range(h)]
for i in range(h):
ct = raw_input()
#print(len(ct))
for j in range(w):
map_data[i][j] = ct[j]
if ct[j]=="@":
sx=j
sy=i
#------
search(sx,sy)
print(count)
count=0
w=1
h=1
| Traceback (most recent call last):
File "/tmp/tmpfe7sxrbs/tmpef_fotx3.py", line 39, in <module>
w,h=map(int ,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s354542968 | p00711 | u617183767 | 1396838531 | Python | Python | py | Runtime Error | 0 | 0 | 1163 | # -*- coding: utf-8 -*-
count = 0
def dfs(i, j, island):
global count
print i, j
dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)]
if i < 0 or i >= len(island) or j < 0 or j >= len(island[0]):
return
if island[i][j] == '#' or island[i][j] == 'x':
return
island[i][j] = 'x'
count += 1
for d in dxy:
dfs(i+d[0], j+d[1], island)
def solve(w, h, island):
s_i = 0
s_j = 0
for i, row in enumerate(island):
for j, s in enumerate(row):
if s == '@':
s_i = i
s_j = j
break
dfs(s_i, s_j, island)
print count
def func():
'''
'''
while True:
global count
wh = map(int, raw_input().split())
w = wh[0]
h = wh[1]
island = []
count = 0
for i in range(h):
row = []
line = raw_input()
for j in line:
row.append(j)
island.append(row)
for row in island:
for j in row:
print j
print ''
solve(w, h, island)
return None
func()
| File "/tmp/tmpdi1hfk3v/tmpfd1isihe.py", line 6
print i, j
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s460079590 | p00711 | u617183767 | 1396838593 | Python | Python | py | Runtime Error | 0 | 0 | 1156 | # -*- coding: utf-8 -*-
count = 0
def dfs(i, j, island):
global count
#print i, j
dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)]
if i < 0 or i >= len(island) or j < 0 or j >= len(island[0]):
return
if island[i][j] == '#' or island[i][j] == 'x':
return
island[i][j] = 'x'
count += 1
for d in dxy:
dfs(i+d[0], j+d[1], island)
def solve(w, h, island):
s_i = 0
s_j = 0
for i, row in enumerate(island):
for j, s in enumerate(row):
if s == '@':
s_i = i
s_j = j
break
dfs(s_i, s_j, island)
print count
def func():
'''
'''
while True:
global count
wh = map(int, raw_input().split())
w = wh[0]
h = wh[1]
island = []
count = 0
for i in range(h):
row = []
line = raw_input()
for j in line:
row.append(j)
island.append(row)
# for row in island:
# for j in row:
# print j
# print ''
solve(w, h, island)
func()
| File "/tmp/tmpjuhefrfd/tmp2ub9bqsd.py", line 32
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s915696254 | p00712 | u269391636 | 1523792797 | Python | Python3 | py | Runtime Error | 0 | 0 | 574 | from fractions import Fraction
def frac(n):
return(Fraction(1,n))
def part(s,a,n,m):
if s == 0:
return(1)
k = int(1/s)
if n == 1:
if frac(k) == s and k <= a:
return(1)
else:
return(0)
else:
ans = 0
for i in range(max(k,m),min(a,int(n/s))+1q):
ans += part(s-frac(i), a//i, n-1, i)
return(ans)
while(True):
tmp = list(map(int, input().split()))
p,q,a,n = tmp[0],tmp[1],tmp[2],tmp[3]
if p == 0:
quit()
s = Fraction(p,q)
print(part(s,a,n,1))
| File "/tmp/tmpgnzi9ywd/tmp9fia4qcf.py", line 17
for i in range(max(k,m),min(a,int(n/s))+1q):
^
SyntaxError: invalid decimal literal
| |
s038192369 | p00712 | u779627195 | 1353169056 | Python | Python | py | Runtime Error | 0 | 0 | 490 | EPS = 10**(-8)
def f(i, cnt, total, prod):
global p,q,a,n
#print p,q,a,n
#print p/float(q), i, cnt, total, prod
if(abs(total-p/float(q))<EPS):
return 1
if(total+(n-cnt)*1.0/i+EPS<p/float(q) or p/float(q)<total-EPS
or cnt+1>n or prod*i>a):
return 0
return f(i,cnt+1,total+1.0/i,prod*i) + f(i+1,cnt,total,prod)
while 1:
p,q,a,n = map(int, raw_input().split())
if not (p or q or a or n): break
#print p,q,a,n
print f(1, 0, 0, 1) | File "/tmp/tmpq0r56prb/tmp0c5jmvfa.py", line 18
print f(1, 0, 0, 1)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s999626458 | p00712 | u617183767 | 1400661851 | Python | Python | py | Runtime Error | 0 | 0 | 809 | # -*- coding: utf-8 -*-
def dfs(num, dem, k, cur_num, prd, p, q, a, n):
#print num, dem, k, cur_num, prd
#time.sleep(0.5)
if num == 0:
#print "result: " + str(result)
return 1
result = 0
i = cur_num
while prd * i <= a:
#print i, num, dem, k, cur_num, prd
if (n - k) * dem < num * i:
break
#if num * i < dem:
# i += 1
# continue
result += dfs((num * i) - dem, dem * i, k + 1, i, prd * i, p, q, a, n)
i += 1
return result
def func():
while True:
p, q, a, n = map(int, raw_input().split())
if p == 0 and q == 0 and a == 0 and n == 0:
break
print dfs(p, q, 0, 1, 1, p, q, a, n)
return None
if __name__ == '__main__':
func()
| File "/tmp/tmp44q8tapw/tmp192bqbal.py", line 35
print dfs(p, q, 0, 1, 1, p, q, a, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s304224450 | p00712 | u617183767 | 1400661904 | Python | Python | py | Runtime Error | 0 | 0 | 798 | # -*- coding: utf-8 -*-
def dfs(num, dem, k, cur_num, prd, p, q, a, n):
#print num, dem, k, cur_num, prd
#time.sleep(0.5)
if num == 0:
#print "result: " + str(result)
return 1
result = 0
while prd * i <= a:
#print i, num, dem, k, cur_num, prd
if (n - k) * dem < num * i:
break
# if num * i < dem:
# i += 1
# continue
result += dfs((num * i) - dem, dem * i, k + 1, i, prd * i, p, q, a, n)
i += 1
return result
def func():
while True:
p, q, a, n = map(int, raw_input().split())
if p == 0 and q == 0 and a == 0 and n == 0:
break
print dfs(p, q, 0, 1, 1, p, q, a, n)
return None
if __name__ == '__main__':
func()
| File "/tmp/tmpokn1ylhj/tmp71l4z2wk.py", line 35
print dfs(p, q, 0, 1, 1, p, q, a, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s264335019 | p00712 | u617183767 | 1400662012 | Python | Python | py | Runtime Error | 0 | 0 | 813 | # -*- coding: utf-8 -*-
def dfs(num, dem, k, cur_num, prd, p, q, a, n):
#print num, dem, k, cur_num, prd
#time.sleep(0.5)
if num == 0:
#print "result: " + str(result)
return 1
result = 0
i = cur_num
while prd * i <= a:
#print i, num, dem, k, cur_num, prd
if (n - k) * dem < num * i:
break
# if num * i < dem:
# i += 1
# continue
result += dfs((num * i) - dem, dem * i, k + 1, i, prd * i, p, q, a, n)
i += 1
return result
def func():
while True:
p, q, a, n = map(int, raw_input().split())
if p == 0 and q == 0 and a == 0 and n == 0:
break
print dfs(p, q, 0, 1, 1, p, q, a, n)
return None
if __name__ == '__main__':
func()
| File "/tmp/tmpwr2s_6_f/tmpxlk0ylu8.py", line 35
print dfs(p, q, 0, 1, 1, p, q, a, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.