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: Runtime Error

Solution code:
N = int(input())
G0, G1, G2, G3 = 0, 0, 0, 0
for i in range(N):
    Si = input()
    if Si == 'AG':
        G0 += 1
 
    elif Si == 'WA':
        G1  += 1
 
    elif Si == 'TLE':
        G2 += 1
 
    else:
        G3 += 1
 
print('AG x ' + str(G0))
print('WA x ' + str(G1))
print('TLE x ' + str(G2))
print('RE x ' + str(G3))

Submission status: Runtime Error

Solution code:
N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0
for i in range(N):
    Si = input()
    if Si == 'AC':
        C0 += 1
 
    elif Si == 'WA':
        C1  += 1
 
    elif Si == 'TLE':
        C2 += 1
 
    else:
        C3 += 1
 
print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Submission status: Runtime Error

Solution code:
N = int(input())
x0,x1,x2,x3=0,0,0,0
for i in range(N):
    Si=input()
    if Si == 'AC':
        x0 = x0+1

    elif Si=='WA':
        x1=x1+1

    elif Si=='TLE':
        x2=x2+1
    
    else:
        x3=x3+1
 
print('AC x' +str(x0))
print('WA x' +str(x1))
print('TLE x'+str(x2))
print('RE x' +str(x3))

Submission status: Runtime Error

Solution code:
n=1
for year in range(1896,2024,4):
    if year == 1916 or year == 1940 or year == 1944:
		n+=1
        continue
    else:
		n+=1
		print(str(year) + "年" + "第" + str(n) + "回")

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

Solution code:
counter = {}
judge = ['AC', 'WA', 'TLE', 'RE']
for c in judge:
    counter[c] = 0

num = int(input())
for i in range(num):
    counter[input()] += 1

for c in judge:
    print('%s x %d' % (c, counter[c]))

Submission status: Runtime Error

Solution code:
import math
 
N=int(input())
if N%1000==0:
  print(0)
elif N<1000:
  N=1000-N
  print(N)
else:
  N=(math.ceil(money/1000))*1000-N
  print(N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(((N % 1000) + 1) * 1000 - N)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
 
money=int(N)
if money%1000==0:
  print(0)
else:
  money=(math.ceil(money/1000))*1000-money
  print(money)

Submission status: Runtime Error

Solution code:
import math

money=N
if money%1000==0:
  print(0)
else:
  money=(math.ceil(money/1000))*1000-money
  print(money)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
p = 1000 - (N % 1000)
print p

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort(reverse = True)
w = 10**9 + 7
ans = 1
if k%2 == 1:
  for i in range(k):
    ans *= a[i]
    print(ans % w)

else:
  if n%2 == 0:
    a_new = [a[2*i]*a[2*i+1] for i in range(n//2)]
    a_new.sort(reverse = True)
    print(a_new)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)
      
  else:
    a_plus = heapq.nlargest(k, a)
    a_minus = heapq.nsmallest(k, a)
    a_plus.sort(reverse = True)
    a_minus.sort()
    a_plus_new = [a_plus[2*i]*a_plus[2*i+1] for i in range(len(a_plus))]
    a_minus_new = [a_minus[2*i]*a_minus[2*i+1] for i in range(len(a_minus))]
    a_new = a_plus_new + a_minus_new
    a_new.sort(revserse = True)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if N%1000==0:
  print(0)
else:
  N=math.ceil(N/1000)*1000-N
  print(N)

Submission status: Runtime Error

Solution code:
num = input("")
while(num >= 1000):
  num = num -1000
print(num)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
int x = 0
print(x)

Submission status: Runtime Error

Solution code:
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(1,N+1):
  S = str(input())
  if S == "AC":
    ac += 1
  elif S == "WA":
    wa += 1
  elif S == "TLE":
    tle += 1
  elif S == "RE":
    re += 1

print("AC ×" + str(ac))
print("WA ×" + str(wa))
print("TLE ×" + str(tle))
print("AC ×" + str(re))

Submission status: Runtime Error

Solution code:
import numpy as np
H,W,K = map(int,input().split())

a = [list(input()) for _ in range(H)] #listの中にlist()を標準入力する。H行分作成する。
#a = np.zeros((int(H),int(W)))
print(a)
count = 0
ans = 0
for i in range(2**W): #行の塗り方のパターン
    for j in range(2**H): #列の塗り方のパターン
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="#":
                    count += 1
            if count == K:
                ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
#N円の商品を1000円札で支払う時のおつり。

price=int(print())
surpus=price%1000
return surpus

Submission status: Runtime Error

Solution code:
N = input()
print((10000 - N) % 1000)

Submission status: Runtime Error

Solution code:
import sys

args = sys.argv
N = int(args[1])
val = 1000 - N % 1000
print(val)

Submission status: Runtime Error

Solution code:
a = int(input())
if a =< 1000:
    b = a//1000
else:
    b = a//1000 + 1
print(b*1000 - a)

Submission status: Runtime Error

Solution code:
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)))

Submission status: Runtime Error

Solution code:

N = int(input()) # yen

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
thousand = 1000*M
thousand - N < 1000
print(M)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# python template for atcoder1 
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

print(input % 1000)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
l = ["AC","WA","TLE","RE"]
for i in range(4):  print(l[i],"x",s.count(l[i]))

Submission status: Runtime Error

Solution code:
N=int(iput())
print(N%1000)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

i = 1
AC = 0
WA = 0
TLE = 0
RE = 0
list = []
for i in range(N):
    list.append(str(input()))
    a = list.count("AC")
    b = list.count("WA")
    c = list.count("TLE")
    d = list.count("RE")

print("AC x",a)
print("WA x" , b)
print("TLE x" , c)
print("RE x" ,d)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int.input()
oturi = 1000-(N%1000)
print(oturi)

Submission status: Runtime Error

Solution code:
N = int.input()
oturi = N%1000
print(oturi)

Submission status: Runtime Error

Solution code:
N=int(input())
if N/1000==0:
	N=0
else:
	N=(math.ceil(N/1000)+1)*1000-N
print(str(N))

Submission status: Runtime Error

Solution code:
if N/1000==0:
	N=0
else:
	N=(math.ceil(N/1000)+1)*1000-N
print("N")

Submission status: Runtime Error

Solution code:
print(abs(-(N%1000)))

Submission status: Runtime Error

Solution code:

iAC = 0
iWA = 0
iTLE = 0
iRE = 0

N = int(input())
for i in range(N):
    S = input()
    if S == "AC":
        iAC += 1
    elif S == "WA":
        iWA += 1
    elif S == "TLE":
        iTLE += 1
    elif S == "RE":
        iRE += 1

print("AC x {}".format(iAC))
print("WA x {}".format(iWA))
print("TLE x {}".format(iTLE))
print("RE x {}".format(iRE))

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:

MOD = 10**9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
plus,minus=[],[]
for i in a:
    if i<0:
        minus.append(i)
    else:
        plus.append(i)
plus.sort(reverse = True)
minus.sort()
plus.append(-10**10)
plus.append(10**10)
minus.append(10**10)
minus.append(-10**10)
ans = 1
if n == k:
    for i in range(n):
        ans *= a[i]
        ans %= MOD
    print(ans)
elif len(plus) == 2 and k % 2 == 1:
    for i in range(3, k + 3):
        ans *= minus[-i]
        ans %= MOD
    print(ans)
else:
    cplus = 0
    cminus = 0
    p = k // 2
    if k % 2 == 1:
        ans *= plus[0]
        cplus = 1
    else:
        for _ in range(p):
            if plus[cplus] * plus[cplus + 1] > minus[cminus] * minus[cminus + 1]:
                ans *= plus[cplus] * plus[cplus + 1]
                ans %= MOD
                cplus += 2
            else:
                ans *= minus[cminus] * minus[cminus + 1]
                ans %= MOD
                cminus += 2
    print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
N,K = map(int, input().split())
p = 10 ** 9 + 7
A = list(map(int, input().split()))
A_np = np.array(A)
A_pos = A_np[A_np>=0]
A_neg = A_np[A_np<0]
judge = False
s = 1
if len(A_pos) > 0:
  if N > K:
    judge = True
  else:
    if len(A_neg) % 2 == 0:
      judge = True    
else:
  if (K % 2) == 0:
    judge = True
if judge == True:
  A_pos = np.sort(A_pos)[::-1]
  A_neg = np.sort(A_neg)
  if (K % 2) == 1:
    s = A_pos[0]
    A_pos = A_pos[1:]
    K = K - 1
  K = int(K / 2)
  stack = np.array([])
  for n in range(0,int(len(A_pos)/2)):
    stack = np.append(stack, (A_pos[2*n]*A_pos[2*n+1]) % p)
    if n == K:
      break
  for n in range(0,int(len(A_neg)/2)):
    stack = np.append(stack, (A_neg[2*n]*A_neg[2*n+1]) % p)
    if n == K:
      break
  stack = np.sort(stack)[::-1]
  for n in range(0,K):
    s = (s * stack[n]) % p
else:
  Index = np.sort(abs(A_np))
  A_sort = A_np[Index-1]
  for n in range(0,K):
    s = (s * A_sort[n]) % p
print(int(s))

Submission status: Runtime Error

Solution code:
def main():
    N = input()
    return N % 1000


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def get_binaly_arr(num,digit):
    return list(bin(num)[2:].zfill(digit))

def get_droped_mat(mat,binaly_arr,direction):
    if direction == "H":# 行をdrop!
        return [mat[i] for i in range(len(mat)) if binaly_arr[i] != "0" ]
    elif direction == "W": # 列をdrop!
        return [[arr[i] for i in range(len(arr)) if binaly_arr[i] != "0" ] for arr in mat]
    else :
        print("INVALID DIRECTION!")

def count_black(mat):
    return sum([sum([1 for item in arr if item == "#"]) for arr in mat])

    
if __name__ == "__main__":
    H,W,K = list(map(int,input().split()))
    c = []
    for i in range(0,H):
        c.append(list(input()))
    H_pattern_num = 2 ** H
    W_pattern_num = 2 ** W
    count = 0
    ite_num = 0
    for i in range(0,H_pattern_num):
        for j in range(0,W_pattern_num):
            # バイナリ配列を生成
            H_binaly_arr = get_binaly_arr(i,H)
            W_binaly_arr = get_binaly_arr(j,W)
            mat_temp = c.copy()
            mat_temp = get_droped_mat(c,H_binaly_arr,direction="H")
            mat_temp = get_droped_mat(mat_temp,W_binaly_arr,direction="W")
            if K == count_black(mat_temp):
                count += 1
    print(count)

Submission status: Runtime Error

Solution code:
s = input()



if int(s[1])==0 and int(s[2])==0 and int(s[3])==0:
	print(0)
elif s[1]!=0 or s[2]!=0 and s[3]!=0:
    t =1000 - int(s[1:])
    print(t)
else:
    print(0)

Submission status: Runtime Error

Solution code:
s = input()



if int(s[1])==0 and int(s[2])==0 and int(s[3])==0:
	print(0)
elif s[1]!=0 or s[2]!=0 and s[3]!=0:
    t =1000 - int(s[1:])
    print(t)

Submission status: Runtime Error

Solution code:
s = input()

if s[1]==0 and s[2]==0 and s[3]==0:
	print(0)
elif s[1]!=0 or s[2]!=0 and s[3]!=0:
    t =1000 - int(s[1:])
    print(t)

Submission status: Runtime Error

Solution code:
n=int(input())

s=[]
for i in range(n):
    a=input()
    s.append(a)
    
for j in ['AC', 'WA', 'TLE', 'RE']:
    print('{0} × {1}'.format(j,s.count(j)))

Submission status: Runtime Error

Solution code:
n=int(input())

judge_list=[]
for i in range(n):
    a=input()
    judge_list.append(a)

print("AC ×",judge_list.count("AC"))
print("WA ×",judge_list.count("WA"))
print("TLE ×",judge_list.count("TLE"))
print("RE ×",judge_list.count("RE"))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
a=input().split()
a.sort(reverse=True)
a_min=[a[0]]
a_s=[a[0]]
comf=0
for i in range(n-1):
  a_min=[min(a_s[j-1],a_s[j]) for j in range(len(a_s))]
  a_minn=[int(i) for i in a_min]
  m=max(a_minn)
  ind=a_min.index(str(m))
  a_s.insert(ind,a[i+1])
  comf+=int(m)
print(comf)

Submission status: Runtime Error

Solution code:
price=N
if price <=1000:
  print(1000-N)
elife price <=2000:
  print(2000-N)
elife price <=3000:
  print(3000-N)
elife price <=4000:
  print(4000-N)
elife price <=5000:
  print(5000-N)
elife price <=6000:
  print(6000-N)
elife price <=7000:
  print(7000-N)
elife price <=8000:
  print(8000-N)
elife price <=9000:
  print(9000-N)
else price <=10000:
  print(10000-N)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# 文字列の入力
s = [input() for i in range(n)]
# 数え上げ
C0 = s.count('AC')
C1 = s.count('WA')
C2 = s.count('TLE')
C3 = s.count('RE')
# 出力
print("AC x {}".format(C0))
print("WA x {}".format(C1))
print("TLE x {}".format(C2))
print("RE x {}".format(C3))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
price = int(input())

comma_price = math.ceil(price / 1000)
comma_price *= comma_price

print(comma_price - price)

Submission status: Runtime Error

Solution code:
N = int(input())

pay = 0

for i in range(10):
    pay += 1000
    if(pay => N):
        break

change = pay - N

print(change)

Submission status: Runtime Error

Solution code:
N = input()

pay = 0

for i in range(10):
    pay += 1000
    if(pay => N):
        break

change = pay - N

print(change)

Submission status: Runtime Error

Solution code:
import sys
#import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
#import math
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()

n = ri()
a = rl()
a=a+a
a.sort()

a.pop()
ans=0
for i in range(n-1):
    ans+=a[-i-1]
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
N = int(N)
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(int(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(int(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
m = input()
print(m % 1000)

Submission status: Runtime Error

Solution code:
x = str(input('N'))
while x >=1000:
  x = x -1000
print(x)

Submission status: Runtime Error

Solution code:
s = input()
a = [int(c) for c in s]

if a[-3] != 0:
    ans = int(s) - (a[-4]*1000)
else:
    ans = 0

print(ans)

Submission status: Runtime Error

Solution code:
b=(1000-(N%1000))%1000
print(b)

Submission status: Runtime Error

Solution code:
a=N%1000
b=1000-a
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()
if N % 1000 == 0: return 0
m = 1000 % N
return m

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

def f(y):

    if 1 <= y <=999:
        print(1000-y)
    elif 1000<= y <= 10000 :
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and x % 1000!=0:
            print("500")
        elif y % 100==0 and x % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and x % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input()
x = f(int(y))

Submission status: Runtime Error

Solution code:

def f(y):

    if 0 <= y <=999:
        print(1000-y)
    elif 1000<= y <= 10000 :
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and x % 1000!=0:
            print("500")
        elif y % 100==0 and x % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and x % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input()
x = f(int(y))

Submission status: Runtime Error

Solution code:

def f(y):

    if 0 <= y <=999:
        print(1000-y)
    else:
        b = int(y / 100)
        c = int(str(b)[1])
        g = 9-c
        h = int(y/10)
        i = int(str(h)[2])

        if y %1000==0:
            print("0")
        elif y % 500==0 and x % 1000!=0:
            print("500")
        elif y % 100==0 and x % 500!=0:
            f = 10-c
            print(f*100)
        elif y % 10 ==0 and x % 100!=0:
            j =10-i
            print(g*100+j*10)
        elif y % 10!=0:
            k = int(str(y)[3])
            l = 9 - i
            m = 10-k
            print(g*100+l*10+m)


y = input("number")

x = f(int(y))

Submission status: Runtime Error

Solution code:
n = int(input())
res = n%1000
if res:
  return 1000 - res
return 0

Submission status: Runtime Error

Solution code:
def change(x):
	res = 1000 - x%1000
    if res:
      return res
    return 0

Submission status: Runtime Error

Solution code:
return 1000 - N%1000

Submission status: Runtime Error

Solution code:
n = input()
while(n > 0):
    n -= 1000
print(-n)

Submission status: Runtime Error

Solution code:
print(''.join([1,2]))

Submission status: Runtime Error

Solution code:
N = input()

if N < 1000:
  out = 1000 - N
elif N % 1000 < 500:
  out = N % 1000
else:
  out = 1000 - N % 1000

print(out)

Submission status: Runtime Error

Solution code:
N = input()
  
if N < 1000:
  out = 1000 - N
elif N % 1000 < 500:
  out = N % 1000
else:
  out = 1000 - N % 1000

print(out)

Submission status: Runtime Error

Solution code:
n = input()

if n < 1000:
    amari = 1000 - n
else:
    amari = 1000 - int(n) % 1000

print(amari)

Submission status: Runtime Error

Solution code:
N = int(input())

result = [input() for _ in range(N)]

C_AC,C_TLE,C_WA,C_RE = [0,0,0,0]

for i in result:
  if i == "AC":
    C_AC += 1
  elif i == "WA":
    C_WA += 1
  elif i == "TLE":
    C_TLE += 1
  elif i == "RE":
    C_RE += 1

print("AC x " + str(C_AC))
print("WA x " + str(C_WA))
print("TLE x " + str(C_TLE))
print("RE x " + str(C_RE))

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
using namespace std;

int n;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	cout << (1000 - n % 1000) % 1000;
	return 0;
}

Submission status: Runtime Error

Solution code:
N = int(input())
N = str(N)
print(1000 - int(N[-3] + N[-2] + N[-1]))

Submission status: Runtime Error

Solution code:
N = input()

print(N % 1000)

Submission status: Runtime Error

Solution code:
N = input()
o = 1000-(N%1000) 
print(o)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
if N%1000==0:
  return 0
else:
  return 1000-N%1000

Submission status: Runtime Error

Solution code:
if N%1000==0:
  return (0)
else:
  return (1000-N%1000)

Submission status: Runtime Error

Solution code:
x=input()
if x%1000:
  print('x')
else 
  x=1000-x
  print('x')

Submission status: Runtime Error

Solution code:
int x
x=1000-x
print(x)

Submission status: Runtime Error

Solution code:
N = input()
o = 1000
i = 1
while o<N:
  O = O*i
  i += 1

print(o-int(N))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
input1 = raw_input()
print 1000 - int(input1) % 1000

Submission status: Runtime Error

Solution code:
N = input()

while N > 0:
  OTURI = 1000 - N
  N -= 1000
  
print(OTURI)

Submission status: Runtime Error

Solution code:
N = input()

While N > 0:
  OTURI = 1000 - N
  N -= 1000
  
print(OTURI)

Submission status: Runtime Error

Solution code:
num = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(num):
    word = input()
    if word == "AC":
        ac = ac + 1
    elif word == "WA":
        wa = wa + 1
    elif word == "TLE":
        tle = tle + 1
    elif word == "RE":
        re = re + 1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Submission status: Runtime Error

Solution code:
print(N % 1000)

Submission status: Runtime Error

Solution code:
price = int(input())
print(prince % 1000)

Submission status: Runtime Error

Solution code:
price = int(raw_input())
print(mod(price, 1000))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=input()
x=N/1000
x=int(x)
y=1000*x
print(y-N)

Submission status: Runtime Error

Solution code:
n = int(stdin.readline().rstrip())
ans = 1000 - n % 1000
if ans == 1000:
    ans = 0
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))
sa = sorted(A, reverse=True)
ans = 0

for i in range(1, N):
    ans += sa[i//2]

print(ans)

Submission status: Runtime Error

Solution code:
N = input()

N = N.splitlines()

N_num = int(N[0])

AC_num = 0
WA_num = 0
TLE_num = 0
RE_num = 0

for i in range(N_num):
    #print(i+1)
    
    if 'AC' == N[i+1]:
        AC_num += 1
        #print(AC_num)
    
    elif 'WA' == N[i+1]:
        WA_num += 1
        #print(WA_num)

    elif 'TLE' == N[i+1]:
        TLE_num += 1
        #print(TLE_num)
    
    else 'RE' == N[i+1]:
        RE_num += 1
        #print(RE_num)


print('AC x {}'.format(AC_num))
print('WA x {}'.format(WA_num))
print('TLE x {}'.format(TLE_num))
print('RE x {}'.format(RE_num))

Submission status: Runtime Error

Solution code:
print(1000-N%1000)

Submission status: Runtime Error

Solution code:
import math

a = input()
oturi = math.ceil(a/1000)*1000-a

print(oturi)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
def pay(a):
  b = np.ceil(a/1000.0)
  print(b)
pay(N)

Submission status: Runtime Error

Solution code:
def pay(a):
  b = math.ceil(a/1000.0)
  print(b)
pay(N)

Submission status: Runtime Error

Solution code:
x=input()

if x<1000:
  result=1000%x
if x%1000==0:
  result=0
else:
  result=1000-(x%1000)

print(result)

Submission status: Runtime Error

Solution code:
s = int(input())
for i in range(1,10):
  if (1000 * i) > s:
    return print((1000 * i) - s)

Submission status: Runtime Error

Solution code:
N=int(input())
a=0
if N<1000:
    print(N)
    exit()
else:
    while 1:
        if a*1000-N>=0:
            prit(a*1000-N)
            exit()
        else:
            a+=1

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
str_list = [str(input()) for _ in range(N)]
count_ac = 0
count_wa = 0
count_tle = 0
count_re = 0

for s in str_list:
    if s == 'AC':
        count_ac = count_ac + 1
    elif s == 'WA':
        count_wa = count_wa + 1
    elif s == 'TLE':
        count_tle = count_tle + 1
    elif s == 'RE':
        coun_re == count_re + 1

print('AC x ' + str(count_ac))
print('WA x ' + str(count_wa))
print('TLE x ' + str(count_tle))
print('RE x ' + str(count_re))

Submission status: Runtime Error

Solution code:
N = int(input())
cnt = 1000

while true:
  if cnt > N:
    print(N - cnt)
  else:
    cnt += 1000
break

Submission status: Runtime Error

Solution code:
N = input()
if N[-3] == '0':
  print(0)
else:
  print((10 - int(N[-3]))*100)

Submission status: Runtime Error

Solution code:
n = int(input())
 
nodes = []
nodes_append = nodes.append
components = 0
for i in range(n - 1):
  edge = tuple(map(int, input().split()))
  node_max = max(edge)
  node_min = min(edge)
  if node_min not in nodes:
      nodes_append(node_min)
      components += node_min * (n - node_min + 1)
  if node_max not in nodes:
      nodes_append(node_max)
      components += node_max * (n - node_max + 1)
  num_edge = node_min * (n - node_max + 1)
  components -= num_edge
  
print(components)

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
edges = [list(map(int, input().split())) for _ in range(n - 1)]

grid = np.zeros([n, n])

for i in range(n - 1):
  edge = sorted(edges[i])
  grid[edge[0] - 1][edge[1] - 1] = 1

components = 0
for i in range(n):
  for j in range(i, n):
    loss = grid[i:j + 1, i:j + 1].sum()
    components += j - i + 1 - loss
  
print(int(components))

Submission status: Runtime Error

Solution code:
from itertools import product
h,w,k=map(int,input().split())
idxs=[]
cols=[0]*w
clis=[]
al=0
k_score=0
def nir(x):
  if x=='#':return 1
  else:return 0
  
for _ in range(h):
  tmp=list(map(nir, list(input())))
  clis.append(tmp)
  idxs.append(sum(tmp))
  al+=sum(tmp)
  for q in range(w):
    cols[q]+=tmp[q]
uu=product((0,1),repeat=h+w)
for bits in uu:
  idd=[]
  coll=[]
  for i in range(h):
    if bits[i]==1:idd.append(i)
  
  for i in range(w):
    if bits[i+h]==1:coll.append(i)
  
  s=al
  if not coll:
    for x in idd:s-=idxs[x]
  elif not idd:
    for y in coll:s-=cols[y]
  else:
    for x in idd:s-=idxs[x]
    for y in coll:s-=cols[y]
    for x in idd:
      for y in coll:
        s+=clis[x][y]
        
  if s==k:k_score+=1
    
print(k_score)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import defaultdict

types = ['AC', 'WA', 'TLE', 'RE']
num = int(input())
categories = defaultdict(int)

for i in range(num):
    categories[input()] += 1

for i in types:
    print("{} x {}".format(i, categories[i]))

Submission status: Runtime Error

Solution code:
a = input()
print(a % 1000)

Submission status: Runtime Error

Solution code:
N =int(input())

remain = 10000 - N
if remain[-4] != 0:
  remain =remain - remain[-4] * 1000
elif remain[-5] != 0:
  remain =remain - remain[-5] * 1000

print(remain)

Submission status: Runtime Error

Solution code:
N=input()
print(N % 1000)

Submission status: Runtime Error

Solution code:
N = int(input())
rest = N//1000
return 1000-rest

Submission status: Runtime Error

Solution code:
if divmod(int(input()), 1000)[1] == 0:
    print(f"{0}")
else:
    print(1000 - divmod(int(input()), 1000)[1])

Submission status: Runtime Error

Solution code:
N = int(input())

N = N % 1000
Ans = 1000 - N

ptint(Ans)

Submission status: Runtime Error

Solution code:
N = input()

N = N % 1000
Ans = 1000 - N

print(Ans)

Submission status: Runtime Error

Solution code:
money = input()

oturi = 1000 - money % 1000

print(oturi)

Submission status: Runtime Error

Solution code:
N = input()
M = int(N)

def cal(a):
	return a%1000

 
if M=1000
  print(0)


else:
	print(1000-cal(M))