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

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)

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

import numpy as npz

ans = 0
for i in range(N):
    c = list(A[i]%np.array(A))
    if A.count(A[i]) == N:
        ans = 0
        break
        break
    if c.count(0) == 1:
        ans += 1
print(ans)

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

import numpy as npz

ans = 0
for i in range(N):
    if A.count(A[i]) == N:
        ans = 0
        break
        break
    c = list(A[i]%np.array(A))
    if c.count(0) == 1:
        ans += 1
print(ans)

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

import numpy as np

ans = 0
for i in range(N):
    if len(A_re) == 0:
        ans = 0
        break
        break
    c = [j for j in A[i]/np.array(A) if j.is_integer() ]
    #print(c)
    if len(c) == 1:
        ans += 1
print(ans)

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

import numpy as np

ans = 0
for i in range(N):
    if len(A_re) == 0:
        ans = 0
        break
        break
    c = [j for j in A[i]/np.array(A) if j.is_integer() ]
    print(c)
    if len(c) == 1:
        ans += 1
print(ans)
Problem p02658 (python)

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

ans = 1
if any([i ==0 for i in A]):
    ans =0
    
for i in range(N):
    ans = ans * A[i]
    if ans == 0:
        ans = 0
        break
    if ans >10**18:
        ans= -1
        break
    else:
        pass
    
print(ans)

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

import functools
import operator

ans = functools.reduce(operator.mul, A)

if result > 10**18:
    ans = -1
print(ans)
Problem p02664 (python)

Fixed submission:
T = input()
print(T.replace("?","D"))

Buggy submission (verdict: Runtime Error):
T = input()
lis = list(T)
n = lis.count("?")

temp = [i for i, x in enumerate(lis) if x == '?']
t = 0
for i, e in enumerate(temp):
    if 0 <= e -2:
        if 1 == e-t  and lis[e - 2] == "D":
            lis[e-1] = "P"
            lis[e] = "D"
    if e == 0:
        lis[e] = "P"
    if e < len(lis) - 1:
        if lis[e + 1] == "D":
            lis[e] = "P"
    if lis[e - 1] == "P":
        lis[e] = "D"

    t = e
    LIS = ''.join(lis)
print(LIS)

Buggy submission (verdict: Runtime Error):
T = input()
lis = list(T)
n = lis.count("?")
 
temp = [i for i, x in enumerate(lis) if x == '?']
 
t = 0
for i, e in enumerate(temp):
    if 1 == e-t  and lis[e - 2] == "D":
        lis[e-1] = "P"
        lis[e] = "D"
    if e == 0:
        lis[e] = "P"
    if e <= len(lis) - 1:
        if lis[e + 1] == "D":
            lis[e] = "P"
    if lis[e - 1] == "P":
        lis[e] = "D"
 
    t = e
    LIS = ''.join(lis)
print(LIS)

Buggy submission (verdict: Runtime Error):
T = input()
lis = list(T)
n = lis.count("?")

temp = [i for i, x in enumerate(lis) if x == '?']

t = 0
for i, e in enumerate(temp):
    if 1 == e-t  and lis[e - 2] == "D":
        lis[e-1] = "P"
        lis[e] = "D"
    if e == 0:
        lis[e] = "P"
    if e < len(lis) - 1:
        if lis[e + 1] == "D":
            lis[e] = "P"
    if lis[e - 1] == "P":
        lis[e] = "D"

    t = e
    LIS = ''.join(lis)
print(LIS)

Buggy submission (verdict: Runtime Error):
T = input()
lis = list(T)
n = lis.count("?")
 
temp = [i for i, x in enumerate(lis) if x == '?']
 
t =0
op_cnt = n
for i in range(2 ** n):
    op = ["P"] * n  # あらかじめ ["P", "P", "P"] というリストを作っておく
    for j in range(n):
        if ((i >> j) & 1):
            op[n - 1 - j] = "D"  # フラグが立っていた箇所を "D" で上書き
 
    for i, e in enumerate(op):
        lis[temp[i]] = e
        LIS = ''.join(lis)
        #print(t , LIS.count("PD"))
        if t < LIS.count("PD"):
            t = LIS.count("PD")
            List = LIS
            #print(t,LIS)
        else:
            pass
print(List)

Buggy submission (verdict: Runtime Error):
T = input()
lis = list(T)
n = lis.count("?")

temp = [i for i, x in enumerate(lis) if x == '?']

t =0
op_cnt = n
for i in range(2 ** n):
    op = ["P"] * n  # あらかじめ ["P", "P", "P"] というリストを作っておく
    for j in range(n):
        if ((i >> j) & 1):
            op[n - 1 - j] = "D"  # フラグが立っていた箇所を "D" で上書き

    for i, e in enumerate(op):
        lis[temp[i]] = e
        LIS = ''.join(lis)
        print(t , LIS.count("PD"))
        if t < LIS.count("PD"):
            t = LIS.count("PD")
            List = LIS
            #print(t,LIS)
        else:
            pass
print(List)
Problem p02683 (python)

Fixed submission:
import numpy as np
n, M, X = list(map(int, input().split()))
CA = []
A = []
for _ in range(n):
    L = list(map(int, input().split()))
    CA.append(L[:])
    
ans = np.zeros(M+1)
S = [0]*n
ANS = list()
def makeCombination():
    for i in range(0, n-1):
        S[i] = 0
    rec(0, ans)
def rec(i,ans):
    if i == n:
        if all(ans[1:] >= X) == True:
            ANS.append(ans[0])
        return
    rec(i + 1,ans)
    S[i] = 1
    ans = ans   + np.array(CA[i])
    rec(i + 1, ans)
    S[i] = 0
makeCombination()
ANS.sort()
if len(ANS) >= 1:
    print(int(ANS[0]))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, M, X = list(map(int, input().split()))
CA = []
A = []
for _ in range(N):
    L = list(map(int, input().split()))
    CA.append(L[:])
ans = np.zeros(M+1)

S = [0]*n
ANS = list()
def makeCombination():
    for i in range(0, n-1):
        S[i] = 0
    rec(0, ans)
def rec(i,ans):
    if i == n:
        if all(ans[1:] >= X) == True:
            ANS.append(ans[0])
        return
    rec(i + 1,ans)
    S[i] = 1
    ans = ans   + np.array(CA[i])
    rec(i + 1, ans)
    S[i] = 0
makeCombination()
ANS.sort()
if len(ANS) >= 1:
    print(ANS[0])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, M, X = list(map(int, input().split()))
CA = []
A = []
for _ in range(N):
    L = list(map(int, input().split()))
    CA.append(L[:])
ans = np.zeros(M+1)
S = [0]*n
ANS = list()
def makeCombination():
    for i in range(0, n-1):
        S[i] = 0
    rec(0, ans)
def rec(i,ans):
    if i == n:
        #print(S)
        print(ans)
        print(ans[1:] >= X)
        if all(ans[1:] >= X) == True:
            ANS.append(ans[0])
        return
    rec(i + 1,ans)
    S[i] = 1
    ans = ans   + np.array(CA[i])
    rec(i + 1, ans)
    S[i] = 0
makeCombination()
ANS.sort()
if len(ANS) >= 1:
    print(ANS[0])
else:
    print(-1)
Problem p02700 (python)

Fixed submission:
import math
a, b, c, d = map(int, input().split())
t = math.ceil(a / d)
a = math.ceil(c / b)
if t >= a:
    print("Yes")
else:
    print("No")

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

t = C /B
a = A /D

if B > C:
    ans = "Yes"
elif B < C and A % D ==0:
    ans = "No"
else:
    if t <= a+1:
        ans = "Yes"
    elif A % D == 0 and C % B ==0:
        ans = "Yes"
    elif A % D == 0:
        ans = "No"

print(ans)
Problem p02713 (python)

Fixed submission:
from math import gcd

k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        p = gcd(a,b)
        for c in range(1,k+1):
            ans += gcd(p,c)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())
sum_gcd = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = math.gcd(a, b)
        for c in range(1, K+1):
            sum_gcd += np.gcd(n, c)
print(sum_gcd)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())
sum_gcd = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = math.gcd(a, b)
        for c in range(1, K+1):
            sum_gcd += np.gcd(n, c)
print(sum_gcd)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())

sum = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        n = math.gcd(a, b)
        for c in range(1, K+1):
            sum += np.gcd(n, c)
print(sum)
Problem p02719 (python)

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

if N%K == 0:
    print("0")
elif abs(N%K- K)<N:
    print(abs(N%K- K))
else:
     print(N)

Buggy submission (verdict: Runtime Error):
if N%K == 0:
   print("0")

#最小値を求める上では余りが割る数を下回るまで続く
elif abs(N%K- K)<N:
     print(abs(N%K- K))
 
else:
     print(N[0])
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    if len(str(i))==n:
        x=str(i)
        for b,c in a:
            if int(x[b-1])!=c:
                break
        else:
            print(i)
            exit()
print(-1)

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

b = [0]*N

ans = 0
for i in range(N):
    if b[A[i][0]-1] ==0:
        b[A[i][0]-1] = A[i][1]
    elif b[A[i][0]-1] == A[i][1]:
        pass
    else:
        ans = -1
        break

s = ''.join([str(N) for N in b])

if ans == 0:
    print(s)
else:
    print(ans)

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

b = [0]*N

ans = 0
for i in range(N):
    #print(A[i][0])
    if b[A[i][0]-1] ==0:
        b[A[i][0]-1] = A[i][1]
    elif b[A[i][0]-1] == A[i][1]:
        pass
    else:
        ans = -1
        break

s = ''.join([str(N) for N in b])

if ans == 0:
    print(s)
else:
    print(s)

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

b = [0]*N

ans = 0
for i in range(N):
    print(A[i][0])
    if b[A[i][0]-1] ==0:
        b[A[i][0]-1] = A[i][1]
    elif b[A[i][0]-1] == A[i][1]:
        pass
    else:
        ans = -1
        break

s = ''.join([str(N) for N in b])

if ans == 0:
    print(s)
else:
    print(s)
Problem p02861 (python)

Fixed submission:
import math

N = int(input())
x = []
y = []

for k in range(N):
    #print(i)
    X, Y =  map(int,input().split())
    x.append(X)
    y.append(Y)

ans = 0    
for i in range(N):
    for j in range(N):
        tmp = math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
        ans += tmp
 
print(ans/N)

Buggy submission (verdict: Runtime Error):
import math
 
N = int(input())
x = list()
y = list()
 
for i in range(N):
    #print(i)
    xy = list(input().split())
    x.append(int(xy[0]))
    y.append(int(xy[1]))
 
lis = list(itertools.permutations(list(range(1, N + 1))))
 
ans = 0    
for i in range(N):
    for j in range(N):
        tmp = math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
        ans += tmp
 
print(ans/N)

Buggy submission (verdict: Runtime Error):
import itertools
 
N = int(input())
x = list()
y = list()
 
for i in range(N):
    #print(i)
    xy = list(input().split())
    x.append(int(xy[0]))
    y.append(int(xy[1]))

ans = 0    
for i in range(N):
    for j in range(N):
        tmp = math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
        ans += tmp
 
print(ans/N)

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())
x = list()
y = list()

for i in range(N):
    #print(i)
    xy = list(input().split())
    x.append(int(xy[0]))
    y.append(int(xy[1]))

lis = list(itertools.permutations(list(range(1, N + 1))))

ans = 0    
for i in range(N):
    for j in range(N):
        tmp = math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
        ans += tmp
 
print(ans/N)
Problem p02911 (python)

Fixed submission:
import numpy as np

N, K, Q = map(int, input().split()) 
score = np.array([0]*N)

def change_score(N ,A, score):
    #score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    #print(score)
    f_score = score

for i in f_score:
    if i + K - Q > 0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split()) 
score = np.array([K]*N)

def change_score(N ,A, score):
    score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    #print(score)
    f_score = score

for i in f_score:
    if i > 0:
        print("Yes")
    else:
        print("No")

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

def change_score(N ,A, score):
    score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

score = np.array([K]*N)
for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    #print(score)
    f_score = score

for i in f_score:
    if i > 0:
        print("Yes")
    else:
        print("No")

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

def change_score(N ,A, score):
    score = score - np.array([1]*N)
    score[A-1] = score[A-1] + 1
    return score

score = np.array([K]*N)
for i in range(Q):
    A = int(input())
    score = change_score(N, A, score)
    print(score)
    f_score = score

for i in f_score:
    if i > 0:
        print("Yes")
    else:
        print("No")
Problem p02922 (python)

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

print(math.ceil((B -1) / (A - 1)))

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

print(math.ceil((A -1) / (B - 1)))
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
H_max = 0

for i in range(N-1):
    if H_max < H[i]:
        H_max = H[i]
    if H[i+1] < H_max - 1:
        print("No")
        break
else:
    print("Yes")

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

for i in range(len(H)-1):
    if H[i] - H[i+1] <= 0:
        ans = "Yes"
    else:
        ans = "No"

print(ans)
Problem p02983 (python)

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

if(R - L) >= 2019:
    print(0)
    exit()
 
ans = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        t = i*j%2019
        ans = min(ans,t)
print(ans)

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

 if R - L >= 2019:
        print(0)
        exit()
 
ans = float('inf')
for i in range(L, R):
    for j in range(i+1, R+1):
        t = i*j%2019
        ans = min(ans,t)
print(ans)
Problem p03001 (python)

Fixed submission:
w, h, x, y = list(map(int,input().split()))
area = (w * h) / 2
if x == (w / 2) and y == (h / 2):
    print(area, 1)
else:
    print(area, 0)

Buggy submission (verdict: Runtime Error):
W, H, x, y = list(map(int,input().split()))

y_min = min(W*y, W*(H-y))
x_min = min(H*x, H*(W-x))

if y_min == x_min:
    ans = 1
else:
    ans = 0
print(f'{max(x_min, y_min):.08f}', ans)
Problem p03239 (python)

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

ans_c = 1001
for i in range(T):
    c, t = list(map(int,input().split()))
    if (N >= t) and (c <= ans_c):
        ans_c = c

if ans_c == 1001:
    print("TLE")
else:
    print(ans_c)

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

ans_c = 1001
for i in range(T):
    c, t = list(map(int,input().split()))
    if (N >= t) and (c <= ans_c):
        ans_c = c

if ans_t == 1001:
    print("TLE")
else:
    print(ans_c)
Problem p03262 (python)

Fixed submission:
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)

N, X = list(map(int, input().split()))
 
x = list(map(int, input().split()))
x.append(X)
x.sort()
 
res = [abs(x[i+1]-x[i]) for i in range(len(x)-1)]
print(gcd(*res))

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

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

N, X = list(map(int, input().split()))

x = list(map(int, input().split()))
x.append(X)
x.sort()

res = [abs(x[i+1]-x[i]) for i in range(len(x))]
print(gcd(*res))

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

N, X = list(map(int, input().split()))

x = list(map(int, input().split()))
x.sort()

res = [x[i+1]-x[i] for i in range(len(x)-1)]

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

print(gcd(*res))
Problem p03281 (python)

Fixed submission:
N = int(input())

def make_divisors(n):
    ans = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans += 1
            if i != n // i:
                ans += 1
    return ans

ans = 0
for i in range(1,N+1):
    if (i %2 ==1) and (make_divisors(i) ==8):
        ans += 1

print(ans)

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

def make_divisors(n):
    ans = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans += 1
            if i != n // i:
                ans += 1
    return ans

for i in range(1,N+1):
    if (i %2 ==1) and (make_divisors(i) ==8):
        ans += 1

print(ans)

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

ans = 0
import sympy
for i in range(1,N+1):
    if (i %2 ==1) and (len(sympy.divisors(i)) ==8):
        ans += 1

print(ans)
Problem p03316 (python)

Fixed submission:
N = input()

ans = 0
for i in N:
    ans += int(i)

if int(N) % ans ==0:
    print("Yes")
else:
    print("No")

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

ans = 0
for i in N:
    ans += int(i)

if N % ans ==0:
    print("Yes")
else:
    print("No")
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):
n=int(input())
d,x=map(int,input().split())
res = x
for i in range(n):
    a=int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
d, x = map(int,input().split())
res = x
for i in range(n):
    a = int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)

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

for i in range(n):
  a = int(input())
  if a == 1:
    res +=d
  else :
    res += (d-1)//a + 1
print(res)

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

for i in range(n):
    a = int(input())
    if a == 1:
        res +=d
    else :
        res += (d-1)//a + 1
print(res)
Problem p03697 (python)

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

if (A+B)<10:
    print(A+B)
else:
    print("error")

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

if (A+B)<10:
    print(A+B)
else:
    print("error")
Problem p03943 (python)

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

if a+b==c or b+c==a or c+a==b:
    print("Yes")
else:
    print("No")

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

if ((a+b)==c) or ((b+c)==a ) or ((c+a)==b):
    print("Yes")
else:
    print("No")

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

if (a+b)==c or (b+c)==a or (c+a)==b:
    print("Yes")
else:
    print("No")
Problem p02612 (python)

Fixed submission:
#N円の商品を1000円札で支払う時のおつり。

price=int(input())
surpus=price%1000
print((1000-surpus)%1000)

Buggy submission (verdict: Runtime Error):
#N円の商品を1000円札で支払う時のおつり。

price=int(print())
surpus=price%1000
return surpus
Problem p02613 (python)

Fixed submission:
num=int(input())
count_AC=0
count_WA=0
count_TLE=0
count_RE=0

def judge(x):
        global count_AC
        global count_WA
        global count_TLE
        global count_RE
        if x=='AC':
            count_AC+=1
        if x=='WA':
            count_WA+=1
        if x=='TLE':
            count_TLE+=1
        if x=='RE':
            count_RE+=1

for i in range(num):
        judge(input())

print('AC x',str(count_AC),'\nWA x',str(count_WA),'\nTLE x',str(count_TLE),'\nRE x',str(count_RE))

Buggy submission (verdict: Runtime Error):
'AC x',str(count_AC)\n'WA x',str(count_WA)\n'TLE x',str(count_TLE)\n'RE x',str(count_RE)
Problem p02730 (python)

Fixed submission:
import sys
S=input()
N=len(S)
if S[:N//2]==S[N//2+1:][::-1]:
  if N==3:
    print("Yes")
  elif (N//2)%2==1:
    if S[:(N//2)//2]==S[(N//2)//2+1:N//2][::-1] and S[N//2+1:-(N//2)//2]==S[-(N//2)//2+1:][::-1]:
      print("Yes")
    else:
#      sys.stderr.write("2\n")
      print("No")
  else:
    if S[:(N//2)//2]==S[(N//2)//2:N//2][::-1] and S[N//2+1:-(N//2)//2]==S[-(N//2)//2:][::-1]:
      print("Yes")
    else:
      print("No")
else:
#  sys.stderr.write("1\n")
  print("No")

Buggy submission (verdict: Runtime Error):
S=input()
t=len(S)
m=t//2
S1=""
S2=""
for x1 in range(m):
  S1 += S[x1]
for x2 in range(m+1,2*m+1):
  S2 += S[x2]
S2=S2[::-1]
if S1==S2:
  t1=len(S1)
  t2=len(S2)
  m1=t1//2
  m2=t2//2
  R11=""
  R12=""
  for y1 in range(m1):
    R11 += S1[y1]
  for y2 in range(m1+1,2*m1+1):
    R12 += S1[y2]
  R12=R12[::-1]
  if R11==R12:
    R21=""
    R22=""
    for z1 in range(m2):
      R21 += S2[z1]
    for z2 in range(m2+1,2*m2+1):
      R22 += S2[z2]
    R22=R22[::-1]
    if R21==R22:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')
Problem p02761 (python)

Fixed submission:
'''
Created on 2020/08/31

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N,M=map(int,pin().split())
  ans=[0]*N
  for _ in [0]*M:
    s,c=map(int,pin().split())
    if s==1 and c==0 and N!=1:
      print(-1)
      return 
    if ans[s-1]!=0 and ans[s-1]!=c:
      print(-1)
      return
    ans[s-1]=c
  if N==3:
    if ans[0]==0:
      if ans[1]==0:
        print(f"{1}{0}{ans[2]}")
      else:
        print(f"{1}{ans[1]}{ans[2]}")
      return
    else:
      print(f"{ans[0]}{ans[1]}{ans[2]}")
      return
  elif N==2:
    if ans[0]==0:
      print(f"{1}{ans[1]}")
    else:
      print(f"{ans[0]}{ans[1]}")
    return
  else:
    print(ans[0])
    return
  return
main()

Buggy submission (verdict: Runtime Error):
'''
Created on 2020/09/10

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M=map(int,pin().split())
  if N==3:
    ans=[1,0,0]
    for _ in [0]*M:
      s,c=map(int,pin().split())
      if s==1 and c==0:
        print(-1)
        return 
      if s!=1 and ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        return 
      ans[s-1]=c
    a=""
    for i in ans:
      a+=str(i) 
    print(a)
    return 
  elif N==2:
    ans=[1,0]
    for _ in [0]*M:
      s,c=map(int,pin().split())
      if s==1 and c==0:
        print(-1)
        return 
      if s!=1 and ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        return 
      ans[s-1]=c
    a=""
    for i in ans:
      a+=str(i)
    print(a)
    return
  else:
    s,c=map(int,pin().split())
    ans=c 
    for j in range(M-1):
      s,c=map(int,pin().split())
      if c!=ans:
        print(-1)
        return 
    print(ans)
    return 
  
main()
Problem p03106 (python)

Fixed submission:
A,B,K=map(int,input().split())
i=0
j=min(A,B)+1
while i<K:
  j-=1
  if A%j==0 and B%j==0:
    i+=1
print(j)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
i=0
j=0
while i<K:
  j+=1
  if A*%j==0 and B%j==0:
    i+=1
print(j)