Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02647 (python)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
if K>=50:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    for i in range(0,N):
      imos[i+1]+=imos[i]
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
@njit(cache = True) 
if K>=40:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    imos=list(accumulate(imos))
    for i in range(0,N):
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
if K>=40:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    imos=lisT(accumulate(imos))
    for i in range(0,N):
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
if K>=50:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    imos=accumulate(imos)
    for i in range(0,N):
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)
Problem p02702 (python)

Fixed submission:
import numpy as np
S=input()
N=len(S)
mod=[0 for i in range(2019)]
mod2=0
ten=1
for i in range(N-1,-1,-1): 
  s=int(S[i])*ten
  mod2+=np.mod(s,2019)
  mod2=np.mod(mod2,2019)
  mod[mod2]+=1
  ten=(ten*10)%2019
ans=0
for i in range(2019):
  k=mod[i]
  if i==0:
    if k>=2:
      ans+=k*(k-1)//2+k
    else:
      ans+=k
  else:
    if k>=2:
      ans+=k*(k-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
S=input()
N=len(S)
mod=[0 for i in range(2019)]
mod2=0
for i in range(N-1,-1,-1): 
  s=int(S[i])*(10**(N-1-i))
  mod2+=np.mod(s,2019)
  mod2=np.mod(mod2,2019)
  mod[mod2]+=1
ans=0
for i in range(2019):
  k=mod[i]
  if i==0:
    if k>=2:
      ans+=k*(k-1)//2+k
    else:
      ans+=k
  else:
    if k>=2:
      ans+=k*(k-1)//2
print(ans)
Problem p02720 (python)

Fixed submission:
K=int(input())
ANS=[i for i in range(1,10)]
i=0
while len(ANS)<=10**5:
  last=str(ANS[i])[-1]
  if last=="0":
    ANS+=[ANS[i]*10,ANS[i]*10+1]
  elif last=="9":
    ANS+=[ANS[i]*10+8,ANS[i]*10+9]
  else:
    ANS+=[ANS[i]*10+int(last)-1,ANS[i]*10+int(last),ANS[i]*10+int(last)+1]
  i+=1  
ans=ANS[K-1]
print(ans)

Buggy submission (verdict: Runtime Error):
K=int(input())
ANS=[]
for i in range(1,10**6*2):
  LEN=len(str(i))
  STR=str(i)
  if LEN==1:
    ANS+=[i]
  for k in range(LEN-1):
    if abs(int(STR[k])-int(STR[k+1]))>1:
      break
    if k==LEN-2:
      ANS+=[i]
ans=ANS[K-1] 
print(ans)

Buggy submission (verdict: Runtime Error):
K=int(input())
ANS=[]
for i in range(1,10**6):
  LEN=len(str(i))
  STR=str(i)
  if LEN==1:
    ANS+=[i]
  for k in range(LEN-1):
    if abs(int(STR[k])-int(STR[k+1]))>1:
      break
    if k==LEN-2:
      ANS+=[i]
ans=ANS[K-1] 
print(ans)
Problem p02888 (python)

Fixed submission:
from bisect import bisect, bisect_left
 
N=int(input())
L=list(map(int,input().split()))
L.sort()
 
ans = 0
for i in range(N-2):
  a=L[i]
  for k in range(i+1,N-1):
    b=L[k]
    t=bisect_left(L,a+b)
    ans+=t-k-1
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect, bisect_left
 
N= int(input())
L= list(map(int,input().split()))
L.sort()
 
ans = 0
for i in range(N-2):
  a=L[i]
  for k in range(i+1,n-1):
    b=s[k]
    t=bisect_left(L,a+b)
    ans+=t-k-1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
listL=list(map(int,input().split()))
listL.sort()
ans=0
for i in range(N-1,2,-1):
  for k in range(i-1,1,-1):
    t=math.ceil(k/2)
    d=listL[i]-listL[k]
    half=math.ceil((k-t)/4)
    while (d-listL[t]<=0 or d-listL[t+1]>0) and t!=0 and t!=k-1:
      third=listL[t]
      if d-third>=0:
        t=t-half
      else:
        t=t+half
      half=half//2+1
      print(half,t) 
    ans+=k-t+1
print(ans)
Problem p02963 (python)

Fixed submission:
S=int(input())
x1=0
y1=0
x2=10**9
y2=1
x3=10**9-S%(10**9)
y3=S//(10**9)+1
if S!=10**18:
  print(x1,y1,x2,y2,x3,y3)
else:
  y3=10**9
  x3=0
  print(x1,y1,x2,y2,x3,y3)

Buggy submission (verdict: Runtime Error):
S=int(input())
x1=0
y1=0
y2=0
x3=0
S1=S**(1/2)
for i in range(int(S1)+1,0,-1):
  if int((S/i)**2)==(S//i)**2:
    ans=i
    break
x2=ans
y3=S//ans
print(x1,y1,x2,y2,x3,y3)

Buggy submission (verdict: Runtime Error):
S=int(input())
x1=0
y1=0
y2=0
x3=0
S1=S**(1/2)
print(S1)
for i in range(int(S1)+1,0,-1):
  if (S/i)**2==(S//i)**2:
    ans=i
    break
x2=ans
y3=S//ans
print(x1,y1,x2,y2,x3,y3)
Problem p02983 (python)

Fixed submission:
import itertools
L,R=map(int,input().split())
if R-L>=2019:
  print(0)
else:
  MIN=2018  
  list1=list(range(L,R+1))
  list2=list(itertools.combinations(list1,2))
  for i in range(len(list2)):
    a=list2[i][0]*list2[i][1]%2019
    MIN=min(MIN,a)
  print(MIN)

Buggy submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
if R-L>=2019:
  print(0)
else:
  MIN=2018  
  list1=list(range(L,R+1))
  list2=list(itertools.combinations(list1,2))
  for i in range(len(list2)):
    a=list2[i][0]*list2[i][1]%2019
    MIN=min(MIN,a)
print(MIN)
Problem p02994 (python)

Fixed submission:
N,L=map(int,input().split())
if L>=0:
  print((N-1)*(L-1)+int(N*(N+1)/2)-1)
else:
  if L+N>0:
    print(N*(L-1)+int(N*(N+1)/2))
  else:
    print(N*(L-1)+int(N*(N+1)/2)-(L+N-1))

Buggy submission (verdict: Runtime Error):
N,map(int,input().split())
if L>=0:
  print((N-1)*(L-1)+int(N*(N+1)/2)-1)
else:
  if L+N>=0:
    print(N*(L-1)+int(N*(N+1)/2))
  else:
    print(N*(L-1)+int(N*(N+1)/2)-(L+N-1))
Problem p02995 (python)

Fixed submission:
import fractions
A,B,C,D=map(int,input().split())
listA=range(A)
listB=range(B+1)
listC=range(0,B+1,C)
listAC=range(0,A,C)
listD=range(0,B+1,D)
listAD=range(0,A,D)
listCD=range(0,B+1,C*D//fractions.gcd(C,D))
listACD=range(0,A,C*D//fractions.gcd(C,D))
lenA=len(listA)
lenB=len(listB)
lenC=len(listC)
lenAC=len(listAC)
lenD=len(listD)
lenAD=len(listAD)
lenCD=len(listCD)
lenACD=len(listACD)
ans=lenB-lenA-lenC+lenAC-lenD+lenAD+lenCD-lenACD
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
setAB=set(range(A,B+1))
setC=range(A,B+1,C)
setD=range(A,B+1,D)
setCD=set(setC+setD)
ans=len(setAB)-len(setCD)
print(ans)
Problem p03007 (python)

Fixed submission:
N=int(input())
listA=list(map(int,input().split()))
listB=[abs(i) for i in listA]
MAX=max(listA)
MIN=min(listA)
ans=sum(listB)
if MAX<=0:
  print(ans+MAX*2)
elif MIN<=0:
  print(ans)   
else:
  print(ans-MIN*2)
listC=sorted(listA)  
for i in range(len(listA)-2):
  if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1]
print(MAX,MIN)

Buggy submission (verdict: Runtime Error):
N=int(input())
listA=list(map(int,input().split()))
listB=[abs(i) for i in listA]
MAX=max(listA)
MIN=min(listA)
listD=heapq.nsmallest(2,listA)
ans=sum(listB)
if MAX<=0:
  print(ans+MAX)
elif MIN<=0:
  print(ans)   
else:
  print(ans-MIN*2)
listC=sorted(listA)  
for i in range(len(listA)-2):
  if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1]
print(MAX,MIN)
Problem p03030 (python)

Fixed submission:
from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
before=0
if N!=1:
  for i in range(1,N):
    if listA[i-1][0]!=listA[i][0]:
      listN=listA[before:i]
      listN.sort(key=itemgetter(1),reverse=True)
      listANS+=listN
      before=i
 
    if i==N-1:
      listN=listA[before:N]
      listN.sort(key=itemgetter(1),reverse=True)
      listANS+=listN
else:
  listANS=listA
for i in range(N):
  print(listANS[i][2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
before=0
for i in range(1,N):
  if listA[i-1][0]!=listA[i][0]:
    listN=listA[before:i]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i

  if i==N-1:
    listN=listA[before:N]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN

for i in range(N):
  print(listANS[i][2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
print(listA)
before=0
for i in range(1,N):
  if listA[i-1][0]!=listA[i][0]:
    listN=listA[before:i]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i

  if i==N-1:
    listN=listA[before:N]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN

for i in range(N):
  print(listANS[i][2])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N=int(input())
listA=[[] for i in range(N)]
listANS=[]
for i in range(N):
  S,P=input().split()
  listA[i]+=[S,int(P),i+1]
listA.sort()
for i in range(1,N):
  before=0
  if listA[i-1][0]!=listA[i][0] or i==N-1:
    listN=listA[before:i+1]
    listN.sort(key=itemgetter(1),reverse=True)
    listANS+=listN
    before=i
for i in range(N):
  print(listANS[i][2])
Problem p03035 (python)

Fixed submission:
A,B=map(int,input().split())
if A>=13:
  print(B)
if 6<=A<13:
  print(int(B/2))
if A<=5:
  print(0)

Buggy submission (verdict: Runtime Error):
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(){
  int A,B;
  cin >>A>>B;
  if (A>=13){
    cout <<B;
  }  
  else if (A>=6){
    cout <<B/2;
  }  
  else{
    cout <<0;
  }
}
Problem p03047 (python)

Fixed submission:
N,K=map(int,input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
print(N-K+1)
Problem p03076 (python)

Fixed submission:
ABCDE=[]
modABCDE=[]
for i in range(5):
  ABCDE+=[int(input())]
  if ABCDE[i]%10!=0:
    modABCDE+=[ABCDE[i]%10]  
if modABCDE!=[]:
  MIN=min(modABCDE)
else:
  MIN=10  
ans=sum(ABCDE)-sum(modABCDE)+(len(modABCDE)-1)*10+MIN
print(ans)

Buggy submission (verdict: Runtime Error):
ABCDE=[]
modABCDE=[]
for i in range(5):
  ABCDE+=[int(input())]
  if ABCDE[i]%10!=0:
    modABCDE+=[ABCDE[i]%10]  
MIN=min(modABCDE)
ans=sum(ABCDE)-sum(modABCDE)+(len(modABCDE)-1)*10+MIN
print(ans)
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
listS=list(S)
ans=0
listAC=[ans]
for k in range(1,N):
  if listS[k-1]=="A" and listS[k]=="C":
    ans+=1
  listAC+=[ans]  
for i in range(Q):
  l,r=map(int,input().split())
  ans=listAC[r-1]-listAC[l-1] 
  print(ans)

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
listS=list(S)
ans=0
listAC=[ans]
for k in range(1,N+1):
  if listS[k-1]=="A" and listS[k]=="C":
    ans+=1
  listAC+=[ans]  
for i in range(Q):
  l,r=map(int,input().split())
  ans=listAC[r-1]-listAC[l-1] 
  print(ans)
Problem p03266 (python)

Fixed submission:
N,K=map(int,input().split())
if K%2==0:
  a=N//(K//2)
  b=N//K
  c=a-b
  ans=b**3+c**3
  print(ans)
else:
  a=N//K
  ans=a**3
  print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
N,K=map(int,input().split())
L=range(1,N+1)
T=0
for i in itertools.permutations(L, r=3):
  int(a,b,c) for a,b,c in i:
    if a+b%K==0 and b+c%K==0 and c+a%K==0:
      T+=1
print(T)
Problem p03378 (python)

Fixed submission:
N,M,X=map(int,input().split())
listA=list(map(int,input().split()))
for i in range(M-1):
  if listA[i]<X<listA[i+1]:
    ans=min(i+1,M-i-1)
  elif listA[i]==0:
    ans=min(i,M-i-1)
if X<listA[0] or listA[M-1]<X:
  ans=0
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,X=map(int,input().split())
listA=list(map(int,input().split()))
for i in range(M-1):
  if listA[i]<X<listA[i+1]:
    ans=min(i+1,M-i-1)
  elif listA[i]==0:
    ans=min(i,M-i-1)
print(ans)
Problem p03385 (python)

Fixed submission:
list1=list(input())
if set(list1)=={"a","b","c"}:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
list1=[map(str,input().split())]
if set(list1)==[a,b,c]:
  print(Yes)
else:
  print(No)
Problem p03548 (python)

Fixed submission:
X,Y,Z=map(int,input().split())
ans=X//(Y+Z)
if X<ans*(Y+Z)+Z:
  print(ans-1)
else:  
  print(ans)

Buggy submission (verdict: Runtime Error):
if Y=n:
    z=n-1
    X＞n+(n-1)=2n-1
    これを満たすnが求める人数
Problem p03598 (python)

Fixed submission:
N=int(input())
K=int(input())
SUM=0
list1=list(map(int,input().split()))
for i in range(N):
  x=list1[i]
  if x>K-x:
    SUM+=2*(K-x)
  else:
    SUM+=2*(x)
print(SUM)

Buggy submission (verdict: Runtime Error):
N=int(input())
K=int(input())
list1=list(input())
SUM=0
for i in range(N):
  x=int(list1[i])
  if x>K-x:
    SUM+=2*(K-x)
  else:
    SUM+=2*x
print(SUM)
Problem p03761 (python)

Fixed submission:
import sys
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
if n==1:
  ANS=S[0]
  ANS.sort()
  ans="".join(ANS) 
  print(ans)
  sys.exit()
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
rem=[]
for i in ANS:
  flag=0
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    elif flag!=1:
      rem+=[i]
      flag=1
for i in rem:
  ANS.remove(i)
ANS.sort()      
ans="".join(ANS)  
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
if n==1:
  ANS=S[0]
  ANS.sort()
  ans="".join(ANS) 
  print(ans)
  sys.exit()
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
for i in ANS:
  flag=0
  rem=[]
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    elif flag!=1:
      rem+=[i]
      flag=1
for i in rem:
  ANS.remove[i]
ANS.sort()      
ans="".join(ANS)  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
for i in ANS:
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    else:
      ANS.remove(i)
      break
ANS.sort()      
ans="".join(ANS)  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
S=[]
for i in range(n):
  s=list(input())
  S+=[s]
ANS=[]
for k in range(len(S[0])):
  if S[0][k] in S[1]:
    ANS+=[S[0][k]]
    S[1].remove(S[0][k])
for i in ANS:
  for k in range(2,n):
    if i in S[k]:
      S[k].remove(i)
    else:
      ANS.remove(i)      
ANS.sort()      
ans="".join(ANS)  
print(ans)
Problem p03943 (python)

Fixed submission:
a,b,c=map(int,input().split())
l=[a,b,c]
MAX=max(l)
SUM=sum(l)
if MAX==SUM-MAX:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
MAX=max[a,b,c]
SUM=sum[a,b,c]
if MAX==SUM-MAX:
  print(Yes)
else:
  print(No)
Problem p02630 (python)

Fixed submission:
s = int(input()) 

dict={}
num_list = list(map(int, input().split()))

length=len(num_list)
count=[0]*(s+1000)
for i in range(length):
    count[num_list[i]]+=1
    dict[num_list[i]]=count[num_list[i]]
    
sum=0
#print(dict)
for k, v in dict.items():
    sum+=k*v
#print(dict)
#print(sum)

count=0
d=0
n = int(input()) 
for i in range(n):
    a,b = map(int, input().split())  
    if dict.get(a)!=None:
        d=(b-a)*dict[a]
        #print("d:{}".format(d))
        if dict.get(b)!=None:
            count=dict[b]
            dict[b]=dict[a]+dict[b]
        else:
            dict[b]=dict[a]
        dict[a]=0
        sum+=d
        
        #print(dict)
        
    else:
        pass
    d=0
    print(sum)
    #print()

Buggy submission (verdict: Runtime Error):
s = int(input()) 

dict={}
num_list = list(map(int, input().split()))

length=len(num_list)
count=[0]*(s+1)
for i in range(length):
    count[num_list[i]]+=1
    dict[num_list[i]]=count[num_list[i]]
    
#print(dict)


sum=0
count=0
n = int(input()) 
for i in range(n):
    a,b = map(int, input().split())  
    if dict.get(a)!=None:
        if dict.get(b)!=None:
            count=dict[b]
            dict[b]=dict[a]+dict[b]
        else:
            dict[b]=dict[a]
        dict[a]=0
    else:
        pass
    #print(dict)
    for k, v in dict.items():
        sum+=k*v
    print(sum)
    sum=0
Problem p02641 (python)

Fixed submission:
x,y=map(int,input().strip().split())
nums = list(map(int, input().strip().split()))
ans=0
if y==0:
  print(x)
elif x not in nums:
  print(x)
else:
  for i in range(0,102):
    if i not in nums:
      if abs(x-i)<abs(x-ans):
        ans=i
  print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
a,b = map(int, input().split()) 

if b==0:
    print(a)
    exit()
num_list = list(map(int, input().split()))

    

num=[True]*101
#print(num)


for i in range(b):
    num[num_list[i]]=False


num[0]=False
#print(num)

count=0
min_min=100
min_max=100
i=a

#print(i)
while 1:
    if i==100:
        break
    if num[i]==True:
        min_min=i-a
        break
    i+=1
j=a


while 1:
    if num[j]==True:
        min_max=a-j
        break
    j-=1
#print(min_max)
#print(j)
if min_min<min_max:
    print(i)
    
else:
    print(j)
Problem p02677 (python)

Fixed submission:

import math

a,b,c,d = map(float, input().split()) 

e=6*d
f=30*c+0.5*d

if e<f:
    kakudo=f-e
else:
    kakudo=e-f
    
if kakudo>180:
    kakudo=360-kakudo

a2=a*a
b2=b*b
i=math.cos(math.radians(kakudo))
j=2*a*b*i
print(math.sqrt(a2+b2-j))

Buggy submission (verdict: Runtime Error):
import math

a,b,c,d = map(float, input().split()) 

e=6*d
f=30*c+0.5*d

if e<f:
    kakudo=f-e
    
if kakudo>180:
    kakudo=360-kakudo

a2=a*a
b2=b*b
i=math.cos(math.radians(kakudo))
j=2*a*b*i
print(math.sqrt(a2+b2-j))
Problem p02837 (python)

Fixed submission:
def main():
    N = int(input())
    S = [[] * N for i in range(N)]
    ans = 0

    for i in range(N):
        A = int(input())
        for j in range(A):
            x, y = map(int, input().split())
            S[i].append([x-1, y])

    P = [0]*N
    
    for i in range(2**N):
        for j in range(N):
            if P[j] == 0:
                P[j] = 1
                break
            else:
                P[j] = 0
        
        if sum(P) <= ans:
            continue
        flag = 0
        for p in range(len(P)):
            if P[p] == 1:
                for s in S[p]:
                    if s[1]!= P[s[0]]:
                        flag = 1
        if flag == 1:
            continue
        else:
            ans = sum(P)
        
    print(ans)


 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = [[] * N for i in range(N)]
    ans = 0

    for i in range(N):
        A = int(input())
        for j in range(A):
            x, y = map(int, input().split())
            S[i].append([x-1, y])

    P = [0]*N

    for i in range(2**N):
        for j in range(N):
            if P[j] == 0:
                P[j] = 1
                break
            else:
                P[j] = 0

        if sum(P) <= ans:
            continue
        flag = 0
        for p in range(len(P)):
            if P[p] == 1:
                for s in S[p]:
                    if s[1]!= P[s[0]]:
                        flag = 1
        if flag == 1:
            continue
        else:
            ans = sum(P)

    print(ans)


 
if name == 'main':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = [[] * N for i in range(N)]
    ans = 0

    for i in range(N):
        A = int(input())
        for j in range(A):
            x, y = map(int, input().split())
            S[i].append([x-1, y])

    P = [0]*N

    for i in range(2**N):
        for j in range(N):
            if P[j] == 0:
                P[j] = 1
                break
            else:
                P[j] = 0

        if sum(P) <= ans:
            continue
        flag = 0
        for p in range(len(P)):
            if P[p] == 1:
                for s in S[p]:
                    if s[1]!= P[s[0]]:
                        flag = 1
        if flag == 1:
            continue
        else:
            ans = sum(P)

    print(ans)


 
if name == 'main':
    main()
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
problems = {}
rejected = [0]*(N+1)
reject_count = 0
for P, S in A:
    P = int(P)
    if not problems.get(P):
        if S != 'AC':
            rejected[P] += 1
        else:
            problems[P] = S
for i in range(N+1):
    if problems.get(i):
        reject_count += rejected[i]
print(len(problems), reject_count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
problems = {}
reject_count = 0
for P, S in A:
    if not problems.get(P) and P <= N:
        if S != 'AC':
            reject_count += 1
        else:
            problems[P] = S
print(len(problems), reject_count)
Problem p02690 (python)

Fixed submission:
x=int(input())
for i in range(200):
    a=i
    for j in range(-200,i):
        b=j
        if a**5-b**5==x:
            am=a
            bm=b
        else:
            c=0
print(am,bm)

Buggy submission (verdict: Runtime Error):
x=int(input())
for i in range(-100,100):
    a=i
    for j in range(-100,100):
        b=j
        if a**5-b**5==x:
            am=a
            bm=b
        else:
            c=0
print(am,bm)
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
P = [int(p) for p in input().split()]

is_exit = [False] * 101

for p in P:
    is_exit[p] = True

if not is_exit[X]:
    print(X)
else:
    l = X - 1
    r = X + 1
    while True:
        if 1 <= l:
            if not is_exit[l]:
                print(l)
                exit()
        else:
            print(l)
            exit()
        if r <= 100:
            if not is_exit[r]:
                print(r)
                exit()
        else:
            print(r)
            exit()
        l -= 1
        r += 1

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
P = [int(p) for p in input().split()]

is_exit = [False] * 101

for p in P:
    is_exit[p] = True

if not is_exit[X]:
    print(X)
else:
    l = X - 1
    r = X + 1
    while True:
        if not is_exit[l]:
            print(l)
            exit()
        if not is_exit[r]:
            print(r)
            exit()
        l -= 1
        r += 1
Problem p02646 (python)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print("NO")
    exit()

d = abs(A - B)
s = V - W

if d <= s * T:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print("NO")
    exit()

s = V - W
if D < s * T:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V <= W:
    print("NO")
    exit()

s = V - W
if D < s * T:
    print("YES")
else:
    print("NO")