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

Fixed submission:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
edges = {}
flag = 'IMPOSSIBLE'
for a, b in AB:
    if a in edges:
        edges[a].append(b)
    else:
        edges[a] = [b]
for i in edges[1]:
    if i not in edges:
        continue
    if N in edges[i]:
        flag = 'POSSIBLE'
        break

print(flag)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
edges = {}
flag = 'IMPOSSIBLE'
for a, b in AB:
    if a in edges:
        edges[a].append(b)
    else:
        edges[a] = [b]
for i in edges[1]:
    if N in edges[i]:
        flag = 'POSSIBLE'
        break

print(flag)
Problem p03673 (python)

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

right = []
left = []
for i in range(N):
    if i % 2 == 0:
        right.append(A[i])
    else:
        left.append(A[i])
answer = left[::-1]
answer += right
if N%2 == 1:
  answer = answer[::-1]
print(*answer)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

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

right = []
left = []
for i in range(N):
    if i % 2 == 0:
        right.append(A[i])
    else:
        left.append(A[i])
answer = left[::-1]
answer += right
print(*answer if N%2 == 0 else *answer[::-1])
Problem p03694 (python)

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

print(max(A) - min(A))

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

print(max(A) - max(B))
Problem p03715 (python)

Fixed submission:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
if H%3==0 or W%3==0:
    answer = 0
else:
    answer = min(H, W)
# さらに小さくするには縦と横で割る
h = H // 3
area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
answer = min(answer, max(area)-min(area))
h += 1
area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
answer = min(answer, max(area)-min(area))
w = W // 3
area = [w * H, (W-w) * (H//2), (W-w) * ((H+1)//2)]
answer = min(answer, max(area)-min(area))
w += 1
area = [w * H, (W-w) * (H//2), (W-w) * ((H+1)//2)]
answer = min(answer, max(area)-min(area))
print(answer)

# 13

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
if H%3==0 or W%3==0:
    answer = 0
else:
    answer = min(H, W)
# さらに小さくするには縦と横で割る
def cal(H, W):
    h = H // 3
    area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
    answer = min(answer, max(area)-min(area))
    h += 1
    area = [h * W, (H-h) * (W//2), (H-h) * ((W+1)//2)]
    answer = min(answer, max(area)-min(area))

cal(H, W)
cal(W, H)
print(answer)
# 13
Problem p03721 (python)

Fixed submission:
N, K = list(map(int, input().split()))
l = [0] * 10 ** 5
for i in range(N):
    a, b = map(int, input().split())
    l[a-1] += b
count = 0
for j in range(10**5):
    count += l[j]
    if count >= K:
        print(j+1)
        break

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
l = [0] * 10 ** 5
for i in range(N):
    a, b = map(int, input().split())
    l[a] += b
count = 0
for j in range(10**5):
    count += l[j]
    if count >= K:
        print(j)
        break
Problem p03729 (python)

Fixed submission:
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A, B, C = rs().split()
bool = A[-1] == B[0] and B[-1] == C[0]
print('YES' if bool else 'NO')

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A, B, C = rl()
bool = A[-1] == B[0] and B[-1] == C[0]
print('YES' if bool else 'NO')
Problem p03762 (python)

Fixed submission:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
n, m = lr()
X = np.array(lr())
Y = np.array(lr())
coef_x = np.arange(n)*2 - (n-1)
X *= coef_x
xsum = (X%MOD).sum() % MOD
coef_y = np.arange(m)*2 - (m-1)
Y *= coef_y
ysum = (Y%MOD).sum() % MOD
answer = xsum * ysum % MOD
print(answer % MOD)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
n, m = lr()
X = np.array(lr())
Y = np.array(lr())
x_len = X[1:] - X[:-1]
y_len = Y[1:] - Y[:-1]

square = x_len[:, None] * y_len[None, :]
answer = 0
for i in range(n-1):
    answer += (square[i] % MOD).sum()
    answer %= MOD

answer *= (n-1) * (m-1)
print(answer%MOD)
# 43

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
n, m = lr()
X = np.array(lr())
Y = np.array(lr())
x_len = X[1:] - X[:-1]
y_len = Y[1:] - Y[:-1]

square = x_len[:, None] * y_len[None, :] % MOD
answer = (n-1) * (m-1) * square.sum() % MOD
print(answer%MOD)
# 43
Problem p03777 (python)

Fixed submission:
a,b=input().split()
print('HD'[a!=b])

Buggy submission (verdict: Runtime Error):
a,b=input(),split()
print('HD'[a!=b])
Problem p03854 (python)

Fixed submission:
S = input()
while S:
    for x in ['dreamer', 'eraser', 'dream', 'erase']:
        if S.endswith(x):
            S = S[:-len(x)]
            break
    else:
        print('NO')
        exit()
print('YES')

Buggy submission (verdict: Runtime Error):
S = input()
while S:
    print(S)
    for x in ['dreamer', 'eraser', 'dream', 'erase']:
        if S.endswith(x):
            S = S[:-len(x)]
            break
    else:
        print('NO')
        exit()
print('YES')
Problem p03911 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

#人は0からN-1,言語は1からMまで
N, M = rl()
KL = [rl() for _ in range(N)]
speak_lan = [[] for _ in range(M+1)] #0は使わない
for i, x in enumerate(KL):
    k, *lan = x
    for l in lan:
        speak_lan[l].append(i)

communicate = set()
used_language = set()
def dfs(person):
    global communicate
    global used_language
    lan = KL[person][1:]
    for l in lan:
        if l in used_language:
            continue
        used_language.add(l)
        for p in speak_lan[l]:
            if p not in communicate:
                communicate.add(p)
                dfs(p)

dfs(0)
if len(communicate) == N:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

#人は0からN-1,言語は1からMまで
N, M = rl()
KL = [rl() for _ in range(N)]
speak_lan = [[] for _ in range(M+1)] #0は使わない
for i, x in enumerate(KL):
    k, *lan = x
    for l in lan:
        speak_lan[l].append(i)

communicate = set()

def dfs(person):
    global communicate
    lan = KL[person][1:]
    for l in lan:
        for p in speak_lan[l]:
            if p not in communicate:
                communicate.add(p)
                dfs(p)

dfs(0)
if len(communicate) == N:
    print('YES')
else:
    print('NO')
Problem p03946 (python)

Fixed submission:
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, T = rl()
A = rl()
answer = 1
profit = 0
min = A[0]
for i in range(1, N):
    if A[i] < min:
        min = A[i]
        continue
    x = A[i] - min
    if x > profit:
        answer = 1
        profit = x
    elif x == profit:
        answer += 1

print(answer)
# 40

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, T = rl()
A = np.array(rl())
A_cummin = A.minimum.accumulate(A)
B = A - A_cummin

answer = (B == B.max()).sum()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, T = rl()
A = rl()
B = np.array(A)
answer = 1
profit = 0
for i in range(N):
    B = B[1:] 
    p = B.max() - A[i]
    if p > profit:
        profit = p
        answer = 1
    elif p == profit:
        answer += 1

print(answer)

# 40
Problem p03973 (python)

Fixed submission:
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
    if a == cur_limit:
        cur_limit += 1
        continue
    answer += -((-(a-cur_limit)) // cur_limit)

print(answer)
# 44

Buggy submission (verdict: Runtime Error):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
    if a == cur_limit:
        cur_limit += 1
        continue
    answer += (a-cur_limit) // cur_limit)

print(answer)
# 44
Problem p04045 (python)

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

while True:
    l = list(str(N))
    for x in l:
        if x in D:
            N += 1
            break
    else:
        print(N)
        exit()

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
D = set(map(int, input().split()))
safe = set(range(10)) - D

def test(N):
    return set((int(x) for x in str(N))) <= safe

def F(N):
    while N % 10:
        if text(N):
            return N
        N += 1
    N //= 10
    x = F(N)
    y = min(safe)
    return 10 * x + y

answer = F(N)
print(answer)
Problem p02583 (python)

Fixed submission:
def get_array():
    l=list(map(int, input().split()))
    return l
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)

Buggy submission (verdict: Runtime Error):
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
n=int(input())
print(a+a*a+a*a*a)
Problem p02697 (python)

Fixed submission:
n,m=map(int,input().split())
for i in range(0,m):
  if n-2*i-1>n/2 or n%2==1 :
    print(i+1,n-i)
  else:
    print(i+1,n-i-1)

Buggy submission (verdict: Runtime Error):
n,m=int(input().split())
for i in range(0,m):
  if n-2*i-1>n/2:
    print(i+1,n-i)
  else:
    print(i+1,n-i-1)
Problem p02909 (python)

Fixed submission:
a = ["Sunny", "Cloudy", "Rainy"]
s = input()
for i in range(0, 3):
  if s == a[i]:
    print(a[(i+1)%3])

Buggy submission (verdict: Runtime Error):
a = ["Sunny", "cloudy", "Rainy"]
s = input()
for i in range(0, 3):
  if s == a[i]:
    print(a[(i+1)/3])
Problem p03659 (python)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
t = [0]
s = 2000000000
for i in range(0, n):
  t.append(t[i]+v[i])
for i in range(0, n-1):
  s = min(s, abs(t[n]-2*t[i+1]))
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
t = [0]
s = 2000000000
for i in range(0, n):
  t.append(t[i]+v[i])
for i in range(0, n-1):
  s = min(s, abs(t[n]-t[i+1])
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
t = [0]
s = 2000000000
for i in range(0, n):
  t.append(t[i]+v[i])
for i in range(0, n-1):
  s = min(s, abs(s-t[i+1])
print(s)
Problem p03687 (python)

Fixed submission:
s = input()
a = 10000
for i in range(0, 26):
  n = 0
  t = 0
  b = True
  for j in range(0, len(s)):
    if s[j] != chr(ord("a")+i):
      t += 1
    elif b:
      n = max(n, t)
      t = 0
    else:
      n = max(n, (t+1)//2)
      t = 0
  n = max(n, t)
  a = min(a, n)
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
c = [0]*26
v = []
m = 0
for i in range(0, len(s)):
  c[(int)s[i]-'a'] += 1
for i in range(0, 26):
  m = max(m, c[i])
for i in range(0, 26):
  if c[i] == m:
    v.append((char)'a'+i)
a = 10000
for i in range(0, len(c)):
  n = 0
  t = 0
  for j in range(0, len(s)):
    if s[j] != v[i]:
      t += 1
    else:
      n = max(n, (t+1)//2)
  n = max(n, (t+1)//2)
  a = min(a, n)
print(a)
Problem p04030 (python)

Fixed submission:
s = input()
a = ""
for i in range(0, len(s)):
  if s[i] == "0":
    a += "0"
  elif s[i] == "1":
    a += "1"
  elif s[i] == "B" and len(a) != 0:
    b = a[0:-1]
    a = b
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
a = ""
for i in range(0, len(s)):
  if s[i] == "0":
    a += "0"
  elif s[i] == "1":
    a += "1"
  elif s[i] == "B" and len(a) != 0:
    a[-1] = ""
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
a = ""
for i in range(0, len(s)):
  if s[i] == "0":
    a += "0"
  elif s[i] == "1":
    a += "1"
  elif s[i] == "B" and len(a) != 0:
    del a[-1]
print(a)
Problem p02582 (python)

Fixed submission:
s = input()

if s == "RRR":
  d = 3
elif s == "RRS" or s == "SRR":
  d = 2
elif s == "SSS":
  d = 0
else:
  d = 1
print(d)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  for _ in range(k):
    xi -= d
    if xi < 0:
      m = min(abs(xi),abs(xi+d),abs(xi-d))
      break
print(m)
Problem p02584 (python)

Fixed submission:
from math import ceil 
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  n = ceil(xi / d)
  if (n+k) % 2 == 0:
    m = abs(xi-d*n)
  else:
    m = abs(xi-d*(n-1))
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

if x>= 0:
  if x > d*k:
    m = x - d*k
  else:
    for i in range(k):
      x -= d
      if x <=0:
        if (i+k) % 2 != 0:
          m = (-1)*x
        else:
          m = x+d
        break

else:
  if x > (-1)*d*k:
    m = x + d*k
  else:
    for i in range(k):
      x += d
      if x >=0:
        if (i+k) % 2 != 0:
          m = x
        else:
          m = (-1)*(x-d)
        break
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  for i in range(k):
    if xi - d*i <= 0:
      if (i+k) % 2 != 0:
        m = abs(xi)
      else:
        m = min(abs(xi+d),abs(xi-d))
      break
    break
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = min(abs(x+d*k),abs(x-d*k))
else:
  for _ in range(k):
    xi -= d
    if xi < 0:
      m = min(abs(xi),abs(xi+d),abs(xi-d))
      break
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = abs(min(x+d*k, x-d*k))
else:
  for _ in range(k):
    xi -= d
    if xi < 0:
      m = abs(min(xi,xi+d,xi-d))
      break
print(m)

Buggy submission (verdict: Runtime Error):
x,k,d = list(map(int,input().split()))

xi = abs(x)
if abs(x) > d*k:
  m = abs(min(x+d*k, x-d*k))
else:
  for i in range(k):
    xi -= d*i
    if xi < 0:
      m = abs(min(x+d*i,x-d*i,x+d*(i-1),x-d*(i-1)))
      break
print(m)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
l = [0]*(10**6+1)
M = max(a)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2, M+1, i):
      l[j] = -1
  else:
    l[i] = -1
print(l.count(1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
l = [0]*(10**6)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2,max(a)+1,i):
      l[j] = -1
  else:
    l[i] = -1
print(l.count(1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
l = [0]*(10**6)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2,max(a)+1,i):
      l[j] = -1
  elif l[i] == 1:
    l[i] = -1
print(l.count(1))
Problem p02812 (python)

Fixed submission:
import re

# N, Sを入力
n = input()
s = input()

results = re.findall(r"ABC", s)

print(len(results))

Buggy submission (verdict: Runtime Error):
# N, Sを入力
n = input()
s = input()

results = re.findall(r"ABC", s)

print(len(results))
Problem p02922 (python)

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

t = b - 1
s = a - 1
ans = (t + s - 1) // s
print(ans)

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

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

Buggy submission (verdict: Runtime Error):
a, b = map(int(input()))

print(max(a + b, a - b, a * b))
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3 * r ** 2)

Buggy submission (verdict: Runtime Error):
r = int(input())
print(3 * (r ** 2)
Problem p02995 (python)

Fixed submission:
from fractions import gcd

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

lcm =  (c * d) // gcd(c, d)

ans = b - a + 1
ans -= (b // c) - ((a - 1 )// c)
ans -= (b // d) - ((a - 1) // d)
ans += (b // lcm) - ((a - 1) // lcm)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

lcm =  (c * d) // math.gcd(c, d)

ans = b - a + 1
ans -= (b // c) - ((a - 1 )// c)
ans -= (b // d) - ((a - 1) // d)
ans += (b // lcm) - ((a - 1) // lcm)
print(ans)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=int(input())
print(a*b)
Problem p02683 (python)

Fixed submission:
n, m, x = map(int, input().split())
C = [0] * n
A = [[] for i in range(n)]
for i in range(n):
    c = list(map(int, input().split()))
    C[i], A[i] = c[0], c[1:]

INF = 10 ** 9
ans = INF

for bit in range(0, 1 << n):
    cost = 0
    flag = True
    tmp = [0] * m
    for i in range(n):
        if bit & 1 << i:
            cost += C[i]
            for j in range(m):
                tmp[j] += A[i][j]
    for i in range(m):
        if tmp[i] < x:
            flag = False
    if flag:
        ans = min(ans, cost)

print(-1 if ans == INF else ans)

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
C = [0] * n
A = [[] for i in range(n)]
for i in range(n):
    c = list(map(int, input().split()))
    C[i], A[i] = c[0], c[1:]

INF = 10 ** 9
ans = INF

for bit in range(0, 1 << n):
    cost = 0
    flag = True
    tmp = [0] * m
    for i in range(n):
        if bit & 1 << i:
            cost += C[i]
            for j in range(m):
                tmp[j] += A[i][j]
    for i in range(n):
        if tmp[i] < x:
            flag = False
    if flag:
        ans = min(ans, cost)

print(-1 if ans == INF else ans)
Problem p02865 (python)

Fixed submission:
print((int(input())-1)//2)

Buggy submission (verdict: Runtime Error):
print((int(input()-1)//2)
Problem p03633 (python)

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

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

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

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

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

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t,ans)

print(int(ans))

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

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t,ans)

print(int(ans))

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

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

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)
Problem p02612 (python)

Fixed submission:
n = int(input())
print(-n % 1000)

Buggy submission (verdict: Runtime Error):

MOD = 10**9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
plus,minus=[],[]
for i in a:
    if i<0:
        minus.append(i)
    else:
        plus.append(i)
plus.sort(reverse = True)
minus.sort()
plus.append(-10**10)
plus.append(10**10)
minus.append(10**10)
minus.append(-10**10)
ans = 1
if n == k:
    for i in range(n):
        ans *= a[i]
        ans %= MOD
    print(ans)
elif len(plus) == 2 and k % 2 == 1:
    for i in range(3, k + 3):
        ans *= minus[-i]
        ans %= MOD
    print(ans)
else:
    cplus = 0
    cminus = 0
    p = k // 2
    if k % 2 == 1:
        ans *= plus[0]
        cplus = 1
    else:
        for _ in range(p):
            if plus[cplus] * plus[cplus + 1] > minus[cminus] * minus[cminus + 1]:
                ans *= plus[cplus] * plus[cplus + 1]
                ans %= MOD
                cplus += 2
            else:
                ans *= minus[cminus] * minus[cminus + 1]
                ans %= MOD
                cminus += 2
    print(ans)
Problem p02713 (python)

Fixed submission:
import math
K=int(input())
ans=0
for a in range(1,K+1):
	for b in range(a,K+1):
		for c in range(b,K+1):
			A=math.gcd(math.gcd(a,b),c)
			if a==b and b==c:
				ans+=A
			elif a==b or b==c:
				ans+=(A*3)
			else:
				ans+=(A*6)
print(ans)

Buggy submission (verdict: Runtime Error):
import fractinons
K=int(input())
ans=0
for a in range(1,K+1):
	for b in range(1,K+1):
		for c in range(1,K+1):
			ans+=fractions.gcd(fractions.gcd(a,b),c)
print(ans)
Problem p02783 (python)

Fixed submission:
H, A=map(int,input().split())
if H//A==H/A:
	print(H//A)
else:
	print(H//A+1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
a=list(map(int,input().split()))
if K>=N:
	print(0)
else:
	b=sorted(a)
	c=0
	for i in range(N-K):
		c+=b[i]
	print(c)
Problem p02784 (python)

Fixed submission:
H,N=map(int,input().split())
a=list(map(int,input().split()))
b=sum(a)
if H>b:
	print('No')
else:
	print('Yes')

Buggy submission (verdict: Runtime Error):
H,N=map(int,input().split())
a=0
for i in range(N):
	b=int(input())
	a+=b
if H>a:
	print('No')
else:
	print('Yes')
Problem p02789 (python)

Fixed submission:
N, M=map(int,input().split())
if N==M:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N, M=int(input())
if N==M:
	print('Yes')
else:
	print('No')