Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [0] * N
for i in range(N):
    L[i] = int(input())

ten = []
non = []
for i in L:
    if i % 10 == 0:
        ten.append(i)
    else:
        non.append(i)
if (sum(ten) + sum(non))%10 != 0:
    print(sum(ten) + sum(non))
else:
    print((sum(ten) + sum(non))-min(non))

Fixed submission:
N = int(input())
L = [0] * N
for i in range(N):
    L[i] = int(input())

ten = []
non = []
for i in L:
    if i % 10 == 0:
        ten.append(i)
    else:
        non.append(i)
if (sum(ten) + sum(non))%10 != 0:
    print(sum(ten) + sum(non))
elif non == []:
    print(0)
else:
    print((sum(ten) + sum(non))-min(non))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for h in range(N-M+1):
        cnt = 0
        for k in range(M):
            for j in range(M):
                if A[i+k][h+j] != B[k][h]:
                    cnt += 1
        if cnt == 0:
            break
if cnt == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N,M = map(int,input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

ans = 0
for i in range(N-M+1):
    for h in range(N-M+1):
        cnt = 0
        for k in range(M):
            for j in range(M):
                if A[i+k][h+j] != B[k][j]:
                    cnt += 1
        if cnt == 0:
            ans += 1
if ans != 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#import itertools
#import bisect
import math

N = int(input())
L = [i for i in range((N+1)//2+1)]
num = math.ceil(pow(2*(N-1),0.5))
    
for i in range(num,len(L)):
    if N == i*(i+1)//2:
        index = i
        Max = i*(i+1)//2
        break
    elif N < i*(i+1)//2:
        index = i
        Max = i*(i+1)//2
        break
Left = Max - N 
    
#acu = list(itertools.accumulate([i for i in range((N+1)//2+2)]))
#print(acu) 
#index = bisect.bisect_left(acu,N)
#print(index)

Left = Max - N    
#if acu[index] == N:
#    Max = acu[index-1]
#else:
#    Max = acu[index]
#Left = Max - N

for i in range(1,index+1):
    if i == Left:
        continue
    print(i)

Fixed submission:
#import itertools
#import bisect
import math

N = int(input())
L = [i for i in range((N+2)//2+2)]
num = math.floor(pow(2*(N-1),0.5))
    
for i in range(num,len(L)):
    if N == i*(i+1)//2:
        index = i
        Max = i*(i+1)//2
        break
    elif N < i*(i+1)//2:
        index = i
        Max = i*(i+1)//2
        break
Left = Max - N 
#print(num,Left,Max,index,L)
#acu = list(itertools.accumulate([i for i in range((N+1)//2+2)]))
#print(acu) 
#index = bisect.bisect_left(acu,N)
#print(index)
 
#if acu[index] == N:
#    Max = acu[index-1]
#else:
#    Max = acu[index]
#Left = Max - N

for i in range(1,index+1):
    if i == Left:
        continue
    print(i)
Buggy python submission (verdict: Runtime Error):
S = input()
Ans = 0
box = []

for i in range(2 ** (len(S)-1)):  # 文字の間に挿入するので、len(S)-1
    for j in range((len(S)-1)):
        box.append(S[j])
        
        if (i >> j) & 1:
            Ans += int("".join(box))
            box.clear()
            
    box.append(S[-1])
    Ans += int("".join(box))
    box.clear()

print(Ans)

Fixed submission:
S = input()
Ans = 0
box = []

for i in range(2 ** (len(S)-1)):  # 文字の間に挿入するので、len(S)-1
    for j in range((len(S)-1)):
        box.append(S[j])
        
        if (i >> j) & 1:
            Ans += int("".join(box))
            box.clear()
            
    box.append(S[-1])
    Ans += int("".join(box))
    box.clear()

print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list(map(int, input().split()))
sum = 1
for i in l:
    sum *= i
if sum > 1000000000000000000:
    print(-1)
else:
    print(sum)

Fixed submission:
N = int(input())
A = sorted(map(int, input().split()))

ans = 1

for x in range(N):
    ans *= A[x]
    if ans > 10**18:
        ans = -1
        break
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K = map(int,input().split())
sum = 0
for i in range(K):
    if A > 0:
        sum += 1
        A -= 1
    elif B > 0:
        sum += 0
        B -= 1
    elif C > 0:
        sum -= 1
        C -= 1
        
print(sum)
    

Fixed submission:
A,B,C,K = map(int,input().split())
if A >= K:
    print(1*K)

else:
    K -= A
    if B >= K:
        print(1*A)
    
    else:
        K -= B
        if K <= C:
            print(1*A + -1*K)
Buggy python submission (verdict: Time Limit Exceeded):
import math
X = int(input())
default = 100
year = 1
while True:
    default = default + math.floor(default * (1 / default))
    if default == X:
        print(year)
        break
    year += 1



Fixed submission:
import math

X = int(input())
year = 0
yokin = 100

while yokin < X:
    year += 1
    yokin += math.floor(yokin * 0.01)
print(year)

Buggy python submission (verdict: Runtime Error):
X = int(input())
default = 100
rishi = 

year = 1
while True:
    default = default + 1
    if default == X:
        print(year)
        break
    year += 1

Fixed submission:
import math

X = int(input())
year = 0
yokin = 100

while yokin < X:
    year += 1
    yokin += math.floor(yokin * 0.01)
print(year)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
li = list(map(int,input().split()))

n_li = sorted(li)


dup = [x for x in set(li) if li.count(x) > 1]

if not dup:
    print('YES')
else:
    print('NO')

Fixed submission:
N = int(input())
A = list(map(int,input().split(' ')))

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
li = list(map(int,input().split()))


count = 0
li = sorted(li)

l = [x for x in set(li) if li.count(x) > 1]
if len(l) == 0:
    print('YES')
else:
    print('NO')

Fixed submission:
N = int(input())
A = list(map(int,input().split(' ')))

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
li = list(map(int,input().split()))


count = 0
li = sorted(li)
for i,v in enumerate(li):
    for j in li[i+1:]:
        if v != j:
            pass
        elif v==j:
            count += 1

if count >0:
    print('NO')
else:
    print("YES")

Fixed submission:
N = int(input())
A = list(map(int,input().split(' ')))

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
li = list(map(int,input().split()))

count = 0

for i in range(a):
    if a-1 == i:
        continue
    for j in li[i+1:]:
        if li[i] == j:
            count += 1
        else:
            pass

if count > 0:
    print('NO')
else:
    print("YES")

Fixed submission:
N = int(input())
A = list(map(int,input().split(' ')))

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')

Buggy python submission (verdict: Runtime Error):
a = int(input())
li = list(map(int,input().split()))

count = 0

for i in range(a):
    # if li[-1] == li[i]:
    #     continue
    if i == a-1:
        continue
    else:
        if li[-5] == li[i]:
            count += 1
    for j in li[i+1:]:
        if li[i] == j:
            count += 1
        else:
            pass

if count > 0:
    print('NO')
else:
    print("YES")

Fixed submission:
N = int(input())
A = list(map(int,input().split(' ')))

is_break = False
seen = set()
for a in A:
    if a not in seen:
        seen.add(a)
    else:
        is_break=True
        break

if is_break:
    print('NO')
else:
    print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
Ans = 1
# print(len(L))
for i in L:
    Ans = Ans * i
if (10**18 - Ans) < 0:
     print(-1)
else:
    print(Ans)



Fixed submission:
N = int(input())
L = list(map(int,input().split()))
dec = 10**18
Ans = 1
# print(len(L))
if(0 in L):
    print(0)
else:
    for i in L:
        Ans = Ans * i
        if dec < Ans:
            print(-1)
            break
    else:
        print(Ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for _ in range(m):
  a,b=map(int,input().split())
  if ans[a-1]:
    if h[a-1]<=h[b-1]:
      ans[a-1]=0
  if ans[b-1]:
    if h[b-1]<=h[a-1]:
      ans[b-1]=0
print(ans.count(1))

Fixed submission:
s = input()
if "ABC" == s:
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())
c = 0
for i in range(1,n+1):
    if c == (math.floor(a*i/b)-a*math.floor(i/b)):
        continue
    elif c < (math.floor(a*i/b)-a*math.floor(i/b)):
        c = (math.floor(a*i/b)-a*math.floor(i/b))
    elif c > 0 and c > (math.floor(a*i/b)-a*math.floor(i/b)):
        print(c)
        exit()
print(c)

Fixed submission:
import math
a,b,n = map(int,input().split())
x = min(b - 1, n)
ans = math.floor((a * x) / b) - a * (math.floor(x / b))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())
c = 0
for i in range(1,n+1):
    # tmp = (math.floor(a*i/b)-a*math.floor(i/b))
    if c < (math.floor(a*i/b)-a*math.floor(i/b)):
        c = (math.floor(a*i/b)-a*math.floor(i/b))
    elif c > 0 and c > (math.floor(a*i/b)-a*math.floor(i/b)):
        print(c)
        exit()
print(c)

Fixed submission:
import math
a,b,n = map(int,input().split())
x = min(b - 1, n)
ans = math.floor((a * x) / b) - a * (math.floor(x / b))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
a,b,n = map(int,input().split())
c = 0
for i in range(1,n+1):
    # tmp = (math.floor(a*i/b)-a*math.floor(i/b))
    if c < (math.floor(a*i/b)-a*math.floor(i/b)):
        c = (math.floor(a*i/b)-a*math.floor(i/b))
    elif c > 0 and c > (math.floor(a*i/b)-a*math.floor(i/b)):
        print(c)
        exit()
print(c)

Fixed submission:
import math
a,b,n = map(int,input().split())
x = min(b - 1, n)
ans = math.floor((a * x) / b) - a * (math.floor(x / b))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = list(map(int,input().split()))
t = 0
for i in range(1,N+1):
    print(A.count(i))
    t += A.count(i)
    if t == N-1:
        for j in range(i+1,N+1):
            print(0)
        sys.exit()


Fixed submission:
n=int(input())
A=list(map(int,input().split()))
N=[0]*n
for a in A:
    N[a-1]+=1
 
for i in N:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = list(map(int,input().split()))
t = 0
for i in range(1,N+1):
    print(A.count(i))
    t += A.count(i)
    if t == N-1:
        for j in range(i+1,N+1):
            print(0)
        sys.exit()


Fixed submission:
n=int(input())
A=list(map(int,input().split()))
N=[0]*n
for a in A:
    N[a-1]+=1
 
for i in N:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
N=[0]*n
for a in A:
    N[a-1]+=1
 
for i in N:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
N=[0]*n
for a in A:
    N[a-1]+=1
 
for i in N:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(math.gcd(i,j),k)
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(math.gcd(i,j),k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(math.gcd(i,j),k)
print(ans)

Fixed submission:
import math
K = int(input())
ans = 0

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            ans += math.gcd(math.gcd(i,j),k)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n,k = map(int,input().split())
if n%k < abs((n%k) - k):
    print(n%k)
    sys.exit(n%k)
print(abs((n%k) - k))

Fixed submission:
import sys
n,k = map(int,input().split())
if n%k < abs((n%k) - k):
    print(n%k)
    sys.exit()
print(abs((n%k) - k))
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
b = ''
while True:
    for i in range(A):
        if len(b) == N:
            print(b.count('b'))
            exit()
        b += 'b'
    for i in range(B):
        if len(b) == N:
            print(b.count('b'))
            exit()
        b += 'r'

Fixed submission:
N,A,B = map(int,input().split())
cnt = N % (A+B)
if cnt == 0:
    print(N // (A+B) * A)
    exit()
else:
    if cnt - A >= 0:
        print(N // (A+B) * A + A)
        exit()
    else:
        print(N // (A+B) * A + cnt)
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N,A,B = map(int,input().split())
b = ''
while True:
    for i in range(A):
        if len(b) == N:
            print(b.count('b'))
            exit()
        b += 'b'
    for i in range(B):
        if len(b) == N:
            print(b.count('b'))
            exit()
        b += 'r'

Fixed submission:
N,A,B = map(int,input().split())
cnt = N % (A+B)
if cnt == 0:
    print(N // (A+B) * A)
    exit()
else:
    if cnt - A >= 0:
        print(N // (A+B) * A + A)
        exit()
    else:
        print(N // (A+B) * A + cnt)
        exit()
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
def Base_10_to_n(X, A):
    if (int(X/A)):
        return Base_10_to_n(int(X/A), A)+str(X%A)
    return str(X%A)
ans = Base_10_to_n(n,k)
print(len(ans))

Fixed submission:
n,r = map(int,input().split())
if n >= 10:
    print(r)
else:
    print(r + (100 * (10 - n)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,K = map(int,input().split())
H = list(map(int,input().split()))
if N-K <= 0:
    print(0)
    sys.exit()
for i in range(N-(N-K)):
    H.remove(max(H))
print(sum(H))

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
a = 0
for i in range(K,N):
    a += H[i]
print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(n):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                ans += 1
print(ans)

Fixed submission:
n = input()
s = input()
print(s.count("ABC"))
Buggy python submission (verdict: Time Limit Exceeded):
# B - Greedy Takahashi
a,b,k = map(int,input().split())
for i in range(k):
    if a >= 1:
        a -= 1
    else:
        b -= 1
print(a,b)

Fixed submission:
# B - Greedy Takahashi
a,b,k = map(int,input().split())
if a < k:
    k -= a
    a = 0  
    if b < k:
        b = 0
        print(a,b)
    else:
        print(a,b-k)
else:
    print(a-k,b)
Buggy python submission (verdict: Runtime Error):
x = int(input())
while True:
  	    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            break
    else:
        print(x)
        exit()
    x += 1

Fixed submission:
# C - Next Prime
x = int(input())
while True:

    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            break
    else:
        print(x)
        exit()
    x += 1
Buggy python submission (verdict: Runtime Error):
# C - Snack
import math
a,b = map(int,input().split())
print(a*b//math.gcd(a,b))

Fixed submission:
# C - Snack
from fractions import gcd
a,b = map(int,input().split())
print(a*b//gcd(a,b))

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
print(a*b//math.gcd(a,b))

Fixed submission:
# C - Snack
from fractions import gcd
a,b = map(int,input().split())
print(a*b//gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
# C - Go to School
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [a.index(i) + 1 for i in range(1, n+1)]
    print(" ".join(map(str, ans)))

if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Go to School
def main():
    import numpy as np
    n = int(input())
    a = list(map(int, input().split()))
    a = np.array(a)
    a = np.argsort(a)
    for i in a:
        print(i+1,end=" ")

if __name__ ==  "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# C - Go to School
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = []
    for i in range(1, n+1):
        ans.append(a.index(i) + 1)
    print(" ".join(map(str, ans)))
    
if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Go to School
def main():
    import numpy as np
    n = int(input())
    a = list(map(int, input().split()))
    a = np.array(a)
    a = np.argsort(a)
    for i in a:
        print(i+1,end=" ")

if __name__ ==  "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(input().split())
print(math.ceil(b%a))

Fixed submission:
# B - Power Socket
def main():
    a, b = map(int, input().split())
    cnt = 1
    ans = 0
    for i in range(20):
        if cnt >= b:
            print(ans)
            exit()
        else:
            cnt = a + (a-1) * i
            ans += 1

if __name__ ==  "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# C - Lower
def main():
    n = int(input())
    h = list(map(int, input().split()))
    cnt = 0
    ans = []

    for i in range(n-1):
        if h[i] >= h[i+1]:
            cnt += 1
            if i == n-2:
                ans.append(cnt)

        else:
            ans.append(cnt)
            cnt = 0
    print(max(ans))


if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Lower
def main():
    n = int(input())
    h = list(map(int, input().split()))
    cnt = 0
    ans = []

    if n == 1:
        print(0)
        exit()
    for i in range(n-1):
        if h[i] >= h[i+1]:
            cnt += 1
            if i == n-2:
                ans.append(cnt)

        else:
            ans.append(cnt)
            cnt = 0
    print(max(ans))


if __name__ ==  "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(m)]
    ab_1 = [ab[i][1] for i in range(m) if ab[i][0] == 1]
    ab_m = [ab[i][0] for i in range(m) if ab[i][1] == n]

    for i in ab_1:
            for j in ab_m:
                if i == j:
                    print('POSSIBLE')
                    exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    li = [0]*200001

    for _ in range(m):
        a, b = map(int, input().split())
        if a == 1:
            if li[b] == 0:
                li[b] = 1
            else:
                print('POSSIBLE')
                exit()
        if b == n:
            if li[a] == 0:
                li[a] = 1
            else:
                print('POSSIBLE')
                exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(m)]
    ab_1 = [ab[i][1] for i in range(m) if ab[i][0] == 1]
    ab_m = [ab[i][0] for i in range(m) if ab[i][1] == n]

    for i in ab_1:
            for j in ab_m:
                if i == j:
                    print('POSSIBLE')
                    exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    li = [0]*200001

    for _ in range(m):
        a, b = map(int, input().split())
        if a == 1:
            if li[b] == 0:
                li[b] = 1
            else:
                print('POSSIBLE')
                exit()
        if b == n:
            if li[a] == 0:
                li[a] = 1
            else:
                print('POSSIBLE')
                exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(m)]

    for a, b in ab:
        if a == 1:
            for a1, b1 in ab:
                if b == a1 and b1 == n:
                    print('POSSIBLE')
                    exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()

Fixed submission:
# C - Cat Snuke and a Voyage
def main():
    n, m = map(int, input().split())
    li = [0]*200001

    for _ in range(m):
        a, b = map(int, input().split())
        if a == 1:
            if li[b] == 0:
                li[b] = 1
            else:
                print('POSSIBLE')
                exit()
        if b == n:
            if li[a] == 0:
                li[a] = 1
            else:
                print('POSSIBLE')
                exit()
    else:
        print('IMPOSSIBLE')

if __name__ ==  "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# C - pushpush
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = []

    for i in range(n):
        if n % 2 == 0:
            if i % 2 == 0:
                ans.append(str(a[i]))
            else:
                ans.insert(0, str(a[i]))
        else:
            if i % 2 == 0:
                ans.insert(0, str(a[i]))
            else:
                ans.append(str(a[i]))

    else:
        print(' '.join(ans))




if __name__ ==  "__main__":
    main()

Fixed submission:
# C - pushpush
def main():
    from collections import deque
    n = int(input())
    a = list(map(int, input().split()))
    ans = deque(maxlen=2*10**5)

    for i in range(n):
        if n % 2 == 0:
            if i % 2 == 0:
                ans.append(str(a[i]))
            else:
                ans.appendleft(str(a[i]))
        else:
            if i % 2 == 0:
                ans.appendleft(str(a[i]))
            else:
                ans.append(str(a[i]))

    else:
        print(' '.join(ans))


if __name__ ==  "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# B - Training Camp
def main():
    n = int(input())
    ans = 1

    for i in range(1, n+1):
        ans *= i
    else:
        print(ans%(10**9+7))

  
        
if __name__ == '__main__':
    main()

Fixed submission:
# B - Training Camp
def main():
    import math
    n = int(input())
    
    
    print(math.factorial(n)%(10**9+7))

  
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# B - Sum of Three Integers
def main():
    k, s = map(int, input().split())
    cnt = 0

    for i in range(k+1):
        for j in range(k+1):
            for k in range(k+1):
                if i+j+k == s:
                    cnt += 1
    else:
        print(cnt)



if __name__ ==  "__main__":
    main()

Fixed submission:
# B - Sum of Three Integers
def main():
    k, s = map(int, input().split())
    cnt = 0

    for i in range(k+1):
        for j in range(k+1):
            z = s-i-j
            if 0 <= z <= k:
                cnt += 1
    else:
        print(cnt)



if __name__ ==  "__main__":
    main()