Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

N, M, K = map(int, input().split())

result = 0
mod = 998244353

for k in range(K + 1):
    c = cmb(N - 1, k) % mod
    m = M % mod
    n = pow(M - 1, N - k - 1, mod) % mod
    result = (result + c * m * n) % mod

print(result)


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

result = 0
p = 998244353
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

for k in range(K + 1):
    c = cmb(N - 1, k, p)
    m = M % p
    n = pow(M - 1, N - k - 1, p)
    result = (result + c * m * n) % p

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

def cmb(n, r):
    r = min(n - r, r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under
  
N, M, K = map(int, input().split())

result = 0
mod = 998244353

for k in range(K + 1):
    c = cmb(N - 1, k) % mod
    m = M % mod
    n = (M - 1) ** (N - k - 1) % mod
    result = (result + c * m * n) % mod

print(result)

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

result = 0
p = 998244353
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

for k in range(K + 1):
    c = cmb(N - 1, k, p)
    m = M % p
    n = pow(M - 1, N - k - 1, p)
    result = (result + c * m * n) % p

print(result)
Buggy python submission (verdict: Runtime Error):
N, N, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

abcd.sort()
total = 0

for i in range(2 ** Q):
    now = str(format(i, 'b')).zfill(Q)
    A = [-1] * N
    flag = 0
    tmp = 0
    for j in range(Q):
        if now[j] == '1':
            mi = abcd[j][0] - 1
            ma = abcd[j][1] - 1
            if A[mi] == -1:
                A[mi] = 0
            if A[ma] == -1:
                A[ma] = A[mi] + abcd[j][2]
            elif A[ma] != A[mi] + abcd[j][2]:
                flag = 1
                break
            tmp += abcd[j][3]
    if tmp > total:
        total = tmp
print(total)

Fixed submission:
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

A = [0] * N
A[0] = 1
result = []


def dfs(d, n, A):
    # 深さがNを超えるか、数字がMを超えたらreturn
    if d > N or n > M:
        return
    # 深さdの数字にnを入力
    A[d - 1] = n

    # 最深まで値が入ったら総和を計算
    if d == N:
        total = 0
        for i in range(Q):
            ai = abcd[i][0]
            bi = abcd[i][1]
            ci = abcd[i][2]
            di = abcd[i][3]
            if A[bi - 1] - A[ai - 1] == ci:
                total += di
        result.append(total)

    dfs(d + 1, n, A)
    dfs(d, n + 1, A)


dfs(2, 1, A)

print(max(result))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

n = len(S)

modlist = [0] * 2019
num = 0

for i in range(n):
    fig = int(S[n - i - 1])
    num = (num + fig * (10 ** i)) % 2019
    modlist[num] = modlist[num] + 1

result = 0
if modlist[0] > 0:
    result += 1

for i in range(2019):
    m = modlist[i]
    if n != 0:
        result += m * (m - 1) / 2

print(int(result))

Fixed submission:
S = input()

n = len(S)

medalist = [0] * 2019
medalist[0] = 1
num = 0
mods = 1

for i in range(n):
    fig = int(S[n - i - 1])
    num = (num + fig * mods) % 2019
    medalist[num] = medalist[num] + 1
    mods = (mods * 10) % 2019

result = 0

for i in range(2019):
    m = medalist[i]
    if m != 0:
        result += m * (m - 1) / 2

print(int(result))

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

n = len(S)

modlist = [0] * 2019
num = 0

for i in range(n):
    fig = int(S[n - i - 1])
    num += (fig * (10 ** i)) % 2019
    modlist[num % 2019] = modlist[num % 2019] + 1

result = 0
if modlist[0] > 0:
    result += 1

for i in range(2019):
    if modlist[i] != 0:
        result += modlist[i] * (modlist[i] - 1) / 2

print(int(result))

Fixed submission:
S = input()

n = len(S)

medalist = [0] * 2019
medalist[0] = 1
num = 0
mods = 1

for i in range(n):
    fig = int(S[n - i - 1])
    num = (num + fig * mods) % 2019
    medalist[num] = medalist[num] + 1
    mods = (mods * 10) % 2019

result = 0

for i in range(2019):
    m = medalist[i]
    if m != 0:
        result += m * (m - 1) / 2

print(int(result))

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

n = len(S)

modlist = [0] * 2019
num = 0

for i in range(n):
    fig = int(S[n - i - 1])
    num += (fig * (10 ** i)) % 2019
    modlist[num % 2019] = modlist[num % 2019] + 1

result = 0
if modlist[0] > 0:
    result += 1

for i in range(2019):
    if modlist[i] != 0:
        result += modlist[i] * (modlist[i] - 1) / 2

print(int(result))

Fixed submission:
S = input()

n = len(S)

medalist = [0] * 2019
medalist[0] = 1
num = 0
mods = 1

for i in range(n):
    fig = int(S[n - i - 1])
    num = (num + fig * mods) % 2019
    medalist[num] = medalist[num] + 1
    mods = (mods * 10) % 2019

result = 0

for i in range(2019):
    m = medalist[i]
    if m != 0:
        result += m * (m - 1) / 2

print(int(result))

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

n = len(S)

modlist = [0] * 2019
num = 0

for i in range(n):
    fig = int(S[n - i - 1])
    num += fig * (10 ** i)
    modlist[num % 2019] = modlist[num % 2019] + 1

result = 0
if modlist[0] > 0:
    result += 1

for i in range(2019):
    if modlist[i] != 0:
        result += modlist[i] * (modlist[i] - 1) / 2

print(int(result))

Fixed submission:
S = input()

n = len(S)

medalist = [0] * 2019
medalist[0] = 1
num = 0
mods = 1

for i in range(n):
    fig = int(S[n - i - 1])
    num = (num + fig * mods) % 2019
    medalist[num] = medalist[num] + 1
    mods = (mods * 10) % 2019

result = 0

for i in range(2019):
    m = medalist[i]
    if m != 0:
        result += m * (m - 1) / 2

print(int(result))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

result = 0
mod = 10 ** 9 + 7

for i in range(K, N + 2):
    first = 0
    second = 0
    for j in range(i):
        first += j
        second += N - j
    result = (result + second - first + 1) % mod

print(result)

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

first = 0
second = 0
result = 0
mod = 10 ** 9 + 7

for i in range(K):
    first += i
    second += N - i

result = (result + second - first + 1) % mod

for i in range(K, N + 1):
    first += i
    second += N - i
    result = (result + second - first + 1) % mod

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

dp_g = A[1]
dp_k = A[0]
dp = [0, max(dp_g, dp_k), max(dp_g, dp_k, A[2])]

for i in range(3, N):
    if i % 2 == 1:
        dp_g = max(dp_k, dp_g) + A[i]
        dp_k += A[i - 1]
        dp.append(max(dp_g, dp_k))
    elif i % 2 == 0:
        dp.append(max(dp[i - 1], dp[i - 2] + A[i]))

print(dp[N - 1])

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

dp_g = A[1]
dp_k = A[0]
dp = [0, max(dp_g, dp_k)]

for i in range(2, N):
    if i % 2 == 1:
        dp_g = max(dp_k, dp_g) + A[i]
        dp_k += A[i - 1]
        dp.append(max(dp_g, dp_k))
    elif i % 2 == 0:
        dp.append(max(dp[i - 1], dp[i - 2] + A[i]))

print(dp[N - 1])
Buggy python submission (verdict: Runtime Error):
    s = input()
    if s[0] == s[1] and s[1] == s[2]:
        print("No")
    else:
        print("Yes")


Fixed submission:
s = input()
if s[0] == s[1] and s[1] == s[2]:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

List.sort()

for i in range(N-1):
    if List[i] == List[i+1]:
        result = 'NO'
        break
        
print(result)

Fixed submission:
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

List.sort()
result = 'YES'

for i in range(N-1):
    if List[i] == List[i+1]:
        result = 'NO'
        break
        
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

#for i in range(N):
#    List[i].append(List[i][0] / List[i][1])
    
#List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])

Fixed submission:
import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

#for i in range(N):
#    List[i].append(List[i][0] / List[i][1])
    
#List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])

Buggy python submission (verdict: Time Limit Exceeded):
import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

for i in range(N):
    List[i].append(List[i][0] / List[i][1])
    
List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])

Fixed submission:
import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

#for i in range(N):
#    List[i].append(List[i][0] / List[i][1])
    
#List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])
Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())

prime_L = prime_factorize(N)
n = len(prime_L)
sum = 10 ** 13

for i in range(2 ** n):
    bit = str(format(i, 'b')).zfill(n)
    total_a = 1
    total_b = 1
    for j in range(n):
        if bit[j] == '0':
            total_a = total_a * prime_L[j]
        elif bit[j] == '1':
            total_b = total_b * prime_L[j]
    if total_a + total_b - 2 < sum:
        sum = total_a + total_b - 2
print(sum)


Fixed submission:
import  math

N = int(input())

root = int(math.sqrt(N))
sum = 10 ** 13

for i in range(1, root + 2):
    if N % i == 0 and int(N / i) + i - 2 < sum:
        sum = int(N / i) + i - 2

print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())

prime_L = prime_factorize(N)
n = len(prime_L)
sum = 10 ** 13

for i in range(2 ** n):
    bit = str(format(i, 'b')).zfill(n)
    total_a = 1
    total_b = 1
    for j in range(n):
        if bit[j] == '0':
            total_a = total_a * prime_L[j]
        elif bit[j] == '1':
            total_b = total_b * prime_L[j]
    if total_a + total_b - 2 < sum:
        sum = total_a + total_b - 2
print(sum)


Fixed submission:
import  math

N = int(input())

root = int(math.sqrt(N))
sum = 10 ** 13

for i in range(1, root + 2):
    if N % i == 0 and int(N / i) + i - 2 < sum:
        sum = int(N / i) + i - 2

print(sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

result = []

for i in range(N):
    result.append([A[i], i + 1])

result.sort()
print(result *)

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

result = []

for i in range(N):
    result.append([A[i], i + 1])

result.sort()
li = []

for i in range(N):
    li.append(result[i][1])

print(*li)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input()) # 数字を変数に格納

result = 0

for i in range(N-1):
    result += (i+1)

print(result)

Fixed submission:
N = int(input())

if N % 2 == 0:
    result = N // 2
    result = result * (N - 1)
elif N % 2 == 1:
    result = (N - 1) // 2
    result = result * N

print(result)
Buggy python submission (verdict: Runtime Error):
import math

def lcm(a, b):
    return a * b / math.gcd(a, b)

A, B, C, D = map(int, input().split())
total = B - A + 1
CD = lcm(C, D)

C_count = math.floor(B / C) - math.floor(A / C)
if (A % C) == 0:
    C_count += 1
D_count = math.floor(B / D) - math.floor(A / D)
if (A % D) == 0:
    D_count += 1
CD_count = math.floor(B / CD) - math.floor(A / CD)
if (A % CD) == 0:
    CD_count += 1

result = total - C_count - D_count + CD_count

print(result)


Fixed submission:
import fractions

def lcm(a, b):
    return a * b // fractions.gcd(a, b)

A, B, C, D = map(int, input().split())
total = B - A + 1
CD = lcm(C, D)

C_count = B//C - (A-1)//C
D_count = B//D - (A-1)//D
CD_count = B//CD - (A-1)//CD

result = total - C_count - D_count + CD_count

print(result)
Buggy python submission (verdict: Runtime Error):
N, X = map(int,input().split()) # 複数の数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

count = 0
point = 0

while point <= X:
    point += List[count]
    count += 1

print(count)

Fixed submission:
N, X = map(int,input().split()) # 複数の数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

count = 1
point = 0

while point <= X and count <= N:
    point += List[count-1]
    if point <= X:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N, A, B, C, D = map(int,input().split())
S = input()

flag = 0

if D > C:
    for i in range(D-B-2):
        if S[B+i] == '#' and S[B+i+1] == '#':
            print('No')
            flag = 1
            break
    if flag == 0:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 1
                break        
        if flag == 0:
            print('Yes')
else:
    count = 0
    for i in range(D-B+3):
        if S[B-2+j] == '.':
            count += 1
        else:
            count = 0
        if count == 3:
            flag = 1
            break
    if flag == 0:
        print('No')
    else:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 0
                break        
        if flag == 1:
            print('Yes')
        
        

Fixed submission:
N, A, B, C, D = map(int,input().split())
S = input()

flag = 0

if D > C:
    for i in range(D-B-2):
        if S[B+i] == '#' and S[B+i+1] == '#':
            print('No')
            flag = 1
            break
    if flag == 0:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 1
                break        
        if flag == 0:
            print('Yes')
else:
    count = 0
    for i in range(D-B+3):
        if S[B-2+i] == '.':
            count += 1
        else:
            count = 0
        if count == 3:
            flag = 1
            break
    if flag == 0:
        print('No')
    else:
        for j in range(C-A-2):
            if S[A+j] == '#' and S[A+j+1] == '#':
                print('No')
                flag = 0
                break        
        if flag == 1:
            print('Yes')
Buggy python submission (verdict: Runtime Error):
s = input()
count = 0

for i in range(len(s)):
    if s[i] = 'x':
        count += 1
if count >= 8:
    print("YES")
else:
    print("NO")

Fixed submission:
s = input()
count = 0

for i in range(len(s)):
    if s[i] == 'x':
        count += 1
if count >= 8:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
N, Q = map(int,input().split())
List_S = [list(map(int,input().split())) for i in range(N)]
List_D = [int(input()) for i in range(Q)]

List_S.sort(key=lambda x:x[2])

for i in range(Q):
    flag = 0
    for j in range(N):
        if (List_S[j][0]-0.5 < (List_D[i] + List_S[j][2])) and ((List_D[i] + List_S[j][2]) < List_S[j][1]-0.5):
            print("{}".format(List_S[j][2]))
            flag = 1
            break
    if flag == 0:
        print("-1")

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

p = A*3 + P
result = int(p / 2)
print("{}".format(result))
Buggy python submission (verdict: Runtime Error):
N = int(input())
List = [list(map(int,input().split())) for i in range(N)]

for i in range(N):
    List[i].append(i+1)
List.sort(key=lambda x:x[1], reverse=True)
List.sort(key=lambda x:x[0])
for i in range(N):
    print("{}".format(List[i][2]))

Fixed submission:
N = int(input())
List = [list(map(str,input().split())) for i in range(N)]

for i in range(N):
    List[i].append(i+1)
    List[i][1] = int(List[i][1])
List.sort(key=lambda x:x[1], reverse=True)
List.sort(key=lambda x:x[0])
for i in range(N):
    print("{}".format(List[i][2]))
Buggy python submission (verdict: Runtime Error):
mi = 1
ma = N

for i in range(M):
    if mi < List[i][0]:
        mi = List[i][0]
    if ma > List[i][1]:
        ma = List[i][1]

diff = ma - mi + 1
if diff < 0:
    diff = 0
print("{}".format(diff))

Fixed submission:
N, M = map(int,input().split())
List = [list(map(int,input().split())) for i in range(M)]

mi = 1
ma = N

for i in range(M):
    if mi < List[i][0]:
        mi = List[i][0]
    if ma > List[i][1]:
        ma = List[i][1]

diff = ma - mi + 1
if diff < 0:
    diff = 0
print("{}".format(diff))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)

A.sort()
B.sort()
C.sort()

i, j, k = 0, 0, 0
count = 0
total = []
result = 0

while i < N:
    while C[i] > B[j] and j < N:
        while B[j] > A[k] and k < N:
            count += 1
            k += 1
        total.append(count)
        j += 1
    result += sum(total)
    i += 1

print(result)

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

A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)

A.sort()
B.sort()
C.sort()

i, j, k = 0, 0, 0
count = 0
total = 0
result = 0

while i < N:
    while C[i] > B[j] and j < N:
        while B[j] > A[k] and k < N:
            count += 1
            k += 1
        total += count
        j += 1
    result += total
    i += 1

print(result)

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

A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)

A.sort()
B.sort()
C.sort()

i, j, k = 0, 0, 0
count = 0
total = []
result = 0

while i < N:
    while C[i] > B[j] and j < N:
        while B[j] > A[k] and k < N:
            count += 1
            k += 1
        total.append(count)
        j += 1
    result += sum(total)
    i += 1

print(result)

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

A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)

A.sort()
B.sort()
C.sort()

i, j, k = 0, 0, 0
count = 0
total = 0
result = 0

while i < N:
    while C[i] > B[j] and j < N:
        while B[j] > A[k] and k < N:
            count += 1
            k += 1
        total += count
        j += 1
    result += total
    i += 1

print(result)
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()
if a > 3200:
  print(s)
else:
  print('red')

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
x = int(input())
j = x.split()
a = j[0]
b = j[1]
print(max((a+b),(a-b),(a*b)))

Fixed submission:
x = str(input())
j = x.split()
a = int(j[0])
b = int(j[1])
print(max((a+b),(a-b),(a*b)))
Buggy python submission (verdict: Runtime Error):
A,B,C=int(input().split())
if A==B and B==C:
  print("YES")
else:
  print("NO")

Fixed submission:
A=list(map(int,input().split()))
if A[0]==A[1] and A[1]==A[2] and A[0]>0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
        else:
            temp*=2
            L.append(temp)
    else:
        temp = 0
print(int(math.log2(max(L))+1))

Fixed submission:
S = input()
s = len(S)
L = []
temp = 0
for i in range(s):
    if S[i]=='A' or S[i]=='T' or S[i]=='G' or S[i]=='C':
        if temp ==0:
            temp=1
            L.append(temp)
        else:
            temp*=10
            L.append(temp)
    else:
        temp = 0
L.append(-1)        
if len(L)==2 and L[0]==0:
    P=0
elif len(L)==1:
    P=0
else:
    P = len(str(max(L)))
print(P)
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = input()
a = [list(map(int,input().split())) for i in range(Q)]
p = []
for i in range(N-1):
    if S[i]=='A' and S[i+1]=='C':
        p.append(1)
    else:
        p.append(0)
for j in range(Q):
    print(p[a[j][0]-1:a[j][1]-1].count(1))

Fixed submission:
N,Q = map(int,input().split())
S = input()
a = [list(map(int,input().split())) for i in range(Q)]
p = [0]
q=0
for i in range(N-1):
    if S[i]=='A' and S[i+1]=='C':
        q+=1
        p.append(q)
    else:
        p.append(p[i])
for j in range(Q):
    
    print(p[a[j][1]-1]-p[a[j][0]-1])