Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import copy as cp
N = int(input())
numbers = [int(input()) for i in range(N)]

max_num = max(numbers)

for i in range(len(numbers)):
    if numbers[i] == max_num:
        temp_numbers = cp.copy(numbers)
        temp_numbers.pop(i)
        print(max(temp_numbers))
    else :
        print(max_num)

Fixed submission:
N = int(input())
numbers = [int(input()) for i in range(N)]

# 最大値を取得
max_num = max(numbers)

# 最大値を同じ値がいくつ在るかを確認
max_nums = numbers.count(max_num)

if max_nums >= 2:
    for i in range(len(numbers)):
        print(max_num)
else :
    max_index = numbers.index(max(numbers))
    for i in range(len(numbers)):
        if i == max_index:
            second_max = sorted(numbers)[-2]
            print(second_max)
        else :
            print(max_num)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
numbers = [int(input()) for i in range(N)]

def check_max_num(i,numbers):
    max_num = 0
    for j in range(len(numbers)):
        if j != i:
            if numbers[j] > max_num:
                max_num = numbers[j]
    return max_num

for i in range(len(numbers)):
    print(check_max_num(i,numbers))

Fixed submission:
N = int(input())
numbers = [int(input()) for i in range(N)]

# 最大値を取得
max_num = max(numbers)

# 最大値を同じ値がいくつ在るかを確認
max_nums = numbers.count(max_num)

if max_nums >= 2:
    for i in range(len(numbers)):
        print(max_num)
else :
    max_index = numbers.index(max(numbers))
    for i in range(len(numbers)):
        if i == max_index:
            second_max = sorted(numbers)[-2]
            print(second_max)
        else :
            print(max_num)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = [int(i) for i in input().split()]
min_mod = (L * R) % 2019 
for i in range(L, R):
    for j in range(i+1,R+1):
        if min_mod > (i * j) % 2019:
            min_mod =(i * j) % 2019
            if min_mod == 0:
                break
print(min_mod)

Fixed submission:
L, R = [int(i) for i in input().split()]
min_mod = (L * R) % 2019 

if R - L > 2019:
    min_mod = 0
else :
    for i in range(L, R):
        for j in range(i+1,R+1):
            if min_mod > (i * j) % 2019:
                min_mod =(i * j) % 2019
                if min_mod == 0:
                    break
print(min_mod)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = [int(i) for i in input().split()]
min_mod = (L * R) % 2019 
for i in range(L, R):
    for j in range(i+1,R+1):
        if min_mod > (i * j) % 2019:
            min_mod =(i * j) % 2019
            
print(min_mod)


Fixed submission:
L, R = [int(i) for i in input().split()]
min_mod = (L * R) % 2019 

if R - L > 2019:
    min_mod = 0
else :
    for i in range(L, R):
        for j in range(i+1,R+1):
            if min_mod > (i * j) % 2019:
                min_mod =(i * j) % 2019
                if min_mod == 0:
                    break
print(min_mod)
Buggy python submission (verdict: Runtime Error):
N, X = list(map(int, input().split()))
bounds = list(map(int, input().split()))

zahyos = [0]
for i, bound in enumerate(bounds):
    zahyo = zahyos[i] + bound
    zahyos.append(zahyo)
    
cnt = 0
zahyo = 0
index = 0
while zahyo <= X:
    cnt += 1
    index += 1
    zahyo = zahyos[index]
    
print(cnt)

Fixed submission:
N, X = list(map(int, input().split()))
bounds = list(map(int, input().split()))

zahyos = [0]
for i, bound in enumerate(bounds):
    zahyo = zahyos[i] + bound
    zahyos.append(zahyo)
    
cnt = 0
for num in zahyos:
    if num <= X:
        cnt += 1
    
print(cnt)
Buggy python submission (verdict: Runtime Error):
dishes = []
for i in range(5):
    dishes.append(input())
    
idx = 0
min_ones_place = 9

for j in range(5):
    ones_place = int(dishes[j][-1])
    if ones_place != 0:
        if ones_place < min_ones_place:
            min_ones_place = ones_place
            idx = j
            
last_dish = int(dishes.pop(idx))

total_time = 0
for k in range(4):
    total_time += int(dishes[k])
    if total_time % 10 == 0:
        pass
    else :
        total_time = int(Decimal(str(total_time)).quantize(Decimal('1E1'), rounding=ROUND_UP))

total_time += last_dish
print(total_time)

Fixed submission:
from decimal import *

dishes = []
for i in range(5):
    dishes.append(input())
    
idx = 0
min_ones_place = 9

for j in range(5):
    ones_place = int(dishes[j][-1])
    if ones_place != 0:
        if ones_place < min_ones_place:
            min_ones_place = ones_place
            idx = j
            
last_dish = int(dishes.pop(idx))

total_time = 0
for k in range(4):
    total_time += int(dishes[k])
    if total_time % 10 == 0:
        pass
    else :
        total_time = int(Decimal(str(total_time)).quantize(Decimal('1E1'), rounding=ROUND_UP))

total_time += last_dish
print(total_time)
Buggy python submission (verdict: Runtime Error):
S = input()

results = []

cnt = 0
results = []

for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        cnt += 1
    else :
        results.append(cnt)
        cnt = 0
        
print(max(results))

Fixed submission:
S = input()

cnt = 0
results = []

for i in range(len(S)):
    if S[i] in ['A', 'C', 'G', 'T']:
        cnt += 1
    else :
        results.append(cnt)
        cnt = 0
    results.append(cnt)
    
print(max(results))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = [int(i) for i in input().split()]
S = input()

output = []
for i in range(Q):
    s, t = [int(i) for i in input().split()]
    cnt = S.count('AC', s-1, t)
    output.append(cnt)

for _ in output:
    print(_)

Fixed submission:
N, Q = [int(i) for i in input().split()]
S = input()

t = [0] * (N+1)

for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
    
for i in range(Q):
    l, r = [int(i) for i in input().split()]
    print(t[r-1] - t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = [int(i) for i in input().split()]
S = input()

output = []
for i in range(Q):
    s, t = [int(i) for i in input().split()]
    string = S[s-1:t]
    cnt = 0
    for j in range(len(string)):
        partial_string = string[j:j+2]
        if partial_string == 'AC':
            cnt += 1
    output.append(cnt)

for _ in output:
    print(_)

Fixed submission:
N, Q = [int(i) for i in input().split()]
S = input()

t = [0] * (N+1)

for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
    
for i in range(Q):
    l, r = [int(i) for i in input().split()]
    print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
A, B = list(map(int,input().split()))
result = A

diff = (B - A) // 2

if A % 2 == 0 and B % 2 == 0:
    if num_of_ones % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    if num_of_ones % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    if num_of_ones % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    if num_of_ones % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)


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

if A % 2 == 0 and B % 2 == 0:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)

Buggy python submission (verdict: Runtime Error):
A, B = list(map(int,input().split()))
result = A

diff = (B - A) // 2

if A % 2 == 0 and B % 2 == 0:
    if num_of_ones % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    if num_of_ones % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    if num_of_ones % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    if num_of_ones % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)

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

if A % 2 == 0 and B % 2 == 0:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = list(map(int,input().split()))
result = A

for i in range(A+1, B+1):
    result = result ^ (i)

print(result)

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

if A % 2 == 0 and B % 2 == 0:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

sitigosan = ['7', '5', '3']
non_sitigosan = ['0', '1', '2', '4', '6', '8', '9']

cnt = 0
for i in range(1, N+1):
    str_i = str(i)
    flag = True
    for n in sitigosan:
        if n not in str_i:
            flag = False
            break
    if flag :
        for m in non_sitigosan:
            if m in str_i:
                flag = False
                break
    if flag :
        cnt += 1        
        
print(cnt)

Fixed submission:
N = int(input())

def dfs(s):
    if int(s) > N:
        return 0
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s+c)
    return ret

print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

PY = []
PYd = {i:[] for i in range(1, N+1)}

for i in range(M):
    x, y = [int(i) for i in input().split()]
    PYd[x].append(y)
    PY.append((x,y))
    
for i in PYd.keys():
    PYd[i].sort()
    
for p,y in PY:
    str_p = str(p).zfill(6)
    index = str(bisect.bisect(PYd[p], y)).zfill(6)
    print(str_p+index)

Fixed submission:
from collections import defaultdict
import bisect

N, M = [int(i) for i in input().split()]

PY = []
PYd = defaultdict(list)

for i in range(M):
    x, y = [int(i) for i in input().split()]
    PYd[x].append(y)
    PY.append((x,y))
    
for i in PYd.keys():
    PYd[i].sort()
    
for p,y in PY:
    str_p = str(p).zfill(6)
    index = str(bisect.bisect(PYd[p], y)).zfill(6)
    print(str_p+index)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().split()]

PY = []
PYd = {i:[] for i in range(1, N+1)}

for i in range(M):
    x, y = [int(i) for i in input().split()]
    PYd[x].append(y)
    PY.append((x,y))
    
for i in PYd.keys():
    PYd[i].sort()
    
for p,y in PY:
    str_p = str(p).zfill(6)
    index = str(PYd[p].index(y)+1).zfill(6)
    print(str_p+index)

Fixed submission:
from collections import defaultdict
import bisect

N, M = [int(i) for i in input().split()]

PY = []
PYd = defaultdict(list)

for i in range(M):
    x, y = [int(i) for i in input().split()]
    PYd[x].append(y)
    PY.append((x,y))
    
for i in PYd.keys():
    PYd[i].sort()
    
for p,y in PY:
    str_p = str(p).zfill(6)
    index = str(bisect.bisect(PYd[p], y)).zfill(6)
    print(str_p+index)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = [int(i) for i in input().split()]

all_cities = []
p_list = []
for i in range(M):
    p, y = [int(j) for j in input().split()]
    city = [i, p, y]
    p_list.append(p)
    all_cities.append(city)
    
p_set = set(p_list)

sorted_all_cities = []
for p in p_set:
    pref_city_list = []
    for city in all_cities:
        if city[1] == p:
            pref_city_list.append(city)
            
    sorted_pref_city_list = sorted(pref_city_list, key=lambda x: x[2])
    
    for c, city in enumerate(sorted_pref_city_list):
        city[2] = c + 1
        sorted_all_cities.append(city)
    
re_sorted_all_cities = sorted(sorted_all_cities, key=lambda x: x[0])

for city in re_sorted_all_cities:
    prefcode = "{0:06d}".format(city[1])
    citycode = "{0:06d}".format(city[2])
    print(prefcode+citycode)



Fixed submission:
from collections import defaultdict
import bisect

N, M = [int(i) for i in input().split()]

PY = []
PYd = defaultdict(list)

for i in range(M):
    x, y = [int(i) for i in input().split()]
    PYd[x].append(y)
    PY.append((x,y))
    
for i in PYd.keys():
    PYd[i].sort()
    
for p,y in PY:
    str_p = str(p).zfill(6)
    index = str(bisect.bisect(PYd[p], y)).zfill(6)
    print(str_p+index)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N, X = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

numbers.append(X)
numbers = sorted(numbers)

diff_numbers = []

for i in range(len(numbers)-1):
    diff_numbers.append(abs(numbers[i] - numbers[i+1]))

gcd = gcd_list(diff_numbers)

print(gcd)

Fixed submission:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N, X = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

numbers.append(X)
numbers = sorted(numbers)

diff_numbers = []

for i in range(len(numbers)-1):
    diff_numbers.append(abs(numbers[i] - numbers[i+1]))

gcd_num = gcd_list(diff_numbers)

print(gcd_num)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N, X = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

numbers.append(X)
numbers = sorted(numbers)

diff_numbers = []

for i in range(len(numbers)-1):
    diff_numbers.append(abs(numbers[i] - numbers[i+1]))

print(gcd_list(diff_numbers))

Fixed submission:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N, X = [int(i) for i in input().split()]
numbers = [int(i) for i in input().split()]

numbers.append(X)
numbers = sorted(numbers)

diff_numbers = []

for i in range(len(numbers)-1):
    diff_numbers.append(abs(numbers[i] - numbers[i+1]))

gcd_num = gcd_list(diff_numbers)

print(gcd_num)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = l
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break
    
if output:
    print(output)
else :
    print('1')

Fixed submission:
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) >= K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break
            
print(output)


Fixed submission:
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) > K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(0, K):
        if S[i] != '1':
            output = S[i]
            break
            
print(output)

Fixed submission:
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if len(S) > K:
    for l in S:
        if l != '1':
            output = l
            break
else :
    for i in range(0, K+1):
        if S[i] != '1':
            output = S[i]
            break
            
print(output)

Fixed submission:
S = input()
K = int(input())

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
cnt = []

for i in range(0, len(S)):
    left = S[:i]
    leader = S[i]
    right = S[i+1:]
    temp_cnt = 0
    temp_cnt += left.count('W')
    temp_cnt += right.count('E')
    cnt.append(temp_cnt)
    
output = min(cnt)

print(output)

Fixed submission:
N = int(input())
S = input()

left = 0
right = S[1:].count('E')

cnt = [left+right]

for i in range(1,len(S)):
    if S[i-1] == 'W':
        left += 1
    
    if S[i] == 'E':
        right -= 1
        
    cnt.append(left+right)

print(min(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
numbers = [int(i) for i in input().split()]

mid = (N - 1) // 2
for i in range(N):
    copy_num = copy.deepcopy(numbers)
    index_num = copy_num.pop(i)
    copy_num = sorted(copy_num)
    print(copy_num[mid])
    

Fixed submission:
import copy
N = int(input())
numbers = [int(i) for i in input().split()]
copy_num = sorted(copy.deepcopy(numbers))

mid = N // 2
mid_num = copy_num[mid]

for i in range(N):
    if numbers[i] >= mid_num:
        print(copy_num[mid-1])
    else :
        print(mid_num)
Buggy python submission (verdict: Runtime Error):
N, M = [int(i) for i in input().split()]

def initTable(N,M):
    table = [['.'] * M for i in range(N)]
    return table

def flipCard(row, column, table):
    for r in range(3):
        for c in range(3):
            if row + (r-1) < 0 or column + (c-1) < 0:
                pass
            elif row + (r-1) >= N or column + (c-1) >= M:
                pass
            else:
                card = table[row + (r-1)][column + (c-1)]
                if card == '.':
                    card = '#'
                else :
                    card = '.'
                table[row + (r-1)][column + (c-1)] = card
    return table

table = initTable(N, M)

for row in range(N):
    for column in range(M):
        table = flipCard(row, column, table)
        
cnt = 0
for row in table:
    cnt += row.count('#')

print(cnt)

Fixed submission:
n, m = [int(i) for i in input().split()]

n = 1 if n < 2 else n - 2
m = 1 if m < 2 else m - 2

print(n * m)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

buttons = {}
for i in range(N):
    buttons[i+1] = int(input())
    
pushed = []

b = 1
cnt = 0
flag = False
for i in range(N):
    cnt += 1
    next_button = buttons[b]
    if next_button == 2:
        flag = True
        break
    pushed.append(b)
    b = next_button
    if b in pushed:
        flag = False
        break
        
if flag:
    print(cnt)
else :
    print(-1)

Fixed submission:
N = int(input())

buttons = {}
for i in range(N):
    buttons[i+1] = int(input())
    
pushed = []

b = 1
cnt = 0
flag = False
for i in range(N):
    cnt += 1
    next_button = buttons[b]
    if next_button == 2:
        flag = True
        break
    b = next_button
        
if flag:
    print(cnt)
else :
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

buttons = {}
for i in range(N):
    buttons[i+1] = int(input())
    
pushed = []

b = 1
cnt = 0
while True:
    cnt += 1
    next_button = buttons[b]
    if next_button == 2:
        flag = True
        break
    pushed.append(b)
    b = next_button
    if b in pushed:
        flag = False
        break
        
if flag:
    print(cnt)
else :
    print(-1)

Fixed submission:
N = int(input())

buttons = {}
for i in range(N):
    buttons[i+1] = int(input())
    
pushed = []

b = 1
cnt = 0
flag = False
for i in range(N):
    cnt += 1
    next_button = buttons[b]
    if next_button == 2:
        flag = True
        break
    b = next_button
        
if flag:
    print(cnt)
else :
    print(-1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())

strings = [input() for i i in range(N)]

string_set = list(map(set,strings))
count_set = list(map(Counter, strings))

common_letter = string_set[0]

for s in string_set:
    common_letter = common_letter & s

common_letter_nums = {}

for l in common_letter:
    common_letter_nums.setdefault(l, [])
    for c in count_set:
        common_letter_nums[l].append(c[l])

output_letter = ''
for k, v in common_letter_nums.items():
    output_letter += k * min(v)

print(''.join(sorted(output_letter)))

Fixed submission:
from collections import Counter

N = int(input())

strings = [input() for i in range(N)]

string_set = list(map(set,strings))
count_set = list(map(Counter, strings))

common_letter = string_set[0]

for s in string_set:
    common_letter = common_letter & s

common_letter_nums = {}

for l in common_letter:
    common_letter_nums.setdefault(l, [])
    for c in count_set:
        common_letter_nums[l].append(c[l])

output_letter = ''
for k, v in common_letter_nums.items():
    output_letter += k * min(v)

print(''.join(sorted(output_letter)))
Buggy python submission (verdict: Runtime Error):
def factorial_power(n):
    if n == 0:
        return 1
    else :
        return n * factorial_power(n-1)
    
divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N) % divisor)

Fixed submission:
def factorial_power(n):
    power = 1
    
    for i in range(1, n+1):
        power *= i
        power = power % divisor
    return power

divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N))

Buggy python submission (verdict: Time Limit Exceeded):
def factorial_power(n):
    power = 1
    for i in range(1, n + 1):
        power *= i
    return power

divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N) % divisor)

Fixed submission:
def factorial_power(n):
    power = 1
    
    for i in range(1, n+1):
        power *= i
        power = power % divisor
    return power

divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N))
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(i) for i in input().split()]


cnt = 0

if S <= K:
    for x in range(S+1):
        for y in range(S+1):
            for z in range(S+1):
                if x + y + z == S:
                    cnt += 1
else :
    for x in range(K+1):
        for y in range(K+1):
            for z in range(K+1):
                if x + y + z == S:
                    cnt += 1

print(cnt)

Fixed submission:
K, S = [int(i) for i in input().split()]


cnt = 0

for x in range(K+1):
    for y in range(K+1):
        z = S - (x + y) 
        if z >= 0 and z <= K:
            cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(i) for i in input().split()]

cnt = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                cnt += 1

print(cnt)

Fixed submission:
K, S = [int(i) for i in input().split()]


cnt = 0

for x in range(K+1):
    for y in range(K+1):
        z = S - (x + y) 
        if z >= 0 and z <= K:
            cnt += 1

print(cnt)