Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=[0]
x=0
for i in a:
    x+=i
    s.append(x)
x=0
for i in range(n+1):
    x+=s[i+1:].count(s[i])
print(x)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
s=[0]
x=0
for i in a:
    x+=i
    s.append(x)
cs=Counter(s).most_common()
x=0
for i,j in cs:
    x+=j*(j-1)//2
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
l=[]
for i in range(int(input())):
    n=int(input())
    x=bisect.bisect_left(l,n)
    if x==len(l):l.append(n)
    elif l[x]==n:l.remove(n)
    else:l.insert(x,n)
print(len(l))

Fixed submission:
from collections import Counter
l=[int(input()) for i in range(int(input()))]
ca=Counter(l).most_common()
x=0
for i,j in ca:
    if j%2==1:x+=1
print(x)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
a=[]
for i in range(n):a.append(int(input()))
while len(a)>1:
    j=a.pop()
    k=a.pop()
    a.append(j*k//math.gcd(j,k))
print(a[0])

Fixed submission:
import fractions
n=int(input())
a=[]
for i in range(n):a.append(int(input()))
while len(a)>1:
    j=a.pop()
    k=a.pop()
    a.append(j*k//fractions.gcd(j,k))
print(a[0])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
s=[]
g=[]
for i in range(m):
    a,b=map(int,input().split())
    if a==1:s.append(b)
    elif b==1:s.append(a)
    elif a==n:g.append(b)
    elif b==n:g.append(a)
for i in s:
    if i in g:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
n,m=map(int,input().split())
s=[]
for i in range(m):
    a,b=map(int,input().split())
    if a==1 or a==n:s.append(b)
    elif b==1 or b==n:s.append(a)
ls=len(s)
s=list(set(s))
if ls==len(s):print("IMPOSSIBLE")
else:print("POSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
b=[0]
for i in range(n):
    b.append(int(input()))
x=1
r=[1]
while 1:
    i=b[x]
    if i==2:
        print(len(r))
        break
    elif i in r:
        print(-1)
        break
    x=i
    r.append(i)

Fixed submission:
n=int(input())
a=[]
for i in range(n):a.append(int(input()))
x=1
for i in range(n):
    x=a[x-1]
    if x==2:
        print(i+1)
        break
else:print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
b=[0]
for i in range(n):
    b.append(int(input()))
x=1
r=[0]
while 1:
    i=b[x]
    if i==2:
        print(len(r))
        break
    elif i in r:
        print(-1)
        break
    x=i
    r.append(i)

Fixed submission:
n=int(input())
a=[]
for i in range(n):a.append(int(input()))
x=1
for i in range(n):
    x=a[x-1]
    if x==2:
        print(i+1)
        break
else:print(-1)
Buggy python submission (verdict: Runtime Error):
n=input()
l=list(map(int,input().split()))
c=[0]*9
for i in l:c[i//400]+=1
mi=0
for i in range(8):
    if c[i]>0:mi+=1
print(max(mi,1),mi+c[8])

Fixed submission:
n=input()
l=list(map(int,input().split()))
c=[0]*8
ma=0
for i in l:
    if i<3200:c[i//400]=1
    else:ma+=1
mi=sum(c)
print(max(mi,1),mi+ma)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:print("H")
else:print("D")   

Fixed submission:
a,b=map(str,input().split())
if a==b:print("H")
else:print("D")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
for i in range(n):
    s=input()
    print(s)
    print(s)

Fixed submission:
h,w=map(int,input().split())
for i in range(h):
    s=input()
    print(s)
    print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
th,ah=1,1
for i in range(n):
    t,a=map(int,input().split())
    while 1:
        if th*a>ah*t:ah+=1
        elif th*a<ah*t:th+=1
        elif th*a==ah*t:break
print(th+ah)

Fixed submission:
n=int(input())
th,ah=1,1
for i in range(n):
    t,a=map(int,input().split())
    n=max((th+t-1)//t,(ah+a-1)//a)
    th,ah=n*t,n*a
print(th+ah)
Buggy python submission (verdict: Time Limit Exceeded):
x=input()
while "S"*10+"T"*10 in x:x=x.replace("S"*10+"T"*10,"")
while "ST" in x:x=x.replace("ST","")
print(len(x))

Fixed submission:
l=[]
for i in input():
    if i=="S":l.append("S")
    elif len(l)==0 or l[-1]=="T":l.append("T")
    else:l.pop()
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
x=input()
while "SSSSSTTTTT" in x:x=x.replace("SSSSSTTTTT","")
while "ST" in x:x=x.replace("ST","")
print(len(x))

Fixed submission:
l=[]
for i in input():
    if i=="S":l.append("S")
    elif len(l)==0 or l[-1]=="T":l.append("T")
    else:l.pop()
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
x=input()
while "SSTT" in x:x=x.replace("SSTT","")
while "ST" in x:x=x.replace("ST","")
print(len(x))

Fixed submission:
l=[]
for i in input():
    if i=="S":l.append("S")
    elif len(l)==0 or l[-1]=="T":l.append("T")
    else:l.pop()
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
x=input()
while "ST" in x:x=x.replace("ST","")
print(len(x))

Fixed submission:
l=[]
for i in input():
    if i=="S":l.append("S")
    elif len(l)==0 or l[-1]=="T":l.append("T")
    else:l.pop()
print(len(l))
Buggy python submission (verdict: Runtime Error):
s=input()
l=[]
for i in s:l.append((123-ord(i))%26)
k=int(input())
for i,j in enumerate(l):
    if j<=k:l[i],k=26,k-j
l[-1]=(l[-1]-k)+[0,26][l[-1]-k<1]
for i,j in enumerate(l):l[i]=chr(123-j)
print(''.join(map(str,l)))

Fixed submission:
s=input()
l=[]
for i in s:l.append((123-ord(i))%26)
k=int(input())
for i,j in enumerate(l):
    if j<=k:l[i],k=26,k-j
l[-1]=(l[-1]-k%26)+[0,26][l[-1]-k%26<1]
for i,j in enumerate(l):l[i]=chr(123-j)
print(''.join(map(str,l)))
Buggy python submission (verdict: Runtime Error):
sa=input()
sb=input()
sc=input()
i=sa[0]
sa=sa[1:]
while 1:
    if i=="a":i,sa=sa[0],sa[1:]
    elif i=="b":i,sb=sb[0],sb[1:]
    elif i=="c":i,sc=sc[0],sc[1:]
    if i=="a" and sa=="":
        print("A")
        break
    elif i=="b" and sb=="":
        print("B")
        break
    elif i=="c" and sc=="":
        print("C")
        break

Fixed submission:
a=list(input().replace("a",""))
b=list(input().replace("b",""))
c=list(input().replace("c",""))
t=0
while 1:
    if t==0:
        if len(a)==0:
            print("A")
            break
        else:
            t=ord(a.pop(0))-97
    elif t==1:
        if len(b)==0:
            print("B")
            break
        else:
            t=ord(b.pop(0))-97
    elif t==2:
        if len(c)==0:
            print("C")
            break
        else:
            t=ord(c.pop(0))-97
Buggy python submission (verdict: Runtime Error):
if __name__ == "__main__":
    n,a,b = input(),input(),input()
    print (max(n*a,b))


Fixed submission:
n,a,b = map(int,input().split())

print(min(n*a,b))

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input.split())
if a*n < b:
    print(a*n)
else:
    print(b)

Fixed submission:
n,a,b = map(int,input().split())
if a*n < b:
    print(a*n)
else:
    print(b)
Buggy python submission (verdict: Runtime Error):
n,*p=map(int,open(0).read().split())
print(int(sum(p)-max(p)/2))

Fixed submission:
print('Christmas'+' Eve'*(25-int(input())))
Buggy python submission (verdict: Runtime Error):
a,b,c = list(map(input().split()))
print(min(a*b, c))


Fixed submission:
a,b,c = list(map(int, input().split()))

print(min(a*b, c))
Buggy python submission (verdict: Runtime Error):
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))
 
a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    for i in range(c//2):
        b.append(ai)
    if (len(b)>=4):
        break
 
if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Fixed submission:
# Meal Delivery
x,a,b, = list(map(int, input().split()))

if ( abs(a-x) < abs(b-x) ):
    print("A")
else:
    print("B")
Buggy python submission (verdict: Runtime Error):
#Make a Rectangle
N = int(input())
A = list(map(int, input().split())

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-2:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>=2):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Fixed submission:
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-1:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>1):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Buggy python submission (verdict: Time Limit Exceeded):
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))
 
a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    for i in range(c//2):
        b.append(ai)
    if (len(b)>=4):
        break
 
if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Fixed submission:
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-1:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>1):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Buggy python submission (verdict: Time Limit Exceeded):
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    b += [ai]*(c//2)
    if (len(b)>=4):
        break
if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Fixed submission:
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-1:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>1):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])

Buggy python submission (verdict: Time Limit Exceeded):
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(list(set(A)), reverse=True)
b = []
for ai in a:
    c = A.count(ai)
    b += [ai]*(c//2)
    if (len(b)>=4):
        break
b+=[0,0]

print(b[0]*b[1])

Fixed submission:
#Make a Rectangle
N = int(input())
A = list(map(int, input().split()))

a = sorted(A, reverse=True)
b = []

i = 0
while i<N-1:
    if ( a[i]==a[i+1] ):
        b+=[a[i]]
        i+=2
    else:
        i+=1
    if (len(b)>1):
        break

if (len(b)<2):
    print(0)
else:
    print(b[0]*b[1])
Buggy python submission (verdict: Time Limit Exceeded):
# Splitting Pile
N = int(input())
a = list(map(int, input().split()))

s = [abs(sum(a[:i+1])-sum(a[i+1:])) for i in range(N-2)] 
if len(a)==2:
    print(abs(a[0]-a[1]))
else:
    print(min(s))

Fixed submission:
# Splitting Pile
N = int(input())
a = list(map(int, input().split()))
 
s = [sum(a[1:]) - a[0]]
for i in range(N-2):
    s.append( s[i]- 2*a[i+1] )
a = list(map(abs, s))
print(min(a))
Buggy python submission (verdict: Runtime Error):
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

#奇数の数
k = 0
for a in A:
    if a%2 ==1:
        k+=1

if ( k ==0 ):
    ans = int(p==0)
else:
    ans = 2**(N-1)
print(ans)

Fixed submission:
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

#奇数の数
k = 0
for a in A:
    k += a%2
if ( k ==0 ):
    ans = (3-P)%2 * 2**N
else:
    ans = 2**(N-1)
print(ans)

Buggy python submission (verdict: Runtime Error):
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

#奇数の数
k = sum([A[i]%2 for i in range(N)])

if ( k ==0 ):
    ans = int(p==0)
else:
    ans = 2**(N-1)
print(ans)

Fixed submission:
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

#奇数の数
k = 0
for a in A:
    k += a%2
if ( k ==0 ):
    ans = (3-P)%2 * 2**N
else:
    ans = 2**(N-1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

import numpy as np

a = np.array(A)
f = 2**N-1
cnt = 0
for i in range(2**N):
    ff = np.array(list(map(int,list(format(f,'b').zfill(N)))))
    s = np.sum(ff * a)
    if ( s%2 == P ):
        cnt+=1
    f-=1
print (cnt)


Fixed submission:
#Biscuits

N,P = list(map(int, input().split()))
A = list(map(int, input().split()))

#奇数の数
k = 0
for a in A:
    k += a%2
if ( k ==0 ):
    ans = (3-P)%2 * 2**N
else:
    ans = 2**(N-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):s
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(c-cnt) + " " + str(c))

Fixed submission:
#RGB card
import numpy as np
r,g,b = list(map(int, input().split()))
if((100*r+10*g+b)%4==0):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
#Traveling AtCoDeer Problem
import numpy as np
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))

Fixed submission:
#RGB card
import numpy as np
r,g,b = list(map(int, input().split()))
if((100*r+10*g+b)%4==0):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):s
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(c-cnt) + " " + str(c))

Fixed submission:
#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(max([1,c-cnt])) + " " + str(c))

Buggy python submission (verdict: Runtime Error):
#Colorful Leaderboard
import numpy as np
import math as m
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):s
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(c-cnt) + " " + str(c))

Fixed submission:
#Colorful Leaderboard
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
b = sorted (a//400)
cnt = 0
for i in range(len(b)):
    if b[i]  < 8:
        None
    else:
        b[i]+=i
        cnt+=1
c = len(list(set(b)))

print(str(max([1,c-cnt])) + " " + str(c))
Buggy python submission (verdict: Runtime Error):
# Widespread
n,a,b = list(map(int, input().split()))
h = []
for i in range(n):
    h.append(int(input()))

import math

sup = sum([hh // a + 1 for hh in h])
inf = 1
 
while sup - inf > 1:
    x = (sup + inf) // 2
    c = sum([math.ceil((hh - x * b)/(a-b)) for hh in h if hh > x * b])
    if c <= x:
        sup = x
    else:
        inf = x
 
print(sup)

Fixed submission:
#Restricted

a,b = list(map(int, input().split()))

if ( a+b >9 ):
    print("error")
else:
    print(a+b)
Buggy python submission (verdict: Time Limit Exceeded):
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

import numpy as np

ss = sorted(s ,reverse=True)
l  = len(s)
f = 2**l-1
for i in range(2**l):
    ff = list(map(int,list(format(f,'b').zfill(3))))
    a = np.sum(np.array(ff)*np.array(ss))
    if ( a%10!=0 or a==0):
        print(a)
        break
    f-=1

Fixed submission:
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

a = []
for ss in s:
    if ( ss%10!=0 ):
        a.append(ss)
ssum = sum(s)
if ( ssum%10!=0 ):
    print(ssum)
else:
    if ( len(a)==0 ):
        print(0)
    else:
        print(ssum-min(a))

Buggy python submission (verdict: Time Limit Exceeded):
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

    import numpy as np

ss = sorted(s ,reverse=True)
l  = len(s)
f = 2**l-1
for i in range(2**l):
    ff = list(map(int,list(format(f,'b').zfill(3))))
    a = np.sum(np.array(ff)*np.array(ss))
    if ( a%10!=0 or a==0):
        print(a)
        break
    f-=1

Fixed submission:
# Bugged

n = int(input())
s = []
for i in range(n):
    s.append(int(input()))

a = []
for ss in s:
    if ( ss%10!=0 ):
        a.append(ss)
ssum = sum(s)
if ( ssum%10!=0 ):
    print(ssum)
else:
    if ( len(a)==0 ):
        print(0)
    else:
        print(ssum-min(a))
Buggy python submission (verdict: Time Limit Exceeded):
# Big Array
n,k =  list(map(int, input().split()))

A1 = []
for i in range(n):
    a,b = list(map(int, input().split())) 
    A1.append([a]*b)

A2 = []
for s in A1:
    A2.extend(s)
print( sorted(A2)[k-1] )

Fixed submission:
# Big Array
n,k =  list(map(int, input().split()))

A = []
for i in range(n):
    a,b = list(map(int, input().split())) 
    A.append([a,b])
    
A.sort(key=lambda x:x[0])

cnt = 0
for i in range(n):
    cnt += A[i][1]
    if ( cnt >= k ):
        print(A[i][0])
        break
Buggy python submission (verdict: Runtime Error):
#Shiritori

a,b,c = input().split()

if ( a[-1]==b[0] and b[-1]==c[0] ):
    print("YES")
else:
    prtin("NO")

Fixed submission:
#Shiritori
a,b,c = input().split()

if ( a[-1]==b[0] and b[-1]==c[0] ):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ans = ""
ls = sorted(s[0])
for l in ls:
    if ( sum([l in s[i+1] for i in range(n-1)])//(n-1) ) :
        ans += l
        ls = ls[1:]
print(ans)        

Fixed submission:
# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ls = sorted(list(set(s[0])))
ans = ""
for l in ls:
    cnt = min ([s[i].count(l) for i in range(n)] )
    ans += l*cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ans = ""
ls = sorted(s[0])
for l in ls:
    if ( sum([l in s[i+1] for i in range(n-1)])//(n-1) ) :
        print(l)
        ans += l
        ls = ls[1:]
print(ans)        

Fixed submission:
# 怪文書 / Dubious Document
n = int(input())
s=[]
for i in range(n):
    s.append(input())
ls = sorted(list(set(s[0])))
ans = ""
for l in ls:
    cnt = min ([s[i].count(l) for i in range(n)] )
    ans += l*cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
n,x=list(map(int,input().split()))
l=list(map(int,input().split()))
d=0
for i in range(n):
  d+=l[i]
  if d>x:
    print(i+1)
    break
else:
  print(n+1)

Fixed submission:
x,a=list(map(int,input().split()))
if x<a:
  print(0)
else:
  print(10)
Buggy python submission (verdict: Runtime Error):
W,H,x,y=list(map(int,input().split()))
print(W,H,x,y)
if x==W/2 and y=H/2:
  print("{:.6f} 1".format(W*H/2))
else:
  print("{:.6f} 0".format(W*H/2))


Fixed submission:
W,H,x,y=list(map(float,input().split()))
if x==W/2 and y==H/2:
  print("{:.6f} 1".format(W*H/2))
else:
  print("{:.6f} 0".format(W*H/2))
Buggy python submission (verdict: Runtime Error):
N=int(input().strip())

xyh=[]
for i in range(N):
    xi,yi,hi = map(int, input().split(' '))
    if hi>0:
        xyh.append([xi,yi,hi])

fl=False
for ny in range(101):
    for nx in range(101):
        nh=abs(xyh[0][0]-nx)+abs(xyh[0][1]-ny)+xyh[0][2]
        nh=max(nh,0)
        fl=True
        for i in range(len(xyh)):
                if nh!=max(0,abs(xyh[i][0]-nx)+abs(xyh[i][1]-ny)+xyh[i][2]):
                    fl=False
        if fl:
            ax=nx
            ay=ny
            ah=nh

print("{} {} {}".format(ax,ay,ah))


Fixed submission:
N=int(input().strip())
if N==1:
    print('Hello World')
elif N==2:
    A=int(input().strip())
    B=int(input().strip())
    print(A+B)

Buggy python submission (verdict: Runtime Error):
N=int(input().strip())

xyh=[]
for i in range(N):
    xi,yi,hi = map(int, input().split(' '))
    if hi>0:
        xyh.append([xi,yi,hi])

fl=False
for ny in range(101):
    for nx in range(101):
        nh=abs(xyh[0][0]-nx)+abs(xyh[0][1]-ny)+xyh[0][2]
        nh=max(nh,0)
        fl=True
        for i in range(len(xyh)):
                if nh!=max(0,abs(xyh[i][0]-nx)+abs(xyh[i][1]-ny)+xyh[i][2]):
                    fl=False
        if fl:
            ax=nx
            ay=ny
            ah=nh

print("{} {} {}".format(ax,ay,ah))


Fixed submission:
N=int(input().strip())
if N==1:
    print('Hello World')
elif N==2:
    A=int(input().strip())
    B=int(input().strip())
    print(A+B)

Buggy python submission (verdict: Runtime Error):
ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=10000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)

Fixed submission:
N=int(input().strip())
if N==1:
    print('Hello World')
elif N==2:
    A=int(input().strip())
    B=int(input().strip())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=10000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)

Fixed submission:
N, T=map(int,input().strip().split(' '))

ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=100000000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)

Buggy python submission (verdict: Runtime Error):
ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=100000000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)

Fixed submission:
N, T=map(int,input().strip().split(' '))

ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=100000000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().strip().split())

for i in range(M//N,0,-1):
    if M%i==0:
        print(i)
        break

Fixed submission:
import math
N, M = map(int, input().strip().split())
st= min(M//N,int(math.sqrt(M)))
cand=0
if M//N <= int(math.sqrt(M)):
    for i in range(M//N,0,-1):
        if M%i==0:
            print(i)
            break
else:
    for i in range(1,int(math.sqrt(M)),1):
        if M%i==0:
            if M//N >= i:
                cand=max(cand,i)
            if M//N >= M//i:
                cand=max(cand,M//i)
    print(cand)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().strip().split())

for i in range(M//N,-1,-1):
    if M%i==0:
        print(i)
        break

Fixed submission:
import math
N, M = map(int, input().strip().split())
st= min(M//N,int(math.sqrt(M)))
cand=0
if M//N <= int(math.sqrt(M)):
    for i in range(M//N,0,-1):
        if M%i==0:
            print(i)
            break
else:
    for i in range(1,int(math.sqrt(M)),1):
        if M%i==0:
            if M//N >= i:
                cand=max(cand,i)
            if M//N >= M//i:
                cand=max(cand,M//i)
    print(cand)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input().strip())
a=list(map(int, input().strip().split(' ')))
for i in range(N):
    a[i]=a[i]-(i+1)
b=sum(a)/N
ans1=0
ans2=0
for i in range(N):
    ans1+=abs(a[i]-math.floor(sum(a)/N))
for i in range(N):
    ans2+=abs(a[i]-math.ceil(sum(a)/N))


print(min(ans1,ans2))

Fixed submission:
N=int(input().strip())
a=list(map(int, input().strip().split(' ')))
for i in range(N):
    a[i]=a[i]-i
a.sort()
m=a[(N-1)//2]
ans=0
for i in range(N):
    ans+=abs(a[i]-m)
print(ans)