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: Wrong Answer

Solution code:
# coding:utf-8
coin = int(input())
reward = (coin // 500) *1000
reward += int(((coin - (reward / 2)) // 5) * 10)
print(reward)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

x = int(stdin.readline().rstrip())

counter = 0
for i in range(2000000):
    if x - 500 >= 0:
        x = x - 500
        counter += 1000
    else:
        break
for i in range(11):
    if x - 5 >= 0:
        x = x - 5
        counter += 5
    else:
        break

print(counter)

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
###500 yen
a = math.floor(x/500)
a_1000 = a*1000
print(a)
###5 yen
amari = x % 500
b = math.floor(amari/5)
b_5 = b*5
print(amari)
###
print(a_1000 + b_5)

Submission status: Wrong Answer

Solution code:
x = int(input())

a=0
b=0
aper=0
if x!=0:
    a=x//500
    aper=x%500

if aper != 0:
    b= b/5
    bper = b%5

result = (a * 1000) + (b*5)

print(int(result))

Submission status: Wrong Answer

Solution code:
a=int(input())
k=0
c=a//500
d=a%500
s=d//5
s1=a-d
print(s1*c+s*5)

Submission status: Wrong Answer

Solution code:
X = int(input())

q, mod = divmod(X, 500)
ans = 1000 * q
_, mod = divmod(mod, 100)
_, mod = divmod(mod, 50)
q, mod = divmod(mod, 5)
ans += 5 * q
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
money = int(input())

bigPoint = int(money/500) * 1000

smallMoney = money - int(money/100)*100

smallPoint = int(smallMoney/5) * 5

print(bigPoint+smallPoint)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

count_a = x // 500
x = x % 10
count_b = x // 5

print(count_a * 1000 + count_b*5)

Submission status: Wrong Answer

Solution code:
a=int(input())
h=0
val=a
if val>500:
  c=int(val//500)
  h=h+1000*c
  val-=c*500
if val>5:
  c=int(val//5)
  h+=5*c
  val-=c*5
print(h)

Submission status: Wrong Answer

Solution code:
import math


num = int(input("num: "))


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: Wrong Answer

Solution code:
X = int(input())

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

print(happiness)

Submission status: Wrong Answer

Solution code:

X=int(input())

changes=[500,100,50,10,5,1]

result=[]

tmp=X

for c in changes:
    if(tmp==0):
        result.append(0)
    else:
        result.append(int(tmp/c))
        tmp=tmp%c

total=0

for idx in range(len(result)):
    if(idx==0):
        total+=result[idx]*1000
    else:
        total+=result[idx]*changes[idx]

print(total)

Submission status: Wrong Answer

Solution code:
S = int(input())

a =  S % 500
b = (S - 500 * a) % 5

print(1000 * a + 5 * b)

Submission status: Wrong Answer

Solution code:
X =  1024

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = 0

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

print(happiness500*1000+happiness5*5)

Submission status: Wrong Answer

Solution code:
money_val = int(input())

if money_val < 5:
    print(0)
elif money_val < 500:
    print(money_val // 5)
else:
    fivehun_num = (money_val // 500)
    five_num = money_val - (500*fivehun_num)
    five_num = five_num // 5
    print((fivehun_num*1000) + (five_num*5))

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
ans = 0
if math.floor(x/500) >1 :
    ans += math.floor(x/500)*1000
    x -= math.floor(x/500)*500
if x > 0 and math.floor(x/5) >1 :
    ans +=  math.floor(x/5)*5
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
coin = int(input())
coin = coin * 2

if coin == 0:
    print(0)
else:
    print(coin)

Submission status: Wrong Answer

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()
a = math.floor(x / 500)
b = math.floor((x - (a * 500)) / 5)
print(a)
print(b)
print(a * 1000 + b * 5)

Submission status: Wrong Answer

Solution code:
X = int(input())

ans = 0
if X > 500:
  a = X // 500
  ans += (1000 * a)
  X -= (500 * a)
  
if X > 5:
  a = X // 5
  ans += (5 * a)
  
print(ans)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
X = int(input())
A = 0
while True:
    if X >= 500:
        X -= 500
        A += 1000
    else:
        X -= 5
        A += 5
    if X < 5:
        print(A)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
if X>=5:
	div500=X//500
	X=X-div500*500
	div5=X//5
	print(div500*1000+div5*5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
user_input = eval(input()) * 2
print(user_input if user_input <= 2020 else 2020)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin


def main():
    X = int(stdin.readline())

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
Y = int(input())

C500 = Y // 500
C5 = (Y - C500*500) // 5 if (Y - C500*500) // 5>0 else 0

print(C500, C5)
print(C500*1000+C5*5)

Submission status: Wrong Answer

Solution code:
X=int(input())

a=X//500
b=X%500
c=b%50
d=c%10
e=d%5

print(1000*a + 5*e)

Submission status: Wrong Answer

Solution code:
x = int(input())
m500 = x // 500
m5 = (x - (x // 500) * 500) % 5

ans = m500 * 1000 + m5 * 5
print(ans)

Submission status: Wrong Answer

Solution code:
X = int(input())

temp = (X //500)
sen = temp * 1000
nokori = X - (temp * 500)

go = (nokori % 5) * 5

print(sen + go)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(1000*a+5*b)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import math
x = int(input())
###500 yen
a = math.ceil(x/500)
a_1000 = a*1000
###5 yen
amari = x % 500
b_5 = amari*5
###
print(a_1000 + b_5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy
#import numpy as np

x=int(input())
cnt=0
while x-500>0:
    cnt += 1000*(x//500)
    x%=500
    #print(cnt,x)
while x-5>0:
    cnt+= 5*(x//5)
    x %= 5
print(cnt)

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = int(n/500)

amari = n%500

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x=int(input())
cnt = 0
q = x // 500
cnt += (q * 1000)
w = x % 500
e = w // 5
cnt += (e * 5)

Submission status: Wrong Answer

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

q, mod = divmod(10, 500)
pl += q * 1000

q, mod = divmod(10, 5)
pl += q * 5

print(pl)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

# 標準入力 <int>
X = int(input())

u500 = 0
u5 = 0

u500 = X // 500

x = X % 1000

u5 = x // 5

print((u500 * 1000) + (u5 * 5))

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
# map(int, input().split())
#
# input().split()

X = int(input())
ans = 0
while X > 5:
    if X > 500:
        a = X//500
        ans += a*1000
        X-=a*500
    else:
        a = X//5
        ans += a*5
        X-=a*5
print(ans)

Submission status: Wrong Answer

Solution code:
x = int(input())

a = [500, 100, 50, 5, 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[3]*5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())
d, v = divmod(X, 500)
print(d * 1000 + v * 5)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
X = int(input())

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

print(happiness)

Submission status: Wrong Answer

Solution code:
x = int(input())
Y = [500, 100, 50, 5, 1]
ans = 0
for i in Y:
    if i == 500:
       ans +=  (x // i)*1000
    elif i == 5:
        ans +=  (x // i)*5
    x -= (x//i)*i
    if x == 0:
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
from sys import stdin


def get_result(data):
    N = data[0]
    q, mod = divmod(N, 500)
    _, mod = divmod(mod, 5)
    return q * 1000 + mod * 5


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    result = get_result(data)
    print(result)

Submission status: Wrong Answer

Solution code:
x = int(input())

x = x//5

print(x//10*100+x%10*5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

x=int(input())

a=x//500
b=x%500

s=(1000*a)+(b)
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

a = n // 500
m = n % 500
b = m % 5

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

Submission status: Wrong Answer

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(_nokori)
print(_500*1000+_nokori*5)

Submission status: Wrong Answer

Solution code:
hap=0
yen=int(input())
hap=1000*(yen//500)+(yen%5)*5

Submission status: Wrong Answer

Solution code:
x = int(input())

count_a = x// 500
x = x%500
x = x% 100
x = x%50
x = x%10
count_b = x // 5

print(count_a*1000+count_b*5)

Submission status: Wrong Answer

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

ans = 0

while(x>0):
    if x- 500 >0:
        ans += 1000
        x -= 500
    elif x-5>0:
        ans +=5
        x-=5
    else:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import itertools
from collections import deque

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

# input
X = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

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

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
x = int(input())
c1 = 0
c2 = 0

c1 = x // 500
x %= 500
c2 = x % 5

print(c1 * 1000 + c2 * 5)

Submission status: Wrong Answer

Solution code:
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    X = I()
    a = 0
    if X > 500:
        a += (X//500)*1000
        X = X%500
    if X > 5:
        a += (X//5)*5
    print(a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = int(input())

print(int((x/500)*2) + int((x%500)/5))

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    a = N//500
    s = str(N)
    b = int(s[-3:]) // 5

    return a*1000 + b*5

print(solve())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
X=int(input())
cnt=0
n=X//1200
X-=n*1200
cnt+=n*1200*2
n=X//5
cnt+=n*5
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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()
    print(1000*(x//500) + 5*((x % 100)//5))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
F = 0
FF = 0
while(N>5):
  if(N>500):
    F = N/500
  else:
    FF = N/5
print((F*2)+(FF))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
h = 0
while(n > 4):
  if n >= 500:
    h += 1000
  elif n >= 5:
    h += 5
    
print(h)

Submission status: Time Limit Exceeded

Solution code:
S=int(input())
a=0
for i in range(S//500+1):
  for j in range(S//5+1):
    if i*500+j*5<=S:
      a=max(a,i*1000+j*5)
    else:
      continue
      
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
x=(n%500)

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

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():
    x = int(input())
    a = x // 500
    b = (x - 500 * a) // 5
    ans = int(a * 1000 + b * 5)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = x // 500 * 1000
x = x % 500
ans += x // 5 * 5

print(ans)

Submission status: Accepted

Solution code:

x=int(input())
k=0
s=0

if x//500>0:
    k=x//500
    s+=k*1000
    x=x-k*500
if x//5>0:
    k=x//5
    s+=k*5
    x=x-k*5
print(s)

Submission status: Accepted

Solution code:
cnt = int(input())

hp = 0
if cnt >= 500:
    hp += (1000 * (cnt // 500))
    cnt %= 500
hp += (5 * (cnt // 5))

print(hp)

Submission status: Accepted

Solution code:
X = int(input())
# 500円で1000, 5円で5
x500 = X // 500

print(1000 * x500 + (X - 500 * x500) // 5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

# X円を、500で割り、余りを更に5で割る

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

print(happiness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
l = divmod(x,500)
m = l[0]
n = l[1]//5
print(1000*m+5*n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a, mod = divmod(X, 500)
b = mod // 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:
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())
import sys
sys.setrecursionlimit(10**6)

n=int(input())
k=(n//500)*1000
t=((n%(500))//5)*5
print(k+t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

print(h1*1000+h2*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
x = x - a * 500
b = x // 5

print(1000*a+5*b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

thousand = X // 500
rest = X - thousand * 500
five = rest // 5

print(1000 * thousand + 5 * five)

Submission status: Accepted

Solution code:
x = int(input())
coins = [500, 5]

ans = 0

ans += (x // 500) * 1000
x = x % 500

ans += (x // 5) * 5

print(ans)

Submission status: Accepted

Solution code:
S =int(input())
joy_500 = (S // 500) * 1000
joy_5 = ((S-(joy_500 // 2)) // 5) * 5
print(joy_500+joy_5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
'''
問題：
    高橋君は金色の硬貨が好きです。
    自分が持っている 500円硬貨 1枚につき 1000、
    5円硬貨 1枚につき 5の嬉しさ を得ます。

    高橋君は X 円を持っています。
    これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか？

    (なお、利用できる硬貨は 500 円玉、100 円玉、50 円玉、10 円玉、5円玉、1 円玉の 6 種類とします。)
'''

'''
    Xは整数
    0 ≦ X ≦ 1,000,000,000
'''
class Yorokobi:
    def __init__(self, money, yorokobi):
        self.money = money
        self.yorokobi = yorokobi

    def calc_yorokobi(self, credit):    # credit （残金？）を入力として受け取り、喜びを計算して返す
        return (credit // self.money) * self.yorokobi

# 標準入力から X の値を取得する
input_x = int(input())

yorokobi_500 = Yorokobi(500, 1000)
yorokobi_5 = Yorokobi(5, 5)

result = 0  # 結果格納用
if input_x >= 500:
    result += yorokobi_500.calc_yorokobi(input_x)   # 高橋君 500円の喜び
    result += yorokobi_5.calc_yorokobi(input_x % 500)   # 高橋君 5円の喜び
else:
    result += yorokobi_5.calc_yorokobi(input_x)

print(result)

# ret1 = input_x // 500  # 500円で割った商
# ret2 = ret1 * 1000  # 高橋君 500円の喜び
# ret3 = input_x - (ret1 * 500)   # X円から500円の枚数分を引いたお金
# ret4 = ret3 // 5 # （X円から500円の枚数分を引いたお金）÷ 5
# ret5 = ret4 * 5 # 高橋君 5円の喜び
# print(ret2 + ret5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
ureshisa_500=(X//500)*1000
ureshisa_5=(X%500//5)*5

print(ureshisa_500+ureshisa_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:
# 160 B
X = int(input())
h1000 = int(X/500)
h5 = int((X%500)/5)
print(h1000 * 1000 + h5*5)

Submission status: Accepted

Solution code:
'''
問題：
    高橋君は金色の硬貨が好きです。
    自分が持っている 500円硬貨 1枚につき 1000、
    5円硬貨 1枚につき 5の嬉しさ を得ます。

    高橋君は X 円を持っています。
    これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか？

    (なお、利用できる硬貨は 500 円玉、100 円玉、50 円玉、10 円玉、5円玉、1 円玉の 6 種類とします。)
'''

'''
    Xは整数
    0 ≦ X ≦ 1,000,000,000
'''
class A:
    def __init__(self, money, yorokobi):
        self.money = money
        self.yorokobi = yorokobi

    def calc_yorokobi(self, credit):    # credit ：残金を入力として受け取り、喜びを計算して返す
        return int(credit / self.money) * self.yorokobi

    # def print_self(self):
        # print(calc_yorokobi(self, credit))
# 
# def calc_yorokobi(input_money, x, yorokobi):
#     ret = input_money // x * yorokobi
#     return ret

# 標準入力から X の値を取得する
input_x = int(input())

yorokobi_500 = A(500, 1000)
yorokobi_5 = A(5, 5)

result = 0  # 結果格納用
if input_x >= 500:
    # print("1回目：{}".format(result))
    result += yorokobi_500.calc_yorokobi(input_x)   # 高橋500円の喜び
    # print("2回目：{}".format(result))
    result += yorokobi_5.calc_yorokobi(input_x % 500)   # 高橋5円の喜び
    # print("3回目：{}".format(result))
else:
    result += yorokobi_5.calc_yorokobi(input_x)

print(result)

# ret1 = input_x // 500  # 500円で割った商
# ret2 = ret1 * 1000  # 高橋君 500円の喜び
# ret3 = input_x - (ret1 * 500)   # X円から500円の枚数分を引いたお金
# ret4 = ret3 // 5 # （X円から500円の枚数分を引いたお金）÷ 5
# ret5 = ret4 * 5 # 高橋君 5円の喜び
# print(ret2 + ret5)

Submission status: Accepted

Solution code:
input_X = int(input())

result_500 = input_X // 500
result_500ureshi = result_500 * 1000
result_5ureshi = (input_X - result_500 * 500) // 5 * 5

result = int(result_500ureshi + result_5ureshi)
print(result)

Submission status: Accepted

Solution code:
'''
問題：
    高橋君は金色の硬貨が好きです。
    自分が持っている 500円硬貨 1枚につき 1000、
    5円硬貨 1枚につき 5の嬉しさ を得ます。

    高橋君は X 円を持っています。
    これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか？

    (なお、利用できる硬貨は 500 円玉、100 円玉、50 円玉、10 円玉、5円玉、1 円玉の 6 種類とします。)
'''

'''
Xは整数
0 ≦ X ≦ 1,000,000,000
'''
# def calc

# 標準入力から X の値を取得する
input_x = int(input())

ret1 = input_x // 500  # 500円で割った商
ret2 = ret1 * 1000  # 高橋君 500円の喜び
ret3 = input_x - (ret1 * 500)   # X円から500円の枚数分を引いたお金
ret4 = ret3 // 5 # （X円から500円の枚数分を引いたお金）÷ 5
ret5 = ret4 * 5 # 高橋君 5円の喜び
print(ret2 + ret5)

Submission status: Accepted

Solution code:
X = int(input())

syou = int(X/500)
syou_second = int((X - syou*500)/5)
ans = syou*1000 + syou_second*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
m = divmod(x, 500)

print(m[0] * 1000 + m[1] // 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())

def answer(x: int) -> int:
    ans = 1000 * (x // 500)
    x %= 500
    ans += 5 * ((x - 500 * (x // 500)) // 5)
    return ans

print(answer(x))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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