Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    elif N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N > B:
        for x in range(B-1, N+1, B):
            temp = mt.floor(A*x/B) - A*mt.floor(x/B)
            if temp >= maxn:
                maxn = temp
            else:
                break
    elif N == B:
        maxn = mt.floor(A*(N-1)/B) - A*mt.floor((N-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N > B:
        for x in range(B-1, N+1, B):
            temp = mt.floor(A*x/B) - A*mt.floor(x/B)
            if temp >= maxn:
                maxn = temp
            else:
                break
    elif N == B:
        maxn = mt.floor(A*(N-1)/B) - A*mt.floor((N-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from math import gcd
from functools import reduce

def gcd_list(numlist):
    return reduce(gcd, numlist)

def main():
    K = int(input())

    s = 0

    for a in range(1, K+1):
        for b in range(1, K+1):
            for c in range(1, K+1):
                s += gcd_list([a, b, c])
    
    print(s)



if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from math import gcd
from functools import reduce

def gcd_list(numlist):
    return reduce(gcd, numlist)

def main():
    K = int(input())

    s = 0

    for a in range(1, K+1):
        for b in range(1, K+1):
            for c in range(1, K+1):
                s += gcd_list([a, b, c])
    
    print(s)



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N):
        for j in range(i+1, N):
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(N - total)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N-2):
        for j in range(i+1, N-1):
            if 2*j-i >= N:
                break
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(R*G*B - total)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = []
    G = []
    B = []

    for i, s in enumerate(S):
        if s == 'R':
            R.append(i)
            continue
        elif s == 'G':
            G.append(i)
            continue
        elif s == 'B':
            B.append(i)
    

    total = 0

    for r in R:
        for g in G:
            for b in B:
                li = sorted([r, g, b])
                if li[1] - li[0] != li[2] - li[1]:
                    total += 1
    
    print(total)



if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N-2):
        for j in range(i+1, N-1):
            if 2*j-i >= N:
                break
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(R*G*B - total)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())

    while True:
        x = abs(N-K)
        if abs(x) > abs(N):
            break
        N = x
    
    print(N)


if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())

    if 2 * N < K:
        return N

    R = N % K
    
    if R < abs(R - K):
        return R
    else:
        return abs(R - K)


if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
 
S = list(input())
Q = int(input())
is_forward = True
 
for i in range(Q):
    query = input()
 
    if query == '1':
        is_forward = not is_forward
    else:
        T, F, C = query.split()
        if is_forward:
            if F == '1':
                S.insert(0, C)
            else:
                S.append(C)
        else:
            if F == '1':
                S.append(C)
            else:
                S.insert(0, C)

if not is_forward:
  S.reverse()
 
print(''.join(S))


Fixed submission:
# -*- coding: utf-8 -*-
 
S = list(input())
Q = int(input())
is_forward = True
lia = []
lib = []
 
for i in range(Q):
    query = input()
 
    if query == '1':
        is_forward = not is_forward
    else:
        T, F, C = query.split()
        if is_forward:
            if F == '1':
                lia.append(C)
            else:
                lib.append(C)
        else:
            if F == '1':
                lib.append(C)
            else:
                lia.append(C)

if is_forward:
  lia.reverse()
  print(''.join(lia + S + lib))
else:
  S.reverse()
  lib.reverse()
  print(''.join(lib + S + lia))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

S = list(input())
Q = int(input())

for i in range(Q):
    query = input()

    if query == '1':
        S.reverse()
    else:
        T, F, C = query.split()
        
        if F == '1':
            S.insert(0, C)
        else:
            S.append(C)

print(''.join(S))


Fixed submission:
# -*- coding: utf-8 -*-
 
S = list(input())
Q = int(input())
is_forward = True
lia = []
lib = []
 
for i in range(Q):
    query = input()
 
    if query == '1':
        is_forward = not is_forward
    else:
        T, F, C = query.split()
        if is_forward:
            if F == '1':
                lia.append(C)
            else:
                lib.append(C)
        else:
            if F == '1':
                lib.append(C)
            else:
                lia.append(C)

if is_forward:
  lia.reverse()
  print(''.join(lia + S + lib))
else:
  S.reverse()
  lib.reverse()
  print(''.join(lib + S + lia))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

S = list(input())
Q = int(input())

for i in range(Q):
    query = input()

    if query == '1':
        S.reverse()
    else:
        T, F, C = query.split()
        
        if F == '1':
            S.insert(0, C)
        else:
            S.append(C)

print(''.join(S))

Fixed submission:
# -*- coding: utf-8 -*-
 
S = list(input())
Q = int(input())
is_forward = True
lia = []
lib = []
 
for i in range(Q):
    query = input()
 
    if query == '1':
        is_forward = not is_forward
    else:
        T, F, C = query.split()
        if is_forward:
            if F == '1':
                lia.append(C)
            else:
                lib.append(C)
        else:
            if F == '1':
                lib.append(C)
            else:
                lia.append(C)

if is_forward:
  lia.reverse()
  print(''.join(lia + S + lib))
else:
  S.reverse()
  lib.reverse()
  print(''.join(lib + S + lia))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

Fixed submission:
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S[:-2]):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S):
    if s != 'A':
        continue
    else:
        if S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

Fixed submission:
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S[:-2]):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range(1, n+1):
    b=1
    while n-a*b>0:
        ans += 1
        b+=1
print(ans)


Fixed submission:
n = int(input())
ans = 0
for a in range(1, n):
  ans += (n - 1) // a
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = input("").split(" ")
a = [int(i) for i in a]

for i in range(1,n - k+1):
    score = 1
    p_score = 1
    for j in range(i,i+k):
        score *= a[j]
        p_score *= a[j-1]
    if score > p_score:
        print("Yes")
    else:
        print("No")



Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n - k):
    if a[k+i] > a[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
score = 1
for j in range(k):
    score *= a[j]

for i in range(n - k):
    score2 = score / a[i] * a[k + i]
    if score2 > score:
        print("Yes")
    else:
        print("No")
    score = score2


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n - k):
    if a[k+i] > a[i]:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
score = 1
for j in range(k):
    score *= a[j]

for i in range(n - k):
    score2 = score / a[i] * a[k + i]
    if score2 > score:
        print("Yes")
    else:
        print("No")
    score = score2


Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n - k):
    if a[k+i] > a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for i in range(1,n+1):
    cnt = 0
    for x in range(1,100):
        for y in range(1,100):
            for z in range(1,100):
                if x**2 + y**2 + z**2 +x*y + y*z + z*x == i:
                    cnt += 1
    print(cnt)

Fixed submission:
n = int(input())
ans = [0] * (n+1)
for x in range(1, 10**2):
    for y in range(1, 10**2):
        for z in range(1, 10**2):
            temp = x*x + y*y + z*z + x*y + y*z + z*x
            if 1 <= temp <= n:
                ans[temp] += 1
print(*ans[1:], sep='\n')
Buggy python submission (verdict: Runtime Error):
n = input()
a,b = divmod(n,1000)
print(b)

Fixed submission:
n = int(input())
a,b = divmod(n,1000)
if b == 0:
    print(0)
else:

    print(1000-b)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
for i in range(1,n+1):
    ans += (i *len(make_divisors(i)))
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += 0.5 * int(n/i) * (2 * i + (int(n/i) - 1) * i)
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
f = functools.partial(functools.reduce, operator.mul)
n = int(input())
a = list(map(int,input().split()))
ans = f(a)

if ans > 10**18:
    ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
f = functools.partial(functools.reduce, operator.mul)
n = int(input())
a = list(map(int,input().split()))
ans = f(a)

if ans > 10**18:
    ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans *= i
if ans > 10**18:
    ans = -1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[n-1] == 0:
    print("0")
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
if s = input()
t = input()
if len(s) +1 == len(t):
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = input()
if s == t[:len(s)]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
I = map(int, input().split())
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if h[a - 1] < h[b - 1]::
        list1[b - 1] = 0
print(sum(list1))

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
list1 = [1] * (n)
for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] > h[b - 1]:
        list1[a - 1] = 0
    if:
        list1[b - 1] = 0
print(sum(list1))

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))

Buggy python submission (verdict: Runtime Error):
import itertools
n,m = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
list1 = [] #あって    眺めがいい
list2 = [] #ない     道が通ってる
list3 = [x for x in range(1,n+1)]
list4 = []
for i in range(m):
    a,b = map(int,input().split())
    list2.append(a)
    list2.append(b)
    if h[a-1] > h[b-1]:
        list1.append(a)
    else:
        list1.append(b)
list1 = list(set(list1))
list2 = list(set(list2))
for i in range(n):
    if list2[i] not in list3:
        list4.append(list2[i])

print(len(list1)+len(list4))

Fixed submission:
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
Buggy python submission (verdict: Runtime Error):
a,b,n = map(int,input().spit())

print(min(b-1,n))

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

num = min(b-1,n)

print(int((a*num)/b)-a*int(num/b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())
ans = 0
test = 0
cnt = 1
while n >= cnt:
    test = int((a * cnt) / b) - (a * int((cnt / b)))
    if test > ans:
        ans = test
    cnt += 1
print(ans)


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

num = min(b-1,n)

print(int((a*num)/b)-a*int(num/b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    num = a.count((i+1))
    print(num)

Fixed submission:
import collections
n = int(input())
a = list(map(int,input().split()))

list_1 = collections.Counter(a)

for i in range(n):
    print(list_1[(i+1)])
Buggy python submission (verdict: Time Limit Exceeded):
import math
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)

Fixed submission:
import math
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)

Buggy python submission (verdict: Runtime Error):
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)

Fixed submission:
import math
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())

ans = 0
list1 = ["", "", ""]
for i in range(n):
    for j in range(n):
        if i < j:
            for k in range(n):
                if j < k:
                    if s[i] != s[j]:
                        if s[j] != s[k]:
                            if s[i] != s[k]:
                                if j - i != k - j:
                                    ans += 1
print(ans)


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

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)

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

ans = 0
list1 = ["", "", ""]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    if j - i != k - j:
                        ans += 1
print(ans)


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

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = 0
list1 = ["", "", ""]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    if j - i != k - j:
                        ans += 1
print(ans)


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

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a=n/k
if a >1:
    b=n%k
    if b==0:
        print(0)
    else:
        print(abs(b-k))
else:
    print(n)
    exit()

Fixed submission:
n, k = map(int, input().split())

b = n % k
c = abs(b - k)
if b < c:
    print(b)
else:
    print(c)
Buggy python submission (verdict: Runtime Error):
    k,n = map(int,input().split())
     
    s = list(map(int,input().split()))
    longest = 0
    for i in range(n-1):
        long = s[i+1] - s[i]
        if long > longest:
            longest = long
    if longest >= k - s[n-1] + s[0]:
        print(k - longest)
    else:
        print(s[n-1] - s[0])

Fixed submission:
k, n = map(int, input().split())

s = list(map(int, input().split()))
longest = 0
for i in range(n - 1):
    long = s[i + 1] - s[i]
    if long > longest:
        longest = long
if longest >= k - s[n - 1] + s[0]:
    print(k - longest)
else:
    print(s[n - 1] - s[0])
Buggy python submission (verdict: Runtime Error):
n,m = import math
n,m = map(int,input().split())
print(math.factorial(n)+math.factorial(m))

Fixed submission:
import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print(round(n2+m2))
Buggy python submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

x = int(input())
print(a[x-1]

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

x = int(input())
print(a[x-1])