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

Fixed submission:
from operator import itemgetter
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [None, 2, 5, 5, 4, 5, 6, 3, 7, 6]
D = []
set_D = set()
A.sort(reverse=True)
for a in A:
    if B[a] in set_D:
        continue
    else:
        set_D.add(B[a])
        D.append([a, B[a]])

D.sort(key=itemgetter(0), reverse=True)
dp = [-10**10]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for elem in set_D:
        if i < elem or dp[i-elem] is None:
            continue
        dp[i] = max(dp[i], dp[i-elem]+1)
ans = ''
while N > 0:
    for i in range(len(D)):
        if N-D[i][1] < 0:
            continue
        if dp[N-D[i][1]] == dp[N]-1:
            ans += str(D[i][0])
            N -= D[i][1]
            break
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [None, 2, 5, 5, 4, 5, 6, 3, 7, 6]
D = []
set_D = set()
A.sort(reverse=True)
for a in A:
    if B[a] in set_D:
        continue
    else:
        set_D.add(B[a])
        D.append([a, B[a]])

D.sort(key=itemgetter(0), reverse=True)
dp = [-10**10]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    for elem in set_D:
        if i < elem or dp[i-elem] is None:
            continue
        dp[i] = max(dp[i], dp[i-elem]+1)
ans = ''
while N > 0:
    for i in range(len(D)):
        if dp[N-D[i][1]] == dp[N]-1:
            ans += str(D[i][0])
            N -= D[i][1]
            break
print(ans)
Problem p03148 (python)

Fixed submission:
from operator import itemgetter
N, K = map(int, input().split())
td = [list(map(int, input().split())) for _ in range(N)]
td.sort(key=itemgetter(1, 0), reverse=True)
t, d = zip(*td)

s = set()
q = []
tmp = 0
now = 0
for i in range(K):
    if t[i] not in s:
        s.add(t[i])
    else:
        q.append(d[i])

    tmp += d[i]
    now += 1
kind = len(s)
sums = [-100000000000]*(kind+1)
sums[kind] = tmp
#for i in range(K, N):
#    if not q:
#        break
#    if t[i] not in s:
#        s.
while q:
    kind += 1
    tmp = q.pop()
    for i in range(now, N):
        now += 1
        if t[i] not in s:
            s.add(t[i])
            sums.append(sums[kind-1] + d[i] - tmp)
            break
for i in range(len(sums)):
    sums[i] += i**2
print(max(sums))

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
from collections import Counter
import heapq
N, K = map(int, input().split())
td = [list(map(int, input().split())) for _ in range(N)]
td.sort(key=itemgetter(1, 0), reverse=True)
t, d = zip(*td)

cnt_all = Counter(t)
cnt_all = cnt_all.most_common()
kind = len(cnt_all)
tmp = 0
i = 0
while tmp < K:
    tmp += cnt_all[i][1]
    i += 1
init_kind = i
S = []
heapq.heapify(S)
cnt = Counter()
for i in range(K):
    cnt[t[i]] += 1
    heapq.heappush(S, (d[i], i, t[i]))
sums = [0]*(K+1)
sums[init_kind] = sum(list(zip(*S))[0])
for i in range(init_kind, kind):
    nS = []
    heapq.heapify(nS)
    keys = cnt.keys()
    remove_flag = False
    for _ in range(K):
        tmp = heapq.heappop(S)
        if cnt[tmp[2]] == 1:
            heapq.heappush(nS, tmp)
        else:
            if remove_flag:
                heapq.heappush(nS, tmp)
            else:
                remove_flag = True
                cnt[tmp[2]] -= 1
    for j in range(N):
        if t[j] not in keys:
            heapq.heappush(nS, (d[j], j, t[j]))
            cnt[t[j]] += 1
            break
    sums[i+1] = sum(list(zip(*nS))[0])
    S = nS
for i in range(len(sums)):
    sums[i] += i**2
print(max(sums))
Problem p03150 (python)

Fixed submission:
S = input()
ans = 'keyence'

if S[0] == 'k':
    flag = True
    for i in range(1, 7):
        if S[i] != ans[i]:
            flag = False
            break
    if flag:
        print('YES')

    else:
        if ans[i:] == S[-len(ans[i:]):]:
            print('YES')
        else:
            print('NO')
else:
    if S[-7:] == ans:
        print('YES')
    else:
        print('NO')

Buggy submission (verdict: Runtime Error):
  S = input()
ans = 'keyence'

if S[0] == 'k':
    flag = True
    for i in range(1, 7):
        if S[i] != ans[i]:
            flag = False
            break
    if flag:
        print('YES')

    else:
        if ans[i:] == S[-len(ans[i:]):]:
            print('YES')
        else:
            print('NO')
else:
    if S[-7:] == ans:
        print('YES')
    else:
        print('NO')
Problem p03157 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)

H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())


dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

used = [[False for _ in range(W)] for _ in range(H)]


def dfs(x, y):
    global nb, nw
    if S[y][x] == '#':
        nb += 1
    if S[y][x] == '.':
        nw += 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or nx >= W or ny < 0 or ny >= H:
            continue
        if used[ny][nx]:
            continue
        if S[y][x] == '#' and S[ny][nx] == '#':
            continue
        if S[y][x] == '.' and S[ny][nx] == '.':
            continue
        used[ny][nx] = True
        dfs(nx, ny)

ans = 0
for i in range(H):
    for j in range(W):
        if not used[i][j]:
            used[i][j] = True
            nb = 0
            nw = 0
            dfs(j, i)
            ans += nb*nw
print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append(input())


dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

used = [[False for _ in range(W)] for _ in range(H)]


def dfs(x, y):
    global nb, nw
    if S[y][x] == '#':
        nb += 1
    if S[y][x] == '.':
        nw += 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or nx >= W or ny < 0 or ny >= H:
            continue
        if used[ny][nx]:
            continue
        if S[y][x] == '#' and S[ny][nx] == '#':
            continue
        if S[y][x] == '.' and S[ny][nx] == '.':
            continue
        used[ny][nx] = True
        dfs(nx, ny)

ans = 0
for i in range(H):
    for j in range(W):
        if not used[i][j]:
            used[i][j] = True
            nb = 0
            nw = 0
            dfs(j, i)
            ans += nb*nw
print(ans)
Problem p03231 (python)

Fixed submission:
import math

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

N, M = list(map(int, input().split()))
S = input()
T = input()
g = gcd(N, M)
lcm = N*M//g
if N%M==0 or M%N==0:
    exist = True
    if N>M:
        for i in range(M):
            if S[N//M*i]!=T[i]:
                exist = False
                break
    else:
        for i in range(N):
            if T[M//N*i]!=S[i]:
                exist = False
                break
    if exist:
        print(max(N, M))
    else:
        print(-1)
else:
    n_s = lcm//N
    n_t = lcm//M
    mul = n_s*n_t
    exist = True
    for i in range(0, lcm, mul):
        if S[i//n_s]!=T[i//n_t]:
            exist = False
            break
    if exist:
        print(lcm)
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
import math

N, M = list(map(int, input().split()))
S = input()
T = input()
gcd = math.gcd(N, M)
lcm = N*M//gcd
if N%M==0 or M%N==0:
    exist = True
    if N>M:
        for i in range(M):
            if S[N//M*i]!=T[i]:
                exist = False
                break
    else:
        for i in range(N):
            if T[M//N*i]!=S[i]:
                exist = False
                break
    if exist:
        print(max(N, M))
    else:
        print(-1)
else:
    print(lcm)

Buggy submission (verdict: Runtime Error):
import math

N, M = map(int, input().split())
S = input()
T = input()
gcd = math.gcd(N, M)
lcm = N*M//gcd
if N%M==0 or M%N==0:
    exist = True
    if N>M:
        for i in range(M):
            if S[N//M*i]!=T[i]:
                exist = False
                break
    else:
        for i in range(N):
            if T[M//N*i]!=S[i]:
                exist = False
                break
    if exist:
        print(max(N, M))
    else:
        print(-1)
else:
    print(lcm)
Problem p03262 (python)

Fixed submission:
from functools import reduce


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

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = []
for i in range(len(x)-1):
    y.append(x[i+1]-x[i])
print(reduce(gcd, y))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = []
for i in range(len(x)-1):
    y.append(x[i+1]-x[i])
print(reduce(math.gcd, y))
Problem p03311 (python)

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

for i in range(N):
    A[i] -= i + 1

sortA = sorted(A)

if(N>1):
    b1 = sortA[(N-1)//2]
    b2 = sortA[(N-1)//2+1]

    ans1 = 0
    ans2 = 0
    for i in range(N):
        ans1 += abs(b1-A[i])
        ans2 += abs(b2-A[i])

    print(min(ans1, ans2))
else:
    print(0)

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

for i in range(N):
    A[i] -= i + 1

sortA = sorted(A)
b1 = sortA[(N-1)//2]
b2 = sortA[(N-1)//2+1]

ans1 = 0
ans2 = 0
for i in range(N):
    ans1 += abs(b1-A[i])
    ans2 += abs(b2-A[i])

print(min(ans1, ans2))
Problem p03393 (python)

Fixed submission:
S = input()
chars = list(map(lambda c: ord(c)-97, S))
if len(chars)!=26:
    chars = sorted(chars)
    i = 0
    while i==chars[i]:
        i += 1
        if i==len(chars):
            break
    ans = S + chr(i+97)
else:
    prev = -1
    i = 0
    for c in reversed(chars):
        if prev < c:
            i += 1
            prev = c
        else:
            break
    if i==26:
        ans = -1
    else:
        max_s = chars[-i-1]
        min_c = 27
        for c in chars[-i:]:
            if c>max_s and c<min_c:
                min_c = c
        ans = S[:-i-1] + chr(min_c+97)

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
chars = list(map(lambda c: ord(c)-97, S))
if len(chars)!=26:
    chars = sorted(chars)
    i = 0
    while i==chars[i]:
        i += 1
    ans = S + chr(i+97)
else:
    prev = -1
    i = 0
    for c in reversed(chars):
        if prev < c:
            i += 1
            prev = c
        else:
            break
    if i==26:
        ans = -1
    else:
        max_s = chars[-i-1]
        min_c = 27
        for c in chars[-i:]:
            if c>max_s and c<min_c:
                min_c = c
        ans = S[:-i-1] + chr(min_c+97)

print(ans)
Problem p03450 (python)

Fixed submission:
from collections import deque
N, M = map(int, input().split())
#L = []
#R = []
#D = []
G = [[] for _ in range(N+1)]
for _ in range(M):
    tmpl, tmpr, tmpd = map(int, input().split())
    # L.append(tmpl)
    # R.append(tmpr)
    # D.append(tmpd)
    G[tmpl].append((tmpr, tmpd))
    G[tmpr].append((tmpl, -tmpd))

field = [None] * (N+1)


def dfs(i):
    q = deque()
    q.append(i)
    field[i] = 0
    #used = [False]*(N+1)
    #used[i] = True
    while q:
        tmp = q.pop()
        for elem in G[tmp]:
            if field[elem[0]] is not None:
                if field[elem[0]] != field[tmp]+elem[1]:
                    return False
                continue
            else:
                q.append(elem[0])
                field[elem[0]] = field[tmp]+elem[1]

            # if used[elem[0]]:
            #    if field[elem[0]] is not None:
            #        if field[elem[0]] != field[tmp]+elem[1]:
            #            return False
            #    continue
            # q.append(elem[0])
            # if field[elem[0]] == None:
            #    field[elem[0]] = field[tmp]+elem[1]
            #    used[elem[0]] = True
            # else:
            #    if field[elem[0]] != field[tmp]+elem[1]:
            #        return False

    return True


for i in range(1, N+1):
    if field[i] == None:
        if not dfs(i):
            print('No')
            exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    tmpl, tmpr, tmpd = map(int, input().split())
    G[tmpl].append((tmpr, tmpd))
    G[tmpr].append((tmpl, -tmpd))

field = [None] * (N+1)


def dfs(i):
    for elem in G[i]:
        if field[elem[0]] is not None:
            if field[elem[0]] != field[i]+elem[1]:
                return False
            continue
        else:
            field[elem[0]] = field[i]+elem[1]
            dfs(elem[0])
    return True


for i in range(1, N+1):
    if field[i] is None:
        field[i] = 0
        if not dfs(i):
            print('No')
            exit()
print('Yes')
Problem p03504 (python)

Fixed submission:
from itertools import accumulate
N, C = map(int, input().split())
STC = [list(map(int, input().split())) for _ in range(N)]

M = 10**5+1
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
    s, t, c = STC[i]
    merge[c][s] += 1
    merge[c][t+1] -= 1
for c in range(31):
    merge[c] = list(map(lambda x: int(bool(x)), accumulate(merge[c])))

ans = []
for i in range(M+1):
    res = 0
    for j in range(31):
        res += merge[j][i]
    ans.append(res)
print(max(ans))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N, C = map(int, input().split())
STC = [list(map(int, input().split())) for _ in range(N)]

M = 10**5
merge = [[0]*(M+1) for _ in range(31)]
for i in range(N):
    s, t, c = STC[i]
    merge[c][s] += 1
    merge[c][t+1] -= 1
for c in range(31):
    merge[c] = list(map(lambda x: int(bool(x)), accumulate(merge[c])))

ans = []
for i in range(M+1):
    res = 0
    for j in range(31):
        res += merge[j][i]
    ans.append(res)
print(max(ans))
Problem p03626 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(2)]
M = 1000000007

if S[0][0] == S[1][0]:
    last_kind = 0
    ans = 3
    i = 1
else:
    last_kind = 1
    ans = 6
    i = 2
while i < N:
    if last_kind == 0 and S[0][i] == S[1][i]:
        ans *= 2
        last_kind = 0
        i += 1
    elif last_kind == 1 and S[0][i] == S[1][i]:
        last_kind = 0
        i += 1
    elif last_kind == 0 and S[0][i] == S[0][i+1]:
        ans *= 2
        last_kind = 1
        i += 2
    elif last_kind == 1 and S[0][i] == S[0][i+1]:
        ans *= 3
        last_kind = 1
        i += 2
    ans %= M

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(2)]
M = 1000000007

if S[0][0] == S[1][0]:
    last_kind = 0
    ans = 3
else:
    last_kind = 1
    ans = 6
i = 1
while i < N:
    if last_kind == 0 and S[0][i] == S[1][i]:
        ans *= 2
        last_kind = 0
        i += 1
    elif last_kind == 0 and S[0][i] == S[0][i+1]:
        ans *= 2
        last_kind = 1
        i += 2
    elif last_kind == 1 and S[0][i] == S[1][i]:
        last_kind = 0
        i += 1
    elif last_kind == 1 and S[0][i] == S[0][i+1]:
        ans *= 3
        last_kind = 1
        i += 2
    print(i, ans)
    ans %= M

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(2)]
M = 1000000007

if S[0][0] == S[1][0]:
    last_kind = 0
    ans = 3
else:
    last_kind = 1
    ans = 6
for i in range(1, N):
    if last_kind == 0 and S[0][i] == S[1][i]:
        ans *= 2
        last_kind = 0
    elif last_kind == 0 and S[0][i] == S[0][i+1]:
        ans *= 2
        last_kind = 1
    elif last_kind == 1 and S[0][i] == S[1][i]:
        last_kind = 0
    elif last_kind == 1 and S[0][i] == S[0][i+1]:
        ans *= 3
        last_kind = 1
    ans %= M

print(ans)
Problem p03681 (python)

Fixed submission:
N, M = map(int, input().split())
N, M = min(N, M), max(N, M)
mod = 10**9+7

g1 = [1, 1]
for i in range(2, M+1):
    g1.append((g1[-1] * i) % mod)

if M-N > 1:
    print(0)
elif M-N == 1:
    print(g1[M]*g1[N] % mod)
else:
    print(g1[M]**2*2 % mod)

Buggy submission (verdict: Runtime Error):
import math.factorial as F
N, M = map(int, input().split())
N, M = min(N, M), max(N, M)
mod = 10**9+7

if M-N > 1:
    print(0)
elif M-N == 1:
    print(F(M)*F(N) % mod)
else:
    print(F(M)**2*2 % mod)
Problem p03029 (python)

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

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

a *= 3

print((a+b)//2)
Problem p02555 (python)

Fixed submission:
S=int(input())
ans=[0]*(S+1)
MOD=10**9+7

if S<=2:
    print(0)
    exit(0)
elif S==3:
    print(1)
    exit(0)   
ans[3]=1
for i in range(4,S+1):
    ans[i]=ans[i-1]+ans[i-3]

print(ans[i]%MOD)

Buggy submission (verdict: Runtime Error):
S=int(input())
ans=[0]*(S+1)
MOD=10**9+7

if S<=2:
    print(0)
    exit(0)

ans[3]=1
for i in range(4,S+1):
    ans[i]=ans[i-1]+ans[i-3]

print(ans[i]%MOD)
Problem p02556 (python)

Fixed submission:
N=int(input())
A=[]
B=[]
for _ in range(N):
    x,y=map(int, input().split())
    A.append(x+y)
    B.append(x-y)

A=sorted(A)
B=sorted(B)

print(max(A[-1]-A[0],B[-1]-A[0],A[-1]-A[0],B[-1]-B[0]))

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

temp1=cp.deepcopy(A[0])
temp2=cp.deepcopy(A[0])
for i in range(N-1):
    f=0
    x,y=map(int, input().split())
    if abs(temp1[0]-x)+abs(temp1[1]-y):
        temp2[0]=x
        temp2[1]=y
        f=1
    if f==1:
        for i,j in A:
           if max(abs(temp2[0]-i)+abs(temp2[1]-j),abs(temp2[0]-temp1[0])+abs(temp2[1]-temp1[1])):
               temp1[0]=i
               temp2[1]=j
    A.append([x,y])


print(abs(temp2[0]-temp1[0])+abs(temp2[1]-temp1[1]))
Problem p02630 (python)

Fixed submission:
mod=pow(10,5)+2
N=int(input())
num=[0]*mod
ans=0
A=list(map(int, input().split()))
for i in range(N):
    num[A[i]]+=1
    ans+=A[i]
Q=int(input())
for i in range(Q):
    B,C=map(int, input().split())
    cnt=num[B]
    num[C]+=num[B]
    num[B]=0
    ans+=(C-B)*cnt
    print(ans)

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

N=int(input())
A=list(map(int, input().split()))
Q=int(input())
B,C=map(int, input().split())
rep=[i for i, x in enumerate(A) if x == B]
for i in range(len(rep)):
    A[rep[i]]=C
ans=np.cumsum(A)
print(ans[1])

for _ in range(Q-1):
    B,C=map(int, input().split())
    rep=[i for i, x in enumerate(A) if x == B]
    for i in range(len(rep)):
        A[rep[i]]=C
    ans+=(C-B)*len(rep)
    print(ans[1])
Problem p02646 (python)

Fixed submission:
A,V=map(int, input().split())
B,W=map(int, input().split())
T=int(input())

if W>=V:
    print('NO')
    exit(0)

if A*B<0:
    if (abs(A)+abs(B))/(V-W)<=T:
        print('YES')
    else:
        print('NO')
else:
    if abs(abs(A)-abs(B))/(V-W)<=T:
        print('YES')
    else:
        print('NO')

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

if W>=V and A!=B:
    print('NO')
    exit(0)

if A*B<0:
    if (abs(A)+abs(B))//(V-W)<=T:
        print('YES')
    else:
        print('NO')
else
    if abs(abs(A)-abs(B))//(V-W)<=T:
        print('YES')
    else:
        print('NO')
Problem p02687 (python)

Fixed submission:
A=input()
if A=='ABC':
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
A=input()
if A='ABC':
  print('ARC')
else:
  print('ABC')
Problem p02690 (python)

Fixed submission:
import math
X=int(input())
c=0
for i in range(200):   
  for j in range(-200,200):
    if i**5-j**5==X:
      c=1
      break
      
  if c==1:
    break
      
print(i,j)

Buggy submission (verdict: Runtime Error):
import math
X=int(input())

for i in range(X+1):
  #print(pow(X-pow(i,5),1/5),i)
  if pow(X-pow(i,5),1/5)%1==0:
    break
print(int(pow(X-pow(i,5),1/5)),-i)

Buggy submission (verdict: Runtime Error):
import math
X=int(input())

for i in range(X+1):
  print(pow(X-pow(i,5),1/5),i)
  if pow(X-pow(i,5),1/5)%1==0:
    break
print(int(pow(X-pow(i,5),1/5)),-i)

Buggy submission (verdict: Runtime Error):
import math
X=int(input())

for i in range(X):
  if　isinstance(pow(1/5, X+pow(5,i)), int)=='true'
    break
    
print(pow(1/5, X+pow(5,i),i)
Problem p02691 (python)

Fixed submission:
n=int(input())
A=list(map(int, input().split()))
d={}
c=0

for i,a in enumerate(A):
  if i+a not in d:
    d[i+a]=1
  else:
    d[i+a]+=1
  if i-a in d:
    c+=d[i-a]

print(c)

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

L=[0]*2*n
c=0

for i,a in enumerate(A):
  L[i+a]+=1
  if 2*n>i-a>0:
    c+=L[i-a]

print(c)

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

L=[0]*2*n
c=0

for i,a in enumerate(A):
  L[i+a]+=1
  c+=L[i-a]

print(c)

Buggy submission (verdict: Runtime Error):
import math

n=int(input())
A=list(map(int, input().split()))
L=[0]*2*n
R=[0]*2*n
c=0
x=0
for i,a in enumerate(A):
  L[i+a]+=1
  R[i-a]+=1
  c+=L[i-a]

print(c)
Problem p02713 (python)

Fixed submission:
from math import gcd 

K=int(input())
S=0

for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      S+=gcd(gcd(i,j),k)

print(S)

Buggy submission (verdict: Runtime Error):
import math

K=int(input())
S=0

for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      S+=gcd(gcd(i,j),k)

print(S)
Problem p02747 (python)

Fixed submission:
s=input()
if s=='hi' or s=='hihi' or s=='hihihi' or s=='hihihihi' or s=='hihihihihi':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if s='hi' or s='hihi' or s='hihihi' or s='hihihihi' or s='hihihihihi':
  print(Yes)
else:
  print(No)
Problem p02760 (python)

Fixed submission:
#import numpy as np

i=[input().split() for l in range(4)]

n=int(i[3][0])

j = [input() for i in range(n)]

#i=np.array(i)
#print(i)


k = [['0' for o in range(3)] for p in range(3)]

for b in range(3):
    #print('b:',b)
    for c in range(3):
        #print('c:',c)
        for d in range(n):
            #print('d:',d)
            if i[b][c]==j[d]:
                k[b][c]='1'
                #print('書き換えたよ',k)
                
                
#print(i)
#print(j)
#print(k)


if  k[0][0]=='1' and k[0][1]=='1' and k[0][2]=='1'\
or k[1][0]=='1' and k[1][1]=='1' and k[1][2]=='1'\
or k[2][0]=='1' and k[2][1]=='1' and k[2][2]=='1'\
or k[0][0]=='1' and k[1][0]=='1' and k[2][0]=='1'\
or k[0][1]=='1' and k[1][1]=='1' and k[2][1]=='1'\
or k[0][2]=='1' and k[1][2]=='1' and k[2][2]=='1'\
or k[0][0]=='1' and k[1][1]=='1' and k[2][2]=='1'\
or k[2][0]=='1' and k[1][1]=='1' and k[0][2]=='1':
	print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
j = [int(0)] * 9
 
n=i[9]
 
for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)    
 
if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
j = [int(0)] * 9

n=i[9]

for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)    

if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('yes')
else:
    print('no')

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
j = [int(0)] * 9

n=i[9]

#print(j)

for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)

#print(j)     

if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('yes')
else:
    print('no')