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

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

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
for i in range(1, int(math.sqrt(b))+1):
    if a%i == 0 and b%i == 0:
        if is_prime(i):
            c.append(i)
    k = b//i
    if a%k == 0:
        if is_prime(k):
            c.append(k)
print(len(set(c))+1)

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

def primes(max_number):
    pr = list(range(3, max_number+1, 2))
    lpr = len(pr)
    for i,n in enumerate(pr):
        if n:
            if n*n > max_number:
                break
            for j in range(i+n, lpr, n):
                pr[j] = 0
    yield 2
    yield from[i for i in pr if i]

if b > a:
    a, b = b, a

cnt = 0
for i in list(primes(b)):
    if a%i == 0 and b%i == 0:
        cnt += 1
print(cnt+1)

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

def primes(max_number):
    pr = list(range(3, max_number+1, 2))
    lpr = len(pr)
    for i,n in enumerate(pr):
        if n:
            if n*n > max_number:
                break
            for j in range(i+n, lpr, n):
                pr[j] = 0
    yield 2
    yield from[i for i in pr if i]

if b > a:
    a, b = b, a
cnt = 0
for i in list(primes(a)):
    if a%i == 0 and b%i == 0:
        cnt += 1
print(cnt+1)
Problem p02936 (python)

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

def dfs(G, v):
    seen[v] = True

    for nv in G[v]:
        if seen[nv]:
            continue
        point[nv] += point[v]
        dfs(G, nv)

n, q = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n-1):
    x, y =  map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)
    G[y].append(x)

seen = [False for _ in range(n)]
root = 0
point = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    point[p-1] += x

dfs(G, root)
print(*point)

Buggy submission (verdict: Runtime Error):
def dfs(G, v):
    seen[v] = True

    for nv in G[v]:
        if seen[nv]:
            continue
        point[nv] += point[v]
        dfs(G, nv)

n, q = map(int, input().split())
G = [[] for _ in range(n)]
for _ in range(n-1):
    x, y =  map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)
    G[y].append(x)

seen = [False for _ in range(n)]
root = 0
point = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    point[p-1] += x

dfs(G, root)
print(*point)
Problem p02939 (python)

Fixed submission:
def calc(pr, s):
    cnt = 0
    i = 0
    while i < len(s)-1:
        if len(pr) == 1:
            if s[i+1] == pr:
                if i+2 < len(s):
                    cnt += 1
                    pr = s[i+1:i+3]
                    i += 1
                else:
                    break
            else:
                cnt += 1
                pr = s[i+1]
                i += 1
        else:
            if i+2 < len(s):
                cnt += 1
                pr = s[i+2]
                i += 2
            else:
                break
    return cnt+1

s = input()
pr1 = s[0]
pr2 = s[:2]
print(max(calc(pr1, s), calc(pr2, s)))

Buggy submission (verdict: Runtime Error):
s = input()
pr = s[0]
cnt = 0
i = 0
while i < len(s)-1:
    if len(pr) == 1:
        if s[i+1] == pr:
            if i+2 < len(s)-1:
                cnt += 1
                pr = s[i+1:i+3]
                i += 2
            else:
                break
        else:
            cnt += 1
            pr = s[i+1]
            i += 1
    else:
        cnt += 1
        pr = s[i+2]
        i += 1
print(cnt+1)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]

if n == 1:
    print(1)
    exit()

b = sorted(a)
sb = []
for i in range(n-1):
    for j in range(i+1, n):
        sb.append((b[i][0] - b[j][0], b[i][1] - b[j][1]))
        
c = Counter(sb)
print(n-c.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = [list(map(int,input().split())) for _ in range(n)]
b = sorted(a)
c = sorted(a, key=lambda x:x[1])
bd = []
cd = []
for i in range(n-1):
    b0 = b[i+1][0] - b[i][0]
    b1 = b[i+1][1] - b[i][1]
    bd.append((b0, b1))
    
    c0 = c[i+1][0] - c[i][0]
    c1 = c[i+1][1] - c[i][1]
    cd.append((c0, c1))
    
cbd = Counter(bd)
ccd = Counter(cd)
print(n-max(cbd.most_common()[0][1], ccd.most_common()[0][1]))
Problem p03061 (python)

Fixed submission:
from fractions import gcd
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
oc = []
b = 0
for i, v in c.items():
    if v == 1:
        oc.append(i)
    else:
        if b == 0:
            b = i
        else:
            b = gcd(b, i)

loc = len(oc)
if loc <= 1:
    print(b)
    exit()

c = [oc[0], oc[1]]
e = gcd(oc[0], oc[1])
if loc == 2:
    c.append(e)
for i in range(2, loc):
    g1 = gcd(e, oc[i])
    d = []
    for cc in c:
        g2 = gcd(cc, oc[i])
        if g2 > 1:
            d.append(g2)
    c = d
    if e > 1:
        c.append(e)
    if i == loc-1:
        c.append(g1)
    e = g1

if b >= 2:
    print(max([gcd(cc, b) for cc in c]))
elif b == 0:
    print(max(c))
else:
    print(1)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
a = list(set(map(int,input().split())))
a.sort(reverse=True)
b = gcd(a[0], a[1])
c = [a[0], a[1]]
for i in range(2, len(a)):
    g1 = gcd(b, a[i])    
    d = []
    for j in c:
        g2 = gcd(j, a[i])
        if g2 > 1:
            d.append(g2)
    c = d
    if b > 1:
        c.append(b)
    b = g1

if c:
    print(max(c))
else:
    print(1)
Problem p03076 (python)

Fixed submission:
total = 0
c = []
for i in range(5):
    a = input()
    b = int(a)
    if int(a[-1]) != 0:
        c.append(int(a[-1]))
        total += b - int(a[-1]) + 10
    else:
        total += b

if c:
    total += min(c)
    total -= 10
print(total)

Buggy submission (verdict: Runtime Error):
total = 0
c = []
for i in range(5):
    a = input()
    b = int(a)
    if int(a[-1]) != 0:
        c.append(int(a[-1]))
        total += b - int(a[-1]) + 10
    else:
        total += b

total += min(c)
total -= 10
print(total)
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')]*n
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))+[float('inf')]*(10001-n)
dp = [float('inf')]*100001
dp[0] = 0
for i in range(n):
    for j in range(1, k+1):
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[n-1])
Problem p03166 (python)

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

n, m = map(int, input().split())
G = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    x, y = x-1, y-1
    G[x].append(y)

memo = [-1]*n
def dp(v):
    if memo[v] != -1:
        return memo[v]
    res = 0
    for nv in G[v]:
        res = max(res, dp(nv) + 1)
    
    memo[v] = res
    return res

ans = 0
for v in range(n):
    ans = max(ans, dp(v))
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
G = [[] for _ in range(n+1)]
for i in range(m):
    x, y = map(int, input().split())
    G[x].append(y)

memo = [0]*(n+1)
seen = [False]*(n+1)
def dp(v):
    if seen[v]:
        return memo[v]
    ans = 0
    for nv in G[v]:
        ans = max(ans, dp(nv) + 1)

    seen[v] = True
    memo[v] = ans
    return ans

ans = 0
for v in range(1, n+1):
    ans = max(ans, dp(v))
print(ans)
Problem p03214 (python)

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

avg = sum(a)/len(a)
b = []
for aa in a:
    b.append(abs(aa-avg))

print(b.index(min(b)))

Buggy submission (verdict: Runtime Error):
import itertools
n,d = map(int,input().split())
a = list(map(int,input().split()))

b = []
c = 0
m = n
for i in range(n):
    for j in range(m):
        for k in range(j+1):
            c += a[k]
        b.append(c)
        c = 0
    m -= 1
    del a[0]
b = list(set(b))

h = list(itertools.permutations(range(len(b)), d))
p = []
q = []
for i in range(len(h)):
    for j in range(d):
        p.append(b[h[i][j]])
        
    for k in range(d-1):
        k += 1
        if k == 1:
            e = bin(p[k])
            f = bin(p[k-1])
            g = int(e,0) & int(f,0)
        g = int(bin(g),0) & int(bin(p[k]),0)
    q.append(g)
    p = []

print(max(q))
Problem p03262 (python)

Fixed submission:
n,m = map(int,input().split())
aa = list(map(int,input().split()))
 
bb = [abs(a-m) for a in aa]

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
    
if len(aa) == 1:
    print(abs(aa[0]-m))
else:
    while len(bb) > 1:
        a, b = bb.pop(), bb.pop()
        bb.append(gcd(a,b))
    print(bb[0])

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
 
n,m = map(int,input().split())
x = list(map(int,input().split()))
 
x.append(m)
x.sort() 
 
aa = []
for i in range(len(x)-1):
    a = x[i+1] - x[i]
    aa.append(a)
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

if len(x) == 1:
    print(abs(x[0]-m))
else:
    set_aa = [a for a in set(aa)]
    print(gcd(*set_aa))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
 
n,m = map(int,input().split())
x = list(map(int,input().split()))
 
x.append(m)
x.sort() 
 
aa = []
for i in range(len(x)-1):
    a = x[i+1] - x[i]
    aa.append(a)
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

if len(x) == 1:
    print(abs(x[0]-m))
else:
    print(gcd(*set(aa)))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
 
n,m = map(int,input().split())
x = list(map(int,input().split()))
 
aa = []
for i in range(len(x)-1):
    a = x[i+1] - x[i]
    aa.append(a)
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

if len(x) == 1:
    print(abs(x[0]-m))
else:
    print(gcd(*aa))

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

n,m = map(int,input().split())
x = list(map(int,input().split()))

aa = []
for i in range(n):
    a = abs(x[i] - m)
    aa.append(a)

def gcd(*numbers):
    return reduce(math.gcd, numbers)

print(gcd(*aa))

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

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n,m = map(int,input().split())
x = list(map(int,input().split()))

aa = []
for i in range(n):
    a = abs(x[i] - m)
    aa.append(a)

print(gcd(*[a for a in aa]))
Problem p03274 (python)

Fixed submission:
n,k = map(int,input().split())
x = list(map(int,input().split()))

if len(x) == 1 and x[0] == 0:
    print(0)
    exit()

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

ans = float('inf')
if len(m) >= k:
    ans = min(ans,abs(m[-k]))
    m = m[-k+1:]
if len(p) >= k:
    ans = min(ans,p[k-1])
    p = p[:k-1]

x = m+p
i = 0
for i in range(len(x)-k+1):
    ans = min(ans, min(abs(x[i])*2+abs(x[i+k-1]), abs(x[i])+abs(x[i+k-1])*2))

print(ans)

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

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

if m and p:
    if k-len(m) >= 0:
        s = 0
    else:
        s = abs(k-len(m))+1
    
    i = 0
    ans = float('inf')
    while s+i <= len(m) and z+s+i <= n:
        ans = min(ans, min(abs(x[s+i])*2 + abs(x[k-1+s+i]), abs(x[s+i]) + abs(x[k-1+s+i])*2))
        
        if s+i == len(m):
            ans = min(ans, x[k-1+s+i])
        if z+s+i == len(m)-1:
            ans = min(ans, abs(x[s+i]))
        i += 1
    
    print(ans)
elif m:
    print(abs(x[-k]))
elif p:
    print(x[k-1])
else:
    print(0)

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

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

if m and p:
    z = len(m)-1
    if k-len(m) >= 0:
        s = 0
    else:
        s = abs(k-len(m))+1
    
    i = 0
    ans = float('inf')
    while s+i <= len(m) and z+s+i <= n:
        ans = min(ans, min(abs(x[s+i])*2 + abs(x[k-1+s+i]), abs(x[s+i]) + abs(x[k-1+s+i])*2))
        
        if s+i == len(m):
            ans = min(ans, x[k-1+s+i])
        if z+s+i == len(m)-1:
            ans = min(ans, abs(x[s+i]))
        i += 1
        
    print(ans)    
elif m:
    print(abs(x[-k]))
elif p:
    print(x[k-1])
else:
    print(0)

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

m = []
p = []
for i in range(n):
    if x[i] < 0:
        m.append(x[i])
    elif x[i] > 0:
        p.append(x[i])

if m and p:
    z = len(m)-1
    if k-len(m) > 0:
        s = 0
    else:
        s = abs(k-len(m))+1
    
    i = 0
    ans = float('inf')
    while z+s+i < n and s+i < len(m):
        ans = min(ans, min(abs(x[s+i])*2 + abs(x[k-1+s+i]), abs(x[s+i]) + abs(x[k-1+s+i])*2))
        i += 1
        
    print(ans)
elif m:
    print(abs(x[-k]))
elif p:
    print(x[k-1])
else:
    print(0)
Problem p03287 (python)

Fixed submission:
import itertools
import collections
import math

n,m = map(int,input().split())
a = list(map(int,input().split()))
ac = [0]
ac += list(itertools.accumulate(a))

re = [i % m for i in ac]
c = collections.Counter(re)

ans = 0
for v in c.values():
    if v >= 2:
        ans += (math.factorial(v)//math.factorial(v-2))//(math.factorial(2))
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
import collections
from scipy.special import comb

n,m = map(int,input().split())
a = list(map(int,input().split()))
ac = [0]
ac += list(itertools.accumulate(a))

re = [i % m for i in ac]
c = collections.Counter(re)

ans = 0
for v in c.values():
    if v >= 2:
        ans += comb(v,2,exact=True)
print(ans)
Problem p03288 (python)

Fixed submission:
n = int(input())
if n < 1200:
    print('ABC')
elif n < 2800:
    print('ARC')
else:
    print('AGC')

Buggy submission (verdict: Runtime Error):
if n < 1200:
    print('ABC')
elif n < 2800:
    print('ARC')
else:
    print('AGC')
Problem p03353 (python)

Fixed submission:
S = input()
K = int(input())
a = list(set(S))
a.sort()

k = []
l = 0
while l < len(a):
    for i in range(len(S)):
        if S[i] == a[l]:
            for j in range(1,6):
                if i+j <= len(S):
                    k.append(S[i:i+j])
                else:
                    break
    l += 1

k = list(set(k))
k.sort()
print(k[K-1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
a = list(set(S))
a.sort()

k = []
l = 0
while True:
    for i in range(len(S)):
        if S[i] == a[l]:
            for j in range(1,6):
                if i+j <= len(S):
                    k.append(S[i:i+j])
                else:
                    break
    if len(k) >= 5:
        break
    if l == len(a)-1:
        break
    l += 1

k = list(set(k))
k.sort()
print(k[K-1])
Problem p03363 (python)

Fixed submission:
import math
from collections import Counter
from itertools import accumulate

def P(n,r):
    return math.factorial(n)//math.factorial(n-r)

def C(n,r):
    return P(n,r)//math.factorial(r)

n = int(input())
a = list(map(int,input().split()))
ac = [0] + list(accumulate(a))
c = Counter(ac)

cnt = 0
for v in c.values():
    if v >= 2:
        cnt += C(v,2)
print(cnt)

Buggy submission (verdict: Runtime Error):
import collections
from itertools import accumulate
from scipy.special import comb

n = int(input())
a = list(map(int,input().split()))
ac = [0] + list(accumulate(a))
c = collections.Counter(ac)

cnt = 0
for v in c.values():
    if v >= 2:
        cnt += comb(v,2,exact=True)
print(cnt)
Problem p03371 (python)

Fixed submission:
a, b, c, x, y = map(int, input().split())
xy = [x, y]

total_ab = a * x + b * y
total_c = c * 2 * max(xy)
if x > y:
    total_abc = c * 2 * min(xy) + a * (x-y)
else:
    total_abc = c * 2 * min(xy) + b * (y-x)

total = [total_ab, total_c, total_abc]
print(min(total))

Buggy submission (verdict: Runtime Error):
a, b, c, x, y = map(int, input().split())
xy = [x, y]

if (a + b) // 2 <= c:
  	total_ab = a * x + b * y
    print(total_ab)
else:
    d = c * min(xy) * 2
    if x == y:
        print(d)
    elif x > y:
        print(min((x-y) * a + d, c * max(xy) * 2))
    else:
        print(min((y-x) * b + d, c * max(xy) * 2))
Problem p03386 (python)

Fixed submission:
a,b,k = map(int,input().split())
ans = [a+i for i in range(k) if a+i <= b] + [b-i for i in range(k) if b-i >= a]
ans = list(set(ans))
ans.sort()

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
c = list(range(a,b+1))
ans = c[:k] + c[-k:]
ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
c = list(range(a,b+1))

if 2*k <= len(c):
    ans = c[:k] + c[-k:]
else:
    ans = c

for i in ans:
    print(i)
Problem p03418 (python)

Fixed submission:
n,k = map(int,input().split())

if k == 0:
    print(n**2)
else:
    total = 0
    for i in range(k+1,n+1):
        d,m = divmod(n,i)
        
        if (i-k) > 0:
            total += d*(i-k)
        if (m-k+1) > 0:
            total += m-k+1

    print(total)

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

if k == 0:
    print(n**2)
else:
	total = 0
    for i in range(k+1,n+1):
        d,m = divmod(n,i)
        
        if (i-k) > 0:
            total += d*(i-k)
        if (m-k+1) > 0:
            total += m-k+1

    print(total)
Problem p03480 (python)

Fixed submission:
s = list(input())
l = len(s)
a = [l]
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        a.append(max(i+1, len(s)-i-1))
        
print(min(a))

Buggy submission (verdict: Runtime Error):
s = list(input())
sums = sum([int(ss) for ss in s])

if len(s) == 1:
    print(1)
elif sums == len(s):
    print(len(s))
else:
    a = []
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            a.append(max(i+1, len(s)-i-1))
            
    print(min(a))

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

if s == '1':
    print(1)
else:
    a = []
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            a.append(max(len(s[:i+1]), len(s[i+1:])))
            
    print(min(a))
Problem p03503 (python)

Fixed submission:
import itertools
n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]

a = list(range(10))
cnt = 0
total = 0
total_p = []
for i in range(1,11):
    c = list(itertools.combinations(a,i))
    
    for tap in c:
        for j in range(n):
            for num in tap:
                if f[j][num] == 1:
                    cnt += 1
                    
            total += p[j][cnt]
            cnt = 0
        
        total_p.append(total)
        total = 0

print(max(total_p))

Buggy submission (verdict: Runtime Error):
p0 = []
maxp = []
for i in range(n):
    p0.append(p[i][0])
    sumf = sum(f[i])
    maxp.append(max(p[i][1:(sumf+1)]))

cnt = 0
sum_max = 0
for i in range(n):
    if p0[i] > maxp[i]:
        cnt += 1
    sum_max += max(p0[i],maxp[i])

if cnt == n:
    a = []
    for i in range(n):
        a.append(p0[i] + sum(maxp[:i]) + sum(maxp[i+1:]))
    print(max(a))
else:
    print(sum_max)
Problem p03544 (python)

Fixed submission:
n = int(input())
a = 2
b = 1
if n == 1:
    print(b)
else:
    for i in range(n-1):
        c = a+b
        a = b
        b = c
    print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = 2
b = 1
for i in range(n-1):
    c = a+b
    a = b
    b = c
print(c)
Problem p03612 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
 
t = 0
for i in range(n):
    if a[i] == i+1:
        t += 1

i = 0
cnt = 0
while i < n-1:
    if a[i] == i+1 and a[i+1] == i+2:
        cnt += 1
        i += 2
    else:
        i += 1

print(t-cnt)

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

t = 0
cnt = 0
for i in range(n):
    if a[i] == i+1:
        t += 1

for i in range(0,n,2):
    if (a[i] == i+1) and (a[i+1] == i+2):
        cnt += 1

print(t-cnt)
Problem p03633 (python)

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

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

n = int(input())
a = [int(input()) for _ in range(n)]

if n == 1:
    print(a[0])
    exit()

for i in range(n-1):
    if i == 0:
        b = lcm(a[i],a[i+1])
    else:
        b = lcm(b,a[i+1])
print(b)

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

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

n = int(input())
a = [int(input()) for _ in range(n)]

b = lcm(a[0],a[1])
for i in range(2,n):
    b = lcm(b,a[i])
print(int(b))
Problem p03759 (python)

Fixed submission:
a,b,c = map(int,input().split())
if b-a == c-b:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if b-a = c-b:
    print('YES')
else:
    print('NO')
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
a = ''
for i in range(len(e)):
    a += o[i] + e[i]
if len(o) > len(e):
    a += o[-1]
print(a)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
a = ''
for i in range(len(o)):
    a += o[i] + e[i]
print(a)
Problem p03814 (python)

Fixed submission:
s = input()
for i, a in enumerate(s):
    if a == 'A':
        l = i
        break
for i, z in enumerate(s[::-1]):
    if z == 'Z':
        r = len(s) - i
        break
print(r - l)

Buggy submission (verdict: Runtime Error):
s = input()
a = z =  ''
for i, v in enumerate(s):
    if not a:
        if v == 'A':
            a = i
    if not z:
        if s[len(s) - i -1] == 'Z':
            z = len(s) - i
            
    if a >= 0 and z >= 0:
        print(z - a)
        exit()
Problem p03862 (python)

Fixed submission:
n, x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in range(1, n):
    if a[i] + a[i-1] > x:
        b = a[i] + a[i-1] - x
        minab = min(a[i], b)
        a[i] -= minab
        cnt += minab
        
        b -= minab
        cnt += b
        a[i-1] -= b
print(cnt)

Buggy submission (verdict: Runtime Error):
n, x = map(int,input().split())
a = list(map(int,input().split()))
mina = min(a)
b = x - mina

a2 = []
a3 = []
for i in range(n):
    if i % 2 == 0:
        a2.append(mina)
        a3.append(b)
    else:
        a2.append(b)
        a3.append(mina)

cnt2 = 0
cnt3 = 0
for i in range(n):
    if a[i] >= a2[i]:
        cnt2 += a[i] - a2[i]
    else:
        cnt2 = None
        break
    
for i in range(n):
    if a[i] >= a3[i]:
        cnt3 += a[i] - a3[i]
    else:
        cnt3 = None
        break

if cnt2 and cnt3:
    print(min(cnt2,cnt3))
elif cnta2:
    print(cnt2)
elif cnta3:
    print(cnt3)
else:
    print(0)
Problem p04033 (python)

Fixed submission:
a,b = map(int,input().split())
if a <= 0 and b >= 0:
    print('Zero')
elif a > 0 and b > 0:
    print('Positive')
else:
    if (abs(a-b)+1) % 2 == 1:
        print('Negative')
    else:
        print('Positive')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
l = list(range(a,b+1))

ans = 1
for i in range(len(l)):
    ans *= l[i]

if ans > 0:
    print('Positive')
elif ans < 0:
    print('Negative')
else:
    print('Zero')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
l = list(range(a,b+1))
ans = 1
for i in range(len(l)):
    ans *= l[i]

if ans > 0:
    print('Positive')
elif ans < 0:
    print('Negative')
else:
    print(0)