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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s279527287 | p03971 | u062691227 | 1592899376 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9144 | 340 | x, s = *open(0),
print(x)
print(s)
n, a, b = map(int, x.rstrip.split())
p = 0
wp = 0
for char in s:
if char == 'c' or p >= a+b:
print('No')
continue
if char == 'a':
p += 1
print('Yes')
continue
if wp < b:
p += 1
wp += 1
print('Yes')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmph9ascajg/tmpwrlk45ze.py", line 1, in <module>
x, s = *open(0),
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s485424953 | p03971 | u829416877 | 1592481499 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 354 | N,A,B = map(int, input().split())
S = input().split()
s=[]
for i in S:
s.append(i)
list=[]
H = list.count('b')
for i in range(N):
if s[i] == 'c'
print('No')
elif s[i] =='a' and len(list) <= A+B:
print('Yes')
list.append(a)
elif s[i] =='a':
print('No')
elif len(list) <= A+B and H <= B:
print('Yes')
else:
print('No') | File "/tmp/tmpzcw2m_fh/tmp7qnhexrb.py", line 9
if s[i] == 'c'
^
SyntaxError: expected ':'
| |
s876423145 | p03971 | u526131148 | 1592370447 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 431 | N, A, B = map(int, input().split())
S = str(input())
total = 0
kaigai = 0
for i in range(0, len(S)):
if L[i] == 'a':
if total < A+B:
print('Yes')
total += 1
else:
print('No')
elif L[i] == 'b':
if total < A+B & kaigai <B:
print('Yes')
total += 1
kaigai += 1
else:
print('No')
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmph0j77d02/tmpnkcdvxi7.py", line 1, in <module>
N, A, B = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s367798773 | p03971 | u579469974 | 1592359592 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38256 | 391 | def main():
n,a,b=mi()
s=input()
nover=0
tot=0
for i in range(n):
if tot<a+b:
if s[i]=='a':
print('Yes')
tot+=1
elif s[i]=='b' and nover<b:
print('Yes')
nover+=1
tot+=1
else:
print('No')
else:
print('No')
main() | Traceback (most recent call last):
File "/tmp/tmpzo1un78i/tmpkw6ox9dg.py", line 19, in <module>
main()
File "/tmp/tmpzo1un78i/tmpkw6ox9dg.py", line 2, in main
n,a,b=mi()
^^
NameError: name 'mi' is not defined. Did you mean: 'i'?
| |
s062876582 | p03971 | u579469974 | 1592359491 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38512 | 413 | def main():
n,a,b=mi()
s=list(input())
nover=0
tot=0
for i in range(n):
if tot<a+b:
if s[i]=='a':
print('Yes')
tot+=1
elif s[i]=='b' and nover<b:
print('Yes')
nover+=1
tot+=1
else:
print('No')
else:
print('No')
main() | Traceback (most recent call last):
File "/tmp/tmp0fh7raqf/tmpzh28gtn9.py", line 19, in <module>
main()
^^^^^^
File "/tmp/tmp0fh7raqf/tmpzh28gtn9.py", line 2, in main
n,a,b=mi()
^^
NameError: name 'mi' is not defined. Did you mean: 'i'?
| |
s255065078 | p03971 | u232873434 | 1592315611 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 402 | import numpy as np
N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
if S[i]=='c':
print('No')
elif total>0:
if S[i] == 'a':
print('Yes')
total = total-1
elif S[i] =='b' and B>0:
print('Yes')
total = total-1
B = B-1
else:
print('No')
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmps_nks57_/tmpi53rs2g4.py", line 2, in <module>
N,A,B = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s468150000 | p03971 | u363146889 | 1591650342 | Python | PyPy3 (2.4.0) | py | Runtime Error | 372 | 72148 | 775 | # -*- coding: utf-8 -*-
## Library
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
## input
# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split())
# P = [list(map(int,input().split())) for i in range(M)]
N,A,B=map(int, input().split())
S = input()
tmp1 = 0
tmp2 = 0
for i in range(0,N):
if tmp1 < A+B:
if S[i] == "a":
tmp1 += 1
print("Yes")
elif S[i] == "b" & tmp2 < B:
tmp1 += 1
tmp2 += 1
print("Yes")
else:
print("No")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmp53wu4ma6/tmpb1md_tj5.py", line 6, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s198481969 | p03971 | u441246928 | 1591241744 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 399 | N,A,B = map(int,input().split())
S = input()
cnt = 0
bcnt = 1
for s in S :
if s =='a' :
if A + B > cnt :
print('Yes')
cnt += 1
else :
print('No')
elif s == 'b'
if A + B > cnt and B => bcnt :
print('Yes')
bcnt += 1
cnt += 1
else :
print('No')
else :
print('No') | File "/tmp/tmpsueb7qw5/tmptz27gee9.py", line 12
elif s == 'b'
^
SyntaxError: expected ':'
| |
s250984732 | p03971 | u441246928 | 1591241710 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 398 | N,A,B = map(int,input().split())
S = input()
cnt = 0
bcnt = 1
for s in :
if s =='a' :
if A + B > cnt :
print('Yes')
cnt += 1
else :
print('No')
elif s == 'b'
if A + B > cnt and B => bcnt :
print('Yes')
bcnt += 1
cnt += 1
else :
print('No')
else :
print('No') | File "/tmp/tmpztilhknv/tmpz_rq078j.py", line 5
for s in :
^
SyntaxError: invalid syntax
| |
s497784979 | p03971 | u441246928 | 1591241677 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 405 | N,A,B = map(int,input().split())
S = list(input())
cnt = 0
bcnt = 1
for s in S :
if s =='a' :
if A + B > cnt :
print('Yes')
cnt += 1
else :
print('No')
elif s == 'b'
if A + B > cnt and B => bcnt :
print('Yes')
bcnt += 1
cnt += 1
else :
print('No')
else :
print('No') | File "/tmp/tmp1oj6rjav/tmp9rd12afs.py", line 12
elif s == 'b'
^
SyntaxError: expected ':'
| |
s370951560 | p03971 | u441246928 | 1591241424 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 413 | N,A,B = map(int,input().split())
S = list(input())
cnt = 0
bcnt = 1
for i in S :
if S[i] == 'a' :
if A + B > cnt :
print('Yes')
cnt += 1
else :
print('No')
elif S[i] == 'b'
if A + B > cnt and B => bcnt :
print('Yes')
bcnt += 1
cnt += 1
else :
print('No')
else :
print('No')
| File "/tmp/tmpidpvjc1n/tmpm93uyhf4.py", line 12
elif S[i] == 'b'
^
SyntaxError: expected ':'
| |
s160932486 | p03971 | u674588203 | 1591240898 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 378 | N,A,B=map(int,input(),())
S=input()
nowA=0
nowB=0
for s in S:
if s=='c':
print('No')
elif s=='a':
if nowA+nowB<=A+B:
nowA+=1
print('Yes')
else:
print('No')
else:
if nowA+nowB<=A+B and nowB<=B:
nowB+=1
print('Yes')
nowB+=1
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmpc5b8eqvk/tmpg_fjfe8y.py", line 1, in <module>
N,A,B=map(int,input(),())
^^^^^^^
EOFError: EOF when reading a line
| |
s005778414 | p03971 | u441246928 | 1591240828 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 411 | N,A,B = map(int,input.split())
S = list(input())
cnt = 0
bcnt = 1
for i in S :
if S[i] == 'a' :
if A + B > cnt :
print('Yes')
cnt += 1
else :
print('No')
elif S[i] == 'b'
if A + B > cnt and B => bcnt :
print('Yes')
bcnt += 1
cnt += 1
else :
print('No')
else :
print('No')
| File "/tmp/tmpuitkrb6f/tmp2ib5m6a_.py", line 12
elif S[i] == 'b'
^
SyntaxError: expected ':'
| |
s181631843 | p03971 | u364386647 | 1591105407 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 571 | def resolve():
N, A, B = list(map(int, input().split()))
S = str(input())
num = 0
foreignnum = 1
for i in range(N):
if S[i] == 'a':
if (num < A + B):
num += 1
print('Yes')
else:
print('No')
if S[i] == 'b':
if (num < A + B) and (foreignnum <= B):
num += 1
foreignnum += 1
print('Yes')
else:
print('No')
if S[i] == 'c':
print('No')
return
resolve() | File "/tmp/tmpsum1veh1/tmpz06j1vwq.py", line 27
resolve()
^
IndentationError: unindent does not match any outer indentation level
| |
s427898949 | p03971 | u791110052 | 1591067563 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 250 | j = 0
for n in s:
if n == "a":
if i + j < a + b:
i += 1
print("Yes")
else:
print("No")
elif n == "b":
if (i + j < a + b) and j < b:
j += 1
print("Yes")
else:
print("No")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmp0x63601e/tmpnmk5utun.py", line 2, in <module>
for n in s:
^
NameError: name 's' is not defined
| |
s414909762 | p03971 | u581403769 | 1590710707 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 429 | n, a, b = map(int, input().split())
s = input()
all = list(s)
count = 0
count_b = 0
for i in all:
if i == 'a':
if count <= a + b:
print('yes')
count += 1
else:
print('no')
if i == 'b':
if count <= a + b and count_b <= b
print('yes')
count += 1
count_b += 1
else:
print('no')
else:
print('no') | File "/tmp/tmp1ysyomet/tmp0jh6g690.py", line 15
if count <= a + b and count_b <= b
^
SyntaxError: expected ':'
| |
s737339075 | p03971 | u810288681 | 1590533911 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 99 | import math
n = int(input())
x1 = math.ceil(n/1.08)
print(':(' if math.floor(x1*1.08) != n else x1) | Traceback (most recent call last):
File "/tmp/tmppm8pl_gv/tmppvrgyxgy.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s161386873 | p03971 | u238940874 | 1589490911 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 260 | s=input()
cnt=0
for i in range(n):
if s[i] == 'a' and cnt < a+b:
print('Yes')
cnt+=1
elif s[i] == 'b' and cnt < a+b and i+1 <=b:
print('Yes')
cnt+=1
elif s[i] == 'c':
print('No')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmphkpyrbbt/tmptvbtthzc.py", line 1, in <module>
s=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s574355924 | p03971 | u198930868 | 1588797761 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 314 | N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
if s == "a":
if passp < (A+B):
passp += 1
print("Yes")
else:
print("No")
elif s == "b":
if passp < (A+B) and passb < B:
passp += 1
passb += 1
print("Yes")
else:
print("No")
else:
print("No") | File "/tmp/tmpfu8mlmjl/tmpc5o714b5.py", line 10
else:
TabError: inconsistent use of tabs and spaces in indentation
| |
s475586473 | p03971 | u198930868 | 1588797675 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 314 | N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
if s == "a":
if passp < (A+B):
passp += 1
print("YES")
else:
print("NO")
elif s == "b":
if passp < (A+B) and passb < B:
passp += 1
passb += 1
print("YES")
else:
print("NO")
else:
print("NO") | File "/tmp/tmpsz52cg_d/tmpwjqpq9j_.py", line 10
else:
TabError: inconsistent use of tabs and spaces in indentation
| |
s465781634 | p03971 | u827306875 | 1588782119 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 367 | N, A, B = input().split()
s = [str(x) for x in input().split()]
count = 0
sb = 0
for i in range(len(s)):
if s[i] == a:
if count <= A+B:
print('Yes')
count +=1
else:
print('No')
elif s[i] == b:
if count <= A+B && sb <= B:
print('Yes')
count += 1
sb += 1
else:
print('No')
else:
print('No') | File "/tmp/tmpqn454yu5/tmp90z9tdin.py", line 15
if count <= A+B && sb <= B:
^
SyntaxError: invalid syntax
| |
s628022227 | p03971 | u708890186 | 1588562842 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 301 | N,A,B=map(int,input().split())
S=input()
cnta=0
for i in range(N):
if S[i]==a:
if cnta<A+B:
print("Yes")
cnta+=1
else:
print("No")
elif S[i]==b:
if (cnta < A+B) and (i+1 <= B):
print("Yes")
cnta+=1
else:
print("No")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmpoe4fns2b/tmpvoocs6ks.py", line 1, in <module>
N,A,B=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s228863727 | p03971 | u708890186 | 1588562640 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 286 | N,A,B=map(int,input().split())
S=input()
cnta=0
cntb=0
for i in range(N):
if S[i]==a:
if cnta<A:
print("Yes")
elsse:
print("No")
cnta+=1
elif S[i]==b:
if cntb+cnta < A+B:
print("Yes")
elsse:
print("No")
cntb+=1
else:
print("No") | File "/tmp/tmpbvjx1096/tmpd4wvqasw.py", line 9
elsse:
^
SyntaxError: invalid syntax
| |
s570213391 | p03971 | u746154235 | 1588358358 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 306 | N,A,B=map(int, input().split())
S=int(input().split())
cntA=0
cntB=0
for s in S:
if s == 'c':
print('No')
continue
if s == 'a' and (cntA+cntB) < A+B:
print('Yes')
cntA +=1
elif (s == 'b') and ((cntA+cntB) < A+B) and (cntB < B):
print('Yes')
cntB +=1
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmpygo9xj2i/tmp4vahmxp4.py", line 1, in <module>
N,A,B=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s436177440 | p03971 | u746154235 | 1588358312 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 291 | N,A,B=map(int, input().split())
S=int(input().split())
for s in S:
if s == 'c':
print('No')
continue
if s == 'a' and (cntA+cntB) < A+B:
print('Yes')
cntA +=1
elif (s == 'b') and ((cntA+cntB) < A+B) and (cntB < B):
print('Yes')
cntB +=1
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmpjobt_yap/tmprgyaraqx.py", line 1, in <module>
N,A,B=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s575288417 | p03971 | u425762225 | 1588089966 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 39152 | 325 | N, A, B = map(int,input().split())
S = input()
a_counter, b_counter = 0
while S != "":
s = S[0]
if s == "a" and a_counter + b_counter <=a+b:
a_counter += 1
print("Yes")
elif s == "b" and b_counter <= b and a_counter + b_counter <=a+b:
b_counter += 1
print("Yes")
else:
print("No")
S = S[1:] | Traceback (most recent call last):
File "/tmp/tmp1qusznd7/tmpytzen6q_.py", line 1, in <module>
N, A, B = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s086284844 | p03971 | u023751250 | 1588040502 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 341 | n,in,out=map(int,input().split())
b=input()
kokunai=0
kaigai=0
for i in range(n):
if(b[i]=='c'):
print('No')
else if(b[i]=='a'):
if(kokunai+kaigai>=in+out):
print('No')
else:
kokunai=kokunai+1
print('Yes')
else:
if(kokunai+kaigai>=in+put or kaigai>=out):
print('No')
else:
print('Yes') | File "/tmp/tmp7t_pz7ja/tmp1ziijrmj.py", line 1
n,in,out=map(int,input().split())
^^
SyntaxError: invalid syntax
| |
s095317001 | p03971 | u629607744 | 1587779303 | Python | Python (3.4.3) | py | Runtime Error | 100 | 4600 | 209 | n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
if s[i]=='a' and cnt<a+b:
print('Yes')
cnt+=1
elif s[i]=='b' and cnt<A+B and cnt_b<=B:
print('Yes')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpr_t2137x/tmpz2oe0y12.py", line 1, in <module>
n,A,B=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s006344165 | p03971 | u629607744 | 1587779214 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 274 | n,A,B=map(int,input().split())
s=list(input())
cnt=0
cnt_b=0
for i in range(n):
if s[i]=='a' and cnt<a+b:
print('Yes')
cnt+=1
else:
print('No')
elif s[i]=='b' and cnt<A+B and cnt_b<=B:
print('Yes')
else:
print('No')
elif s[i]=='c':
print('No')
cnt_c+=1 | File "/tmp/tmp_8f1m9sl/tmpmv7kbexd.py", line 11
elif s[i]=='b' and cnt<A+B and cnt_b<=B:
^^^^
SyntaxError: invalid syntax
| |
s767659482 | p03971 | u331997680 | 1587503646 | Python | Python (3.4.3) | py | Runtime Error | 30 | 3956 | 304 | N, A, B = map(int, input().split())
C = input()
D = [C[i:i+1] for i in range(N)]
AA = 0
BB = 0
for i in(D):
if D[i] == 'c':
print('No')
elif D[i] =='a' and A+B > AA+BB:
print('Yes')
AA += 1
elif D[i] =='a' and A+B > AA+BB and BB < B:
print('Yes')
BB += 1
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpcfwmmdnu/tmppena3v_h.py", line 1, in <module>
N, A, B = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s564197367 | p03971 | u869265610 | 1587335847 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 274 | N,A,B=map(int,input().split())
S=list(map(input().split()))
sin=0
cos=0
for i in range(S)
if S.pop(i)='a'or'b':
sin+=1
if S.pop(i)='b':
cos+=1
print("Yes" if S.pop(i)='a' and sin<A+B:
"Yes" elif S.pop(i)='b' and B<=cos and sin<A+B:
else "No")
| File "/tmp/tmpa6k27gzz/tmpe0pdbr3d.py", line 5
for i in range(S)
^
SyntaxError: expected ':'
| |
s849056399 | p03971 | u869265610 | 1587335718 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 309 | N,A,B=map(int,input().split())
S=list(map(input().split()))
sin=0
cos=0
K=list.count("a")
G=list.count("b")
for i in range(S)
if S.pop(i)='a'or'b':
sin+=1
if S.pop(i)='b':
cos+=1
print("Yes" if S.pop(i)='a' and sin<K+G:
"Yes" elif s.pop(i)='b' and G<=cos and sin<K+G:
else "No")
| File "/tmp/tmptejajvqe/tmpn_vi9lxm.py", line 7
for i in range(S)
^
SyntaxError: expected ':'
| |
s234081684 | p03971 | u502200133 | 1587333479 | Python | Python (3.4.3) | py | Runtime Error | 93 | 4016 | 246 | p = 0
n, a, b = map(int, input().split())
for i in input():
if i == "a" and p < a+b:
p += 1
print("Yes")
elif i == "b" and p < a+b and f < b:
f += 1
p += 1
print("Yes")
else:
print("No") | Traceback (most recent call last):
File "/tmp/tmp3urvvgo5/tmp59k3juo0.py", line 2, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s399099567 | p03971 | u545644875 | 1587249579 | Python | Python (3.4.3) | py | Runtime Error | 120 | 4708 | 989 | li = list(map(int,input().split()))
s=list(input())
cnt = 0
b = 0
for i in s:
if i == "a":
if cnt < li[1] + li[2]:
cnt += 1
print("Yes")
else:
print("No")
elif i == "b":
b += 1
if cnt < li[1] + li[2]:
if b <= li[2]:
cnt += 1
print("Yes")
else:
print("No")
else:
print("No")
else:
#cnt -= 1
print("No")
#print(a)
li = list(map(int,input().split()))
s=list(input())
cnt = 0
b = 0
for i in s:
if i == "a":
if cnt < li[1] + li[2]:
cnt += 1
print("Yes")
else:
print("No")
elif i == "b":
b += 1
if cnt < li[1] + li[2]:
if b <= li[2]:
cnt += 1
print("Yes")
else:
print("No")
else:
print("No")
else:
#cnt -= 1
print("No") | Traceback (most recent call last):
File "/tmp/tmpurofybzc/tmptqgtsqd6.py", line 1, in <module>
li = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s800871878 | p03971 | u545644875 | 1587248627 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 567 | x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0
for i in s:
if i == "a":
if rank <= x[1] + x[2]:
rank += 1
print("Yes")
else:
print("No")
elif i == "b":
if rank <= x[1] + x[2]:
rank += 1
if frank <= x[2]:
frank += 1
print("Yes")
else:
print("No")
else:
print("No")
else:
print("No") | File "/tmp/tmpex8n4msg/tmpr7rpn7xr.py", line 17
elif i == "b":
^^^^
SyntaxError: invalid syntax
| |
s265020038 | p03971 | u545644875 | 1587248423 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 592 | x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0
for i in s:
if i == "a":
if rank <= x[1] + x[2]:
rank += 1
print("Yes")
else:
print("No")
elif i == "b":
if rank <= x[1] + x[2]:
rank += 1
if frank <= x[2]:
frank += 1
print("Yes")
else:
print("No")
else:
print("No")
else:
print("No") | File "/tmp/tmp_lfq_91i/tmphzn2k26d.py", line 13
else:
^
IndentationError: unindent does not match any outer indentation level
| |
s520936512 | p03971 | u545644875 | 1587246557 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 508 | x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0
for i in s:
if i == "c":
print("NO")
elif i == "b":
if rank =< x[1] + x[2] and frank =< x[2]:
rank += 1
frank += 1
print("YES")
else:
print("NO")
else:
if rank =< x[1] + x[2]:
rank += 1
print("YES")
else:
print("NO") | File "/tmp/tmpm1xfw99p/tmpqferhqid.py", line 12
if rank =< x[1] + x[2] and frank =< x[2]:
^
SyntaxError: invalid syntax
| |
s710830408 | p03971 | u274635633 | 1586746937 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 236 | n,a,b=map(int,input().split())
s=input()
all=a+b
in=b
for i in range(n):
if all==0:
print('No')
elif s[i]=='a':
print('Yes')
all-=1
elif s[i]=='b' and in>0:
print('Yes')
all-=1
in-=1
else:
print('No') | File "/tmp/tmpl53uv8ix/tmpfk_em0vh.py", line 4
in=b
^^
SyntaxError: invalid syntax
| |
s581868409 | p03971 | u251779460 | 1586738618 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 824 | #include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;
int main() {
int n, a, b;
string s;
cin >> n >> a >> b >> s;
int cnt = 0; //予選通過確定者の人数
int kaigai = 0;
rep(i, n) {
if (cnt + 1 <= a + b) {
if (s[i] == 'a') {
cnt++;
cout << "Yes" << endl;
} else if (s[i] == 'b') {
kaigai++;
if (kaigai <= b) {
cout << "Yes" << endl;
cnt++;
} else
cout << "No" << endl;
} else {
cout << "No" << endl;
}
} else
cout << "No" << endl;
}
} | File "/tmp/tmpn7s_uypt/tmpo20ncjkc.py", line 7
const long long INF = 1LL << 60;
^
SyntaxError: invalid decimal literal
| |
s333567630 | p03971 | u089142196 | 1586712613 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 214 | N,A,B = map(int,input().split())
S=input()
pas=0
kai=0
for num in S:
if num=="a":
if pas<A+B:
pas +=1
print("Yes")
else:
print("No")
elif num=="b":
if pas<A+B and :
pas +=1
| File "/tmp/tmpcxrixywk/tmpin2rnkl3.py", line 14
if pas<A+B and :
^
SyntaxError: invalid syntax
| |
s144110919 | p03971 | u857460786 | 1586665536 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 441 | # coding: utf-8
As = list(input().rstrip().split(" "))
N = int(As[0])
A = int(As[1])
B = int(As[2])
S = input()
cnt = 1
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if cnt < A+B:
print("Yes")
cnt +=1
else:
print("No")
elif S[i] == "b":
if cnt < B:
print("Yes")
cnt +=1
else:
print("No") | File "/tmp/tmpn3hdv03b/tmp1t6agcij.py", line 7
S = input()
IndentationError: unexpected indent
| |
s314282538 | p03971 | u857460786 | 1586665481 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 393 | # coding: utf-8
N,A,B=list(map(int,input().split()))
S = input()
cnt = 1
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if cnt < A+B:
print("Yes")
cnt +=1
else:
print("No")
elif S[i] == "b":
if cnt < B:
print("Yes")
cnt +=1
else:
print("No") | File "/tmp/tmpozcq8gnb/tmpj6qny91_.py", line 4
S = input()
IndentationError: unexpected indent
| |
s287877101 | p03971 | u036914910 | 1586665049 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 223 | or i in range(N) :
if (S[i] == 'a') and (c < A + B) :
print('Yes')
c += 1
elif S[i] == 'b' and (c < A + B) and b < B:
print('Yes')
b += 1
c += 1
else :
print('No') | File "/tmp/tmptpeukxxy/tmpdbz8wdye.py", line 1
or i in range(N) :
^^
SyntaxError: invalid syntax
| |
s844036293 | p03971 | u857460786 | 1586664922 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 371 | # coding: utf-8
As = list(input().rstrip().split(" "))
N = As[0]
A = As[1]
B = As[2]
S = input()
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if i < A+B:
print("Yes")
else:
print("No")
elif S[i] == "b":
if i < B:
print("Yes")
else:
print("No") | Traceback (most recent call last):
File "/tmp/tmp9ih0jknz/tmpv496yn_w.py", line 3, in <module>
As = list(input().rstrip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s110365654 | p03971 | u857460786 | 1586664771 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 395 | # coding: utf-8
pre_list = list(input().rstrip().split(" "))
N = pre_list[0]
A = pre_list[1]
N = pre_list[2]
S = input()
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if i < A+B:
print("Yes")
else:
print("No")
elif S[i] == "b":
if i < B:
print("Yes")
else:
print("No") | Traceback (most recent call last):
File "/tmp/tmpxjmaachm/tmpuu8b_wmz.py", line 3, in <module>
pre_list = list(input().rstrip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s148039318 | p03971 | u857460786 | 1586664526 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 393 | # coding: utf-8
pre_list = list(input().rstrip().split(""))
N = pre_list[0]
A = pre_list[1]
N = pre_list[2]
S = input()
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if i < A+B:
print("Yes")
else:
print("No")
elif S[i] == "b":
if i < B:
print("Yes")
else:
print("No") | Traceback (most recent call last):
File "/tmp/tmp6mwflyh6/tmp29lnwvh0.py", line 3, in <module>
pre_list = list(input().rstrip().split(""))
^^^^^^^
EOFError: EOF when reading a line
| |
s170720901 | p03971 | u857460786 | 1586664296 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 338 | # coding: utf-8
N,A,B=list(map(int,input().split()))
S = input()
for i in range(N):
if S[i] == "c":
print("No")
elif S[i] == "a":
if i < A+B:
print("Yes")
else:
print("No")
elif S[i] == "b":
if i < B:
print("Yes")
else:
print("No")
| File "/tmp/tmp0kz1sij2/tmp2cr5pjxp.py", line 4
S = input()
IndentationError: unexpected indent
| |
s173669969 | p03971 | u735335967 | 1586638444 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 289 | n, a, b = map(int, input().split())
b_cnt = 0
a_cnt = 0
for i in range(n):
if s[i] == "a" and (a_cnt+b_cnt) < a+b:
a_cnt += 1
print("Yes")
elif s[i] == "b" and (a_cnt+b_cnt) < a+b and b_cnt < b:
b_cnt += 1
print("Yes")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmpy1192uth/tmpe1v8eg6e.py", line 1, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s774043274 | p03971 | u735335967 | 1586638388 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 303 | n, a, b = map(int, input().split())
print(len(s))
b_cnt = 0
a_cnt = 0
for i in range(n):
if s[i] == "a" and (a_cnt+b_cnt) < a+b:
a_cnt += 1
print("Yes")
elif s[i] == "b" and (a_cnt+b_cnt) < a+b and b_cnt < b:
b_cnt += 1
print("Yes")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmpblwr7mxr/tmpi3i22yz0.py", line 1, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s076813627 | p03971 | u056358163 | 1586634303 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 473 | N, A, B = a,b=map(int, input().split())
S = input()
qualified = 0
qualified_foreign = 0.
for s in S:
if s == 'c':
print('No')
elif s == 'a':
if qualified < A + B:
print('Yes')
qualified += 1
else:
print('No')
else:
if (qualified < A + B) & (qualified_foreign < B):
print('Yes')
qualified += 1
qualified_foreign += 1
else:
print('No')
| Traceback (most recent call last):
File "/tmp/tmpemtacaf9/tmpz_sc1gb_.py", line 1, in <module>
N, A, B = a,b=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s995824836 | p03971 | u113971909 | 1583667888 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3188 | 300 | n,a,b=map(int,input().split())
cab,cb=0,0
for i in range(n):
s=input()
if s=='c':
print('No')
if s=='a':
if cab<a+b:
print('Yes')
cab+=1
else:
print('No')
if s=='b':
if cab<a+b and cb<b:
print('Yes')
cab+=1
cb+=1
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpk31b1z8i/tmp6fpkn6p8.py", line 1, in <module>
n,a,b=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s516981620 | p03971 | u291988695 | 1581359490 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3956 | 258 | n,a,b=map(int,input().split())
bs=1
a=[""]*n
s=input()
for k in range(n):
if s[k]!="c":
k<=a+b-1
if s[k]=="a":
a[k]="Yes"
else:
if bs<=b:
bs+=1
a[k]="Yes"
else:
a[k]="No"
else:
a[k]="No"
print(*a) | Traceback (most recent call last):
File "/tmp/tmp45revlnb/tmplkisaiv1.py", line 1, in <module>
n,a,b=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s294532946 | p03971 | u969190727 | 1558047651 | Python | Python (3.4.3) | py | Runtime Error | 118 | 4016 | 290 | n,a,b=map(int,input().split())
s=input()
pa,pb=0,0
for i in range(n):
if s[i]=='a':
pa+=1
if pa+prb<=a+b:
print('Yes')
else:
print('No')
elif s[i]=='b':
pb+=1
if pa+pb<=a+b and pb<=b:
print('Yes')
else:
print('No')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpesu14b4a/tmpv8zwmldu.py", line 1, in <module>
n,a,b=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s805662681 | p03971 | u426108351 | 1554227177 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 223 | N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for i in range(S):
if S[i] == 'a' and a+b < A+B:
a += 1
print('Yes')
elif S[i] == 'b' and a+b < A+B and b < B:
print('Yes')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpc81egluc/tmplc53eru5.py", line 1, in <module>
N, A, B = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s158119341 | p03971 | u118642796 | 1553574972 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 387 | N,A,B = map(int,input().split())
S = input()
win = 0
abr = 0
for c in S:
if c == a:
if win<A+B:
print("Yes")
win += 1
else:
print("No")
elif c == b:
if win < A+B and abr <= B:
print("Yes")
win += 1
abr += 1
else:
print("No")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmpfx19ru5k/tmpqoqhpddh.py", line 1, in <module>
N,A,B = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s519280081 | p03971 | u543954314 | 1552236037 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 240 | n, a, b = map(int, input().split())
s = input()
cnt = a+b
fc = b
for i in range(n):
if s[n] == 'a' and cnt:
print("Yes")
cnt -= 1
elif s[n] == 'b' and cnt and fc:
print("Yes")
cnt -= 1
fc -= 1
else:
print("No") | Traceback (most recent call last):
File "/tmp/tmpu_xr1civ/tmpp82yp5mt.py", line 1, in <module>
n, a, b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s148224537 | p03971 | u846150137 | 1537068461 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 373 | I = lambda: [int(i) for i in input().split()]
n,k=I()
a=I()[::-1]
a.append(0)
b=[]
p=1
for i in range(n):
if i==0:
b+=[a[i] + a[i] * (p + 1)**2 + k ]
elif a[i] * 2 ** 2 + a[i] * (p + 1)**2 + a[i] + k > a[i] * (p + 1 + 1)**2 :
b+=[p*a[i] * (p + 1 + 1)**2 - p * a[i] * (p + 1)**2]
p+=1
else:
b+=[a[i] * 2 **2 + a[i] + k]
p=1
print(sum(b) +k*n) | Traceback (most recent call last):
File "/tmp/tmppnpu7xk6/tmp1v2y3h8z.py", line 2, in <module>
n,k=I()
^^^
File "/tmp/tmppnpu7xk6/tmp1v2y3h8z.py", line 1, in <lambda>
I = lambda: [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s846812483 | p03971 | u333945892 | 1536111047 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 347 | N,A,B = map(int,list(input()))
S = input()
tmp = 0
tmpf = 0
for i in range(1,N+1):
s = S[i]
if s == "a":
if tmp <= A+B:
print("Yes")
tmp +=1
else:
print("No")
elif s == "b":
if tmp <= A+B and tmpf <=B:
print("Yes")
tmp +=1
tmpf += 1
else:
print("No")
else:
print("No")
| Traceback (most recent call last):
File "/tmp/tmprjfuklc2/tmp_jj9cm6b.py", line 1, in <module>
N,A,B = map(int,list(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s649258398 | p03971 | u941884460 | 1526047060 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 353 | N,A,B=map(int,input().split())
s = input().rstrip()
count = 0
countB = 0
for i in range(N):
if A+B <= count:
print('No')
else:
if s[i] == 'a':
print('Yes')
count += 1
elif s[i] =='b'"
if countB <= B:
print('Yes')
countB += 1
count += 1
else:
print('No')
else:
print('No') | File "/tmp/tmppttd2245/tmpwtemvv4f.py", line 12
elif s[i] =='b'"
^
SyntaxError: unterminated string literal (detected at line 12)
| |
s346713629 | p03971 | u582243208 | 1476310914 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3064 | 256 | n,a,b=map(int,input().split())
s=input()
for i in s:
if a+b>0:
if i=="a":
a-=1
print("Yes")
continue
elif i=="b" and b>0:
b-=1
print("Yes")
continue
print("No")
| File "/tmp/tmpktkwjn6s/tmpb4ychkma.py", line 9
elif i=="b" and b>0:
^
IndentationError: unindent does not match any outer indentation level
| |
s252063025 | p03971 | u619384481 | 1476149404 | Python | Python (2.7.6) | py | Runtime Error | 25 | 6660 | 323 | init_input=map(int, raw_input().split())
mem=raw_input()
mem_list=list(mem)
man=init_input[0]
jap=init_input[1]
ove=init_input[2]
jas=0
ovs=0
for i in range(man):
if mem==a and jas+ovs<jap+ove:
jap+=1
print "Yes"
elif mem==b and jas+ovs<jap+ove and ovs<ove:
ovs+=1
print "Yes"
else:
print "No" | File "/tmp/tmpafdervjd/tmpalg7zjf9.py", line 16
print "Yes"
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s475840930 | p03971 | u279903174 | 1476120898 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2948 | 447 | args = list(map(lambda x: int(x), raw_input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()
a = 0
b = 0
for i in range(0, len(s)):
if s[i] == 'a':
if a + b < A + B:
a = a + 1
print('Yes')
else:
print('No')
elif s[i] == 'b':
if a + b < A + B and b < B:
b = b + 1
print('Yes')
else:
print('No')
else:
print('No') | Traceback (most recent call last):
File "/tmp/tmpgnpufn6p/tmp5qp5gmxg.py", line 1, in <module>
args = list(map(lambda x: int(x), raw_input().split()))
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s100043436 | p03971 | u279903174 | 1476120709 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3064 | 449 | args = list(map(lambda x: int(x), input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()
a = 0
b = 0
for i in range(0, len(s)):
if s[i] == 'a':
if a + b < A + B:
a = a + 1
print('Yes')
else:
print('No')
elif s[i] == 'b':
if a + b < A + B and b < B:
b = b + 1
print('Yes')
else:
print('No')
else:
print('No') | File "/tmp/tmpr8xwilnp/tmpzyvigr4e.py", line 1
args = list(map(lambda x: int(x), input().split()))
^
SyntaxError: invalid character '' (U+FFFC)
| |
s800130309 | p03971 | u279903174 | 1476120556 | Python | Python (2.7.6) | py | Runtime Error | 15 | 2568 | 449 | args = list(map(lambda x: int(x), input().split()))
N = args[0]
A = args[1]
B = args[2]
s = input()
a = 0
b = 0
for i in range(0, len(s)):
if s[i] == 'a':
if a + b < A + B:
a = a + 1
print('Yes')
else:
print('No')
elif s[i] == 'b':
if a + b < A + B and b < B:
b = b + 1
print('Yes')
else:
print('No')
else:
print('No') | File "/tmp/tmpke9l6fxx/tmpxpr694ih.py", line 1
args = list(map(lambda x: int(x), input().split()))
^
SyntaxError: invalid character '' (U+FFFC)
| |
s545548417 | p03971 | u835464975 | 1476120045 | Python | Python (2.7.6) | py | Runtime Error | 24 | 2820 | 373 | # -*- coding: utf-8 -*-
input_line_1 = raw_input()
fields = input_line_1.split()
N = fields[0]
A = fields[1]
B = fields[2]
T = A + B
all = raw_input()
for every in all:
if every == 'c':
print 'No'
elif every == 'a':
if T > 0:
T = T - 1
print 'Yes'
else:
print 'No'
else:
if T > 0 and B > 0:
T = T - 1
B = B - 1
print 'Yes'
else:
print 'No' | File "/tmp/tmpxaw01kee/tmpo5lm6er3.py", line 11
print 'No'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s321420707 | p03971 | u835464975 | 1476119849 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 376 | # -*- coding: utf-8 -*-
input_line_1 = raw_input()
fields = input_line_1.split()
N = fields[0]
A = fields[1]
B = fields[2]
T = A + B
all = raw_input()
for every in all:
if every == 'c':
print 'No'
else if every == 'a':
if T > 0:
T = T - 1
print 'Yes'
else:
print 'No'
else:
if T > 0 and B > 0:
T = T - 1
B = B - 1
print 'Yes'
else:
print 'No' | File "/tmp/tmp002ioaxe/tmpheqwex9t.py", line 11
print 'No'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s539784697 | p03971 | u664481257 | 1476119834 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3784 | 1301 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
#
# Author: Noname
# URL: https://github.com/pettan0818
# License: MIT License
# Created: 2016-10-10
#
# Usage
#
"""
def read_value():
first_line = input()
status = first_line.split(" ")
num_of_contestant = status[0]
basis = status[1]
oversea_limit = status[2]
second_line = input()
rank_str = second_line
return [num_of_contestant, basis, oversea_limit, rank_str]
def check_japan(rank, basis, oversea_limit):
if rank < basis + oversea_limit:
return "Yes"
else:
return "No"
def check_overseas(rank, oversea_rank, basis, oversea_limit):
if rank < basis + oversea_limit and oversea_rank < oversea_limit:
return "Yes"
else:
return "No"
if __name__ == "__main__":
input_items = read_value()
basis = input_items[1]
oversea_limit = input_items[2]
rank_str = input_items[3]
oversea_rank = 0
for rank, type in enumerate(rank_str):
if type == "a":
print(check_japan(rank, basis, oversea_limit))
if type == "b":
oversea_rankt += 1
print(check_overseas(rank, oversea_rank, basis, oversea_limit))
if type == "c":
print("No")
| Traceback (most recent call last):
File "/tmp/tmpruckfvqc/tmp2kivexms.py", line 45, in <module>
input_items = read_value()
^^^^^^^^^^^^
File "/tmp/tmpruckfvqc/tmp2kivexms.py", line 18, in read_value
first_line = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s377129417 | p03972 | u417212867 | 1600217931 | Python | PyPy3 (7.3.0) | py | Runtime Error | 302 | 87652 | 407 | w, h = list(map(int, input().split()))
xs = [int(input()) for _ in range(w)]
ys = [int(input()) for _ in range(h)]
x_cnt = w + 1
y_cnt = h + 1
i = 0
j = 0
xs.sort()
ys.sort()
ans = 0
while i < len(xs) or j < len(ys):
if i >= len(xs) or ys[j] < xs[i]:
ans += x_cnt * ys[j]
j += 1
y_cnt -= 1
else:
ans += y_cnt * xs[i]
i += 1
x_cnt -= 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp1tcdboq9/tmp2kr53fx_.py", line 1, in <module>
w, h = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s439050663 | p03972 | u707124227 | 1595691855 | Python | Python (3.8.2) | py | Runtime Error | 342 | 17344 | 274 | w,h=map(int,input().split())
p=[int(input()) for _ in range(w)]
q=[int(input()) for _ in range(h)]
p.sort(reverse=True)
q.sort(reverse=True)
ans=0
c,r=w+1,h+1
while p or q:
if not p or p[-1]>q[-1]:
ans+=q.pop()*c
r-=1
else:
ans+=p.pop()*r
c-=1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpb_8avqo8/tmpy6bm2ngw.py", line 1, in <module>
w,h=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s052801937 | p03972 | u366541443 | 1588622443 | Python | PyPy3 (2.4.0) | py | Runtime Error | 944 | 68056 | 623 |
w,h = list(map(int, input().split()))
ws = []
hs = []
for i in range(w): ws.append(int(input()))
for i in range(h): hs.append(int(input()))
ws.sort(reverse = True)
hs.sort(reverse = True)
remainW = w
remainH = h
aliveW = [1 for i in range(w)]
aliveH = [1 for i in range(h)]
ans = 0
while(remainW>0 or remainH>0):
#print(ans, remainW, remainH)
costW = ws[remainW-1] * (remainH + 1)
costH = hs[remainH-1] * (remainW + 1)
if(ws[remainW-1] > hs[remainH-1] or remainW==0):
ans += costH
remainH-=1
else:
ans += costW
remainW -= 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpgo0b7gq3/tmpqkh3jknm.py", line 2, in <module>
w,h = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s963890725 | p03972 | u366541443 | 1588622266 | Python | PyPy3 (2.4.0) | py | Runtime Error | 863 | 67928 | 575 |
w,h = list(map(int, input().split()))
ws = []
hs = []
for i in range(w): ws.append(int(input()))
for i in range(h): hs.append(int(input()))
ws.sort(reverse = True)
hs.sort(reverse = True)
remainW = w
remainH = h
aliveW = [1 for i in range(w)]
aliveH = [1 for i in range(h)]
ans = 0
while(remainW>0 or remainH>0):
#print(ans, remainW, remainH)
costW = ws[remainW-1] * (remainH + 1)
costH = hs[remainH-1] * (remainW + 1)
if(costW > costH or remainW==0):
ans += costH
remainH-=1
else:
ans += costW
remainW -= 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpagcxepfa/tmp5q3dxdot.py", line 2, in <module>
w,h = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s341176113 | p03972 | u789436713 | 1586854813 | Python | Python (3.4.3) | py | Runtime Error | 2208 | 1615272 | 1001 | W,H=[int(item) for item in input().split()]
p=[]
for _ in range(W):
p.append(int(input()))
q=[]
for _ in range(H):
q.append(int(input()))
cost = [[114514] * (W+1) for i in range(H+1)]
cost[0][0]=0
cnt = 1
totalcost=0
while True:
if cnt <= H :
x,y=0,cnt
else:
x,y=cnt-H,H
if cnt-H==W+1:break
while y>=0 and x<=W:
if x == 0:
cost[x][y]=cost[x][y-1]+q[y-1]
totalcost+=q[y-1]
elif y == 0:
cost[x][y]=cost[x-1][y]+p[x-1]
totalcost+=p[x-1]
else:
totalcost += p[x - 1] if p[x - 1] < q[y - 1] else q[y-1]
# if cost[x][y - 1] + q[y - 1] < cost[x - 1][y] + p[x - 1]:
# cost[x][y]=cost[x][y-1]+q[y-1]
# totalcost+=q[y-1]
# else:
# cost[x][y]=cost[x-1][y]+p[x-1]
# totalcost += p[x - 1]
#print(x,y)
x += 1
y -= 1
#print(cnt)
#print(cost)
cnt += 1
print(totalcost) | Traceback (most recent call last):
File "/tmp/tmpdxhyzjhp/tmpb79c_cur.py", line 1, in <module>
W,H=[int(item) for item in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s507638529 | p03972 | u638795007 | 1579061987 | Python | Python (3.4.3) | py | Runtime Error | 278 | 12168 | 1647 | def examA():
S = SI(); N = len(S)
T = "CODEFESTIVAL2016"
ans = 0
for i in range(N):
if S[i]!=T[i]:
ans +=1
print(ans)
return
def examB():
N, A, B = LI()
S = SI()
d = defaultdict(int)
for s in S:
if s=="a":
if d["a"]+d["b"]<A+B:
print("Yes")
d[s] += 1
else:
print("No")
elif s=="b":
if d["a"]+d["b"]<A+B and d["b"]<B:
print("Yes")
d[s] += 1
else:
print("No")
else:
print("No")
return
def examC():
W, H = LI()
P = [I() for _ in range(W)]; P.sort()
Q = [I() for _ in range(H)]; Q.sort()
dh = 0; dw = 0
p = 0; q = 0
ans = 0
for i in range(H+W):
if (p<W and P[p]<Q[q]) or q>=H:
ans += P[p]*(H+1-dh)
p +=1; dw +=1
else:
ans += Q[q]*(W+1-dw)
q +=1; dh+=1
print(ans)
return
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]
if __name__ == '__main__':
examC()
| Traceback (most recent call last):
File "/tmp/tmparg09flb/tmpehtx3k8l.py", line 66, in <module>
examC()
File "/tmp/tmparg09flb/tmpehtx3k8l.py", line 33, in examC
W, H = LI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s237911577 | p03972 | u638795007 | 1579061930 | Python | Python (3.4.3) | py | Runtime Error | 286 | 12168 | 1645 | def examA():
S = SI(); N = len(S)
T = "CODEFESTIVAL2016"
ans = 0
for i in range(N):
if S[i]!=T[i]:
ans +=1
print(ans)
return
def examB():
N, A, B = LI()
S = SI()
d = defaultdict(int)
for s in S:
if s=="a":
if d["a"]+d["b"]<A+B:
print("Yes")
d[s] += 1
else:
print("No")
elif s=="b":
if d["a"]+d["b"]<A+B and d["b"]<B:
print("Yes")
d[s] += 1
else:
print("No")
else:
print("No")
return
def examC():
W, H = LI()
P = [I() for _ in range(W)]; P.sort()
Q = [I() for _ in range(H)]; Q.sort()
dh = 0; dw = 0
p = 0; q = 0
ans = 0
for i in range(H+W):
if p<W and P[p]<Q[q] or q>=H:
ans += P[p]*(H+1-dh)
p +=1; dw +=1
else:
ans += Q[q]*(W+1-dw)
q +=1; dh+=1
print(ans)
return
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]
if __name__ == '__main__':
examC()
| Traceback (most recent call last):
File "/tmp/tmp_4qf3hqb/tmprapt9bud.py", line 66, in <module>
examC()
File "/tmp/tmp_4qf3hqb/tmprapt9bud.py", line 33, in examC
W, H = LI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s102579064 | p03972 | u533885955 | 1568073861 | Python | Python (3.4.3) | py | Runtime Error | 617 | 42632 | 802 | #C問題
#UnionFind
def find(A,x):
p = A[x]
if p == x:
return x
a = find(A,p)
A[x] = a
return a
def union(A, x, y):
if find(A,x) > find(A,y):
bx, by = find(A,y), find(A,x)
else:
bx, by = find(A,x), find(A,y)
A[y] = bx
A[by] = bx
import heapq
H,W = map(int,input().split())
PQ = []
for i in range(W+H+1):
if i == W:
continue
pq = int(input())
heapq.heappush(PQ,[pq,i,i+1])
uf = UnionFind(H+W+2)
a = W+1
b = H+1
ans = 0
V = [i for i in range(H+W+2)]
while PQ:
edge = heapq.heappop(PQ)
w,s,t = edge[0],edge[1],edge[2]
if find(V,s) != find(V,t):
union(V,s,t)
if s < W+1: #P
ans+=w*b
a-=1
else:#Q
ans+=w*a
b-=1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpx_mk0yac/tmpz0yzztgm.py", line 21, in <module>
H,W = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s493251206 | p03972 | u727801592 | 1567570243 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 145184 | 524 | import sys #入力時間短縮
input = sys.stdin.readline
W,H=map(int,input().split())
p=sorted(int(input()) for i in range(W))
q=sorted(int(input()) for i in range(H))
ans=sum(p)*(H+1)+sum(q)*(W+1)
#1マスずつmax(pi,qj)→O(N^2)
#pi,qjが大きい順に列ごと消去→O(N)
for i in range(W+H-1):
if p[len(p)-1]>=q[len(q)-1]:
ans-=p[len(p)-1]*len(q)
p.pop()
if p==[]:
print(ans)
exit()
else:
ans-=q[len(q)-1]*len(p)
q.pop()
if q==[]:
print(ans)
exit()
print(p,q)
| Traceback (most recent call last):
File "/tmp/tmpqb_btauj/tmpv12g_1el.py", line 4, in <module>
W,H=map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s696527098 | p03972 | u727801592 | 1567569320 | Python | Python (3.4.3) | py | Runtime Error | 327 | 13360 | 332 | import sys
input = sys.stdin.readline
W,H=map(int,input().split())
p=sorted(int(input()) for i in range(W))
q=sorted(int(input()) for i in range(H))
ans=sum(p)*(H+1)+sum(q)*(W+1)
for i in range(W+H-1):
if p[len(p)-1]>=q[len(q)-1]:
ans-=p[len(p)-1]*len(q)
p.pop()
else:
ans-=q[len(q)-1]*len(p)
q.pop()
print(ans) | Traceback (most recent call last):
File "/tmp/tmp2rutxqjy/tmpvgjf6br0.py", line 4, in <module>
W,H=map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s607584636 | p03972 | u023540496 | 1555950587 | Python | PyPy3 (2.4.0) | py | Runtime Error | 884 | 61272 | 652 | W,H = (int(num) for num in input().split())
p = [int(input()) for _ in range(W)]
p.sort()
q = [int(input()) for _ in range(H)]
q.sort()
p_cnt = H+1 #何本取るか
q_cnt = W+1
gr_cnt = (W+1) * (H+1) - 1
p_idx = 0
q_idx = 0
ans = 0
while gr_cnt > 0:
if (p_idx < W and p[p_idx] <= q[q_idx]) or q_idx >= H:
nt = min(p_cnt,gr_cnt)
#print(gr_cnt,nt,p[p_idx])
ans += p[p_idx] * nt
gr_cnt -= nt
q_cnt -= 1
p_idx += 1
else:
nt = min(q_cnt,gr_cnt)
#print(gr_cnt,nt,q[q_idx])
ans += q[q_idx] * nt
gr_cnt -= nt
p_cnt -= 1
q_idx += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpg4f1ys2o/tmpzi7_p18s.py", line 1, in <module>
W,H = (int(num) for num in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s587965510 | p03972 | u563710899 | 1477949010 | Python | Python (2.7.6) | py | Runtime Error | 1583 | 12404 | 466 | W,H=map(int,raw_input().split())
p=[input() for i in range(W)]
q=[input() for i in range(H)]
p.sort(reverse=True)
q.sort(reverse=True)
cost=0
del_H=0
del_W=0
len_p=W
len_q=H
while len_p>0 and len_q>0:
if p[del_W]>q[del_H]:
del_W+=1
cost+=p[del_W]*(del_H+1)
len_p-=1
else:
del_H+=1
cost+=q[del_H]*(del_W+1)
len_q-=1
if len_p==0:
cost+=sum(q)*(W+1)
else:
cost+=sum(p)*(H+1)
print cost | File "/tmp/tmpp4kf0va3/tmprb5cjjgt.py", line 32
print cost
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s098248725 | p03972 | u501661505 | 1476142993 | Python | Python (2.7.6) | py | Runtime Error | 19 | 2816 | 867 | from heapq import heappop, heappush
from networkx import nx
import sys
def build_graph(W, H, p, q):
graph = nx.Graph()
for i in range(W):
for j in range(H):
x = j*W + i
if i+1 < W:
graph.add_edge(x, x+1, weight=p[i])
if j+1 < H:
graph.add_edge(x, x+W, weight=q[j])
return graph
def prim(G, s):
P, Q = {}, [(0, None, s)]
while Q:
_, p, u = heappop(Q)
if u in P: continue
P[u] = p
for v, w in G[u].items():
heappush(Q, (w, u, v))
return sum(G[key][P[key]]['weight'] for key in P if P[key] != None)
W, H = map(int, raw_input().split(' '))
p = [0] * W
q = [0] * H
for i in xrange(W):
p[i] = int(raw_input())
for j in xrange(H):
q[j] = int(raw_input())
W+=1
H+=1
g = build_graph(W, H, p, q)
p = prim(g, 0)
print p | File "/tmp/tmpiml3akyw/tmp_jeu_igi.py", line 38
print p
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s920260972 | p03972 | u104282757 | 1476135577 | Python | PyPy2 (5.6.0) | py | Runtime Error | 204 | 27036 | 664 | W, H = map(int, raw_input().split())
p_list = list()
q_list = list()
for i in range(W):
p_list.append(int(raw_input()))
for j in range(H):
q_list.append(int(raw_input()))
p_list.sort()
q_list.sort()
cp = H+1
cq = W+1
res = 0
pid = 0
qid = 0
while True:
if pid == H:
if qid == W:
break
else:
choice = 'q'
elif qid == W:
choice = 'p'
elif p_list[pid] < q_list[qid]:
choice = 'p'
else:
choice = 'q'
if choice == 'p':
cq -= 1
res += cp*p_list[pid]
pid += 1
else:
cp -= 1
res += cq*q_list[qid]
qid += 1
print res | File "/tmp/tmp4evitjrd/tmpmn0qtdul.py", line 43
print res
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s005539598 | p03972 | u079701009 | 1476126380 | Python | Python (2.7.6) | py | Runtime Error | 548 | 9660 | 432 | w, h = map(int, raw_input().split())
p = []
q = []
for i in xrange(w):
p.append(int(raw_input()))
for i in xrange(h):
q.append(int(raw_input()))
wl = w
hl = h
cost = 0
p.sort()
q.sort()
p.append(10 ** 8)
q.append(10 ** 8)
pc = 0
qc = 0
while(wl + hl - pc - qc> 0):
if p[pc] < q[qc]:
cost += (hl - qc + 1) * p[pc]
pc += 1
else:
cost += (wl - pc + 1) * q[qc]
qc += 1
print cost
| File "/tmp/tmpma4cfjhg/tmpnr1911mc.py", line 31
print cost
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s801256145 | p03972 | u079701009 | 1476126256 | Python | Python (2.7.6) | py | Runtime Error | 472 | 14544 | 454 | w, h = map(int, raw_input().split())
p = []
q = []
for i in xrange(w):
p.append(raw_input())
p = map(int, p)
for i in xrange(h):
q.append(raw_input())
q = map(int, q)
wl = w
hl = h
cost = 0
p.sort()
q.sort()
p.append(10 ** 8)
q.append(10 ** 8)
pc = 0
qc = 0
while(wl + hl - pc - qc> 0):
if p[pc] < q[qc]:
cost += (hl - qc + 1) * p[pc]
pc += 1
else:
cost += (wl - pc + 1) * q[qc]
qc += 1
print cost
| File "/tmp/tmp2sq1kw13/tmpmvjr7xi_.py", line 33
print cost
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s202828895 | p03972 | u079701009 | 1476126181 | Python | Python (2.7.6) | py | Runtime Error | 367 | 14424 | 526 | # import time
w, h = map(int, raw_input().split())
p = []
q = []
for i in xrange(w):
p.append(raw_input())
p = map(int, p)
for i in xrange(h):
q.append(raw_input())
q = map(int, q)
start = time.time()
wl = w
hl = h
cost = 0
p.sort()
q.sort()
p.append(10 ** 8)
q.append(10 ** 8)
pc = 0
qc = 0
while(wl + hl - pc - qc> 0):
if p[pc] < q[qc]:
cost += (hl - qc + 1) * p[pc]
pc += 1
else:
cost += (wl - pc + 1) * q[qc]
qc += 1
print cost
# print time.time() - start
| File "/tmp/tmpc6h_qcfn/tmpfvc60xwm.py", line 37
print cost
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s161558378 | p03972 | u501661505 | 1476125926 | Python | Python (2.7.6) | py | Runtime Error | 17 | 2696 | 1134 | import sys
_=sys.maxint
def build_graph(W, H, p, q):
vetex = W * H
graph = [[_] * vetex ] * vetex
for i in range(W):
for j in range(H):
x = i*W + j
if i+1 < W:
graph[x][x+W] = p[i]
if j+1 < H:
graph[x][x+1] = q[j]
return graph
W, H = map(int, raw_input().split(' '))
p = [0] * W
q = [0] * H
for i in xrange(W):
p[i] = int(raw_input())
for j in xrange(H):
q[j] = int(raw_input())
W+=1
H+=1
n = W*H
g = build_graph(W,H,p,q)
def prim(graph,n):
dis=[0]*n
pre=[0]*n
flag=[False]*n
flag[0]=True
k=0
for i in range(n):
dis[i]=graph[k][i]
for j in range(n-1):
mini=_
for i in range(n):
if mini>dis[i] and not flag[i]:
mini=dis[i]
k=i
if k==0:#不连通
return
flag[k]=True
for i in range(n):
if dis[i]>graph[k][i] and not flag[i]:
dis[i]=graph[k][i]
pre[i]=k
return dis,pre
dis, pre = prim(g, n)
print sum(dis[1:]) | File "/tmp/tmpeh5swdq_/tmp6uef7bde.py", line 52
print sum(dis[1:])
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s599839389 | p03972 | u501661505 | 1476125795 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2696 | 1125 | _=float('inf')
def build_graph(W, H, p, q):
vetex = W * H
graph = [[_] * vetex ] * vetex
for i in range(W):
for j in range(H):
x = i*W + j
if i+1 < W:
graph[x][x+W] = p[i]
if j+1 < H:
graph[x][x+1] = q[j]
return graph
W, H = map(int, raw_input().split(' '))
p = [0] * W
q = [0] * H
for i in xrange(W):
p[i] = int(raw_input())
for j in xrange(H):
q[j] = int(raw_input())
W+=1
H+=1
n = W*H
g = build_graph(W,H,p,q)
def prim(graph,n):
dis=[0]*n
pre=[0]*n
flag=[False]*n
flag[0]=True
k=0
for i in range(n):
dis[i]=graph[k][i]
for j in range(n-1):
mini=_
for i in range(n):
if mini>dis[i] and not flag[i]:
mini=dis[i]
k=i
if k==0:#不连通
return
flag[k]=True
for i in range(n):
if dis[i]>graph[k][i] and not flag[i]:
dis[i]=graph[k][i]
pre[i]=k
return dis,pre
dis, pre = prim(g, n)
print sum(dis[1:]) | File "/tmp/tmp1je5w2t3/tmp5g4ddqva.py", line 51
print sum(dis[1:])
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s851634423 | p03972 | u744592787 | 1476124927 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 515 | def cost(x, y, a):
if x[0] == y[0] and abs(x[1]-y[1])==1:
if x[1] > y[1]:
return a[1][y[i]]
else:
return a[1][x[i]]
elif x[1] == y[1] and abs(x[0]-y[0])==1:
if x[0] > y[0]:
return a[0][y[i]]
else:
return a[0][x[i]]
W = 2
H = 2
a = [[0 for i in range(W)] for j in range(H)]
for i in range(W):
for j in range(H):
a[i][j] = 1#input()
a = [[3,5], [2,7]]
z = list(itertools.product([0, 1, 2], repeat=2))
print(29) | Traceback (most recent call last):
File "/tmp/tmpdi2y3a09/tmplelgkupd.py", line 24, in <module>
z = list(itertools.product([0, 1, 2], repeat=2))
^^^^^^^^^
NameError: name 'itertools' is not defined
| |
s279348884 | p03972 | u725662235 | 1476124903 | Python | Python (2.7.6) | py | Runtime Error | 1668 | 15532 | 615 | w,h= map(int, raw_input().split())
p =[]
q = []
for i in xrange(w):
t = input()
p.append(t)
for i in xrange(h):
t = input()
q.append(t)
p =sorted(p,reverse=True)
q =sorted(q, reverse=True)
ac = p[:]
acq = q[:]
i = w-2
while i >=0:
ac[i] += ac[i+1]
i -=1
i = h - 2
while i >= 0:
acq[i] += acq[i + 1]
i -= 1
c = ac[0] + acq[0]
k = 0
# for i in xrange(h):
i = 0
while i < h:
# for j in xrange(k,w):
j = k
if q[i] > p[j]:
c += ac[j]
i += 1
# break
else:
c +=acq[i]
k +=1
# c += q[i]
print c | File "/tmp/tmp_puta2t_/tmp3v69vlcc.py", line 38
print c
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s416862672 | p03972 | u830390742 | 1476122517 | Python | PyPy2 (5.6.0) | py | Runtime Error | 420 | 46492 | 1241 | W, H = map(int, raw_input().split())
p = sorted([(i, int(raw_input())) for i in xrange(W)], key=lambda x:-x[1])
q = sorted([(i, int(raw_input())) for i in xrange(H)], key=lambda x:-x[1])
class UnionFind(object):
def __init__(self, n):
self.uf = [-1 for _ in xrange(n)]
def union(self, x, y):
x = self.find(x[0] + x[1]*(W+1))
y = self.find(y[0] + y[1]*(W+1))
if x == y:
return False
if self.uf[x] >= self.uf[y]:
self.uf[y] += self.uf[x]
self.uf[x] = y
else:
self.uf[x] += self.uf[y]
self.uf[y] = x
return True
def find(self, x):
leaves = []
while self.uf[x] >= 0:
leaves.append(x)
x = self.uf[x]
for lf in leaves:
self.uf[lf] = x
return x
uf = UnionFind((W+1)*(H+1))
ans = 0
while len(p) > 0 or len(q) > 0:
if len(q) == 0 or (len(p) > 0 and p[-1][1] <= q[-1][1]):
i, cost = p.pop()
for j in xrange(H+1):
if uf.union((i, j), (i+1, j)):
ans += cost
else:
j, cost = q.pop()
for i in xrange(W+1):
if uf.union((i, j), (i, j+1)):
ans += cost
print ans
| File "/tmp/tmpbkud36y_/tmp9u9dg6xq.py", line 44
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s970984938 | p03972 | u406648710 | 1476122024 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 1310 | neighbor = lambda c, w, h: filter(
lambda b: 0 <= b[0] <= w and 0 <= b[1] <= h,
[
(c[0]-1, c[1]),
(c[0]+1, c[1]),
(c[0], c[1]-1),
(c[0], c[1]+1)
]
)
def q_c():
t = raw_input()
W, H = map(int, t.split(' '))
p, q = [], []
for i in xrange(W):
p.append(int(raw_input()))
for j in xrange(H):
q.append(int(raw_input()))
has = [[False for i in xrange(H+1)] for j in xrange(W+1)]
has[0][0] = True
Next = [(1, 0), (0, 1)]
cost = 0
for i in xrange(W*H+W+H):
Min = 100000005
choose = None
Next.sort(key=lambda a: min(p[a[0]-1] if a[0] > 0 else 100000005, q[a[1]-1] if a[1] > 0 else 100000005))
choose = Next[-1]
Min = min(p[choose[0]-1] if choose[0] > 0 else 100000005, q[choose[1]-1] if choose[1] > 0 else 100000005)
# for each in Next:
# if each[0] > 0:
# if p[each[0]-1] < Min:
# choose = each
# Min = p[each[0]-1]
# if each[1] > 0:
# if q[each[1]-1] < Min:
# choose = each
# Min = q[each[1]-1]
has[choose[0]][choose[1]] = True
Next = Next[:-1]
cost += Min
for every in neighbor(choose, W, H):
# print every
if not has[every[0]][every[1]] and every not in Next:
Next.append(every)
print cost | File "/tmp/tmp998_k03p/tmpcadjti90.py", line 12
t = raw_input()
^
IndentationError: expected an indented block after function definition on line 11
| |
s559266282 | p03973 | u600402037 | 1582741180 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 332 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
if a == cur_limit:
cur_limit += 1
continue
answer += (a-cur_limit) // cur_limit)
print(answer)
# 44
| File "/tmp/tmpxd2aqj1n/tmpgz4lru8i.py", line 15
answer += (a-cur_limit) // cur_limit)
^
SyntaxError: unmatched ')'
| |
s593234629 | p03973 | u905582793 | 1581704882 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38512 | 234 | import sys
input = sys.stdin.readline
n = int(input())
a = [int(input()) for i in range(n)]
cnt = 1
ans = 0
for i in range(n):
if a[i] = cnt+1:
cnt += 1
else:
ans += (a[i]-1)//cnt
if cnt == 1:
cnt += 1
print(ans) | File "/tmp/tmp5mjlnsg9/tmpz_z33nd6.py", line 8
if a[i] = cnt+1:
^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s439594688 | p03973 | u731028462 | 1476155022 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 235 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
arr = [int(input()) for _ in range(N)]
count = arr[0]-1
m = 1
for a in arr[1:]:
if a == m:
m += 1
if a > m:
count += (a - 1) // (m+1)
print(count) | Traceback (most recent call last):
File "/tmp/tmppwwuzupx/tmpcqasszhw.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s033652688 | p03973 | u664481257 | 1476125517 | Python | Python (3.4.3) | py | Runtime Error | 629 | 8932 | 1069 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
#
# Author: Noname
# URL: https://github.com/pettan0818
# License: MIT License
# Created: 2016-10-10
#
# Usage
#
"""
def read_value():
num_customer = input()
return [int(input()) for _ in range(num_customer)]
def greed_canceler(customers):
"""
>>> greed_canceler([3,2,5])
3
>>> greed_canceler([3,1,4,1,5,9,2,6,5,3,5,8,9,7,9])
18
"""
selled = 0
must_above = 1
for i, n in enumerate(customers):
flag = False
while must_above < customers[i]:
flag = True
selled += 1
#print("Processing col: {0} of {1}".format(i, customers[i]))
customers[i] = customers[i] - must_above
#print("must_above: {0}".format(must_above))
#print(customers[i])
if not must_above < customers[i]:
must_above = customers[i] + 1
return selled
if __name__ == "__main__":
import doctest
doctest.testmod()
greed_canceler(read_value())
| Traceback (most recent call last):
File "/tmp/tmpa9pg3ud2/tmp5bfqqcm5.py", line 52, in <module>
greed_canceler(read_value())
^^^^^^^^^^^^
File "/tmp/tmpa9pg3ud2/tmp5bfqqcm5.py", line 18, in read_value
num_customer = input()
^^^^^^^
EOFError: EOF when reading a line
| **********************************************************************
File "/tmp/tmpa9pg3ud2/tmp5bfqqcm5.py", line 28, in __main__.greed_canceler
Failed example:
greed_canceler([3,1,4,1,5,9,2,6,5,3,5,8,9,7,9])
Expected:
18
Got:
22
**********************************************************************
1 items had failures:
1 of 2 in __main__.greed_canceler
***Test Failed*** 1 failures.
|
s377069418 | p03973 | u657357805 | 1476125014 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3192 | 267 | N=int(input())
a=[0]*N
for i in range(N):
a.[i]=int(input())
minimum=1
count=0
for i in a:
if(minimum<i):
if i%minimum:
count+= i//minimum
else :
count+= (i//minimum-1)
else:
minimum=max(minimum,i+1)
print(count)
| File "/tmp/tmprktei17r/tmpkhgysal5.py", line 4
a.[i]=int(input())
^
SyntaxError: invalid syntax
| |
s372043397 | p03973 | u098968285 | 1476124509 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3192 | 393 | # def makelist(n, m):
# return [[0 for i in range(m)] for j in range(n)]
n = int(input())
A = [0]*N
for i in range(N):
A[i] = int(input())
ans = A[0] - 1
A[0] = 1
cnt = 1
# yobi = 1
for i in range(1, N):
now = A[i]
if now > cnt:
if now == cnt + 1: ## 0 ni nattyau
cnt += 1
else: ## now >= cnt + 2
ans += now // (cnt + 1)
if now % (cnt + 1) == 0:
ans -= 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpx1et1clg/tmpnwlj9h31.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s448854847 | p03974 | u557523358 | 1476254415 | Python | PyPy3 (2.4.0) | py | Runtime Error | 476 | 302960 | 531 | import array;R=range;L=input;T=[0]*28;N=int(L());S=[];U=N*26**2*array.array('i',[0]);V=N*[0];Q=int(L())
for I in R(N):
S+=[[ord(C)-95 for C in L()]];P=0
for C in S[I]:
if T[P+C]==0:T[P+C]=len(T);T+=[0]*28
T[P]+=1;P=T[P+C]
T[P]+=1;T[P+1]=1
while N:
N-=1;P=0
for C in S[N]:
for A in R(26):
X=T[P+A+2]
if(A!=C-2)*X:U[676*N+26*A+C-2]+=T[X]
V[N]+=T[P+1]
P=T[P+C]
while Q:
K,P=L().split();K=int(K)-1;P=[ord(C)-97 for C in P];X=1+V[K]
for A in R(26):
for B in R(A+1,26):
X+=U[676*K+26*P[A]+P[B]]
print(X);Q-=1 | Traceback (most recent call last):
File "/tmp/tmp757qf3ej/tmp8pxpeo6x.py", line 1, in <module>
import array;R=range;L=input;T=[0]*28;N=int(L());S=[];U=N*26**2*array.array('i',[0]);V=N*[0];Q=int(L())
^^^
EOFError: EOF when reading a line
| |
s149630813 | p03975 | u223904637 | 1574617517 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38384 | 190 | import bisect
n,a,b=map(int,input().split())
t=set([])
for i in range(n):
t.add(int(input()))
t=list(t)
t.sort()
ai=bisect.bisect_left(t,a)
bi=bisect.bisect_left(t,b)
print(ans-(bi-ai))
| Traceback (most recent call last):
File "/tmp/tmpmrjhmv4l/tmpz6kffl61.py", line 2, in <module>
n,a,b=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s095788524 | p03975 | u596421790 | 1574185348 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 108 | n,a,b = map(int, input().split())
l = [int(input()) for _ in range(n)]
print(len(filter(lambda x:a<=x<b,l))) | Traceback (most recent call last):
File "/tmp/tmpe4268et9/tmpu_d8jjsw.py", line 1, in <module>
n,a,b = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s847754459 | p03975 | u516242950 | 1563932314 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 156 | n, a, b = map(int, input().split())
2.kazu = 0
3.for cl in range(n):
4. jugyo = int(input())
5. if a > jugyo or jugyo >= b:
6. kazu += 1
7.print(kazu)
| File "/tmp/tmp138towvx/tmpe2j_8oko.py", line 2
2.kazu = 0
^
SyntaxError: invalid decimal literal
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.