Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = a*k
cnt = 0
for i in range(len(b)-1):
  for j in range(i+1,len(b)):
    if b[i] > b[j]:
      cnt += 1
x = 10**9 + 7
print(cnt%x)

Fixed submission:
import sys
input = sys.stdin.readline

n,k = map(int,input().split())
a = list(map(int,input().split()))
cnt1 = 0
for i in range(n-1):
  for j in range(i+1,n):
    if a[i] > a[j]:
      cnt1 += 1
cnt1 = cnt1*k

cnt2 = 0
for l in range(n):
  for m in range(n):
    if a[l] > a[m]:
      cnt2 += 1
cnt2 = cnt2*k*(k-1)//2

cnt = cnt1 + cnt2

x = 10**9 + 7
print(int(cnt%x))
Buggy python submission (verdict: Runtime Error):
n,q = map(int,input().split())
a,b = [],[]
for i in range(n-1):
    a1,b1=[int(i) for i in input().split()]
    a.append(a1)
    b.append(b1)
p,x = [],[]
for j in range(q):
    p1,x1=[int(j) for j in input().split()]
    p.append(p1)
    x.append(x1)
    
z = [0]*n
for k in range(q):
  z[p[k]-1] = z[p[k]-1] + x[k]
for l in range(n-1):
  z[b[l]-1] = z[b[l]-1] + z[a[l]-1]    
print(*z)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")
Buggy python submission (verdict: Runtime Error):
a,b = int(input().split())
list = [a+b,a-b,a*b]
print(max(list))


Fixed submission:
a,b = map(int,input().split())
list = [a+b,a-b,a*b]
print(max(list))

Buggy python submission (verdict: Runtime Error):
a,b = int(input().split())
print(max(a+b,a-b,a*b))


Fixed submission:
a,b = map(int,input().split())
list = [a+b,a-b,a*b]
print(max(list))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(max(a+b,a-b,a*b))

Fixed submission:
a,b = map(int,input().split())
list = [a+b,a-b,a*b]
print(max(list))
Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().split())
c = list(range(k-x+1,k+x)) 
print(" ".join([n for n in c]))

Fixed submission:
k,x = map(int,input().split())
for i in range(x-k+1,x+k):
    print(i,end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[list(input()) for _ in range(n)]

for i in range(n):
  s[i].sort()

count=0
for i in range(n-1):
  for j in range(i+1,n):
    if s[i]==s[j]:
      count+=1
      
print(count)


Fixed submission:
n=int(input())
s=[''.join(sorted(list(input()))) for _ in range(n)]
s.sort()
t=list(sorted(set(s)))

count=[1]*len(t)
j=0
for i in range(1,n):
  if t[j]==s[i]:
    count[j]+=1
  else:
    j+=1

ans=0
for i in range(len(t)):
  ans+=((count[i])*(count[i]-1))//2
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(len(n)):
  if len(str(i))%2 == 1:
    count += 1
print(count)


Fixed submission:
n = int(input())
count = 0
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.append(0)
count = 0
for i in range(n+1):
  if a[i] >= b[i]:
    count += b[i]
  else:
    count += b[i]
    a[i+1] = a[i+1] - b[i] + a[i]
print(count) 

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.append(0)
count = 0
for i in range(n+1):
  if a[i] >= b[i]:
    count += b[i]
  else:
    if a[i] + a[i+1] > b[i]:
      count += b[i]
      a[i+1] = a[i+1] - b[i] + a[i]
    else:
      count += a[i] + a[i+1]
      a[i+1] = 0
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
L,R = map(int,input().split())
x = np.arange(L,R+1)
m = sorted(np.mod(x,2019))
print(m[0]*m[1])

Fixed submission:
L,R = map(int,input().split())
if R - L >= 672:
  print(0)
else:
  l = L%2019
  r = R%2019
  if l > r:
    print(0)
  else:
    a = 2018
    for i in range(l,r):
      for j in range(i+1,r+1):
        a = min((i*j)%2019,a)
        if a == 1:
          print(a)
          exit()
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  a=list(map(int,input().split()))
  ans=[0]*n
  ans[0]=sum([a[i]*(-1)**i for i in range(n)])
  for i in range(1,n):
    ans[i]=sum((a[j]*(-1)**(i+j+1) if j<i else a[j]*(-1)**(i+j) for j in range(n)))
  print(*ans)
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=int(input())
  a=list(map(int,input().split()))
  ans=[0]*n
  ans[0]=sum([a[i]*(-1)**i for i in range(n)])
  for i in range(1,n):
    ans[i]=ans[i-1]*(-1)+2*a[i-1]
  print(*ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
n,mod=n-k+1,pow(10,9)+7

fact,inv,factinv=[0]*(n+1),[0]*(n+1),[0]*(n+1)
fact[0],fact[1]=1,1
inv[1]=1
factinv[0],factinv[1]=1,1

for i in range(2,n+1):
  fact[i]=(fact[i-1]*i)%mod
  inv[i]=mod-(inv[mod%i]*(mod//i))%mod               
  factinv[i]=(factinv[i-1]*inv[i])%mod      
    
def comb(n,r,mod):
  r = min(r,n-r)
  return fact[n] * factinv[r] * factinv[n-r] % mod
  
for i in range(1,k+1):
  ans=comb(n,i,mod)*comb(k-1,i-1,mod)%mod
  print(ans)

Fixed submission:
n,k=map(int,input().split())
mod=pow(10,9)+7

fact,inv,factinv=[0]*(n+1),[0]*(n+1),[0]*(n+1)
fact[0],fact[1],inv[1]=1,1,1
factinv[0],factinv[1]=1,1

for i in range(2,n+1):
  fact[i]=(fact[i-1]*i)%mod
  inv[i]=mod-(inv[mod%i]*(mod//i))%mod               
  factinv[i]=(factinv[i-1]*inv[i])%mod      
    
def comb(n,r,mod):
  if r<0 or n<r:
    return 0
  r=r if r<=n-r else n-r
  return fact[n]*factinv[r]*factinv[n-r]%mod
  
for i in range(1,k+1):
  ans=comb(n-k+1,i,mod)*comb(k-1,i-1,mod)%mod
  print(ans)
Buggy python submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())
s = w*h/2
if x == w/2 and y == h/2:
  print(s,1)
else:
  print(s,0)


Fixed submission:
x,a = map(int,input().split())
if x >= a:
  print(10)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
x,a = mao(int,input())
if x >= a:
  print(10)
else:
  print(0)

Fixed submission:
x,a = map(int,input().split())
if x >= a:
  print(10)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
p,q,r = map(int,input().split())
print(min[p+q,q+r,r+p])


Fixed submission:
import sys
input = sys.stdin.readline
p,q,r = map(int,input().split())
print(min(p+q,q+r,r+p))
Buggy python submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  mod=pow(10,9)+7
  ans=[1]*(n+1)
  for _ in [0]*m:
    ans[int(input())]=0
  ans[2]=ans[1]+1 if ans[2]!=0 else 0
  for i in range(3,n+1):
    if ans[i]>0:
      ans[i]=(ans[i-1]+ans[i-2])%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Fixed submission:
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  mod=pow(10,9)+7
  ans=[1]*(n+1)
  for _ in [0]*m:
    ans[int(input())]=0
  for i in range(n+1):
    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  a=[int(input()) for _ in [0]*m]
  mod=pow(10,9)+7
  ans=[0]*n
  ans[0]=1
  for i in range(n):
    if a.count(i+1)==1:
      ans[i]=0
    else:
      if i==1:
        ans[i]=ans[0]+1
      elif i>1:
        if ans[i-1]==0 and ans[i-2]==0:
          print(0)
          exit()
        ans[i]=(ans[i-1]%mod+ans[i-2]%mod)%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Fixed submission:
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  mod=pow(10,9)+7
  ans=[1]*(n+1)
  for _ in [0]*m:
    ans[int(input())]=0
  for i in range(n+1):
    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  a=[int(input()) for _ in [0]*m]
  mod=pow(10,9)+7
  ans=[0]*n
  ans[0]=1
  for i in range(n):
    if a.count(i+1)==1:
      ans[i]=0
    else:
      if i==1:
        ans[i]=ans[0]+1
      else:
        ans[i]=(ans[i-1]%mod+ans[i-2]%mod)%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Fixed submission:
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  mod=pow(10,9)+7
  ans=[1]*(n+1)
  for _ in [0]*m:
    ans[int(input())]=0
  for i in range(n+1):
    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod
  print(ans[-1])
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  from bisect import bisect_left
  n,m=map(int,input().split())
  a=sorted(list(map(int,input().split())))
  for _ in range(m):
    b,c=map(int,input().split())
    index = bisect_left(a,c)
    b=index if b>=index else b
    a=[c]*b+a[b:]
    a.sort()
  print(sum(a))
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n,m=map(int,input().split())
  a=sorted(list(map(int,input().split())))
  bc=[list(map(int,input().split())) for _ in range(m)]
  for i in range(n):
    bc.append([1,a[i]])
  bc.sort(key=lambda x:x[1],reverse=True)
  ans,cnt=0,0
  for i in range(n):
    ans+=bc[i][0]*bc[i][1]
    cnt+=bc[i][0]
    if cnt>=n:
      ans-=(cnt-n)*bc[i][1]
      break
  print(ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  s=list(input())
  count1,count2,l=0,0,len(s)
  for i in range(l):
    count1=count1+1 if (i%2==0 and int(s[i])==1) or (i%2==1 and int(s[i])==0) else count1
    count2=count2+1 if (i%2==1 and int(s[i])==1) or (i%2==0 and int(s[i])==0) else count2
  print(min(count1,count2))

if __name__=='__main__':
  main()

Fixed submission:
def main():
  s=list(input())
  count1,count2,l=0,0,len(s)
  for i in range(l):
    count1=count1+1 if (i%2==0 and int(s[i])==1) or (i%2==1 and int(s[i])==0) else count1
    count2=count2+1 if (i%2==1 and int(s[i])==1) or (i%2==0 and int(s[i])==0) else count2
  print(min(count1,count2))

if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
b=input()
l=['A','C','G','T']
for i in range(4):
  if b==l[i]:
    print(l[4-i])

Fixed submission:
b=input()
l=['A','C','G','T']
for i in range(4):
  if b==l[i]:
    print(l[3-i])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,q=map(int,input().split())
  s=input()
  lr=[list(map(int,input().split())) for _ in [0]*q]
  for i in range(q):
    print(s[lr[i][0]-1:lr[i][1]].count('AC'))

if __name__=='__main__':
  main()

Fixed submission:
def main():
  n,q=map(int,input().split())
  s=input()
  t = [0] * (n + 1)
  for i in range(n):
    t[i + 1] = t[i] + (1 if s[i : i + 2] == 'AC' else 0)
  for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

if __name__=='__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  import sys
  input = sys.stdin.readline
  n,k=map(int,input().split())
  h=tuple(map(int,input().split()))
  dp=[0]*(n+1)
  for i in range(2,n+1):
    a=min(i-1,k)+1
    dp[i]+=min([dp[i-j]+abs(h[i-1]-h[i-j-1]) for j in range(1,a)])
  print(dp[-1])
if __name__=='__main__':
  main()

Fixed submission:
def main():
  import sys
  input = sys.stdin.readline
  n,k=map(int,input().split())
  h=tuple(map(int,input().split()))
  dp=[0]*(n+1)
  for i in range(2,n+1):
    a=min(i-1,k)+1
    m=float('inf')
    for j in range(1,a):
      x=dp[i-j]+abs(h[i-1]-h[i-j-1])
      m=x if m>=x else m
    dp[i]+=m
  print(dp[-1])
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  n,w=map(int,input().split())
  wv=[tuple(map(int,input().split())) for _ in range(n)]
  dp=[[0]*(w+1) for _ in range(n+1)]
  for i in range(n):
    for j in range(w+1):
      dp[i+1][j]=max(dp[i][j-wv[i][0]]+wv[i][1],dp[i][j]) if j-wv[i][0]>=0 else dp[i][j]
  print(dp[n][w])
if __name__=='__main__':
  main()

Fixed submission:
def main():
  import sys
  input = sys.stdin.readline
  n,W=map(int,input().split())
  w,v=[0]*n,[0]*n
  for i in range(n):
    w[i],v[i]=map(int,input().split())
  v_sum=sum(v)
  dp=[[float('inf')]*(v_sum+1) for _ in range(n+1)]
  dp[0][0]=0
  for i in range(n):
    for j in range(v_sum+1):
      dp[i+1][j]=dp[i][j - v[i]] + w[i] if j - v[i]>=0 else dp[i+1][j]
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=0
  for j in range(v_sum+1):
    if dp[n][j] <= W:
      ans = j
  print(ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
D=int(input())
if D=25:
  print('Christmas')
elif D=24:
  print('Christmas Eve')
elif D=23:
  print('Christmas Eve Eve')
elif D=22:
  print('Christmas Eve Eve Eve')

Fixed submission:
D=int(input())
if D==25:
  print('Christmas')
elif D==24:
  print('Christmas Eve')
elif D==23:
  print('Christmas Eve Eve')
elif D==22:
  print('Christmas Eve Eve Eve')

Buggy python submission (verdict: Runtime Error):
D=int(input())
if D=25:
  print('Christmas')
elif D=24:
  print('Christmas Eve')
elif D=23:
  print('Christmas Eve Eve')
elif D=22:
  print('Christmas Eve Eve Eve')

Fixed submission:
D=int(input())
if D==25:
  print('Christmas')
elif D==24:
  print('Christmas Eve')
elif D==23:
  print('Christmas Eve Eve')
elif D==22:
  print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
A=list(map(int,input89.split()))
A.sort()
print(A[2]-A[0])


Fixed submission:
A=list(map(int,input().split()))
A.sort()
print(A[2]-A[0])
Buggy python submission (verdict: Runtime Error):
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,11):
    if pow(i,j)=<x:
      ans=max(pow(i,j),ans)
print(ans)

Fixed submission:
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,11):
    if pow(i,j)<=x:
      ans=max(pow(i,j),ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=list(map(int,input().split()))
y=sorted(x)
a,b,c=y[n//2-1],y[n//2],y[:n//2]
for i in x:
  print(b if i in c else a)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
y=sorted(x)
a,b=y[n//2-1],y[n//2]
for i in x:
  print(b if i<=a else a)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
l=[i for i in range(a,b+1) if i<a+k or b-k<i]
for j in l:
  print(j)

Fixed submission:
a,b,k=map(int,input().split())
l=sorted(list(set([i for i in range(a,min(a+k,b+1))]+[i for i in range(max(b-k+1,a),b+1)])))
for i in l:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
l=[i for i in range(a,b+1) if i<a+k or b-k<i]
for j in l:
  print(j)

Fixed submission:
a,b,k=map(int,input().split())
l=sorted(list(set([i for i in range(a,min(a+k,b+1))]+[i for i in range(max(b-k+1,a),b+1)])))
for i in l:
  print(i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(x//3)

Fixed submission:
n=int(input())
print(n//3)
Buggy python submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)

Fixed submission:
s1,s2,s3=input().split('/')
s1='2018'
print(s1+'/'+s2+'/'+s3)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(set(a))
l=len(b)
c=[0]*l
for i in range(l):
  c[i]=a.count(b[i])
c=sorted(c)
print(sum(c[:l-k]))

Fixed submission:
import collections
n,k=map(int,input().split())
a = input().split()
a = sorted(list(collections.Counter(a).values()))
print(sum(a[:len(a)-k]))
Buggy python submission (verdict: Runtime Error):
c1=input()
c2=input()
if c1[0]==c2[2],c1[1]==c2[1],c1[2]==c2[0]:
  print('Yes')
else:
  print('No')

Fixed submission:
c1=input()
c2=input()
if c1[0]==c2[2] and c1[1]==c2[1] and c1[2]==c2[0]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import bisect
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in c:
  x=bisect.bisect_left(b,i)
  for j in range(x):
    y=bisect.bisect_left(a,b[j])
    ans+=y
print(ans)

Fixed submission:
import sys
import bisect
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
c.sort()
ans=0
for i in b:
  x=bisect.bisect_left(a,i)
  y=n-bisect.bisect_right(c,i)
  ans+=x*y
print(ans)
Buggy python submission (verdict: Runtime Error):
s=list(input())
t=list(input())
S,T=len(s),len(t)
t=t+['?']
if S<T:
  print('UNRESTORABLE')
  exit()
c,p=[0]*S,s[::-1]
for i in range(T+1):
  if t[i] in p:
    x=S-p.index(t[i])-1
    c[x-i]=1 if all(s[x-i+j]=='?' or s[x-i+j]==t[j] for j in range(T)) else 0
if max(c)==0:
  print('UNRESTORABLE')
  exit()
c=c[::-1]
x,j=S-c.index(1)-1,0
for i in range(S):
  if (i<x or i>x+T-1):
    s[i]='a' if s[i]=='?' else s[i]
  else:
    s[i],j=t[j],j+1
print(''.join(s))

Fixed submission:
s=list(input())
t=list(input())
S,T=len(s),len(t)
t=t+['?']
if S<T:
  print('UNRESTORABLE')
  exit()
count=[0]*S
for i in range(T+1):
  if t[i] in s:
    x=s.index(t[i])
    if all(s[x-i+j]=='?' or s[x-i+j]==t[j] for j in range(T)):
      count[x-i]=1   
if max(count)==0:
  print('UNRESTORABLE')
  exit()
count=count[::-1]
x=count.index(1)
x,j=S-x-1,0
for i in range(S):
  if (i<x or i>x+T-1):
    if s[i]=='?':
      s[i]='a'
  else:
    s[i]=t[j]
    j+=1
print(''.join(s))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  a=[int(input()) for _ in [0]*n]
  print(len([i for i in a if a.count(i)%2==1]))
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=int(input())
  a=sorted([int(input()) for _ in [0]*n])
  a.append(0)
  a=tuple(a)
  cnt,x,ans=0,a[0],0
  for i in a:
    if x==i:
      cnt+=1
    else:
      ans+=1 if cnt%2==1 else 0
      cnt,x=1,i
  print(ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
def main():
  import sys
  input = sys.stdin.readline
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(max(a)+2)
  for i in a:
    cnt[i]+= 1
  print(max(map(sum,zip(cnt,cnt[1:],cnt[2:]))))  
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(pow(10,5)+2)
  for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
  print(max(set(cnt)))   
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=input()
  a=list(map(int,input().split()))
  ap=[i+1 for i in set(a)]
  am=[i-1 for i in set(a)]
  A=set(ap+am+a)
  a=tuple(a)
  count=0
  for i in A:
    x=a.count(i)+a.count(i+1)+a.count(i-1)
    count=x if x>count else count
  print(count)
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(pow(10,5)+2)
  for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
  print(max(set(cnt)))   
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=input()
  a=list(map(int,input().split()))
  ap=[i+1 for i in set(a)]
  am=[i-1 for i in set(a)]
  A=set(ap+am+a)
  count=0
  for i in A:
    x=a.count(i)+a.count(i+1)+a.count(i-1)
    count=x if x>count else count
  print(count)
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(pow(10,5)+2)
  for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
  print(max(set(cnt)))   
if __name__=='__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  a=list(map(int,input().split()))
  ap=[i+1 for i in set(a)]
  am=[i-1 for i in set(a)]
  A=set(ap+am+a)
  count=0
  for i in A:
    x=0
    for j in a:
      x+=1 if i==j or i==j+1 or i==j-1 else 0
    count=max(count,x)
  print(count)
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=input()
  a=tuple(map(int,input().split()))
  cnt=[0]*(pow(10,5)+2)
  for i in a:
    cnt[i-1]+=1
    cnt[i]+=1
    cnt[i+1]+=1
  print(max(set(cnt)))   
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
  print(B)
else:
  print(A)


Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
  print('B')
else:
  print('A')

Buggy python submission (verdict: Runtime Error):
x,a,b=mapt(int,input().split())
if abs(x-a)>abs(x-b):
  print(B)
else:
  print(A)

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
  print('B')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

n=int(input())
t=list(set([int(input()) for _ in range(n)]))
T=max(t)

def f(j):
  for i in t:
    if (T*j)%i!=0:
      return f(j+1)
      break
  return T*j

print(f(1))

Fixed submission:
import fractions
n=int(input())
t=set([int(input()) for _ in range(n)])
ans=1
for i in t:
  ans=(i*ans)//fractions.gcd(i,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(set([int(input()) for _ in range(n)]))
T,l=max(t),len(t)

def f(j):
  for i in range(l):
    if (T*j)%t[i]!=0:
      return f(j+1)
      break
  return T*j

print(f(1))

Fixed submission:
import fractions
n=int(input())
t=set([int(input()) for _ in range(n)])
ans=1
for i in t:
  ans=(i*ans)//fractions.gcd(i,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(set([int(input()) for _ in range(n)]))

def f(j):
  T=max(t)
  for i in range(len(t)):
    if (T*j)%t[i]!=0:
      return f(j+1)
      break
  return T*j

print(f(1))

Fixed submission:
import fractions
n=int(input())
t=set([int(input()) for _ in range(n)])
ans=1
for i in t:
  ans=(i*ans)//fractions.gcd(i,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
t=list(set([int(input()) for _ in range(n)]))

def f(j):
  T=max(t)
  for i in range(len(t)):
    if (T*j)%t[i]!=0:
      j+=1
      return f(j+1)
      break
  return T*j

print(f(1))

Fixed submission:
import fractions
n=int(input())
t=set([int(input()) for _ in range(n)])
ans=1
for i in t:
  ans=(i*ans)//fractions.gcd(i,ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n=int(input())
  a=list(map(int,input().split()))
  ans=float('inf')
  for i in range(1,n):
    ans=min(ans,abs(sum(a[i:])-sum(a[:i])))
  print(ans) 
if __name__=='__main__':
  main()

Fixed submission:
def main():
  n=int(input())
  a=list(map(int,input().split()))
  ans,s,x=abs(sum(a)-2*a[0]),sum(a),a[0]
  for i in range(1,n-1):
    x+=a[i]
    ans=min(ans,abs(s-2*x))
  print(ans)
if __name__=='__main__':
  main()
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split())).sort()
print(l[0]+l[1])


Fixed submission:
l=list(map(int,input().split()))
l.sort()
print(l[0]+l[1])
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
x=a*b,y=c*d
if x>=y:
  print(x)
else:
  print(y)

Fixed submission:
a,b,c,d=map(int,input().split())
x,y=a*b,c*d
if x>=y:
  print(x)
else:
  print(y)