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

Fixed submission:
from fractions import gcd
# from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def run():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


run()

Buggy submission (verdict: Runtime Error):
# from fractions import gcd
from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def run():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


run()

Buggy submission (verdict: Runtime Error):
# from fractions import gcd
from math import gcd
from functools import reduce
N, M = map(int, input().split())
nums = set([num // 2 for num in list(map(int, input().split()))])
# 1<=X<=Mの範囲で、半公倍数の数を求める。
# 但し、Xは、num*(p+0.5)でなければならない
# Mが10**9なので、全部やるのは無理。
# n.5倍なので、numsのあたいは全て偶数になっている。

# nums一つ一つ、答えになりうるXの配列を作って、重複したものを残せばそれが答えになる。
# Nが10**5なので、どうだろう


def half_multiple(x, y):
    return (x * y) // gcd(x, y)


def main():
    half_multiple_num = reduce(half_multiple, nums, 1)

    # print(half_multiple_num)
    for num in nums:
        if (half_multiple_num // num) % 2 == 0:
            print(0)
            return

    pmax = M // half_multiple_num
    pmax = pmax - 1 if pmax % 2 == 0 else pmax

    print((pmax + 1) // 2)


main()
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
graph = [[] for i in range(N)]

for i in range(N - 1):
    a, b = map(int, input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

# print(graph)
v = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    v[p - 1] += x
# print(v)


seen_points = [True] * N
seen_points[0] = False
stack = [0]

while stack:
    now = stack.pop()
    for i in graph[now]:
        if seen_points[i]:
            seen_points[i] = False
            stack.append(i)
            v[i] += v[now]

print(*v)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(20000)
N, Q = list(map(int, input().split()))

points = [[] for _ in range(N)]
counters = [0 for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    points[a - 1].append(b)

operations = []
for _ in range(Q):
    operations.append(list(map(int, input().split())))

# print(points)
# print(operations)


def dfs(points, counters, i, count):
    counters[i - 1] += count
    for next_point in points[i - 1]:
        dfs(points, counters, next_point, count)


for operation in operations:
    dfs(points, counters, operation[0], operation[1])
# print(counters)

print(' '.join(map(str, counters)))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(20000)N, Q = list(map(int, input().split()))

points = [[] for _ in range(N)]
counters = [0 for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    points[a - 1].append(b)

operations = []
for _ in range(Q):
    operations.append(list(map(int, input().split())))

# print(points)
# print(operations)


def dfs(points, counters, i, count):
    counters[i - 1] += count
    for next_point in points[i - 1]:
        dfs(points, counters, next_point, count)


for operation in operations:
    dfs(points, counters, operation[0], operation[1])
# print(counters)

print(' '.join(map(str, counters)))

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

points = [[] for _ in range(N)]
counters = [0 for _ in range(N)]
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    points[a - 1].append(b)

operations = []
for _ in range(Q):
    operations.append(list(map(int, input().split())))

# print(points)
# print(operations)


def dfs(points, counters, i, count):
    counters[i - 1] += count
    for next_point in points[i - 1]:
        dfs(points, counters, next_point, count)


for operation in operations:
    dfs(points, counters, operation[0], operation[1])
# print(counters)

print(' '.join(map(str, counters)))
Problem p03557 (python)

Fixed submission:
import bisect
N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = list(map(int, input().split(" ")))
bottoms = sorted(list(map(int, input().split(" "))))
# print(tops)
# print(mids)
# print(bottoms)


# def left_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] >= num:
#         return left_binary_search(check_list, num, left, mid - 1)
#     else:
#         return left_binary_search(check_list, num, mid + 1, right)


# def right_binary_search(check_list, num, left, right):
#     if left > right:
#         return left
#     mid = (left + right) // 2
#     if check_list[mid] > num:
#         return right_binary_search(check_list, num, left, mid - 1)
#     else:
#         return right_binary_search(check_list, num, mid + 1, right)


total_count = 0
for mid in mids:
    # bottom_start_index = right_binary_search(bottoms, mid, 0, N - 1)
    bottom_start_index = bisect.bisect_right(bottoms, mid)
    # top_end_index = left_binary_search(tops, mid, 0, N - 1)
    top_end_index = bisect.bisect_left(tops, mid)
    total_count += ((N - bottom_start_index) * top_end_index)
print(total_count)

Buggy submission (verdict: Runtime Error):
N = int(input())
# サイズが下の方が大きくないとダメtop<mid<bottom
tops = sorted(list(map(int, input().split(" "))))
mids = sorted(list(map(int, input().split(" "))))
bottoms = sorted(list(map(int, input().split(" "))))


def binary_search(check_list, num, left, right):
    if left > right:
        return left
    mid = (left + right) // 2
    if check_list[mid] > num:
        return binary_search(check_list, num, left, mid - 1)
    elif check_list[mid] == num:
        return mid
    else:
        return binary_search(check_list, num, mid + 1, right)


total_count = 0
for bottom in bottoms:
    mid_insert_index = binary_search(mids, bottom, 0, N - 1)

    for mid in mids[0:mid_insert_index]:
        top_insert_index = binary_search(tops, mid, 0, N - 1)
        total_count += top_insert_index])
print(total_count)
Problem p02658 (python)

Fixed submission:
ans = 1
ok1 = True
_n = int(input())
a = list(map(int,input().split()))
ok2 = False
if 0 in a:
    ok2 = True

for i in a:
    ans *= i
    if ans > 1e18:
        ok1 = False
        break

if ok2:
    print(0)
elif ok1:
    print(ans)
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
ans = 1
ok = True
_n = int(input())
a = list(map(int,input().split()))
for i in a:
    ans *= i

if ans > 1e18:
    print(-1)
else 
    print(ans)
Problem p02717 (python)

Fixed submission:
x,y,z = map(int,input().split())
x,y = y,x
x,z = z,x
print(x,y,z)

Buggy submission (verdict: Runtime Error):
x,y,z = map(int,input().split())
swap(x,z)
swap(x,y)
print(x,y,z)
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())
print(min(n%k,k - n%k))

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

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
print(min(n%k),k - (n%k))
Problem p03074 (python)

Fixed submission:
def main():
    ans = 0
    n, k = map(int, input().split())
    s = input()
    arr = []
    if s[0] == '0':
        arr.append(0)
    cnt = 1
    i = 1
    while i != n:
        if s[i] != s[i - 1]:
            arr.append(cnt)
            cnt = 1
        else:
            cnt += 1
        i += 1
    arr.append(cnt)
    if s[-1] == '0':
        arr.append(0)
    ans = 0
    curr = arr[0]
    j = 1
    if len(arr) - 1 <= 2 * k:
        print(n)
        return 0
    for i in range(1, len(arr), 2):
        curr += arr[i] + arr[i + 1]
        if i - j == 2 * k:
            curr -= arr[j] + arr[j - 1]
            j += 2
        ans = max(ans, curr)
    print(ans)
    return 0
main()

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;

    int i=0;
    int j=0;

    int ans = 0;

    while(j<n)
    {
        while(j<n && s[j]=='1')
        {
            j++;
        }
        ans = max(ans,j-i);
        while(j<n && s[j]=='0')
        {
            j++;
        }
        k--;
        if(k<0)
        {
            while(i<n && s[i]=='1')
            {
                i++;
            }
            while(i<n && s[i]=='0')
            {
                i++;
            }
        }
        ans = max(ans,j-i);
    }
    cout << ans << endl;
}
Problem p03087 (python)

Fixed submission:
# coding:utf-8

# 入力
N, Q = map(int, input().split(' '))
S = input()
ql = [map(int, input().split(' ')) for _ in range(Q)]

# 累積和の作成
cl = [0, 0]
for i in range(N-1):
    if S[i] + S[i+1] == 'AC':
        cl.append(cl[-1]+1)
    else:
        cl.append(cl[-1])

# クエリに対する出力
for l, r in ql:
    print(cl[r] - cl[l])

Buggy submission (verdict: Runtime Error):
# coding:utf-8

# 入力
N, Q = map(int, input().split(' '))
S = input()
ql = []
for _ in range(Q):
    l, r = map(int, input().split(' '))
    ql.append((l,r))

# 累積文字和の作成
cl = ['']
for char in S:
    cl.append(cl[-1] + char)

# クエリに対する出力
for i in range(Q):
    cnt = 0
    string = cl[ql[i][1]][ql[i][0]-1:]
    for j in range(len(string)-1):
        if string[j:j+2] == 'AC':
            cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
# coding:utf-8

# 入力
N, Q = map(int, input().split(' '))
S = input()
ql = []
for _ in range(Q):
    l, r = map(int, input().split(' '))
    ql.append({'l': l, 'r': r})

# 累積文字和の作成
cl = ['']
for char in S:
    cl.append(cl[-1] + char)

# クエリに対する出力
for i in range(Q):
    print(cl[ql[i]['r']][ql[i]['l']-1:].count('AC'))
Problem p03005 (python)

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

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

length = len(a_l)
k = 0
for i in range(length):
  if a_l[i] < 0:
    k = i
  else:
    break

b_l = a_l[:k+1]
a_l = a_l[k+1:]
fu = len(b_l)
sei = len(a_l)
ans_l = list()
ans_ll = list()
if sei > fu:
  sa = sei-fu-1
  ans_ll.append(a_l[-1])
  for i in range(fu):
    ans_l.append([b_l[i], a_l[-i-2]])
    ans_ll.append(b_l[i]-a_l[-i-2])
  aa_l = a_l[:sa]
  aa = 0
  for i in range(len(aa_l)-1):
    ans_l.append([aa_l[i], aa_l[i+1]])
    aa = aa_l[i] - aa_l[i+1]
  ans_ll.append(aa)
  ans_ll.sort()
  lent = len(ans_ll)
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
elif sei < fu:
  sa = fu-sei+1
  ans_ll += b_l[:sa]
  ans_ll.append(a_l[-1])
  b_l = b_l[sa:]
  for i in range(len(b_l)):
    ans_l.append([b_l[i], a_l[-i-2]])
    ans_ll.append(b_l[i]-a_l[-i-2])
  ans_ll.sort()
  lent = len(ans_ll)  
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
else:
  for i in range(sei):
    if i == 0:
      ans_l.append([a_l[-i-1], b_l[i]])
      ans_ll.append(a_l[-i-1]-b_l[i])
    else:
      ans_l.append([b_l[i], a_l[-i-1]])
      ans_ll.append(b_l[i]-a_l[-i-1])
  ans_ll.sort()
  lent = len(ans_ll)  
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
    
ans_length = len(ans_l)
print(ans_ll[-1])
for i in range(ans_length):
  a = ans_l[i][0]
  b = ans_l[i][1]
  print(a, b)

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

length = len(a_l)
k = 0
for i in range(length):
  if a_l[i] < 0:
    k = i
  else:
    break

b_l = a_l[:k+1]
a_l = a_l[k+1:]
fu = len(b_l)
sei = len(a_l)
ans_l = list()
ans_ll = list()
if sei > fu:
  sa = sei-fu-1
  ans_ll+= a_l[:sa]
  ans_ll.append(a_l[-1])
  for i in range(fu):
    ans_l.append([b_l[i], a_l[-i-2]])
    ans_ll.append(b_l[i]-a_l[-i-2])
  ans_ll.sort()
  lent = len(ans_ll)
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
elif sei < fu:
  sa = fu-sei+1
  ans_ll += b_l[:sa]
  ans_ll.append(a_l[-1])
  for i in range(sei-1):
    ans_l.append([b_l[i], a_l[-i-2]])
    ans_ll.append(b_l[i]-a_l[-i-2])
  ans_ll.sort()
  lent = len(ans_ll)  
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
else:
  for i in range(sei):
    if i == 0:
      ans_l.append([a_l[-i-1], b_l[i]])
      ans_ll.append(a_l[-i-1]-b_l[i])
    else:
      ans_l.append([b_l[i], a_l[-i-1]])
      ans_ll.append(b_l[i]-a_l[-i-1])
  ans_ll.sort()
  lent = len(ans_ll)  
  for i in range(lent-1):
    ans_l.append([ans_ll[-1], ans_ll[i]])
    ans_ll[-1] = ans_ll[-1]-ans_ll[i]
    
ans_length = len(ans_l)
print(ans_ll[-1])
for i in range(ans_length):
  a = ans_l[i][0]
  b = ans_l[i][1]
  print(a, b)
Problem p03006 (python)

Fixed submission:
n = int(input())
x = [0]*n
y = [0]*n

if n == 1:
  print(1)
else:
  for i in range(n):
    x[i],y[i] = map(int, input().split())
  ans = []
  for i in range(n):
    for j in range(n):
      if i == j:
        continue
      p = x[i]-x[j]
      q = y[i]-y[j]
      count = 0
      for k in range(n):
        for l in range(n):
          if p == x[k]-x[l] and q == y[k]-y[l]:
            count += 1
            ans.append(count)
  print(n-max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
  x[i],y[i] = map(int, input().split())

if n == 1:
  print(1)

ans = []
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    p = x[i]-x[j]
    q = y[i]-y[j]
    count = 0
    for k in range(n):
      for l in range(n):
        if p == x[k]-x[l] and q == y[k]-y[l]:
          count += 1
          ans.append(count)
print(n-max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i],y[i] = map(int, input().split())

if n == 1:
    print(1)

ans = []
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        p = x[i]-x[j]
        q = y[i]-y[j]
        count = 0
        for k in range(n):
            for l in range(n):
                if p == x[k]-x[l] and q == y[k]-y[l]:
                    count += 1
                ans.append(count)

print(n-max(ans))
Problem p03035 (python)

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

if a >=13:
  print(b)
elif a>=6:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a_list = list(map(lambda x: int(x), input().split()))
for _ in range(m):
  b, c = map(int, input().split())
  ll = [c for _ in range(b)]
  a_list.extend(ll)
a_list.sort(reverse=True)
print(sum(a_list[::-n]))
Problem p03049 (python)

Fixed submission:
N = int(input())
s_list = [input() for _ in range(N)]
ans = 0
ans_list = [0, 0, 0]
for s in s_list:
  ans += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    ans_list[0] += 1
  elif s[0] == 'B':
    ans_list[1] += 1
  elif s[-1] == 'A':
    ans_list[2] += 1

if ans_list[1] == 0:
  if ans_list[0] != 0:
    if ans_list[2] != 0:
      ans += ans_list[0]
    else:
      ans += ans_list[0]-1
else:
  if ans_list[0] != 0:
    if ans_list[2] != 0:
      ans += ans_list[0] + min(ans_list[1], ans_list[2])
    else:
      ans += ans_list[0]
  else:
    ans += min(ans_list[1], ans_list[2])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
s_list = [input() for _ in range(N)]
ans = 0
ans_list = [0, 0, 0]
for s in s_list:
  ans += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    ans_list[0] += 1
  elif s[0] == 'B':
    ans_list[1] += 1
  elif s[-1] == 'A':
    ans_list[2] += 1

if ans_list[1] == 0:
  if ans_list[0] != 0:
    if ans_list[2] != 0:
      ans += ans_list[0]
    else:
      ans += ans_list[0]-1
else:
  if ans_list[0] != 0:
    if ans_list[2] != 0:
      ans += ans_list[0] + min(ans_list[1], ans_list[2])
    else:
      ans += ams_list[0]
  else:
    ans += min(ans_list[1], ans_list[2])
print(ans)
Problem p03085 (python)

Fixed submission:
I=input()

if I == "A":
  print("T")
elif I == "T":
  print("A")
elif I == "C":
  print("G")
else:
  print("C")

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

if I == "A":
  print("T")
elif I = "T":
  print("A")
elif I == "C":
  print("G")
else:
  print("C")
Problem p03087 (python)

Fixed submission:
import sys
sy = sys.stdin.readlines()
N,Q = map(int, sy[0].split())
S = sy[1]
ACindex = [0 for _ in range(N+1)]
count = 0
for n in range(1, N):
  if S[n-1]=="A" and S[n]=="C":
    count += 1
  ACindex[n+1] = count

for i in range(Q):
  l, r = map(int, sy[2+i].split())
  print(ACindex[r]-ACindex[l])

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l, r = map(int, input().split())
  s = S[l-1:r]
  print(s)

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l, r = map(int, input().split())
  s = S.copy()
  ss = s[l-1:r]
  print(ss)

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l, r = map(int, input().split())
  s = S.copy()[l-1, r]
  print(s)

Buggy submission (verdict: Runtime Error):
N,Q = map(int, input().split())
S = input()
for i in range(Q):
  l, r = map(int, input().split())
  s = S[l-1:r]
  print(s)
Problem p03260 (python)

Fixed submission:
a,b = map(int, input().split())
if a*b%2 == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b = int(input().split())
if a*b%2 == 0:
   print("No")
else:
  print("Yes")
Problem p03261 (python)

Fixed submission:
N = int(input())
l = list()

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(0, N-1):
        if l[i+1][0] != l[i][-1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")

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

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(0, N-1):
        if a[i+1][0] != a[i][-1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")

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

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(0, N-1):
        if a[i+1][0] != a[i][-1]:
            print("No")
            break
    print("Yes")
else:
    print("No")

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

for n in range(N):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(1, N):
        if a[i][0] != a[i-1][-1]:
            print("No")
            break
    print("Yes")
else:
    print("No")

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

for n in range(0,N-1):
    a = input()
    l.append(a)

l_uniq = list(set(l))

if len(l) == len(l_uniq):
    for i in range(1, N):
        if a[i][0] != a[i-1][-1]:
            print("No")
            break
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
l = list()
al = list()
bl = list()
 
for n in range(0,N):
    a = input()
　 l.append(a)
    al.append(a[1])
    bl.append(a[-1])
 
l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in range(0,N-1):
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
l = list()
al = list()
bl = list()
 
for n in range(0,N):
    a = input()
　 l.append(a)
    al.append(a[:1])
    bl.append(a[-1:])
 
l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in range(0,N-1):
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
l = list()
al = list()
bl = list()

for n in N:
    a = input()
　 l.append(a)
    al.append(a[:1])
    bl.append(a[-1:])

l_unq = list(set(l))
if len(l) == len(l_unq):
    for i in N-1:
        if al[i+1] != bl[i]:
          print("No")
          break
     print("Yes")
else:
    print("No")
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 = int(input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p02700 (python)

Fixed submission:
ok=True
i=0
a,b,c,d=map(int,input().split())
k=c//b
c-=b*k
a-=d*(k)
if(a<=0 and c!=0):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
ok=True
i=0
a,b,c,d=map(int,input().split())
k=c//b
c-=bk
a-=d(k)
if(a<=0 and c!=0):
    print("No")
else:
    print("Yes")
Problem p02630 (python)

Fixed submission:
n = int(input())
*a, = map(int,input().split())
M = 10**5+1
g = [0] * M
s = 0
for A in a:
    g[A] += 1
    s += A

q = int(input())
for loop in range(q):
    b,c = map(int,input().split())
    if g[b] == 0:
        print(s)
        continue
    s += g[b] * (c - b)
    g[c] += g[b]
    g[b] = 0
    print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
*a, = map(int,input().split())
g = []
M = 10**5+1
for i in range(1,5):
    g.append((i,0))
g = dict(g); s = 0
for A in a:
    g[A] += 1
    s += A
q = int(input())
for loop in range(q):
    b,c = map(int,input().split())
    if g[b] == 0:
        print(s)
        continue
    s += g[b] * (c - b)
    g[c] += g[b]
    g[b] == 0
    print(s)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(str,input().split())
a = int(a)
b1,b2 = map(int,b.split("."))
ans = a* (b1 * 100 + b2)
print(ans//100)
Problem p02678 (python)

Fixed submission:
from collections import deque
n,m = map(int,input().split())

path = []
net = [[] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int,input().split())

    net[a].append(b)
    net[b].append(a)

a = [-1] * (n+1)
d = deque()
d.append(1)
while d:
    u = d.popleft()
    for child in net[u]:
        if a[child] != -1:continue
        a[child] = u
        d.append(child)
a = a[2:]
for z in a:
    if z == -1:
        print("No")
        exit()
print("Yes")
for z in a:
    print(z)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m = map(int,input().split())

net = [[] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int,input().split())

    net[a].append(b)
    net[b].append(a)

a = [-1] * (n+1)
d = deque()
d.append(1)
while d:
    u = d.popleft()
    for child in net[u]:
        if a[child] != -1:continue
        a[child] = u
        d.append(child)
print("Yes")
print(*a[2:], seq = " ")