buggy
stringlengths
1
618k
fixed
stringlengths
16
618k
buggy_submission_id
stringlengths
10
10
fixed_submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
lang
stringclasses
1 value
buggy_verdict
stringclasses
2 values
money=input() sum=input() money500=500*money if money500>=sum: print('Yes') else: print('No') return 0
money,sum=map(int,input().split()) money500=500*money if money500>=sum: print('Yes') else: print('No')
s987875518
s586638682
p02811
python
Runtime Error
money=input() sum=input() money500=500*money if money500>=sum: print('Yes') else: print('No')
money,sum=map(int,input().split()) money500=500*money if money500>=sum: print('Yes') else: print('No')
s409013950
s586638682
p02811
python
Runtime Error
money=input() sum=input() money500=500*money if money500>=sum: print('Yes') else: print('No')
money,sum=map(int,input().split()) money500=500*money if money500>=sum: print('Yes') else: print('No')
s975283774
s586638682
p02811
python
Runtime Error
money=input() sum=input() money500=500*money if money500>=sum: print('Yes') else: print('No')
money,sum=map(int,input().split()) money500=500*money if money500>=sum: print('Yes') else: print('No')
s718052871
s586638682
p02811
python
Runtime Error
ta,ao,N= map(int,input().split()) #li = [int(x) for x in input().split()] for i in range(N): if ta>0: ta-=1 elif ao>0: ao-=1 elif (ta==0 & ao==0): break print(str(ta)+" "+str(ao))
import sys import math ta,ao,N= map(int,input().split()) #li = [int(x) for x in input().split()] N=N-ta if N>0: ta=0 N=N-ao if N>0: print("0 0") sys.exit() else: ao=abs(N) else: ta=abs(N) print(str(ta)+" "+str(ao))
s611104596
s471351108
p02818
python
Time Limit Exceeded
N,A,B=map(int,input().split()) total=(10 ** 100) + 1 for i in range(total): if N <= i*A + i*B : if N >= i*A + (i-1)*B : ans=i*A break else : ans=i*A - (i*A+(i-1)*B - N) break print(ans)
import math N,A,B=map(int,input().split()) total=(10 ** 100) + 1 firstCnt=math.floor(N/(A+B)) for i in range(firstCnt,total): if N <= i*A + i*B : if N >= i*A + (i-1)*B : ans=i*A break else : ans=i*A - (i*A+(i-1)*B - N) break print(ans)
s937559119
s502703157
p02754
python
Time Limit Exceeded
N,A,B=map(int,input().split()) total=(10 ** 100) + 1 lengthCnt=0 lengthA=0 lengthB=0 for i in range(total): if i % 2 == 0: lengthCnt += A lengthA += A if lengthCnt >= N : ans = lengthA - (lengthCnt - N) break else : lengthCnt += B lengthB += B if lengthCnt >= N : ans = leng...
import math N,A,B=map(int,input().split()) total=(10 ** 100) + 1 firstCnt=math.floor(N/(A+B)) for i in range(firstCnt,total): if N <= i*A + i*B : if N >= i*A + (i-1)*B : ans=i*A break else : ans=i*A - (i*A+(i-1)*B - N) break print(ans)
s682439905
s502703157
p02754
python
Time Limit Exceeded
N = input() a = input() mylist = list(map(int, a.split(" "))) for i in range(N+1): if mylist[i] % 2 == 0: if mylist[i] % 3 != 0 and mylist[i] % 5 != 0: print("DENIED") else: return print("APPROVED")
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s092659399
s040158370
p02771
python
Runtime Error
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print(Yes) elif (A == C and B != C): print(Yes) elif (B == C and A != B): print(Yes) else: print(No)
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s356385755
s040158370
p02771
python
Runtime Error
myinput_H = input() mylist = list(map(int, myinput_H.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B & B != C): print(Yes) elif (A == C & B != C): print(Yes) elif (B == C & A != B): print(Yes) else: print(No)
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s711567607
s040158370
p02771
python
Runtime Error
myinput_H = input() mylist = list(map(int, myinput_H.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B & B != C) or (A == C & B != C) or (B == C & B != A): print(Yes) else: print(No)
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s715615446
s040158370
p02771
python
Runtime Error
myinput_H = input() mylist = list(map(int, myinput_H.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] def check(a,b,c): if (a == b & b != c) or (a == c & b != c) or (b == c & b != a): print(Yes) else: print(No) check(A,B,C)
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s306666137
s040158370
p02771
python
Runtime Error
mylist = list(map(int, myinput_H.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] def check(a,b,c): if (a == b & b != c) or (a == c & b != c) or (b == c & b != a): print(Yes) else: print(No)
a = input() mylist = list(map(int, a.split(" "))) A = mylist[0] B = mylist[1] C = mylist[2] if (A == B and B != C): print("Yes") elif (A == C and B != C): print("Yes") elif (B == C and A != B): print("Yes") else: print("No")
s538637382
s040158370
p02771
python
Runtime Error
mylist = list(map(int, myinput.split(" "))) H = mylist[0] A = mylist[1] x = 0 while H >0: H -= A x += 1 print(x)
input_1 = input() mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A != 0: answer = H//A + 1 else: answer = H//A print(answer)
s755196353
s208493274
p02783
python
Runtime Error
mylist = list(map(int, myinput.split(" "))) H = mylist[0] A = mylist[1] H // A = C print(C)
input_1 = input() mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A != 0: answer = H//A + 1 else: answer = H//A print(answer)
s727587697
s208493274
p02783
python
Runtime Error
input_1 = input() mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A =! 0: answer = H//A + 1 else: anser = H//A print(answer)
input_1 = input() mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A != 0: answer = H//A + 1 else: answer = H//A print(answer)
s226392842
s208493274
p02783
python
Runtime Error
input_1 = input("") mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A =! 0: answer = H//A + 1 else: anser = H//A print(answer)
input_1 = input() mylist = list(map(int, input_1.split(" "))) H = mylist[0] A = mylist[1] if H % A != 0: answer = H//A + 1 else: answer = H//A print(answer)
s070375516
s208493274
p02783
python
Runtime Error
myinput = input() myinput_H = input() mylist = list(map(int, myinput.split(" "))) N = int(mylist[0]) K = int(mylist[1]) list_H = list(map(int, myinput_H.split(" "))) for i in range(K): list_H.remove(max(list_H)) sum = sum(list_H) print(sum)
myinput = input() myinput_H = input() mylist = list(map(int, myinput.split(" "))) N = mylist[0] K = mylist[1] list_H = list(map(int, myinput_H.split(" "))) if N - K <= 0: print(0) else: x = N - K list_H.sort() l = list_H[0:x] sum = sum(l) print(sum)
s209094594
s172864166
p02785
python
Runtime Error
A, B, T = [input(), input(), input()] print( B * int((T + 0.5)/A) )
A, B, T = map(int, input().split()) print( B * int((T + 0.5)/A) )
s436762421
s512950081
p03059
python
Runtime Error
print( B * int((T + 0.5)/A) )
A, B, T = map(int, input().split()) print( B * int((T + 0.5)/A) )
s598465646
s512950081
p03059
python
Runtime Error
N = int(input()) V = [int(x.strip()) for x in input().split()] C = [int(x.strip()) for x in input().split()] Z = [0 for i in range(2**N)] for i in range(1, 2**N): select = [] temp = i for n in reversed(range(1, N+1)): if temp - 2**(n-1) >= 0: temp = temp - 2**(n-1) select.a...
N = int(input()) V = [int(x.strip()) for x in input().split()] C = [int(x.strip()) for x in input().split()] Z = [V[i] - C[i] for i in range(N)] print(sum([z for z in Z if z > 0]))
s369649561
s619099145
p03060
python
Time Limit Exceeded
N = int(input()) V = [int(x.strip()) for x in input().split()] C = [int(x.strip()) for x in input().split()] X = [0 for i in range(2**N)] Y = [0 for i in range(2**N)] Z = [0 for i in range(2**N)] for i in range(1, 2**N): select = [] temp = i for n in reversed(range(1, N+1)): if temp - 2**(n-1) >= ...
N = int(input()) V = [int(x.strip()) for x in input().split()] C = [int(x.strip()) for x in input().split()] Z = [V[i] - C[i] for i in range(N)] print(sum([z for z in Z if z > 0]))
s985527541
s619099145
p03060
python
Time Limit Exceeded
X = [0 for i in range(2**N)] Y = [0 for i in range(2**N)] Z = [0 for i in range(2**N)] for i in range(2**N): select = [] if i > 0: temp = i for n in reversed(range(1, N+1)): if temp - 2**(n-1) >= 0: temp = temp - 2**(n-1) select.append(n-1) ...
N = int(input()) V = [int(x.strip()) for x in input().split()] C = [int(x.strip()) for x in input().split()] Z = [V[i] - C[i] for i in range(N)] print(sum([z for z in Z if z > 0]))
s520790157
s619099145
p03060
python
Runtime Error
N,R=int(input( ).split( )) ans=0 if N>=10: ans=R else: ans=R+100*(10-N) print(ans)
N,R=map(int,input().split()) ans=0 if N>=10: ans=R else: ans=R+100*(10-N) print(ans)
s725245512
s525159514
p02765
python
Runtime Error
N,R=int(input().split()) ans=0 if N>=10: ans=R else: ans=R+100*(10-N) print(ans)
N,R=map(int,input().split()) ans=0 if N>=10: ans=R else: ans=R+100*(10-N) print(ans)
s823645761
s525159514
p02765
python
Runtime Error
N,R=int(input().split()) ans=0 if N>=10: ans=R else: ans=R-100*(10-N) print(ans)
N,R=map(int,input().split()) ans=0 if N>=10: ans=R else: ans=R+100*(10-N) print(ans)
s928686674
s525159514
p02765
python
Runtime Error
N=int(input()) data=list(map(int,input().split())) for i in range(N): mo2=data[i]%2 mo6=data[i]%6 mo10=data[i]%10 if mo2==0: if mo6==0 or mo10==0: ans="APPROVED" else: ans="DENIED" break print(ans)
N=int(input()) data=list(map(int,input().split())) ans="APPROVED" for i in range(N): mo2=data[i]%2 mo6=data[i]%6 mo10=data[i]%10 if mo2==0: if mo6==0 or mo10==0: ans="APPROVED" else: ans="DENIED" break else: continue print(ans)
s520363184
s476644282
p02772
python
Runtime Error
N=int(input()) data=list(map(int,input().split())) for i in range(N): mo2=data[i]%2 mo6=data[i]%6 mo10=data[i]%10 if mo2==0: if mo6==0 or mo10==0: ans="APPROVED" continue else: ans="DENIED" break else: continue print(ans)
N=int(input()) data=list(map(int,input().split())) ans="APPROVED" for i in range(N): mo2=data[i]%2 mo6=data[i]%6 mo10=data[i]%10 if mo2==0: if mo6==0 or mo10==0: ans="APPROVED" else: ans="DENIED" break else: continue print(ans)
s267229009
s476644282
p02772
python
Runtime Error
N=int(input()) data=list(map(int,input().split())) for i in range(N): mod2=data[i]%2 mod6=data[i]%6 mod10=data[i]%10 if mod2==0: if mod6==0 or mod10==0: ans="APPROVED" continue else: ans="DENIED" break else: continue print(ans)
N=int(input()) data=list(map(int,input().split())) ans="APPROVED" for i in range(N): mo2=data[i]%2 mo6=data[i]%6 mo10=data[i]%10 if mo2==0: if mo6==0 or mo10==0: ans="APPROVED" else: ans="DENIED" break else: continue print(ans)
s854706874
s476644282
p02772
python
Runtime Error
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) val=score_sorted L=len(val) count="Yes" ii=0 ansa=1 while count=="Yes": if val[ii][1]==val[ii+1][1]: ii+=1 ...
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) val=score_sorted L=len(val) count="Yes" ii=0 ansa=1 if L==1: print(val[0][0]) else: while count=="Yes": if...
s308468979
s918495693
p02773
python
Runtime Error
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) val=score_sorted count="Yes" ii=0 ansa=1 while count=="Yes": if val[ii][1]==val[ii+1][1]: ii+=1 ansa+...
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) val=score_sorted L=len(val) count="Yes" ii=0 ansa=1 if L==1: print(val[0][0]) else: while count=="Yes": if...
s335960076
s918495693
p02773
python
Runtime Error
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() #val=c.values() #dada=list(val) #dada.sort() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) #print(val) #val.sort() #print(dada) #print(score_sorted) val=score_sorted #pri...
import collections N=int(input()) data=[input() for i in range(N)] c = collections.Counter(data) score=c com=c.most_common() score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True) val=score_sorted L=len(val) count="Yes" ii=0 ansa=1 if L==1: print(val[0][0]) else: while count=="Yes": if...
s309256603
s918495693
p02773
python
Runtime Error
N=int(input()) data = list(map(int, input().split())) ans=1 if N>1: for i in range(1,N): if data[i]<=data[i-1]: ans+=1 print(ans)
N,M=map(int,input().split()) if N==M: print("Yes") if N!=M: print("No")
s393172083
s183780641
p02789
python
Runtime Error
N=int(input()) data = list(map(int, input().split())) ans=0 for i in range(0,N): a=[] a=data[0:i+1] if a[i]==min(a): ans+=1 print(ans)
N=int(input()) data = list(map(int, input().split())) ans=1 minmin=data[0] if N==1: ans=1 elif N>1: minmin=data[0] for i in range(1,N): if data[i]<=minmin: minmin=data[i] #if minmin<=data[i]: ans+=1 #continue #if minmin<=data[i]: ...
s850917539
s107649308
p02791
python
Time Limit Exceeded
N=int(input()) data = list(map(int, input().split())) ans=1 if N==1: ans=1 elif N>1: for i in range(1,N): count=0 for k in range(0,i+1): if data[i]<=data[i-k]: count+=1 if count==i+1: ans+=1 #print("I=",i) ...
N=int(input()) data = list(map(int, input().split())) ans=1 minmin=data[0] if N==1: ans=1 elif N>1: minmin=data[0] for i in range(1,N): if data[i]<=minmin: minmin=data[i] #if minmin<=data[i]: ans+=1 #continue #if minmin<=data[i]: ...
s084763914
s107649308
p02791
python
Time Limit Exceeded
N=int(input()) data = list(map(int, input().split())) ans=1 if N>1: for i in range(1,N+1): if data[i]<=data[i-1]: ans+=1 print(ans)
N=int(input()) data = list(map(int, input().split())) ans=1 minmin=data[0] if N==1: ans=1 elif N>1: minmin=data[0] for i in range(1,N): if data[i]<=minmin: minmin=data[i] #if minmin<=data[i]: ans+=1 #continue #if minmin<=data[i]: ...
s586230329
s107649308
p02791
python
Runtime Error
H=int(input()) W=int(input()) N=int(input()) if W>H : if N%W==0: k=N/W else: k=math.ceil(N/W) if H>=W: if N%H==0: k=N/H else: k=math.ceil(N/H) print(int(k))
import math H=int(input()) W=int(input()) N=int(input()) if W>H : if N%W==0: k=N/W else: k=math.ceil(N/W) else: if N%H==0: k=N/H else: k=math.ceil(N/H) k=int(k) print(k)
s335538135
s219981672
p02795
python
Runtime Error
H=int(input()) W=int(input()) N=int(input()) if W>H : k=int(N/W)+1 else k=int(H/W)+1 print(k)
import math H=int(input()) W=int(input()) N=int(input()) if W>H : if N%W==0: k=N/W else: k=math.ceil(N/W) else: if N%H==0: k=N/H else: k=math.ceil(N/H) k=int(k) print(k)
s297025269
s219981672
p02795
python
Runtime Error
import math H=input() W=input() N=input() k=W-3*H-math.sqrt((w-3h)**2-(w-h)**2+4N) k=int(k)+1 print(k)
import math H=int(input()) W=int(input()) N=int(input()) if W>H : if N%W==0: k=N/W else: k=math.ceil(N/W) else: if N%H==0: k=N/H else: k=math.ceil(N/H) k=int(k) print(k)
s505538365
s219981672
p02795
python
Runtime Error
N,X = map(int,input().split()) bound_limit= N+1 L = list(map(int,input().split())) sum=0 count=1 for i in range(0,len(L)): sum+=L[i] if sum<=x: count+=1 else: break print(count)
N,X = map(int,input().split()) bound_limit= N+1 L = list(map(int,input().split())) sum=0 count=1 for i in range(0,len(L)): sum+=L[i] if sum<=X: count+=1 else: break print(count)
s123105207
s824106324
p03000
python
Runtime Error
N,X = map(int,input().split()) bound_limit= N+1 L = list(map(int,input().split())) sum=0 count=1 for i in range(len(L)): sum+=L[i] if sum<=x: count+=1 else: break print(count)
N,X = map(int,input().split()) bound_limit= N+1 L = list(map(int,input().split())) sum=0 count=1 for i in range(0,len(L)): sum+=L[i] if sum<=X: count+=1 else: break print(count)
s844855359
s824106324
p03000
python
Runtime Error
W,H,x,y= map(int,input().split()) max=W*H/2 if x=W or y=H: check=0 else: check=1 print(max,check)
W,H,x,y = map(int,input().split()) max=W*H/2 xx=W/2 yy=H/2 if xx==x and yy==y: check=1 else: check=0 print(max,check)
s531909916
s783001393
p03001
python
Runtime Error
N=int(input()) s=[x for x in input()] #print(s) answers=[] for i in range(1,N+1): sl=s[:i] #print(sl) sr=s[i:N] l=sl.count("W") r=sr.count("E") ans=l+r #print(ans) answers.append(ans) fa=min(a for a in answers) print(fa)
a=list(map(int,input( ).split( ))) b=a[0]+a[1] c=a[0]-a[1] d=a[0]*a[1] e=max(b,c,d) print (e)
s631676434
s902310177
p03337
python
Runtime Error
a,b=map(int, raw_input.split( )) c=max(a+b,a-b,a*b) print c
a=list(map(int,input( ).split( ))) b=a[0]+a[1] c=a[0]-a[1] d=a[0]*a[1] e=max(b,c,d) print (e)
s973414258
s902310177
p03337
python
Runtime Error
N, a, b = map(int, input().split()) all = a + b # a = 0 if a == 0: print(0) exit(0) if N <= a: print(N) exit(0) # a > 0 c = round(N / all) d = N % all roundCnt = a * c if d != 0: if d <= a : amariCnt = d else: amariCnt = a print(roundCnt + amariCnt) #a = 0 print 0 #a > 0...
import math N, a, b = map(int, input().split()) all = a + b # a = 0 if a == 0: print(0) exit(0) if N <= a: print(N) exit(0) # a > 0 c = math.floor(N / all) d = N % all roundCnt = a * c amariCnt = 0 if d != 0: if d <= a : amariCnt = d else: amariCnt = a print(roundCnt + ama...
s958699265
s080525148
p02754
python
Runtime Error
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [0.0] * (A * B) for i in range(M): x, y, c = map(int, input().split()) sum[(y-1)*A + (x-1)] -= c for ia in range(A): for ib in range(B): sum...
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [] for i in range(M): x, y, c = map(int, input().split()) sum.append(a[x-1] + b[y-1] - c) a.sort() b.sort() sum.append(a[0] + b [0]) sum.sort() i=0 while sum[i]...
s299810286
s423740887
p02748
python
Runtime Error
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [0.0] * (A * B) for i in range(M): x, y, c = map(int, input().split()) sum[(y-1)*A + (x-1)] -= c for ia in range(A): for ib in range(B): sum...
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [] for i in range(M): x, y, c = map(int, input().split()) sum.append(a[x-1] + b[y-1] - c) a.sort() b.sort() sum.append(a[0] + b [0]) sum.sort() i=0 while sum[i]...
s077692919
s423740887
p02748
python
Runtime Error
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [0] * (A * B) for i in range(M): x, y, c = map(int, input().split()) sum[(y-1)*A + (x-1)] = -c for ia in range(A): for ib in range(B): sum[i...
# -*- coding: utf-8 -*- A, B, M = map(int, input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) sum = [] for i in range(M): x, y, c = map(int, input().split()) sum.append(a[x-1] + b[y-1] - c) a.sort() b.sort() sum.append(a[0] + b [0]) sum.sort() i=0 while sum[i]...
s833526099
s423740887
p02748
python
Runtime Error
# -*- coding: utf-8 -*- s = input().split() n = input().split() s2 = input() if s[0] == s2: n[0] = n[0] - 1 else: n[1] = n[1] - 1 print(str(n[0]) +' '+str(n[1]))
# -*- coding: utf-8 -*- s = input().split() n = list(map(int,input().split())) s2 = input() if s[0] == s2: n[0] = n[0] - 1 else: n[1] = n[1] - 1 print(str(n[0]) +' '+str(n[1]))
s750292130
s767726641
p02777
python
Runtime Error
s = input().split() n = input().split() s2 = input() if s[0] == s2: n[0] = n[0] - 1 else: n[1] = n[1] - 1 print(str(n[0]) +' '+str(n[1]))
# -*- coding: utf-8 -*- s = input().split() n = list(map(int,input().split())) s2 = input() if s[0] == s2: n[0] = n[0] - 1 else: n[1] = n[1] - 1 print(str(n[0]) +' '+str(n[1]))
s569113875
s767726641
p02777
python
Runtime Error
# -*- coding: utf-8 -*- print(re.sub('[a-z]', 'x', input()))
# -*- coding: utf-8 -*- import re s = input() print(re.sub('[a-z]', 'x', s))
s866318502
s595675377
p02778
python
Runtime Error
-*- coding: utf-8 -*- print(re.sub('[a-z]', 'x', input()))
# -*- coding: utf-8 -*- import re s = input() print(re.sub('[a-z]', 'x', s))
s597905482
s595675377
p02778
python
Runtime Error
# -*- coding: utf-8 -*- a = list(map(int,input().split())) n = a[0] k = a[1] p = list(map(int,input().split())) e = [(pi+1)/2 for pi in p] ret = [] for i in range(n-(k-1)): b = 0.0 for j in range(k): b += e[i+j] ret.append(b) ret.sort() print(ret[n-k])
# -*- coding: utf-8 -*- a = list(map(int,input().split())) n = a[0] k = a[1] p = list(map(int,input().split())) e = [(pi+1)/2 for pi in p] ret2 = [] b = 0.0 for j in range(k): b += e[j] ret2.append(b) for i in range(n-k): ret2.append(ret2[i] - e[i] + e[i+k]) ret=ret2 ret.sort() print(ret[n-k])
s881715925
s664373998
p02780
python
Time Limit Exceeded
a, b = map(int, input().split()) if a == 1: if b ==2: print(3) else: print(2) elif a == 2: if b == 1: print(3) else: print(1) else: if b == 1: print(2) else: print(1)
a = int(input()) b = int(input()) if a == 1: if b ==2: print(3) else: print(2) elif a == 2: if b == 1: print(3) else: print(1) else: if b == 1: print(2) else: print(1)
s890765277
s524580726
p02829
python
Runtime Error
n , k = map(int , input(),split()) ans = n - k + 1 print(ans)
n , k = map(int , input().split()) ans = n - k + 1 print(ans)
s513016140
s365393842
p03047
python
Runtime Error
bingo = [] tmp = input() bingo.append(tmp.split(' ')) tmp = input() bingo.append(tmp.split(' ')) tmp = input() bingo.append(tmp.split(' ')) for i in len(bingo): bingo[i] = [int(bingo[i][0]), int(bingo[i][1]), int(bingo[i][2])] n = input() data = [] arr = range(int(n)) arr = list(arr) for count in arr: tmp = in...
bingo = [] tmp = input() bingo.append(tmp.split(' ')) tmp = input() bingo.append(tmp.split(' ')) tmp = input() bingo.append(tmp.split(' ')) for i in range(len(bingo)): bingo[i] = [int(bingo[i][0]), int(bingo[i][1]), int(bingo[i][2])] n = input() data = [] arr = range(int(n)) arr = list(arr) for count in arr: t...
s242817987
s743909429
p02760
python
Runtime Error
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1], reverse=True) a = 0 list2=[] while a<len(list1) and list1[0][1] == list1[a][1]: list2.append(list1[a][0]) list2.sort() a += 1...
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1]) a = len(list1)-1 temp = len(list1)-1 list2 = [] while a >= 0 and list1[temp][1] == list1[a][1]: list2.append(list1[a][0]) a -= 1 ...
s434132554
s079941392
p02773
python
Time Limit Exceeded
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1]) list1.reverse() a = 0 list2=[] while a<len(list1) and list1[0][1] == list1[a][1]: list2.append(list1[a][0]) list2.sort() a +=...
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1]) a = len(list1)-1 temp = len(list1)-1 list2 = [] while a >= 0 and list1[temp][1] == list1[a][1]: list2.append(list1[a][0]) a -= 1 ...
s964207230
s079941392
p02773
python
Time Limit Exceeded
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1]) list1.reverse() a = 0 list2=[] while list1[0][1] == list1[a][1]: list2.append(list1[a][0]) list2.sort() a += 1 print(list2)
n = int(input()) b = {} for i in range(n): temp = input() if temp not in b: b[temp] = 1 else: b[temp] += 1 list1 = sorted(b.items(), key=lambda x: x[1]) a = len(list1)-1 temp = len(list1)-1 list2 = [] while a >= 0 and list1[temp][1] == list1[a][1]: list2.append(list1[a][0]) a -= 1 ...
s333045742
s079941392
p02773
python
Runtime Error
N=int(input()) robbot=[input().split() for i in range(N)] roba=[x[0] for x in robbot] robb=[x[1] for x in robbot] robc=list(map(int,roba)) robd=list(map(int,robb)) tas1=[x+y for (x,y) in zip (robc,robd)] tas2=[x-y for (x,y) in zip (robc,robd)] del tas2[0] del tas1[-1] tas3=[x-y for (x,y) in zip (tas2,tas1)] tas4=[i for...
import math H=int(input()) W=int(input()) N=int(input()) if H>=W: print(str(math.ceil(N/H))) else: print(str(math.ceil(N/W)))
s114778437
s917155670
p02795
python
Runtime Error
N=int(input()) robbot=[input().split() for i in range(N)] roba=[x[0] for x in robbot] robb=[x[1] for x in robbot] robc=list(map(int,roba)) robd=list(map(int,robb)) tas1=[x+y for (x,y) in zip (robc,robd)] tas2=[x-y for (x,y) in zip (robc,robd)] del tas2[0] del tas1[-1] tas3=[x-y for (x,y) in zip (tas2,tas1)] tas4=[i for...
import math H=int(input()) W=int(input()) N=int(input()) if H>=W: print(str(math.ceil(N/H))) else: print(str(math.ceil(N/W)))
s849937172
s917155670
p02795
python
Runtime Error
S=input() T=input() U=T+S Print(U)
S=list(input().split()) print(S[1]+S[0])
s176655554
s212489389
p02817
python
Runtime Error
def main(N): a = list(map(int, input().split())) if a.count(0) == N: print("Yes") return if N%3 != 0: print("No") return d={} for i in a: if i in d: d[i] = d[i] + 1 else: d[i] = 1 if 0 in d.keys(): if d[0] == N//3: for i in d.keys(): if i == 0: continue elif d[i] % 2 != 0: ...
def main(N): a = list(map(int, input().split())) if a.count(0) == N: print("Yes") return if N%3 != 0: print("No") return d={} for i in a: if i in d: d[i] = d[i] + 1 else: d[i] = 1 if 0 in d.keys(): if d[0] == N//3: for i in d.keys(): if i == 0: continue elif d[i] % 2 != 0: ...
s277022381
s710928164
p02975
python
Runtime Error
import sys sys.setrecursionlimit(10**6) def gcd(x,y): if x<y: x,y = y,x if y == 0: return x return gcd(y,x%y) def main(): n = int(input()) xy = [] for _ in range(n): xy +=[list(map(int,input().split()))] xy.sort(key=lambda x:(x[0],x[1])) dic = {} for i in range(n): for j in range(i+1,n): x,y = xy[...
import sys sys.setrecursionlimit(10**6) def main(): n = int(input()) xy = [] for _ in range(n): xy +=[list(map(int,input().split()))] xy.sort(key=lambda x:(x[0],x[1])) dic = {} for i in range(n): for j in range(i+1,n): x,y = xy[i][0] - xy[j][0], xy[i][1] - xy[j][1] if x*y == 0: temp = "{}.{}".forma...
s662206028
s442064163
p03006
python
Runtime Error
import math def main(): n = int(input()) xy = [] for _ in range(n): xy +=[list(map(int,input().split()))] xy.sort(key=lambda x:(x[0],x[1])) dic = {} for i in range(n): for j in range(i+1,n): x,y = xy[i][0] - xy[j][0], xy[i][1] - xy[j][1] if x*y == 0: temp = f"{x}.{y}" else: g = math.gcd(x,y)...
import sys sys.setrecursionlimit(10**6) def main(): n = int(input()) xy = [] for _ in range(n): xy +=[list(map(int,input().split()))] xy.sort(key=lambda x:(x[0],x[1])) dic = {} for i in range(n): for j in range(i+1,n): x,y = xy[i][0] - xy[j][0], xy[i][1] - xy[j][1] if x*y == 0: temp = "{}.{}".forma...
s715727097
s442064163
p03006
python
Runtime Error
def main(): n, m = map(int, input().split()) a = list(map(int, input().split())) for _ in range(m): b, c = map(int, input().split()) a += [c]*b a.sort() print(sum(a[::-1][:n])) return main()
def main(): n, m = map(int, input().split()) a = list(map(int, input().split())) dic = {} lst = [] for i in a: if i in dic: dic[i] = dic[i] + 1 else: lst += [i] dic[i] = 1 for _ in range(m): b, c = map(int, input().split()) if c in dic: dic[c] = dic[c] + b else: dic[c] = b lst += [c] ...
s588962633
s065178925
p03038
python
Time Limit Exceeded
import sys sys.setrecursionlimit(10**6) d={} def c(s): a = [0] * 10 for i in s: a[int(i)] += 1 if a[3] != 0 and a[5] != 0 and a[7] != 0: return True else: return False def r(m, s): global d if s == "": pass elif m < int(s) or (s in d): return 0 ret = 0 if c(s): ret += 1 d[s] = 1 ret += r(m,s+...
import sys sys.setrecursionlimit(10**6) d={} def c(s): a = [0] * 10 for i in s: a[int(i)] += 1 if a[3] != 0 and a[5] != 0 and a[7] != 0: return True else: return False def r(m, s): global d if s == "": pass elif m < int(s) or (s in d): return 0 ret = 0 if c(s): ret += 1 d[s] = 1 ret += r(m,s+"...
s718657420
s360926514
p03212
python
Time Limit Exceeded
a = [int(i) for i in input().split())] a.sort() print(a[2]*10+a[1]+a[0])
a = [int(i) for i in input().split()] a.sort() print(a[2]*10+a[1]+a[0])
s279638864
s426078165
p03250
python
Runtime Error
def main(): n = list(map(int, input().split())) ans = 0 for i in range(n[0], n[1]+1): temp = str(i) if temp == temp[::-1]: an += 1 print(ans) main()
def main(): n = list(map(int, input().split())) ans = 0 for i in range(n[0], n[1]+1): temp = str(i) if temp == temp[::-1]: ans += 1 print(ans) main()
s346055497
s851438766
p03416
python
Runtime Error
a, b = input().split() a = int(a) b = int(b) ans = -1 for i in range(1000000000000000000): if (a * i) % b != 0: ans = a * i break print(ans)
a, b = input().split() a = int(a) b = int(b) ans = -1 for i in range(1000000000000000000): if a % b == 0: break if a*i > 1000000000000000000: break if (a * i) % b != 0: ans = a * i break print(ans)
s324512128
s106483815
p03437
python
Time Limit Exceeded
l = [0]*11 r = list(map(int,input().split())) for i in r: l[r] += 1 print("YES" if (l[5]==2)and(l[7]==1) else "NO")
l = [0]*11 r = list(map(int,input().split())) for i in r: l[i] += 1 print("YES" if (l[5]==2)and(l[7]==1) else "NO")
s973194611
s517429176
p04043
python
Runtime Error
A = [list(map(int, input().split())) for i in range(3)] N = int(input()) B = [int(input()) for i in range(N)] cards = A[0] + A[1] + A[2] for b in B: cards = [c if c != b else 0 for c in cards] if (sum(A[0:3]) == 0): print('Yes') elif (sum(A[3:6]) == 0): print('Yes') elif (sum(A[7:9]) == 0): print('Ye...
A = [list(map(int, input().split())) for i in range(3)] N = int(input()) B = [int(input()) for i in range(N)] cards = A[0] + A[1] + A[2] for b in B: cards = [c if c != b else 0 for c in cards] if (sum(cards[0:3]) == 0): print('Yes') elif (sum(cards[3:6]) == 0): print('Yes') elif (sum(cards[6:9]) == 0): ...
s421828565
s702606613
p02760
python
Runtime Error
N = int(input()) alp = 'abcdefghijklmnopqrstuvwxyz' ans = alp[(alp.index(N) + 1)] print(ans)
S = input() alp = 'abcdefghijklmnopqrstuvwxyz' ans = alp[(alp.index(S) + 1)] print(ans)
s741108122
s045298114
p02801
python
Runtime Error
N = int(input()) alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ans = alp[(alp.index(N) + 1)] print(ans)
S = input() alp = 'abcdefghijklmnopqrstuvwxyz' ans = alp[(alp.index(S) + 1)] print(ans)
s639880824
s045298114
p02801
python
Runtime Error
N = int(input()) S = input() ans = 0 while 'ABC' in S: ans += 1 S.remove('ABC') print(ans)
N = int(input()) S = input() ans = S.count('ABC') print(ans)
s439519674
s193004382
p02812
python
Runtime Error
N = int(input()) D = list(map(int, input().split())) ans = 0 for i in range(0, N): for j in range(i, N+1): ans += (D[i] * D[j]) print(ans)
N = int(input()) D = list(map(int, input().split())) ans = 0 for i in range(0, N): for j in range(i+1, N): ans += (D[i] * D[j]) print(ans)
s235482626
s298729725
p02886
python
Runtime Error
import numpy as np N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(N): for j in range(i + 1, N): dis = np.linalg.norm(np.array(X[i]) - np.array(X[j])) if dis - int(dis) < 0.00000001: ans += 1 print(ans)
import numpy as np N, D = list(map(int, input().split())) X = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(N): for j in range(i + 1, N): dis = np.linalg.norm(np.array(X[i]) - np.array(X[j])) if dis - int(dis) < 0.00000001: ans += 1 print(ans)
s582665180
s685652044
p02982
python
Runtime Error
A = [int(input()) for i in range(3)] ans = sum(A) - max(A) print(ans)
A = list(map(int, input().split())) ans = sum(A) - max(A) print(ans)
s647136581
s202159449
p03011
python
Runtime Error
A = list(map(int, input().split())) BC = [] for i in range(M): b, c = list(map(int, input().split())) BC.append([b, c]) BC = sorted(BC, reverse=True, key=lambda x:x[1]) cnt = 0 com = [] for b, c in BC: cnt += b if cnt > N: add = N-cnt+b com.extend([c]*add) break else: ...
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s820747791
s428038451
p03038
python
Runtime Error
A = list(map(int, input().split())) BC = [] for i in range(M): b, c = list(map(int, input().split())) BC.append([b, c]) BC=sorted(BC, reverse=True, key=lambda x:x[1]) cnt = 0 com = [] for b, c in BC: cnt += b if cnt > N: add = N-cnt+b com.extend([c]*add) break else:...
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s153752885
s428038451
p03038
python
Runtime Error
N, M = list(map(int, input().split())) A = list(map(int, input().split())) for i in range(M): b, c = list(map(int, input().split())) A.extend([c]*b) A.sort(reverse=True) print(sum(A[:N]))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s985810431
s428038451
p03038
python
Time Limit Exceeded
N, M = list(map(int, input().split())) A = list(map(int, input().split())) for i in range(M): b, c = list(map(int, input().split())) A += [c]*b A.sort(reverse=True) print(sum(A[:N]))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s613564451
s428038451
p03038
python
Time Limit Exceeded
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] for card in cards: A += [card[1]]*card[0] A.sort(reverse=True) print(sum(A[:N]))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s450527727
s428038451
p03038
python
Time Limit Exceeded
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] for card in cards: A += [card[1]]*card[0] A.sort(reverse=True) print(sum(A[:N]))
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s328583241
s428038451
p03038
python
Time Limit Exceeded
N, M = list(map(int, input().split())) A = list(map(int, input().split())) A.sort() cards = [list(map(int, input().split())) for i in range(M)] D = [] for card in cards: D += [card[1]]*card[0] D.sort(reverse=True) i = 0 ans = sum(A) while (D[i] > A[i]): ans += (D[i] - A[i]) i += 1 if i == N - 1: ...
N, M = list(map(int, input().split())) A = list(map(int, input().split())) cards = [list(map(int, input().split())) for i in range(M)] cards = sorted(cards, key=lambda x: x[1], reverse=True) cnt = 0 for card in cards: A += [card[1]]*card[0] cnt += card[0] if cnt >= N: break A.sort(reverse=True) pri...
s409365362
s428038451
p03038
python
Runtime Error
def dfs(node, distance): for next_node, edge_size in G[node]: if ans[next_node] == -1: ans[next_node] = ((distance+edge_size) % 2) dfs(next_node, distance+edge_size) N = int(input()) G = [[] for i in range(N)] for i in range(N-1): u, v, w = map(int, input().split()) G[u-1]...
import math N, K = list(map(int, input().split())) ans = 0 for n in range(1, N+1): # 2^(num_success) * n >= K なる num_success # 2^(num_success) >= K/n # num_success >= log_2(K/n) num_success = max(0, math.ceil(math.log2(K/n))) ans += (1/2) ** num_success print(ans/N)
s222056087
s344306783
p03043
python
Runtime Error
import math N, K = list(map(int, input().split())) ans = 0 for n in range(1, N+1): # 2^(num_success) * n >= K なる num_success # 2^(num_success) >= K/n # num_success >= log_2(K/n) num_success = max(0, math.ceil(math.log2(K/n))) ans += (1/2) ** num_success print(ans/N)
import math N, K = list(map(int, input().split())) ans = 0 for n in range(1, N+1): # 2^(num_success) * n >= K なる num_success # 2^(num_success) >= K/n # num_success >= log_2(K/n) num_success = max(0, math.ceil(math.log2(K/n))) ans += (1/2) ** num_success print(ans/N)
s901165994
s344306783
p03043
python
Runtime Error
Copy Copy import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: ...
import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: an...
s110777256
s310055356
p03044
python
Runtime Error
def dfs(node, distance): for next_node, edge_size in G[node]: if ans[next_node] == -1: ans[next_node] = ((distance+edge_size) % 2) dfs(next_node, distance+edge_size) N = int(input()) G = [[] for i in range(N)] for i in range(N-1): u, v, w = map(int, input().split()) G[u-1]...
import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: an...
s741156890
s310055356
p03044
python
Runtime Error
def dfs(node, distance, ans, G): for next_node, edge_size in G[node]: if ans[next_node] == -1: ans[next_node] = ((distance+edge_size) % 2) dfs(next_node, distance+edge_size, ans, G) return ans N = int(input()) G = [[] for i in range(N)] for i in range(N-1): u, v, w = map(i...
import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: an...
s026300807
s310055356
p03044
python
Runtime Error
def dfs(node, distance, ans, G): for next_node, edge_size in G[node]: if ans[next_node] == -1: ans[next_node] = ((distance+edge_size) % 2) dfs(next_node, distance+edge_size, ans, G) return ans N = int(input()) G = [[] for i in range(N)] for i in range(N-1): u, v, w = map(i...
import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: an...
s396606417
s310055356
p03044
python
Runtime Error
def dfs(node, distance, ans, G): for next_node, edge_size in G[node]: if ans[next_node] == -1: ans[next_node] = ((distance+edge_size) % 2) dfs(next_node, distance+edge_size, ans, G) return ans N = int(input()) G = [[] for i in range(N)] for i in range(N-1): u, v, w = map(i...
import sys sys.setrecursionlimit(20000000) #input = sys.stdin.readline n = int(input()) g = [[] for i in range(n)] for i in range(n-1): u,v,w = map(int,input().split()) u-=1;v-=1 g[u].append([v,w]) g[v].append([u,w]) ans = [-1]*n def dfs(x,y): for i,j in g[x]: if ans[i] == -1: an...
s757190444
s310055356
p03044
python
Runtime Error
import fractions from functools import reduce import itertools N = int(input()) A = list(map(int, input().split())) ans = [] for a in list(itertools.combinations(A, N-1)): ans.append(reduce(fractions.gcd, a)) print(max(ans))
import fractions N = int(input()) A = list(map(int, input().split())) gcd_l = [0] gcd_r = [0] for i in range(N): gcd_l.append(fractions.gcd(gcd_l[i], A[i])) gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)])) gcd_r = gcd_r[::-1] ans = [] for i in range(N): ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1])) p...
s195365969
s141411387
p03061
python
Time Limit Exceeded
import fractions from functools import reduce N = int(input()) A = list(map(int, input().split())) ans = [] for i in range(N): if i != N: a = A[:i] + A[i+1:] else: a = A[:i] ans.append(reduce(fractions.gcd, a)) print(max(ans))
import fractions N = int(input()) A = list(map(int, input().split())) gcd_l = [0] gcd_r = [0] for i in range(N): gcd_l.append(fractions.gcd(gcd_l[i], A[i])) gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)])) gcd_r = gcd_r[::-1] ans = [] for i in range(N): ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1])) p...
s513963656
s141411387
p03061
python
Time Limit Exceeded
import fractions from functools import reduce N = int(input()) A = list(map(int, input().split())) ans = [] for i in range(N): if i != N: a = A[:i] + A[i+1:] else: a = A[:i] ans.append(reduce(fractions.gcd, a)) print(max(ans))
import fractions N = int(input()) A = list(map(int, input().split())) gcd_l = [0] gcd_r = [0] for i in range(N): gcd_l.append(fractions.gcd(gcd_l[i], A[i])) gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)])) gcd_r = gcd_r[::-1] ans = [] for i in range(N): ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1])) p...
s019977216
s141411387
p03061
python
Time Limit Exceeded
from itertools import accumulate N = int(input()) S = input() black = [0]*N white = [0]*N for i, s in enumerate(S): if s == '#': black[i] = 1 else: white[i] = 1 # 累積和 black = [0] + black black = list(accumulate(black)) white = [0] + white[::-1] white = list(accumulate(white))[::-1] ans = [...
A = list(map(int, input().split())) if (A[0] < A[2] < A[1]) or (A[1] < A[2] < A[0]): print("Yes") else: print("No")
s318703285
s275364126
p03067
python
Runtime Error
N = int(input()) S = input() cnt = 0 for i in range(N-1): if S[i] == '#' and S[i+1] == '.': tmp_S = list(S) tmp_S[i+1] = '#' S = "".join(tmp_S) cnt += 1 print(cnt)
from itertools import accumulate N = int(input()) S = input() black = [0 for _ in range(N)] white = [0 for _ in range(N)] for i, s in enumerate(S): if s == '#': black[i] = 1 else: white[i] = 1 # 累積和 black = [0] + black black = list(accumulate(black)) white = [0] + white[::-1] white = list(a...
s457921657
s595737000
p03069
python
Time Limit Exceeded
N, K = list(map(int, input().split())) S = input() ans = -1 # 十分に小さい値 if (S[0] == '0'): stand = 1 else: stand = 0 L = 0 R = 0 # 尺取り法 while (R < N): # 右端を進めることが可能(進めたときの積がK以下)なら、右端を進める if (stand <= K): ans = max(ans, R - L + 1) if (S[R] == '1' and S[R + 1] == '0'): stand...
N, K = list(map(int, input().split())) S = input() S = S + 'E' # 終端処理 ans = -1 # 答えの初期値(十分に小さい値) # 立った人の連続の数 if (S[0] == '0'): stand = 1 else: stand = 0 L = 0 R = 0 # 尺取り法 while (R < N): # 右端を進めることが可能(立った人の連続の数がK以下)なら、右端を進める if (stand <= K): # 立った人の連続の集合数が増えるなら1足す if (S[R] == '1...
s308316400
s896636261
p03074
python
Runtime Error
N, K = list(map(int, input().split())) S = input() ans = -1 # 十分に小さい値 if (S[0] == '0'): stand = 1 else: stand = 0 l = 0 r = 0 # 尺取り法 while (r < N): # 右端を進めることが可能(進めたときの積がK以下)なら、右端を進める if (stand <= K): ans = max(ans, r - l + 1) if (S[r] == '1' and S[r + 1] == '0'): stand...
N, K = list(map(int, input().split())) S = input() S = S + 'E' # 終端処理 ans = -1 # 答えの初期値(十分に小さい値) # 立った人の連続の数 if (S[0] == '0'): stand = 1 else: stand = 0 L = 0 R = 0 # 尺取り法 while (R < N): # 右端を進めることが可能(立った人の連続の数がK以下)なら、右端を進める if (stand <= K): # 立った人の連続の集合数が増えるなら1足す if (S[R] == '1...
s942938693
s896636261
p03074
python
Runtime Error
import itertools X, Y, Z, K = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) AB = [a + b for (a, b) in list(itertools.product(A, B))] AB = sorted(AB)[::-1] ans = [ab + c for (ab, c) in list(itertools.product(AB[:3000], C))] ...
A = [int(input()) for i in range(5)] K = int(input()) if (max(A)-min(A) <= K): print("Yay!") else: print(":(")
s170829383
s127093523
p03075
python
Runtime Error