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())
i = 0
while x >= 500:
    x = x - 500
    i = i + 1000
while x >= 5:
    x = x - 5
    i = i + 5
print(int(i))

Submission status: Accepted

Solution code:
# coding: utf-8

x = int(input())
ans = x // 500
x = x - ans * 500
ans = ans * 1000
ans += (x // 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())
yen_500 = 0
yen_5 = 0
amari = 0
happy = 0

if x>= 500:
    yen_500 = x//500
    amari = x - 500 * yen_500
    yen_5 = amari//5
    happy = 1000 * yen_500 + 5 * yen_5
    print(happy)
else:
    yen_5 = x//5
    happy = 5 * yen_5
    print(happy)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    X = int(input())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

#500円で
happiness += x//500*1000
x %= 500
#5円で
happiness += x//5*5
x %= 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())
ans = 0
ans+=1000*(x//500)
x%=500
ans+=5*(x//5)
print(ans)

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:
def main():
    x = int(input())
    c = 0

    c += 1000 * (x//500)
    x -= 500 * (x//500)

    c += 5 * (x//5)
    print(c)
    return
main()

Submission status: Accepted

Solution code:
X = int(input())

h = (X // 500) * 1000

X = X % 500

h += (X // 5) * 5

print(h)

Submission status: Accepted

Solution code:
X = int(input())
x500 = X//500
amari = X - x500 * 500
x5 = amari // 5

print(x500*1000+x5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

x500 = x // 500
y = x - x500*500
y5 = y // 5
z = y - y5*5

print(x500*1000+y5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
a=x
i=0
j=0
if 500<= x:
  while i*500<x:
    i+=1
  i-=1
  x-=500*i
if 5<=x:
  while j*5<x:
    j+=1
  j-=1
if i==0 and j==0:
  print(0)
elif a%500==0:
  print(a//500 * 1000)
else:
  print(1000*i+5*j)

Submission status: Accepted

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

happiness = 0
if x // 500 > 0:
  n = x // 500
  happiness += 1000 * n
  x %= 500
if x // 5 > 0:
  n = x // 5
  happiness += 5 * n
print(happiness)

Submission status: Accepted

Solution code:
X=int(input())
k=0
l=0
while X>=500:
    X-=500
    k+=1
while X>=5:
    X-=5
    l+=1
print(1000*k+5*l)

Submission status: Accepted

Solution code:
x = int(input())

big = x // 500

small = (x - (big*500)) // 5

print(big*1000 + small*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def change(X, coin):
    """ exchange
    :param X: total money
    :param coin: 500 or 5
    :return: reduced X and num of coins
    """
    num = X // coin
    X -= coin * num
    return X, num

if __name__ == '__main__':
    X = int(input())
    ans = 0
    X, num = change(X, 500)
    ans += 1000 * num
    X, num = change(X, 5)
    ans += 5 * num
    print(ans)

Submission status: Accepted

Solution code:

# ABC160
# B Golden Coins
x = int(input())
y = int(x / 500)
z = int((x - (500 * y)) / 5)
a = (y * 1000) + (z * 5)
print(a)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for a in range(2*10**6):
    if x >= 500:
        x = x-500
        ans = ans + 1000
    else:
        break
for b in range(100):
    if x >= 5:
        x = x-5
        ans = ans + 5
    else:
        break
print(ans)

Submission status: Accepted

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

main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
print(1000*(x//500)+5*((x%500)//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())
Y = X//500
Z = X%500
ZZ = Z//5
print(Y*1000+ZZ*5)

Submission status: Accepted

Solution code:
score = int(input())
dama500 = score // 500
dama5 = (score % 500)//5
answer = 1000*dama500+5*dama5
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:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

yen_500 = x//500
yen_5 = (x-(yen_500*500))//5

print((yen_500*1000)+(yen_5*5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

r = 0
divider = ((500,1000), (5, 5))
for i in divider:
    x, remain = divmod(x, i[0])
    r += x * i[1]
    x = remain

print(r)

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

Submission status: Accepted

Solution code:
x = int(input())

count_500 , mod = divmod(x, 500)
count_5 = mod // 5
print(count_500 * 1000 + count_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans=0

if X < 500:
    print((X // 5) * 5)
else:
    ans += (X // 500)*1000
    X -= (X//500)*500
    ans += (X//5)*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:
N = int(input())
d = N // 500
mod = N % 500
d2 = mod // 5
print(d*1000+d2*5)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

num1000 = X // 500
r500 = X % 500
num5 = r500 // 5

print(num1000 * 1000 + num5 * 5)

Submission status: Accepted

Solution code:
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())
print( (X//500)*1000 + ((X%500)//5)*5 )

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

x = inp()

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

print(a*1000 + b*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(1000*a+5*b)

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:
"""
500 -> 1000
5 -> 5
"""
ans = 0
n = int(input())
if n >= 500:
    goh = n // 500
    zan = n % 500
    ans += goh*1000
    n = zan
if n < 500 and n != 0:
    g = n // 5
    ans += g*5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

happy = 0
happy += X // 500 * 1000
X = X % 500
happy += X //5 * 5

print(happy)

Submission status: Accepted

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

a = int(x / 500)
ans = ans + a * 1000

x = x % 500
b = int(x / 5)
ans = ans + b * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a1 = 1000
a2 = 5

n1 = X // 500
X -= n1 * 500
n2 = X // 5

print(n1 * a1 + n2 * a2)

Submission status: Accepted

Solution code:
import sys
x = int(sys.stdin.read())
c500, x = divmod(x, 500)
c5 = x // 5
print(c500 * 1000 + c5 * 5)

Submission status: Accepted

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

print(a*1000 + b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

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

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())
a = x//500
b = (x%500)//5

print(1000*a + 5*b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

m_500 = x // 500
m_5 = (x - m_500*500) // 5

print(m_500*1000 + m_5*5)

Submission status: Accepted

Solution code:
x = int(input())

fivehandred = x // 500
x -= x // 500 * 500
five = x // 5

print(fivehandred*1000+five*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())
num_500 = X // 500
amari = X % 500
num_5 = amari // 5
print(1000 * num_500 + 5 * num_5)

Submission status: Accepted

Solution code:
# abc160_b.py
# https://atcoder.jp/contests/abc160/tasks/abc160_b

# B - Golden Coins /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 高橋君は金色の硬貨が好きです。自分が持っている 500円硬貨 1 枚につき 1000、5 円硬貨 1 枚につき 5の 嬉しさ を得ます。
# 高橋君は X円を持っています。これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか？
# (なお、利用できる硬貨は 500円玉、100 円玉、50 円玉、10 円玉、5 円玉、1 円玉の 6種類とします。)

# 制約
#     0≤X≤109
#     Xは整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# X

# 出力
# 嬉しさの最大値を出力せよ。

# 入力例 1
# 1024

# 出力例 1
# 2020

# 500円硬貨 2 枚、5 円硬貨 4 枚を含むように両替することで 2020の嬉しさを得ます。これが嬉しさの最大です。

# 入力例 2
# 0

# 出力例 2
# 0

# 高橋君は一文無しです。

# 入力例 3
# 1000000000

# 出力例 3
# 2000000000

# 高橋君は大富豪です。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    X = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    q1, mod1 = divmod(X, 500)
    q2, mod2 = divmod(mod1, 5)

    result = q1*1000 + q2*5

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['1024']
        lines_export = [2020]
    if pattern == 2:
        lines_input = ['0']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['1000000000']
        lines_export = [2000000000]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

x = int(input())

ans = 0

ans += x // 500 * 1000

ans += x % 500 // 5 * 5

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


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


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    print(f'{solve(X)}')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
 
if n!=0:
	ans1=n//500
	sub=n-(ans1*500)
	ans2=sub//5
 
	print((ans1*1000)+(ans2*5))
 
else:
	print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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

if not ( 0 <= X <= 10**9 and isinstance(X,int)): sys.exit

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*= coding: utf-8 -*-
X = int(input())

score = 0

quotient_500 = X // 500
score += quotient_500 * 1000

remainder_500 = X % 500

quotient_5 = remainder_500 // 5
score += quotient_5 * 5

print(score)

Submission status: Accepted

Solution code:
# B Golden Coins

X = int(input())

high, mod = divmod(X, 500)
low, mod = divmod(mod, 5)

ans = high * 1000 + low * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

total = 0
happiness_500 = X // 500 *1000 
total += happiness_500
y = X % 500
happiness_5 = y //5 *5
total += happiness_5
print(total)

Submission status: Accepted

Solution code:
x = int(input())

gohyaku = int(x / 500)
x = x% 500

go = int(x/5)

print(1000*gohyaku+5*go)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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

Submission status: Accepted

Solution code:
X = int(input())

ureshi = 0

# 500 yen
ureshi += (X // 500) * 1000
X = X % 500

# 5 yen
ureshi += (X // 5) * 5

print(ureshi)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
a500 = N //500
N = N - 500 *a500
a5 = N//5
res = 1000*a500 +5*a5
print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(sum([i//500*1000+i%500//5*5 for i in [int(input())]]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def happiness_from_golden_coins():
    # 入力
    X = int(input())
    # 初期化
    count_500yen = 0
    count_5yen = 0
    # 両替処理
    # 500円の個数
    while True:
        if X >= 500:
            count_500yen += 1
            X -= 500
        else:
            break
    # 5円の個数
    while True:
        if X >= 5:
            count_5yen += 1
            X -= 5
        else:
            break
    # 嬉しさ集計
    happiness = (1000 * count_500yen) + (5 * count_5yen)
    return happiness

result = happiness_from_golden_coins()
print(result)

Submission status: Accepted

Solution code:
import math
import collections
import itertools
import heapq
import sys

def main():
    X = int(input())

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

    print(res)


if __name__ == "__main__":
    main()

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:
a = int(input())
a -= a%5
print(2*a - a%500)

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

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

print(ans)

Submission status: Accepted

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


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    big = N // 500
    N -= big*500
    small = N // 5
    print(big*1000 + small * 5)


main()

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

u_1000=x//500*1000
u_5=x%500//5*5

print(u_1000+u_5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

cnt_500 = x // 500
cnt_5 = (x % 500) // 5

print(cnt_500 * 1000 + cnt_5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

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

print(n_500*1000 + n_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC160 B
x = int(input())
a,moda = divmod(x,500)
b,modb = divmod(moda,5)
print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
q,mod=divmod(X,500)
p=mod//5
print(q*1000+p*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())
(a,b)=divmod(x,500)
print(a*1000+b//5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    x = int(input())
    a, b = divmod(x, 500)
    c = b // 5
    print(1000 * a + 5 * c)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
yen500 = n // 500
yen5 = (n-500*yen500) // 5
pts = 1000*yen500 + 5*yen5
print(pts)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    n, X = divmod(X, 500)
    m = X // 5

    ans = 1000 * n + 5 * m

    print(ans)

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

t, r = x // 500, x % 500
u = r // 5

print(t * 1000 + u * 5)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

x = int(input())

ans = 0
cnt = x // 500
ans = cnt * 1000

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
x,res=X//500, X%500
y=res//5

print(x*1000+y*5)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())
happy = 0
while X // 5 > 0:
  if X // 500 > 0:
    happy += 1000
    X -= 500
  else:
    happy += 5
    X -= 5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

if X ==0:
  print(0)
else:
  N = X // 500
  M = X - (500 * N)
  R = M // 5
  print((N * 1000) + (R * 5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

a = x // 500

res = x - a * 500

b = res // 5

print(a * 1000 + b * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

thousand = X // 500
five = (X % 500) // 5

ans = thousand * 1000 + five * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
print(1000*(X//500)+5*((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())
q, r = divmod(x, 500)
print(5 * (r // 5) + 1000 * q)

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())
fhund  = X//500
f = (X-fhund*500)//5
print(fhund*1000+f*5)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
h1 = x // 500
y = x % 500
h2 = y // 5

print(h1*1000 + h2*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
X = int(input())
happ = (X // 500) * 1000
X = X % 500
happ += (X // 5) * 5
print(happ)

Submission status: Accepted

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

Submission status: Accepted

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