qyliang/CodeNanoFix huggingface dataset:
Buggy code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.8.2)

import math
import statistics
import numpy as np
import queue
import itertools
import functools 

n = int(input())
print(0 if n == 1000 else 1000 - (n % 1000))


Fixed code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.8.2)

import math
import statistics
import numpy as np
import queue
import itertools
import functools 

n = int(input())
print(0 if n % 1000 == 0 else 1000 - (n % 1000))
Buggy code:

n=int(input())
if n%1000==0:
    print(0)
else:
    x=math.ceil(n/1000)
    ans=int(x*1000)-n
    print(ans)



Fixed code:
import math
n=int(input())
if n%1000==0:
    print(0)
else:
    x=math.ceil(n/1000)
    ans=int(x*1000)-n
    print(ans)
Buggy code:
n = int(input())

maisuu = n / 1000
amari = n - maisuu*1000
oturi = 1000 - amari

if amari > 0:
    maisuu += 1

print(oturi)

Fixed code:
n = int(input())

amari = n % 1000

oturi = (1000 - amari) % 1000

# maisuu = n / 1000
# amari = n - maisuu*1000
# oturi = 1000 - amari

# if amari > 0:
#     maisuu += 1

print(oturi)
Buggy code:
def main():
    N = int(input())

    return N % 1000

print(main())


Fixed code:
def main():
    N = int(input())

    return (1000 - (N % 1000)) % 1000

print(main())
Buggy code:
N=int(input())
print(1000-(N%1000))

Fixed code:
N = int(input())

print((1000-N%1000)%1000)
Buggy code:
n=int(input())
print((1000-n%1000))

Fixed code:
n = int(input())
print((1000 - n%1000)%1000)
Buggy code:
print(100000-int(input())%1000)


Fixed code:
print((100000-int(input()))%1000)
Buggy code:
N = int(input())
otsuri = N%1000
print(otsuri)

Fixed code:
N = int(input())
otsuri = (1000 - N%1000)%1000
print(otsuri)
Buggy code:
n = int(input())

res = n%1000

if res == 0:
  print(0)
else:
  print(100-res)



Fixed code:
n = int(input())

res = n % 1000

if res == 0:
    print(res)
else:
    print(1000-res)
Buggy code:
input1 = input()
result = 1000 - int(input1) % 1000
if result == 1000:
    print 0
else:
    result

Fixed code:
input1 = input()
result = 1000 - int(input1) % 1000
if result == 1000:
    print(0)
else:
    print(result)
Buggy code:
a = int(input())

if a % 1000 == 0:
  print("0")
else:
  print(a % 1000)

Fixed code:
a = int(input())

if a % 1000 == 0:
  print("0")
else:
  print(1000 - a % 1000)
Buggy code:
n=int(input())
a=n%1000
ans=1000-a
print(ans)

Fixed code:
n=int(input())

ans=(1000-(n%1000))%1000

print(ans)
Buggy code:
pay = int(input())

while(pay >=0):
    pay -= 1000
otu = abs(pay)
print(otu)

Fixed code:
pay = int(input())

while(pay >0):
    pay -= 1000
otu = abs(pay)
print(otu)
Buggy code:
n=int(input())

if n==0:
    print('0')
else:
    print(1000-n)

Fixed code:
n=int(input())
n%=1000

if n==0:
    print('0')
else:
    print(1000-n)
Buggy code:
a = int(input())
#a = list(map(int, input().split()))
#x,y = map(int, input().split())

#x,n = map(int, input().split())
#p = input().split()
#for i in range(len(p)):
#    p[i] = int(p[i])
money = 0
while True:
    if money > a:
        print(money-a)
        break
    else :
        money += 1000

Fixed code:
a = int(input())
#a = list(map(int, input().split()))
#x,y = map(int, input().split())

#x,n = map(int, input().split())
#p = input().split()
#for i in range(len(p)):
#    p[i] = int(p[i])
money = 0
while True:
    if money >= a:
        print(money-a)
        break
    else :
        money += 1000
Buggy code:
n=int(input())
print(n%1000 == 0 if 0 else 1000-n)

Fixed code:
n=int(input())%1000
print(0 if n==0 else 1000-n)
Buggy code:
N = int(input())
pay = (N%1000)
if(pay = 0):
  print(0)
else:
  print(1000 - pay)

Fixed code:
N=int(input())%1000

if N==0:
  print(0)
else:
  print(1000-N)
Buggy code:
N = int(input())
pay = 1000 - (N%1000)
print(pay)

Fixed code:
N = int(input())

print((1000 - N) % 1000)
Buggy code:

a = int(input())
b = 0
while b <= a:
    b = b + 1000

print(abs(a-b))

Fixed code:

a = int(input())
b = 0
while b < a:
    b = b + 1000

print(abs(a-b))
Buggy code:
n = int(input())
print(0 if a%1000 == 0 else 1000-a%1000)

Fixed code:
n = int(input())
print(0 if n%1000 == 0 else 1000-n%1000)
Buggy code:


n = int(input())

print(1000 - n%1000)

Fixed code:
n = int(input())
print(- n % 1000)
Buggy code:
N=int(input())
Na=N%1000
if Na=0:
  print(Na)
else:
  print(1000-Na)
  

Fixed code:
N=int(input())
Na=N%1000
if Na==0:
  print(Na)
else:
  print(1000-Na)
Buggy code:
n = int(input())
print(print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)

Fixed code:
n = int(input())
print(0 if n%1000 == 0 else 1000*((n//1000)+1) - n)
Buggy code:
N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)

Fixed code:
import math

N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)
Buggy code:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  cnt = (N // 1000) + 1
  ans = 1000 * cnt - N
  print(N)

Fixed code:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  cnt = N // 1000 + 1
  ans = cnt * 1000 - N
  print(ans)
Buggy code:
n = int(input())
x = (n//1000 + 1) * 1000 - n
print(x)

Fixed code:
n = int(input())
x = (n//1000 + 1) * 1000 - n
print(x % 1000)
Buggy code:
x = int(input())
print(1000-x%1000)

Fixed code:
x = int(input())
print((1000-x%1000)%1000)
Buggy code:
s = int(input())
change = s % 1000
if change == 0:
    print(0):
else:
    print(1000-change)

Fixed code:
s = int(input())
change = s % 1000
if change == 0:
    print(0)
else:
    print(1000-change)
Buggy code:
import sys, math,os
from io import BytesIO, IOBase
#data = BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from bisect import bisect_left as bl, bisect_right as br, insort
# from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
# from itertools import permutations,combinations
# from decimal import Decimal
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var): sys.stdout.write(' '.join(map(str, var)) + '\n')
def out(var): sys.stdout.write(str(var) + '\n')
#sys.setrecursionlimit(100000 + 1)
INF = 10**9
mod = 998244353

N=int(data())
out(1000-N%1000)








Fixed code:
import sys, math,os
from io import BytesIO, IOBase
#data = BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from bisect import bisect_left as bl, bisect_right as br, insort
# from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
# from itertools import permutations,combinations
# from decimal import Decimal
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var): sys.stdout.write(' '.join(map(str, var)) + '\n')
def out(var): sys.stdout.write(str(var) + '\n')
#sys.setrecursionlimit(100000 + 1)
INF = 10**9
mod = 998244353

N=int(data())
out((1000-N%1000)%1000)
Buggy code:
n=int(input())
x=0
while x<n:
  x+=1000
print(n-x)

Fixed code:
n=int(input())
x=0
while x<n:
  x+=1000
print(x-n)
Buggy code:
N = int(input())
res = N%1000

if N == 0:
  print(res)
else:
  print(1000-res)

Fixed code:
N = int(input())
res = N%1000

if res == 0:
  print(res)
else:
  print(1000-res)
Buggy code:
N = int(input())
x = N % 1000
x = int()
print(x)

Fixed code:
N = int(input())
x =(1000 - N % 1000)%1000
print(x)
Buggy code:
N=int(input())
a = N%1000
print(a%1000)

Fixed code:
N=int(input())
a = N%1000
print((1000-a)%1000)
Buggy code:
n = int(input())
#n,k = map(int,input().split())
#a = list(map(int,input().split()))
#mod = pow(10,9) + 7
if(n == 10000):
    print(0)
else:  
    print(1000-n%1000)
'''
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
print(a)
'''

Fixed code:
n = int(input())
#n,k = map(int,input().split())
#a = list(map(int,input().split()))
#mod = pow(10,9) + 7
if(n == 10000):
    print(0)
elif(n%1000 == 0):
    print(0)
else:  
    print(1000-n%1000)
'''
a = []
for i in range(n):
    a.append(list(map(int,input().split())))
print(a)
'''
Buggy code:
N = int(input())
N = N % 1000
ans = 1000 - N if not N else 0
print(ans)

Fixed code:
N = int(input())
N = N % 1000
ans = 1000 - N if N else 0
print(ans)
Buggy code:
n=input()
print(999-((n-1)%1000))

Fixed code:
n=int(input())
print(999-((n-1)%1000))
Buggy code:
input_line = input()
a = input_line % 1000
if a == 0:
  print(0)
else:
  print(1000-a)

Fixed code:
input_line = int(input())
a = input_line % 1000
if a == 0:
  print(0)
else:
  print(1000-a)
Buggy code:

import math
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 code:
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 code:
N = int(input())
if N%1000 != 0:
	maisu = N//1000 + 1
else:
  maisu = N//1000
print(maisu*1000-k)

Fixed code:
N = int(input())
if N%1000 != 0:
	maisu = N//1000 + 1
else:
  maisu = N//1000
print(maisu*1000-N)
Buggy code:
N = int(input())
print(1000 - N%1000 if N%1000!=0 else 0)a

Fixed code:
N = int(input())
print(1000 - N%1000 if N%1000!=0 else 0)
Buggy code:
N = int(input())
print(1000-(N%1000))

Fixed code:
N = int(input())

print(-(N%-1000))
Buggy code:
print(abs(-(int(input())%1000)))

Fixed code:
print(abs((-int(input())%1000)))
Buggy code:
n = int(input())
if n % 1000 == 0 :
  print(n / 1000)
else : 
  tmp = n // 1000
  print(1000 * (tmp +1) - n)

Fixed code:
n = int(input())
if n % 1000 == 0 :
	print(0)
else :
	tmp = n // 1000
	print(1000 * (tmp + 1) - n)
Buggy code:
def main():
    N=int(input())

    mod=N%1000
    if N==0:
        print("0")
    else:
        print(1000-N)




if __name__=="__main__":
    main()

Fixed code:
def main():
    N=int(input())

    mod=N%1000
    if mod==0:
        print(0)
    else:
        print(1000-mod)




if __name__=="__main__":
    main()
Buggy code:
N = int(input)
for i in range(11):
	money = i * 1000
	if money - N >= 0:
		print(money - N)
		break

Fixed code:
N = int(input())

for i in range(11):
    money = i * 1000
    if money - N>=0:
        print(money - N)
        break
Buggy code:
N = int(input()
if N%1000==0:
  print(0)
else:
  print(1000-(N%1000))

Fixed code:
N = int(input())

if N % 1000 == 0:
  ans = 0
else:
  ans = 1000 - (N % 1000)

print(ans)
Buggy code:
N = int(input())
if N == 0:
  print('0')
else:
  print(1000 - N%1000)

Fixed code:
N = int(input())
if N == 0 or N%1000 == 0:
  print('0')
else:
  print(1000 - N%1000)
Buggy code:
N = int(input())
if N == 10000:
    print(0)
else:
    print(1000-N%1000)


Fixed code:
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000-N%1000)
Buggy code:
num = int(input())

fraction = num % 1000
change =0
if fraction !=0:
  change = 1000-change

print(change)

Fixed code:
num = int(input())
 
fraction = num % 1000
change =0
if fraction !=0:
  change = 1000-fraction
 
print(change)
Buggy code:
N = int(input())

if N%1000=0:
    print(0)
else:
    print(1000-(N%1000))

Fixed code:
N = int(input())
if N%1000 == 0:
    print(0)
else:
    print(abs(N%1000-1000))
Buggy code:
N = input()
o = 1000-(N%1000) 
print(o)

Fixed code:
N = int(input())
o = (1000-N%1000)%1000
print(o)
Buggy code:
n = int(input())

ans = 1000 - (n%1000)

print(ans)

Fixed code:
n = int(input())
n = n%1000
n = (1000 - n )%1000
print(n)
Buggy code:
n=int(input())
n%=1000
print(1000-n)


Fixed code:
n = int(input())
print((1000-(n % 1000))%1000)
Buggy code:
n = int(input())
print(((n+999)//1000)*1000 - N)

Fixed code:
n = int(input())
print(((n+999)//1000)*1000 - n)
Buggy code:
n = int(input())
if n%1000!=0:
    print(min(1000-(n%1000)))
else:
    print("0")

Fixed code:
n = int(input())
if n%1000!=0:
    print(1000-(n%1000))
else:
    print("0")
Buggy code:
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())
    print(N % 1000)

if __name__ == "__main__":
    run()

Fixed code:
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    N = int(input())
    a = (N + 999) // 1000
    print(a * 1000 - N)

if __name__ == "__main__":
    run()
Buggy code:
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    print(N % 1000)

if __name__ == "__main__":
    main()

Fixed code:
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    ans = (1000 - N % 1000) % 1000

    print(ans)

if __name__ == "__main__":
    main()
Buggy code:
# Contest No.: ABC173
# Problem No.: A
# Solver:      JEMINI
# Date:        20200705

import sys
import heapq

def main():
    n = int(input())
    print(1000 - n % 1000)
    return

if __name__ == "__main__":
    main()

Fixed code:
# Contest No.: ABC173
# Problem No.: A
# Solver:      JEMINI
# Date:        20200705

import sys
import heapq

def main():
    n = int(input())
    print((1000 - n % 1000) % 1000)
    return

if __name__ == "__main__":
    main()
Buggy code:
N=int(input())
N%=1000
print(1000-N)

Fixed code:
N=int(input())
N%=1000
print((1000-N)%1000)
Buggy code:
N = int.input()
if N % 1000 == 0:
  print(0)
else:
  print(1000-(N%1000))



Fixed code:
N = int(input())
if N%1000 == 0 :
    print(0)
else :
    print(1000 - N%1000 )
Buggy code:
S = 1e3

def main():
    n = int(input())
    r = n % S
    if r == 0:
        return int(r)
    else:
        return int(S - r)

if __name__ == '__main__':
    # print(main())
    main()

Fixed code:
S = 1e3

def main():
    n = int(input())
    r = n % S
    if r == 0:
        return int(r)
    else:
        return int(S - r)

if __name__ == '__main__':
    print(main())
    # main()
Buggy code:
N=int(input())
if (N%1000==0):
    print (0)
else:
    ((((N//1000)+1)*1000)-N)

Fixed code:
N=int(input())
if (N%1000==0):
    print (0)
else:
    print ((((N//1000)+1)*1000)-N)
Buggy code:
a = int(input())
print(1000-a%1000)

Fixed code:
a = int(input())
print((500000-a)%1000)
Buggy code:
N=int(input())
M=0
while True:
  M+=1
  if 1000*M>N:
    print(1000*M-N)
    break

Fixed code:
N=int(input())
M=0
while True:
  if 1000*M>N or 1000*M==N:
    print(1000*M-N)
    break
  else:
    M+=1
Buggy code:
amari = int(input())%1000
ans = 1000 - amari
if amari:
    print('0')
else:
    print(ans)

Fixed code:
amari = int(input())%1000
ans = 1000 - amari
if amari:
    print(ans)
else:
    print('0')
Buggy code:
a=int(input())%1000
if a=0:
  print(a)
else:
  print(1000-a)



Fixed code:
a=int(input())%1000
if a==0:
  print(a)
else:
  print(1000-a)
Buggy code:
n=int(input())
ans=0
for i in range(10000):
    n+=1
    ans+=1
    if n%1000==0:
        break
print(ans)

Fixed code:
n=int(input())
ans=0
if n%1000==0:
    print(ans)
    exit()
for i in range(10000):
    n+=1
    ans+=1
    if n%1000==0:
        break
print(ans)
Buggy code:
n=int(input())
if n%1000==0:
  print(0)
else print(1000-n%1000)

Fixed code:
n = int(input())
tmp=n%1000

if tmp == 0:
  print(0)
else:
  print(1000 - tmp)
Buggy code:
N = input()
R = N%1000

if R == 0:
    print(0)

else :
    print(abs(R-1000))

Fixed code:
N = int(input())
R = N % 1000
if R == 0:
    print(0)
else:
    print(abs(R-1000))
Buggy code:
import math

N = int(input())

ans = math.ceil(N / 1000)

print(ans - N)

Fixed code:
import math

N = int(input())

ans = math.ceil(N / 1000)

print(ans * 1000 - N)
Buggy code:
n =int(input())
n = n%1000
print(1000- n)

Fixed code:
n =int(input())
n = n%1000
print((1000- n)%1000)
Buggy code:
N = int(input())
a = N // 1000
b = N % 1000

if b == 0:
    ans = 0
else:
    ans = N - a * 1000

print(ans)

Fixed code:
N = int(input())
a = N // 1000
b = N % 1000

if b == 0:
    ans = 0
else:
    ans = (a + 1) * 1000 - N

print(ans)
Buggy code:
n = int(input())
print(1000-(n%1000))


Fixed code:
n=int(input())
print((10000-n)%1000)
Buggy code:
N = int(input())
N = 1000 - (N % 1000)
print(N)

Fixed code:
N = int(input())
print((-N)%1000)
Buggy code:
n=int(input())
while n>=1000:
    n-=1000
print(abs(n))

Fixed code:
n=int(input())
while n>0:
    n-=1000
print(abs(n))
Buggy code:
taka = int(input())
remainder = taka % 1000
ans = 1000 - remainder
print(ans)

Fixed code:
taka = int(input())
remainder = taka % 1000
ans = 1000 - remainder
print(ans % 1000)
Buggy code:
N = int(input())
d = N % 1000

if 1000 - d == 0:
    print(0)
else:
    print(1000 - d)

Fixed code:
N = int(input())
d = N % 1000


if 1000 - d == 0 or d == 0:
    print(0)
else:
    print(1000 - d)
Buggy code:
n = int(input())
if n%1000 == 0:
  print(0)
else:
  print(n-n%1000)

Fixed code:
n = int(input())

tmp = n%1000
if tmp==0:
  print(0)
else:
  print(int(1000-tmp))
Buggy code:
N = int(input())
if N % 1000 == 0:
    print(0)
print(1000 - N % 1000)


Fixed code:
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000 - (N % 1000))
Buggy code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)

t=1
# t=int(input())
for _ in range(t):
    n=L()[0]
    print(1000-N%1000)

Fixed code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)

t=1
# t=int(input())
for _ in range(t):
    n=L()[0]
    if n%1000==0:
        print(0)
        exit()

    print(1000-n%1000)
Buggy code:
n = int(input())

if n % 1000 == 0 :
    a = n / 1000
else :
    a = n / 1000 + 1

b = a * 1000
answer = b - n

print(answer)

Fixed code:
n = int(input())
 
if n % 1000 == 0 :
    a = n / 1000
else :
    a = int(n / 1000 + 1)
 
b = a * 1000
answer = int(b - n)
 
print(answer)
Buggy code:
N = int(input())
a = 1000 - N % 1000
if a == 1000:
    print(0)
else:
    print(a

Fixed code:
N = int(input())
a = 1000 - N % 1000
if a == 1000:
    print(0)
else:
    print(a)
Buggy code:
N = int(input())
print(1000 - (N%1000))

Fixed code:

N = int(input())

print ((1000 - N % 1000) % 1000)
Buggy code:
n = int(input())
while n >= 1000:
  n -=1000
print(n)

Fixed code:
n = int(input())
while n > 0:
  n -=1000
print(-n)
Buggy code:
a = int(input())
print(0) if a%1000==0 else print(1000-(a//1000))

Fixed code:
a = int(input())
print(0) if a%1000==0 else print(1000-(a%1000))
Buggy code:
money = int(input())

print(1000 - money % 1000 % 10000)


Fixed code:
money = int(input())

print((1000 - money % 1000) % 1000)
Buggy code:
N = int(input())
x = N % 1000
print(N-x)

Fixed code:
N = int(input())
N = N % 1000
print((1000 - N) % 1000)
Buggy code:
print(1000 - (int(input()) % 1000))

Fixed code:
print(-int(input())%1000)
Buggy code:
t=int(input())
m=0
while 1000*m<t:
    m=m+1
c=1000*m-t
print(t)

Fixed code:
t=int(input())
m=0
while 1000*m<t:
    m=m+1
c=1000*m-t
print(c)
Buggy code:
N = int(input())
count = 0
money = 1000
while N >= money * count:
    count += 1
print(money * count - N)


Fixed code:
N = int(input())
count = 0
money = 1000
while N > money * count:
    count += 1
print(money * count - N)
Buggy code:
n = int(input())

if n % 1000 == 0:
  print(0)
else:
	tmp = n // 1000 + 1
  print(tmp - n)

Fixed code:
n = int(input())

if n % 1000 == 0:
  print(0)
else:
  tmp = n // 1000 + 1
  print(tmp * 1000 - n)
Buggy code:
N = input()
turi = N % 1000
if turi != 0:
  turi = 1000 - turi
print(turi)

Fixed code:
N = int(input())
turi = N % 1000
if turi != 0:
  turi = 1000 - turi
print(turi)
Buggy code:
a = int(input())
b = int(a / 1000) + 1
c = a % 1000
if c == 0:
  print(0)
else:
  print(b - c)


Fixed code:
a = int(input())
b = int(a / 1000) + 1
c = a % 1000
if c == 0:
  print(0)
else:
  print(1000 - c)
Buggy code:
ma = 1000
given = int(input())
c = given%ma
if(c == 0):
  print(0)
else:
  print(c-1000)

Fixed code:
ma = 1000
given = int(input())
c = given%ma
if(c == 0):
  print(0)
else:
  print(abs((c-1000)))
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/7/5 19:54
# @Version : 1.1
# @Author  : Jade
# @File    : a.py
# @Software: PyCharm
#

def main():
    n = int(input())
    print(1000 - n%1000)
if __name__ == '__main__':
    main()

Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/7/5 19:54
# @Version : 1.1
# @Author  : Jade
# @File    : a.py
# @Software: PyCharm
#

def main():
    n = int(input())
    print((1000 - n%1000)%1000)
    
if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
if n % 1000:
    print(0)
else:
    print(1000 - n%1000)

Fixed code:
n = int(input())
a = n % 1000
if a == 0:
  print(0)
else:
  print(1000 - a)
Buggy code:
import math
N = int(input())
print(int(math.ceil(N / 1000) * 1000))

Fixed code:
import math
N = int(input())
print(int(math.ceil(N / 1000) * 1000) - N)
Buggy code:
n = input()
if n % 1000:
    print(0)
else:
    print(1000 - n%1000)

Fixed code:
n = int(input())

if n % 1000 == 0:
  print(0)
else:
  print(1000 - (n  % 1000))
Buggy code:
def abc173_a():
    N = int(input())
    #N = 3000%1000
    if N%1000:
        print(0)
    else:
        print(1000-N%1000)






abc173_a()


Fixed code:

def abc173_a():
    N = int(input())
    #N = 3000%1000
    if N%1000 ==  0:
        print(0)
    else:
        print(1000-N%1000)






abc173_a()
Buggy code:
n = int(input())
print(1000 - n%1000)


Fixed code:
n = int(input())
print((10000-n)%1000)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
aa = sorted(a, reverse=True)
# print(aa)

ans = 0
for i in range(n-1):
    ans += a[(i + 1) // 2]
#     print(ans)

print(ans)


Fixed code:
n = int(input())
a = list(map(int, input().split()))
aa = sorted(a, reverse=True)
# print(aa)

ans = 0
for i in range(n-1):
    ans += aa[(i + 1) // 2]
#     print(ans)

print(ans)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print( sum( a[(i+1)//2] for i in range(n)) )

Fixed code:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print( sum( a[(i+1)//2] for i in range(n-1)) )