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

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x = int(input())
    a = x//500
    b = (x%500)//5
    print(1000*a+5*b)
    return

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

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())

a = X // 500
aa = X - 500 * a
b = aa // 5

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

h=a//500

a=a-500*h

f=a//5

ans=h*1000+f*5

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

ans = 0

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

print(ans)

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
b = (X % 500) // 5
print(1000 * a + 5 * b)

Submission status: Accepted

Solution code:
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

n_500 = x // 500
n_5 = (x%500)//5

grad = n_500 * 1000 + n_5 * 5

print("{}".format(grad))

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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())

x500 = x // 500
x5 = (x - x500 * 500) // 5

print(x500 * 1000 + x5 * 5)

Submission status: Accepted

Solution code:
s = int(input())

result = int(s/500) * 1000 + int((s%500)/5)*5

print(int(result))

Submission status: Accepted

Solution code:
a=input()
a=int(a)
result=0
while a>=500:
  a=a-500
  result=result+1000

while a>=5:
  a=a-5
  result=result+5
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
num_500 = x // 500

x -= num_500 * 500
num_5 = x // 5

print(num_500 * 1000 + num_5 *5)

Submission status: Accepted

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

q, mod = divmod(x, 500)
mmod = math.floor(mod/5)
ans = 1000*q + 5*mmod
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    x = int(stdin.readline())
    a = x // 500
    b = (x - a * 500) // 5
    print(a * 1000 + b * 5)


if __name__ == "__main__":
    main()

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())
A=X//500
B=(X%500)//5
print(A*1000+B*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

k1 = 500
k2 = 5

k1a = int(x/k1)
xx = x%k1
k2a = int(xx/k2)

ans = 1000*k1a + 5*k2a
print(str(ans))

Submission status: Accepted

Solution code:
x = int(input())

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

print(1000*a+5*b)

Submission status: Accepted

Solution code:
q_500, mod_500 = divmod(int(input()), 500)
q_5, mod_5 = divmod(mod_500, 5)
print(1000 * q_500 + 5 * q_5)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x=int(input())
    a,b=divmod(x,500)
    print(a*1000+(b//5)*5)
resolve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May  6 16:26:02 2020

@author: shinba
"""
X = int(input())

a = X//500

X -= a*500

b = X//5

happiness = a*1000 + b*5

print(happiness)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - Golden Coins

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

fi_hun = X // 500
fi_mod = X % 500

fi = fi_mod // 5

print(fi_hun * 1000 + fi * 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:
X=int(input())
A=X//500
B=(X-A*500)//5
print(1000*A+5*B)

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())

happiness = 0
while x >= 5:
    if x >= 500:
        x -= 500
        happiness += 1000
    else:
        x -= 5
        happiness += 5

print(happiness)

Submission status: Accepted

Solution code:
import math

yen = int(input())
happiness = 0

if yen / 500 > 0:
    fivehandred_number = math.floor(yen / 500)
    happiness = happiness + (1000 * fivehandred_number)
    yen = yen - (500 * fivehandred_number)

if yen / 5 > 0:
    five_number = math.floor(yen / 5)
    happiness = happiness + (5 * five_number)

print(happiness)

Submission status: Accepted

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

print((math.floor(X/500))*1000+(math.floor((X%500)/5)*5))

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

Submission status: Accepted

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

while(x-500>=0):
    x-=500
    happy+=1000
while(x-5>=0):
    x-=5
    happy+=5
print(happy)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
money = int(input())

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

print(coin1 * 1000 + coin2 * 5)

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

Submission status: Accepted

Solution code:
x = int(input())

n500, a500 = divmod(x, 500)
n005, a005 = divmod(a500, 5)

print(n500*1000 + n005*5)

Submission status: Accepted

Solution code:
def function(args):
    X = int(args)
    ureshisa = 0
    div, mod = divmod(X,500)
    ureshisa += div*1000
    div, mod = divmod(mod,5)
    ureshisa += div*5
    
    return str(ureshisa)

if __name__ == '__main__':
    print(function(input()))

Submission status: Accepted

Solution code:
X = int(input())

div500, mod500 = divmod(X, 500)
div5 = mod500 // 5

print(div500 * 1000 + div5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
X = int(input())
hand = X//500
one = (X - hand*500)//5

ans = hand*1000 + one *5

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
print((N//500)*1000+((N%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:
def main():
    X = int(input())
    ans = (X//500)*1000
    X %= 500
    ans += (X//5)*5
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

ans = x // 500 * 1000
x -= x // 500 * 500

ans += x // 5 * 5
x -= x // 5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
X = int(input())

ans = X // 500 * 1000

X %= 500

ans += X // 5 * 5

print (ans)

Submission status: Accepted

Solution code:
X = int(input())
ans_1 = 0
ans_2 = 0
#pattern 1
A = X//500
X -= 500*A
ans_1 += A*1000
ans_1 += X//5*5
#pattern 2
ans_2 = X//5*5
print(max(ans_1,ans_2))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

q, r = divmod(X, 500)
ans = q * 1000 + (r // 5) * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
if num >= 500:
    count = num/500
    num -= int(count)*500
    ans = int(count)*1000
if num >= 5:
    count2 = num/5
    ans += int(count2)*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
happpy500 = int( x / 500) * 1000
cnt500 = int( x / 500 )
happy5 =  int( ( x - ( 500 * cnt500 ) ) / 5 ) * 5

print(happpy500 + happy5)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()
    t = x // 5

    return t // 100 * 1000 + t % 100 * 5


print(main())

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

x = I()

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

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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    x = II()

    t = x // 500
    x = x % 500

    t2 = x // 5
    # print(t, t2)
    print(1000*t + 5 * t2)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
money = int( input() )

hapiness = (money//500)*1000 + ((money%500)//5)*5
print(hapiness)

Submission status: Accepted

Solution code:
def main():
  X = int(input())
  ans = 0
  while True:
    if 0 <= X - 500:
      X = X - 500
      ans += 1000
    elif 0 <= X - 5:
      X = X - 5
      ans += 5
    else:
      break
  print(ans)

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
n=int(input())

a=n//500
b=(n-500*a)//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:
x = int(input())

res = x // 500
res_ = x % 500

res2 = res_ // 5
print(res * 1000 + res2 * 5)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
x = int(readline())

ans = 0

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

ans += x//5*5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

y = x // 500
r = x % 500
z = r // 5

print(1000*y + 5*z)

Submission status: Accepted

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


def solve(X: int):
    happiness = 0
    gohyaku_maisuu, modulo = divmod(X, 500)
    happiness += gohyaku_maisuu * 1000
    happiness += (modulo // 5) * 5
    return happiness


def main():
    X = int(sys.stdin.readline().strip())  # type: int
    print(solve(X))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

m = n // 500

n -= m*500

l = n // 5

print(m*1000 + l*5)

Submission status: Accepted

Solution code:
x=int(input())
ans=0
kin1=x//500
change=x%500
kin2=change//5
print(kin1*1000+kin2*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())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

X = int(input())

num_500 = math.floor(X/500)
res = X - 500*num_500
num_5 = int(res/5)

happy = num_500*1000 + num_5*5
print(happy)

Submission status: Accepted

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

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:
n=int(input())
gg=0
gg+=(n//500)*1000
n=n-(n//500)*500
gg+=(n//5)*5
print(gg)

Submission status: Accepted

Solution code:
x = int( input() )

SOO = x // 500
S = ( x % 500 ) // 5

print( 1000 * SOO + 5 * S )

Submission status: Accepted

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

while x >= 500:
    ans += 1000
    x -= 500
    
while x >= 5:
    ans += 5
    x -= 5

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

k = n//500
l = (n-500*k)//5

print(k*1000+ l*5  )

Submission status: Accepted

Solution code:
n=int(input())

k = 0
l = 0
while n>=500:
  n = n-500
  k = k+1

  
while n>5:
  n -= 5 #n=n-5
  l += 1
  

print(k*1000+ l*5  )

Submission status: Accepted

Solution code:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

X = I()
num500 = X//500
num5 = (X%500)//5
print(num500*1000+num5*5)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
amari = x % 500
b = amari // 5

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
# B - Golden Coins
# https://atcoder.jp/contests/abc160/tasks/abc160_b

# 所持金
X = int(input())

# 嬉しさ(= 残金計算時にも使用)
happy = 0

# 500円玉,5円玉の最大両替枚数
max_five_hundred = X//500
max_five = (X-(max_five_hundred*500))//5

# 各硬化の枚数をもとに嬉しさを算出
print((max_five_hundred*1000)+(max_five*5))

Submission status: Accepted

Solution code:
def main():
	k = int(input())
	ans = 0
	nokori = 0

	ans += (k // 500)* 1000
	nokori = k % 500
	ans += (nokori // 5)*5
	print(ans)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
x=int(input())

coin_1=0
coin_5=0
coin_500=0

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

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

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

Submission status: Accepted

Solution code:
X = int(input())

if X >= 500:
  a = X // 500
  happy = a*1000
  X -= a*500
  b = X // 5
  happy += b*5
else:
  b = X // 5
  happy = b*5
  
print(happy)

Submission status: Accepted

Solution code:
X = int(input())
coin_500 = X//500
X = X - coin_500*500
coin_5 = X//5

print(1000*coin_500 + 5*coin_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 = x // 500 #500円玉の枚数
B = (x - A*500) // 5 #5円玉の枚数

print(A*1000 + B*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
k=divmod(X,500)[0]
l=divmod(divmod(X,500)[1],5)[0]
print(k*1000+l*5)

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

X = int(input())
#N, K = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]
ans=0
ans+=(X//500)*1000
X%=500
ans+=(X//5)*5
print(ans)

Submission status: Accepted

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

fh = int(x/500)
f = int((x-fh*500)/5)
print(fh*1000+f*5)

Submission status: Accepted

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

print(HP)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

X = int(input())
ans = 0

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

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())

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

print(ans)

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())
a = X//500
b = (X%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:
X = int(input())

shou_500 = int(X/500)
shou_5 = int((X-500*shou_500) / 5)

print(shou_500 * 1000 + shou_5 * 5)

Submission status: Accepted

Solution code:
import sys

x = int(input())

dai = x//500
syou = (x-500*dai)//5

#print(dai,syou)

ans = 1000*dai+5*syou
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

ans = 1000 * (x // 500)
x -= 500 * (x // 500)

ans += 5 * (x // 5)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

a = 0
b = 0
ans = 0

if N >= 500:
    a = (N // 500) * 1000
    b = ((N % 500) // 5) * 5
    ans = a + b
else:
    ans = (N // 5) * 5

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

n500,r500=divmod(X,500)
n50=r500//5
print(n500*1000+n50*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

num_500 = int(x / 500)

amari = x - 500 * num_500

num_5 = int(amari / 5)

print(1000 * num_500 + 5 * num_5)

Submission status: Accepted

Solution code:


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    X = read_int()
    return (X//500)*1000+((X%500)//5)*5


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

sen = X//500
X = X - sen * 500
go = X//5

print(sen*1000+5*go)

Submission status: Accepted

Solution code:
x=int(input())



a=x//500
d=x%500
b=d//5

print(a*1000+b*5)

Submission status: Accepted

Solution code:
sum = int(input())

f_hund  =  int(sum / 500)

f = int((sum - f_hund*500) / 5)

print(f_hund*1000 + f*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500
b = X % 500
c = b // 5
grad = 0

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

Submission status: Accepted

Solution code:
X = int(input())
a = X//500
e = (X%500)//5

print(1000*a+5*e)

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

t = (x // 500)
x -= t * 500
f = (x // 5)

print(t*1000+f*5)

Submission status: Accepted

Solution code:
D = int(input())

a1 = D // 500
a2 = (D - a1*500) // 5

print(a1*1000 + a2*5)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

count500 = X // 500
Xremain = X - (500 * count500)
count5 = Xremain // 5

happy = (1000 * count500) + (5 * count5)
print(happy)

Submission status: Accepted

Solution code:
import math 
X = int(input())
M = math.floor(X/500)
L = X - M * 500
N = math.floor(L/5)
V = M * 1000 + N * 5
print(V)

Submission status: Accepted

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


def main():
    X = int(input())
    happy1 = (X - X % 500)*2
    happy2 = (X % 500-(X % 500 % 5))
    print(happy1+happy2)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = int(input())

a = S//500
b = (S-500*a)//5
print(a*1000 + b*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

x = int(stdin.readline().rstrip())
t = x // 500
f = (x % 500) // 5

print(1000 * t + 5 * f)