Problem:


Score : 100 points

Problem Statement

We will buy a product for N yen (the currency of Japan) at a shop.

If we use only 1000-yen bills to pay the price, how much change will we receive?

Assume we use the minimum number of bills required.

Constraints

1 \leq N \leq 10000

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the amount of change as an integer.

Sample Input 1

1900

Sample Output 1

100

We will use two 1000-yen bills to pay the price and receive 100 yen in change.

Sample Input 2

3000

Sample Output 2

0

We can pay the exact price.



Sample input:
1900


Sample output:
100

Submission status: Accepted

Solution code:
import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce
from itertools import groupby
from heapq import heapify, heappush, heappop

# sys.setrecursionlimit(5000)

n1 = lambda: int(sys.stdin.readline().strip())
nn = lambda: list(map(int, sys.stdin.readline().strip().split()))
f1 = lambda: float(sys.stdin.readline().strip())
fn = lambda: list(map(float, sys.stdin.readline().strip().split()))
s1 = lambda: sys.stdin.readline().strip()
sn = lambda: list(sys.stdin.readline().strip().split())
nl = lambda n: [n1() for _ in range(n)]
fl = lambda n: [f1() for _ in range(n)]
sl = lambda n: [s1() for _ in range(n)]
nm = lambda n: [nn() for _ in range(n)]
fm = lambda n: [fn() for _ in range(n)]
sm = lambda n: [sn() for _ in range(n)]

def array1(n, d=0): return [d] * n
def array2(n, m, d=0): return [[d] * m for x in range(n)]
def array3(n, m, l, d=0): return [[[d] * l for y in xrange(m)] for x in xrange(n)]
def linc(A, d=1): return map(lambda x: x + d, A)
def ldec(A, d=1): return map(lambda x: x - d, A)

N = n1()

ans = 1000-N%1000
if ans == 1000:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())

print(math.ceil(n/1000)*1000-n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input()) % 1000

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

Submission status: Accepted

Solution code:
n=int(input())

a=n%1000
if a==0:
    ans=0
else:
    ans=1000-a
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

r = n % 1000
if r == 0:
    print(0)
else:
    print(1000 - r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
if n % 1000 == 0:
    print(0)
else:
    print(1000 - n % 1000)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    div = N // 1000 if N % 1000 == 0 else N // 1000 + 1
    print(div * 1000 - N)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a=int(input())
a%=1000
if a==0:
    print(0)
else:
    print(1000-a)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n=int(input())
print(-n%1000)

Submission status: Accepted

Solution code:
a = int(input())
if a % 1000 == 0:
    print(0)
else:
    print(1000 - a % 1000)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.buffer.read




N = int(input())
while N > 0:
    N -= 1000

print(-N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
i=1
while 1000*i<N:
    i+=1
print(1000*i-N)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N % 1000 == 0:
        print(0)
    else:
        print(1000 - N % 1000)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    if N % 1000 == 0:
        print(0)
    else:
        print(1000-N%1000)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
input = raw_input
n = int(input())

if n % 1000 == 0:
    out = 0
else:
    out = 1000 - (n % 1000)
print(out)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

sen = N // 1000
amari = N % 1000

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

Submission status: Accepted

Solution code:
_MULTITEST = False
##
def solve():
    n = int(input())
    k = (n // 1000) + (1 if n % 1000 != 0 else 0)
    print(k*1000 - n)

##
if __name__ == "__main__":
    t = (int(input()) if _MULTITEST else 1)
    for tt in range(t):
        solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    if N % 1000 == 0:
        print(0)
    else:
        print(1000 - N % 1000)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def LI(): return list(map(int, input().split()))
def I(): return map(int, input().split())
mod = 10**9 + 7

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

Submission status: Accepted

Solution code:
N = int(input())

for i in range(1,100):
    if 1000*i>=N:
        print(1000*i-N)
        break

Submission status: Accepted

Solution code:
N = int(input())
print(1000 - N % 1000 if N % 1000 > 0 else 0 )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    print((10000-n)%1000)
resolve()

Submission status: Accepted

Solution code:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################


n = int(input())
val = math.ceil(n/1000)
print(1000*val - n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
a = int(input())
x = 0
while x < a:
    x+=1000
print(x-a)

Submission status: Accepted

Solution code:
N = int(input())
while N > 1000:
    N -= 1000
print(1000 - N)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n % 1000 != 0:
        print(1000-n % 1000)
    else:
        print(0)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N):
    while N > 0:
        N -= 1000
    return -N


if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if n % 1000 != 0:
    print(1000 - n % 1000)
else:
    print('0')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
print((1000 - N % 1000) % 1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import *
n = int(input())
x = 1000*ceil(n/1000)
print(x-n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
for i in range(1000, 11000, 1000):
    if i >= N:
        print(i-N)
        break

Submission status: Accepted

Solution code:
import math
N = int(input())
print(math.ceil(N / 1000)*1000-N)

Submission status: Accepted

Solution code:
N = int(input())

a = 1000-(N % 1000)
if a == 1000:
  a = 0

print(a)

Submission status: Accepted

Solution code:
N = int(input())

if N % 1000 == 0:
    print(0)
else:
    print(1000 * (N // 1000 + 1) - N)

Submission status: Accepted

Solution code:
n = int(input())
m = n
while m % 1000 != 0:
    m += 1
print(m-n)

Submission status: Accepted

Solution code:
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    n = int(input())
    # a, b = list(map(int, input().split()))
    print((1000 - n%1000) if n %1000 else 0)

main()

Submission status: Accepted

Solution code:
import sys
import math

def read_int():
    line = sys.stdin.readline().rstrip('\n')
    return int(line)

def read_int_list():
    line = sys.stdin.readline().rstrip('\n')
    return [int(e) for e in line.split(' ')]

N = read_int()

print(1000 * math.ceil (N / 1000) - N)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 1000-n%1000
if ans == 1000:
    ans = 0
print(ans)

Submission status: Accepted

Solution code:

n=int(input())
import math
print(math.ceil(n/1000)*1000-n)

Submission status: Accepted

Solution code:

import math 
N = int(input())

print(math.ceil(N/1000)*1000-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
# n, k = map(int, input().split())
# a = list(map(int, input().split()))


ans = 1000 - n % 1000
if ans >= 1000:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
# 
import sys

from sys import stdin
input = lambda: stdin.readline().rstrip()


N = int(input())

m = N % 1000

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

Submission status: Accepted

Solution code:
n = int(input())
a = n%1000
answer = 1000-a
if answer == 1000:
  answer = 0
print(answer)

Submission status: Accepted

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    N = int(input())
    print((1000-N%1000)%1000)

main()

Submission status: Accepted

Solution code:
n = int(input())
res = 0
while res < n:
    res+=1000
print(res-n)

Submission status: Accepted

Solution code:
n = int(input())


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

Submission status: Accepted

Solution code:
# 2020/07/05
# AtCoder Beginner Contest 173 - A

# Input
n = int(input())

# Calc
if n % 1000 == 0:
    ans = 0
else:
    ans = 1000 - (n % 1000)

# Output
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

i = 1
while 1000 * i < N:
    i += 1

print(1000*i - N)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
# = str(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

change = N%1000

if change == 0:
    print(0)
    exit()

print(1000-change)

Submission status: Accepted

Solution code:
import math
N = int(input())

print(math.ceil(N/1000) * 1000 - N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    N = int(input())

    mod = N % 1000
    if mod == 0:
        return 0
    else:
        return 1000 - mod


def main():
    print(solve())


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
surplus = N % 1000
if surplus > 0:
  print(1000-surplus)
else:
  print(0)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n, = map(int,readline().split())

a = 0
while a < n: a += 1000
print(a-n)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(input())

for _ in range(11):
    N -= 1000
    if N <= 0:
        break
ans = abs(N)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input().strip())
    return (1000 - N % 1000) % 1000


if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = N%1000
if K == 0:
    print(0)
else:
    print(1000-K)

Submission status: Accepted

Solution code:
N = int(input())

tmp = 10000 - N
print(tmp%1000)

Submission status: Accepted

Solution code:
n = int(input())

import math
x = math.ceil(n/1000)*1000-n
print (x)

Submission status: Accepted

Solution code:
n = int(input())

ans = n % 1000

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

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    n = ii()
    if n % 1000 == 0:
        print(0)
    else:
        print(1000 - (n % 1000))


main()

Submission status: Accepted

Solution code:
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

#DIV = (10**9) + 7
DIV = 998244353

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


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

main()

Submission status: Accepted

Solution code:
n = int(input())

while n >=1000:
  n = n - 1000

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

Submission status: Accepted

Solution code:
N=int(input())
for i in range(1,11):
  if 1000*i-N>=0:
    print(1000*i-N)
    break

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    return N,


def solve(N):
    if N % 1000 > 0:
        return 1000 - N % 1000
    return 0


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Submission status: Accepted

Solution code:
N = int(input())

r = N % 1000
if r:
    ans = 1000 - r
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    if n % 1000 != 0:
        print(1000 - n % 1000)
    else:
        print(0)

resolve()

Submission status: Accepted

Solution code:
def main():
    print((1000-int(input()) % 1000) % 1000)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
## coding: UTF-8

N = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())
print((1000*(N//1000+1)-N)%1000)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    if n%1000 == 0:
        print(0)
    else:
        print(1000-n%1000)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import time
import math
st = time.perf_counter()
def inpl():
    return list(map(int, input().split()))
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Submission status: Accepted

Solution code:
(N, ) = [int(n) for n in input().split()]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


n = int(input())

res = n % 1000
if res == 0:
    print(0)
else:
    print(1000 - res)

Submission status: Accepted

Solution code:
n=int(input())
i=1
while 1000*i<n:
    i+=1
print(1000*i-n)

Submission status: Accepted

Solution code:
N =int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
print(999-(N-1)%1000)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    
    pays = -(-n//1000)*1000

    print(pays-n)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=int(input())
print(999-(s-1)%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
print(-(-n//1000)*1000 - n)

Submission status: Accepted

Solution code:
n = int(input())
print((n + 999) // 1000 * 1000 - n)

Submission status: Accepted

Solution code:
N = int(input())

ans = (1000 - N%1000)%1000

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

rem = n%1000
if rem == 0: rem = 1000
print(1000-rem)

Submission status: Accepted

Solution code:
n=int(input())
money=1000
while True:
    if money>=n:
        print(money-n)
        break
    money+=1000

Submission status: Accepted

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)

Submission status: Accepted

Solution code:
n = int(input())

if n % 1000 == 0:
    print(0)

else:
    print(1000 - n % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
while (N > 0):
    N -= 1000
print(abs(N))

Submission status: Accepted

Solution code:
# coding:utf-8

N = int(input())
paid = 0

while paid < N:
    paid += 1000

print(paid - N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
print(-N % 1000)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


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

Submission status: Accepted

Solution 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()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

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

Submission status: Accepted

Solution code:
print((1000 - (int(input()) % 1000)) % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

n = n%1000

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

Submission status: Accepted

Solution code:
n = int(input())

a = n % 1000

if a:
    print(1000-a)
else:
    print(0)

Submission status: Accepted

Solution code:
import math
import collections
import bisect
from copy import copy


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    if N % 1000 == 0:
        print(0)
    else:
        print(1000 - N % 1000)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
print(0 if n%1000 == 0 else 1000-n%1000)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
print((1000 - n % 1000) % 1000)