Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03014 (python)

Fixed submission:
H, W = map( int, input().split())
S = [["#"]*(W+2)]+[ "#"+input()+"#" for _ in range(H)]+ [["#"]*(W+2)]
H += 2
W += 2
L = [[0]*(W+2) for _ in range(H+2)]
R = [[0]*(W+2) for _ in range(H+2)]
D = [[0]*(W+2) for _ in range(H+2)]
U = [[0]*(W+2) for _ in range(H+2)]
cnt = 0

for i in range(1,H-1):
    for j in range(W):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            R[i][j] = cnt
            
for i in range(1,H-1):
    for j in range(W-1,-1,-1):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            L[i][j] = cnt

for j in range(1,W-1):
    for i in range(H):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            D[i][j] = cnt

for j in range(1,W-1):
    for i in range(H-1,-1,-1):
        if S[i][j] == "#":
            cnt = 0
        else:
            cnt += 1
            U[i][j] = cnt

ans = 0
for i in range(1,H-1):
    for j in range(1,W-1):
        if ans < L[i][j] + R[i][j] + U[i][j] + D[i][j]:
            ans =  L[i][j] + R[i][j] + U[i][j] + D[i][j]
print(ans-3)

Buggy submission (verdict: Runtime Error):
H, W = map( int, input().split())
d = dict()
S = [["#"]*(W+2)]+[ "#"+input()+"#" for _ in range(H)]+ [["#"]*(W+2)]
H += 2
W += 2
L = [[0]*(W+2) for _ in range(H+2)]
R = [[0]*(W+2) for _ in range(H+2)]
D = [[0]*(W+2) for _ in range(H+2)]
U = [[0]*(W+2) for _ in range(H+2)]
cnt = 0
for i in range(W):
    d[(0,j)] = 1
    d[(H-1,j)] = 1
for i in range(1,H-1):
    for j in range(W):
        if S[i][j] == "#":
            d[(i,j)] = 1
            cnt = 0
        else:
            d[(i,j)] = 0
            cnt += 1
            R[i][j] = cnt
            
for i in range(1,H-1):
    for j in range(W-1,-1,-1):
        if d[(i,j)] == 1:
            cnt = 0
        else:
            cnt += 1
            L[i][j] = cnt

for j in range(1,W-1):
    for i in range(H):
        if  d[(i,j)] == 1:
            cnt = 0
        else:
            cnt += 1
            D[i][j] = cnt

for j in range(1,W-1):
    for i in range(H-1,-1,-1):
        if d[(i,j)] == 1:
            cnt = 0
        else:
            cnt += 1
            U[i][j] = cnt

ans = 0
for i in range(1,H-1):
    for j in range(1,W-1):
        if ans < L[i][j] + R[i][j] + U[i][j] + D[i][j]:
            ans =  L[i][j] + R[i][j] + U[i][j] + D[i][j]
print(ans-3)
Problem p03063 (python)

Fixed submission:
N = int( input())
S = input()
C = [0]*(N+1)
for i in range(N):
    if S[i] == ".":
        C[i+1] = C[i]
    else:
        C[i+1] = C[i] + 1
b = C[N]
w = N - b
ans = w
for i in range(N):
    if C[i+1] + N - i - 1 -b + C[i+1] < ans:
        ans = C[i+1] + N - i - 1 -b + C[i+1]
print(ans)

Buggy submission (verdict: Runtime Error):
def factors(z):
    ret = []
    for i in range(2, int(z**(1/2))+1):
        if z%i == 0:
            ret.append(i)
            while z%i == 0:
                z //= i
    if z != 1:
        ret.append(z)
    return ret

def eratosthenes(N):
    from collections import deque
    work = [True] * (N+1)
    work[0] = False
    work[1] = False
    ret = []
    for i in range(N+1):
        if work[i]:
            ret.append(i)
            for j in range(2* i, N+1, i):
                work[j] = False
    return ret

N = int( input())
A = [ int( input()) for _ in range(N+1)]
Primes = eratosththenes(N)
ANS = []
F = factors( abs(A[0]))
for f in F:
    if f >= N+1:
        Primes.append(f)
for p in Primes:
    if p >= N+1:
        check = 1
        for i in range(N+1): # f が恒等的に 0 であるかどうかのチェック
            if A[i]%p != 0:
                check = 0
                break
        if check == 1:
            ANS.append(p)
    else:
        poly = [0]*(p-1)
        for i in range(N+1): # フェルマーの小定理
            poly[(N-i)%(p-1)] = (poly[(N-i)%(p-1)] + A[i])%p
        check = 0
        if sum(poly) == 0 and A[N]%p == 0: # a_0 が 0 かつ、g が恒等的に 0 であることをチェックしている
            check = 1
        if check == 1:
            ANS.append(p)
for ans in ANS:
    print(ans)
Problem p03095 (python)

Fixed submission:
N = int( input())
S = input()
Q = 10**9+7
A = [1]*26
ANS = [0]*26
for i in range(N):
    s = ord(S[i]) - ord("a")
    ans = 1
    for j in range(26):
        if j != s:
            ans *= A[j]
            ans %= Q
    ANS[j] = (ANS[j] + ans)%Q
    A[s] += 1
print( sum(ANS))

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int( input())
S = int( input())
Q = 10**9+7
C = Counter(S)
ans = 1
for c in C:
    ans *= C[c]+1
    ans %= Q
print((ans-1)%Q)
Problem p03251 (python)

Fixed submission:
N, M, X, Y = map( int, input().split())
x = max( list( map( int, input().split())))
y = min( list( map( int, input().split())))
if max(x, X)+1 <= min( y, Y):
    print('No War')
else:
    print('War')

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  int x[N], y[M];
  for (int i = 0; i < N; ++i) {
    cin >> x[i];
  }
  for (int i = 0; i < M; ++i) {
    cin >> y[i];
  }
  for (int i = 0; i < N; ++i) {
    if (X < x[i]) X = x[i];
  }
  for (int i = 0; i < M; ++i) {
    if (Y > y[i]) Y = y[i];
  }
  if (X < Y) {
    cout << "No war" << "\n";
  }
  else {
    cout << "War" << "\n";
  }

  return 0;
}
Problem p03261 (python)

Fixed submission:
N = int(input())
W = input()
L = []
L.append(W)
last = W[-1]
ans = 'Yes'
for _ in range(N-1):
    w = input()
    if w in L:
        ans = 'No'
    if last == w[0]:
        last = w[-1]
        L.append(w)
    else:
        ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
4
hoge
english
hoge
enigma
Problem p03280 (python)

Fixed submission:
A, B = map( int, input().split())
print(A*B - A - B + 1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M, Q = map( int, input().split())
NN = [ [ 0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L, R = map( int, input().split())
    NN[L][R] += 1
Sum = [ [ 0 ] for _ in range(N+1)]
for i in range(1,N+1):
    for j in range(1,N+1):
        Sum[i].append(Sum[i][-1]+NN[i][j])
for _ in range(Q):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p,q+1):
        ans += Sum[i][q] - Sum[i][p-1]
    print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print(A*B - A - B + 1)
Problem p03283 (python)

Fixed submission:
N, M, Q = map( int, input().split())
NN = [ [0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    L, R = map( int, input().split())
    NN[L][R] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        NN[i][j] += NN[i][j-1]+NN[i-1][j]-NN[i-1][j-1]
for _ in range(Q):
    p, q = map( int, input().split())
    print(NN[q][q]-NN[q][p-1]-NN[p-1][q]+NN[p-1][p-1])

Buggy submission (verdict: Runtime Error):
N, M, Q = map( int, input().split())
NN = [ [0]*N for _ in range(N)]
for _ in range(M):
    L, R = map( int, input().split())
    NN[L-1][R-1] += 1

for i in range(1,N+1):
    for j in range(1,N+1):
        NN[i][j] += NN[i][j-1]+NN[i-1][j]+NN[i-1][j]-NN[i-1][j-1]
for _ in range(Q):
    p, q = map( int, input().split())
    print(NN[p-1][q-1])

Buggy submission (verdict: Runtime Error):
N, M, Q = map( int, input().split())
NN = [ [ 0 for _ in range(N)] for _ in range(N)]
for _ in range(M):
    L, R = map( int, input().split())
    NN[L-1][R-1] += 1

for i in range(1,N):
    for j in range(1,N):
        NN[j][j+1] += NN[j][j+i-1] + NN[j+1][i+j] - NN[j+1][j+i-1]
for _ in range(Q):
    p, q = map( int, input().split())
    print(NN[p-1][q-1])
Problem p03297 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return(a)

T = int(input())
for i in range(T):
    A,B,C,D = map(int,input().split())
    if B > D:
        print('No')
    elif A < B:
        print('No')
    elif C + 1 >= B:
        print('Yes')
    else:
        q = gcd(B,D)
        r = (A-C)%q
        if r == 0:
            r = q
        if C + r >= B:
            print('Yes')
        else:
            print('No')

Buggy submission (verdict: Runtime Error):
import math
T = int(input())
for i in range(T):
    A,B,C,D = map(int,input().split())
    if B > D:
        print('No')
    elif A < B:
        print('No')
    elif C + 1 >= B:
        print('Yes')
    else:
        r = (A-C)%math.gcd(B,C)
        if C + r >= B:
            print('Yes')
        else:
            print('No')
Problem p03304 (python)

Fixed submission:
n, m, d = map(int, input().split())
if d == 0:
    C = n
else:
    C = 2*(n-d)
print(C*(m-1)/n**2)

Buggy submission (verdict: Runtime Error):
n, m , d = map(int, input().split())
A = [0]*n
for i in range(1,m):
    B = A
    A = [0]*n
    for j in range(n):
        for k in range(n):
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] = B[j] + 2
            elif k + 1 - d >= 0 and k + 1 + d > n:
                A[j] = B[j] + 1
            elif k + 1 - d < 0 and k + 1 + d <= n:
                A[j] = B[j] + 1
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] += 2
            elif k + 1 - d >= 0 and k + 1 + d > n:
                A[j] += 1
            elif k + 1 - d < 0 and k + 1 + d <= n:
                A[j] += 1
print(sum(A)/(n**m))

Buggy submission (verdict: Runtime Error):
n, m , d = map(int, input().split())
A = [0]*n
for i in range(1,m):
    B = A
    A = [0]*n
    for j in range(n):
        for k in range(n):
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] = B[j] + 2
            elif k + 1 - d >= 0 or k + 1 + d > n:
                A[j] = B[j] + 1
            elif k + 1 - d < 0 or k + 1 + d <= n:
                A[j] = B[j] + 1
            if k + 1 - d >= 0 and k + 1 + d <= n:
                A[j] += 2
            elif k + 1 - d >= 0 or k + 1 + d > n:
                A[j] += 1
            elif k + 1 - d < 0 or k + 1 + d <= n:
                A[j] += 1
print(sum(A)/(n**m))
Problem p03305 (python)

Fixed submission:
import heapq

n, m, s, t = map( int, input().split())

def dijkstra(graph, start):
    dist = [ 10**14 for _ in range(n)]
    dist[start] = 0
    q = [(0,start)]
    while q:
        l, v = heapq.heappop(q)
        if dist[v] < l:
            continue
        for u, d in graph[v].items():
            if dist[u] > l+d:
                dist[u] = l+d
                heapq.heappush(q, (dist[u], u))
    return dist

D_yen = [ dict() for _ in range(n)]
D_snuuk = [ dict() for _ in range(n)]
for _ in range(m):
    u, v, a, b = map( int, input().split())
    u, v = u-1, v-1
    D_yen[u][v] = D_yen[v][u] = a
    D_snuuk[u][v] = D_snuuk[v][u] = b

C_yen = dijkstra(D_yen, s-1)
C_snuuk = dijkstra(D_snuuk, t-1)
ans = 10**15
ANS = [ 0 for _ in range(n)]
for i in range(n):
    ans = min( ans, C_yen[n-1-i] + C_snuuk[n-1-i])
    ANS[n-1-i] = ans
for i in range(n):
    print(10**15 - ANS[i])

Buggy submission (verdict: Runtime Error):
import heapq
from itertools import accumulate

n, m, s, t = map( int, input().split())

def dijkstra(graph, start):
    dist = [ 10**14 for _ in range(n)]
    dist[start] = 0
    q = [(0,start)]
    while q:
        l, v = heapq.heappop(q)
        if dist[v] < l:
            continue
        for u, d in graph[v].items():
            if dist[u] > l+d:
                dist[u] = l+d
                heapq.heappush(q, (dist[u], u))
    return dist

D_yen = [ dict() for _ in range(n)]
D_snuuk = [ dict() for _ in range(n)]
for _ in range(m):
    u, v, a, b = map( int, input().split())
    u, v = u-1, v-1
    D_yen[u][v] = D_yen[v][u] = a
    D_snuuk[u][v] = D_snuuk[v][u] = b

C_yen = dijkstra(D_yen, s-1)
C_snuuk = dijkstra(D_snuuk, t-1)

ANS = list( accumulate( [y+s for y, s in zip( C_yen, C_snuuk])[::-1], min))
[ print( 10**15 - ANS[i]) for i in range(n-1,-1,-1)]
Problem p03309 (python)

Fixed submission:
from statistics import median
import math
N = int(input())
*A, = map(int, input().split())
B = [A[i]-i for i in range(N)]
b = median(B)
bm = math.floor(b)
K = [x - bm for x in B]
KZ = [abs(x) for x in K]
Z = sum(KZ)
for i in range(20):
    C = [abs(x-i+10) for x in K]
    Z = min([sum(C),Z])
print(int(Z))

Buggy submission (verdict: Runtime Error):
from statistics import mean
import math
N = int(input())
*A, = map(int, input().split())
B = [A[i]-i for i in range(N)]
bm = math.median(B)
K = [x - bm for x in B]
KZ = [abs(x) for x in K]
Z = sum(KZ)
for i in range(200):
    C = [abs(x-i+100) for x in K]
    Z = min([sum(C),Z])
print(int(Z))

Buggy submission (verdict: Runtime Error):
from statistics import mean
import math
N = int(input())
*A, = map(int, input().split())
B = [A[i]-i for i in range(N)]
bm = median(B)
K = [x - bm for x in B]
KZ = [abs(x) for x in K]
Z = sum(KZ)
for i in range(200):
    C = [abs(x-i+100) for x in K]
    Z = min([sum(C),Z])
print(int(Z))
Problem p03310 (python)

Fixed submission:
from itertools import accumulate

N = int( input())
A = list( map( int, input().split()))
a, b = 0, 2
ans = 10**9 + 1
S = list(accumulate(A))
for i in range(1,N-2):
    while S[a] < S[i] - S[a+1]:
        a += 1
    b = max(b,i+1)
    while S[b] - S[i] < S[-1] - S[b+1]:
        b += 1
    ans = min( ans, max(S[a], S[i] - S[a], S[b] - S[i], S[-1] - S[b]) - min(S[a], S[i] - S[a], S[b] - S[i], S[-1] - S[b]))
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

N = int( input())
A = list( map( int, input().split()))
a, b = 0, 2
ans = 10**9 + 1
S = list(accumulate(A))
for i in range(1,N-1):
    while S[a] < S[i] - S[a+1]:
        a += 1
    b = max(b,i+1)
    while S[b] - S[i] < S[-1] - S[b+1]:
        b += 1
    ans = min( ans, max(S[a], S[i] - S[a], S[b] - S[i], S[-1] - S[b]) - min(S[a], S[i] - S[a], S[b] - S[i], S[-1] - S[b]))
print(ans)
Problem p03340 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
r = 0
now = 0
ans = 0
for i in range(N):
    while N > r:
        if now & A[r] != 0:
            break
        now += A[r]
        r += 1
    now -= A[i]
    ans += r-i
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
r = 0
now = 0
ans = 0
for i in range(N):
    while N > r:
        if now & A[r] != 0:
            break
        now += A[r]
        r += 1
    s -= A[i]
    ans += r-i
print(ans)
Problem p03360 (python)

Fixed submission:
A, B, C = map( int, input().split() )
K = int(input())
print(A + B + C - max(A,B,C) + max(A,B,C)*(2**K))

Buggy submission (verdict: Runtime Error):
A, B, C = map(int,inpput()split())
K = int(input())
print(A + B + C - max(A,B,C) + max(A,B,C)*(2**K))
Problem p03393 (python)

Fixed submission:
S = input()
l = len(S)
if l != 26:
    colors = [0]*26
    for i in range(l):
        colors[ ord(S[i]) - ord('a')] = 1
    for i in range(26):
        if colors[i] == 0:
            ans = S + chr( i + ord('a'))
            break
    print(ans)
elif S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    for i in range(25,0,-1):
        if S[i] > S[i-1]:
            now = i
            break
    colors = [0]*26
    for i in range(now-1):
        colors[ ord(S[i]) - ord('a')] = 1
    c = 'z'
    for i in range(now-1,26):
        if S[now-1] < S[i]:
            c = min(c, S[i])
    print(S[:now-1]+c)

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
if l != 26:
    colors = [0]*26
    for i in range(26):
        colors[ ord(S[i]) - ord('a')]
    for i in range(26):
        if colors[i] == 0:
            ans = S + chr( i + ord('a'))
            break
    print(ans)
elif S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    for i in range(25,0,-1):
        if S[i] > S[i-1]:
            now = i
            break
    print(S[:i-1] + S[-1])
Problem p03402 (python)

Fixed submission:
A, B = map( int, input().split())
Board = [ ['#']*100 for _ in range(50)] + [['.']*100 for _ in range(50)]
i = 0
nowj = 0
for _ in range(A-1):
    Board[i][nowj] = '.'
    if nowj == 98:
        nowj = 0
        i += 2
    else:
        nowj += 2
i = 51
nowj = 0
for _ in range(B-1):
    Board[i][nowj] = '#'
    if nowj == 98:
        nowj = 0
        i += 2
    else:
        nowj  += 2
print( '{} {}'.format(100, 100))
for i in range(100):
    print( ''.join(Board[i]))

Buggy submission (verdict: Runtime Error):
A, B = map( int, input().split())
Board = [ ['#']*100 for _ in range(50)] + [['.']*100 for _ in range(50)]
i = 0
nowj = 0
for _ in range(A-1):
    Board[i][nowj] = '.'
    if nowj == 100:
        nowj = 0
        i += 2
    else:
        nowj += 2

i = 51
nowj = 0
for _ in range(B-1):
    Board[i][nowj] = '#'
    if nowj == 100:
        nowj == 0
        i += 2
    else:
        nowj  += 2

for i in range(100):
    print( ''.join(Board[i]))
Problem p03476 (python)

Fixed submission:
from itertools import accumulate
V = [1]*(10**5+1)
P = [0]*(10**5+1)
V[0] = 0
V[1] = 0
for i in range(10**5+1):
    if V[i] == 0:
        continue
    P[i] = 1
    for j in range(2,10**5):
        if i*j >= 10**5:
            break
        V[i*j] = 0
W = [0]*(10**5+1)
for i in range(10**5+1):
    if not V[i]:
        continue
    if V[(i+1)//2] == 1:
        W[i] = 1
accW = list( accumulate(W))
Q = int( input())
for i in range(Q):
    l, r = map( int, input().split())
    print(accW[r] - accW[l-1])

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
V = [1]*(10**5+1)
P = [0]*(10**5+1)
V[0] = 0
V[1] = 0
for i in range(10**5+1):
    if V[i] == 0:
        continue
    P[i] = 1
    for j in range(2,10**5+1, i):
        V[i*j] = 0
W = [0]*(10**5+1)
for i in range(10**5+1):
    if not V[i]:
        continue
    if V[(i+1)//2] == 1:
        W[i] = 1
accW = list( accumulate(W))
Q = int( input())
for i in range(Q):
    l, r = map( int, input().split())
    print(accW[r] - accW[l-1])
Problem p03485 (python)

Fixed submission:
a, b = map( int, input().split())
x = (a+b+1)/2
print(int(x))

Buggy submission (verdict: Runtime Error):
a, b = map( int, input().split())
x = (a+b+1)/2
print(int(x)
Problem p03501 (python)

Fixed submission:
N, A, B = map( int, input().split())
print( min(A*N,B))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N, C = map( int, input().split())
timetable = [ [0]*(10**5+2) for _ in range(C+1)]
for _ in range(N):
    s, t, c = map( int, input().split())
    timetable[c][s-1] += 1
    timetable[c][t] -= 1
for c in range(1,C+1):
    timetable[c] = list( accumulate(timetable[c]))
ans = 0
for i in range(1,10*5+1):
    now = 0
    for c in range(1,C+1):
        if timetable[c][i] > 0:
            now += 1
    ans = max( now, ans)
print(ans)
Problem p03523 (python)

Fixed submission:
S = list(input())
T = list("AKIHABARA")
ans = "YES"
i = 0
while i < len(S) and i < 9:
    if S[i] != T[i]:
        if T[i] == "A":
            S.insert(i,"A")
    i += 1
if S[-1] != "A":
    S += "A"

if S == T:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
T = "AKIHABARA"
if S[-1] != "A":
    S += "A"
l = len(S)
t = 0
ans = "YES"
K = ""
c = 0
for i in range(9):
    if T[i] == S[t]:
        K += T[i]
        t += 1
        continue
    elif T[i] == "A":
        K += "A"
        c += 1
        continue
    else:
        ans = "NO"
        break

if T == K and c+l == 9:
    print(ans)
else:
    print("NO")
Problem p03556 (python)

Fixed submission:
N = int(input())
for i in range(N+1):
    if N < i**2:
        j = i - 1
        break
if N == 1:
    print(1)
else:
    print(j**2)

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N+1):
    if N < i**2:
        j = i - 1
        break
print(j**2)

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
    if N < i**2:
        j = i - 1
        break
print(j**2)
Problem p03609 (python)

Fixed submission:
X, t = map(int, input().split())
print(max(X-t,0))

Buggy submission (verdict: Runtime Error):
X, t = map(int, input().split())
print(max(X-t),0)
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

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

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i])
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

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

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int( input())
T = [ int( input()) for _ in range(N)]
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a
def lcm(a,b):
    return (a*b)/gcd(a,b)
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int( input())
T = [ int( input()) for _ in range(N)]
def lcm(a,b):
    return (a*b)/math.gcd(a,b)
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)
Problem p03635 (python)

Fixed submission:
n, m = map( int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = map( int, input().split())
print((n-1)*(m-1))a
Problem p03646 (python)

Fixed submission:
K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join( map( str, ANS)))

Buggy submission (verdict: Runtime Error):
K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join(ANS))
Problem p03681 (python)

Fixed submission:
Q = 10**9 + 7
'''
def factorial(n):
    if n == 0:
        return 1
    else:
        return (n * factorial(n-1))%Q
'''
N, M = map( int, input().split())
N, M = min(N, M), max(N, M)
if N == M or N+1 == M:
    NN = 1
    MM = 1
    for i in range(1,N+1):
        NN = (NN*i)%Q
    if N == M:
        ans = (2*NN*NN)%Q
    elif N+1 == M:
        ans = (NN*NN*M)%Q
else:
    ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
Q = 10**9 + 7
'''
def factorial(n):
    if n == 0:
        return 1
    else:
        return (n * factorial(n-1))%Q
'''
N, M = map( int, input().split())
N, M = min(N, M), max(N, M)
if N == M or N+1 == M:
    NN = 1
    MM = 1
    for i in range(1,N+1):
        NN = (NN*i)%Q
    if N == M:
        ans = (2*NN*NN)%Q
elif N+1 == M:
    ans = (NN*NN*M)%Q
else:
    ans = 0
print(ans)
Problem p03697 (python)

Fixed submission:
A, B = map( int, input().split())
if A+B >= 10:
    print('error')
else:
    print(A+B)

Buggy submission (verdict: Runtime Error):
A, B = map( int, input().split)
if A+B >= 10:
    print('error')
else:
    print(A+B)
Problem p03721 (python)

Fixed submission:
N, K = map( int, input().split())
A = [ [0]*2 for _ in range(N)]
for i in range(N):
    A[i] = list(map( int, input().split()))
A.sort()
L = 0
for i in range(N):
    L += A[i][1]
    if L >= K:
        print(A[i][0])
        break

Buggy submission (verdict: Runtime Error):
N, K = map( int, input().split())
A = []
for i in range(N):
    a, b = map( int, input().split())
    A += [a]*b
    A = A.sort()[:K]
print(A[K-1])