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

Fixed submission:
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(3)] for j in range(n)]
for i in range(3):
    dp[0][i] = matrix[0][i]
for i in range(1,n):
    for j in range(3):
        if j == 0:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j+2])+matrix[i][j]
        elif j == 1:
            dp[i][j] = max(dp[i-1][j+1],dp[i-1][j-1])+matrix[i][j]
        else:
            dp[i][j] = max(dp[i-1][j-1], dp[i-1][j-2]) + matrix[i][j]
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(10)] for j in range(n+1)]


def go(i, j):
    if i < 0:
        return 0
    ans = 0
    if dp[i][j] > 0:
        return dp[i][j]
    dp[i][j] = max(ans, go(i-1, (j+1) % 3)+matrix[i][j], go(i-1, (j+2) % 3)+matrix[i][j])
    return dp[i][j]


print(max(go(n-1, 2),go(n-1,1),go(n-1,0)))

Buggy submission (verdict: Runtime Error):
# key not available ""
n = int(input())
matrix = []
for _ in range(n):
    matrix.append([int(i) for i in input().split()])
dp = [[0 for i in range(3)] for j in range(n+1)]


def go(i, j):
    if i < 0:
        return 0
    ans = 0
    if dp[i][j] > 0:
        return dp[i][j]
    dp[i][j] = max(ans, go(i-1, (j+1) % 3)+matrix[i][j], go(i-1, (j+2) % 3)+matrix[i][j])
    return dp[i][j]


print(max(go(n-1, 2),go(n-1,1),go(n-1,0)))
Problem p03136 (python)

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

m = L.pop(L.index(max(L)))
if sum(L) > m:
    print('Yes')
else:
    print('No')

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

m = L.pop(max(L))
if sum(L) > m:
    print('Yes')
else:
    print('No')
Problem p03262 (python)

Fixed submission:
from fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)

Buggy submission (verdict: Runtime Error):
import fractions from gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)

Buggy submission (verdict: Runtime Error):
import fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort()
m = x[1]-x[0]

for i in range(1,N+1):
    n = x[i]-x[i-1]
    v = gcd(m,n)
    m = v

print(m)
Problem p03339 (python)

Fixed submission:
import collections
N = int(input())
S = list(input())
cnt = 0

ans = [0]*N

for i in range(1,N):
    if S[i] == "E":
        cnt += 1
ans[0] = cnt

for i in range(1,N):
    if S[i-1] == 'E' and S[i] == 'E':
        ans[i] = ans[i-1]-1
    elif S[i-1] == "W" and S[i] == 'W':
        ans[i] = ans[i-1]+1
    else:
        ans[i] = ans[i-1]
     
print(min(ans))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = list(input())
cnt = 0
cntW = 0
cntE = 0
n = N-1

index = 0
for i in range(N-1):
    if S[i] != S[i+1]:
        cnt += 1
        index = i
i = 0
if cnt == 1:
    m = min(index,n-index)
    print(m)
    exit()
else:
    while i != n-1:
        if S[n] == 'E':
            cntE += 1
        if S[i] == 'W':
            i += 1
            n -= 1
            cntW += 1
        else:
            i += 1
print(cntW+cntE)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = list(input())
cnt = 0
cntW = 0
cntE = 0
n = N-1
i = 0

index = 0
for i in range(N):
    if S[i] == 'W' and S[i+1] == 'E':
        cnt += 1
        index = i
if cnt == 1:
    m = min(index,n-index)
    print(m)
    exit()
else:
    while i != n-1:
        if S[n] == 'E':
            cntE += 1
        if S[i] == 'W':
            i += 1
            n -= 1
            cntW += 1
        else:
            i += 1
print(cntW+cntE)
Problem p03360 (python)

Fixed submission:
A,B,C = map(int,input().split())
K = int(input())
array = []
for i in range(3):
    array.append([A,B,C])

for i in range(3):
    array[i][i] *= 2**K

print(max(sum(array[0]),sum(array[1]),sum(array[2])))

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

for i in range(3):
    array[i][i] *= 2**K

print(max(sum(array[0],array[1],array[2])))
Problem p03361 (python)

Fixed submission:
H,W = map(int,input().split())

s=[list(str(input())) for _ in range(H)]

di=[1,-1,0,0]
dj=[0,0,1,-1]
for i in range(H):
    for j in range(W):
        if s[i][j]=='#':
            found=False
            for k in range(4):
                i2=i+di[k]
                j2=j+dj[k]
                if 0<=i2 and i2<H and 0<=j2 and j2<W:
                    if s[i2][j2]=='#':
                        found=True
            if not found:
                print('No')
                exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [list(input()) for i in range(W)]
w = [1,0,0,-1]
h = [0,1,-1,0]
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            flag = False
            for k in range(4):
                if j+w[k] >= 0 and j+w[k] < H and i+h[k] >= 0 and i+h[k] < W:
                    if s[i+h[k]][j+w[k]] == '#':
                        flag = True
            
            if not flag:
                print('No')
                exit()

            
        
print('Yes')

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
s = [list(input()) for i in range(W)]
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if i == 0:
                if j == 0:
                    if s[i+1][j] != '#' and s[i][j+1] != '#':
                        print('No')
                        exit()
                elif j == W-1:
                    if s[i+1][j] != '#' and s[i][j-1] != '#':
                        print('No')
                        exit()
                else:
                    if s[i+1][j] != '#' and s[i][j-1] != '#' and s[i][j+1] != '#':
                        print('No')
                        exit()
            elif i == H-1:
                if j == 0:
                    if s[i-1][j] != '#' and s[i][j+1] != '#':
                        print('No')
                        exit()
                elif j == W-1:
                    if s[i-1][j] != '#' and s[i][j-1] != '#':
                        print('No')
                        exit()
                else:
                    if s[i-1][j] != '#' and s[i][j-1] != '#' and s[i][j+1] != '#':
                        print('No')
                        exit()
            else:
                if j == 0:
                    if s[i-1][j] != '#' and s[i][j+1] != '#' and s[i+1][j] != '#':
                        print('No')
                        exit()
                elif j == W-1:
                    if s[i-1][j] != '#' and s[i][j-1] != '#' and s[i+1][j] != '#':
                        print('No')
                        exit()
                else:
                    if s[i-1][j] != '#' and s[i][j-1] != '#' and s[i][j+1] != '#' and s[i+1][j] != '#':
                        print('No')
                        exit()
print('Yes')
Problem p03415 (python)

Fixed submission:
c = [list(input()) for i in range(3)]
print(''.join([c[0][0],c[1][1],c[2][2]]))

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

print(''.join([c[0][0],c[1][1],c[2][2]]))
Problem p03424 (python)

Fixed submission:
N = int(input())
S = list(map(str,input().split()))
if len(set(S)) == 4:
    print('Four')
elif len(set(S)) == 3:
    print('Three')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(int,input().split()))
if len(set(S)) == 4:
    print('Four')
elif len(set(S)) == 3:
    print('Three')
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):
a,b = map(int,input().split())
if A*B%2==0:
    print('Even')
else:
    print('Odd')
Problem p03502 (python)

Fixed submission:
N = input()
n = int(N)
sum = 0
a = list(N)
for i in range(len(a)):
    sum += int(a[i])

if n%sum==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
n = int(N)
sum = 0
a = list(input())
for i in range(len(a)):
    sum += int(a[i])

if n%sum==0:
    print('Yes')
else:
    print('No')
Problem p03543 (python)

Fixed submission:
import collections
N = list(input())
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
for i in ans:
    if i >= 2:
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
N = list(int(input()))
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
for i in ans:
    if i >= 3:
        print('Yes')
        exit()
print('No')
Problem p03547 (python)

Fixed submission:
X,Y = map(str,input().split())

a = ['A','B','C','D','E','F']
b = [10,11,12,13,14,15]

if a.index(X) > a.index(Y):
    print('>')
elif X == Y:
    print('=')
else:
    print('<')

Buggy submission (verdict: Runtime Error):
X,Y = map(int,input().split())

if X > Y:
    print('>')
elif x == Y:
    print('=')
else:
    print('<')
Problem p03556 (python)

Fixed submission:
n = int(input())

ans = 0

for a in range(10**5 + 1):
    if a**2 <= n:
        ans = max(ans, a**2)

print(ans)

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

for i in range(N):
    if i**2 > N:
        print(i-1)**2
        exit()
Problem p03605 (python)

Fixed submission:
N = list(input())

if '9' in N:
    print('Yes')
else:
    print('No')

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

if N in '9':
    print('Yes')
else:
    print('No')
Problem p03612 (python)

Fixed submission:
N = int(input())
p = list(map(int,input().split()))
cnt = 0
flag = True
for i in range(N):
    if p[i] == i+1:
        if flag:
            cnt += 1
            flag = False
        else:
            flag = True
    else:
        flag = True
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(N):
    if p[i] == i+1:
        value = p[i]
        p[i] = p[i+1]
        p[i+1] = value
        cnt += 1
print(cnt)
Problem p03632 (python)

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

s = min(B,D)-max(A,C)

if s <= 0:
    s = 0

print(s)

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

s = min(B-C,D-C)

if s <= 0:
    s = 0

print(s
Problem p03633 (python)

Fixed submission:
import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
t_lcm = int(input())
for i in range(N-1):
  t = int(input())
  t_lcm = (t_lcm*t)//fractions.gcd(t,t_lcm)
print(t_lcm)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
t_lcm = int(input())
for i in range(N-1):
  t = int(input())
  t_lcm = (t_lcm*t)//math.gcd(t,t_lcm)
print(t_lcm)

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

N = int(input())
T = np.array([int(input()) for _ in range(N)])

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

t_lcm = lcm(T[0],T[1])
for i in range(2,N):
    t_lcm = lcm(t_lcm,T[i])
print(t_lcm)

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

N = int(input())
T = np.array([int(input()) for _ in range(N)])


print(np.lcm.reduce(T))
# for i in range(1,N):

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

N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

a = np.array(T)
print(np.lcm.reduce(a))

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



N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
T = []

for i in range(N):
    t = int(input())
    T.append(t)

print(np.lcm.reduce(T))
Problem p03645 (python)

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

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(g)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Problem p03658 (python)

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

l.sort(reverse=True)

sum = 0

for i in range(k):
    sum += l[i]

print(sum)

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

l.sort(reverse=True)

sum = 0

for i in range(K):
    sum += l[i]

print(sum)

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

l.sort(reverse=True)

sum = 0

for i in range(K):
    sum += l[i]

print(sum)

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

l.sort()

print(l[-1]+l[len(l)-2]+l[len(l)-3])

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

l.sort()

print(l[-1]+l[-2]+l[-3])
Problem p03659 (python)

Fixed submission:

N = int(input())
a = list(map(int,input().split()))
x = a[0]
y = sum(a[1:])
ans = abs(x-y)
for i in range(1,N-1):
    x += a[i]
    y -= a[i]
    ans = min(abs(x-y),ans)

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
a = list(map(int,input().split()))
value = []
for i in range(2,N):
    x = sum(a[0:i])
    y = sum(a[i:N])
    value.append(abs(x-y))

print(min(value))

Buggy submission (verdict: Runtime Error):
from collections import deque
N = int(input())
a = list(map(int,input().split()))
value = deque()
for i in range(2,N):
    x = sum(a[0:i])
    y = sum(a[i:N])
    value.append(abs(x-y))
print(min(value))
Problem p03694 (python)

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

a.sort()

print(a[-1]-a[0])

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

a.sort()

print(a[-1]-a[0])
Problem p03695 (python)

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

color = [0]*8
count = 0

for a in A:
    if a < 400:
        color[0] = 1
    elif a < 800:
        color[1] = 1
    elif a < 1200:
        color[2] = 1
    elif a < 1600:
        color[3] = 1
    elif a < 2000:
        color[4] = 1
    elif a < 2400:
        color[5] = 1
    elif a < 2800:
        color[6] = 1
    elif a < 3200:
        color[7] = 1
    else:
        count += 1
sum_color = sum(color)

if sum_color == 0:
    print(1,count)
else:
    print(sum_color,sum_color+count)

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

color = [0]*8
count = 0

for i in a:
    if a < 400:
        color[0] = 1
    elif a < 800:
        color[1] = 1
    elif a < 1200:
        color[2] = 1
    elif a < 1600:
        color[3] = 1
    elif a < 2000:
        color[4] = 1
    elif a < 2400:
        color[5] = 1
    elif a < 2800:
        color[6] = 1
    elif a < 3200:
        color[7] = 1
    else:
        count += 1
sum_color = sum(color)

if sum_color == 0:
    print(1,count)
else:
    print(sum_color,sum_color+count)
Problem p03698 (python)

Fixed submission:
S = list(input())
s = set(S)

if len(s) == len(S):
    print('yes')
else:
    print('no')

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

if len(s) == len(S):
    print('yes')
else:
    prirnt('no')

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

if len(s) == len(S):
    print('yes')
else:
    prirnt('no')
Problem p03720 (python)

Fixed submission:
N,M = map(int,input().split())
ans = [0]*N
for i in range(M):
    a,b = map(int,input().split())
    ans[a-1] += 1
    ans[b-1] += 1

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
value = []
ans = [0]*M
for i in range(M):
    a,b = map(int,input().split())
    value.append([a,b])
    ans[a-1] += 1
    ans[b-1] += 1

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

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

if sum >= 24:
    print(sum-24)
else:
    print(sum)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input())
sum = A+B

if sum >= 24:
    print(sum-24)
else:
    print(sum)
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
if N > 0:
    p = list(map(int, input().split()))
elif N == 0:
    print(X)
    exit()
else :
    p = [int(input())]
if N == 100:
    if X <= 50:
        print(0)
    else:
        print(101)
    exit()

for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break
    elif i == 100:
        y = 101

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N != 0:
    p = list(map(int, input().split()))
else:
    print(X)
    exit()

if N == 100:
    print(0)
    exit()

for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N != 0:
    p = list(map(int, input().split()))
else:
    print(X)
    exit()

if N = 100:
    print(0)
    exit()

for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N != 0:
    p = list(map(int, input().split()))
else:
    p = []

if N == 100:
    print(-1)
    exit()


for i in range(X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N != 0:
    p = list(map(int, input().split()))
else:
    p = []

res = 10**9
MIN = res

for i in range(-100,X+1):
    if not i in p:
        x = i

for i in range(X,101):
    if not i in p:
        y = i
        break

if (X-x) == (y-X):
    print(x)
elif (X-x) > (y-X):
    print(y)
else:
    print(x)
Problem p02817 (python)

Fixed submission:
s,t = str(input()).split()
print(t+s)

Buggy submission (verdict: Runtime Error):
s,t = str(input())
print(t+s)
Problem p02939 (python)

Fixed submission:
S = input()
d1 = ""
d2 = ""
res = 0
for i in range(len(S)):
  d1 += S[i]
  if d1 != d2:
    d2 = d1
    d1 = ""
    res += 1
print(res)

Buggy submission (verdict: Runtime Error):
S = input()
d1 = ""
d2 = ""
res = 0
for i in range(len(S)):
  d1 += s[i]
  if d1 != d2:
    d2 = d1
    d1 = ""
    res += 1
print(res)
Problem p02975 (python)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
cc = []
res = a[0]
for i in range(1,N):
    res ^= a[i]
if res == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
cc = []
res = s[0]
for i in range(1,N):
    res^ = a[i]
if res == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
cc = []
res = s[0]
for i in range(1,N):
    res^ = s[i]
if res == 0:
    print('Yes')
else:
    print('No')
Problem p03076 (python)

Fixed submission:
A = [int(input()) for _ in range(5)]
cnt = 0
Max = 10
Max_i = 0
for i in range(len(A)):
    if 0 < A[i]%10 < Max:
        Max = A[i]%10
        Max_i = i
for i in range(len(A)):
    if i != Max_i:
        cnt += A[i]
    while cnt%10 != 0:
        cnt += 1
print(cnt+A[Max_i])

Buggy submission (verdict: Runtime Error):
A = [int(input()) for _ in range(5)]
cnt = 0
Max = 10
for i in range(len(A)):
    if 0 < A[i]%10 < Max:
        Max = A[i]%10
        Max_i = i
for i in range(len(A)):
    if i != Max_i:
        cnt += A[i]
    while cnt%10 != 0:
        cnt += 1
print(cnt+A[Max_i])
Problem p03106 (python)

Fixed submission:
A,B,K = map(int, input().split())
div_1 = []
div_res = []
for i in range(A+1):
    if i != 0 and A%i == 0:
        div_1.append(i)
for i in range(B+1):
    if i != 0 and B%i == 0 and (i in div_1):
        div_res.append(i)
div_res.reverse()
print(div_res[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
div_1 = []
div_res = []
for i in range(A):
    if i != 0 and A%i == 0:
        div_1.append(i)
for i in range(B):
    if i != 0 and B%i == 0 and i in div_1:
        div_res.append(i)
print(div_res[K-1])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int, input().split())
div_1 = []
div_res = []
for i in range(1,A):
    if A%i == 0:
        div_1.append(i)
for i in range(1,B):
    if B%i == 0 and i in div_1:
        div_res.append(i)
print(div_res[K-1])
Problem p03110 (python)

Fixed submission:
N = int(input())
res = 0
for i in range(N):
    x,u = map(str, input().split())
    if u == "JPY":
        res += int(x)
    else:
        res += float(x)*380000
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
res = 0
for i in range(N):
    x,u = map(str, input().split())
    if u == "JPY":
        res += int(x)
    else:
        res += int(x)*380000
print(res)
Problem p03126 (python)

Fixed submission:
N,M = map(int, input().split())
res = [0]*M
for i in range(N):
    A = list(map(int, input().split()))
    K = A[0]
    for j in range(1,K+1):
        res[A[j]-1] += 1
print(res.count(N))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
res = [0]
for i in range(N):
    K = list(map(int, input().split()))
    for j in K:
        res[K-1] = 1
print(M-res.count(0))
Problem p03231 (python)

Fixed submission:
import fractions
N, M = list(map(int, input().split()))
S = input()
T = input()
d = fractions.gcd(N,M)
n = N//d
m = M//d
for i in range(d):
    if S[i*n] != T[i*m]:
        flag = False
        break
    else:
        flag = True
if flag:
  print((N*M)//d)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import math
N, M = list(map(int, input().split()))
S = input()
T = input()
d = math.gcd(N,M)
n = N//d
m = M//d
for i in range(d):
    if S[i*n] != T[i*m]:
        flag = False
        break
    else:
        flag = True
if flag:
  print((N*M)//d)
else:
  print(-1)
Problem p03254 (python)

Fixed submission:
N,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(N):
    x -= a[i]
    if x < 0:
        break
    res += 1
if x > 0:
    res -= 1
print(res)

Buggy submission (verdict: Runtime Error):
 N,x = map(int, input().split())
 a = list(map(int, input().split()))
 a.sort()
 for i in range(N):
     x -= a[i]
     if x < 0:
         print(i+1)
         exit()
print(N)
Problem p03282 (python)

Fixed submission:
S = list(input())
K = int(input())
for i in range(min(len(S),K)):
    if S[i] != "1":
        print(int(S[i]))
        exit()
print(1)

Buggy submission (verdict: Runtime Error):
S = list(input())
K = int(input())
for i in range(len(K)):
    if S[i] != 1:
        print(S[i])
        exit()
print(1)