You are viewing a single comment's thread. Return to all comments →
1 iteration, almost 1-liner. O(n) is slightly better than O(2n):
for _ in range(int(input())):
x = int(input())
print(x + (5 - x % 5)) if x >= 38 and 5 - x % 5 < 3 else print(x)
I wouldn't be surprised to learn that there is a better way to do it, though...