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.

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.q = l
        heapq.heapify(self.q)
        return

    def push(self, n):
        heapq.heappush(self.q, n)
        return

    def pop(self):
        return heapq.heappop(self.q)


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    
    X = Scanner.int()
    ans = (X // 500) * 1000
    X %= 500
    ans += (X // 5) * 5
    print(ans)


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
print(N // 500 * 1000 + N % 500 // 5 * 5)

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
setrecursionlimit(1000000)


INF = int(1e10)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    n = int(input())
    x1 = n // 500
    n -= x1 * 500
    x2 = n // 5
    print(1000 * x1 + 5 * x2)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(X: int):
    gohyaku = X//500
    X %= 500
    go = X // 5

    print(gohyaku*1000+go*5)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)

if __name__ == '__main__':
    main()

Solution (Python):
x = int(input())

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

Solution (Python):
x = int(input())

a = x // 500

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

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

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

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

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

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

print(ans)

Solution (Python):
x = int(input())
a,b = divmod(x, 500)
c = b//5
ans = 1000*a + 5*c
print(ans)

Solution (Python):
A = int(input())

hap = 0

hap += (A // 500) * 1000
A = A % 500

hap += (A // 5) * 5

print(hap)

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

Solution (Python):
n = int(input())

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

Solution (Python):

def inputlist(): return [int(j) for j in input().split()]
from collections import Counter


X = int(input())
k = X //500
ans = 0
ans += 1000*k
X -= 500*k
l = X //5
ans += 5*l
print(ans)

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

Solution (Python):
x = int(input())

l = x//500

x -= l*500

s = x//5

print(l*1000+s*5)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

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

Solution (Python):

import sys


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x=II()
    a,x=divmod(x,500)
    b=x//5
    print(a*1000+b*5)

main()

Solution (Python):
def inpl():
    return list(map(int, input().split()))


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

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

Solution (Python):
import sys








import math



readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


X = int(sys.stdin.buffer.readline())
a = X // 500
b = (X % 500) // 5
print( a * 1000 + b * 5)

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

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

Solution (Python):

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


if __name__ == "__main__":
    solve()

Solution (Python):
def main():
    N = int(input())
    return (N // 500) * 1000 + ((N % 500) // 5) * 5


print(main())

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

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