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:
X = int(input())

a = 0
b = 0
t = 0

if X >= 500:
    a = X//500
    t = X%500
    if t != 0:
        b = t//5

else:
    b = X//5

print(1000*a+5*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
ans = a*1000 + b*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = int(input())

a = S // int(500)

b = S - a * 500

c = b // 5

print(a*1000 + c*5)

Submission status: Accepted

Solution code:
X=int(input())

now=X
ans=0
ans+=1000*(now//500)


now=now%500

ans+=5*(now//5)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

y = x%500
z = x - y
hap = 0

while z >= 500:
  z -= 500
  hap += 1000
  
while y >= 5:
  y -= 5
  hap += 5
  
print(hap)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy
import re

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
X = int(input())

def calc(number, coin):
  n = number // coin
  amari = number % coin
  return n, amari


n500, amari = calc(X, 500)
n5, amari = calc(amari, 5)

print('{}'.format(n500 * 1000 + n5 * 5))

Submission status: Accepted

Solution code:

X = int(input())

coin_500 = X // 500
mod = X % 500

coin_5 = mod // 5

print(1000 * coin_500 + 5 * coin_5)

Submission status: Accepted

Solution code:
X = input()

x = int(X)

gosen = x // 500

goen = (x - 500* gosen) // 5

happy = gosen * 1000 + goen * 5

print(happy)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
b = (x - a*500) // 5
happy = a*1000 + b*5

print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# sys.stdin = open('input.txt')

x = int(input())
x1 = x // 500
x %= 500
x2 = x // 5

ans = 1000 * x1 + 5 * x2
print(ans)

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:
import math
x = int(input())
###500 yen
a = math.floor(x/500)
a_1000 = a*1000
###5 yen
amari = x % 500
b = math.floor(amari/5)
b_5 = b*5
###
print(a_1000 + b_5)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:

x = input()
x = int(x)

happy = 0

if 500 <= x :
    sho_a = (x // 500)
    happy = sho_a * 1000
    x = x - (sho_a * 500)
    sho_b = x // 5
    happy = happy + sho_b * 5
else : 
    sho_b = x // 5
    happy = sho_b * 5

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

X = (a/500)*1000
Y = b*1000 + d*5
Z = (a//5)*5

if a == 0:
    print(0)
elif a < 5:
    print(0)
elif A == 0:
    print(int(X))
elif b>0 and d > 0:
    print(int(Y))
elif b>0 and d < 0:
    print(int(b*1000))
elif b == 0 and d > 0:
    print(int(Z))
elif b == 0 and d < 0:
    print(0)

Submission status: Accepted

Solution code:
def coins(c):
    if c>= 500:
        c1 = c//500
        c2 = (c-500*c1)//5
        #print(c1,c2)
        s = c1*1000 + c2*5
        print(s)
    else:
        c2 = c//5
        print(c2*5)

def io():
    c = int(input())
    coins(c)

if __name__=='__main__':
    io()

Submission status: Accepted

Solution code:
num = int(input())

five_hundred_coin = (num // 500)
rest = (num % 500)
five_coin = (rest // 5)

presure = (five_hundred_coin * 1000) + (five_coin * 5)

print(presure)

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
X = I()
_500 = X//500
_nokori = (X%500)//5
print(_500*1000+_nokori*5)

Submission status: Accepted

Solution code:
x = int(input())

a = [500, 5, 100, 50, 1]
b = [0, 0, 0, 0, 0]

for i in range(5):
    b[i] = x // a[i]
    x = x % a[i]

print(b[0] * 1000 + b[1]*5)

Submission status: Accepted

Solution code:
X = int(input())

happiness = 0
if X >= 500:
    happiness += (X//500)*1000
    X = X%500
happiness += (X//5)*5

print(happiness)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

n500 = X // 500

X = X % 500

n5 = X // 5

print(n500 * 1000 + n5 * 5)

Submission status: Accepted

Solution code:
N=int(input())
big=N/500
ans=1000*int(big)
small=500*(big-int(big))
while True:
	if small>5:
		ans+=5
		small-=5
	else:
		break
print(ans)

Submission status: Accepted

Solution code:
sum = int(input())
golds = [500, 5]

happy = 0
for gold in golds:
    if gold == 500:
        happy += 1000 * (sum // gold)
    if gold == 5:
        happy += 5 * (sum // gold)
    sum = sum % gold

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
remain = X
if X // 500 != 0:
    a = remain // 500
    remain = X - 500*a
else:
    a = 0
if remain // 5 !=0:
    b = remain // 5
    remain == b + remain % 5
else:
    b = 0
result = 1000*a + 5*b 
print(str(result))

Submission status: Accepted

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

print((a * 1000) + (b * 5))

Submission status: Accepted

Solution code:
n = int(input())

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

print(1000*a+5*b)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
big=int(x/500)#number of 500 coins
x=x-big*500
hap=big*1000
med=int(x/5)#number of 5 coins
hap+=med*5
print(hap)

Submission status: Accepted

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

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

print(num_500 * 1000 + num_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

if X >= 500:
    a, b = divmod(X, 500)
    if b >= 5:
        c, d = divmod(b, 5)
    else:
        c = 0
else:
    a = 0
    c, d = divmod(X, 5)

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	money = int(input())
	num_gohyaku = money // 500
	nokori = money%500
	num_five  = nokori // 5
	shiawase = num_gohyaku * 1000 + num_five * 5
	print(shiawase)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
X = input()
intx = int(X)

gohyakuX = int(intx / 500)
nokori = intx - (gohyakuX * 500)
nokoriX = int(nokori / 5)
#1024
result = gohyakuX * 1000 + nokoriX * 5
print(result)

Submission status: Accepted

Solution code:
i = int(input())

a500, mod500 = divmod(i, 500)
a5, mod5 = divmod(mod500, 5)
print (a500 * 1000 + a5 * 5)

Submission status: Accepted

Solution code:
N = int(input())

#
ans = 0
flag = True
flag2 = True

while flag:

    if N < 500:
        flag = False
    else:
        ans += 1000
        N-= 500

while flag2:

    if N < 5:
        flag2 = False
    else:
        ans+=5
        N -= 5

print(ans)

Submission status: Accepted

Solution code:
import math


num = int(input())


c_500 = math.floor(num / 500)
num2 = num - c_500 * 500

c_5 = math.floor(num2/5)



print(c_500 * 1000 +c_5 * 5)

Submission status: Accepted

Solution code:
x = int(input())
list = [500, 5,100, 50, 10, 1]
ans_list = [0, 0, 0, 0, 0]
for i in range(5):
    ans_list[i] = int(x / list[i])
    x -= (list[i] * ans_list[i])
ans = ans_list[0] * 1000 + ans_list[1] * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

#print(a)
#print(b)
print(a*1000+b*5)

Submission status: Accepted

Solution code:
import math
a = int(input())
#print(a)
b = math.floor(a / 500)
#print(b)
c = math.floor(a % 500)
#print(c)
d = math.floor(c / 5)
#print(d)
e = b * 1000 + d * 5
print(e)

Submission status: Accepted

Solution code:
x = int(input())

ureshisa = 0

ureshisa += x//500*1000

amari = x%500

ureshisa += amari//5*5

print(ureshisa)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
ans = 0
while(1):
  if(X >= 500):
    ans += 1000
    X -= 500
  elif(X >= 5):
    ans += 5
    X -= 5
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

coi = [500, 5]
ans = 0
for i in coi:
    y = x//i
    x -= i * y
    if i == 500:
        ans += 1000 * y 
    elif i == 5:
        ans += 5 * y
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
happy = 0
while x >= 500 :
    happy += 1000 * int(x/500)
    x = x%500


while x >= 5 :
    happy += 5 * int(x/5)
    x = x%5


print(happy)

Submission status: Accepted

Solution code:
# 1行目の入力を数値として扱う
X = int(input())

# 答えの準備
ans = (X // 500) * 1000
m = X % 500      
ans += (m // 5) * 5

# 出力
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

q_500, mod = divmod(X, 500)

q_5, mod_2 = divmod(mod, 5)

print(q_500*1000+q_5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
have = int(input())
first = have//500
remain = have - 500*first
second = remain//5
happy = first*1000+second*5
print(happy)

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())
A = 0
while True:
    if X >= 500:
        X -= 500
        A += 1000
    elif X > 0:
        X -= 5
        A += 5
    if X < 5:
        print(A)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ina = input()
ina=int(ina)
gohyaku, mod1 = divmod(ina, 500)
go,mod5=divmod(mod1,5)
print(gohyaku*1000+go*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

y=x % 500

max=0
max=1000*(x//500)+5*(y//5)
print(max)

Submission status: Accepted

Solution code:
m=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

s = a * 1000 + b * 5

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())


happy = 0
a = money // 500
money -= 500*a
happy += a*1000
b = money // 5
happy += b*5

print(happy)

Submission status: Accepted

Solution code:
X = int(input())
answer = [0]
A = 0
while 4 < X:
  if X >= 500:
    answer.append(1000)
    X -= 500
  elif 499 >= X >= 5:
    answer.append(5)
    X -= 5
for i in answer:
  A += i
print(A)

Submission status: Accepted

Solution code:
x = int(input())

b,s = x // 500,(x % 500)//5
print(b*1000 + s*5)

Submission status: Accepted

Solution code:
x = int(input())

x500 = x // 500

x -= x500*500

x5 = x // 5

ans = x500*1000+x5*5

print(ans)

Submission status: Accepted

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

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())
x1 = (x%500)
a = (x1//5)*5
a2 = (x//500)*1000


print(a+a2)

Submission status: Accepted

Solution code:
import math
a = int(input())
print(math.floor(a/500)*1000 + math.floor((a%500)/5)*5)

Submission status: Accepted

Solution code:
import math

def solution():
    x = int(input())
    xx = math.floor(x / 500)
    if xx == 0:
        point = math.floor(x / 5) * 5
    else:
        point = xx * 1000
        xx = x - 500 * xx
        point = point + math.floor(xx / 5) * 5
    print(point)

solution()

Submission status: Accepted

Solution code:
X = int(input())

total = int(X / 500) * 1000
amari = int(X % 500)
total += int(amari / 5) *5
print(total)

Submission status: Accepted

Solution code:
s = input()
q = int(s) //500
mod = int(s) % 500

mod2 = int(mod) // 5

N = 1000 * int(q) + 5 * int(mod2)

print(N)

Submission status: Accepted

Solution code:
x = int(input())
x_500 = x//500
x_5 = (x - (x_500*500))//5
print(x_500*1000+x_5*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())
res = 0

good1000 = x // 500
x500 = x % 500

good5 = x500 // 5

res = 1000 * good1000 + 5 * good5
print(res)

Submission status: Accepted

Solution code:
import sys, re
import math
 
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

x = INT()
if x == 0:
    print(0)
else:
    a = math.floor(x / 500)
    b = math.floor((x - (a * 500)) / 5)
    print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
import sys


def input() -> str:
    return sys.stdin.readline().rstrip("\r\n")


def main():
    # s = input()
    # if len(s) != 6:
    #     print('No')
    # elif s[-2] == s[-1] and s[2] == s[3]:
    #     print('Yes')
    x = int(input())
    print(x//500*1000 + (x%500)//5*5)

if __name__ == "__main__":

    main()

Submission status: Accepted

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

q = X // 500
happiness += 1000 * q
X -= q * 500

q = X // 5
happiness += 5 * q

print(happiness)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
n = int(input())
#print(n)
sum = 0

while True:
  if n >= 500:
    sum += 1000
    n -= 500
  else:
    break
while True:
  if n >= 5:
    sum += 5
    n -= 5
  else:
    break
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

print(a+b)

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())
num_500 = int(X / 500)
nokori = X - (500 * num_500)
num_5 = int(nokori / 5)

print(num_500 * 1000 + num_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

X = ni()

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

print(a * 1000 + b * 5 )

Submission status: Accepted

Solution code:
x = int(input())
coins = [500, 5]
happy = [0] * 2
for coin in coins:
    if coin == 500:
        happy[0] = x // coin
    elif coin == 5:
        happy[1] = x // coin
    x = x % coin

print(1000 * happy[0] + 5 * happy[1])

Submission status: Accepted

Solution code:
S = int(input())
FFNum = int(S/500)
perse500Num = S%500
FNum = int(perse500Num/5)
print(int(FFNum*1000+FNum*5))

Submission status: Accepted

Solution code:
Num = int(input())

ans = 0

val = int(Num / 500)
ans += val * 1000
val = int((int(Num % 500)) / 5)
ans += val * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
h = 0

while True:
    if s < 5:
        break
    if s - 500 >= 0:
        s = s-500
        h += 1000
    elif s - 5 >= 0:
        s = s-5
        h += 5

print(h)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
x -= a * 500

b = x // 5

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
x = int(input())

if x == 0:
    print(0)
else:
    q1 = x // 500
    mod = x % 500

    mod2 = mod // 5

    print(1000 * q1 + 5 * mod2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
answer=0
answer+=int(X/500)*1000

x=X%500
answer+=int(x/5)*5

print(answer)

Submission status: Accepted

Solution code:
# he doesn't get anything for coins under 5 yen.
# for amounts over 5 yen, he should use the 500-yen
# coin as much as possible, then use the 5-yen coin.

x = int(input())
num500, leftover_from500 = divmod(x, 500)
num5, _ = divmod(leftover_from500, 5)
happiness = 1000*num500 + 5*num5
print(happiness)

Submission status: Accepted

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


def solve(X: int):

    k = (X //500)*1000

    p = (X%500)//5*5
    print(k+p)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

X = int(input())
happy_1000 = X//500
X = math.floor(X%500)
happy_5 = X//5
res = happy_1000*1000 + happy_5*5
print(res)

Submission status: Accepted

Solution code:
x = int(input())

coins = [500, 5]

g = 0
for c in coins:
  n = x//c
  if c==500:
    g+=n*1000
  if c==5:
    g+=n*5
  x -= n*c
  
print(g)

Submission status: Accepted

Solution code:
x = int(input())
# a,b = map(int, input().split())
# l = list(map(int, input().split()))

ans = 0
r5 = int(x/500)
x= x- 500*r5
r1 = int(x/5)
print(r5*1000 + r1*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    x = int(input())
    temp = (x // 500) * 1000
    x %= 500
    ans = temp + (x // 5) * 5
    print(ans)


    return

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

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

print((b*1000) + (c*5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

if __name__ == "__main__":
    x = int(input())

    n_500 = int(x / 500)
    n_5 = int((x - n_500*500)/ 5 )
    print(n_500*1000 + n_5*5)

Submission status: Accepted

Solution code:
#code
from math import *
x = int(input())

res = int(x/500)
res *=1000
m = x%500
p = int(m/5)
p*=5
res += p
print(res)

Submission status: Accepted

Solution code:
from sys import stdin
x = int(stdin.readline().rstrip())

ans = 0
th = x//500
nokori = x-500*th
five = nokori//5
print(1000*th + 5*five)

Submission status: Accepted

Solution code:
x = int(input())

hpy = []

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


print((a*1000) + (b*5))

Submission status: Accepted

Solution code:
x = int(input())

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

print(a+b)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

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

X = I()

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

Submission status: Accepted

Solution code:
def no_of_500(X):
  return X/500

def rem(X):
  return X%500

def no_of_5(X):
  return rem(X)/5

def happiness_points(X):
  return (no_of_500(X)*1000)+(no_of_5(X)*5)

X=input()
print(happiness_points(X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a = X//500
answer = a * 1000
b = X - a*500

c = b//5

answer_2 = c * 5
aa = answer + answer_2

print(aa)

Submission status: Accepted

Solution code:
x = int(input())
f = x//500
g = x%500
h = g//5
j = h*5
k = f*1000 + j
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
#x
x=int(input())

ans = math.floor(x / 500) * 1000
x = x % 500
ans += math.floor(x / 5) * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

happiness500 = int(X / 500)
happiness5 = int((X%500/5))

print(happiness500*1000+happiness5*5)

Submission status: Accepted

Solution code:
s = int(input())

n500 = s // 500
ds = s - n500 * 500
n5 = ds // 5

print(n500 * 1000 + n5 * 5)

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
n1=a//500
s1=a%500
n2=s1//5
#print(n1)
print(n1*1000+n2*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

remainder = x % 500

fhj = int((x - remainder) / 500 * 1000)
fj = int(int(remainder / 5) * 5)
print(fhj + fj)

Submission status: Accepted

Solution code:
X = int(input())

'''
500: 1000
5: 5
'''

ans = 0
if X >= 500:
    x500 = X // 500
    ans += x500 * 1000
    X -= 500 * x500
    #print('x500: {}'.format(x500))

if X >= 5:
    x5 = X // 5
    ans += x5 * 5
    X -= 5 * x5
    #print('x5: {}'.format(x5))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(1000*a+5*b)

Submission status: Accepted

Solution code:
import math

def func2(x):
    a500 = math.floor(x/500)
    a5 = math.floor(x%500 / 5)
    p = 1000*a500 + 5*a5
    return p

if __name__ == "__main__":
    a = int(input())
    print(func2(a))

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
q,mod = divmod(x,500)
ans += q * 1000
q,mod = divmod(mod,5)
ans += q * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def solve():
    X = int(input())
    res = 1000*(X//500) + 5*((X%500)//5)
    return str(res)

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

Submission status: Accepted

Solution code:
value = int(input())

ureshi = (value//500)*1000
ureshi += ((value-(value//500)*500)//5)*5

print( ureshi )

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())

a = n // 500
b = n % 500

c = b //5

ans = a*1000 + c*5

print(ans)

Submission status: Accepted

Solution code:
m = input()


d={500:0,5:0}
# if m > 500
fm = m/500
m -= fm*500
ffm = m/5



print 1000*fm+5*ffm

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
a = X%500
b = a%5
print(2*X-a-b,end = '')

Submission status: Accepted

Solution code:
X=int(input())

a=X//500
b=X%500
e=b//5

print(1000*a + 5*e)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
s = x//500
t = x%500
u = t//5

print(1000*s+5*u)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 20:52:57 2020

@author: over-
"""

X=int(input())

ans=X//500*1000
ans+=((X%500)//5)*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#create date: 2020-03-28 21:01

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    x = ni()
    l = x % 100
    print(1000*(x//500) + 5*((x % 500)//5))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
b = X % 500
c = b // 5

print(1000*a + 5*c)

Submission status: Accepted

Solution code:
n = int(input())

happy = 0
if n // 500 >= 1:
    ha500 = n // 500
    happy = 1000 * ha500
    nokon = n % 500
    if nokon // 5 >= 1:
        ha005 = nokon // 5
        happy = happy + 5 * ha005
else:
    if n // 5 >= 1:
        ha005 = n // 5
        happy = 5 * ha005
print(happy)