Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def solve(n, p_list):

    count = 0
    j = 2 * 10^^5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Fixed submission:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def solve(n, p_list):

    count = 1
    for i in range(n-1):
        target_num = p_list.pop()
        if min(p_list) > target_num:
            count += 1
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Fixed submission:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def check(target_num, num_list):
    for i in num_list:
        if i < target_num:
            return 0
    return 1

def solve(n, p_list):

    count = 0
    for i in range(n):
        target_num = p_list.pop()
        count += check(target_num, p_list)
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Fixed submission:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def check(target_num, num_list):
    count = len([ i for i in num_list if i < target_num])
    if count == 0:
        return 1
    else:
        return 0

def solve(n, p_list):

    count = 0
    for i in range(n):
        target_num = p_list.pop()
        count += check(target_num, p_list)
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

Fixed submission:
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)
Buggy python submission (verdict: Runtime Error):
import copy

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

def hoge(numbers, s, n_list):

    for i in range(len(numbers)):
        copy_numbers = copy.deepcopy(numbers)
        ss = s+copy_numbers.pop(i)
        if len(copy_numbers) > 0:
            hoge(copy_numbers, ss, n_list)
        else:
            n_list.append(ss)

n_list = []
for i in range(n):
    number_list = [str(i) for i in range(1, n+1)]
    s = number_list.pop(i)
    hoge(number_list, s, n_list)

n_list.sort()

ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1))
print(ans)


Fixed submission:
import copy

n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))

def hoge(numbers, s, n_list):

    for i in range(len(numbers)):
        copy_numbers = copy.deepcopy(numbers)
        ss = s+copy_numbers.pop(i)
        if len(copy_numbers) > 0:
            hoge(copy_numbers, ss, n_list)
        else:
            n_list.append(int(ss))

n_list = []
for i in range(n):
    number_list = [str(i) for i in range(1, n+1)]
    s = number_list.pop(i)
    hoge(number_list, s, n_list)

n_list.sort()

ans = abs((n_list.index(p) + 1) - (n_list.index(q) + 1))
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = "WA"

if s[0] == "A" and a[2:-2].count("C") == 1:
  tmp = s[1:]
  tmp.replace("C","")
  ans = "AC" if tmp.islower() else "WA"
  
print(ans)

Fixed submission:
s = input()
ans = "WA"

if s[0] == "A" and s[2:-1].count("C") == 1:
  tmp = s[1:]
  tmp = tmp.replace("C","")
  ans = "AC" if tmp.islower() else "WA"
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums  = [int(i) for i in input().split()]

count = 0
while any([i % 2 == 0 for i in nums]):
    count += 1
    div_index = max([(i, v) for i, v in enumerate(nums) if v % 2 == 0],
                    key=lambda x: x[1])[0]
    for i in range(len(nums)):
        if i == div_index:
            nums[i] //= 2
        else:
            nums[i] *= 3

print(count)


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

tmp = [i for i in nums if i % 2 == 0]
count = 0
for i in tmp:

    while i % 2 == 0:
        count += 1
        i //= 2

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())

memo = [-1]*(n+1)

def func(n):
    if n == 0:
        return 0

    if memo[n] != -1:
        return memo[n]

    res = n
    i = 1
    while i <= n:
        res = min(res, func(n-i)+1)
        i *= 6

    j = 1
    while j <= n:
        res = min(res, func(n-j)+1)
        j *= 9

    memo[n] = res
    return memo[n]

ans = func(n)
print(ans)

Fixed submission:
n = int(input())

dp = [n+1]*(n+1)
dp[0] = 0

for i in range(1, n+1):
    j = 1
    while j <= n:
        dp[i] = min(dp[i], dp[i-j]+1)
        j *= 6

    k = 1
    while k <= n:
        dp[i] = min(dp[i], dp[i-k]+1)
        k *= 9

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = len(s)

for i in range(len(s)):
    func  = lambda x, y, v: y < x and v != "E" or y > x and v != "W"
    tmp = len([1 for j, v in enumerate(s) if func(i, j, v)])

    ans = min(tmp, ans)

print(ans)


Fixed submission:
n = int(input())
s = input()

ans = s.count("E")

tmp = ans

for i in s:
    tmp += (-1 if i == "E" else 1)
    ans = min(ans, tmp)

print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())

i = 2
max_num = 1
while i**2 < a:
    j = 1
    temp = 0
    while i**j < a:
        temp = i**j
        j+=1

    if temp > max_num:
        max_num = temp
    i+=1
print(max_num)


Fixed submission:
a,b,c,d = map(int, input().split())

ab = abs(a - b)
bc = abs(b - c)
ca = abs(c - a)

if(ab <= d and bc <= d or ca <=d):
  print("Yes")
else:
  print("No")

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

def func(n, a):
  b = a**2
  if b >= n:
    return (a-1)**2
  else:
    c = a+1
    d = func(n, c)
  
  return d

d = func(n, 1)

print(d)

Fixed submission:
a,b,c,d = map(int, input().split())

ab = abs(a - b)
bc = abs(b - c)
ca = abs(c - a)

if(ab <= d and bc <= d or ca <=d):
  print("Yes")
else:
  print("No")

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

def func(n, a):
  b = a**2
  if b > n:
    return (a-1)**2
  else:
    c = a+1
    d = func(n, c)
  
  return d

d = func(n, 1)

print(d)

Fixed submission:
a,b,c,d = map(int, input().split())

ab = abs(a - b)
bc = abs(b - c)
ca = abs(c - a)

if(ab <= d and bc <= d or ca <=d):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a = int(input())

i = 2
max_num = 1
flag_outer = True
while i < a:      
    j = 2
  	temp = 0

  	while i**j < a:
    	temp = i**j
    	j+=1

    if temp > max_num and temp < a:
    	max_num = temp
      	i+=1
print(max_num)

Fixed submission:
a = int(input())

i = 2
max_num = 1
while i <= a:
    j = 2
    temp = 0
    while i**j <= a:
        temp = i**j
        j+=1

    if temp > max_num and temp <= a:
        max_num = temp
    i+=1
print(max_num)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

x = sorted(set(s))

subs_list = []
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        subs_list.append(s[i:j])

ans = sorted(set(subs_list))
print(ans[k-1])


Fixed submission:
s = input()
k = int(input())

subs_list = []
for i in range(len(s)):
    for j in range(i+1, i+k+1):
        subs_list.append(s[i:j])

ans = sorted(set(subs_list))
print(ans[k-1])
Buggy python submission (verdict: Runtime Error):
a, b = [int(i) for i in input().spili()]

print(a if a <= b else a - 1)

Fixed submission:
a, b = [int(i) for i in input().split()]
     
print(a if a <= b else a - 1)
Buggy python submission (verdict: Runtime Error):
import collections
counter = collections.Counter()

for i in input():
  counter[i] += 1
  
if len([i for i in counter.values() if i >= 1]) == 3:
  print*"Yes")
else:
  print("No")

Fixed submission:
import collections
counter = collections.Counter()

for i in input():
  	counter[i] += 1

if len([i for i in counter.values() if i >= 1]) == 3:
	print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a, b, k = [int(i) for i in input().split()]

tmp = list(range(a, b+1))

ans = tmp[:k]
ans.extend(tmp[-1*k:])

for i in list(set(ans)):
    print(i)


Fixed submission:
a, b, k = [int(i) for i in input().split()]

if k < b-a+1:
    tmp1 = list(range(a, a+k))
    tmp2 = list(range(b-k+1, b+1))
    tmp1.extend(tmp2)
    tmp = sorted(list(set(tmp1)))
    
else:
    tmp = list(range(a, b+1))
    
for i in tmp:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0)
a.append(0)
ans = []
for i in range(1, n+1):
    new_a = a.copy()
    new_a.pop(i)
    ans.append(sum([abs(new_a[i] - new_a[i+1]) for i in range(len(new_a) - 1)]))

for i in ans:
    print(i)


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0)
a.append(0)

s = sum([abs(a[i] - a[i+1]) for i in range(len(a) - 1)])

for i in range(1, len(a)-1):
    tmp = s + abs(a[i-1] - a[i+1]) -(abs(a[i-1] - a[i]) + abs(a[i] - a[i+1]))
    print(tmp)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
def find_ge(a, x):
    i = bisect.bisect_right(a,x)
    return i
    
def solve(n, a, b, c):

    b_count = [0]*len(b)
    for i, x in enumerate(b):
        b_count[i] = len(c) - find_ge(c, x)

    ans = 0
    for i in a:
        x = find_ge(b, i)
        ans += sum(b_count[x:])
        
    return ans

if __name__ == "__main__":
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    b = sorted([int(i) for i in input().split()])
    c = sorted([int(i) for i in input().split()])
    print(solve(n, a, b, c))


Fixed submission:
import bisect
import itertools
def find_ge(a, x):
    i = bisect.bisect_right(a,x)
    return i

def solve(n, a, b, c):

    tmp = len(c)
    b_count =list(itertools.accumulate([tmp - find_ge(c, x) for x in b]))
    ans = 0
    for i in a:
        min_index = find_ge(b, i)
        
        ans += b_count[-1] -(0 if min_index == 0 else b_count[min_index-1])
    
    return ans

if __name__ == "__main__":
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    b = sorted([int(i) for i in input().split()])
    c = sorted([int(i) for i in input().split()])
    print(solve(n, a, b, c))

Buggy python submission (verdict: Runtime Error):
def solve(n, a, b, c):

    b_count = [0]*len(b)
    for i, x in enumerate(b):
        b_count[i] = len(c) - find_ge(c, x)

    ans = 0
    for i in a:
        x = find_ge(b, i)
        ans += sum(b_count[x:])
        
    return ans

if __name__ == "__main__":
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    b = sorted([int(i) for i in input().split()])
    c = sorted([int(i) for i in input().split()])
    print(solve(n, a, b, c))

Fixed submission:
import bisect
import itertools
def find_ge(a, x):
    i = bisect.bisect_right(a,x)
    return i

def solve(n, a, b, c):

    tmp = len(c)
    b_count =list(itertools.accumulate([tmp - find_ge(c, x) for x in b]))
    ans = 0
    for i in a:
        min_index = find_ge(b, i)
        
        ans += b_count[-1] -(0 if min_index == 0 else b_count[min_index-1])
    
    return ans

if __name__ == "__main__":
    n = int(input())
    a = sorted([int(i) for i in input().split()])
    b = sorted([int(i) for i in input().split()])
    c = sorted([int(i) for i in input().split()])
    print(solve(n, a, b, c))
Buggy python submission (verdict: Runtime Error):
a, b, c = [int(i) for i in input().splt()]

if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)

Fixed submission:
a, b, c = [int(i) for i in input().split()]

if a == b:
  print(c)
elif b == c:
  print(a)
else:
  print(b)
Buggy python submission (verdict: Runtime Error):
n = input()

for "9" in n:
  print("Yes")
else:
  print("No")

Fixed submission:
n = input()
  
if "9" in n:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import functools
def func(a,b):
    y = max(a,b)
    x = min(a,b)
    i = 1
    while True:
        tmp = y * i
        if tmp % x == 0:
            break
        else:
            i += 1
    return tmp

def slove(n, t):
    t.sort()
    ans = functools.reduce(func, t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))


Fixed submission:
import sys
import functools
import fractions
def slove(n, t):
    t.sort()
    ans = functools.reduce(lambda x,y:(x*y)//fractions.gcd(x,y), t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def slove(n, t):
    t.sort()
    max_num = t.pop()
    i = 1
    while True:
        ans = max_num * i
        tmp = all([True if ans % j == 0 else False for j in t])
        if tmp:
            break
        else:
            i += 1

    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))


Fixed submission:
import sys
import functools
import fractions
def slove(n, t):
    t.sort()
    ans = functools.reduce(lambda x,y:(x*y)//fractions.gcd(x,y), t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def slove(n, t):
    t.sort()
    max_num = t.pop()
    i = 1
    while True:
        ans = max_num * i
        tmp = all([True if ans % j == 0 else False for j in t])
        if tmp:
            break
        else:
            i += 1

    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))


Fixed submission:
import sys
import functools
import fractions
def slove(n, t):
    t.sort()
    ans = functools.reduce(lambda x,y:(x*y)//fractions.gcd(x,y), t)
    return ans

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    t = [int(input()) for i in range(n)]
    print(slove(n, t))
Buggy python submission (verdict: Runtime Error):
def slove(n, k):
    a_list = [int(i) for i in k.split()]
    num = len([i for i in a_list if i % 4 == 0])
    tmp =  [i for i in a_list if i % 4 != 0]
    num2 = tmp.count(2) // 2
    return "Yes" if (num + num2)>= n // 2 else "No"

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    k = input()
    print(slove(n, k))


Fixed submission:
import sys
def slove(n, k):
    a_list = [int(i) for i in k.split()]
    num = len([i for i in a_list if i % 4 == 0])
    tmp =  [i for i in a_list if i % 4 != 0]
    num2 = len([i for i in tmp if i % 2 == 0]) // 2
    return "Yes" if (num + num2)>= n // 2 else "No"

if __name__ == "__main__":
    input = sys.stdin.readline
    n = int(input())
    k = input()
    print(slove(n, k))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

btn_list = {i:int(input()) for i in range(1,n+1)}

count = 0
btn = 1

while True:
    if btn == 2:
        print(count)
        break
    elif btn == 1 and count != 0:
        print(-1)
        break
    else:
        count += 1
        btn = btn_list[btn]

Fixed submission:
n = int(input())

btn_list = {i:int(input()) for i in range(1,n+1)}

count = 1
right = btn_list[1]

while True:
    if right == 2:
        print(count)
        break
    elif count == n:
        print(-1)
        break
    else:
        count += 1
        right = btn_list[right]

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

btn_list = {i:int(input()) for i in range(1,n+1)}

count = 0
btn = 1

while True:
    if btn == 2:
        print(count)
        break
    elif btn == 1 and count != 0:
        print(-1)
        break
    else:
        count += 1
        btn = btn_list[btn]

Fixed submission:
n = int(input())

btn_list = {i:int(input()) for i in range(1,n+1)}

count = 1
right = btn_list[1]

while True:
    if right == 2:
        print(count)
        break
    elif count == n:
        print(-1)
        break
    else:
        count += 1
        right = btn_list[right]
Buggy python submission (verdict: Runtime Error):
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        count[i // 400] += 1

    max_value = len([i for i in count.keys() if i != 8]) + count[8]
    min_value =  1 if max_value - count[8] == 0 else max_value - count[8]
    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = sorted([int(input()) for i in range(n)])
    print(solve(n, a_list))


Fixed submission:
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        no = 8 if i // 400 >= 8 else i // 400
        count[no] += 1

    tmp = len([i for i in count.keys() if i != 8])
    max_value = tmp + count[8]
    min_value = 1 if tmp == 0 else tmp

    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))

Buggy python submission (verdict: Runtime Error):
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        count[i // 400] += 1

    min_value = len([i for i in count.keys() if i != 8])
    max_value = min_value + count[8]
    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(input()) for i in range(n)]
    print(solve(n, a_list))


Fixed submission:
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        no = 8 if i // 400 >= 8 else i // 400
        count[no] += 1

    tmp = len([i for i in count.keys() if i != 8])
    max_value = tmp + count[8]
    min_value = 1 if tmp == 0 else tmp

    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))

Buggy python submission (verdict: Runtime Error):
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        count[i // 400] += 1

    min_value = len([i for i in count.keys() if i != 8])
    max_value = min_value + count[8]
    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = sorted([int(input()) for i in range(n)])
    print(solve(n, s_list))


Fixed submission:
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        no = 8 if i // 400 >= 8 else i // 400
        count[no] += 1

    tmp = len([i for i in count.keys() if i != 8])
    max_value = tmp + count[8]
    min_value = 1 if tmp == 0 else tmp

    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))
Buggy python submission (verdict: Runtime Error):
def solve(n, s_list):
    max_score = sum(s_list)

    if max_score % 10 != 0:
        return max_score
    else:
        for i in tmp:
            if (max_score - i) % 10 != 0:
                return max_score - i

if __name__ == "__main__":
    n = int(input())
    s_list = sorted([int(input()) for i in range(n)])
    print(solve(n, s_list))

Fixed submission:
def solve(n, s_list):
    max_score = sum(s_list)

    if max_score % 10 != 0:
        return max_score
    else:
        for i in s_list:
            if (max_score - i) % 10 != 0:
                return max_score - i
    return 0

if __name__ == "__main__":
    n = int(input())
    s_list = sorted([int(input()) for i in range(n)])
    print(solve(n, s_list))

Buggy python submission (verdict: Runtime Error):
def solve(n, s_list):
    max_score = sum(tmp)

    if max_score % 10 != 0:
        return max_score
    else:
        for i in tmp:
            if (max_score - i) % 10 != 0:
                return max_score - i

if __name__ == "__main__":
    n = int(input())
    s_list = sorted([int(input()) for i in range(n)])
    print(solve(n, s_list))

Fixed submission:
def solve(n, s_list):
    max_score = sum(s_list)

    if max_score % 10 != 0:
        return max_score
    else:
        for i in s_list:
            if (max_score - i) % 10 != 0:
                return max_score - i
    return 0

if __name__ == "__main__":
    n = int(input())
    s_list = sorted([int(input()) for i in range(n)])
    print(solve(n, s_list))
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(40000)
def func(pos, t, x):

    if pos + t == x:
        return t
    elif pos + t < x:
        new_pos = pos + t
        t += 1
        return func(new_pos, t, x)
    else:
        new_pos = pos - t
        t -= 1
        return func(new_pos, t, x)
    
def slove(x):
    ans = func(0,0,x)
    return ans
if __name__ == "__main__":
    x = int(input())
    print(slove(x))


Fixed submission:
def slove(x):
    t = 1
    ans = t
    while ans <x:
        t += 1
        ans += t
    return t
if __name__ == "__main__":
    x = int(input())
    print(slove(x))

Buggy python submission (verdict: Runtime Error):
def func(pos, t, x):
    if pos + t == x:
        return t
    elif pos + t < x:
        new_pos = pos + t
        t += 1
        return func(new_pos, t, x)
    else:
        new_pos = pos - t
        t -= 1
        return func(new_pos, t, x)
      
def slove(x):
    ans = func(0,0,x)
    return ans

if __name__ == "__main__":
    x = int(input())
    print(slove(x))

Fixed submission:
def slove(x):
    t = 1
    ans = t
    while ans <x:
        t += 1
        ans += t
    return t
if __name__ == "__main__":
    x = int(input())
    print(slove(x))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

power = 1

for i in range(1, n+1):
    power *= i

print(power % (10**9 + 7))


Fixed submission:
import math
n = int(input())

power = math.factorial(n)

print(power % (10**9 + 7))