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

Fixed submission:
N = int(input())

if N < 1200:
    print('ABC')
elif 1200<= N < 2800:
    print('ARC')
else:
    print('AGC')

Buggy submission (verdict: Runtime Error):
import itertools
D, G = map(int, input().split())
P = [list(map(int, input().split())) for i in range(D)]
min_num = 10**8

judge_list = list(itertools.product([0, 1, 2], repeat=D)) #0:中途半端に解く 1:一問も解かない 2: 全部解く

for judge in judge_list:
    score = 0
    num = 0
    flag = 0
    for i in range(1, len(judge) + 1):
        if score >= G:
            break
        
        if judge[-i] == 1:
            pass
        
        if judge[-i] == 2:
            score += P[-i][0] * (D - i + 1) * 100 + P[-i][1]
            num += P[-i][0]
            
        if (judge[-i] == 0) and (flag == 0):
            for j in range(P[-i][0]):
                if score >= G:
                    break
                score += 100 * (D - i + 1)
                num += 1
            flag = 1
                        
    if score >= G:
        min_num = min(num, min_num)

print(min_num)
Problem p03337 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
min_num = 10**6


for i in range(0, N):
    num = 0
    num = sum(x == 'W' for x in S[:i]) + sum(x == 'E' for x in S[i+1:])    
    if num < min_num:
        min_num = num
        
print(min_num)
Problem p03351 (python)

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

if (abs(a-c) <= d) or (abs(a-b) <= d and abs(c-b) <= d):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
X = int(input())
max1 = 0
max2 = 0

for b in range(1, X+1):
    for q in range(2, X+1):
        if b**q >= X:
            break
        max1 = b**q
        
    if max1 > max2:
        max2 = max1
        
print(max2)
Problem p03359 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
    print(a)
else:
    print(a-1)

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
K = int(input())

l.sort()
for i in range(K):
    l[0] = 2*l[0]
    
print(l[0] + l[1] + l[2])
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
arr = input().split()
list_fee = []

for i in range(N):
    if arr == []:
        break
    if int(arr[0]) == i+1:
        list_fee.append(1)
        arr.pop(0)
    else:
        list_fee.append(0)
    
a = list_fee[:X].count(1)
b = list_fee[X:].count(1)

print(min(a, b))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
arr = input().split()
list_fee = []

for i in range(N):
    if int(arr[0]) == i:
        list_fee.append(1)
        arr.pop(0)
    else:
        list_fee.append(0)
    
a = list_fee[:X].count(1)
b = list_fee[X:].count(1)

print(min(a, b))
Problem p03379 (python)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
X = arr.copy()
arr.sort()

for i in range(N):
    if X[i] < arr[int(N/2)]:
        print(arr[int(N/2)])
    else:
        print(arr[int(N/2)-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = input().split()
arr = arr.sort()

for i in range(N):
    if i < N/2:
        print(arr[int(N/2)])
    else:
        print(arr[int(N/2)-1])
Problem p03385 (python)

Fixed submission:
S = input()
result = 'No'

if 'a' in S:
    if 'b' in S:
        if 'c' in S:
            result = 'Yes'

print(result)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

print(min(A, B) + min(C, D))
Problem p03386 (python)

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

if A+K > B:
    for i in range(A, B+1):
        print(i)

else:
    for i in range(A, A+K):
        print(i)
    
    for j in range(max(i, B-K), B):
        print(j+1)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

for i in range(A, min(A+K, B)):
    print(i)

for j in range(max(i+1, B-K+1), B+1): 
    print(j)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

for i in range(A, min(A+K, B)):
    print(i)

for j in range(max(A, B-K+1), B+1): 
    if j <= i:
        pass
    else:
        print(j)
Problem p03387 (python)

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

if (N[1] - N[0])%2 == 0:
    result = int((N[1] - N[0])/2) + N[2] - N[1]

else:
    result = int((N[1] - N[0])/2) + N[2] - N[1] + 2 

print(result)

Buggy submission (verdict: Runtime Error):
N = list(map(int, input().split()))
N.sort()

for i in range(50):
    N[0] += 2
    if N[0] == N[1]:
        result = (i + 1) + (N[2] - N[1])
        break
        
    elif N[0] + 1 == N[1]:
        result = (i + 1) + (N[2] - N[1]) + 2

print(result)
Problem p03399 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A, B) + min(C, D))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

print(min(A, B) + min(C, D))
Problem p03408 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]

M = int(input())
t = [input() for i in range(M)]

count_max = 0
for i in range(N):
    count = s.count(s[i]) - t.count(s[i])
    if count > count_max:
         count_max = count
            
print(count_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]

M = int(input())
t = [input() for i in range(M)]

count_max = 0
for i in range(N):
    count = s.count(s[i]) - t.count(s[i])
    if count > count_max:
         count_max = count
            
print(count_max)
N = int(input())
s = [input() for i in range(N)]

M = int(input())
t = [input() for i in range(M)]

count_max = 0
for i in range(N):
    count = s.count(s[i]) - t.count(s[i])
    if count > count_max:
         count_max = count
            
print(count_max)
Problem p03420 (python)

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

res = 0
    
for b in range(1, N + 1):
    res += max(b - K, 0) * (N  // b)
    res += max(N % b - K + 1, 0)
 
if K == 0:
    res -= N
print(res)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())

res = 0
    
for b in range(1, N + 1):
    res += max(b - K, 0) * (N  // b)
    res += max(N % b - K + 1, 0)
 
if k == 0:
    res -= 10
print(res)
Problem p03435 (python)

Fixed submission:
C = [list(map(int, input().split())) for i in range(3)]

a = [0]
b = []
result = 'Yes'

b.append(C[0][0])
b.append(C[0][1])
b.append(C[0][2])
a.append(C[1][0] - b[0])
a.append(C[2][0] - b[0])

for i in range(3):
    for j in range(3):
        if C[i][j] != a[i] + b[j]:
            result = 'No'
            
print(result)

Buggy submission (verdict: Runtime Error):
C = [list(map(int, input().split())) for i in range(3)]

a = [0]
b = []
result = 'Yes'

b.append(C[0][0])
b.append(C[1][0])
b.append(C[2][0])
a.append(C[1][0] - b1)
a.append(C[2][0] - b1)

for i in range(3):
    for j in range(3):
        if C[i][j] != a[i] + b[j]:
            result = 'No'
            
print(result)

Buggy submission (verdict: Runtime Error):
C1 = [list(map(int, input().split())) for i in range(3)]

a = []
b = []
result = 'Yes'

a.append(0)
b.append(C[0][0])
b.append(C[1][0])
b.append(C[2][0])
a.append(C[1][0] - b1)
a.append(C[2][0] - b1)

for i in range(3):
    for j in range(3):
        if C[i][j] != a[i] + b[j]:
            result = 'No'
            
print(result)
Problem p03438 (python)

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

a_b = 0
b_a = 0
for i in range(N):
    if A[i] > B[i]:
        a_b += A[i] - B[i]
        
    else:
        b_a += (B[i] - A[i]) // 2

if a_b <= b_a:
    print('Yes')
else:
    print('No')

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

a_b = 0
b_a = 0
for i in range(N):
    if A[i] > B[i]:
        a_b += A[i] - B[i]
        
    else
        b_a += (B[i] - A[i]) // 2

if a_b <= b_a
    print('Yes')
else:
    print('No')

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

num = 0
diff = 0
for i in range(N):
    if A[i] != B[i]:
        num += 1
        
    diff += A[i] - B[i]
    
if diff%num == 0 and diff >= 0:
    print('Yes')
else:
    print('No')
Problem p03447 (python)

Fixed submission:
X = int(input())
A = int(input())
B = int(input())

n = X - A
res = n - int(n/B)*B

print(res)

Buggy submission (verdict: Runtime Error):
X = int(input()))
A = int(input())
B = int(input())

print(X-A-B)
Problem p03455 (python)

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

if (a*b)%2 == 0:
    print('Even')

else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
package main

import "fmt"

func main() {
	var a, b int

	fmt.Scan(&a, &b)

	if (a * b)%2 == 1 {
		fmt.Println("Odd")
	} else {
		fmt.Println("Even")
	}
}

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = [ list(map(int, input().split())) for i in range(N)]
res = 'Yes'

for i in range(N-1):
    x = arr[i+1][1] - arr[i][1]
    y = arr[i+1][2] - arr[i][2]
    t = arr[i+1][0] - arr[i][0]
    
    if x+y <= t:
        if (x+y-t)%2 == 0:
            pass
        else:
            res = 'No'
            break
    else:
        res = 'No'
        break
        
print(res)
Problem p03457 (python)

Fixed submission:
N = int(input())
arr = [ list(map(int, input().split())) for i in range(N)]
arr.insert(0, [0, 0, 0])
res = 'Yes'

for i in range(N):
    x = arr[i+1][1] - arr[i][1]
    y = arr[i+1][2] - arr[i][2]
    t = arr[i+1][0] - arr[i][0]
    
    if x+y <= t:
        if (x+y-t)%2 == 0:
            pass
        else:
            res = 'No'
            break
    else:
        res = 'No'
        break
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
arr = [ list(map(int, input().split())) for i in range(N)]

for i in range(N-1):
    if (arr[i+1][1] + arr[i+1][2]) - (arr[i][1] + arr[i][2]) < arr[i+1][0] - arr[i][0]:
        if((arr[i+1][1] + arr[i+1][2]) - (arr[i][1] + arr[i][2]) - (arr[i+1][0] + arr[i][0]))%2 == 0:
            res = 'Yes'
        else:
            res = 'No'
            break
    else:
        res = 'No'
        break
        
print(res)
Problem p03469 (python)

Fixed submission:
S = input()
S = S.replace('2017', '2018')

print(S)

Buggy submission (verdict: Runtime Error):
N, H = map(int, input().split())
weapon = [list(map(int, input().split())) for _ in range(N)]

count = 0

max_atack = -1
for i in range(N):
    max_atack = max(max_atack, weapon[i][0]) 


flag = True
for i in range(N):
    if weapon[i][1] >= max_atack:
        count += 1
        H -= weapon[i][1]
        
        if H <= 0:
            flag = False
            break

if flag:
    if H % max_atack == 0:
        count += H // max_atack
    else:
        count += H // max_atack + 1


print(count)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
rx, ry, rz = -1, -1, -1

for x in range(N+1):
    for y in range(N+1-x):
        for z in range(N+1-x-y):
            if 1000*x + 5000*y + 1000*z == Y:
                rx, ry, rz = x, y, z
                break
    
print(rx, ry, rz)
Problem p03485 (python)

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

if c%2 == 0:
    print(int(c/2))
    
else:
    print(int(c/2)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()

for i in range(N-1):
    if a[i] != a[i+1]:
        count = i + 1 - count 
        if count < a[i]:
            res += count
        else:
            res += count - a[i]
        
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()
count = 1
for i in range(N-1):
    if a[i] != a[i+1]:
        count = i - count 
        if count < a[i]:
            res += count
        else:
            res += count - a[i]
        
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()

for i in range(N):
    X = a.count(i+1)
    if a[i] > N:
        res += N - i
        break
        
    elif X < i+1:
        res += X
        i = i  + X
        
    else:
        res += X - (i+1)
        i = i  + X
        
print(res)
Problem p03487 (python)

Fixed submission:
from collections import Counter
N = int(input())
a = list(map(int, input().split()))
L = list(set(a))
res = 0
d = Counter()
d.update(a)
for i in L:
    X = d[i]
    if X < i:
        res += X
    
    else:
        res += X - i

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()
k = 0
for i in range(N-1):
    if a[i] != a[i+1]:
        count = i + 1 - k
        k = count 
        
        if count < a[i]:
            res += count
        else:
            res += count - a[i]
        
for i in range(a[-1]):
    if a[-1] != a[-i]:
        res += 1
        break
        
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()

for i in range(N-1):
    if a[i] != a[i+1]:
        count = i + 1 - count 
        if count < a[i]:
            res += count
        else:
            res += count - a[i]
        
        
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
res = 0
a.sort()

for i in range(N-1):
    if a[i] != a[i+1]:
        count = i + 1 - count 
        if count < a[i]:
            res += count
        else:
            res += count - a[i]
        
        
print(res)
Problem p03524 (python)

Fixed submission:
s = input()

dic = {}
for i in range(len(s)):
  if s[i] in dic:
    dic[s[i]] += 1
  else:
    dic[s[i]] = 1

if len(dic) == 1:
  if len(s) == 1:
    print('YES')
  else:
    print('NO')

elif len(dic) == 2:
  if len(s) == 2:
    print('YES')
  else:
    print('NO')

else:
  first = 'a'
  second = 'b'
  for k, v in dic.items():
    if  v > dic[first]:
      if k != first:
        second = first
        first = k

    elif v > dic[second]:
      if k != second and k != first:
        second = k


  tmp = first + second
  dic[first] -= 1
  dic[second] -= 1
  ans = 'YES'

  for i in range(1, len(s) - 1):
    if tmp[i-1] == 'a':
      if tmp[i] == 'b':
        if dic['c'] == 0:
          ans = 'NO'
          break
        else:
          dic['c'] -= 1
          tmp += 'c'

      if tmp[i] == 'c':
        if dic['b'] == 0:
          ans = 'NO'
          break
        else:
          dic['b'] -= 1
          tmp += 'b'

    elif tmp[i-1] == 'b':
      if tmp[i] == 'a':
        if dic['c'] == 0:
          ans = 'NO'
          break
        else:
          dic['c'] -= 1
          tmp += 'c'

      if tmp[i] == 'c':
        if dic['a'] == 0:
          ans = 'NO'
          break
        else:
          dic['a'] -= 1
          tmp += 'a'

    elif tmp[i-1] == 'c':
      if tmp[i] == 'a':
        if dic['b'] == 0:
          ans = 'NO'
          break
        else:
          dic['b'] -= 1
          tmp += 'b'

      if tmp[i] == 'b':
        if dic['a'] == 0:
          ans = 'NO'
          break
        else:
          dic['a'] -= 1
          tmp += 'a'

  print(ans)

Buggy submission (verdict: Runtime Error):
s = input()

dic = {}
for i in range(len(s)):
  if s[i] in dic:
    dic[s[i]] += 1
  else:
    dic[s[i]] = 1

if len(dic) == 1:
  if len(s) == 1:
    print('YES')
  else:
    print('No')

elif len(dic) == 2:
  print('NO')

else:
  first = 'a'
  second = 'b'
  for k, v in dic.items():
    if  v > dic[first]:
      second = first
      first = k

    elif v > dic[second]:
      second = k

  tmp = first + second
  dic[first] -= 1
  dic[second] -= 1
  ans = 'YES'
  for i in range(1, len(s) - 1):
    if tmp[i-1] == 'a':
      if tmp[i] == 'b':
        if dic['c'] == 0:
          ans = 'NO'
          break
        else:
          dic['c'] -= 1
          tmp += 'c'

      if tmp[i] == 'c':
        if dic['b'] == 0:
          ans = 'NO'
          break
        else:
          dic['b'] -= 1
          tmp += 'b'

    elif tmp[i-1] == 'b':
      if tmp[i] == 'a':
        if dic['c'] == 0:
          ans = 'NO'
          break
        else:
          dic['c'] -= 1
          tmp += 'c'

      if tmp[i] == 'c':
        if dic['a'] == 0:
          ans = 'NO'
          break
        else:
          dic['a'] -= 1
          tmp += 'a'

    elif tmp[i-1] == 'c':
      if tmp[i] == 'a':
        if dic['b'] == 0:
          ans = 'NO'
          break
        else:
          dic['b'] -= 1
          tmp += 'b'

      if tmp[i] == 'b':
        if dic['a'] == 0:
          ans = 'NO'
          break
        else:
          dic['a'] -= 1
          tmp += 'a'

  print(ans)
Problem p03555 (python)

Fixed submission:
l = input()
m = input()
res = 'YES'


if l[0] != m[2]:
    res = 'NO'
    
if l[1] != m[1]:
    res = 'NO'
    
if l[2] != m[0]:
    res = 'NO'
        
print(res)

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

for i in range(1, N):
    if i*i > N:
        break
        
    res = i * i

print(res)
Problem p03556 (python)

Fixed submission:
N = int(input())

for i in range(N+1):
    n = i*i
    if n > N:
        break
        
    res = n

print(res)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
res = 0
for i in B:
    res += bisect.bisect_right(A, i) * (N - bisect.bisect_left(C, i))
    
print(res)

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

for i in range(1, N):
    n = i*i
    if n > N:
        break
        
    res = n

print(res)

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

for i in range(1, N):
    if i*i > N:
        break
        
    res = i * i

print(res)
Problem p03557 (python)

Fixed submission:
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
res = 0
for i in B:
    res += bisect.bisect_left(A, i) * (N - bisect.bisect_right(C, i))
    
print(res)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()

res = 0
for b in B:
    bisect_index_A = bisect.bisect_left(A, b)
    bisect_index_C = bisect.bisect_right(C, b)
    res += insert_index_A * (N - insert_index_C)
    
print(res)

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

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()

res = 0
for b in B:
    insert_index_A = bisect.bisect_left(A, b)
    insert_index_C = bisect.bisect_right(C, b)
    res += insert_index_A * (N - insert_index_C)
    
print(res)
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())

print(2*G-R)

Buggy submission (verdict: Runtime Error):
N = int(input())
items = [input() for _ in range(N)]

print(len(set(items)))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
res = ''
end = -1
for i in range(len(S) - len(T) + 1):
    for j in range(len(T)):
        start = i
        
        if S[i+j] == T[j]:
            end = i + j
            flag == 1
        elif S[i+j] == '?':
            end = i + j
            flag == 0
        else:
            pass
            break
    if flag == 1:
        break
            
if end == -1:
    print('UNRESTORABLE')
    
else:
    j = 0
    for i in range(len(S)):
        if start <= i <= end:
            res += T[j]
            j += 1

        elif S[i] == '?':
            res += 'a'

        else:
            res += S[i]

    print(res)
Problem p03574 (python)

Fixed submission:
W, H=map(int,input().split())
arr = [input() for j in range(W)]
ans = ['' for i in range(W)] 

for i in range(0, W):
    for j in range(0, H):
        bomb_num = 0
        if arr[i][j] == '#':
            ans[i] += '#'
        else:
            for k in (-1, 0, 1):
                for l in (-1, 0, 1):
                    if (-1<i+k<W) and (-1<j+l<H):
                        if arr[i+k][j+l] == '#':
                            bomb_num += 1
                        
            ans[i] += str(bomb_num)
            
for i in range(W):
        print(ans[i])

Buggy submission (verdict: Runtime Error):
W, H=map(int,input().split())
arr = [input() for j in range(W)]
ans = ['' for i in range(H)] 

for i in range(0, W):
    for j in range(0, H):
        bomb_num = 0
        if arr[i][j] == '#':
            ans[i] += '#'
        else:
            for k in (-1, 0, 1):
                for l in (-1, 0, 1):
                    if (-1<i+k<W) and (-1<j+l<H):
                        if arr[i+k][j+l] == '#':
                            bomb_num += 1
                        
            ans[i] += str(bomb_num)
            
for i in range(W):
        print(ans[i])
Problem p03624 (python)

Fixed submission:
S = input()
S_list = list(set(S))
al = 'abcdefghijklmnopqrstucwxyz'
al_list = list(al)
S_list.sort()
flg = 1
for i in range(len(al_list)):
    if al_list[i] in S_list:
        pass
    else:
        print(al_list[i])
        flg = 0
        break
    
if flg == 1:
    print('None')

Buggy submission (verdict: Runtime Error):
S = input()
S_list = list(set(S))
al = 'abcdefghijklmnopqrstucwxyz'
al_list = list(al)
S_list.sort()

for i in range(len(S)):
    if al_list[i] in S_list:
        pass
    else:
        print(al_list[i])
        break
    
if i == len(S) - 1:
    print('None')
Problem p03625 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
L.sort()
a = [0,0]
count = 0
for i in range(N):
    count += 1
    if i == N-1:
        if count >= 2:
            a.append(L[i])
        if count >= 4:
            a.append(L[i])
        count = 0
        
    elif L[i] != L[i+1]:
        if count >= 2:
            a.append(L[i])
        if count >= 4:
            a.append(L[i])
        count = 0
            
print(a[-1]*a[-2])

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
L.sort()
a = [0,0]
count = 0
for i in range(N):
    count += 1
    if i == N-1:
        if count >= 2:
            a.append(L[i])
            a.pop(0)
            res = a[0]*a[1] 
        count = 0
    elif L[i] != L[i+1]:
        if count >= 2:
            a.append(L[i])
            a.pop(0)
            res = a[0]*a[1]
        count = 0
            
print(res)
Problem p03633 (python)

Fixed submission:
N = int(input())
L = [ int(input()) for i in range(N)]

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

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

x = L[0]
for i in range(len(L)-1):
    y = lcm(x, L[i+1])
    x = y
    
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [ int(input()) for i in range(N)]
L.sort()

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

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

x = L[0]
for i in range(len(L)-1):
    y = lcm(x, L[i+1])
    x = y
    
print(int(x))

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [ int(input()) for i in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

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

x = L[0]
for i in range(len(L)-1):
    y = lcm(x, L[i+1])
    x = y
    
print(int(x))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
L = [ int(input()) for i in range(N)]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(L))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

N = int(input())
L = [ int(input()) for i in range(N)]


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(L))
Problem p03636 (python)

Fixed submission:
S = input()

print(S[0] + str(len(S)-2) + S[-1])

Buggy submission (verdict: Runtime Error):
S = input()

print(S[0] + str(len(S-2)) + S[-1])

Buggy submission (verdict: Runtime Error):
S = input()

print(S[0] + len(S) + S[-1])