Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

A = int(max(a))
B = [i for i in b if i > A]

B.sort(reverse=True)

Sum = 0

for i in range(len(B)):
    H -= B[i]
    Sum += 1
    if H <= 0:
        break

if H > 0:
    Sum += int((H-1)//A)+1


print(Sum)

Fixed submission:
s=list(str(input()))
s[3]=str(int(s[3])+1)
print("".join(s))

Buggy python submission (verdict: Runtime Error):
n,h=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
   a[i],b[i]=map(int,input().split()) 
x=max((a))
y=[i for i in b if i>x]
y.sort(reverse=True)
count=0
for i in range(len(y)):
    if h>0:
        count+=1
        h-=y[i]
    else:
        break

if h>0:
     count +=int(h//x)+1
print(count)

Fixed submission:
s=list(str(input()))
s[3]=str(int(s[3])+1)
print("".join(s))

Buggy python submission (verdict: Runtime Error):
s=[map(str,input().split())]
s[3]=str(int(s[3])+1)
print("".join(s))



Fixed submission:
s=list(str(input()))
s[3]=str(int(s[3])+1)
print("".join(s))
Buggy python submission (verdict: Runtime Error):
n,h=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n)
a[i],b[i]=map(int,input().split()) 
x=max((a))
y=[i for i in b if i>A]
y.sort(reverse=True)
count=0
for i in range(len(y)):
    if h>0:
        count+=1
        h-=y[i]
    else:
        break
 if h>0:
     count +=int(h//x)+1
print(count)

Fixed submission:
N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

A = int(max(a))
B = [i for i in b if i > A]

B.sort(reverse=True)

Sum = 0

for i in range(len(B)):
    H -= B[i]
    Sum += 1
    if H <= 0:
        break

if H > 0:
    Sum += int((H-1)//A)+1


print(Sum)

Buggy python submission (verdict: Runtime Error):
n,h=map(int,input().split())
l=[[map(int,input().split())] for _ in range(n)]
la=sorted(l,key=lambda x:x[0],reverse=True)
a=l[0][0]
lb=sorted(l,key=lambda x:x[1],reverse=True)
count=0
total=0
for i in lb:
    if i[1]>a:
        count+=1
        total+=i[1]
    else:
        break
print((h-total)//a+1+count

Fixed submission:
N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

A = int(max(a))
B = [i for i in b if i > A]

B.sort(reverse=True)

Sum = 0

for i in range(len(B)):
    H -= B[i]
    Sum += 1
    if H <= 0:
        break

if H > 0:
    Sum += int((H-1)//A)+1


print(Sum)
Buggy python submission (verdict: Runtime Error):
l=input().split()
a,b=map(int,[l[1],l[2]])
n=len(list(l[0]))
total=0
while i in range(1,n+1):
    if a<=i<=b:
        total+=1
        i+=1
else:
    print(total)

Fixed submission:
n,a,b=map(int,input().split())
total=0
i=1
while i in range(1,n+1):
   l=list(str(i))
   ll=[int(s) for s in l]
   if a<=sum(ll)<=b:
        total+=i
        i+=1
   else:
           i=i+1
else:
    print(total)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
n=y//x
m=len(bin(n))-bin(n).rfind("1")-1
print(sum(len(i*m) for i in range(i,m+1)))

Fixed submission:
x,y=map(int,input().split())
n=y//x
print(len(bin(n))-2)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
a=l.find("0")
b=l.rfind("0")
c=l.find("1")
d=l.rfind("1")
x=max(a,n-b-1)
y=max(c,n-b-1)
print(min(x,y,n-a,n-b))

Fixed submission:
s=input()
n=len(s)
ans=n
for i in range(n-1):
    if s[i]!=s[i+1]:
        t=max(i+1,n-i-1)
        ans=min(ans,t)

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
f=[l.count(i) for i in range(1,n+1)]
f.sort()
print(sum(f[0:n-k]))


Fixed submission:
print(input().count("1"))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=list(map(int,input().split()))
f=[l.count(i) for i in range(0,n)]
f.sort()
print(sum(f[0:n-k]))

Fixed submission:
print(input().count("1"))

Buggy python submission (verdict: Runtime Error):
print(input().count(1))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int(input().split())))
m=list(map(bin,l))

print(min(m[i].rfind(1)-1 for i in range(1,n+1)))


Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy python submission (verdict: Runtime Error):
n=input()

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

b=map(bin,a)

c=map(rfind('1')-1,c)

print(min(c))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy python submission (verdict: Runtime Error):
n=input()

a=list(map(bin(int),input(),split()))

b=map(rfind('1')-1,a)

print(min(b))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy python submission (verdict: Runtime Error):
n=input()

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

b=list(map(rfind('1')-1,a))

print(min(b))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
Buggy python submission (verdict: Runtime Error):
from itertools import product
s=input()
for b in list(product(["+","-"],repeat=3)):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if evel(ans)==7:
        print(ans+"7")
        break


Fixed submission:
from itertools import product
s=input()
for b in list(product(["+","-"],repeat=3)):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if eval(ans)==7:
        print(ans+"=7")
        break

Buggy python submission (verdict: Runtime Error):
from itertools import product
s=input()
for b in list(product["+","-"],repeat=3):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if evel(ans)==7:
        print(ans+"7")
        break

Fixed submission:
from itertools import product
s=input()
for b in list(product(["+","-"],repeat=3)):
    ans=s[0]+b[0]+s[1]+b[1]+s[2]+b[2]+s[3]
    if eval(ans)==7:
        print(ans+"=7")
        break
Buggy python submission (verdict: Runtime Error):
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n):
x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
    inf.append(x%l)
    s+=x//l
inf.sort()
s%n
for i in range(n):
    print(inf[(i+s)%n])

Fixed submission:
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n):
   x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
   inf.append(x%l)
   s+=x//l
inf.sort()
for i in range(n):
    print(inf[(i+s)%n])

Buggy python submission (verdict: Runtime Error):
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n):
x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
    inf.append(x%l)
    s+=x//l
inf.sort()
s%n
for i in range(n):
    print(inf[(i+p)%n])

Fixed submission:
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n):
   x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
   inf.append(x%l)
   s+=x//l
inf.sort()
for i in range(n):
    print(inf[(i+s)%n])

Buggy python submission (verdict: Runtime Error):
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n)
x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
    inf.append(x%l)
    s+=x//l
inf.sort()
s%n
for i in range(n):
    print(inf[(i+p)%n])

Fixed submission:
n,l,t=map(int,input().split())
inf=[]
s=0
for _ in range(n):
   x,y=map(int,input().split())
   if y==1:
       x+=t
   else:
       x-=t
   inf.append(x%l)
   s+=x//l
inf.sort()
for i in range(n):
    print(inf[(i+s)%n])
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=float(inf)
for x in range(1,min(n,10**5)):
    if n%x==0:
        m=len(str(x))*len(str(n//x))
        ans=min(ans,m)
print(ans)

Fixed submission:
n=int(input())
ans=10**20
for x in range(1,10**5+1):
    if n%x==0:
        ans=min(ans,max(len(str(x)),len(str(n//x))))
print(ans)
Buggy python submission (verdict: Runtime Error):
c=input()
if c="a" or c= 'e' or c="o" or c="i" or c="u":
    print("vowel")
else:
    print("consonant")

Fixed submission:
c=input()
if c=="a" or c=='e' or c=="o" or c=="i" or c=="u":
    print("vowel")
else:
    print("consonant")
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]
for i in range(h)
a.append(input().split())

for i in range(h)
print(" ".join(a[i]))
print(" ".join(a[i]))

Fixed submission:
h,w=map(int,input().split())
a=[]
for i in range(h):
   a.append(input().split())

for i in range(h):
   print(" ".join(a[i]))
   print(" ".join(a[i]))
Buggy python submission (verdict: Runtime Error):
s=input().replace('eraser',"").replace('eraser',"").replace('erase',"")replace('dreamer',"").replace('dream',"")
if s:
    print("No")
else:
    print("Yes")

Fixed submission:
s=input().replace('eraser',"").replace('eraser',"").replace('erase',"").replace('dreamer',"").replace('dream',"")
if s:
    print("NO")
else:
    print("YES")

Buggy python submission (verdict: Runtime Error):
s=input().replace('eraser',"")replace('eraser',"").replace('erase',"")replace('dreamer',"")replace('dream',"")
if s:
    print("No")
else:
    print("Yes")

Fixed submission:
s=input().replace('eraser',"").replace('eraser',"").replace('erase',"").replace('dreamer',"").replace('dream',"")
if s:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)-1
ans=0
for b in list(product(['+',''],repeat=n)):
    a=s[0]
    for i in range(n):
        a=a+b[i]+s[i+1]
    ans+=eval(a)
print(ans)


Fixed submission:
from itertools import product
s=input()
n=len(s)-1
ans=0
for b in list(product(['+',''],repeat=n)):
    a=s[0]
    for i in range(n):
        a=a+b[i]+s[i+1]
    ans+=eval(a)
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)-1
ans=0
for b in list(product(['+',''],repeat=n))
    a=s[0]
    for i in range(n):
        a=a+b[i]+s[i+1]
    ans+=eval(a)
print(ans)


Fixed submission:
from itertools import product
s=input()
n=len(s)-1
ans=0
for b in list(product(['+',''],repeat=n)):
    a=s[0]
    for i in range(n):
        a=a+b[i]+s[i+1]
    ans+=eval(a)
print(ans)
Buggy python submission (verdict: Runtime Error):
th,td,ah,ad = map(int,input().split())
x,y = (td+ah-1)//td,(ad+th-1)//ad
if(x<=y):print("Yes")
else:print("No")


Fixed submission:
s,w = map(int,input().split())
if(w>=s):print("unsafe")
else:print("safe")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = set()
for _ in range(n):
    string = input()
    s.add(string)
return len(s)    
    


Fixed submission:
n = int(input())
s = set()
for _ in range(n):
    string = input()
    s.add(string)
print(len(s))
Buggy python submission (verdict: Runtime Error):
s=input().split(' ')
A,B,N=int(s[0]),int(s[1]),int(s[2])

def f(x):
    a=np.floor(A*x/B)-A*np.floor(x/B)
    return a.astype(int)

if N<B-1:
    print(f(N))
else:
    print(f(B-1))


Fixed submission:
import numpy as np

s=input().split(' ')
A,B,N=int(s[0]),int(s[1]),int(s[2])

def f(x):
    a=np.floor(A*x/B)-A*np.floor(x/B)
    return a.astype(int)

if N<B-1:
    print(f(N))
else:
    print(f(B-1))
Buggy python submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)


Fixed submission:
N=input()
sum=0
for i in range(1,int(N)+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)

Buggy python submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)


Fixed submission:
N=input()
sum=0
for i in range(1,int(N)+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)

Buggy python submission (verdict: Runtime Error):
N=input()
sum=0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        sum += i
print(sum)


Fixed submission:
N=input()
sum=0
for i in range(1,int(N)+1):
    if i % 3 != 0 and i % 5 != 0:
        #print(i)
        sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)




Fixed submission:
N = int(input())
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)

Buggy python submission (verdict: Runtime Error):
c = 0
for i in range(1, N+1):
  if i % 2 == 0:
    c+=1

print(c/N)




Fixed submission:
N = int(input())
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)

Buggy python submission (verdict: Runtime Error):
if N % 2 == 0:
  print(N/2)
else:
  print((N+1)/2)
 

Fixed submission:
N = int(input())
c = 0
for i in range(1, N+1):
  if i % 2 == 1:
    c+=1

print(c/N)
Buggy python submission (verdict: Time Limit Exceeded):
a=input()
b=input()

N=int(a)
An = [int(b0) for b0 in b.split(' ')]

for i in range(1,N+1):
    for j in range(N):
        if i == An[j]:
            print(j+1, end=' ')
    

Fixed submission:
a=input()
b=input()


N=int(a)
An = [int(b0) for b0 in b.split(' ')]

Cn=[0]*len(An)
for i in range(len(An)):
    Cn[An[i]-1] = i+1

for i in Cn:
    print(i, end=' ')
Buggy python submission (verdict: Runtime Error):
k = int(input())
a, b = list(map(int, input().split()))

for i in range(1000):
    if k*i >= a and k*i=<b:
        print("OK")
        exit()
    if k*i > b:
        break

print("NG")

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

for i in range(1001):
    if k*i >= a and k*i<=b:
        print("OK")
        exit()
    if k*i > b:
        break

print("NG")
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

sa = []

for i in range(n-1):
    sa.append(h[i+1]-h[i])

#print(sa)

ans = 0
for i in range(n-1):
    if sa[i] == 0 and sa[i+1] < 0:
        print('No')
        exit(0)
    else:
        if sa[i] == -1:
            ans += 1
        elif sa[i] < -1:
            ans += sa[i]

    if ans > 1:
        print('No')
        exit(0)
        
#print(ans)
print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
f=True
m=0
for i in range(n):
    if h[i]>m:
        m=h[i]-1
    elif h[i]==m:
        continue
    else:
        f=False
        break
print('Yes' if f else 'No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

sa = []

for i in range(n-1):
    sa.append(h[i+1]-h[i])

#print(sa)

ans = 0
for i in range(n-1):
    if sa[i] == 0 and sa[i+1] < 0:
        print('No')
        exit(0)
    else:
        if sa[i] == -1:
            ans += 1
        elif sa[i] >= 0:
            ans += sa[i]
        else:
            ans += 999
    
    if ans > 1:
        print('No')
        exit(0)
        
#print(ans)
print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
f=True
m=0
for i in range(n):
    if h[i]>m:
        m=h[i]-1
    elif h[i]==m:
        continue
    else:
        f=False
        break
print('Yes' if f else 'No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

sa = []

for i in range(n-1):
    sa.append(h[i+1]-h[i])

#print(sa)

ans = 0
for i in range(n-1):
    if sa[i] == 0 and sa[i+1] < 0:
        print('No')
        exit(0)
    else:
        if sa[i] < 0:
            ans += 1
    
    if ans > 1:
        print('No')
        exit(0)
        
#print(ans)
print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
f=True
m=0
for i in range(n):
    if h[i]>m:
        m=h[i]-1
    elif h[i]==m:
        continue
    else:
        f=False
        break
print('Yes' if f else 'No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))

sa = []

for i in range(n-1):
    sa.append(h[i+1]-h[i])

#print(sa)

ans = 0
for i in range(n-1):
    if sa[i] == 0 and sa[i+1] == -1:
        print('No')
        exit(0)
    else:
        if sa[i] < 0:
            ans += 1
    
    if ans > 1:
        print('No')
        exit(0)
        
#print(ans)
print('Yes')

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
f=True
m=0
for i in range(n):
    if h[i]>m:
        m=h[i]-1
    elif h[i]==m:
        continue
    else:
        f=False
        break
print('Yes' if f else 'No')
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)


A, B, C, D = map(int, input().split())
target = B - A + 1

hoge1 = int(B / C) - int((A - 1) / C)
hoge2 = int(B / D) - int((A - 1) / D)
hoge3 = int(B / (C * D)) - int((A - 1) / (C * D))

saisho = lcm(C, D)
hoge4 = B // saisho - (A - 1) // saisho

print(target - hoge1 - hoge2 + hoge4)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
    
def lcm(x, y):
    return (x * y) // gcd(x, y)


A, B, C, D = map(int, input().split())
target = B - A + 1

hoge1 = B // C - (A - 1) // C
hoge2 = B // D - (A - 1) // D
hoge3 = B // (C * D) - (A - 1) // (C * D)

saisho = lcm(C, D)
hoge4 = B // saisho - (A - 1) // saisho

print(target - hoge1 - hoge2 + hoge4)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
size = list(map(int, input().split()))
price = list(map(int, input().split()))

ans = 0

for i in range(2**n-1) :
    tmp_sumS = 0
    tmp_sumP = 0
    tmp_comb = []

    for j in range(n) :
        # シフトして１ビットずつ判断
        is_put = i>>(n-j-1)&1
        tmp_comb.append(is_put)
        tmp_sumS += is_put * size[j]
        tmp_sumP += is_put * price[j]
            
        if tmp_sumS-tmp_sumP > ans:
            ans = tmp_sumS-tmp_sumP

print(ans)

Fixed submission:
n = int(input())
size = list(map(int, input().split()))
price = list(map(int, input().split()))

ans = 0

for i in range(n):
    if size[i]-price[i] > 0:
        ans+=size[i]-price[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
size = list(map(int, input().split()))
price = list(map(int, input().split()))

max_size = -1
max_price = -1
combination = []
ans = 0

for i in range(2**n-1) :
    tmp_sumS = 0
    tmp_sumP = 0
    tmp_comb = []
    over_flag = False

    for j in range(n) :
        # シフトして１ビットずつ判断
        is_put = i>>(n-j-1)&1
        tmp_comb.append(is_put)
        tmp_sumS += is_put * size[j]
        tmp_sumP += is_put * price[j]
            
        if tmp_sumS-tmp_sumP > ans:
            ans = tmp_sumS-tmp_sumP
    
    # over flag が立ってない かつ 暫定 max price より高いときに更新
    if (not over_flag) and tmp_sumP > max_price :
        max_price = tmp_sumP
        max_size = tmp_sumS
        combination = tmp_comb
    
print(ans)

Fixed submission:
n = int(input())
size = list(map(int, input().split()))
price = list(map(int, input().split()))

ans = 0

for i in range(n):
    if size[i]-price[i] > 0:
        ans+=size[i]-price[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
monsters = list(map(int,input().split()))

print(reduce(math.gcd, monsters))

Fixed submission:
N = int(input())
monsters = list(map(int,input().split()))
monsters = sorted(monsters)

def gcd(a,b):
    if b==0:
        return a
    return gcd(b, a%b)

if N == 1:
    print(monsters[0])
else:
    ans = gcd(monsters[0], monsters[1])
    if N == 2:
        print(ans)
    else:
        for i in range(2, N):
            ans = gcd(ans,monsters[i])
        print(ans)
Buggy python submission (verdict: Runtime Error):
text = input()
cnt = 0
if 1000 <= int(text) and int(text) <= 9000:
	for i in range(len(text)):
		if i == "2":
			cnt += 1
		else:
			pass
print (i)

Fixed submission:
text = input()
cnt = 0
for i in text:
	if i == "2":
		cnt += 1
print (cnt)

Buggy python submission (verdict: Runtime Error):
text = input()
cnt = 0
if 1000 <= int(text) and int(text) <= 9000:
	for i in range(len(text)):
		if i == 2:
			cnt += 1
		else:
			pass
print (i)

Fixed submission:
text = input()
cnt = 0
for i in text:
	if i == "2":
		cnt += 1
print (cnt)
Buggy python submission (verdict: Runtime Error):
x = str(input())
target = 753
ok = 999
for i in range(len(x)-3):
	num = x[i:i+3]
	sa = target - num
	if (ok < sa):
		ok = sa
print (sa)

Fixed submission:
x = str(input())
target = 753
ok = 999
for i in range(len(x)-2):
	num = x[i:i+3]
	sa = abs(target - int(num))
	if (ok > sa):
		ok = sa
	#print (sa)
print (ok)

Buggy python submission (verdict: Runtime Error):
x = int(input())
target = 753
ok = 999
for i in range(len(x)-3):
	num = x[i:i+3]
	sa = target - num
	if (ok < sa):
		ok = sa
print (sa)

Fixed submission:
x = str(input())
target = 753
ok = 999
for i in range(len(x)-2):
	num = x[i:i+3]
	sa = abs(target - int(num))
	if (ok > sa):
		ok = sa
	#print (sa)
print (ok)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import itertools
x = int(input())
l = [3, 5, 7]

h = itertools.combinations_with_replacement(l, 4)

cnt = 0
for v in itertools.combinations_with_replacement(l, 4):
    if (3 in v and 5 in v and 7 in v):
        if v < x:
            cnt += 1

h_list = list(itertools.combinations_with_replacement(l, 4))

print (cnt)

Fixed submission:
N = int(input())

def dfs(s): # 文字列 s で始まる七五三数の個数
	if int(s) > N:
		return 0
	ret = 1 if all(s.count(c) > 0 for c in '753') else 0 # s 自体が七五三数なら +1
	for c in '753':
		ret += dfs(s + c)
	return ret

print(dfs('0')) # 本当は dfs('') と書きたいが 4 行目でのエラーを防ぐため仕方なく
Buggy python submission (verdict: Runtime Error):
i = list(map(int,input().split()))
f = 0
for x in range(i[1],i[2]+1):
    if x % i[0] == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("No")

Fixed submission:
i = int(input())
i2 = list(map(int,input().split()))

f = 0
for x in range(i2[0],i2[1]+1):
    if x % i == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
import os

N = input()
S = []
N = int(N)
count = 0
for i in range(int(N)):
    tmp = input()
    if (tmp in S) == False:
        count += 1
        S.append(tmp)

print (len(S))

Fixed submission:
import os

N = input()
S = set() 
N = int(N)
count = 0
for i in range(int(N)):
    tmp = input()
    if (tmp in S) == False:
        count += 1
    S.add(tmp)


print (count)
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
temp = 3.14
val = str(2*temp*a)
st=""
ind=0
for j in range(len(val)):
	if(val[j]=="."):
		ind=j
		st+="."
		break
	else:
		st+=val[j]
st+=val[ind+1]
st+=val[ind+2]

print(st)


Fixed submission:
import math
a = int(input())
val = 2*math.pi*a
print(val)
Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(input().split())
x=[int(s) for s in x]
if n>1:
    b_li=[]
    for i in range(min(x),max(x)):
        a_li=[]
        for j in range(n):
            a=(x[j]-i)**2
            a_li.append(a)
        b=sum(a_li)
        b_li.append(b)
    print(min(b_li))
else:
    print(0)

Fixed submission:
n=int(input())
x=list(input().split())
x=[int(s) for s in x]
if n==1 or len(set(x))==1:
    print(0)
else:
    b_li=[]
    for i in range(min(x),max(x)):
        a_li=[]
        for j in range(n):
            a=(x[j]-i)**2
            a_li.append(a)
        b=sum(a_li)
        b_li.append(b)
    print(min(b_li))

Buggy python submission (verdict: Runtime Error):
n=int(input())
x=list(input().split())
x=[int(s) for s in x]
b_li=[]
for i in range(min(x),max(x)):
    a_li=[]
    for j in range(n):
        a=(x[j]-i)**2
        a_li.append(a)
    b=sum(a_li)
    b_li.append(b)
print(min(b_li))


Fixed submission:
n=int(input())
x=list(input().split())
x=[int(s) for s in x]
if n==1 or len(set(x))==1:
    print(0)
else:
    b_li=[]
    for i in range(min(x),max(x)):
        a_li=[]
        for j in range(n):
            a=(x[j]-i)**2
            a_li.append(a)
        b=sum(a_li)
        b_li.append(b)
    print(min(b_li))