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 math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  for i in range(20):
    x=i*1000
    if x>=n:
      return x-n

# main()
print(main())

Submission status: Accepted

Solution code:
def examA():
    N = I()
    ans = (10000 - N)%1000
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
payment = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = ((n + 999) // 1000) * 1000 - n
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
print(((N+999)//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())
if (n%1000 ==0):
  print(0)
else:
  print(1000 - n%1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    return (1000 - N % 1000) %1000


def main():
    N = read_int()
    print(slv(N))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

print((1000 - n) % 1000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

if __name__ == '__main__':
    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:
import math
import fractions
import collections
import itertools
N=int(input())
print(math.ceil(N/1000)*1000-N)

Submission status: Accepted

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

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())
print((1000-N%1000)%1000)

Submission status: Accepted

Solution code:
N = int(input())

print((-N)%1000)

Submission status: Accepted

Solution code:
N = int(input())

ans = 1000 * ((N + 999) // 1000) - N
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    
    n = (N + 999) // 1000
    ans = n * 1000 - N
    print(ans)
    
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

N, = [int(x) for x in input().split()]

print(-N % 1000)

Submission status: Accepted

Solution code:
def main():

    N = int(input())
    if N % 1000 == 0:
        return 0
    else:
        return 1000 - N % 1000

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
import math
print(math.ceil(n/1000)*1000 - n)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
from decimal import *
import heapq
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

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

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

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

    return None

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
print(-(-N//1000)*1000-N)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]


INF = float("inf")
MOD = 10**9 + 7


def main():

    N = INT()
    print((1000 - N % 1000) % 1000)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    n = int(input())
    print(ceil(n / 1000) * 1000 - n)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n =I()
    print(-n%1000)
    return

#Solve
if __name__ == "__main__":
    solve()

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:
N = int(input())
print(1000*math.ceil(N/1000)-N)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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:
fun main(args:Array<String>) {
var a = readLine()!!.toInt()
var b = a%1000
  if (b==0) {
  println(0)
  }else{
  println(1000-b)
}
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()

A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

#while ansA>0:
#  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
B1.remove(Bp[-1])
B1.append(min(B2[0],0))

ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD

C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD

BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2

if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()

if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
from functools import reduce
from operator import add, mul
 
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
A=sorted(A)
if K%2==1 and A[-1]<0:
  ans0 = 1
  for a in A[N-K:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
 
A=sorted(A, reverse=True)
ansB = 1
for a in A[0:K]:
  ansB *= a
  ansB %= MOD
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
ansC = 1
for a in A[0:K]:
  ansC *= a
  ansC %= MOD
 
#print(ansA, ansB, ansC)
print(max(ansA, ansB, ansC)%MOD)
exit()
#print(factorial(0,30))
      
#A=sorted(A)
 
#Amin=factorial(0,K)
#if Amin<0 and 0 in A[K:N]:Amin=0
 
A=sorted(A, reverse=True)
 
Amax=factorial(0,K)
 
#A=sorted(A, key=lambda x: abs(x), reverse=True)
 
#B=A[0:K-1]
#C=A[K-1:N]
 
#Bmax=factorial(0,K-1)*C[0]
#print(factorial(0,K-1),C[0])
#print(Bmax)
 
#C=sorted(C)
#print(C)
#Bmin=factorial(0,K-1)*C[0]
#print(Bmin)
#print(Amax,Amin,Bmax,Bmin)
#print(max(Amax,Amin,Bmax,Bmin)%(10**9+7))
print(Amax)
import numpy as np
import sys
from functools import reduce
from operator import add, mul
 
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
A=sorted(A)
if K%2==1 and A[-1]<0:
  ans0 = 1
  for a in A[N-K:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()

ansA = 1
for a in A[0:K]:
  ansA *= a
  if ansA>0:ansA %= MOD

A=sorted(A, reverse=True)
ansB = 1
for a in A[0:K]:
  ansB *= a
  if ansB>0:nsB %= MOD

A=sorted(A, key=lambda x:abs(x), reverse=True)
ansC = 1
for a in A[0:K]:
  ansC *= a
  if ansC>0:ansC %= MOD

#print(ansA, ansB, ansC)
print(max(ansA, ansB, ansC)%MOD)
exit()

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
 
N,K=map(int, input().split())
A =np.array(list(map(int,input().split())), dtype=np.int64)
#A=sorted(A, reverse=True)
 
def factorial(p,q):
    fact = 1
    for integer in A[p:q]:
        fact *= integer
        fact = fact%(10**9+7)
    return fact
 
A=sorted(A)
 
Amin=factorial(0,K)%(10**9+7)
A=sorted(A, reverse=True)
 
Amax=factorial(0,K)%(10**9+7)
 
 
A=sorted(A, key=lambda x: abs(x), reverse=True)
 
B=A[0:K-1]
C=A[K-1:N]
 
 
Bmax=factorial(0,K-1)*C[0]%(10**9+7)
#print(factorial(0,K-1),C[0])
#print(Bmax)
 
C=sorted(C)
#print(C)
Bmin=factorial(0,K-1)*C[0]%(10**9+7)
#print(Bmin)
 
print(max(Amax,Amin,Bmax,Bmin))

Submission status: Runtime Error

Solution code:
n = int(input())
if(n%1000 == 0):
	print('0')
else:
	n_str = str(n)
    g = n_str[0]
    print((n+1)*1000-n)

Submission status: Runtime Error

Solution code:
using namespace std;
#include <iostream>
int main(){
  int N;
  cin >> N;

  if (N % 1000 == 0) cout << 0;
  else cout << 1000 - N % 1000;

  return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  cout << n%1000 << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = input()
if len(n) < 3:
  print(1000 - int(n))
else:
  hasuu = n[len(n) - 3:]
  if hasuu == '000':
    print('0')
  else:
    print(1000-int(hasuu)

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
n = input()
for i in range(11):
  if 1000*i >= n:
    print(n - 1000*i)
    exit()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
print(n - (math.floor(n - 1 / 1000) + 1) * 1000)

Submission status: Runtime Error

Solution code:
n = int(input())
result = n % 1000

pirnt(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=(input())
a = len(N)
if N[a-3]+N[a-2]+N[a-1] =='000':
    print(0)
    
else:
    if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
    elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
    else :
        x = int(N[a-1])
        print(1000-x)

Submission status: Runtime Error

Solution code:
N=(input())
a = len(N)
if N[a-3]+N[a-2]+N[a-1] =='000':
    print(0)
    
else:
    if a>=3:
        x = int(N[a-3]+N[a-2]+N[a-1])
        print(1000-x)
    elif a==2:
        x = int(N[a-2]+N[a-1])
        print(1000-x)
    else :
        x = int(N[a-1])
        print(1000-x)

Submission status: Runtime Error

Solution code:
N=(input())
a = len(N)
if N%1000 ==0:
    print(0)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a==2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Submission status: Runtime Error

Solution code:
N=(input())
a = len(N)
if N%1000 ==0:
  print(0)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a==2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Submission status: Runtime Error

Solution code:
N=(input())
a = len(N)
if a>=3:
    x = int(N[a-3]+N[a-2]+N[a-1])
    print(1000-x)
elif a=2:
    x = int(N[a-2]+N[a-1])
    print(1000-x)
else :
    x = int(N[a-1])
    print(1000-x)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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 = 10000 - int(input())
if N % 1000 == 0:
    print(0)
ans = [str(x) for x in list(str(N))]
print(ans[-3]+ans[-2]+ans[-1])

Submission status: Runtime Error

Solution code:
N = 10000 - int(input())
ans = [str(x) for x in list(str(N))]
print(ans[-3]+ans[-2]+ans[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = map(int,input())
a = n // 1000
b = n - a
print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
if 0 <= N <= 1000:
  print(1000 - N)
elif 1001 <= N <= 2000:
  print(2000 - N)
elif 2001 <= N <= 3000:
  print(3000 - N)
elif 3001 <= N <= 4000:
  print(4000 - N)
elif 4001 <= N <= 5000:
  print(5000 - N)
elif 5001 <= N <= 6000:
  print(6000 - N)
elif 6001 <=N <= 7000
  print(7000 - N)
elif 7001 <= N <= 8000:
  print(8000 - N)
elif 8001 <= N <= 9000:
  print(9000 - N)
else:
  print(10000 - N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def sides(a,b,c):
  if a + b > c:
    return True
  return False
res = 0
N = int(input())
nums = list(map(int,input().split()))
for x in range(N-2):
  for y in range(x+1,N-1):
    for z in range(y+1,N):
      if nums[x] != nums[y] and nums[x] != nums[z] and nums[y] != nums[z] and sides(x,y,z):
        res += 1
print(res)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
money1 = int(input())
money2 = money % 1000
print(money2)

Submission status: Runtime Error

Solution code:
n = int(input())
x = 0

whlie True:
  if n % 1000 == 0:
    break
   
  n += 1
  x += 1
  
print(x)

Submission status: Runtime Error

Solution code:
n = int(input())
x = 0

whlie True:
  if n % 1000:
    break
   
  n += 1
  x += 1
  
print(x)

Submission status: Runtime Error

Solution code:
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True,key=lambda x:abs(x)) #絶対値の順にソートする
if k==n: #k=nのときはすべてを掛け合わせるほかない
  ans=1
  for i in range(n):
    ans*=arr[i]
    ans%=mod
  print(ans)
else:
  if k%2==1 and max(arr)<0: #答えが負になる場合は絶対値の小さい順にK個掛け合わせる
    ans=1
    for i in range(k):
      ans*=arr[n-1-i]
      ans%=mod
      print(ans)
  else:
    ans=1
    cnt=0
    for i in range(k): #絶対値の大きい順にK個掛け合わせる
      if arr[i]<0: #負数を掛けた回数を数えておく
        cnt+=1
      ans*=arr[i]
      ans%=mod
    if cnt%2==0: #負数を偶数回掛けていれば答えは非負なのでそのまま出力
      print(ans)
    else: #そうでなければ調整を行う
      min_plus=-1
      min_minus=1
      for i in range(k): #絶対値の大きい順にK個を見て最小の非負の数・負の数を探す
        if arr[i]>=0:
          min_plus=arr[i]
        else:
          min_minus=arr[i]
      max_plus=-1
      max_minus=1
      for i in range(k,n): #残るN-K個を見て最大の非負の数・負の数を探す
        if arr[i]>=0 and max_plus==-1:
          max_plus=arr[i]
        if arr[i]<0 and max_minus==1:
          max_minus=arr[i]
      if min_plus==-1: #もし最小の非負の数がなければ、最小の負の数を取り除くしかない
        arr.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_plus
        ans%=mod
      elif min_minus==1: #もし最小の負の数がなければ、最小の非負の数を取り除くしかない
        arr.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_minus
        ans%=mod
      elif min_plus*max_plus>=min_minus*max_minus: #そうでなければより倍率の大きいほうを選ぶ
        arr.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_plus
        ans%=mod
      else:
        arr.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_minus
        ans%=mod
      print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC', 'x', AC)
print('WA', 'x', WA)
print('TLE', 'x', TLE)
print('RE', 'x', RE)

Submission status: Runtime Error

Solution code:
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC x', AC)
print('WA x', WA)
print('TLE x', TLE)
print('RE x', RE)

Submission status: Runtime Error

Solution code:
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
    s = input()
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC','×',AC)
print('WA','×',WA)
print('TLE','×',TLE)
print('RE','×',RE)

Submission status: Runtime Error

Solution code:
n=int(input())
a=0
b=0
c=0
d=0
for i in range(n):
  s=input()
  if s=="AC":
    a=a+1
  if s=="WA":
    b=b+1
  if s=="TLE":
    c=c+1
  if s=="RE":
    d=d+1
print("AC*a""WA*b""TLE*c""RE*d)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

s = sorted(a,reverse=True)
mod = 10**9 + 7
ans = 1
#全部の要素が負の数であり奇数個の場合は大きい順に取ったものが答え
if k % 2 == 1 and s[0] < 0:
        for i in range(k):
            ans = ans * s[i] % mod
        print(ans)
        exit()#終了

l = 0
r = n - 1
#次の処理のための計算　（kが奇数だった場合)
#この処理の必要性
#奇数個だった場合三個のうち二つで正の数の最大値を作れば良い
if k % 2 == 1:
  ans = ans * s[l]
  l += 1


for _ in range(k // 2):
  ml = s[l] * s[l + 1]
  mr = s[r] * s[r - 1]
  if ml > mr:
    ans = ans * ml % mod
    l += 2
  else:
    ans = ans * mr % mod
    r -= 2

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
for i in range(10):
 if N>1000:
  N-=1000
 if N<1000:
  break

print(1000-N)

Submission status: Runtime Error

Solution code:
n = int(input())

a = 0
w = 0
t = 0
r = 0

for i in range(n):
    b = input()
    if b == "AC":
        a += 1
    if b == "WA":
        w += 1
    if b == "TLE":
        t += 1
    if b == "RE":
        r += 1
print("AC x", a)
print("WA x", w)
print("TLE x", t)
print("RE x", r)

Submission status: Runtime Error

Solution code:
#include <iostream>
2 using namespace std;
3 int main(){
4 int N;
5 cin >> N;
6 cout << (1000 - N % 1000) % 1000 << endl;
7 }
1 puts -gets.to_i % 1000

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())
print((10000-n)%1000)

Submission status: Runtime Error

Solution code:
import sys

N = int(input())

if N % 1000 == 0:
  ans = 0
elif:
  ans = N % 1000
  
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
    print('{0} x {1}'.format(v, s.count(v)))

Submission status: Runtime Error

Solution code:
a = 1000-N%1000
if a != 1000:
	print(a)
else:
	print('O')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=input()
t=len(n)
if t<4:
  print(1000-int(n))
else:
  k,p=int(n[0]),int(n[1])
  if p!=0:
    print((k+1)*1000-int(n))
  else:
    print(0

Submission status: Runtime Error

Solution code:
n=input()
t=len(n)
if t<4:
  print(1000-n)
else:
  k,p=n[0],n[1]
  if p!=0:
    print((k+1)*1000-n)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
u=str(n)
t=len(u)
if t<4:
  print(1000-n)
else:
  k,p=u[0],u[1]
  if p!=0:
    print((k+1)*1000-n)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
u,t=str(n),len(n)
if t<4:
  print(1000-n)
else:
  k,p=u[0],u[1]
  if p!=0:
    print((k+1)*1000-n)
  else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
t=len(n)
if t<4:
  print(1000-n)
else:
  k,p=n[0],k[1]
  if p!=0:
    print((k+1)*1000-n)
  else:
    print(0)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(Y):
    i=0
    while 1-i==1:
        return ((Y-2000)*-1)
main(Y)

Submission status: Runtime Error

Solution code:
def main(Y):
    while 1000-Y>-2000:
        return ((Y-2000)*-1)
        break
main(Y)