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

Fixed submission:
s = input()
k = int(input())

index = 0
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < index:
  print('1')
else:
  print(s[index])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
for i in range(len(s)):
  if s[i] != '1':
    index = i
    break
if k-1 < i:
  print(1)
else:
  print(s[index])
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(1, w+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(1, h+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
L = ['.'*(w+1)]
for i in range(h):
  L.append('.'+input()+'.')
L.append('.'*(w+1))  

out = 1
for i in range(1, h+1):
  for j in range(i+1, h+1):
    if L[i][j] == '#':
      if L[i][j+1] == '#' or L[i][j-1] == '#' or L[i-1][j] == '#' or L[i+1][j] == '#':
        out *= 1
      else:
        out *= 0

if out == 1:
  print('Yes')
else:
  print('No')
Problem p03408 (python)

Fixed submission:
b = [input() for i in range(int(input()))]
r = [input() for i in range(int(input()))]
o = 0
for w in list(set(b)):
  o = max(o, b.count(w) - r.count(w))
  
print(o)

Buggy submission (verdict: Runtime Error):
b = [input() for i in range(int(input()))]
r = [input() for i in range(int(input()))]
k = 0
for w in list(set(b)):
  k = max(o, b.count(w) - r.count(w))
print(k)
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())
if b-a == c-b:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')
Problem p03760 (python)

Fixed submission:
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)-1] + e[len(e)-1])
else:
  list.append(o[len(o)-1])
  
 
print(*list, sep='')

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(o)] + e[len(e)])
else:
  list.append(o[len(o)])
  
 
print(*list, sep='')

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
list = []
for i in range(len(o)-1):
  list.append(o[i] + e[i])
  
if len(e) == len(o):
  list.append(o[len(e)] + e[len(o)])
else:
  list.append(o[len(e)])
  
 
print(*list, sep='')
Problem p02658 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))
newA = sorted(A,reverse=True)
num = 1
if 0 in A:
  num = 0
else:
  for i in newA:
    if num > 1000000000000000000:
      break
    num = num*int(i)
if num > 1000000000000000000:
  print(-1)
else:
  print(num)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(input().split())
num = 0
for i in A:
  num *= i
if num <= 1000000000000000000:
  print(-1)
else:
  print(num)
Problem p02675 (python)

Fixed submission:
N = input()
if int(N[-1]) == 2 or int(N[-1]) == 4 or int(N[-1]) == 5 or int(N[-1]) == 7 or int(N[-1]) == 9:
  print('hon')
elif int(N[-1]) == 0 or int(N[-1]) == 1 or int(N[-1]) == 6 or int(N[-1]) == 8:
  print('pon')
elif int(N[-1]) == 3:
  print('bon')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()

if K >= len(S):
  print(S)
else:
  print(S[0:K]+'...')
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if S == T[0:len(S)]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if S == T[0:len(S)]:
  print('YES')
else:
  pritn('NOa')
Problem p02841 (python)

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

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

if (A == 1 or A == 3 or A == 5 or A == 7 or A == 8 or A == 10 or A == 12):
  if B == 31:
    print(1)
  else:
    print(0)
elif (A == 4 or A == 6 or A== 9 or A == 11):
  if B == 30:
    print(1)
  else:
    print(0)
elif A == 2:
  if B == 28:
    print(1)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
A = (N*100)%108
N = N*100/108

if A == 0:
  print(int(N))
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

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

if (A == 1 or A == 3 or A == 5 or A == 7 or A == 8 A == 10 or A == 12):
  if B == 31:
    print(1)
  else:
    print(0)
elif (A == 4 or A == 6 or A== 9 or A == 11):
  if B == 30:
    print(1)
  else:
    print(0)
elif A == 2:
  if B == 28:
    print(1)
  else:
    print(0)
Problem p02885 (python)

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

A,B = map(int,input().split())

C = B * 2

if A<C:
  print(0)
else:
  D = A - C
  print(D)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
N = N-1
S = input()
s = ' '
o = ' '
n = 0
for i in range(N):
  if S[n] == S[n+1]:
    if s[-1] != S[n]:
      s = s + S[n]
    n = n + 1
  else:
    if s == o:
      s = s + S[n]
      s = s.lstrip()
    s = s + S[n+1]
    n = n + 1
print(len(s.lstrip()))
Problem p03455 (python)

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

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
c = a*b%2

if c = 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

c = a*b%2

if c = 0:
    print("Even")
else:
    print("Odd")
Problem p03547 (python)

Fixed submission:
X,Y = map(str, input().split())
l = ['A','B','C','D','E','F']
if l.index(X)>l.index(Y):
  print('>')
elif l.index(X)<l.index(Y):
  print('<')
else:
  print('=')

Buggy submission (verdict: Runtime Error):
X,Y = map(int, input().split())
l = ['A','B','C','D','E','F']
if l.index(X)>l.index(Y):
  print('>')
elif l.index(X)<l.index(Y):
  print('<')
else:
  print('=')
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())


print(2*G-R)

Buggy submission (verdict: Runtime Error):
R = int(input())
G = int(input())


print(2G-R)
Problem p03605 (python)

Fixed submission:
N = input()

if N[0] == '9' or N[1] == '9':
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()
N = list[N[0],N[1]]
if '9' in N:
  print('Yes')
else:
  print('No')
Problem p03657 (python)

Fixed submission:
A,B = map(int, input().split())
if (A + B)%3 == 0 or A%3 == 0 or B%3 == 0:
  print('Possible')
else:
  print('Impossible')

Buggy submission (verdict: Runtime Error):
A,B = map(str, input().split())
if (A + B)%3 == 0:
  print('Possible')
else:
  print('Impossible')
Problem p03671 (python)

Fixed submission:
A = list(map(int, input().split()))
A = sorted(A)
print(A[0]+A[1])

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
A = A.sorted()
print(A[0]+A[1])
Problem p04043 (python)

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

A = a[0] + a[1]
if(A==10 or A==12):
  if (a[0] == 7):
    if(a[2] == 5 and a[1] == 5):
      print('YES')
    else:
      print('NO')
  elif (a[1] == 7):
    if(a[2] == 5 and a[0] == 5):
      print('YES')
    else:
      print('NO')
  elif (a[2] == 7):
    if(a[0] == 5 and a[1] == 5):
      print('YES')
    else:
      print('NO')
  else:
    print('NO')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
D = A + B + C
if(D<=12):
  if (A == 7):
    if(B == 5):
      print('YES')
  if (B == 7):
    if(A == 5):
      print('YES')
  if (C == 7):
    if(A == 5):
      print('YES')
else:
  print('NO')
Problem p02607 (python)

Fixed submission:
# 解答
def abc173_a(lines):
    N = int(lines[0])
    values = map(int, lines[1].split(' '))
    answer = 0
    tmp = list()
    for value in values:
        tmp.append(value)
    for i in range(N):
        if i % 2 != 0:
            pass
        else:
            if tmp[i] % 2 != 0:
                answer += 1
    return [answer]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '1 3 4 5 7']
        lines_export = [2]
    elif pattern == 2:
        lines_input = ['15', '13 76 46 15 50 98 93 77 31 43 84 90 6 24 14']
        lines_export = [3]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = abc173_a(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        print(f'lines_input=[{lines_input}]')
        print(f'lines_export=[{lines_export}]')
        print(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            print('OK')
        else:
            print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
# 解答
def abc173_a(lines):
    N = int(lines[0])
    values = map(int, lines[1].split(' '))
    answer = 0
    tmp = list()
    for value in values:
        tmp.append(value)
    print(f'tmp=[{tmp}]')
    print(f'tmp[0]=[{tmp[0]}]')
    for i in range(N):
        if i % 2 != 0:
            pass
        else:
            if tmp[i] % 2 != 0:
                answer += 1
    return [answer]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '1 3 4 5 7']
        lines_export = [2]
    elif pattern == 2:
        lines_input = ['15', '13 76 46 15 50 98 93 77 31 43 84 90 6 24 14']
        lines_export = [3]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = abc173_a(lines_input)

    for line_result in lines_result:
        print(line_result)

    if mode > 0:
        print(f'lines_input=[{lines_input}]')
        print(f'lines_export=[{lines_export}]')
        print(f'lines_result=[{lines_result}]')
        if lines_result == lines_export:
            print('OK')
        else:
            print('NG')


# 起動処理
if __name__ == '__main__':
    main()
Problem p02678 (python)

Fixed submission:
import collections

INF = float('inf')

N, M = list(map(int, input().split()))
d = {i: [] for i in range(N)}

for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    d[a].append(b)
    d[b].append(a)

queue = collections.deque()
queue.append((0, 0))
results = {i: (INF, -1) for i in range(N)}
results[0] = (0, 0)
used = set()

while queue:
    cost, cur = queue.pop()
    if cur in used:
        continue
    used.add(cur)
    next_list = d[cur]

    for next_cur in next_list:
        next_cost = cost+1
        if next_cost < results[next_cur][0]:
            results[next_cur] = (next_cost, cur)
            queue.appendleft((next_cost, next_cur))

is_no = False
for k, result in results.items():
    if k == 0:
        continue
    if result[1] == -1:
        is_no = True

if is_no:
    print('No')
else:
    print('Yes')
    for k, result in results.items():
        if k == 0:
            continue
        print(result[1] + 1)

Buggy submission (verdict: Runtime Error):
import collections

INF = float('inf')

N, M = list(map(int, input().split()))
d = {i: [] for i in range(N)}

for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    d[a].append(b)
    d[b].append(a)

queue = collections.deque()
queue.append((0, 0))
results = {i: (INF, -1) for i in range(N)}

while queue:
    cost, cur = queue.pop()
    next_list = d[cur]

    for next_cur in next_list:
        next_cost = cost+1
        if next_cost < results[next_cur][0]:
            results[next_cur] = (next_cost, cur)
            queue.append((next_cost, next_cur))

del results[0]
print(results)

is_no = False
for result in results:
    if result[1] == -1:
        is_no = True

if is_no:
    print('No')
else:
    print('Yes')
    for result in results:
        print(result[1])
Problem p02947 (python)

Fixed submission:
import unittest
from io import StringIO
import sys
from math import factorial
from scipy.misc import comb
import math


def resolve():
    N = int(input())
    d = {}
    count = 0
    for i in range(N):
        s = list(input())
        s.sort()
        s = ''.join(s)
        if s not in d.keys():
            d[s] = 1
        else:
            count += d[s]
            d[s] += 1

    print(count)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
acornistnt
peanutbomb
constraint"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2
oneplustwo
ninemodsix"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa"""
        output = """4"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Buggy submission (verdict: Runtime Error):
from math import factorial


def comb(n, r):
    if n == 0 or n-r < 0:
        return 0
    return int(factorial(n) / factorial(r) / factorial(n-r))


N = int(input())
S = []
for i in range(N):
    s = list(input())
    s.sort()
    S.append(s)

S.sort()

count = 0
count_min = 0
tmp = []
for s in S:
    if s == tmp:
        count_min += 1
    else:
        count += comb(count_min+1, 2)
        count_min = 0
    tmp = s
    # print('count:{}, min:{}'.format(count, count_min))
count += comb(count_min+1, 2)
print(count)

Buggy submission (verdict: Runtime Error):
from math import factorial


def comb(n, r):
    if n == 0 or n-r < 0:
        return 0
    return factorial(n) / factorial(r) / factorial(n-r)


N = int(input())
S = []
for i in range(N):
    s = list(input())
    s.sort()
    S.append(s)

S.sort()

count = 0
count_min = 0
tmp = []
for s in S:
    if s == tmp:
        count_min += 1
    else:
        count += comb(count_min+1, 2)
        count_min = 0
    tmp = s
    # print('count:{}, min:{}'.format(count, count_min))
count += comb(count_min+1, 2)
print(int(count))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

N = int(input())
S = []
for i in range(N):
    s = list(input())
    s.sort()
    S.append(s)

S.sort()

count = 0
count_min = 0
tmp = []
for s in S:
    if s == tmp:
        count_min += 1
    else:
        count += comb(count_min+1, 2, exact=True)
        count_min = 0
    tmp = s
    # print('count:{}, min:{}'.format(count, count_min))
count += comb(count_min+1, 2, exact=True)
print(count)
Problem p03682 (python)

Fixed submission:
# https://atcoder.jp/contests/abc065/tasks/arc076_b
import copy


class UnionFind():
    def __init__(self, n):
        super().__init__()
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        return True


n = int(input())
rows = [[i] + list(map(int, input().split())) for i in range(n)]

# (start, end, cost)
edges = []

# x座標でソートしてx座標が隣り合う点にをedge候補に
rows_x = copy.deepcopy(rows)
rows_x.sort(key=lambda x: x[1])
for i in range(len(rows)-1):
    left = rows_x[i]
    right = rows_x[i+1]
    edges.append((left[0], right[0], right[1] - left[1]))

# print(rows)
rows_y = copy.deepcopy(rows)
rows_y.sort(key=lambda x: x[2])
for i in range(len(rows)-1):
    down = rows_y[i]
    up = rows_y[i+1]
    edges.append((down[0], up[0], up[2] - down[2]))

# print(edges)

uf = UnionFind(n)

edges.sort(key=lambda edge: edge[2])

result = 0
for edge in edges:
    s, t, c = edge
    unioned = uf.union(s, t)
    if unioned:
        result += c

print(result)

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc065/tasks/arc076_b
import copy


class UnionFind():
    def __init__(self, n):
        super().__init__()
        self.n = n
        self.parents = [i for i in range(n)]

    def root(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        self.parents[y] = x
        return True


n = int(input())
rows = [[i] + list(map(int, input().split())) for i in range(n)]

# (start, end, cost)
edges = []

# x座標でソートしてx座標が隣り合う点にをedge候補に
rows_x = copy.deepcopy(rows)
rows_x.sort(key=lambda x: x[1])
for i in range(len(rows)-1):
    left = rows_x[i]
    right = rows_x[i+1]
    edges.append((left[0], right[0], right[1] - left[1]))

rows_y = copy.deepcopy(rows)
rows_y.sort(key=lambda x: x[2])
for i in range(len(rows)-1):
    down = rows_y[i]
    up = rows_y[i+1]
    edges.append((down[0], up[0], up[2] - down[2]))

# print(edges)

uf = UnionFind(n)

edges.sort(key=lambda edge: edge[2])

result = 0
for edge in edges:
    s, t, c = edge
    unioned = uf.union(s, t)
    if unioned:
        result += c

print(result)
Problem p03795 (python)

Fixed submission:
N = int(input())
x = 0
y = 0
for i in range(1,N+1):
    x += 800
    if (i%15 == 0):
        y += 200
print(x-y)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
count = 0
while(1):
    if N>=1:
        if M>=2:
            N -= 1
            M -= 2
            count += 1
        else:
            break
    else:
        while(1):
            if M >= 4 :
                M -= 4
                count += 1
            else:
                break
        break
        
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
count = 0
while(1):
    if N>=1:
        if M>=2:
            N -= 1
            M -= 2
            count += 1
        else:
            break
    elif M >= 4 :
        M -= 4
        count += 1
    else:
        break
        
print(count)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
num_c = N*2 + M
num_Scc = num_c//4
print(num_Scc)

Buggy submission (verdict: Runtime Error):
a = int(input())
b,c=map(int,input().split())
s=input()
print(str(a+b+c) + " " + s)
Problem p03797 (python)

Fixed submission:
import math
N,M = map(int,input().split())
count = 0
if N*2>M:
    count = math.floor(M/2)
else:
    temp=M-2*N
    count = N+math.floor(temp/4)

print(count)

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int,input().split())
count = 0
if N*2>M:
    count = math.floor(M/2)
else:
    temp=M-2*N
    ans = N+math.floor(temp/4)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int,input().split())
count = 0
if N*2>M:
    count = math.floor(M/2)
else:
    temp=M-2*N
    ans = N+math.floor(temp/4)

print(ans)
Problem p02576 (python)

Fixed submission:
N, X, T = map(int, input().split())
i=0
ans=0

if X==1:
  ans= N*T
else:
  if N<=X:
    ans = T
  else:
    while i<N :
      i = i+X
      ans = ans+T 
print(ans)

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

if X==1:
  ans == N*T
else:
  if N > X:
    ans = (N//X)*T
    ans = ans+T
  elif N < X:
    ans = T

print(ans)

Buggy submission (verdict: Runtime Error):
N, X, T = map(int, input().split())
if N > X:
  ans = (N//X)*T
  ans = ans+T
elif N < X:
  ans = T
elif X==1:
  ans == N*T
print(ans)
Problem p02719 (python)

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

quotinent = a // b

res = min(a - b * quotinent,  abs(a- b * (quotinent + 1)))
print(res)

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

quotinent = a // b

res = max(a - b * quotinent, abs( a- b * (quotinent + 1)))
print(res)
Problem p03061 (python)

Fixed submission:
from fractions import gcd


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i], A[i]))
    gcd_r.append(gcd(gcd_r[i], A[-(i+1)]))

gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
from math import gcd 


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i], A[i]))
    gcd_r.append(gcd(gcd_r[i], A[-(i+1)]))

gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))
Problem p03308 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())
print(max(A)-min(A))
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
n , m = map(int,input().split())
arr = list(map(int,input().split()))
add = sum(arr)
miniVotes = int(add*(1/(4*m)))
cnt = 0
for i in range(len(arr)):
	if arr[i]>=miniVotes:
		cnt+=1
if(cnt>=m):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
x ,y ,z = map(int,intput().split())
print(z,x,y)