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

Fixed submission:
N, M = map(int, input().split())
#tmp = [[] for i in range(N)]
tmp = []
res = ['' for i in range(M)]
count = [1 for i in range(N+1)]
for i in range(M):
    A, B = map(int, input().split())
    tmp.append([A,B,i])

tmp.sort(key=lambda tmp: tmp[1])

for i in range(M):
    res[tmp[i][2]] += '0'*(6-len(str(tmp[i][0]))) + str(tmp[i][0]) + '0'*(6-len(str(count[tmp[i][0]]))) + str(count[tmp[i][0]])
    count[tmp[i][0]] += 1

for i in range(M):
    print(res[i])

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

for i in range(M):
    A, B = map(int, input().split())
    tmp[A-1].append(B)

for i in range(N):
    tmp[i].sort()
    
for i in range(M):
    X = tmp[F[i][0]-1].index(F[i][1])+1
    print(('0'*(6-len(str(F[i][0]))) + str(F[i][0])) + '0'*(6-len(str(X))) + str(X))
Problem p03242 (python)

Fixed submission:
N = input()
res = ''
for i in range(len(N)):
    if N[i] == '1':
        res += '9'
    if N[i] == '9':
        res += '1'
        
print(res)

Buggy submission (verdict: Runtime Error):
import collections

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

a = []
b = []
a_f = 0
b_f = 0
a_s = 0
b_s = 0
for i in range(N):
    if i%2 == 0:
        a.append(l[i])
    else:
        b.append(l[i])
        
c_a = collections.Counter(a)
c_b = collections.Counter(b)

a_f = c_a.most_common()[0]
b_f = c_b.most_common()[0]

if a_f[0] != b_f[0]:
    print(N - a_f[1] - b_f[1])

elif len(set(a)) == 1 and len(set(b)) == 1:
    print(int(N/2))
elif len(set(a)) == 1:
    print(int(N/2 - c_b.most_common()[1][1]))
elif len(set(b)) == 1:
    print(int(N/2 - c_a.most_common()[1][1]))
elif a_f[1] == b_f[1]:
    second_a = c_a.most_common()[1][1]
    second_b = c_b.most_common()[1][1]
    if second_a >= second_b:
        print(int(N - b_f[1] - second_a)
    else:
        print(int(N - a_f[1] - second_b)
elif a_f[1] > b_f[1]:
    print(int(N - a_f[1] - c_b.most_common()[1][1]))
else:
    print(int(N - b_f[1] - c_a.most_common()[1][1]))
Problem p03317 (python)

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

ans = 1
tmp = N - K
ans += tmp // (K - 1)

if tmp%(K - 1) != 0:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
m = min(A)
res = 0
for i in range(N):
    min_num = i
    if m == A[i]:
        break
    
        
n1 = min_num 
n2 = N - min_num - 1

if n1 == 0:
    res = math.ceil(n2/2)
elif n2 == 0:
    res = math.ceil(n1/2)
else:
    res = math.ceil(n1/2) + math.ceil(n2/2)
    
print(res)
Problem p03426 (python)

Fixed submission:
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for _ in range(Q)]

number_dict = {}
for h in range(H):
    for w in range(W):
        number_dict[A[h][w]] = (w+1, h+1)
        
        
number = [0 for _ in range(H*W+1)]
for i in range(H*W):
    now = H * W - i
    
    if now + D > H * W:
        pass
    
    else:
        number[now] = number[now + D] + abs(number_dict[now+D][0] - number_dict[now][0]) + abs(number_dict[now+D][1] - number_dict[now][1])
       

for i in range(Q):
    res = number[LR[i][0]] - number[LR[i][1]]
            
    print(res)

Buggy submission (verdict: Runtime Error):
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for _ in range(Q)]

number_dict = {}
for h in range(H):
    for w in range(W):
        number_dict[A[h][w]] = (w+1, h+1)
        
       
for i in range(Q):
    tmp = 0
    now = LR[i][0]
    now_state = number_dict[now]
    
    while True:
        if now == LR[i][1]:
            break
        
        tmp += abs(number_dict[now+D][0] - now_state[0]) + abs(number_dict[now+D][1] - now_state[1])
        now = now + D
        now_state = number_dict[now+D]
        

            
    print(tmp)

Buggy submission (verdict: Runtime Error):
H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for _ in range(Q)]

number_dict = {}
for h in range(H):
    for w in range(W):
        number_dict[A[h][w]] = (w+1, h+1)
        
       
for i in range(Q):
    tmp = 0
    now = LR[i][0]
    
    while True:
        tmp += abs(number_dict[now+D][0] - number_dict[now][0]) + abs(number_dict[now+D][1] - number_dict[now][1])
        now = now + D
        
        if now == LR[i][1]:
            break
            
    print(tmp)
Problem p03775 (python)

Fixed submission:
N = int(input())

def prime_factor(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

res = prime_factor(N)

result = 10 ** 10
for i in range(1, N+1):
    if N%i == 0:
        result = min(result, max(len(str(i)), len(str(N//i))))
    if i*i > N:
        break


print(result)

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

def prime_factor(n):
    i = 2
    table = [1]
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

res = prime_factor(N)

tmp = 1
tmp2 = N
for i in range(len(res)):
    if len(str(tmp)) >= len(str(tmp2)):
        break
    count = tmp2
    tmp2 = tmp2//res[i]
    tmp *= res[i]
    
print(len(str(count)))
Problem p03805 (python)

Fixed submission:
N, M = map(int, input().split())
E = [[0 for i in range(N)] for j in range(N)] #頂点のつながり
for i in range(M):
    a, b = map(int, input().split())
    E[a-1][b-1] = 1
    E[b-1][a-1] = 1

V = [ 0 for i in range(N)] #訪問済みの頂点が1
V[0] = 1 #頂点1は訪問済み

def DPS(now, V):
    res = 0 #全て訪問できた回数
    if 0 not in V:
        return 1
    for i in range(N): 
        if (E[now][i] == 1) and (V[i] == 0): #現在の頂点と隣接してかつ未訪問の頂点
            V[i] = 1
            res = res + DPS(i, V)
            V[i] = 0
    return res

print(DPS(0, V))

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

V = [i+1 for i in range(N)]
import itertools

ptr = list(itertools.permutations(V, N))

res = 0
for p in ptr:       
    if p[0] == 1:
        now = 1
        flag = [0 for _ in range(N)]
        flag[0] = 1
        for i in range(N-1):
            for j in range(M):
                if A[j][0] == now and A[j][1] == p[i+1]:
                    flag[A[j][1] - 1] += 1
                    now = p[i+1]
                if A[j][1] == now and A[j][0] == p[i+1]:
                    flag[A[j][0] - 1] += 1
                    now = p[i+1]
                    
        tmp = 1         
        for i in range(N):
            if flag[i] != 1:
                tmp = 0
                break
                
        res += tmp
 
print(res)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
E = [[0 for i in range(N)] for j in range(N)] #頂点のつながり
for i in range(M):
    a, b = map(int, input().split())
    E[a-1][b-1] = 1
    E[b-1][a-1] = 1

V = [ 0 for i in range(N)] #訪問済みの頂点が1
V[0] = 1 #頂点1は訪問済み

def DPS(now, V):
    res = 0 #全て訪問できた回数
    if 0 not in V:
        return 1
    for i in range(M):
        if (E[now][i] == 1) and (V[i] == 0): #現在の頂点と隣接してかつ未訪問の頂点
            V[i] = 1
            res = res + DPS(i, V)
            V[i] = 0
    return res

print(DPS(0, V))
Problem p02623 (python)

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

a = [0]
b = [0]

for i in range(N):
    a.append(a[i] + A[i])

for j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M

for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(i + j, ans)

print(ans)

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

a = [0]
b = [0]

for i in range(N):
    a.append(a[i] + A[i])

for j in range(M):
    b.append(b[i] + B[i])

ans = 0
j = M

for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(i + j, ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n_m_k = input().split()
n = int(n_m_k[0])
m = int(n_m_k[1])
k = int(n_m_k[2])

a_str_list = input().split()
a_int_list = [int(x) for x in a_str_list]

b_str_list = input().split()
b_int_list = [int(x) for x in b_str_list]

sum_t = 0
cnt_a = 0
cnt_b = 0

len_a = len(a_int_list)
len_b = len(b_int_list)
while(1):
    if((cnt_a != len_a) and (cnt_b != len_b)):
        if(a_int_list[cnt_a] < b_int_list[cnt_b]):
            sum_t += a_int_list[cnt_a]
            if(sum_t <= k):
                cnt_a += 1
            else:
                break
        elif(a_int_list[cnt_a] > b_int_list[cnt_b]):
            sum_t += b_int_list[cnt_b]
            if(sum_t <= k):
                cnt_b += 1
            else:
                break
        #
        elif(a_int_list[cnt_a] == b_int_list[cnt_b]):
            if(a_int_list[cnt_a + 1] < b_int_list[cnt_b + 1]):
                sum_t += a_int_list[cnt_a]
                if(sum_t <= k):
                    cnt_a += 1
                else:
                    break
            elif(a_int_list[cnt_a + 1] > b_int_list[cnt_b + 1]):
                sum_t += b_int_list[cnt_b]
                if(sum_t <= k):
                    cnt_b += 1
                else:
                    break
        #

    elif(cnt_a < len_a):
        sum_t += a_int_list[cnt_a]
        if(sum_t <= k):
            cnt_a += 1
        else:
            break
    elif(cnt_b < len_b):
        sum_t += b_int_list[cnt_b]
        if(sum_t <= k):
            cnt_b += 1
        else:
            break
    else:
        break

print(cnt_a + cnt_b)
Problem p02762 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
import collections

class UnionFind:

    def __init__(self, N):
        self.raw = [i for i in range(N)]

    def root(self, i):
        if self.raw[i] == i:
            return i
        self.raw[i] = self.root(self.raw[i])
        return self.raw[i]

    def unite(self, a, b):
        a_root = self.root(a)
        b_root = self.root(b)
        self.raw[a_root] = b_root

    def is_same(self, a, b):
        return self.root(a) == self.root(b)


def solve(N, M, K, AB, CD):
    uf = UnionFind(N)
    minus_count = [0 for _ in range(N)]
    for a, b in AB:
        uf.unite(a - 1, b - 1)
        minus_count[a - 1] += 1
        minus_count[b - 1] += 1
    for c, d in CD:
        if uf.is_same(c - 1, d - 1):
            minus_count[c - 1] += 1
            minus_count[d - 1] += 1
    counter = collections.Counter()
    roots = [uf.root(i) for i in range(N)]
    counter.update(roots)

    ans = []
    for i in range(N):
        ans.append(str(counter[uf.root(i)] - minus_count[i] - 1))
    return " ".join(ans)

if __name__ == "__main__":
    N, M, K = tuple(map(int, input().split(" ")))
    AB = []
    for _ in range(M):
        AB.append(tuple(map(int, input().split(" "))))
    CD = []
    for _ in range(K):
        CD.append(tuple(map(int, input().split(" "))))
    print(solve(N, M, K, AB, CD))

Buggy submission (verdict: Runtime Error):
import collections

class UnionFind:

    def __init__(self, N):
        self.raw = [i for i in range(N)]

    def root(self, i):
        if self.raw[i] == i:
            return i
        self.raw[i] = self.root(self.raw[i])
        return self.raw[i]

    def unite(self, a, b):
        a_root = self.root(a)
        b_root = self.root(b)
        self.raw[a_root] = b_root

    def is_same(self, a, b):
        return self.root(a) == self.root(b)


def solve(N, M, K, AB, CD):
    uf = UnionFind(N)
    minus_count = [0 for _ in range(N)]
    for a, b in AB:
        uf.unite(a - 1, b - 1)
        minus_count[a - 1] += 1
        minus_count[b - 1] += 1
    for c, d in CD:
        if uf.is_same(c - 1, d - 1):
            minus_count[c - 1] += 1
            minus_count[d - 1] += 1
    counter = collections.Counter()
    roots = [uf.root(i) for i in range(N)]
    counter.update(roots)

    ans = []
    for i in range(N):
        ans.append(str(counter[uf.root(i)] - minus_count[i] - 1))
    return " ".join(ans)

if __name__ == "__main__":
    N, M, K = tuple(map(int, input().split(" ")))
    AB = []
    for _ in range(M):
        AB.append(tuple(map(int, input().split(" "))))
    CD = []
    for _ in range(K):
        CD.append(tuple(map(int, input().split(" "))))
    print(solve(N, M, K, AB, CD))
Problem p02987 (python)

Fixed submission:
from collections import Counter
if __name__ == "__main__":
    S = Counter(input())
    if len(S) == 2 and all(v == 2 for v in S.values()):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    S = Counter(input())
    if len(S) == 2 and all(v == 2 for v in S.values()):
        print("Yes")
    else:
        print("No")
Problem p03201 (python)

Fixed submission:
from collections import Counter

def ans_solve(N, As):
    C = Counter(As)
    ans = 0
    for d in reversed(sorted(As)):
        n = (2 ** d.bit_length()) - d
        if d != n:
            if C[d] > 0 and C.get(n, 0) > 0:
                C[d] -= 1
                C[n] -= 1
                ans += 1
        else:
            ans += C[d]//2
            C[d] = 0
    return ans
 
 
if __name__ == "__main__":
    N = input()
    As = [int(c) for c in input().split()]
    print(ans_solve(N, As))

Buggy submission (verdict: Runtime Error):
def ans_solve(N, As):
    C = Counter(As)
    ans = 0
    for d in As:
        n = (2 ** d.bit_length()) - d
        if d != n:
            if C[d] > 0 and C.get(n, 0) > 0:
                C[d] -= 1
                C[n] -= 1
                ans += 1
        else:
            ans += C[d]//2
            C[d] = 0
    return ans
 

if __name__ == "__main__":
    N = input()
    As = [int(c) for c in input().split()]
    print(ans_solve(N, As))
Problem p03221 (python)

Fixed submission:
def solve(N, M, PYs):
    Ys = {i + 1: 1 for i in range(N)}
    ret = {}
    for p, y in sorted(PYs, key=lambda x: x[1]):
        ret[(p, y)] = "{:06d}{:06d}".format(p, Ys[p])
        Ys[p] += 1
    return [ret[(p, y)] for (p, y) in PYs]

if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    PYs = [tuple(map(int, input().split(" "))) for _ in range(M)]
    print("\n".join(solve(N, M, PYs)))

Buggy submission (verdict: Runtime Error):
def solve(N, M, PYs):
    Ys = {i + 1: 1 for i in range(M)}
    ret = {}
    for p, y in sorted(PYs, key=lambda x: x[1]):
        ret[(p, y)] = "{:06d}{:06d}".format(p, Ys[p])
        Ys[p] += 1
    return [ret[(p, y)] for (p, y) in PYs]

if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    PYs = [tuple(map(int, input().split(" "))) for _ in range(M)]
    print("\n".join(solve(N, M, PYs)))
Problem p03242 (python)

Fixed submission:
def solve(N):
    return l.replace("1", "8").replace("9", "1").replace("8", "9")

if __name__ == "__main__":
    l = input()
    print(solve(l))

Buggy submission (verdict: Runtime Error):
from collections import Counter


def solve(V):
    n = len(V)
    odd = Counter()
    even = Counter()
    total = Counter()
    for i, c in enumerate(V):
        total.update([c])
        if i % 2 == 0:
            even.update([c])
        else:
            odd.update([c])

    total_max = total.most_common()[0]
    if total_max[1] == len(V):
        return len(V) / 2

    even_maxs = even.most_common(2)
    odd_maxs = odd.most_common(2)
    if len(odd_maxs) > 1:
        odd_max, odd_2nd_max = odd_maxs[0], odd_maxs[1]
    else:
        odd_max, odd_2nd_max = odd_maxs[0], None

    if len(even_maxs) > 1:
        even_max, even_2nd_max = even_maxs[0], even_maxs[1]
    else:
        even_max, even_2nd_max = even_maxs[0], None

    ans = 0
    if odd_max[0] != even_max[0]:
        odd_max = odd_max[0]
        even_max = even_max[0]
    elif odd_2nd_max != None and even_2nd_max == None:
        even_max = even_max[0]
        odd_max = odd_2nd_max[0]
    elif odd_2nd_max == None and even_2nd_max != None:
        odd_max = odd_max[0]
        even_max = even_2nd_max[0]
    else:  # odd_2nd_max != None and even_2nd_max != None:
        return n - max(even_maxs[0][1] + odd_maxs[1][1], 
                       even_maxs[1][1] + odd_maxs[0][1])

    for key, count in even.items():
        if key != even_max:
            ans += count
    for key, count in odd.items():
        if key != odd_max:
            ans += count
    return ans


if __name__ == "__main__":
    n = int(input())
    l = input()
    print(solve(l.split(" ")))
Problem p03127 (python)

Fixed submission:
import numpy as np
N = int(input())
HPs = np.array([int(i) for i in input().split()])
np.sort(HPs)
while len(HPs) > 1:
    HPs[1:] %= HPs[0]
    HPs[HPs==0] = HPs[0]
    HPs=np.unique(HPs)
print(HPs[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
HP_list = [int(i) for i in input().split()]
while len(set(HP_list))>1:
    for i in range(0, len(set(HP_list))):
        min_HP = min(HP_list)
        if HP_list[i] > min_HP:
            HP_list[i] = HP_list%min_HP
            if HP_list[i]==0:
                HP_list[i] += min_HP
print(list(set(HP_list))[0])
Problem p03208 (python)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
H = np.array([int(input()) for _ in range(0, N)])
H = np.sort(H)
H_diff = np.diff(H)
best = int(np.min(np.convolve((H_diff), np.ones(K-1), mode='valid')))
print(best)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int,input().split())
H = np.array([int(input()) for _ in range(0, N)])
H = np.sort(H)
#print(H)
H_diff = abs(H[1:]-H[:-1])
#print(H_diff)
best = np.sum(H_diff[0, K-1])
for i in range(0, len(H_diff)-K+2):
    #print(i)
    if np.sum(H_diff[i:i+K-1]) < best:
        #print(H_diff[i:i+K-1])
        best = np.sum(H_diff[i:i+K-1])
#print('best:{}'.format(best))
print(best)
Problem p03221 (python)

Fixed submission:
import numpy as np
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
counts = (np.zeros(N+1)).astype(int)
id_list = []

sort_ind = np.argsort(P_Y_list[:,1])
sorted_P_Y = P_Y_list[sort_ind]

for p, y in sorted_P_Y:
    counts[p] += 1
    id_list.append(str(p).zfill(6) + str(counts[p]).zfill(6))
id_list = np.array(id_list)
id_list = id_list[np.argsort(sort_ind)]
for id in id_list:
    print(id)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
P_Y_list = np.array([input().split() for _ in range(0, M)], dtype='int')
years = [np.sort(P_Y_list[np.where(P_Y_list[:,0]==i)][:,1]) for i in set(P_Y_list[:, 0])]
for l in P_Y_list:
    left = str(l[0]).zfill(6)
    right = str(np.where(years[list(set(P_Y_list[:,0])).index(l[0])]==l[1])[0][0]+1).zfill(6)
    print(left+right)
Problem p03265 (python)

Fixed submission:
x_1, y_1, x_2, y_2 = map(int, input().split())

x_4 = x_1 - (y_2 - y_1)
y_4 = y_1 + (x_2 - x_1)
x_3 = x_4 - (y_1 - y_4)
y_3 = y_4 + (x_1 - x_4)
 
print(x_3, y_3, x_4, y_4)

Buggy submission (verdict: Runtime Error):
import numpy as np
x1_, y_1, x_2, y_2 = map(int, input().split())

x_4 = x_1 - (y_2 - y_1)
y_4 = y_1 + (x_2 - x_1)
x_3 = x_4 - (y_1 - y_4)
y_3 = y_4 + (x_1 - x_4)
 
print(x_3, y_3, x_4, y_4)
Problem p02689 (python)

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

competitor_H = {}

for m in range(M):
    A, B = map(int, input().split())
    
    if A-1 not in competitor_H.keys():
        competitor_H[A-1] = []
    competitor_H[A-1].append(H[B-1])
    
    if B-1 not in competitor_H.keys():
        competitor_H[B-1] = []
    competitor_H[B-1].append(H[A-1])

countGood = 0
for i in range(N):
    if i not in competitor_H.keys():
        countGood += 1
    elif H[i] > max(competitor_H[i]):
        countGood += 1
print(countGood)

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

H = np.array(list(map(int, input().split())))

streetMatrix = np.array([np.zeros(N, dtype='int8')]*N)

for m in range(M):
    A, B = map(int, input().split())
    
    streetMatrix[A-1][B-1] = 1
    streetMatrix[B-1][A-1] = 1

countGood = 0
street_and_height = streetMatrix*H

for i in range(N):
    if max(streetMatrix[i]) == 0:
        countGood += 1
    elif H[i] > max(street_and_height[i]):
        countGood += 1
print(countGood)

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

H = np.array(list(map(int, input().split())))

streetMatrix = np.array([np.zeros(N, dtype='int8')]*N)

for m in range(M):
    A, B = map(int, input().split())
    
    streetMatrix[A-1][B-1] = 1
    streetMatrix[B-1][A-1] = 1

countGood = 0
street_and_height = streetMatrix*H

for i in range(N):
    if max(streetMatrix[i]) == 0:
        countGood += 1
    elif H[i] > max(street_and_height[i]):
        countGood += 1
print(countGood)

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

N, M = map(int, input().split())
H = np.array(list(map(int, input().split())))

streetMatrix = np.array([np.zeros(N)]*N)

for m in range(M):
    A, B = map(int, input().split())
    
    streetMatrix[A-1][B-1] = 1
    streetMatrix[B-1][A-1] = 1

countGood = 0

for i in range(N):
    if max(streetMatrix[i]) == 0:
        countGood += 1
    elif H[i] > max(streetMatrix[i] * H):
        countGood += 1
print(countGood)
Problem p02831 (python)

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

import fractions

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

print(lcm(A, B))

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

import math

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

print(lcm(A, B))
Problem p02959 (python)

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

count = 0
for i in range(N):
  if A[i] < B[i]:
    count += A[i]
    B[i] -= A[i]
    if A[i+1] < B[i]:
      count += A[i+1]
      A[i+1] = 0
    else:
      count += B[i]
      A[i+1] -= B[i]
  else:
    count += B[i]

print(count)

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

ans = 0

for i in range(N):
    if B[i] > A[i]:
        kill_1 = A[i]
        if B[i] - kill_1 > A[i+1]:
            kill_2 = A[i+1]
        else:
            kill_2 = B[i] - kill_1
    else:
        kill_1 = B[i]
        
    ans += kill_1 + kill_2
    B[i] -= kill_1 - kill_2
    A[i] -= kill_1
    A[i+1] -= kill_2
    
print(ans)
Problem p03075 (python)

Fixed submission:
antenna = [int(input()) for i in range(5)]
k = int(input())
judge = ''
i,j = 1,1
for i in range(5):
  for j in range(i+1,5):
    if abs(antenna[i]-antenna[j]) > k:
      judge = ':('
      break

if judge==':(':
  print(':(')
else:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
antenna = []
for i in range(5):
  antenna.append(int(input()))
K = int(input())

d = True
for i in range(5):
  if d:
  for j in range(i,5):
    if antenna[j]-antenna[i] > K:
      print(':(')
      d = False
      break
if d:
  print('Yay!')