Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

def main():
    a, b, c, x, y = map(int, input().split())
    r = float('inf')
    for piza_a in range(x + 1):
        for piza_b in range(y + 1):
            piza_c = max(x - piza_a, y - piza_b) * 2
            tmp = piza_a * a + piza_b * b + piza_c * c
            r = min(r, tmp)
    print(r)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    a, b, c, x, y = map(int, input().split())
    r = float('inf')
    for piza_c in range(0, max(x, y) * 2 + 1, 2):
        piza_a = max(0, x - piza_c // 2)
        piza_b = max(0, y - piza_c // 2)
        r = min(r, piza_c * c + piza_a * a + piza_b * b)
    print(r)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a, b, k = map(int, input().split())
    k -= 1
    for i in range(a, b + 1):
        if min(abs(a - i), abs(b - i)) <= k:
            print(i)


if __name__ == '__main__':
    main()


Fixed submission:

def main():
    a, b, k = map(int, input().split())
    r = set()
    for i1 in range(a, min(a + k, b)):
        r.add(i1)
    for i2 in range(max(a, b - k + 1), b + 1):
        r.add(i2)
    r = list(r)
    r.sort()
    for j in r:
        print(j)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a, b, k = map(int, input().split())
    for i in range(a, b + 1):
        if abs(a - i) <= (k - 1) or abs(b - i) <= (k - 1):
            print(i)


if __name__ == '__main__':
    main()

Fixed submission:

def main():
    a, b, k = map(int, input().split())
    r = set()
    for i1 in range(a, min(a + k, b)):
        r.add(i1)
    for i2 in range(max(a, b - k + 1), b + 1):
        r.add(i2)
    r = list(r)
    r.sort()
    for j in r:
        print(j)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import accumulate
from itertools import chain
from collections import deque
def main():
    n = int(input())
    a1 = chain(tuple([0]), tuple(map(int, input().split())))
    a2 = chain(tuple([0]), tuple(map(int, input().split())))

    a1a = tuple(accumulate(a1))
    a2a = tuple(accumulate(a2))
    scores = deque()
    for i1 in range(1, n + 1):
        scores.append([i1] + a2a[n] - a2a[i1 - 1])
    r = max(scores)
    print(r)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    a1 = list(map(int, input().split()))
    a2 = list(map(int, input().split()))

    scores = []
    for i1 in range(n):
        score = sum(a1[:i1+1]) + sum(a2[i1:])
        scores.append(score)
    r = max(scores)
    print(r)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
S = input()
s[3] = '8'
print(s)

Fixed submission:
s = input()
s = s.replace('2017','2018')
print(s)
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    # cs[0]とcs[-1]はindex error除け。
    cs = [0] * 10002

    for _ in range(n):
        s, t, c = map(int, input().split())
        cs[s - 1] += 1
        cs[t + 1] -= 1
    cur = 0
    r = 0
    for cse in cs:
        cur += cse
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()


Fixed submission:
import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    d = {e: [0] * (c + 1) for e in range(100001)}
    d1 = [0] * 100001
    m = map(int, read().split())
    stc = zip(m, m, m)
    for s, t, c in stc:
        if d[s][c]:
            d1[s - 1] -= 1
            d1[s] += 1
        else:
            d[s][c] = 1
        if d[t][c]:
            d1[t - 1] -= 1
            d1[t] += 1
        else:
            d[t][c] = 1
        d1[s - 1] += 1
        d1[t] -= 1

    cur = 0
    r = 0
    for i1 in range(100001):
        cur += d1[i1]
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    # cs[0]とcs[-1]はindex error除け。
    cs = [0] * 10001

    for _ in range(n):
        s, t, c = map(int, input().split())
        cs[s] += 1
        cs[t + 1] -= 1
    cur = 0
    r = 0
    for cse in cs:
        cur += cse
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    d = {e: [0] * (c + 1) for e in range(100001)}
    d1 = [0] * 100001
    m = map(int, read().split())
    stc = zip(m, m, m)
    for s, t, c in stc:
        if d[s][c]:
            d1[s - 1] -= 1
            d1[s] += 1
        else:
            d[s][c] = 1
        if d[t][c]:
            d1[t - 1] -= 1
            d1[t] += 1
        else:
            d[t][c] = 1
        d1[s - 1] += 1
        d1[t] -= 1

    cur = 0
    r = 0
    for i1 in range(100001):
        cur += d1[i1]
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect
def main():
    n = int(input())
    a = tuple(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    b.sort()
    c.sort()
    r = 0
    a_index_inB = [bisect(b, ea) for ea in a]
    b_larger_inC = [n - bisect(c, eb) for eb in b]
    for aiie in a_index_inB:
        r += sum(b_larger_inC[aiie:])

    print(r)

if __name__ == '__main__':
    main()


Fixed submission:
from bisect import bisect
from itertools import accumulate
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a.sort()
    b.sort()
    c.sort()
    ainb = [bisect(b, ea) for ea in a]
    bc = [n - bisect(c, eb) for eb in b]
    bcaccum = tuple(accumulate(bc))
    tr = 0
    for eainb in ainb:
        if eainb != 0:
            tr += bcaccum[eainb - 1]
    r = bcaccum[-1] * n - tr

    print(r)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
    a, b, c, d, e, f = map(int, input().split())
    a *= 100
    b *= 100

    # 濃度0%のケース
    if e == 0 or min(a, b) == f:
        print(a, 0)
        sys.exit()
    water = [0] * 6001
    water[0] = True
    for i1 in range(3001):
        if water[i1]:
            water[i1 + a] = True
            water[i1 + b] = True
    sugar = [0] * 6001
    sugar[0] = True
    for i1 in range(3001):
        if sugar[i1]:
            sugar[i1 + c] = True
            sugar[i1 + d] = True

    noudo = 0
    r1 = 0
    r2 = 0
    for i1 in range(1, f + 1):
        if water[i1]:
            for i2 in range(f + 1):
                if i1 + i2 > f:
                    break
                if sugar[i2]:
                    if i1 * e >= i2 * 100:
                   

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b, c, d, e, f = map(int, input().split())
    a *= 100
    b *= 100

    # 濃度0%のケース
    if e == 0 or min(a, b) == f:
        print(a, 0)
        sys.exit()

    water = [0] * 6001
    water[0] = True
    for i1 in range(3001):
        if water[i1]:
            water[i1 + a] = True
            water[i1 + b] = True
    sugar = [0] * 6001
    sugar[0] = True
    for i1 in range(3001):
        if sugar[i1]:
            sugar[i1 + c] = True
            sugar[i1 + d] = True

    noudo = 0
    r1 = 0
    r2 = 0
    for i1 in range(1, f + 1):
        if water[i1]:
            for i2 in range(f + 1):
                if i1 + i2 > f:
                    break
                if sugar[i2]:
                    if i1 * e >= i2 * 100:
                        if noudo < i2 / (i1 + i2):
                            noudo = i2 / (i1 + i2)
                            r1 = int(i1 + i2)
                            r2 = int(i2)
                    else:
                        break
    if noudo == 0:
        print(a, 0)
    else:
        print(r1, r2)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    l1 = [0] * (10**9 + 1)
    print(n)
    for _ in range(n):
        i = int(input())
        l1[i] ^= 1
    print(sum(l1))


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
def main():
    n = int(input())
    l1 = []
    for _ in range(n):
        l1.append(input())
    l1c = Counter(l1)
    l1c2 = [c for c in l1c if l1c[c]%2 != 0]
    print(len(l1c2))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
s = set(input())
abc = set('abcdefghijklmnopqrstuvwxyz')
nots = abc.difference(s)
print(min(nots))

Fixed submission:
s = set(input())
abc = set('abcdefghijklmnopqrstuvwxyz')
nots = abc.difference(s)
if len(nots) == 0:
  print('None')
else:
  print(min(nots))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
def main():
    n = int(input())
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    ac = Counter(a)
    acl = [i for i in ac if ac[i] >= 2]

    if ac[acl[0]] >= 4:
        print(int(acl[0] ** 2))
    else:
        print(int(acl[0]*acl[1]))

if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
def main():
    n = int(input())
    a = list(map(int, input().split()))
    ac = Counter(a)
    acl = [i for i in ac if ac[i] >= 2]
    acl.sort(reverse=True)

    if len(acl) == 0:
        print(0)
    elif ac[acl[0]] >= 4:
        print(int(acl[0] * acl[0]))
    elif len(acl) <= 1:
        print(0)
    else:
        print(int(acl[0]*acl[1]))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = input()
 
rN = N[::-1]
if N = rN:
  r = 'Yes'
else:
  r = 'No'

print(r)

Fixed submission:
N = input()

rN = N[::-1]
if N == rN:
  r = 'Yes'
else:
  r = 'No'
 
print(r)

Buggy python submission (verdict: Runtime Error):
N = input()

if N = N[::-1]:
  r = 'Yes'
else:
  r = 'No'

print(r)

Fixed submission:
N = input()

rN = N[::-1]
if N == rN:
  r = 'Yes'
else:
  r = 'No'
 
print(r)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
end = min((a + b),(c + d))
start max(a,c)
r = max(0, end - start)
print(r)


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

start = max(a, c)
end = min(b, d)

r = max(0, end - start)
print(int(r))
Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    if n == 2:
        print(1)
        sys.exit()
    r = 0
    x = 2
    while x != 1:
        r += 1
        x = a.index(x) + 1
        if x == 2 or r >= n:
            r = -1
            break
    print(r)

if __name__ == '__main__':
    main()


Fixed submission:
n = int(input())
a = [0]
tmp = [int(input()) for _ in range(n)]
a = a + tmp

r = -1
cnt = 1
next = a[1]
while cnt < n:
  if next == 2:
    r = cnt
    break
  else:
    next = a[next]
    cnt += 1
print(r)

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    if n == 2:
        print(1)
        sys.exit()
    r = 0
    x = 2
    while x != 1:
        r += 1
        x = a.index(x) + 1
        if x == 2:
            r = -1
            break
    print(r)

if __name__ == '__main__':
    main()

Fixed submission:
n = int(input())
a = [0]
tmp = [int(input()) for _ in range(n)]
a = a + tmp

r = -1
cnt = 1
next = a[1]
while cnt < n:
  if next == 2:
    r = cnt
    break
  else:
    next = a[next]
    cnt += 1
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
read = sys.stdin.read

def main():
    # heapqをつかうプリム法
    import heapq
    def prim_heap():
        used = [True] * n  # True:不使用
        edgelist = []
        for e in edge[0]:
            heapq.heappush(edgelist, e)
        used[0] = False
        res = 0
        while len(edgelist) != 0:
            minedge = heapq.heappop(edgelist)
            if not used[minedge[1]]:
                continue
            v = minedge[1]
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist, e)
            res += minedge[0]
        return res

    n = int(input())
    xy = [tuple(map(int, input().split())) for _ in range(n)]
    edge = {e:[] for e in range(n)}
    for i1 in range(n):
        for i2 in range(i1 + 1):
            dis = min(abs(xy[i1][0] - xy[i2][0]), abs(xy[i1][1] - xy[i2][1]))
            edge[i1].append([dis, i2])
            edge[i2].append([dis, i1])
    r = prim_heap()
    print(r)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
read = sys.stdin.read
from operator import itemgetter
from copy import deepcopy
from collections import deque
def main():
    def find(x):
        if par[x] < 0:
            return x
        else:
            par[x] = find(par[x])
            return par[x]

    def unite(x, y):
        x = find(x)
        y = find(y)
        if x == y:
            return False
        else:
            if par[x] > par[y]:
                x, y = y, x
            par[x] += par[y]
            par[y] = x
            return True
    def same(x, y):
        return find(x) == find(y)
    def size(x):
        return -par[find(x)]
    def members(x):
        root = find(x)
        return [i for i in range(n) if find(i) == root]
    def roots():
        return [i for i, x in enumerate(par) if x < 0]

    # input
    n = int(input())
    m = map(int, read().split())
    # inputされたノード座標のリストをｘ座標とｙ座標それぞれでソート。
    mm = zip(m, m)
    cnt = 0
    nodes = []
    nodes_a = nodes.append
    for a, b in mm:
        # nodes_a(x座標、y座標、ノード名) ※ノード名は0origin。union-findを使うため。
        nodes_a((a, b, cnt))
        cnt += 1
    nodes.sort(key=itemgetter(0))
    nodes_y = deepcopy(nodes)
    nodes_y.sort(key=itemgetter(1))
    # ノード座標リストからｘ軸とｙ軸それぞれで「隣接するノードをむすぶ辺」のリストをedgesに格納。
    edges = []
    for i1 in range(n - 1):
        # 辺のコスト、端のノード２つ
        edges.append((nodes[i1+1][0] - nodes[i1][0], nodes[i1][2], nodes[i1+1][2]))
        edges.append((nodes_y[i1+1][1] - nodes_y[i1][1], nodes_y[i1][2], nodes_y[i1+1][2]))
    # 「コストが小さい順」でソート
    edges.sort(key=itemgetter(0))
    # union-findをつかってクラスカル法をする。
    par = [-1] * n  # union-find用のデータ初期化
    edges = deque(edges)  # edgesを左から１つずつpopするのでdequeに変換。
    r = 0  # rに「森に加えた辺のコスト」を加算していく
    while edges:
        e = edges.popleft()
        if not same(e[1], e[2]):
            r += e[0]
            unite(e[1], e[2])
    print(r)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    rate_count = [0] * 9
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds =  rate_count[8]
    rate_count[8] = 0
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = min(8, res + reds)
    print(r_min, r_max)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    rate_count = [0] * 13
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds = sum(rate_count[8:])
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = res + reds
    print(r_min, r_max)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    rate_count = [0] * 9
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds =  rate_count[8]
    rate_count[8] = 0
    rc2 = [1 for rce in rate_count if rce > 0]
    res = sum(rc2)
    r_min = max(res, 1)
    r_max = min(8, res + reds)
    print(r_min, r_max)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    rate_count = [0] * 13
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds = sum(rate_count[8:])
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = res + reds
    print(r_min, r_max)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s.sort()
    s_sum = sum(s)
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        s_sum -= es
        if s_sum % 10 != 0:
            print(s_sum)
            exit()
	else:
      print(0)
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = sum(s)
    s = [i for i in s if i % 10 != 0]
    s.sort()
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        if (s_sum - es) % 10 != 0:
            print(s_sum - es)
            exit()
    else:
        print(0)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = []
    def dfs(i, sum):
        if i == n:
            s_sum.append(sum)
        else:
            dfs(i + 1, sum + s[i])
            dfs(i + 1, sum)
    dfs(0, 0)
    s_sum_c = [s for s in s_sum if s % 10 != 0]
    s_sum_c.append(0)
    print(max(s_sum_c))

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = sum(s)
    s = [i for i in s if i % 10 != 0]
    s.sort()
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        if (s_sum - es) % 10 != 0:
            print(s_sum - es)
            exit()
    else:
        print(0)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = []
    def dfs(i, sum):
        if i == n:
            s_sum.append(sum)
        else:
            dfs(i + 1, sum + s[i])
            dfs(i + 1, sum)
    dfs(0, 0)
    s_sum_c = [s for s in s_sum if s % 10 != 0]
    print(max(s_sum_c))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = sum(s)
    s = [i for i in s if i % 10 != 0]
    s.sort()
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        if (s_sum - es) % 10 != 0:
            print(s_sum - es)
            exit()
    else:
        print(0)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
h, w = map(int,input().split()
a = [row for row in range(h)]

print('#' * w)           
for i in range(h):
  print('#' + a[i] + '#')
print('#' * w)           

Fixed submission:
h, w = map(int,input().split())
a = [input() for _ in range(h)]

print('#' * (w+2))           
for i in range(h):
  print('#' + a[i] + '#')
print('#' * (w+2))
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
students[i] = [tuple(map(int, input.split())) for _ in range(n)]
points[i] = [tuple(map(int, input.split())) for _ in range(m)]

ans = []
for s in students:
  tmp = []
  for p in points:
    tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1]))
  ans.append(tmp.index(min(tmp)) + 1)
for i in range(n):
  print(ans[i])


Fixed submission:
A, B = map(int, input().split())
r = (A + B) % 24
print(int(r))
Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

ans = [None]*n
for s in students:
  tmp = [None]*m
  for p in points:
    tmp[p] = abs(students[s][0] - points[p][0]) + abs(students[s][1] - points[p][1])
  ans[s] = tmp.index(min(tmp))
for i in range(n):
  print(ans[i])


Fixed submission:
n, m = map(int,input().split())
students = [None]*n
points = [None]*m
for i in range(n):
  students[i] = tuple(map(int,input().split()))
for i in range(m):
  points[i] = tuple(map(int,input().split()))

ans = []
for s in students:
  tmp = []
  for p in points:
    tmp.append(abs(s[0] - p[0]) + abs(s[1] - p[1]))
  ans.append(tmp.index(min(tmp)) + 1)
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
from functools import reduce
from operator import mul
def prime_dec(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

n = int(input())
ps = prime_dec(n)
ps_com = []
for i in range(len(ps)):    
    ps_com += set(combinations(ps, i))
divs = [reduce(mul, k) for k in ps_com if not len(k) == 0]
divs_twin = [(k, int(n/k)) for k in divs]
divs_twin = set(divs_twin)
divs_twin_len = [max(len(str(k[0])) ,len(str(k[1])))  for k in divs_twin]

print(min(divs_twin_len))



Fixed submission:
from itertools import combinations
from functools import reduce
from operator import mul
def prime_dec(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(n)
  return table

n = int(input())
ps = prime_dec(n)
ps = [1] if len(ps) == 0 else ps
ps_com = []
for i in range(len(ps)):    
    ps_com += set(combinations(ps, i+1))
divs = [reduce(mul, k) for k in ps_com if not len(k) == 0]
divs_twin = [(k, int(n/k)) for k in divs]
divs_twin = set(divs_twin)
divs_twin_len = [max(len(str(k[0])) ,len(str(k[1])))  for k in divs_twin]

print(min(divs_twin_len))
Buggy python submission (verdict: Runtime Error):
n = int(input())
r = 1
w = 10**9 + 7
for i in range(n):
  r = (r * i) % x
  
print(r)

Fixed submission:
n = int(input())
r = 1
w = 10**9 + 7
for i in range(1, n+1):    
  r *= i
  r = (r % w)
  
  
  
print(r)

Buggy python submission (verdict: Runtime Error):
n = int(input())
r = 1
w = 10**9 + 7
for i in range(n):
  r = r * i / x
  
print(r)

Fixed submission:
n = int(input())
r = 1
w = 10**9 + 7
for i in range(1, n+1):    
  r *= i
  r = (r % w)
  
  
  
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())

l1 = [i for i in range(K+1)]
r = 0
for i in l1:
  for j in l1:
    if S - i - j in l1:
      r += 1
print(r)

Fixed submission:
K, S = map(int,input().split())
 
l1 = tuple([i for i in range(K+1)])
r = 0
for i in l1:
  if i > S:
    continue
  else:
    for j in l1:
      if i + j > S:
        continue
      elif S - i - j <= K:        
        r += 1
print(r)