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

Fixed submission:
import collections
 
n= int(input())
a= list(map(int, input().split()))
cnt = collections.Counter(a)
for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
list1=[0]*(a-1)
list1=list(map(int,input().split()))
for i in range(a):
    print(list1.count(i+1))

Fixed submission:
import collections
 
n= int(input())
a= list(map(int, input().split()))
cnt = collections.Counter(a)
for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
list1=[0]*(a-1)
list1=list(map(int,input().split()))
for i in range(a):
    print(list1.count(i+1))

Fixed submission:
import collections
 
n= int(input())
a= list(map(int, input().split()))
cnt = collections.Counter(a)
for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
list1=[0]*(a-1)
list1=list(map(int,input().split()))
for i in range(a):
    print(list1.count(i+1))

Fixed submission:
import collections
 
n= int(input())
a= list(map(int, input().split()))
cnt = collections.Counter(a)
for i in range(1, n+1):
    print(cnt[i])

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
list1=[0]*(a-1)
list1=list(map(int,input().split()))
for i in range(a):
    print(list1.count(i+1))

Fixed submission:
import collections
 
n= int(input())
a= list(map(int, input().split()))
cnt = collections.Counter(a)
for i in range(1, n+1):
    print(cnt[i])
Buggy python submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
a,b=map(int, input().split())
cnt=0
if a>1:
    cnt=(factorial(a)/((factorial(a-2))*2))
if b>1:
    cnt=(factorial(b)/((factorial(b-2))*2))+cnt
print(int(cnt))

Fixed submission:
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
a,b=map(int, input().split())
cnt=0
if a==2:
    cnt=1
elif a>1:
    cnt=(factorial(a)/((factorial(a-2))*2))
if b==2:
    cnt=cnt+1
elif b>1:
    cnt=(factorial(b)/((factorial(b-2))*2))+cnt
print(int(cnt))

Buggy python submission (verdict: Runtime Error):
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
a,b=map(int, input().split())
cnt=0
if a>0:
    cnt=(factorial(a)/((factorial(a-2))*2))
if b>0:
    cnt=(factorial(b)/((factorial(b-2))*2))+cnt
print(int(cnt))

Fixed submission:
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
a,b=map(int, input().split())
cnt=0
if a==2:
    cnt=1
elif a>1:
    cnt=(factorial(a)/((factorial(a-2))*2))
if b==2:
    cnt=cnt+1
elif b>1:
    cnt=(factorial(b)/((factorial(b-2))*2))+cnt
print(int(cnt))
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int2((a+1)/2)
print(b)

Fixed submission:
# -*- coding: utf-8 -*-
a=int(input())
b=int((a+1)/2)
print(b)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int2((a+1)/2)
print(b)

Fixed submission:
# -*- coding: utf-8 -*-
a=int(input())
b=int((a+1)/2)
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
wl=[]
for i in range(n):
    w=input()
    wl.append(w)
wl2=Counter(wl)
ans=[]
for i in range(len(wl2)):
    if wl2.most_common()[i][1]==wl2.most_common()[0][1]:
        ans.append(wl2.most_common()[i][0])
ans.sort()
for i in range(len(ans)):
    print(ans[i])


Fixed submission:
n=int(input())
wl={}
for i in range(n):
    w=input()
    if w not in wl:
        wl[w]=0
    wl[w]+=1
wm=max(wl.values())
wl3=sorted(wl.items())
for i in range(len(wl3)):
    if wl3[i][1]==wm:
        print(wl3[i][0])
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
n=int(math.log2(n))
ans=2**(n+1)
print(ans-1)

Fixed submission:
import math
n=int(input())
n=int(math.log2(n))
ans=2**(n+1)
print(ans-1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ct=0
p=list(map(int,input().split()))
for i in range(n):
    list1=sorted(p[0:i+1])
    if list1[0]==p[i]:
        ct+=1
print(ct)

Fixed submission:
n=int(input())
ct=0
p=list(map(int,input().split()))
mn=p[0]
for i in range(1,n):
    if mn>=p[i]:
        ct+=1
        mn=p[i]
print(ct+1)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans_list=[]
for i in range(2**n):
    num_list=[]
    for j in range(n):
        if (i >> j) & 1:
            num_list.append(a[j])
    if list(range(1,len(num_list)+1))==num_list:
        ans_list.append(len(num_list))

if (len(ans_list)==1)and(ans_list[0]==0):
    print(-1)
else:
    print(n-max(ans_list))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ct=0
for i in range(n):
    if a[i]==(ct+1):
        ct+=1
if ct==0:
    print('-1')
else:
    print(n-ct)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
b=[]
a=list(map(int,input().split()))
for i in range(n):
    b.append(str(a.index(i+1)+1))
print(' '.join(b))

Fixed submission:
n=int(input())
b=['']*n
a=list(map(int,input().split()))
for i in range(n):
    b[a[i]-1]=str(i+1)
print(' '.join(b))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
for i in range(n):
    a[i]=int(input())
for i in range(n):
    a[i]*=-1
    print(max(a))
    a[i]*=-1

Fixed submission:
n=int(input())
a=[0]*n
for i in range(n):
    a[i]=int(input())
b=sorted(a)
for i in range(n):
    if a[i]==b[-1]:
        print(b[-2])
    else:
        print(b[-1])
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans1=(w*h)/2.0
ans=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))

Fixed submission:
w,h,x,y=map(int,input().split())
ans1=(w*h)/2.0
ans2=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))

Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
ans1=(w*h)/2
ans=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))

Fixed submission:
w,h,x,y=map(int,input().split())
ans1=(w*h)/2.0
ans2=0
if (w/2==x)and(h/2==y):
    ans2=1
print('%f %d'%(ans1,ans2))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
flag=n*[0]
for i in range(m):
    l,r=map(int,input().split())
    flag[l-1:r]=list(map(lambda n: n+1,flag[l-1:r]))

print(flag.count(m))

Fixed submission:
n,m=map(int,input().split())
ansl=1
ansr=n
flag=0
for i in range(m):
    l,r=map(int,input().split())
    if (ansl>r)or(ansr<l):
        flag=1
        break
    if ansl<l:
        ansl=l
    if ansr>r:
        ansr=r
if flag==0:
    print(ansr-ansl+1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
list1=[[0 for i in range(h)] for j in range(w)]
for i in range(h):
    list1[i]=list(map(str,input().split()))
print('#'*(w+2))
for i in range(h):
    print('#'+str(''.join(list1[i]))+'#')
print('#'*(w+2))

Fixed submission:
h,w=map(int,input().split())
list1=[[0 for i in range(w)]for j in range(h)]
for i in range(h):
    list1[i]=list(map(str,input().split()))
print('#'*(w+2))
for i in range(h):
    print('#'+str(''.join(list1[i]))+'#')
print('#'*(w+2))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
cnt=0
passw=''
if (len(a)-len(b))==1:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        passw=passw+a[cnt+1]
        break
else:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        break
print(passw)

Fixed submission:
a=input()
b=input()
cnt=0
passw=''
if (len(a)-len(b))==1:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        passw=passw+a[cnt]
        break
else:
  while 1:
      passw=passw+a[cnt]+b[cnt]
      cnt=cnt+1
      if (cnt+1)>len(b):
        break
print(passw)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

setA = set(A)
counts = {}
for e in setA:
    counts[e] = A.count(e)

ans = 0
for e in setA:
    ans += counts[e] * (counts[e]-1) // 2

for i in range(0, len(A)):
    e = A[i]
    print(ans - (counts[e] * (counts[e]-1) // 2) +
          ((counts[e]-1) * (counts[e]-2) // 2))


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

counts = {}
for e in A:
    if e not in counts:
        counts[e] = 0
    counts[e] += 1

ans = 0
for e in counts:
    ans += counts[e] * (counts[e]-1) // 2

for i in range(0, len(A)):
    print(ans - counts[A[i]] + 1)

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

for i in range(0, len(A)):
    B = A[:i] + A[i+1:]
    ans = 0
    for e in set(B):
        l = B.count(e)
        ans += l * (l-1) // 2
    print(ans)


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

counts = {}
for e in A:
    if e not in counts:
        counts[e] = 0
    counts[e] += 1

ans = 0
for e in counts:
    ans += counts[e] * (counts[e]-1) // 2

for i in range(0, len(A)):
    print(ans - counts[A[i]] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
# 23:22

S = input()
Q = int(input())

for _ in range(0, Q):
    q = input()
    if len(q.split()) == 1:
        S = S[::-1]
    else:
        _, f, c = q.split()
        if f == '1':
            S = c + S
        else:
            S = S + c
print(S)


Fixed submission:
# 23:22

S = input()
Q = int(input())

# 0: 順
# 1: 逆
head = 0
pre = ''
post = ''

for _ in range(0, Q):
    q = input()
    if len(q.split()) == 1:
        head = 1 if head == 0 else 0
    else:
        _, f, c = q.split()
        if f == '1':
            # 先頭
            if head == 0:
                pre = c + pre
            else:
                post = post + c
        else:
            # 末尾
            if head == 1:
                pre = c + pre
            else:
                post = post + c

S = pre + S + post
print(S[::-1] if head == 1 else S)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ns = map(input().split(), int)

c = 0
for i in range(1, n):
  if sorted([ns[i-1], ns[i], ns[i+1]])[2] == ns[i]:
    c += 1
    
print(c)

Fixed submission:
a = input()
b = list(set(list(a)))
print('Yes' if len(b) == 2 and a.count(b[0]) == 2 and a.count(b[1]) == 2 else 'No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
ns = map(input().split(), int)

c = 0
for i in range(1, n):
  if sorted([n[i-1], n[i], n[i+1]])[2] == n[i]:
    c += 1
    
print(c)

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

c = 0
for i in range(1, n-1):
  if sorted([ns[i-1], ns[i], ns[i+1]])[1] == ns[i]:
    c += 1
    
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
Hs = list(map(int, input().split()))
print(len([i for i in range(0, len(Hs)) if all(lambda j: Hs[j]<=Hs[j+1]), range(0, i)]))

Fixed submission:
N = int(input())
Hs = list(map(int, input().split()))
print(len([i for i in range(0, len(Hs)) if all([Hs[j] <= Hs[i] for j in range(0, i)])]))
Buggy python submission (verdict: Time Limit Exceeded):
N, trans = int(input()), [int(input()), int(input()), int(input()), int(input()), int(input())]

persons = [N, 0, 0, 0, 0, 0]

t = 0
while persons[5] != N:
    for i in reversed(list(range(0, 5))):
        if persons[i] > 0:
            np = trans[i] if persons[i] >= trans[i] else persons[i]            
            persons[i] -= np
            persons[i+1] += np
    t += 1    

print(t)

Fixed submission:
N, trans = int(input()), [int(input()), int(input()), int(input()), int(input()), int(input())]

min_trans = min(trans)
print(int((N-1)/min_trans) + 1 + 4)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, raw_input().split())
print(X + Y/2)

Fixed submission:
X, Y = map(int, input().split())
print(int(X + Y/2))

Buggy python submission (verdict: Runtime Error):
X, Y = input().split()
print(X + Y/2)

Fixed submission:
X, Y = map(int, input().split())
print(int(X + Y/2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i+1)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    if v is None or abs(_T-A) < v:
        v = abs(_T-A)
        i = _i

print(i+1)

Buggy python submission (verdict: Runtime Error):
N = int(raw_inpit())
T, A = map(int, raw_input().split())
Hs = list(map(int, raw_input().split()))

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i+1)


Fixed submission:
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    if v is None or abs(_T-A) < v:
        v = abs(_T-A)
        i = _i

print(i+1)

Buggy python submission (verdict: Runtime Error):
N = int(raw_inpit())
T, A = map(int, raw_input().split())
Hs = list(map(int, raw_input().split()))

Ts = list(map(lambda x: T-x * 0.006), Hs)

i = 0
v = 0
for _i, _T in enumerate(Ts):
    if abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i)


Fixed submission:
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    if v is None or abs(_T-A) < v:
        v = abs(_T-A)
        i = _i

print(i+1)
Buggy python submission (verdict: Runtime Error):
import fraction
def lcm(x, y):
    return (x * y) // fraction.gcd(x, y)

print(lcm(int(input()), 2))


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

print(lcm(int(input()), 2))

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(int(input()), 2))


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

print(lcm(int(input()), 2))
Buggy python submission (verdict: Runtime Error):
print('Even' if a * b % 2 == 0 else 'Odd')

Fixed submission:
a, b = map(int, input().split())
print('Even' if a * b % 2 == 0 else 'Odd')
Buggy python submission (verdict: Runtime Error):
a = input()
a[3] = '8'
print(a)

Fixed submission:
a = [c for c in input()]
a[3] = '8'
print(''.join(a))
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print(min([A * T, B]))

Fixed submission:
N, A, B = map(int, input().split())
print(min([A * N, B]))
Buggy python submission (verdict: Runtime Error):
s = [c for c in input()]
print('Yes' if len(set(s[:3])) == 1 or len(set[1:]) == 1 else 'No')

Fixed submission:
s = input()
print('Yes' if len(set(s[:3])) == 1 or len(set(s[1:])) == 1 else 'No')

Buggy python submission (verdict: Runtime Error):
s = input()
print('Yes' if len(set(s[:3])) == 1 or len(set[1:]) == 1 else 'No')

Fixed submission:
s = input()
print('Yes' if len(set(s[:3])) == 1 or len(set(s[1:])) == 1 else 'No')
Buggy python submission (verdict: Runtime Error):
x, y = input(), input()
if x < y: print('<')
if x == y: print('=')
if x > y: print('>')

Fixed submission:
x, y = input().split()
if x < y: print('<')
if x == y: print('=')
if x > y: print('>')
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
print(max([x - y, 0])

Fixed submission:
x, y = map(int, input().split())
print(max([x - y, 0]))
Buggy python submission (verdict: Runtime Error):
groups = [[1, 3, 5, 7, 8, 12], [4, 6, 9, 11], [2]]
gg = lambda t: [i for i in range(0, 3) if t in groups[i]][0]
x, y = map(int, input().split())
print('Yes' if gg(x) == gg(y) else 'No')

Fixed submission:
groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]
gg = lambda t: [i for i in range(0, 3) if t in groups[i]][0]
x, y = map(int, input().split())
print('Yes' if gg(x) == gg(y) else 'No')
Buggy python submission (verdict: Runtime Error):
power = [i for i in range(2, 12+1)] + [1]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')

Fixed submission:
power = [i for i in range(2, 13+1)] + [1]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')

Buggy python submission (verdict: Runtime Error):
power = [i for i in range(1, 12+1)] + [2]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')

Fixed submission:
power = [i for i in range(2, 13+1)] + [1]
A, B = map(lambda x: power.index(int(x)), input().split())
if A < B:
  print('Bob')
elif A == B:
  print('Draw')
else:
  print('Alice')
Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,k+1):
        if i-j>=0:
            dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i])
    
print(dp[-1])

Fixed submission:
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,k+1):
        if i-j>=0:
            dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i])
    
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    temp = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,k+1):
        if i-j>=0:
            temp = min(dp[i-j]+abs(h[i]-h[i-j]), temp)
    
    dp[i] = temp
    
print(dp[-1])

Fixed submission:
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,k+1):
        if i-j>=0:
            dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i])
    
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    temp = float('inf')
    for j in range(1,k+1):
        if i-j>=0:
            temp = min(dp[i-j]+abs(h[i]-h[i-j]), temp)
    
    dp[i] = temp
    
print(dp[-1])

Fixed submission:
n,k = list(map(int,input().split(' ')))
h = list(map(int, input().split(' ')))

dp = [0]*n 

for i in range(1,n):
    dp[i] = dp[i-1]+abs(h[i]-h[i-1])
    for j in range(2,k+1):
        if i-j>=0:
            dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i])
    
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
h, a = map(int, input())

print(h // a + int(h%a != 0))


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

print(h//a + int(h%a!=0))

Buggy python submission (verdict: Runtime Error):
h, a = map(int, input())

print(h//a + int(h%a!=0))


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

print(h//a + int(h%a!=0))

Buggy python submission (verdict: Runtime Error):
h, a = map(int, input())

print(h//a + int(h%a!=0))

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

print(h//a + int(h%a!=0))
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

n = functools.partial(functools.reduce, operator.mul)
N,K = map(int,input().split())
A = list(map(int,input().split()))
# print(n(A))
S = [0] * K
s = 0
for i in range(K,len(A)+ 1):
    # print(i)
    # S.append(n(A[(i-1)-(K-1):i]))
    # print(n(A[(i-1)-(K-1):i]))
    if i == K:
        s = n(A[(i-1)-(K-1):i])
        continue
    else:
        if s < n(A[(i-1)-(K-1):i]):
            print("Yes")
            s = n(A[(i-1)-(K-1):i])
        else:
            print("No")
            s = n(A[(i-1)-(K-1):i])

        



Fixed submission:
import functools
import operator

n = functools.partial(functools.reduce, operator.mul)
N,K = map(int,input().split())
A = list(map(int,input().split()))
# print(n(A))
for i in range(K,N):
    if A[i-K] < A[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import math
N = input()
S = 0
S = int(N[-3]) * 100
if S == 0:
    print(S)
else:
    print(1000 - S)

Fixed submission:
import math
N = int(input())
S = 0
ans = 0
for i in range(1000, 10001, 1000):
    if i - N == 0:
        ans = 0
        break
    if i - N > 0:
        ans = i - N
        break
        # ans = min(ans, i - N)
        
print(ans)
Buggy python submission (verdict: Runtime Error):
X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(1, 101):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))


Fixed submission:
X,N = map(int,input().split())
P = list(map(int,input().split()))
m = {}
for i in range(102):
    if i in P:
        continue
    ab = abs(i - X)
    m[i] = ab
# min_kv_list = [kv for kv in m.items() if kv[1] == min(m.values())]
min_k_list = [kv[0] for kv in m.items() if kv[1] == min(m.values())]
print(min(min_k_list))
Buggy python submission (verdict: Runtime Error):
H1,M1,H2,M2,K = map(int,input().split())
 
h = H2 - H1
m = M2 - M1
s = 0
if h > 0:
    s = h * 60 + m
elif: h == 0:
    s = 24 * 60 + m
else:
    s = (24 + h) * 60 + m

s -= K
print(s)

Fixed submission:
H1,M1,H2,M2,K = map(int,input().split())

h = H2 - H1
m = M2 - M1
s = 0

s = h * 60 + m


s = s - K

print(s)

Buggy python submission (verdict: Runtime Error):
H1,M1,H2,M2,K = map(int,input().split())
 
h = H2 - H1
m = M2 - M1
if h > 0:
    s = h * 60 + m
    s -= K
	print(s)
else:
    s = (24 + h) * 60 + m
    s -= K
	print(s)
 


Fixed submission:
H1,M1,H2,M2,K = map(int,input().split())

h = H2 - H1
m = M2 - M1
s = 0

s = h * 60 + m


s = s - K

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())

if N > K and K == 1:
    print(0)
    exit(0)

while N > abs(N - K):
    N = abs(N - K)


print(N)

Fixed submission:
N,K = map(int, input().split())
ans = 0

if N < abs(N - K):
    ans = N
elif N % K == 0:
    ans = 0
else:
    ans = abs(N % K - K)


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
f = False
count = 0
for i in range(N):
    # print(i)
    for j in reversed(range(0,i)):
        # print(j)
        if P[i] > P[j]:
            f = True
        
    if f == False:
        count += 1
    f = False
print(count)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
f = False
count = 0
m = P[0]
for i in range(N):
    m = min(m, P[i])
    if m >= P[i]:
        count += 1


print(count)

    # print(i)
#     for j in reversed(range(0,i)):
#         # print(j)
#         if P[i] > P[j]:
#             f = True
        
#     if f == False:
#         count += 1
#     f = False
# print(count)
Buggy python submission (verdict: Runtime Error):
from sympy import isprime
X = int(input())
ans = 0
for i in range(X, 10 ** 5 + 1):
    if isprime(i):
        ans = i
        break

print(i)

Fixed submission:
import math
def isPrime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
    # ２ではない偶数は素数ではない
        return False
  
  # nの半分まで計算する範囲を絞る
    m = math.floor(n / 2) + 1
    for p in range(3, m, 2): # 奇数だけ計算する
        if n % p == 0:
            return False
    return True
# def isPrime(n):
#     if n < 2:
#     # 2未満は素数でない
#         return False
#     if n == 2:
#     # 2は素数
#         return True
#     for p in range(2, n):
#         if n % p == 0:
#         # nまでの数で割り切れたら素数ではない
#             return False
#   # nまでの数で割り切れなかったら素数
#     return True
X = int(input())
ans = 0
for i in range(X, 10 ** 10):
    if isPrime(i):
        ans = i
        break

print(ans)