Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
lr_cnt = 0
rl_cnt = 0
mnt = 0
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        lr_cnt += 1
        
    if s[i] == 'R' and s[i+1] == 'L':
        rl_cnt += 1
mnt  = rl_cnt + lr_cnt+1
mnt = np.max([1,mnt-2*k])
if mnt == 1:
    print(n-1)
else:
    print(n-rl_cnt-lr_cnt+2*k-1)

Fixed submission:
import numpy as np
n,k = map(int,input().split())
s = input()
lr_cnt = 0
rl_cnt = 0
mnt = 0
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        lr_cnt += 1
        
    if s[i] == 'R' and s[i+1] == 'L':
        rl_cnt += 1
mnt  = rl_cnt + lr_cnt+1
mnt = np.max([1,mnt-2*k])
if mnt == 1:
    print(n-1)
else:
    print(n-rl_cnt-lr_cnt+2*k-1)
Buggy python submission (verdict: Runtime Error):
a = int(input())
print(((a)*(a-1))//2)

Fixed submission:
a = input()
b = input()
num = 0
for i in range(3):
    if a[i] == b[i]:
        num += 1
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
num  = 0
for i in range(1,a):
    num += i
print(num)

Fixed submission:
a = int(input())
print(((a)*(a-1))//2)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
tree_list  = []
answer_list = [0]
for i in range(n-1):
    tree_list.append(list(map(int,input().split())))
    answer_list.append(0)
for i in range(m):
    num1,num2 = map(int,input().split())
    answer_list[num1-1] +=  num2
for i in range(n): 
    true = True
    while true:
        true = False
        print(i)
        for _ in tree_list:
            if i == _[0]-1:
                answer_list[_[1]-1] += answer_list[i]
                tree_list.remove(_)
                true = True
for i in answer_list:
    print(i)

Fixed submission:
num = int(input())
s = input()
if num  >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Fixed submission:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 1:
            ans_list[i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())
cnt = 0
mod_list = []
for i in range(l,r):
    for j in range(i+1,r+1):
        mod_list.append(i*j%2019)
        cnt += 1
        if cnt == 2019**2:
            break
print(min(mod_list))

Fixed submission:
l,r = map(int,input().split())
cnt = 0
mod_list = []
if r- l >=2019:
    print(0)
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            mod_list.append(i*j%2019)
    print(min(mod_list))
Buggy python submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/math.gcd(c, d))
a_cd = (a-1)//int((c*d)/math.gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))

Fixed submission:
def gcd(a, b):
    # ユークリッド互除法により最大公約数を求める。
    if a < b:
        a, b = b, a

    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/gcd(c, d))
a_cd = (a-1)//int((c*d)/gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/math.gcd(c, d))
a_cd = (a-1)//int((c*d)/math.gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))

Fixed submission:
def gcd(a, b):
    # ユークリッド互除法により最大公約数を求める。
    if a < b:
        a, b = b, a

    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
a,b,c,d = map(int,input().split())
b_c = b//c
b_d = b//d
a_c = (a-1)//c
a_d = (a-1)//d
b_cd = b//int((c*d)/gcd(c, d))
a_cd = (a-1)//int((c*d)/gcd(c, d))
print((b-a+1)-(b_c+b_d-b_cd-(a_c+a_d-a_cd)))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a >=13:
    print(b)
elif  6 <= a <= 12:
    print(b//2)
else:
    prnt(0)

Fixed submission:
a,b = map(int,input().split())
if a >=13:
    print(b)
elif  6 <= a <= 12:
    print(b//2)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a_list = list(map(int,input().split()))
for i in range(m):
    b,c = map(int,input().split())
    for i in range(b):
        a_list.append(c)
        
a_list.sort()
print(sum(a_list[::-1][0:n]))

Fixed submission:
n,m = map(int,input().split())
a_list = list(map(int,input().split()))
b_list = []
for i in range(m):
    b_list.append(list(map(int,input().split())))
    
    
b_list.sort(key=lambda x: x[1],reverse=True)
cnt = 0
for i in range(m):
    for j in range(b_list[i][0]):
        if cnt > n:
            break
        a_list.append(b_list[i][1])
        cnt += 1
    
a_list.sort()
print(sum(a_list[::-1][0:n]))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        if k//i == 0 :
            num = 1
        else:
            num = int((np.log2(k/i)+1)//1)
        ans += (1/n)*(1/2)**num
    
print(ans)

Fixed submission:
import numpy as np
import math 
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        num = math.ceil(np.log2(k/i))
        ans += (1/n)*(1/2)**num
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        if k//i == 0 :
            num = 1
        else:
            num = int((np.log2(k//i)+1)//1)
        ans += (1/n)*(1/2)**num
    
print(ans)

Fixed submission:
import numpy as np
import math 
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i >= k:
        ans += 1/n
    else:
        num = math.ceil(np.log2(k/i))
        ans += (1/n)*(1/2)**num
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
a_list = []
for i in range(len(s)-1):
    if (s[i] == 'A') and (s[i+1] == 'C'):
        a_list.append(i)
    
for i in range(q):
    cnt = 0
    l,r =  map(int,input().split())
    for j in a_list:
        if j+1 in range(l,r+1) and  j+2 in range(l,r+1):
            cnt += 1
    print(cnt)

Fixed submission:
n,q = map(int,input().split())
s = input()
t_list = [0]*n
for i in range(len(s)-1):
    if (s[i] == 'A') and (s[i+1] == 'C'):
        t_list[i+1] = 1+t_list[i]
    else:
        t_list[i+1] = t_list[i]
        
for i in range(q):
    l,r =  map(int,input().split())
    print(t_list[r-1] - t_list[l-1])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
num_list = list(map(int,input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(num_list))

Fixed submission:
n = int(input())
 
A = list(map(int, input().split()))
 
t = max(A)
 
from fractions import gcd
 
for i in A:
    t = gcd(t, i)
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
num_list = list(map(int,input().split()))
num_list.sort()
d_list = []
if n >= m:
    print(0)
    
else:
    for i in range(m-1):
        tmp = num_list[i+1] - num_list[i]
        d_list.append(tmp)
        d_list.sort(reverse = True)
    print(sum(d_list[n-1:]))

Fixed submission:
n,m = map(int,input().split())
num_list = list(map(int,input().split()))
num_list.sort()
d_list = []
if n >= m:
    print(0)
    
else:
    for i in range(m-1):
        tmp = num_list[i+1] - num_list[i]
        d_list.append(tmp)
    d_list.sort(reverse = True)
    print(sum(d_list[n-1:]))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
ans = 0
tmp = int(m/n)
for i in range(1,int(np.sqrt(m))):
    if m%i == 0:
        if (ans < i) and(i <= tmp):
            ans = i
print(ans)

Fixed submission:
import numpy as np

n,m = map(int,input().split())
ans = 0
tmp = int(m/n)
for i in range(1,int(np.sqrt(m)+1)):
    if m%i == 0:
        if (ans < i) and(i <= tmp):
            ans = i
        tmp2 = m//i
        if (ans < tmp2) and(tmp2 <= tmp):
            ans = tmp2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ans = 0
flag = True
tmp = int(m/n)
for i in range(1,tmp+1):
    if m%i == 0:
        if ans < i:
            ans = i
print(ans)

Fixed submission:
import numpy as np

n,m = map(int,input().split())
ans = 0
tmp = int(m/n)
for i in range(1,int(np.sqrt(m)+1)):
    if m%i == 0:
        if (ans < i) and(i <= tmp):
            ans = i
        tmp2 = m//i
        if (ans < tmp2) and(tmp2 <= tmp):
            ans = tmp2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
flag = True
ans = n
while flag:
    if m%ans == 0:
        flag = False
    else:
        ans += 1
print(int(m/ans))

Fixed submission:
import numpy as np

n,m = map(int,input().split())
ans = 0
tmp = int(m/n)
for i in range(1,int(np.sqrt(m)+1)):
    if m%i == 0:
        if (ans < i) and(i <= tmp):
            ans = i
        tmp2 = m//i
        if (ans < tmp2) and(tmp2 <= tmp):
            ans = tmp2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
flag = True
ans = n
while flag:
    if m%ans == 0:
        flag = False
    else:
        ans += 1
print(int(m/ans))

Fixed submission:
import numpy as np

n,m = map(int,input().split())
ans = 0
tmp = int(m/n)
for i in range(1,int(np.sqrt(m)+1)):
    if m%i == 0:
        if (ans < i) and(i <= tmp):
            ans = i
        tmp2 = m//i
        if (ans < tmp2) and(tmp2 <= tmp):
            ans = tmp2
print(ans)
Buggy python submission (verdict: Runtime Error):
#C - Traveling
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1) :
        check = 1
        break
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b = map(int,input().split())
if a*b%2 == 0 or a*b == 0:
    print('Even')
else:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
#C - Traveling
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 > 0) :
        check = 1
        break
    print(((x-x_b)+(y-y_b) - (step - step_b)))
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
a,b = map(int,input().split())
if a*b%2 == 0 or a*b == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
yukichi_num = 0
ichiyou_num = 0
a,b = map(int,input().split())
for i in range(a+1):
    for  n in range(a+1-i):
        if i*10000+n*5000+1000*(a-i-n) == b:
            print('{0} {1} {2}'.format(i,n,a-i-n))
            exit()
print('-1 -1 -1')

Fixed submission:
a = input()
print("2018"+a[4::])

Buggy python submission (verdict: Runtime Error):
yukichi_num = 0
ichiyou_num = 0
a,b = map(int,input().split())
while (b >= 10000) and (a > 0):
    b -=10000
    yukichi_num += 1
    a -= 1
while (b >= 5000) and(a > 0):
    b -= 5000
    ichiyou_num += 1
    a -= 1
if (b/1000) <= a:
    print('{0} {1} {2}'.format(yukichi_num,ichiyou_num,int(b/1000)))
else:
    print('-1 -1 -1')

Fixed submission:
a = input()
print("2018"+a[4::])

Buggy python submission (verdict: Runtime Error):
yukichi_num = 0
ichiyou_num = 0
a,b = map(int,input().split())
while (b >= 10000) and (a > 0):
    b -=10000
    yukichi_num += 1
    a -= 1
while (b >= 5000) and(a > 0):
    b -= 5000
    ichiyou_num += 1
    a -= 1
if (b//1000) <= a:
    print('{0} {1} {2}'.format(yukichi_num,ichiyou_num,int(b/1000)))
else:
    print('-1 -1 -1')

Fixed submission:
a = input()
print("2018"+a[4::])
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
flag = False
for i in range(N+1):
    for j in range(N+1-i):
        x = N - i - jint
        if x*1000 + j*5000 +i*10000 == Y:
            print(i,j,x)
            flag = True
            break
    if flag == True:
        break


if flag == False:
    print('-1 -1 -1')

Fixed submission:
yukichi_num = 0
ichiyou_num = 0
d,e,f = -1,-1,-1
a,b = map(int,input().split())
for i in range(a+1):
    for  n in range(a+1-i):
        if i*10000+n*5000+1000*(a-i-n) == b:
            d = i
            e = n
            f = a-i-n
print('{0} {1} {2}'.format(d,e,f))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
from collections import defaultdict
d = defaultdict(int)
num_list = list(map(int,input().split()))
for tmp in num_list:
	d[tmp] += 1
    
v_list = sorted(list(d.values()))
while len(v_list) > k:
    v_list.pop(0)
print(n - sum(v_list))

Fixed submission:
n,k = map(int,input().split())
from collections import defaultdict
d = defaultdict(int)
num_list = list(map(int,input().split()))
for tmp in num_list:
	d[tmp] += 1
    
v_list = sorted(list(d.values()) ,reverse=True)

print(n - sum(v_list[:k]))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
from collections import defaultdict
d = defaultdict(int)
for i in range(5):
    tmp = input()
    d[tmp] += 1
    
v_list = sorted(list(d.values()))
while len(v_list) > k:
    v_list.pop(0)
print(n - sum(v_list))

Fixed submission:
n,k = map(int,input().split())
from collections import defaultdict
d = defaultdict(int)
num_list = list(map(int,input().split()))
for tmp in num_list:
	d[tmp] += 1
    
v_list = sorted(list(d.values()) ,reverse=True)

print(n - sum(v_list[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
iki = []
iki2 = []
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        iki.append(b)
    if b == n:
        iki2.append(a)
        

flag = False
for i in iki:
    if i in iki2:
        flag = True
        break
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")



Fixed submission:
n,m = map(int,input().split())
c = [False for i in range(200000)]
d = [False for i in range(200000)]
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        c[b] = True 
    if b == n:
        d[a] = True
        
flag = False
for i in range(200000):
    if c[i] and d[i]:
        flag = True
        break
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
graph = [[0*n] for j in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

flag = False
for i in range(n):
    if graph[0][i] == 1:
        if graph[i][n-1] == 1:
            flag = True
            break
                
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")


Fixed submission:
n,m = map(int,input().split())
c = [False for i in range(200000)]
d = [False for i in range(200000)]
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        c[b] = True 
    if b == n:
        d[a] = True
        
flag = False
for i in range(200000):
    if c[i] and d[i]:
        flag = True
        break
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

flag = False
for i in range(n):
    if graph[0][i] == 1:
        if graph[i][n-1] == 1:
            flag = True
            break
                
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")


Fixed submission:
n,m = map(int,input().split())
c = [False for i in range(200000)]
d = [False for i in range(200000)]
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        c[b] = True 
    if b == n:
        d[a] = True
        
flag = False
for i in range(200000):
    if c[i] and d[i]:
        flag = True
        break
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
mod = 10**9+7

if abs(n -m) > 1:
    print(0)
    
if  abs(n -m) == 0:
    n_ans = 1
    m_ans = 1
    for i in range(1,n+1):
        n_ans *= i%mod
    for i in range(1,m+1):
        m_ans *= i%mod
    print(2*n_ans*m_ans%mod)
    
if abs(n -m) == 1:
    n_ans = 1
    m_ans = 1
    for i in range(1,n+1):
        n_ans *= i%mod
    for i in range(1,m+1):
        m_ans *= i%mod
    print(n_ans*m_ans%mod)

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

if abs(n -m) > 1:
    print(0)
    
if  abs(n -m) == 0:
    n_ans = 1
    m_ans = 1
    for i in range(1,n+1):
        n_ans *= i
        n_ans %= mod
    for i in range(1,m+1):
        m_ans *= i
        m_ans %= mod
    print(2*n_ans*m_ans%mod)
    
if abs(n -m) == 1:
    n_ans = 1
    m_ans = 1
    for i in range(1,n+1):
        n_ans *= i
        n_ans %= mod
    for i in range(1,m+1):
        m_ans *= i
        m_ans %= mod
    print(n_ans*m_ans%mod)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
for i in range(n):
    if i == 0:
        string = input()
        for j in string:
            ans[j] += 1
    else:
        tmp = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
        string = input()
        for j in string:
            tmp[j] += 1
            
        for j in tmp:
            ans[j] = min(ans[j],tmp[j])

anser = ''
for i in ans:
    for j in range(ans[i]):
        anser += i
print(anser.sort())

Fixed submission:
import string
n = int(input())
ans = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
for i in range(n):
    if i == 0:
        st = input()
        for j in st:
            ans[j] += 1
    else:
        tmp = {'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,
      'm':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,
      'y':0,'z':0}
        st = input()
        for j in st:
            tmp[j] += 1
            
        for j in tmp:
            ans[j] = min(ans[j],tmp[j])

anser = ''
for d in string.ascii_lowercase:
    for j in range(ans[d]):
        anser += d
print(anser)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if (0 <= z <= k) and type(z) == int:
            cnt += 1
            
print(cnt)

Fixed submission:
k,s = map(int,input().split())
cnt = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if (0 <= z <= k) :
            cnt += 1
            
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
N = str(N)
print(1000 - int(N[-3] + N[-2] + N[-1]))

Fixed submission:
N = int(input())

if(N % 1000 != 0):
 print(1000 - (N % 1000))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
N, K=map(int,input().split())

fruit = list(input().split())
price = list(map(int, input().split()))

price2 = sorted(price)
i = 0
sum = 0
while (i < K):
  sum += price2[i]
  i += 1

print(sum)

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

price = list(map(int, input().split()))

price2 = sorted(price)
i = 0
sum = 0
while (i < K):
  sum += price2[i]
  i += 1

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = list(map(int, input().split()))
if (0 in lst):
  print(0)
else:
  product = 1
  for i in lst: #iというlist中の数字
    product *= i #これが(i + 1)番目

  if(product > 1000000000000000000):
      #これをfor文に書くことで掛け終える前に超えたらやめることができる（処理を短縮できる！）
    print(-1)
  else:
    print(product)

Fixed submission:
N = int(input())
lst = list(map(int, input().split()))
if (0 in lst):
  print(0)
else:
  product = 1
  for i in lst: 
    product *= i

    if(product > 1000000000000000000):
      print(-1)
      break
  else:
    print(product)

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

product = 1
for i in lst:
  product *= i #これが(i + 1)番目

if(product > 1000000000000000000):
  print(-1)
else:
  print(product)

Fixed submission:
N = int(input())
lst = list(map(int, input().split()))
if (0 in lst):
  print(0)
else:
  product = 1
  for i in lst: 
    product *= i

    if(product > 1000000000000000000):
      print(-1)
      break
  else:
    print(product)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

if(N = M):
  print("Yes")
else:
  print("No")

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

if(N == M):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
dist = {"MON":0,"TUE":1,"WED":2,"THU":3,"FRI":4,"SAT":5,"FRI":6,"SUN":7}
i = str(input())
if i == "SUN":
  print(7)
else:
  print(dist["SUN"]-dist(i))



Fixed submission:
dist = {"MON":1,"TUE":2,"WED":3,"THU":4,"FRI":5,"SAT":6,"SUN":7}
i = str(input())
if i == "SUN":
  print(7)
else:
  print(dist["SUN"]-dist[i])
Buggy python submission (verdict: Runtime Error):
N = input()

print(N % 1000)

Fixed submission:
N = int(input())

MOD = N % 1000
ANS = 1000 - MOD

if (MOD == 0):
  print(0)
else:
  print(ANS)
Buggy python submission (verdict: Runtime Error):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=t()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)

Fixed submission:
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=S()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


n=IN()
ans=""
while n>0:
    b=n%26
    if b==0:
        ans='z'+ans
    else:
        ans=chr(ord('a')+b-1)+ans
        n//=26
print(ans)
        



Fixed submission:
n=int(input())
ans = " "
while n>0:
    re=n%26
    if re!=0:
        ans= chr(ord('a')+re-1)+ans
        n=n//26
    else:
        ans='z'+ans
        n=(n//26)-1
print(ans)