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: Accepted

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
import math

def main():
    N = int(input())
    result = math.floor(N / 500) * 1000
    result += math.floor((N % 500)/5)*5
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X=int(input())

def gold_calc(X):
    g_500=0
    g_5=0

    while X>=500:
        X-=500
        g_500+=1000

    while X>=5:
        X-=5
        g_5+=5
    
    return g_500+g_5

print(gold_calc(X))

Submission status: Accepted

Solution code:
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(1024), 2020)

    def test_2(self):
        self.assertEqual(think(0), 0)

    def test_3(self):
        self.assertEqual(think(1000000000), 2000000000)


def solve():
    x = read()
    result = think(x)
    write(result)


def read():
    return read_int(1)[0]


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(data):
    result = 1000 * (data // 500)
    data %= 500
    result += 5 * (data // 5)
    return result


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input(""))
hapiness = (money//500)*1000 + ((money%500)//5)*5

print(hapiness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
coin_values = [[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: Accepted

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

Submission status: Accepted

Solution code:
X = int(raw_input())

coin500 = X/500
coin5 = (X-coin500*500)/5

print coin500*1000+coin5*5

Submission status: Accepted

Solution code:
X = int(input())

coin500 = X // 500

coin5 = (X - coin500 * 500) // 5

print(coin500 * 1000 + coin5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
while(n - 500 >= 0):
    n -= 500
    ans += 1000
while(n - 5 >= 0):
    n -= 5
    ans += 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

ureshisa1 = X // 500
ureshisa2 = (X - 500*ureshisa1) // 5

print(ureshisa1 * 1000 + ureshisa2 * 5)

Submission status: Accepted

Solution code:
n = int( input() )

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
b = (X-(a*500)) // 5

print(1000 * a + 5 * b)

Submission status: Accepted

Solution code:
X = int(input());
happy = 0;
x=0;
y=0;
z=0;

x = X // 500;
y = X % 500;
z = y // 5;
happy = x * 1000 + z * 5;
    
print(happy);

Submission status: Accepted

Solution code:
n = int(input())
count = 0
if n>=500 :
	a = int(n / 500)
	count += a * 1000
	n = n % 500

if n>=5 :
	a = int(n / 5)
	count += a * 5
	n = n % 5

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

num = X // 500
num2 = (X - num * 500) // 5

print(1000 * num + 5 * num2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

coin500 = X // 500
surplus = X % 500

coin5 = surplus // 5

print(coin500 * 1000 + coin5 * 5)

Submission status: Accepted

Solution code:
n = int(input())
m = n // 500
l = n - 500 * m
j = l // 5
ans = m * 1000 + j * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = X//500 * 1000
X -= X//500 * 500
ans += X//5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans += int(n/5)*5

print(int(ans))

Submission status: Accepted

Solution code:
import math

x = int(input())

s = math.floor(x / 500)
t = x%500
u = math.floor(t/5)

print(s*1000+u*5)

Submission status: Accepted

Solution code:
yen = int(input())

yen500 = int(yen / 500)
yen = int(yen - yen500 * 500)

yen5 = int(yen / 5)

print(int(yen500 * 1000 + yen5 * 5))

Submission status: Accepted

Solution code:
X = int(input())
d_500 = X // 500
Y = X % 500
d_5 = Y // 5
total = d_500 * 1000 + d_5 * 5
print(total)

Submission status: Accepted

Solution code:
n = int(input())
count500 = 0
count5 = 0
praise = 0
while (n >= 500):
    n -= 500
    count500 += 1
while (n >= 5):
    n -= 5
    count5 += 1
print(count500 * 1000 + count5 * 5)

Submission status: Accepted

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

print(happiness)

Submission status: Accepted

Solution code:
n = int(input())

div_500, mod_500 = divmod(n,500)
if mod_500 > 0:
    div_5, mod = divmod(mod_500, 5)
    print(div_500*1000 + div_5*5)
else:
    print(div_500*1000)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
while x-500 >= 0:
    x -= 500
    ans += 1000
while x -5>= 0:
    x -= 5
    ans += 5
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

i = n % 500
happy = ((n//500)*1000 + (i//5)*5)

print(happy)

Submission status: Accepted

Solution code:
x=int(input())

five_hundred=int(x/500)

five=int((x-five_hundred*500)/5)

print(five_hundred*1000+five*5)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
ans += (n // 500) * 1000
n %= 500
ans += (n // 5) * 5

print(ans)

Submission status: Accepted

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(int, input_str_list))
    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: Accepted

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    big_happy = x // 500
    amari = x % 500
    small_happy = amari // 5

    print(big_happy * 1000 + small_happy * 5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
b = (x % 500) // 5

print(a * 1000 + b * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

X = I()

ans = 0

ans += X // 500 * 1000
X %= 500

ans += X //5 * 5
X %= 5

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]

X = I()

a = X // 500
c = (X - 500*a) // 5


print(a*1000 + c*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
tmp = x // 500
ans += tmp * 1000
x -= tmp * 500

tmp = x // 5
ans += tmp * 5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

c500 = x // 500
x %= 500
c005 = x // 5

print(c500 * 1000 + c005 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

happy1 = x // 500 * 1000
amari = x % 500
happy2 = amari // 5 * 5

print(happy1 + happy2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
X = int(input())
fun1000 = X // 500
X = X % 500
fun5 = X // 5
print(fun1000 * 1000 + fun5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

coin_type = [500,  5, 1]
exchange = []
for i in coin_type:
    count, X = divmod(X, i)
    exchange.append(count)


herty_point = exchange[0] * 1000 + exchange[1] * 5
print(herty_point)

Submission status: Accepted

Solution code:
X = int(input())

ure = 0
ure += (X // 500) * 1000
X  %= 500
ure += (X // 5) * 5

print(ure)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
total = int(input())

x_500 = int(total/500)
x_5   = int((total-x_500*500)/5) 

print(x_500*1000 + x_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

happy = 0
coin_500 = X // 500
remain_X = X % 500
coin_5 = remain_X // 5
happy = coin_500*1000 + coin_5*5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

n_500 = x//500
n_5 = (x-n_500*500)//5

print(n_500*1000 + n_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter,mul
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left,bisect_right
#from copy import deepcopy
#import heapq
#import math
#import string
#from time import time
#from functools import lru_cache,reduce
#from math import factorial,hypot
#import sys
#from fractions import gcd
setrecursionlimit(10**6+1)
input=stdin.readline

x=int(input().rstrip())
ans=0
ans+=(x//500)*1000
x%=500
print(ans+(x//5)*5)

Submission status: Accepted

Solution code:
X = int(input())

a, m = divmod(X, 500)
a5, m5 = divmod(m, 5)

ans = a * 1000 + a5 * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
happiness = 0
money -= money % 5
happiness += (money // 500) * 1000
happiness += (money % 500)
print(int(happiness))

Submission status: Accepted

Solution code:
X = int(input())

C = 0
D = 0

if X >= 500:
    C = X // 500
    X = X - (500 * C)
if X >= 5:
    D = X // 5

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

print(total)

Submission status: Accepted

Solution code:
#B golden coins
import math

x = int(input())
print(math.floor(x/500)*1000+math.floor((x-math.floor(x/500)*500)/5)*5)

Submission status: Accepted

Solution code:
X = int(input())

C = 0
D = 0

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: Accepted

Solution code:
X = int(input())
q, r = divmod(X, 500)
print(q * 1000 + r // 5 * 5)

Submission status: Accepted

Solution code:
x = int(input())
y = 0
z = 0
y = x // 500 
z = (x - 500*y) //5
ans = 1000 * y + 5 *z
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

C = 0
P = 0
D = 0
L = 0

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: Accepted

Solution code:
X = int(input())

C = 0
P = 0
D = 0
L = 0
total = 0

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
man = 1000 * C
t   = 5 * D

total = man + t

print(total)

Submission status: Accepted

Solution code:
x=int(input())

ans1=x//500
ans2=(x%500)//5

print(ans1*1000+ans2*5)

Submission status: Accepted

Solution code:
money = int(input())
# 500yen = 1000happy, 5yen = 5happy
 
n_500 = int(money//500)
n_5 = int((money - 500*n_500)//5)

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

Submission status: Accepted

Solution code:
S=int(input())
a_500=S//500

S_temp=S-500*a_500

a_5=S_temp//5

ans=a_500*1000+a_5*5
print(ans)

Submission status: Accepted

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X=I()
    ans=(X//500)*1000
    ans+=((X%500)//5)*5
    print(ans)

main()

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())

res = n//500
ans = 0
ans += res*1000

n -= 500*res

res = n//5

ans += res*5

print(ans)

Submission status: Accepted

Solution code:
X=int(input())
h=0
q,mod=divmod(X,500)
h=q*1000+mod//5*5
print(h)

Submission status: Accepted

Solution code:
X = int(input())

count500 = int(X/500)
remain = X%500
count5 = int(remain/5)

print(1000 * count500 + 5 * count5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

k = int(x/500)
t = int((x-500*k)/5)

print(1000*k+5*t)

Submission status: Accepted

Solution code:
import sys
n = int(input())
f=0
ff=0
if n<5:
    print(0)
    sys.exit(0)

f=int(n/500)
n%=500
ff=int(n/5)

print(f*1000+ff*5)

Submission status: Accepted

Solution code:
import sys
def resolve():
    X = int(input())
    uresisa1000 = X // 500
    uresisa5 = (X - uresisa1000 * 500) // 5
    print(1000 * uresisa1000 + 5 * uresisa5)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
X = int(input())

fi_hun = X // 500
five = (X - (500*fi_hun)) // 5

print(fi_hun*1000+five*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = int(input())
happy = 0
if s >= 500:
    happy += 1000 * (s // 500)
    s = s % 500
if s >= 5:
    happy += 5 * (s // 5)

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem B - Golden Coins

X = int(input())

gohyaku = X // 500
nokori = X % 500
goen = nokori // 5

# output
print(gohyaku * 1000 + goen * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
c=0
gohyaku=x//500
c+=gohyaku*1000
go=(x-gohyaku*500)//5
c+=go*5
print(c)

Submission status: Accepted

Solution code:
def happy(sum):
    num_of_500 = int(sum/500)
    num_of_5 = int((sum-num_of_500*500)/5)
    return num_of_500*1000 + num_of_5*5

x = int(input())
print(int(happy(x)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
a = 0
b = 0
c = 0
d = 0
if X >= 500:
	a = X%500
	b = X-X%500
	if a >=5:
		c = a%5
		d = a-a%5
else:
	if X >= 5:
		c = X%5
		d = X-X%5
print(2*b+d)

Submission status: Accepted

Solution code:
z = input()

uire = (int(z)//500) * 1000 + ((int(z)%500)//5) * 5

print(uire)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
a=X//500
b=X-(a*500)
c=b//5

print(a*1000+c*5)

Submission status: Accepted

Solution code:
n=int(input())

x=n//500

y=(n-x*500)//5

print(x*1000+y*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
coin=[[500,1000],[5,5]]
ans=0
for c,h in coin:
  num = x // c
  ans += num*h
  x %= c
print(ans)

Submission status: Accepted

Solution code:
X=int(input())

n=X//500
m=(X-500*n)//5

ans=1000*n+5*m
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input());t=500;print(X//t*2*t+X%t//5*5)

Submission status: Accepted

Solution code:
X = int(input())

a,b = divmod(X,500)
c = b // 5

print(a*1000 + c*5)

Submission status: Accepted

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

Submission status: Accepted

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

while x >= 500:
    x -= 500
    happiness += 1000

while x >= 5:
    x -= 5
    happiness += 5

print(happiness)

Submission status: Accepted

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

q,r=divmod(n,500)
res+=q*1000
q,r=divmod(r,5)
res+=q*5
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
print(2*x-x%500-x%5)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
b = 0
s = 0
while x >= 500:
    x -= 500
    b += 1
while x >= 5:
    x -= 5
    s += 1
a = b * 1000 + s * 5
print(str(a))

Submission status: Accepted

Solution code:
x=int(input())
cnt=0
v1=x//500
x=x-v1*500
v2=x//5
cnt=v1*1000+v2*5
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

f = int(x / 500) * 1000

s = int((x % 500) / 5) * 5

print(f + s)

Submission status: Accepted

Solution code:
# B - Golden Coins
def main():
    X = int(input())
    five_hundreds, remaining = divmod(X, 500)
    happiness = five_hundreds * 1000 + (remaining // 5) * 5
    print(happiness)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
if x>=500:

    ans+=(x//500)*1000
    x=x-(x//500)*500
if x>=5:
    ans += (x // 5) * 5
    x = x - (x // 5) * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n= int(input())
a = n//500
b = n%500
c = b//5

ans = (a*1000) + (c*5)
print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
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():
    x = I()
    goh = x // 500 * 1000
    x -= goh//1000 * 500
    go = x // 5 * 5
    print(goh+go)
    return


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    a=int(input())
    b=a//500
    a-=b*500
    print(b*1000+(a//5)*5)
main()

Submission status: Accepted

Solution code:
x = int(input())
y = 0
z = 0
while x >= 500:
    y += 1
    x -= 500
while x >= 5:
    z += 1
    x -= 5
print(y*1000 + z*5)

Submission status: Accepted

Solution code:
x = int(input())
if x < 500:
    print(x//5*5)
else:
    div_500 = x // 500
    nokori = x - div_500 * 500
    div_5 = nokori // 5
    print(div_500 * 1000 + div_5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

a = 1000 * (x // 500) + 5 * ((x % 500) // 5)

print(a)

Submission status: Accepted

Solution code:
n = int(input())
y = 0
if(n==0):
  print(y)
elif(n%500==0):
  y = int(n/500)*1000
  print(y)
else:
  j = n%500
  y = int(n//500)*1000 + int(j//5)*5
  print(y)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
a=0
c=0
d=0
b=[500,100,50,10,5,1]
a=n//b[0]
c=n%b[0]
d=c//b[4]

ans=a*1000+d*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
h = 0
if x < 500:
    h += x // 5 * 5
else:
    h += x // 500 * 1000
    h += (x % 500) // 5 * 5
print(h)

Submission status: Accepted

Solution code:
x = int(input())

ans_1 = x // 500 * 1000
x = x % 500
ans_2 = x // 5 * 5
print(ans_1+ans_2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
x = int(input())
a = x // 500
b = (x - a * 500) // 5
ans = a * 1000 + b * 5
print("{}".format(ans))

Submission status: Accepted

Solution code:
#Golden Coins
yen = int(input())
a = yen // 500
b = (yen % 500) // 5
print(1000*a + 5*b)

Submission status: Accepted

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: Accepted

Solution code:
X = int(input())
n500 = int(X/500)
n5 = int( (X-n500*500)/5 )

print(1000*n500+5*n5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

Solution code:
X = int(input())

coin1 = int(X / 500)
coin2 = int((X % 500) / 5)

print(coin1*1000 + coin2*5)

Submission status: Accepted

Solution code:
x=int(input())

ans=(x//500)*1000
x-=(x//500)*500
ans+=(x//5)*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input()) # 入力
x500 = X // 500
x5 = (X%500) // 5
print((1000*x500) + (5*x5))

Submission status: Accepted

Solution code:
money = int(input())
happy1 = money//500
happy2 = (money-happy1*500)//5
print(happy1*1000+happy2*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input());print(2*x-x%500-x%5)