Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M,Q=map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(Q):
  ta,tb,tc,td=map(int,input().split())
  a+=[ta]
  b+=[tb]
  c+=[tc]
  d+=[td]
maxs=0

def suuretu(n,m):#n桁m以上
  if n>1:
    A=[]
    for i in range(1,9):
      for j in suuretu(n-1,i):
        A+=[10*i+j]
    return A
  else:
    A=[i for i in range(m,10)]
    return A
B=suuretu(N,1)
answer=0
for i in B:
  ans=0
  s=str(i)
  tmpl=[int(s[j]) for j in range(N)]  
  for k in range(Q):
    if tmpl[a[k]-1]-tmpl[b[k]-1]==c[k]:
      ans+=d[i]
  answer=max(answer,ans)
print(answer)

 


Fixed submission:
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    break
  if i==B:
    print("NG")

Buggy python submission (verdict: Runtime Error):
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.floor(A*x/B)-A*math.floor(x/B)
print(int(ans))



Fixed submission:
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    break
  if i==B:
    print("NG")

Buggy python submission (verdict: Runtime Error):
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.ceil(A*x/B)-A*math.ceil(x/B)
print(int(ans))



Fixed submission:
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
  if i%K==0:
    print("OK")
    break
  if i==B:
    print("NG")
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)
Slis=[]
for i in range(N):
  Slis+=[int(S[i])]
T=[0 for i in range(N+1)]#T[i]はi桁より右側の数字


def kaizyou(n):
  c=1
  c=c*10**n
  return c%2019


for i in range(N):
  T[N-i-1]=(T[N-i]+kaizyou(i)*Slis[N-i-1])%2019

MOD=[0 for i in range(2019)]
for i in range(N+1):
  tmp=T[i]%2019
  MOD[tmp]+=1


  
ans=0

for i in range(2019):
  tmp=MOD[i]
  ans+=tmp*(tmp-1)//2
print(ans)


Fixed submission:
S,W=map(int,input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")

Buggy python submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
t=0
while A>0 and C>0:
  if t%2==0:
    A-=D
  else:
    C-=B
  t+=1
if A<=0:
  print("No")
else:
  print("Yes")


Fixed submission:
S,W=map(int,input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
counter=[[0 for i in range(N)] for _ in range(3)]#i+1より右側にあるR(0),G(1),B(2)の数
if S[N-1]=="R":
  counter[0][N-1]=1
elif S[N-1]=="G":
  counter[1][N-1]=1
else:
  counter[2][N-1]=1
for i in range(1,N):
  if S[N-1-i]=="R":
    counter[0][N-1-i]=counter[0][N-i]+1
  elif S[N-1-i]=="G":
    counter[1][N-1-i]=counter[1][N-i]+1
  else:
    counter[2][N-1-i]=counter[2][N-i]+1
  counter[0][N-1-i]=max(counter[0][N-i],counter[0][N-1-i])
  counter[1][N-1-i]=max(counter[1][N-i],counter[1][N-1-i])
  counter[2][N-1-i]=max(counter[2][N-i],counter[2][N-1-i])
ans=0
for i in range(N-1):
  if S[i]=="R":
    for j in range(i+1,N):
      if S[j]=="G":
        ans+=counter[2][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="B":
            ans-=1
      elif S[j]=="B":
        ans+=counter[1][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="G":
            ans-=1
for i in range(N-1):
  if S[i]=="G":
    for j in range(i+1,N):
      if S[j]=="R":
        ans+=counter[2][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="B":
            ans-=1
      elif S[j]=="B":
        ans+=counter[0][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="R":
            ans-=1
for i in range(N-1):
  if S[i]=="B":
    for j in range(i+1,N):
      if S[j]=="R":
        ans+=counter[1][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="G":
            ans-=1
      elif S[j]=="G":
        ans+=counter[0][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="R":
            ans-=1
print(ans)

Fixed submission:
N=int(input())
S=input()
counter=[[0 for i in range(N)] for _ in range(3)]#i+1より右側にあるR(0),G(1),B(2)の数
if S[N-1]=="R":
  counter[0][N-1]=1
elif S[N-1]=="G":
  counter[1][N-1]=1
else:
  counter[2][N-1]=1
for i in range(1,N):
  if S[N-1-i]=="R":
    counter[0][N-1-i]=counter[0][N-i]+1
  elif S[N-1-i]=="G":
    counter[1][N-1-i]=counter[1][N-i]+1
  else:
    counter[2][N-1-i]=counter[2][N-i]+1
  counter[0][N-1-i]=max(counter[0][N-i],counter[0][N-1-i])
  counter[1][N-1-i]=max(counter[1][N-i],counter[1][N-1-i])
  counter[2][N-1-i]=max(counter[2][N-i],counter[2][N-1-i])
ans=0
for i in range(N-1):
  if S[i]=="R":
    for j in range(i+1,N):
      if S[j]=="G":
        ans+=counter[2][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="B":
            ans-=1
      elif S[j]=="B":
        ans+=counter[1][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="G":
            ans-=1
for i in range(N-1):
  if S[i]=="G":
    for j in range(i+1,N):
      if S[j]=="R":
        ans+=counter[2][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="B":
            ans-=1
      elif S[j]=="B":
        ans+=counter[0][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="R":
            ans-=1
for i in range(N-1):
  if S[i]=="B":
    for j in range(i+1,N):
      if S[j]=="R":
        ans+=counter[1][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="G":
            ans-=1
      elif S[j]=="G":
        ans+=counter[0][j]
        if 2*j-i<=N-1:
          if S[2*j-i]=="R":
            ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())
sup=min((A+1)/0.08,(B+1)/0.1)
inf=max(A/0.08,B/0.1)
inf2=math.ceil(inf)
if inf2<sup:
  print(inf2)
else:
  print(-1)


Fixed submission:
S=input()
a=[]
b=[]
for i in range(3):
  if S[i]=="A":
    a+=[S[i]]
  else:
    b+=["B"]
if len(a)==3 or len(b)==3:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
def main():
  N=int(input())
  S=str(input())
  Q=int(input())
  Q1=[]
  Q2=[]
  Q3=[]
  for i in range(Q):
    i1,i2,i3=map(str,input().split())
    Q1+=[i1]
    Q2+=[i2]
    Q3+=[i3]
  Slist=[]
  for i in range(N):
    Slist+=[S[i]]
  tf=[[0 for  i in range(26)] for i in range(N+1)]
  for i in range(1,N):
    n=ord(Slist[i])-97
    tf[i][n]=tf[i-1][n]+1
  for i in range(Q):
    if int(Q1[i])==1:
      n=ord(Slist[int(Q2[i])-1])-97
      tf[int(Q2[i])-1][n]-=1
      Slist[int(Q2[i])-1]=Q3[i]
      n=ord(Q3[i])-97
      tf[int(Q2[i])-1][n]+=1
    elif int(Q1[i])==2:
      l=Q2[i]-2
      r=Q3[i]-1
      t=0
      for i in range(26):
        if tf[r][i]>tf[l][i]:
          t+=1
      print(t)
if __name__ == '__main__':
  main()


Fixed submission:
N=int(input())
print(N//2+N%2)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  S+=[s]
  C+=[c]
tf=1
ans=[]
for i in range(N):
  ans+=[-1]
for i in range(M):
  if ans[S[i]-1] ==-1:
    ans[S[i]-1]=C[i]
  else:
    if ans[S[i]-1]!=C[i]:
      tf=0
      break
    else:
      continue
for i in range(N):
  if ans[i]==-1:
    if i!=0 or (i==0 and N==1):
      ans[i]=0
    else:
      ans[i]=1
  elif ans[i]==0 and i==0 and N!=1:
    tf=0
    break
if tf==0:
  print('-1')
else:
  ansnum=''
  for i in range(N):
    ansnum+=str(ans[i])
  print(ansnum)

Fixed submission:
N=int(input())
print(N//2+N%2)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  S+=[s]
  C+=[c]
tf=1
ans=[]
for i in range(N):
  ans+=[-1]
for i in range(M):
  if ans[S[i]-1] ==-1:
    ans[S[i]-1]=C[i]
  else:
    if ans[S[i]-1]!=C[i]:
      tf=0
      break
    else:
      continue
for i in range(M):
  if ans[i]==-1:
    if i!=0:
      ans[i]=0
    else:
      ans[i]=1
if ans[0]==0:
  print('-1')
else:
  ansnum=''
  for i in range(M):
    ansnum+=str(ans[i])
  print(ansnum)

Fixed submission:
N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  S+=[s]
  C+=[c]
tf=1
ans=[]
for i in range(N):
  ans+=[-1]
for i in range(M):
  if ans[S[i]-1] ==-1:
    ans[S[i]-1]=C[i]
  else:
    if ans[S[i]-1]!=C[i]:
      tf=0
      break
    else:
      continue
for i in range(N):
  if ans[i]==-1:
    if i!=0 or (i==0 and N==1):
      ans[i]=0
    else:
      ans[i]=1
  elif ans[i]==0 and i==0 and N!=1:
    tf=0
    break
if tf==0:
  print('-1')
else:
  ansnum=''
  for i in range(N):
    ansnum+=str(ans[i])
  print(ansnum)
Buggy python submission (verdict: Runtime Error):
S,T=str(input())
A,B=str(input())
U=input()
if U==S:
  A-=1
else:
  B-=1
AN=[A,B]
print(*AN)

Fixed submission:
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()
if U==S:
  A-=1
else:
  B-=1
AN=[A,B]
print(*AN)
Buggy python submission (verdict: Runtime Error):
S=input()
L=len(S)
for i in range(L):
  S[i]="x"
print(S)

Fixed submission:
S=input()
L=len(S)
ans=""
for i in range(L):
  ans+="x"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
a=1
exist=[]
for i in range(N):
  if A[i] in exist:
    a=0
    print("NO")
    break
  else:
    exist+=[A[i]]
if a==1:
  print("YES")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
a=0
for i in range(N-1):
  if A[i]==A[i+1]:
    print("NO")
    a=1
    break
if a==0:
  print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
a=1
exist=[]
for i in range(N):
  if A[i] in exist:
    a=0
    print("NO")
    break
  else:
    exist+=[A[i]]
if a==1:
  print("YES")
 

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
a=0
for i in range(N-1):
  if A[i]==A[i+1]:
    print("NO")
    a=1
    break
if a==0:
  print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
for i in range(N-K+1):
  s=sum(P[i:i+K])
  if s>S:
    S=s
ans=(K+S)/2
print(ans)

Fixed submission:
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
sumlist=[0 for i in range(N+K-1)]
sumlist[0]=sum(P[:K])
for i in range(1,N-K+1):
  sumlist[i]=sumlist[i-1]+P[K+i-1]-P[i-1]
S=max(sumlist)
ans=(K+S)/2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
for i in range(N-K+1):
  s=sum(P[i:i+K])
  if s>S:
    S=s
ans=(K+S)/2
print(ans)

Fixed submission:
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=0
sumlist=[0 for i in range(N+K-1)]
sumlist[0]=sum(P[:K])
for i in range(1,N-K+1):
  sumlist[i]=sumlist[i-1]+P[K+i-1]-P[i-1]
S=max(sumlist)
ans=(K+S)/2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A+=[a]
  B+=[b]
dp=[[float('inf') for i in range(H+1)]for i in range(N+1)]#i番めの魔法までを使って体力j減らすのに必要な魔力の最小値
dp[0][0]=0
for i in range(1,N+1):
  for j in range(H+1):
    if j>=A[i-1]:
      Ai=A[i-1]
      Bi=B[i-1]
      dp[i][j]=min(dp[i][j-Ai]+Bi,dp[i-1][j])
    else:
      dp[i][j]=min(dp[i-1][j],B[i-1])
ans=dp[N][H]
print(ans)

Fixed submission:
H,N=map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A+=[a]
  B+=[b]
dp=[[float('inf') for i in range(H+1)]for i in range(N+1)]#i番めの魔法までを使って体力j減らすのに必要な魔力の最小値
dp[0][0]=0
for i in range(1,N+1):
  for j in range(H+1):
    if j>=A[i-1]:
      Ai=A[i-1]
      Bi=B[i-1]
      dp[i][j]=min(dp[i][j-Ai]+Bi,dp[i-1][j])
    else:
      dp[i][j]=min(dp[i-1][j],B[i-1])
ans=dp[N][H]
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int(input()))
if N==M:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M=map(int,input().split())
if N==M:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
p=[]
S=[]
for i in range(M):
  p0,S0=map(int,input().split())
  p+=[p0]
  S+=[S0]
awlist=[0 for i in range(N)]
walist=[0 for i in range(N)]
wacount=0
account=0
for i in range(M):
  if s[i]=='WA' and awlist[s[i]]==0:
    walist[s[i]]+=1
  elif s[i]=='AC' and awlist[s[i]]==0:
    account+=1
    awlist[s[i]]=1
    wacount+=walist[s[i]]
Answer=[account,wacount]
print(*Answer)

Fixed submission:
N,M=map(int,input().split())
p=[]
s=[]
for i in range(M):
  p0,S0=map(str,input().split())
  p0=int(p0)-1
  p+=[p0]
  s+=[S0]
awlist=[0 for i in range(N)]
walist=[0 for i in range(N)]
wacount=0
account=0
for i in range(M):
  if s[i]=='WA' and awlist[p[i]]==0:
    walist[p[i]]+=1
  elif s[i]=='AC' and awlist[p[i]]==0:
    account+=1
    awlist[p[i]]=1
    wacount+=walist[p[i]]
Answer=[account,wacount]
print(*Answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
def sn(a,n):
  c=0
  for i in a:
    if i<n:
      c+=1
  return c
def comb(n):
  k=1
  if n<=1:
    return 1
  for i in range(1,n+1):
    k=k*i
  return k
def numberorder(a):
  s={1,2,3,4,5,6,7,8}
  c=0
  for p in range(8):
    c+=(sn(s,a[p]))*comb(7-p)
    s=s-{a[p]}
  return c
P_num=numberorder(P)
Q_num=numberorder(Q)
print(abs(P_num-Q_num))

Fixed submission:
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
def sn(a,n):
  c=0
  for i in a:
    if i<n:
      c+=1
  return c
def comb(n):
  k=1
  if n<=1:
    return 1
  for i in range(1,n+1):
    k=k*i
  return k
def numberorder(a,n):
  s=set({})
  for i in range(1,n+1):
    s=s|{i}
  c=0
  for p in range(n):
    c+=(sn(s,a[p]))*comb(n-1-p)
    s=s-{a[p]}
  return c
P_num=numberorder(P,N)
Q_num=numberorder(Q,N)
print(abs(P_num-Q_num))
Buggy python submission (verdict: Runtime Error):
import math
t=0
X=int(input())
while True:
  t=0
  for i in range(2,math.ceil((X)**(1/2))+1):
    if X%i==0:
      break
    else:
      t+=1
  if t=math.ceil((X)**(1/2))-1:
    break
  X+=1
print(X)


Fixed submission:
import math
t=0
X=int(input())
while True:
  if X==2:
    break
  t=0
  for i in range(2,math.ceil((X)**(1/2))+1):
    if X%i==0:
      break
    else:
      t+=1
  if t==math.ceil((X)**(1/2))-1:
    break
  X+=1
print(X)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T[i]="o"
print(c)

Fixed submission:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i]+"o"+T[i+1:]
print(c)

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x==r:
    c+=P
  elif x==s:
    c+=R
  else:
    c+=S
  return c
for i in range(len(T)):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
print(c)

Fixed submission:
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=str(input())
c=int(0)
def get(x,c):
  if x=="r":
    c+=P
  elif x=="s":
    c+=R
  else:
    c+=S
  return c
n=len(T)
for i in range(n):
  if i<=K-1:
    c=get(T[i],c)
  else:
    if T[i-K]!=T[i]:
      c=get(T[i],c)
    if T[i-K]!="o" and T[i-K]==T[i]:
      T=T[:i]+"o"+T[i+1:]
print(c)
Buggy python submission (verdict: Runtime Error):
N=int(input())
c5=0
c2=0
if N%2==0:
  print(0)
else:
  Nlis=[2i for i in range(1,int(N/2)+1)]
  while(Nlis!=[0 for i in range(N)]):
    for i in range(N):
      if Nlis[i]%2==0:
        c2+=1
        Nlis[i]=Nlis[i]//2
      else:
        Nlis[i]=0
  Nlis=[2i for i in range(1,int(N/2)+1)]
  while(Nlis!=[0 for i in range(N)]):
    for i in range(N):
      if Nlis[i]%5==0:
        c5+=1
        Nlis[i]=Nlis[i]//5
      else:
        Nlis[i]=0


Fixed submission:
N=int(input())
def fact(N,k):
  t=0
  c=0
  while(k**t<N):
    t=t+1
  for i in range(1,t+1):
    c+=N//(k**i)
  return c
if N%2!=0:
  print(0)
else:
  c2=fact(N//2,2)
  c5=fact(N//2,5)
  print(min(c2,c5))
Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
Min=N/1.08
Max=(N+1)/1.08
Mi=int(math.ceil(Min))
Ma=int(math.floor(Max))
if Ma<Mi:
  print(":(")
else:
  print(Mi)

Fixed submission:
M1,D1=map(int,input().split())
M2,D2=map(int,input().split())
if M2==M1+1:
  print(1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
x=min(10**9,int((X-B)/A)+1)
for  i in range(x):
  d=len(str(x-i))
  if A*(x-i)+B*d<=X:
    ans=x-i
    break
  if i==x-1:
    ans=0
print(ans)

Fixed submission:
S=str(input())
list=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(7):
  if S==list[i]:
    print(7-i)

Buggy python submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
X=min(10**9,((X-B)//A)+1)
for  i in range(X):
  d=len(str(X-i))
  if A*(X-i)+B*d<=X:
    ans=X-i
    break
  if i==X-1:
    ans=0
print(ans)


Fixed submission:
S=str(input())
list=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(7):
  if S==list[i]:
    print(7-i)

Buggy python submission (verdict: Runtime Error):
A,B,X=map(int,input().split())
X=min(10**9,(X-B)//A+1)
for  i in range(X):
  d=len(str(X-i))
  if A*(X-i)+B*d<=X:
    ans=X-i
    break
  if i==X-1:
    ans=0
print(ans)

Fixed submission:
S=str(input())
list=["SUN","MON","TUE","WED","THU","FRI","SAT"]
for i in range(7):
  if S==list[i]:
    print(7-i)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list=[]
for t in range(1,N+1):
  if N%t==0:
    list+=[(t,int(N/t))]
mini=N+1
for (p,q) in list:
  if p+q<mini:
    mini=p+q
print(mini-2)

Fixed submission:
N=int(input())
list=[]
for t in range(1,int(N**(1/2)+2)):
  if N%t==0:
    list+=[(t,int(N/t))]
mini=N+1
for (p,q) in list:
  if p+q<mini:
    mini=p+q
print(mini-2)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
counter=0
for t in range(1,N-1):
  for i in range(0,t):
    for p in range(t+1,N):
      if L[i]<L[t]+L[p] and L[p]<L[i]+L[t] and L[t]<L[i]+L[p]:
        counter+=1
print(counter)

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

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
L=list(map(int,input().split()))
counter=0
for t in range(N):
  for i in range(t+1,N):
    for p in range(i+1,N):
      if L[p]<L[t]+L[i] and L[t]<L[i]+L[p] and L[i]<L[p]+L[t]:
        counter+=1
print(counter)

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

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
counter=0
for t in range(N):
  for i in range(t+1,N):
    for p in range(i+1,N):
      if L[p]<L[t]+L[i] and L[t]<L[i]+L[p] and L[i]<L[p]+L[t]:
        counter+=1
print(counter

Fixed submission:
import bisect
counter=0
N=int(input())
L=sorted(list(map(int,input().split())))
for a in range(N-2):
  for b in range(a+1,N-1):
    k=bisect.bisect_left(L,L[a]+L[b])
    counter+=k-b-1
print(counter)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]
for i in range(N):
  ans[i]=(A.index(i+1))+1
print(*ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
Answer=[0 for i in range(N)]
for t in range(N):
  Answer[A[t]-1]=t+1
print(*Answer)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(str,input().split()))
ans=[o for i in range(N)]
for i in range(N):
  ans[i]=A.index("i")
print(*ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
Answer=[0 for i in range(N)]
for t in range(N):
  Answer[A[t]-1]=t+1
print(*Answer)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input(),split())
print((B-1)//A+1)

Fixed submission:
A,B=map(int,input().split())
if (B-1)%(A-1)==0:
  print((B-1)//(A-1))
else:
  print((B-1)//(A-1)+1)
Buggy python submission (verdict: Runtime Error):
n,d=input().split()
N=int(n)
D=int(d)
if N%(2*D+1)==0:
  print(N//(2*D+1))
else:
  print(N//(2*D+1)+1)

Fixed submission:
r=int(input())
print(3*(r**2))

Buggy python submission (verdict: Runtime Error):
A=input()
print(3*A**2)

Fixed submission:
r=int(input())
print(3*(r**2))
Buggy python submission (verdict: Runtime Error):
S=input().split()
L=int(S[0])
R=int(S[1])
list=2018
L1=L
L2=L
while list <> 1:  
  while L2 <= R:
    while L1 < L2:
      if (L1*L2)%2019 <= list:
        list = (L1*L2)%2019
      L1 += 1
    L1 =int(L)
    L2 += 1
print(list)

Fixed submission:
S=[int (i) for i in input().split()]
N=S[0]
A=S[1]
B=S[2]
TRAIN=A*N
BUS=B
if TRAIN > BUS:
  print(BUS)
else:
  print(TRAIN)
Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(input().split())
NL=sorted(L)
P=int(NL[int(N/2)-1])
Q=int(NL[int(N/2)])
print(Q+1-P)

Fixed submission:
S=input()
L=[str(c) for c in S]
if L[0]==L[1]==L[2]==L[3]:
  print("No")
elif L[0] ==L[1]:
  if L[2]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[2]:
  if L[1]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[3]:
  if L[1]==L[2]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(input().split())
NL=sorted(L)
P=int(NL[int(N/2)-1])
Q=int(NL[int(N/2)])
print(Q+1-P)

Fixed submission:
S=input()
L=[str(c) for c in S]
if L[0]==L[1]==L[2]==L[3]:
  print("No")
elif L[0] ==L[1]:
  if L[2]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[2]:
  if L[1]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[3]:
  if L[1]==L[2]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
L=list(input().split())
NL=sorted(L)
P=int(NL[int(N/2)-1])
Q=int(NL[int(N/2)])
print(Q+1-P)
print(L[1])

Fixed submission:
S=input()
L=[str(c) for c in S]
if L[0]==L[1]==L[2]==L[3]:
  print("No")
elif L[0] ==L[1]:
  if L[2]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[2]:
  if L[1]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[3]:
  if L[1]==L[2]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
r,D,x = [int(i) for i in input().split()]
n=2000
X=r*x-D
x=X
while n <=2010: 
  print(x) 
  X=r*x-D
  x=X
  n=n+1
        

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

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)

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

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A>=13: print(B)
elif A>=6: print(B/2)
else : print (0)

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

Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)

Fixed submission:
A,B =map(int,input().split())
if A>=13: print(B)
elif A>=6: print(int(B/2))
else : print (0)
Buggy python submission (verdict: Runtime Error):
N=int(inout())
L=list(map(int,input().split()))
T=0
for i in range(N):
  T+=L[i]  
if max(L)>T-max(L):
  print("Yes")
else:
  print("No")
  


Fixed submission:
N=int(input())
L=list(map(int,input().split()))
T=0
for i in range(N):
  T+=L[i]  
if max(L)<T-max(L):
  print("Yes")
else:
  print("No")