Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
if input() == "A" : print("T")
elif input() == "T" : print("A")
elif input() == "C" : print("G")
else : print("C")

Fixed submission:
b = str(input())
if b == "A" : print("T")
elif b == "T" : print("A")
elif b == "C" : print("G")
else : print("C")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
dic = {i: [] for i in range(1, N + 1)} 
XY_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  dic[X].append(Y)
  XY_list[i] = (X, Y)
for j in range(1, N + 1):
  dic[j].sort()
for x in XY_list:
  print(str(x[0]).zfill(6)+str(dic[x[0]].index(x[1]) + 1).zfill(6))

Fixed submission:
N, M = map(int, input().split())
XY_list = [[] for i in range(N)]
ans_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  XY_list[X - 1].append((Y, i))
for j, k in enumerate(XY_list):
  k.sort()
  for l, (y, m) in enumerate(k):
    ans_list[m] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
print(*ans_list, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
City_list = [[] for i in range(N)]
X_list = [None] * M
Y_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  City_list[X - 1].append(Y)
  X_list[i] = X
  Y_list[i] = Y
for j in range(N):
  City_list[j].sort()
for x, y in zip(X_list, Y_list):
  print(str(x).zfill(6)+str(City_list[x - 1].index(y) + 1).zfill(6))

Fixed submission:
N, M = map(int, input().split())
XY_list = [[] for i in range(N)]
ans_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  XY_list[X - 1].append((Y, i))
for j, k in enumerate(XY_list):
  k.sort()
  for l, (y, m) in enumerate(k):
    ans_list[m] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
print(*ans_list, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
dic = {i: [] for i in range(1, N + 1)} 
X_list = [None] * M
Y_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  dic[X].append(Y)
  X_list[i] = X
  Y_list[i] = Y
for j in range(1, N + 1):
  dic[j].sort()
for x, y in zip(X_list, Y_list):
  print(str(x).zfill(6)+str(dic[x].index(y) + 1).zfill(6))

Fixed submission:
N, M = map(int, input().split())
XY_list = [[] for i in range(N)]
ans_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  XY_list[X - 1].append((Y, i))
for j, k in enumerate(XY_list):
  k.sort()
  for l, (y, m) in enumerate(k):
    ans_list[m] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
print(*ans_list, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
dic = {i: [] for i in range(1, N + 1)} 
X_list = []
Y_list = []
for i in range(M):
  X, Y = map(int, input().split())
  dic[X].append(Y)
  X_list.append(X)
  Y_list.append(Y)
for j in range(1, N + 1):
  dic[j].sort()
for x, y in zip(X_list, Y_list):
  print(str(x).zfill(6)+str(dic[x].index(y) + 1).zfill(6))

Fixed submission:
N, M = map(int, input().split())
XY_list = [[] for i in range(N)]
ans_list = [None] * M
for i in range(M):
  X, Y = map(int, input().split())
  XY_list[X - 1].append((Y, i))
for j, k in enumerate(XY_list):
  k.sort()
  for l, (y, m) in enumerate(k):
    ans_list[m] = str(j + 1).zfill(6) + str(l + 1).zfill(6)
print(*ans_list, sep = "\n")
Buggy python submission (verdict: Runtime Error):
print((int(input()) - 1) * (int(input()) - 1))

Fixed submission:
n, m = list(map(int, input().split()))
print((n - 1) * (m - 1))

Buggy python submission (verdict: Runtime Error):
print(int(input() - 1) * int(input() - 1))

Fixed submission:
n, m = list(map(int, input().split()))
print((n - 1) * (m - 1))
Buggy python submission (verdict: Runtime Error):
A, op, B = intput().split()
if str(op) == "+" :
  print(int(A) + int(B))
else :
  print(int(A) - int(B))

Fixed submission:
A, op, B = input().split()
if str(op) == "+" :
  print(int(A) + int(B))
else :
  print(int(A) - int(B))
Buggy python submission (verdict: Runtime Error):
c = str(intput())
if c == "a" or c == "e" or c == "i" or c == "o" or c == "u" :
  print("vowel")
else :
  print("consonant")

Fixed submission:
c = str(input())
if c == "a" or c == "e" or c == "i" or c == "o" or c == "u" :
  print("vowel")
else :
  print("consonant")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
L = [0] * (N+1)
for i in range(N):
  L[A[i]]+=1
for i in range(1,N+1):
  print(L[i])

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
L = [0] * (N+1)
for i in range(N-1):
  L[A[i]]+=1
for i in range(1,N+1):
  print(L[i])
Buggy python submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

X, Y, Z = map(int, input().split())
print(Z, X, Y)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

X, Y, Z = map(int, input().split())
print(Z, X, Y)


Fixed submission:
X, Y, Z = map(int, input().split())
print(Z, X, Y)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

def expect(x):
    prob = 1 / float(x)
    return sum(np.arange(1, x+1)) * prob

p_mapped = [expect(i) for i in p]

max = 0
for i in range(len(p_mapped)-K+1):
    answer = np.sum(p_mapped[i:i+K])
    if answer >= max:
        max = answer
print(max)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

p_mapped = [(i + 1) / 2 for i in p]
p_m_cumsum = np.cumsum(p_mapped)

max = 0
for i in range(len(p_m_cumsum)-K+1):
    if i != 0:
        answer = p_m_cumsum[i+K-1] - p_m_cumsum[i-1]
    else:
        answer = p_m_cumsum[i+K-1]
    if answer >= max:
        max = answer
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

expect = {}
for i in range(1, 1001):
    prob = 1 / float(i)
    expect[i] = sum(np.arange(1, i+1)) * prob

p_mapped = [expect[i] for i in p]

max = 0
for i in range(len(p_mapped)-K+1):
    answer = np.sum(p_mapped[i:i+K])
    if answer >= max:
        max = answer
print(max)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

p_mapped = [(i + 1) / 2 for i in p]
p_m_cumsum = np.cumsum(p_mapped)

max = 0
for i in range(len(p_m_cumsum)-K+1):
    if i != 0:
        answer = p_m_cumsum[i+K-1] - p_m_cumsum[i-1]
    else:
        answer = p_m_cumsum[i+K-1]
    if answer >= max:
        max = answer
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

def summation(x):
    result = 0
    for i in range(x+1):
        result += i
    return result

expect = {}
for i in range(1, 1001):
    prob = 1 / float(i)
    expect[i] = summation(i) * prob

p_mapped = [expect[i] for i in p]

max = 0
for i in range(len(p_mapped)-K+1):
    answer = np.sum(p_mapped[i:i+K])
    if answer >= max:
        max = answer
print(max)

Fixed submission:
import numpy as np

N, K = map(int, input().split())
p = list(map(int, input().split()))

p_mapped = [(i + 1) / 2 for i in p]
p_m_cumsum = np.cumsum(p_mapped)

max = 0
for i in range(len(p_m_cumsum)-K+1):
    if i != 0:
        answer = p_m_cumsum[i+K-1] - p_m_cumsum[i-1]
    else:
        answer = p_m_cumsum[i+K-1]
    if answer >= max:
        max = answer
print(max)
Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

sorted_H = sorted(H)
num = np.maximum(0, N-K)
answer = sum(sorted_H[:num])
print(answer)

Fixed submission:
import numpy as np
N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

sorted_H = sorted(H)
num = np.maximum(0, N-K)
answer = sum(sorted_H[:num])
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())

P = [int(i) for i in input().split()]

loop_max = P.index(np.min(P))

count = 0
for i in range(loop_max+1):
    if P[i] == np.min(P[:i+1]):
        count += 1
print(count)

Fixed submission:
import numpy as np

N = int(input())

P = [int(i) for i in input().split()]

minimum = P[0]
count = 1
for i in range(1, N):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())

P = [int(i) for i in input().split()]

count = 0
for i in range(N):
    if P[i] == np.min(P[:i+1]):
        count += 1
print(count)

Fixed submission:
import numpy as np

N = int(input())

P = [int(i) for i in input().split()]

minimum = P[0]
count = 1
for i in range(1, N):
    if P[i] <= minimum:
        count += 1
        minimum = P[i]

print(count)
Buggy python submission (verdict: Runtime Error):
import math

A, B = [int(i) for i in input().split()]

answer = (A * B) // math.gcd(A, B)
print(answer)

Fixed submission:
A, B = [int(i) for i in input().split()]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return (a * b) // gcd(a, b)
	
answer = lcm(A, B)
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

result = []
for i in range(1, N+1):
    result.append(A.index(i) + 1)
print(*result)


Fixed submission:
import numpy as np
N = int(input())
A = list(map(int, input().split()))

result = np.argsort(A) + 1

print(*result)
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = [int(i) for i in input().split()]
A = []
for i in range(Q):
    A.append(int(input())-1)

for i in range(N):
    score = K - Q + A.count(i)
#    print(score)
    if score > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N, K, Q = [int(i) for i in input().split()]

score = [K - Q] * N

for i in range(Q):
    score[int(input())-1] += 1

for i in range(N):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K, Q = [int(i) for i in input().split()]
A = []
for i in range(Q):
    A.append(int(input())-1)

point = np.array([A.count(i) for i in range(N)])

score = K - Q + point
result = ['Yes' if score[i] > 0 else 'No' for i in range(len(score))]
for i in range(len(result)):
    print(result[i])

Fixed submission:
N, K, Q = [int(i) for i in input().split()]

score = [K - Q] * N

for i in range(Q):
    score[int(input())-1] += 1

for i in range(N):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K, Q = [int(i) for i in input().split()]
A = []
for i in range(Q):
    A.append(int(input())-1)

score = K * np.ones(N)

point = np.array([A.count(i) for i in range(N)])
minus = Q - point

score = score - minus
result = ['Yes' if score[i] > 0 else 'No' for i in range(len(score))]
for i in range(len(result)):
    print(result[i])

Fixed submission:
N, K, Q = [int(i) for i in input().split()]

score = [K - Q] * N

for i in range(Q):
    score[int(input())-1] += 1

for i in range(N):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = [int(i) for i in input().split()]
A = []
for i in range(Q):
    A.append(int(input())-1)

score = [K] * N

point = [A.count(i) for i in range(N)]
minus = [Q - point[i] for i in range(len(point))]

score = [score[i] - minus[i] for i in range(len(score))]
result = ['Yes' if score[i] > 0 else 'No' for i in range(len(score))]
for i in range(len(result)):
    print(result[i])

Fixed submission:
N, K, Q = [int(i) for i in input().split()]

score = [K - Q] * N

for i in range(Q):
    score[int(input())-1] += 1

for i in range(N):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N-1):
    count = 0
    for j in range(i, N-1):
        if H[j] >= H[j+1]:
            count += 1
        else:
            break
    if count > max:
        max = count

print(max)

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

updown = ['-' if H[i+1] <= H[i] else '+' for i in range(N-1)]
count = 0
max = 0
for i in updown:
    if i == '-':
        count += 1
    else:
        if count > max:
            max = count
        count = 0
if count > max:
    max = count
print(max)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
H = [int(i) for i in input().split()]

result ='Yes'
for i in range(N-2):
    num = H[i] - 1
    tmp = H[i+1:]
    if num > np.min(tmp):
        result = 'No'
        break
print(result)

Fixed submission:
import numpy as np
N = int(input())
H = [int(i) for i in input().split()]

result = 'Yes'
for i in range(N-2, -1, -1):
    if H[i] - H[i+1] >= 2:
        result = 'No'
        break
    elif H[i] - H[i+1] == 1:
        H[i] -= 1
    else:
        continue
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
H = [int(i) for i in input().split()]

result ='Yes'
for i in range(N-1):
    num = H[i] - 1
    tmp = H[i+1:]
    if num > np.min(tmp):
        result = 'No'
        break
print(result)

Fixed submission:
import numpy as np
N = int(input())
H = [int(i) for i in input().split()]

result = 'Yes'
for i in range(N-2, -1, -1):
    if H[i] - H[i+1] >= 2:
        result = 'No'
        break
    elif H[i] - H[i+1] == 1:
        H[i] -= 1
    else:
        continue
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(np.max(A))
    A[i] = tmp

Fixed submission:
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)


Fixed submission:
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(np.max(A))
    A[i] = tmp

Fixed submission:
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(np.max(A))
    A[i] = tmp

Fixed submission:
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = copy.deepcopy(A)
    tmp[i] = 0
    print(np.max(tmp))

Fixed submission:
import numpy as np
import copy
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

tmp = copy.deepcopy(A)
tmp = list(sorted(A, reverse=True))

Amax = tmp[0]
Asecond = tmp[1]

for i in range(N):
    if A[i] != Amax:
        print(Amax)
    else:
        print(Asecond)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
A, B, C, D = [int(i) for i in input().split()]

large = np.max([C, D])
small = np.min([C, D])
quo = large // small
rem = large % small
g = small
while rem != 0:
    large = small 
    small = rem
    quo = large // small
    rem = large % small

g = small
#print(g)

l = C / g * D

#num_B_1 = math.floor(B / C)
#num_B_2 = math.floor(B / D)
#num_B_3 = math.floor(B / l)
num_B_1 = B // C
num_B_2 = B // D
num_B_3 = B // l
num_B = B - (num_B_1 + num_B_2 - num_B_3)

#num_A_1 = math.floor((A - 1) / C)
#num_A_2 = math.floor((A - 1) / D)
#num_A_3 = math.floor((A - 1) / l)
num_A_1 = (A - 1) // C
num_A_2 = (A - 1) // D
num_A_3 = ((A - 1) // l
num_A = (A - 1) - (num_A_1 + num_A_2 - num_A_3)

print(num_B - num_A)

Fixed submission:
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, M = [int(i) for i in input().split()]
L = [0]*M
R = [0]*M
for i in range(M):
    L[i], R[i] = [int(i) for i in input().split()]

Rmin = np.min(R)
Lmax = np.max(L)
if Rmin >= Lmax:
    num = np.min(R) - np.max(L) + 1
else
    num = 0
print(num)

Fixed submission:
import numpy as np
N, M = [int(i) for i in input().split()]
L = [0]*M
R = [0]*M
for i in range(M):
    L[i], R[i] = [int(i) for i in input().split()]

Rmin = np.min(R)
Lmax = np.max(L)
if Rmin >= Lmax:
    num = np.min(R) - np.max(L) + 1
else:
    num = 0
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 1

nums = list(map(lambda x : int(x),input().split()))

for i in range(n):
    ans *= nums[i]
    
if ans > 10**18:
  ans = -1

print(ans)

Fixed submission:
n = int(input())
ans = 1

nums = list(map(lambda x : int(x),input().split()))

for i in range(n):
    if nums[i] == 0:
        ans = 0
        break
        
for k in range(n):
    ans *= nums[k]
    if ans > 10**18:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
C=A*B
if A<B :
    A,B=B,A
while a%b=0:
    A,B=B,A%B 
D=C/B
print(D)

Fixed submission:
A,B=map(int,input().split())
C=A*B
if A<B :
    A,B=B,A
while A%B!=0:
    A,B=B,A%B 
D=C/B
print(int(D))
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input.split)
if A+B+C>=22:
    print("bust")
elif A+B+C<=21:
    print("win")

Fixed submission:
A,B,C=map(int,input().split())
if A+B+C>=22:
    print("bust")
elif A+B+C<=21:
    print("win")
Buggy python submission (verdict: Runtime Error):
# a(1)〜z(26)を使った26進数に変換する

import string

N = int(input())
alpha = list(string.ascii_lowercase)
alpha.append('')

# valueに答えとなるalphabetの羅列を入れる
value = []
value.append(alpha[N // (26**10) - 1])

for i in range(10,1,-1):
  value.append(alpha[(N % (26**i)) // (26**(i-1)) - 1])

value.append(alpha[N % (26**1) - 1])

value = ''.join(value)
print(value)

Fixed submission:
alpha = input()

if alpha.islower():
  print('a')
else:
  print('A')
Buggy python submission (verdict: Time Limit Exceeded):
import math
k = int(input())

ans = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
      value = math.gcd(i,j)
      ans += math.gcd(value,k)

print(ans)

Fixed submission:
import math
k = int(input())
ans = 0

for i in range(1, k+1):
    for j in range(1, k+1):
        num = math.gcd(i, j)
        for l in range(1, k+1):
            ans += math.gcd(num, l)

print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

have_money = a + b*2

print( "Yes" if( have_money >= C ) else "No" )



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


have_money = a + b

print( "Yes" if( have_money >= c ) else "No" )
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>

int main( void )
{
    int r, g;
    scanf("%d", &r);
    scanf("%d", &g);

    printf("%d\n", r + (g-r)*2);
    return 0;
}

Fixed submission:
x, y = int(input()), int(input())
print( (y - x)*2 + x )
Buggy python submission (verdict: Runtime Error):
(a,b)=list(map(int,input()));print( a-b if( a > b ) else 0 )

Fixed submission:
(a,b)=list(map(int,input().split()))
print( a-b if( a > b ) else 0 )
Buggy python submission (verdict: Runtime Error):
import math
import tensorflow as tf
N = int(input()) # yen

number_of_bills = N / 1000
change = number_of_bills*1000 - N
if change < 0:
    change += 1000
print(str(int(change)))


Fixed submission:
N = int(input()) # yen

number_of_bills = int(N / 1000)
change = number_of_bills*1000 - N
if change < 0:
    change += 1000
print(str(int(change)))

Buggy python submission (verdict: Runtime Error):

N = int(input()) # yen

number_of_bills = ceil(N / 1000)
change = number_of_bills*1000 - N
print(str(change), flush=True)


Fixed submission:
N = int(input()) # yen

number_of_bills = int(N / 1000)
change = number_of_bills*1000 - N
if change < 0:
    change += 1000
print(str(int(change)))

Buggy python submission (verdict: Runtime Error):
n = input()
a = n%1000
if a == 1000:
  print(0)
else:
  print(a)

Fixed submission:
n = int(input())
a = n%1000
if a == 0:
  print(0)
else:
  print(1000 - a)
Buggy python submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A_time = list(map(int,input().split()))
B_time = list(map(int,input().split()))
all_time = 0
a_t = A_time.pop(0)
b_t = B_time.pop(0)
count = 1
while all_time < K:
    if a_t <= b_t:
        all_time = all_time + a_t
        if count == 1 and all_time > K:
            count = -1
            break
        a_t = A_time.pop(0)
        count +=1
    else:
        all_time = all_time + b_t
        if count == 1 and all_time > K:
            count = -1
            break
        b_t = B_time.pop()
        count +=1
    if len(A_time)==0 or len(B_time)==0:
        break
        
if all_time > K:
    print(count-1)
elif count == -1:
    print(0)
else:
    if len(A_time)==0:
        while all_time > K:
            all_time = all_time + b_t
            count += 1
            b_t = B_time.pop(0)
        print(count - 1)
    else:
        while all_time > K:
            all_time = all_time + a_t
            count += 1
            b_t = A_time.pop(0)
        print(count - 1)

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

a,b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break    
    while b[j]>K-a[i]:
        j -= 1    
    ans = max(ans,i+j)
print(ans)