Problem:


Score : 200 points

Problem Statement

Takahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)

Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?

(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)

Constraints

0 \leq X \leq 10^9

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the maximum number of happiness points that can be earned.

Sample Input 1

1024

Sample Output 1

2020

By exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.

Sample Input 2

0

Sample Output 2

0

He is penniless - or yenless.

Sample Input 3

1000000000

Sample Output 3

2000000000

He is a billionaire - in yen.



Sample input:
1024


Sample output:
2020

Submission status: Runtime Error

Solution code:
x=int(input())
i=x//500
a=(x-i)//5
sum=i*1000+a*5
print sum

Submission status: Runtime Error

Solution code:
x=map(int,input().split())
h=x//500 * 1000
x%=500
h+=x//5
print(h)

Submission status: Runtime Error

Solution code:
X = input()
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Submission status: Runtime Error

Solution code:
# -*- coding: <encoding name> -*-

x = int(input())
print(1000 * (x // 500) + 5 * (x % 500 // 5)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

ll x;
bool su[101];

int main(){
    cin >> x;
    ll ans=0;
    ll p;
    p = x%500;
    ans+=p*1000;
    x-=x-500*p;
    p = x%5;
    ans+=p*5;
    cout << ans << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
X=int(input())
N=0
n=0
N=X//500
n=(X-N*500)//5
input(N*1000+5*n)

Submission status: Runtime Error

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

X = int(input())

a = int(X/500)
b = int((X-500*a)/5
print("{}".format(1000*a+5*b))

Submission status: Runtime Error

Solution code:
import.math
X=int(input())
M=X%500
print(M*1000 +  5*(math.ceil(M/5)-1))

Submission status: Runtime Error

Solution code:
yen=int(input())
big=yen//500
small=(yen-500*big)//5
print(1000*big+5*small

Submission status: Runtime Error

Solution code:
x = int(input())
a = 500
b = 5
q = x//a
mod = x%a
if q > 0:
  c = q * 1000
elif mod // b > 0:
  d = (mod // b) * 5
  print(c + d)
else:
  print('0')

Submission status: Runtime Error

Solution code:
X = int(input())

print( (X//500)*1000 + ((X%500)//5)*5

Submission status: Runtime Error

Solution code:
X = input()
a=X//500
b=(X-500*a)//5
print(1000*a+5*b)

Submission status: Runtime Error

Solution code:
k,n=map(int,input().split())
lista=list(map(int,input().split())) 
ans=[]
for i in range(n):
  ans.append(lista[i+1]-lista[i])
print(k-max(ans))

Submission status: Runtime Error

Solution code:
def registar(nyukin,coin):
    oturi=nyukin-coin*int(nyukin/coin)
    return oturi,int(nyukin/coin)

x,coin_500=registar(x,500)
#print(coin_500)
x,coin_5=registar(x,5)
x,coin_1=registar(x,1)

#print(coin_500,coin_5,coin_1)
uresisa=coin_500*1000+coin_5*5
print(uresisa)

Submission status: Runtime Error

Solution code:
X=int(input())
g=X//500
h=X-500*g
i=h//5
j=1000*g+5*i
input(j)

Submission status: Runtime Error

Solution code:
X=int(input())
g=X//500
h=X-g
i=h//5
j=1000*g+5*i
input(j)

Submission status: Runtime Error

Solution code:
X=int(input())
N=int(input())
Z=int(input())
A=int(input())
G=int(input())
M=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Submission status: Runtime Error

Solution code:
X=int(input())
N=int(input())
Z=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Submission status: Runtime Error

Solution code:
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Submission status: Runtime Error

Solution code:
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Submission status: Runtime Error

Solution code:
X = input()

y = X//500
z = X%500
a = z//5 

A = 1000*y+5*a
print(a)

Submission status: Runtime Error

Solution code:
x=int(input())
a=x//500*1000
b=(x-x//500*500)//5*5
input(a+b)

Submission status: Runtime Error

Solution code:
X = input()
print((X//500)*1000+((X-X//500)//5)*5)

Submission status: Runtime Error

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

x = int(input())
a = x//500
x -= a*500
b = x//5
print(a*1000+b*5)
~

Submission status: Runtime Error

Solution code:
X=int(input())
print(print('{:.0f}'.format(round(X/500)*1000+round(rem(X/500)/5)*5)))

Submission status: Runtime Error

Solution code:
a = input()
b = 0
while a >= 500:
  a-=500
  b+=1000
while a >= 5:
  a-=5
  b+=5
print(b)

Submission status: Runtime Error

Solution code:
n =input()
a= 500
b = 5
sum = 0
if(n%a==0):
  sum = n*2
print(sum)

Submission status: Runtime Error

Solution code:
x = input()
happy500 = (x % 500) * 1000
happy5(500 - (x % 500) * x) % 5 * 5
print(happy500 + happy5)

Submission status: Runtime Error

Solution code:
n=int(input())
d=n//500
e=n%500
f=e//5
print('d*1000 + f*5)

Submission status: Runtime Error

Solution code:
X = input()
happier = (X % 500) * 1000
happy = ((X % 500) % 5) * 5
print(happier + happy)

Submission status: Runtime Error

Solution code:
s=input()
if s[2]==s[3] and s[4]==s[5]:print("Yes")
else :print("No")

Submission status: Runtime Error

Solution code:
x=input()
a=x//500
b=(x%500)//5
print(1000*a+5*b)

Submission status: Runtime Error

Solution code:
x=input()
a=x//500
b=a//5
print(1000*a+5*b)

Submission status: Runtime Error

Solution code:
X= int(input())
ans = X // 500 * 1000
X -= X // 500 * 
ans += (X // 5) * 5
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import permutations
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *
from math import gcd

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    x=II()
    c,x=divmod(x,500)
    ans=c*1000+x//5*5
    print(ans)

main()

Submission status: Runtime Error

Solution code:
a = list(input())
if (a[2] == a[3]) & (a[4] == a[5]):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

int main() {
    int x;
    int HP = 0;
    bool FUCK = false;
    
    cin >> x;

    if(x < 5){
        cout << 0 << endl;
        FUCK = true;
    }
    
    while(x >= 500){
        HP += 1000;
        x -= 500;
    }
    
    while(x >= 5){
        HP += 5;
        x -= 5;
    }
        
    if(FUCK == false){
        cout << HP << endl;
    }
    
}

Submission status: Runtime Error

Solution code:
X = input()
uresisa_500yen = (X // 500) * 1000
mod = (X % 500)
uresisa_5yen = (mod // 5) * 5

uresisa_total = uresisa_500yen + uresisa_5yen
print(uresisa_total)

Submission status: Runtime Error

Solution code:
x = input()

print(x//500*1000 + (x%500)//5*5)

Submission status: Runtime Error

Solution code:
X = int(input())

div = int(X/500)
mod = int(X%500)
hap = 0

if div != 0:
  hap = i
q = int(p/5)
hap += q

print(hap)

Submission status: Runtime Error

Solution code:
X = input()
a = X // 500
b = X % 500
c = b // 5
print(a * 1000 + c * 5)

Submission status: Runtime Error

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

#!/usr/bin/env python3

N, D = map(int, input().split())
X = [list(map(int, input().split())) for i in range(N)]
cnt = 0

def dist(X,i,j):
    dist = 0
    for k in range(D):
        dist += (X[i][k] - X[j][k]) **2
    dist = dist ** 0.5
    return dist.is_integer()

for i in range(N):
    for j in range(N):
        if i >= j :
            continue
        else:
            if dist(X,i,j):
                cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
x = input()
HP = 0
while x > 500:
  x -= 500
  HP += 1000
while x > 5:
  x -= 5
  HP += 5
if x < 5:
  print(0)
print(HP)

Submission status: Runtime Error

Solution code:
x=input()

a=int(x%500)

b=int((x-a*500)%5)

c=1000*a+5*b

print(c)

Submission status: Runtime Error

Solution code:
x=input()

a=int(x%500)

b=int((x-a)%5)

c=1000*a+5*b

print(c)

Submission status: Runtime Error

Solution code:
x=input()

a=int(x//500)

b=int((x-a)//5)

c=1000*a+5*b

print(c)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    long int n,sum;
    cin>>n;
    sum=(n/500)*1000;
    n-=(n/500)*500;
    sum+=(n/5)*5;
    cout<<sum;
    return 0;
}

Submission status: Runtime Error

Solution code:
X=int(input())
print((x//500)*1000+((x%500)//5)*5)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
gold = x % 500
silver = (x - 500*g) % 5
fun = gold*1000 + silver*5
print(fun)

Submission status: Runtime Error

Solution code:
n = int(input())

print(int((n/500))*1000 + int((n%500)/5))*5

Submission status: Runtime Error

Solution code:
num_origin = input()
gohyoku = int(num_origin/500)
num_zan = num_origin - gohyoku*500
go = int(go/5)

num = go*5 + gohyoku*1000

print(num)

Submission status: Runtime Error

Solution code:
X = input()

print(X // 500 * 1000 + X % 500 // 5 * 5)

Submission status: Runtime Error

Solution code:
X=input()
a=X/500
X%=500
b=X/5
print(1000*a+5*b)

Submission status: Runtime Error

Solution code:
X = int(input())

500_cnt = X//500
new_X = X - 500_cnt * 500
5_cnt = new_X // 5
print(500_cnt*1000 + 5_cnt*5)

Submission status: Runtime Error

Solution code:
x = int(input())

500yen = x//500*1000
5yen = x%500//5*5

print(500yen + 5yen)

Submission status: Runtime Error

Solution code:
x = input()

500yen = x//500*1000
5yen = (x - x//500)//5*5

print(500yen + 5yen)

Submission status: Runtime Error

Solution code:
x = input()
no_of_500 = x//500
x -= 500*no_of_500
no_of_5 = x//5
total = (no_of_500 * 1000) + (no_of_5 * 5)
print(total)

Submission status: Runtime Error

Solution code:
x = int(input())
print('{}'.format(str(int(x/500)*1000 + x%500))

Submission status: Runtime Error

Solution code:
X = input()
no_of_500 = s//500
s -= 500*no_of_500
no_of_5 = s//5
total = (no_of_500 * 1000) + (no_of_5 * 5)
print(total)

Submission status: Runtime Error

Solution code:
x = input()
no_of_500 = s//500
s -= 500*no_of_500
no_of_5 = s//5
total = (no_of_500 * 1000) + (no_of_5 * 5)
print(total)

Submission status: Runtime Error

Solution code:
a,b=divmod(int(input),500)
print(a*1000+b//5*5)

Submission status: Runtime Error

Solution code:
a,b=divmod(int(input()))
print(a*1000+b//5*5)

Submission status: Runtime Error

Solution code:
S=input(int())
a=S//500
b=S%500
c=b//5
print(a*1000+c*5)

Submission status: Runtime Error

Solution code:
X = input()
tmp = X // 500
ans = tmp * 1000 + X % 500 - ((X % 500) % 5)
print(ans)

Submission status: Runtime Error

Solution code:
x = input()

happyPoints = 0

y = x - (x % 500)

if x % 500 !== x:
  happyPoints += (x/500)*1000
  	if y % 5 !== y:
      z = y - (y % 5)
      happyPoints += y
elif x % 5 !== x:
  w = x - (x % 5)
  happyPoints += w

  print(happyPoints

Submission status: Runtime Error

Solution code:
X = input()

a = X / 500
b = X % 500
c = b / 5
    
print(a * 1000 + c * 5)

Submission status: Runtime Error

Solution code:
a = X / 500
b = X % 500
c = b / 5
    
print(a * 1000 + c * 5)

Submission status: Runtime Error

Solution code:
l = input()
if l>1000:
  print(l*2)
elif l>=0 and l<1000:
  print(l)
else:
  print("Invalid")

Submission status: Runtime Error

Solution code:
money = int(input())
if money >= 500:
    twoup = int(money / 500)
    oneup = int((money - twoup * 500) / 5)
    print(twoup * 1000 + oneup * 5)
elif money > 0:
    oneup = int(mone / 5)
    print(oneup * 5)
else:
    print(money)

Submission status: Runtime Error

Solution code:
n=int(input())
happy=0
def covid(num):
  if num==0:
    return 0
  else:
    fund=num//500
    num-=fund*500
    happy+=fund*1000
    happy+=num//5*5
    return happy
print(covid(n))

Submission status: Runtime Error

Solution code:
x = input()
bigpleasure = x//500*1000
smallpleasure = x%500//5*5

print(bigpleasure+smallpleasure)

Submission status: Runtime Error

Solution code:
x = input()
print(x//500 * 1000 + x%500//5 * 5)

Submission status: Runtime Error

Solution code:
x = inpput()
print(x//500 * 1000 + x%500//5 * 5)

Submission status: Runtime Error

Solution code:
n=int(input())
print(1000*(n/500)+((n%500))

Submission status: Runtime Error

Solution code:
X = int(input())
fh = x // 500
f = (x - (500*fh)) // 5
pint(f*5+fh*1000)

Submission status: Runtime Error

Solution code:
X = int(input())
fh = x // 500
f = (x - (500*fh)) // 5
pint(f*1000+fh*5)

Submission status: Runtime Error

Solution code:
X = int(input())
fh = x // 500
f = (x - (500*fh)) // 5
pint(f+fh)

Submission status: Runtime Error

Solution code:
X = int(input())
fh = x // 500
f = x - 2*fh // 5
pint(f+fh)

Submission status: Runtime Error

Solution code:
coin_value = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
  result += value * (x // coin)
  x = x - x // coin * coin
  
print(result)

Submission status: Runtime Error

Solution code:
coin_value = [[500, 1000], [5, 5]]
result = 0
x = int(input().strip())
idx = 0
for coin, value in coin_values:
    result += value * (x // coin)
    x = x - x // coin * coin
  
print(result)

Submission status: Runtime Error

Solution code:
x = int(raw_intput())

1000ureshi = x / 500
5ureshi = (x % 500) / 5

ureshimi = 1000ureshi + 5ureshi

print(1000ureshi + 5ureshi)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    l = []
    
    if(n<0 or n>1000000000):
        main()
    
    h1 = int(n/500)*1000
    ar = n - (h1/int(n/500))
    h1+=int(ar/5)*5
    h2 = int(n/5)*5

    l.append(h1)
    l.append(h2)
    print(max(l))

main()

Submission status: Runtime Error

Solution code:
c5, c2 = (500, 5)
yens = int(input())
happiness = 0
if yens >= c5:
    noofc5 = yens // c5
    happiness += 1000 * noofc5
    yens -= (noofc5 * c5)
    
if yens >= c2:
    noofc2 = yens // c2
    happiness += 5 * noofc2
    yens -= (noofc5 * c2)
print(happiness)

Submission status: Runtime Error

Solution code:
# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(input_str_list, int))
    return input_int_list

X = get_stdin_int_list()[0]
n_500 = int(X / 500)
X = X % 500
n_5 = int(X/5)

p = n_500*1000 + n_5*5
print(p)

Submission status: Runtime Error

Solution code:
# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(input_str_list, int))
    return input_int_list

X = get_stdin_int_list()[0]
n_500 = int(X / 500)
X = X % 500
n_5 = int(X/5)

p = n_500*1000 + n_5*5

Submission status: Runtime Error

Solution code:
import math
test = input()
five_hundred = math.floor(test / 500) * 1000
five_happy = math.floor((test - five_hundred*500)/5) * 5
print(five_hundred + five_happy)

Submission status: Runtime Error

Solution code:
import math
test = input()
five_hundred = math.floor(test / 500) * 1000
five_happy = math.floor((test - five_hundred*500)/5) * 5

Submission status: Runtime Error

Solution code:
X = int(input())

if X >= 0 and X <= 10 ** 9:
    while True:
        if X >= 500:
            C = X // 500
            X = X - (500 * C)
        elif X >= 5:
            D = X // 5
            X = X - (5 * D)
        else:
            break

total = (1000 * C) + (5 * D)

print(total)

Submission status: Runtime Error

Solution code:
X = int(input())

while True:
    if X >= 500:
        C = X // 500
        X = X - (500 * C)
    elif X >= 5:
        D = X // 5
        X = X - (5 * D)
    else:
        break

total = (500 * C) + (5 * D)

print(total)

Submission status: Runtime Error

Solution code:
X = int(input())

if X >= 0 and X <= 10 ** 9:
    while True:
        if X >= 500:
            C = X // 500
            X = X - (500 * C)
        elif X >= 5:
            D = X // 5
            X = X - (5 * D)
        else:
            break

total = (500 * C) + (5 * D)

print(total)

Submission status: Runtime Error

Solution code:
X = int(input())
if X >0:   
    num = X / 500
    w = X-(int(num)*500)
    p = w / 5   
    sum = (int(num)*1000)+(int(p)*5)
 else:
     sum = 0   
print(sum)

Submission status: Runtime Error

Solution code:
x = int(input())
 if x >0:   
    num = x / 500
    w = x-(int(num)*500)
    p = w / 5   
    sum = (int(num)*1000)+(int(p)*5)
 else:
     sum = 0   
print(sum)

Submission status: Runtime Error

Solution code:
x = int(input())
 if x >0:   
    num = x / 500
    w = x-(int(num)*500)
    p = w / 5   
    sum = (int(num)*1000)+(int(p)*5)
 else:
     sum = 0

Submission status: Runtime Error

Solution code:
money = input()
happy = money//500+(money-money//500)//5
print(happy)

Submission status: Runtime Error

Solution code:

KN = input("").split()
A = input("").split()

K = int(KN[0])
N = int(KN[1])
A_0 = int(A[0])
A_N = int(A[N-1])
L = A_0

for j in range(N):
    A_i = int(A[j+1])
    A_m = int(A[j])
    if A_i - A_m > L:
        L == A_i - A_m

if L > K - A_N + A_0:
    print(K-L)
else:
    print(K - A_N + A_0)

Submission status: Runtime Error

Solution code:
from sys import maxsize as infinity


def exchange(amount: int) -> int:
    dp = [0] * (amount + 1)

    for to_exchange in range(amount + 1):
        dp[to_exchange] = 0

        for (coin, gain) in [(500, 1000), (5, 5), (100, 0), (50, 0), (10, 0), (1, 0)]:
            if coin <= to_exchange:
                dp[to_exchange] = max(
                    dp[to_exchange],
                    gain + dp[to_exchange - coin]
                )

    return dp[amount]


amount = int(input())
print(exchange(amount))

Submission status: Runtime Error

Solution code:
x=int(input())
if x<5:
  	print("0")
elif x<500:
  	y=(x//5)*5
    print(y)

Submission status: Runtime Error

Solution code:
X = int(input())
 
h1 = X // 500
h2 = (X %% 500) // 5
 
print(h1 * 1000 + h2 * 5)

Submission status: Runtime Error

Solution code:
from sys import maxsize as infinity
import resource
import sys

resource.setrlimit(resource.RLIMIT_STACK, (2**29, -1))
sys.setrecursionlimit(10**6)

dp = {}
minus_infinity = - (infinity // 2)


def exchange(amount: int) -> int:
    if amount < 0:
        return minus_infinity
    if amount == 0:
        return 0
    if amount in dp:
        return dp[amount]

    dp[amount] = max([
        1000 + exchange(amount - 500),
        5 + exchange(amount - 5),
        exchange(amount - 100),
        exchange(amount - 50),
        exchange(amount - 10),
        exchange(amount - 1)
    ])

    return dp[amount]


amount = int(input())
print(exchange(amount))

Submission status: Runtime Error

Solution code:
a=int(input())
assert(a>0)
if a > 500:
    print((a//500)*1000+((a%500)//5)*5)
else:
    print(a//5*5)

Submission status: Runtime Error

Solution code:
num = int(input())
point = 0
while num >= 500:
    point+=1000
    num-=500
while num >=5:
    point+=5
    num-=5
print(re)

Submission status: Runtime Error

Solution code:
X = int(input())

if X >= 0 and X <= 10 ** 9:
    while True:
        if X > 500:
            C = X // 500
            P = 500 * C
            X = X - P
        elif X > 5:
            D = X // 5
            L = 5 * D
            X = X - L
        else:
            break

total = (1000 * C) + (5 * D)

print(total)

Submission status: Runtime Error

Solution code:
X = int(input())

if X >= 0 and X <= 10 ** 9:
    while True:
        if X > 500:
            C = X // 500
            P = 500 * C
            X = X - P
            continue
        if X > 5:
            D = X // 5
            L = 5 * D
            X = X - L
            continue
        break

total = (1000 * C) + (5 * D)

print(total)

Submission status: Runtime Error

Solution code:
inp = input()
inp = int(float(inp))
aaa = 0
bbb = 0
yyy = 0

if 0 <= inp and inp <= 10**9:
  if 500 <= inp:
    big = inp // 500
    aaa = big * 1000
    amari = inp % 500
    if 5 <= amari:
      smo = amari //5
      bbb = smo *5
    print(aaa+bbb)
  else if 5 <= inp:
    hhh = inp // 5
    yyy = hhh * 5
    print(yyy)
else:
  print(0)

Submission status: Runtime Error

Solution code:
def main():
    x = int(input())
    
    x // 500 = a
    x %= 500

    x // 5 = b
    
    ans = 1000 * a + 5 * b
    print(ans)

main()

Submission status: Runtime Error

Solution code:
c=input()
p1=c%500
t=c//500
t=t*1000+((p1//5)*5)
print(t)

Submission status: Runtime Error

Solution code:
big_ple=X//500*1000
remain=X%500
small_ple=remain//5*5
Sum=big_ple+small_ple

if X<5:
    print(0)
elif X<500:
    print(small_ple)
else:
     print(Sum)

Submission status: Runtime Error

Solution code:
X = int(input())
num500=//500
num5=(X%500)//5
print (1000*num500+5*num5)

Submission status: Runtime Error

Solution code:
X = input()
num500=X//500
num5=(X%500)//5
print (1000*num500+5*num5)

Submission status: Runtime Error

Solution code:
X = int(input())

a = 0
b = 0
c = 0
d = 0
e = 0
f = 0

for q in range(100):
    for w in range(100):
        for e in range(100):
            for r in range(100):
                for t in range(100):
                    for y in range(100):
                        num = (500 * q) + (100 * w) + (50 * e) + (10 * r) + (5 * t) + (1 * y)
                        if X % num == 0:
                            m = q
                            i = t
                            break


print(500 * m + 5 * i)

Submission status: Runtime Error

Solution code:
X = input()
nfh = X // 500
nf = (X - 500 * nfh) // 5
happy = 1000 * nfh + 5 * nf
print(happy)

Submission status: Runtime Error

Solution code:
    coin = int(input())
    fivet_yen = 0
    five_yen = 0
    if coin == 0:
        print(0)
    else:
    while(coin > 0):
        if coin >= 500:
            coin = coin - 500
            fivet_yen = fivet_yen + 1000
        else:
            if coin >= 5:
                coin = coin - 5
                five_yen   = five_yen + 5
            else:    
                coin = coin - 1


    print(fivet_yen + five_yen)

Submission status: Runtime Error

Solution code:
X = input()
num_500=X//500
num_5=(X%500)//5
print (1000*num_500+5*num_5)

Submission status: Runtime Error

Solution code:
sum=0
d=X/500
sum=sum+(d*1000)
y=X-(d*500)
z=y/5
sum=sum+(z*5)
print(sum)

Submission status: Runtime Error

Solution code:
fun main()
{
    var has = readLine()!!.toInt()
    var happiness = 0
    if (has > 500)
    {
        var _500 = has / 500
        happiness = _500 * 1000
        has = has - _500 * 500
    }
    if (has > 5)
    {
        var _5 = has / 5
        happiness += _5 * 5
    }
    print(happiness)
}

Submission status: Runtime Error

Solution code:
X = input()
n500 = X // 500
n5 = (X - 500 * n500) // 5
happy = 1000 * n500 + 5 * n5
print(happy)

Submission status: Runtime Error

Solution code:
Y = input()
X = int(Y)
if(X >= 500):
  a = X // 500
  b = X % 500
  if(b >= 5):
    c = (b//5)*5
  e = (a*1000) + c
  print(e)

Submission status: Runtime Error

Solution code:
X = int(input())import math
X = int(input())
A = X/500
A=math.floor(A)
Q=1000*A
D=A*500
Y=X-D
B = Y/5
B = math.floor(B)
B= 5*B
print(Q+B)

Submission status: Runtime Error

Solution code:
X = map(int, input())

num_500 = X // 500
num_5 = (X - (X // 500)*500 ) % 5

print(1000*num_500 + 5 * num_5)

Submission status: Runtime Error

Solution code:
# Your code here!
I =int(input())


if I>=500:
    J=I//500
    
    K=J*500*2#
    
    
    P=I-500*J
    
    if P>=5:
        Q=P//5
        R=Q*5#
        
        A=K+R
print(A)

Submission status: Runtime Error

Solution code:
inp = int(input())
aaa =0
bbb =0
nega = 0

if 0 <= inp and inp <= 10**9:
  if 500 <= inp:
    big = int(inp / 500)
    
    sma = inp-(big *500)
    if 5 <= sma:
      nega = int(sma / 5)
      
  aaa = 1000*big
  bbb = 5*nega
  print(aaa + bbb)

Submission status: Runtime Error

Solution code:
x=input()
a=x // 500
y=x-500a
b= y // 5
print(a*1000+b*5)

Submission status: Runtime Error

Solution code:
x=int(input())
a=x // 500
y=x-500a
b= y // 5
happy = a*1000+b*5
print(happy)

Submission status: Runtime Error

Solution code:
X=input()
y=int(X)
while y<1000:
  y-=1000
  z+=1
result=z*2+y*1
str_result=str(result)
print('str_result')

Submission status: Runtime Error

Solution code:
big_ple=X/500*1000
remain=X%500
small_ple=remain/5*5
Sum=big_ple+small_ple

if X<5:
    print(0)
elif X<500:
    print(small_ple)
else:
     print(Sum)

Submission status: Runtime Error

Solution code:
x=int(input())
a=x//500
y=x-500a
b=y//50
print(a*1000+b*5)

Submission status: Runtime Error

Solution code:
X=int(input())
A=math.floor(X/500)
B=math.floor((X-A*500)/5)
print(A*1000+B*5)

Submission status: Runtime Error

Solution code:
N = int(input())
if N >= 500:
    t = N//500
    a = N%500
    if a >= 5:
        f = a//5
        print(1000*t+f*5)
    else:
        print(1000*t)
elif N >= 5:
    f = a//5
    print(1000*t+f*5)
else:
    print("0")

Submission status: Runtime Error

Solution code:
X=int(input())

s=0
t=0

if X>=500:
    a=X//500
    s=1000*a

if  (X-500*(X//500))>=5:
    b=(X - 500 * a)//5
    t=5*b

print(s+t)

Submission status: Runtime Error

Solution code:
N=int(input())
Happoint=(N//500)*1000 + ((n%500)//5)*5
print(int(Happoint))

Submission status: Runtime Error

Solution code:
money = int(input())
fh = n // 500
money -= 500 * fh
goen = money // 5

point = 1000 * fh + 5 * goen
print(point)

Submission status: Runtime Error

Solution code:
n = int(input)
print(int(n//500*1000+(n%500)//5*5))

Submission status: Runtime Error

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

def b(x,u):
    if x>=5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>=500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)

Submission status: Runtime Error

Solution code:
# 1行、1変数を受け取るとき
s = int(input())

print(int(s / 500) * 1000) + (int(s % 10 / 5) * 5)

Submission status: Runtime Error

Solution code:
X = int(input())

h1 = X // 500
h2 = (X %% 500) // 5

print(h1 * 1000 + h2 * 5)

Submission status: Runtime Error

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

def b(x,u):
    if x>5:
        x-=5
        u+=5
        b(x,u)
    else:
        print(u)

def a(x,u):
    if x>500:
        x-=500
        u+=1000
        a(x,u)
    else:
        b(x,u)

a(x,u)

Submission status: Runtime Error

Solution code:
x=int(input())
a=(x-x%500)/500
y=x-500a
b=(y-y%50)/50
print(a*1000+b*5)

Submission status: Runtime Error

Solution code:
x = input()
big = x // 500
small = x % 500 // 5
grace = big + small
print(grace)

Submission status: Runtime Error

Solution code:
n=int(input())
print(n//500 * 1000 + x//5 * 5)

Submission status: Runtime Error

Solution code:
X = map(int, input())

happy = ((X // 500) * 1000 ) + ((X % 5) * 5)
print(happy)

Submission status: Runtime Error

Solution code:
s=list(input())
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
X = int(input())
sen = X // 500
amari = X % 500
go = amari // 5
ans = sen * 1000 + gp * 5

Submission status: Runtime Error

Solution code:
import sys
X = sys.stdin.readline()
score = X//500 * 1000
X %= 500
score += X//5 * 5
print(score)

Submission status: Runtime Error

Solution code:
a = x // 500
b = (x % 500)//5

s = a * 1000 + b * 5

print(s)

Submission status: Runtime Error

Solution code:
X = int(input())
a = X // 500
X -= a * 500
b = X // 5
print(a,b)
print(a*1000+5*

Submission status: Runtime Error

Solution code:
X = int(input())
if X >= 500:
  q = X // 500 
  mod = X % 500 
  f = mod // 5
  print(q*1000+f*5)
else:
  f = X // 5
  print(f*5

Submission status: Runtime Error

Solution code:
x = input()
temp = (x // 500) * 1000
x %= 500
ans = temp + (x // 5) * 5
print(ans)

Submission status: Runtime Error

Solution code:
import sys,bisect
from math import gcd
input = sys.stdin.readline

############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n = inp()
remain = n - (n//500)*500

print((n//500)*1000 + 5*(remain//5))
#print()

Submission status: Runtime Error

Solution code:
X = int(input())
ans = 0
ans += X//500 * 1000
x = x % 500
ans += X // 500 * 5

print(ans)

Submission status: Runtime Error

Solution code:

def main(inputs):
	x=int(inputs[0][0])
	n=x//500
	x-=n*500
	n1=x//5
	print(n*1000+n1*5)


if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)

Submission status: Runtime Error

Solution code:
x=int(input())
a=int(x/500)
b=int((x-500a)/5)
print(a*1000+b*5)

Submission status: Runtime Error

Solution code:
X = int(input())
pleasure += (X // 500) * 1000
X //= 500
pleasure += (X // 5) * 5
print(pleasure)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll x;
    cin>>x;
    ll a,b;
    a=x/500;
    x-=a;
    b=x/5;
    cout<<1000*a+5*b<<endl;
}