AtCoder Beginners Contest 085[A to C]



A. Already 2018 … String concatenation and slicing



B. Kagami Mochi … I used set. As all values added into the set is unique(duplicated values will be ignored), I just need to output the numbers of the set once all input is completed.

s = set()
for _ in range(int(input())):



C. Otoshidama … I used simple two for loops to iterate the numbers of 10,000 notes and 5,000 notes. Hence the cost is N^2.

def otoshidama(nos, amt):

    for x in range(0, amt//10000+1):
        for y in range(0, (amt-(10000*x))//5000+1):
            if 10000*x + 5000*y + 1000*(nos-x-y) == amt:
                return (x, y, nos-x-y)

    return (-1, -1, -1)

n, y = list(map(int,input().split()))

print(*otoshidama(n, y))