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

Fixed submission:
from collections import deque
S = deque(list(input()))
Q = int(input())
f = 0
for _ in range(Q):
  a, *b = input().split()
  f += int(a)
  if a == "2":
    if (int(b[0]) + f) % 2 == 1 :
      S.appendleft(b[1])
    else:
      S.append(b[1])
D = list(S)
print ("".join(D) if f % 2 == 0 else "".join(D[::-1]))

Buggy submission (verdict: Runtime Error):
from collections import deque
S = deque(list(input()))
Q = int(input())
f = 0
for _ in range(Q):
  a, *b = input().split()
  f += int(a)
  if a == "2":
    if (int(b[0]) + f) % 2 == 1 :
      S.appendleft(b[1])
    else:
      S.append(b[1])
if  f % 2 == 0 :
  S = "".join(S)
else:
  S = "".join(S[::-1])
print (S)

Buggy submission (verdict: Runtime Error):
from collections import deque
S = deque(list(input()))
Q = int(input())
f = 0
for _ in range(Q):
  a, *b = input().split()
  f += int(a)
  if a == "2":
    if (int(b[0]) + f) % 2 == 1 :
      S.appendleft(b[1])
    else:
      S.append(b[1])
if  f % 2 == 0 :
  S = "".join(S)
else:
  S = "".joins(S[::-1])
print (S)
Problem p02886 (python)

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

print ((sum(d) ** 2 - sum(map(lambda x: x ** 2, d))) //2)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  for j in range(i:N):
    ans += d[i] * d[j]
print (ans)
Problem p02898 (python)

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

L = [1 for i in range(N) if h[i] >= K]
print (len(L))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
print (len([1 for x in h if h >= K]))
Problem p02900 (python)

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

def gcd(a, b):
  if b > a:
    a, b = b,a
  a, b = b, a % b
  if b == 0:
    return a
  else:
    return gcd(a, b)

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
  divisors.append(N // divisors[-1])
  return divisors

N = gcd(A, B)
if N == 1:
  print (1)
  sys.exit()

D = make_divisors(N)
L = []
for i in D[1:]:
  for j in L:
    if i % j == 0:
      break
  else:
    L.append(i)
print (len(L)+1)

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

def gcd(a, b):
  if b > a:
    a, b = b,a
  a, b = b, a % b
  if b == 0:
    return a
  else:
    return gcd(a, b)

def make_divisors(n):
  divisors = []
  for i in range(2, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
  divisors.append(N // divisors[-1])
  return divisors

N = gcd(A, B)
if N == 1:
  print (1)
  sys.exit()

D = make_divisors(N)
L = []
for i in D:
  for j in L:
    if i % j == 0:
      break
  else:
    L.append(i)
print (len(L)+1)
Problem p02936 (python)

Fixed submission:
from collections import deque
from collections import defaultdict
N, Q = map(int, input().split())
C = [0]* N
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a-1].add(b-1)
  D[b-1].add(a-1)
for i in range(Q):
  p, x = map(int, input().split())
  C[p-1] += x

Q = deque([])
Q.append(0)
vstd = set()

while len(Q)>0:
  a = Q.popleft()
  vstd.add(a)
  for b in D[a]:
    if b in vstd:
      continue
    C[b] += C[a]
    Q.append(b)

print (" ".join(map(str, C)))

Buggy submission (verdict: Runtime Error):
from collections import deque
from collections import defaultdict
N, Q = map(int, input().split())
C = [0]* N
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a-1].add(b-1)
  D[b-1].add(a-1)
for i in range(Q):
  p, x = map(int, input().split())
  C[p-1] += x

def dfs(n, vstd, x):
  C[n] += x
  vstd.append(n)
  for i in D[n]:
    if i in vstd:
      continue
    dfs(i, vstd, C[n])

dfs(0, [0], 0)    
print (" ".join(map(str, C)))

Buggy submission (verdict: Runtime Error):
from collections import deque
from collections import defaultdict
N, Q = map(int, input().split())
C = defaultdict(int)
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a-1].add(b-1)
  D[b-1].add(a-1)
for i in range(Q):
  p, x = map(int, input().split())
  C[p-1] = x

def dfs(n, vstd, x):
  C[n] += x
  vstd.append(n)
  for i in D[n]:
    if i in vstd:
      continue
    dfs(i, vstd, C[n])

dfs(0, [0], 0)    
print (" ".join(map(str, C.values())))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N, Q = map(int, input().split())
C = defaultdict(int)
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a-1].add(b-1)
  
def AddPX(n, x):
  C[n] += x
  for i in D[n]:
    AddPX(i, x)
  
for i in range(Q):
  p, x = map(int, input().split())
  AddPX(p-1, x)
print (" ".join(map(str, C.values())))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N, Q = map(int, input().split())
C = [0] * (N+1)
D = defaultdict(set)
for i in range(N-1):
  a, b = map(int, input().split())
  D[a].add(b)
  
def AddPX(n, x):
  C[n] += x
  for i in D[n]:
    AddPX(i, x)
  
for i in range(Q):
  p, x = map(int, input().split())
  AddPX(p, x)

print (" ".join(map(str, C[1:])))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
A = [''] * (N+1)
C = [0] * (N+1)
for i in range(N-1):
  a, b = map(int, input().split())
  if len(A[a]) == 0:
    A[a] = [b]
  else:
    A[a].append(b)
def AddPX(n, x):
  C[n] += x
  for i in A[n]:
    AddPX(i, x)
  
for i in range(Q):
  p, x = map(int, input().split())
  AddPX(p, x)

print (" ".join(map(str, C[1:])))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
A = [''] * (N+1)
C = [0] * (N+1)
for i in range(N-1):
  a, b = map(int, input().split())
  if len(A[a]) == 0:
    A[a] = [b]
  else:
    A[a].append(b)

def AddPX(n, x):
  C[n] += x
  for i in A[n]:
    AddPX(i, x)
  
for i in range(Q):
  p, x = map(int, input().split())
  AddPX(p, x)
print (" ".join(map(str, C[1:])))
Problem p03035 (python)

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

print (B if A>=13 else B//2 if A>= 6 else 0)

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

print (B if a>=13 else B//2 if a>= 6 else 0)
Problem p03219 (python)

Fixed submission:
x, y = map(int, input().split())
print (x + y // 2)

Buggy submission (verdict: Runtime Error):
print (int(input()) + int(input())//2)
Problem p03261 (python)

Fixed submission:
N = int(input())
L = [input() for _ in range(N)]

flg = False
if len(L) != len(set(L)): flg = True
for i in range(1, N):
  if flg: break
  if i != 0:
    if L[i][0] != L[i-1][-1]:
      flg = True
print ("No" if flg else "Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [input() for _ in range(N)]

flg = False
if len(L) != len(set(L)): flg = True
for i in range(N):
  if flg: break
  if i != 0:
    if L[i][1] != L[i-1][-1]:
      flg = True
print ("No" if flg else "Yes")
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
print ((int(input())-1) * (int(input())-1))
Problem p03288 (python)

Fixed submission:
N = int(input())

if N < 1200:
  print ("ABC")
elif N < 2800:
  print ("ARC")
else:
  print ("AGC")

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

if N< 1200:
  print ("ABC")
elsif N< 2800:
  print ("ARC")
else:
  print ("AGC")
Problem p03338 (python)

Fixed submission:
N = int(input())
S = input()

a = [0] * N
for i in range(1, N-1):
  a[i] = len(set(S[:i]) & set(S[i:]))
print (max(a))

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

print (max(len(set(S[:i]) & set(S[i:])) for i in range(1,N-1)))
Problem p03474 (python)

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

if any([S.count("-") != 1, S[0] == "-", S[-1] == "-"]):
  print ("No")
else:
  a, b = S.split("-")
  if len(a) == A and len(b) == B:
    print ("Yes")
  else:
    print ("No")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
a, b = input().split("-")
print ("Yes" if len(a) == A and len(b) == B else "No")
Problem p03493 (python)

Fixed submission:
s = input()
a = 0
for i in range(3):
  if s[i] == "1": a += 1
print (a)

Buggy submission (verdict: Runtime Error):
s = input()
a = 0
for i in range(3):
  if s[i] = "1": a += 1
print (a)
Problem p03598 (python)

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

ans = 0
for i in range(N):
  ans += min(x[i], K-x[i])*2
print (ans)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(*args):
  return reduce(fractions.gcd, args)

ans = 1
for i in range(1, N):
    ans = ans * T[i] // gcd(ans, T[i])
print(ans)
Problem p03624 (python)

Fixed submission:
S = input()

li = [chr(i) for i in range(ord("a"), ord("z") + 1)]

for i in range(len(S)):
  if S[i] in li:
    li.remove(S[i])
print (li[0] if len(li) != 0 else "None")

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

li = [chr(i) for i in range(ord("a"), ord("z") + 1)]

for i in range(len(S)):
  if S[i] in li:
    li.remove(S[i])
print (li[0])
Problem p03645 (python)

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

A = []
for i in range(M):
  A.append(list(map(int, input().split())))

D1 = set(A[i][1] for i in range(M) if A[i][0] == 1)
D2 = set(A[i][0] for i in range(M) if A[i][1] == N)

if len(D1 & D2) != 0:
  print ("POSSIBLE")
else:
  print ("IMPOSSIBLE")

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

D = {}
for i in range(M):
  a, b = map(int, input().split())
  D[a] = b

print ("POSSIBLE" if D[D[1]] == N else "IMPOSSIBLE")
Problem p03796 (python)

Fixed submission:
import math

N = int(input())
print (math.factorial(N) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
print (factorial(N) % (10 ** 9 + 7))
Problem p03962 (python)

Fixed submission:
print (len(set(input().split())))

Buggy submission (verdict: Runtime Error):
print (len(set(input.split())))
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print ((a+b)*h //2)

Buggy submission (verdict: Runtime Error):
a = int(input)
b = int(input)
h = int(input)
print ((a+b)*h //2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print ((a+b)*h //2)
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(max(a - b * 2, 0))
Problem p02923 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()
t = readl()

left = 0
right = 1
mx = 0
current = 0
if n == 1:
    print(0)
    exit()
while(1):
    if t[left] >= t[right]:
        current += 1
        mx = max(current, mx)
    else:
        current = 0
    left += 1
    right += 1
    if left >= n or right >= n:
        break
print(mx)

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()
t = readl()

left = 0
right = 1
tt = [0] * (n + 1)
index = 0
mx = 0
current = 0
while(1):
    if t[left] >= t[right]:
        current += 1
        mx = max(current, mx)
    else:
        current = 0
    left += 1
    right += 1
    if left >= n or right >= n:
        break
print(mx)
Problem p02969 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

a = int(input())
print(3 * (a ** 2))

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()
d = []
for i in range(n):
    k = readi()
    d.append(k)
p = []
g = -1
for i in range(n - 1):
    t = d[i]
    k = max(d[i+1:n])
    print(max(k, g))
    g = max(t, g)
print(max(d[0],g))
Problem p02999 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

x, a = map(int,input().split())
if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
x, a = map(int,input().split())
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

x, a = readmi()
if x > a:
    print(10)
else:
    print(0)
Problem p03048 (python)

Fixed submission:
# coding: UTF-8
import sys
sys.setrecursionlimit(10**5)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

R, G, B, N = map(int, input().split())
count = 0
for i in range(N + 1):
    for j in range(N + 1):
        t = N - (i * R + G * j)
        if t < 0:
            break
        if t % B == 0:
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
sys.setrecursionlimit(10**5)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

R, G, B, N = map(int, input().split())
count = 0
for i in range(1, N + 1):
    j i n range(1, N + 1):
        t = N - (i * R + G * j)
        if t < 0:
            break
        if t % B == 0:
            count += 1
print(count)
Problem p03087 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n, q = map(int, input().split())
s = list(input())

ss = ""
b = [0] * n
for i in range(n):
    if s[i] == "A":
        ss = s[i]
    elif s[i] == "C":
        ss += s[i]
    else:
        ss = ""
    if ss == "AC":
        b[i] += b[i - 1] + 1
        ss = ""
    else:
        if i > 0:
            b[i] = b[i - 1]
for i in range(q):
    x, y = map(int, input().split())
    print(b[y - 1] - b[x - 1])

Buggy submission (verdict: Runtime Error):
    # coding: UTF-8
    import sys
    #sys.setrecursionlimit(n)
    import heapq
    import re
    import bisect
    import random
    import math
    import itertools
    from collections import defaultdict, deque
    from copy import deepcopy
    from decimal import *
     
    n, q = map(int, input().split())
    s = list(input())
     
    ss = ""
    a = [0] * n
    b = [0] * n
    for i in range(n):
        if s[i] == "A":
            ss = s[i]
        elif s[i] == "C":
            ss += s[i]
        if ss == "AC":
            a[i] = a[i - 1] - 1
            b[i] += b[i - 1] + 1
            ss = ""
        else:
            if i > 0:
                a[i] = a[i - 1]
                b[i] = b[i - 1]
     
    for i in range(q):
        x, y = map(int, input().split())
        print(max(0, b[y - 1] + a[x - 1]))
Problem p03103 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a, b = map(int, input().split())
d = []
for i in range(a):
    x, y = map(int, input().split())
    d.append((x, y))
d.sort()
count = 0
for i in range(a):
    if b <= d[i][1]:
        count += b * d[i][0]
        break
    else:
        b -= d[i][1]
        count += d[i][0] * d[i][1]
print(count)

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a, b = map(int, input().split())
d = defaultdict(int)
array = []
for i in range(a):
    x, y = map(int, input().split())
    d[x] = y
    array.append(x)
array.sort()


count = 0
for i in array:
        break
    if b <= d[i]:
        count += min(b, 0) * i
        break
    else:
        t = d[i]
        b -= t
        count += t * i
print(count)
Problem p03105 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

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

cnt = 0
for i in range(c):
    if b >= a:
        cnt += 1
        b -= a
    else:
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

def find(x):
    if node[x] < 0:
        return x
    else:
        node[x] = find(node[x])
        return node[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    ret = False
    if x != y:
        ret = True
        if rank[x] > rank[y]:
            node[x] += node[y]
            node[y] = x
        else:
            node[y] += node[x]
            node[x] = y
            if rank[x] == rank[y]:
                rank[y] += 1
    return ret

def is_same(x, y):
    return find(x) == find(y)

def size(x):
    return -node[find(x)]

n, m = map(int,input().split())
node = [-1 for i in range(n + 1)]
rank = [0 for i in range(n + 1)]
e = [[int(i) for i in input().split()] for i in range(m)]
ans = deque()
num = int((n * (n - 1)) // 2)
s = 0
for i in e[::-1]:
    s1 = size(i[0])
    s2 = size(i[1])
    ans.appendleft(num)
    if unite(i[0], i[1]):
        num -= s1 * s2
for i in ans:
    print(i)
Problem p03244 (python)

Fixed submission:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
a = list(map(int, input().split()))
even = defaultdict(int)
odd = defaultdict(int)
for i in range(n):
    if i % 2 == 0:
        even[a[i]] += 1
    else:
        odd[a[i]] += 1
x = sorted(even.items(), reverse=True, key=lambda t:t[1])
y = sorted(odd.items(), reverse=True, key=lambda t:t[1])
even_index = 0
odd_index = 0
if x[0][0] == y[0][0]:
    if x[0][1] > y[0][1]:
        even_index = 0
        odd_index = 1
    elif x[0][1] < y[0][1]:
        odd_index = 0
        even_index = 1
    else:
        if len(x) > 1:
            print(n - x[0][1] - max(x[1][1], y[1][1]))
        else:
            print(n // 2)
        exit()
            
else:
    even_index = 0
    odd_index = 0
print(n - x[even_index][1] - y[odd_index][1])

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
v = list(map(int, input().split()))
a = defaultdict(int)
b = defaultdict(int)

nn = n // 2
for i in range(nn):
    a[v[i * 2]] += 1
    b[v[i * 2 + 1]] += 1

ma1 = max(a, key=a.get)
mb1 = max(b, key=b.get)
mva1 = a[ma1]
mvb1 = b[mb1]
a[ma1] = 0
b[mb1] = 0
ma2 = max(a, key=a.get)
mb2 = max(b, key=b.get)
mva2 = a[ma2]
mvb2 = b[mb2]
a[ma2] = 0
b[mb2] = 0

ma = [(ma1, mva1), (ma2, mva2)]
mb = [(mb1, mvb1), (mb2, mvb2)]
mx = 0xFFFFFFFF
for i in ma:
    for j in mb:
        if i[0] == j[0]:
            pass
        else:
            mx = min(sum(a.values()) + i[1] + sum(b.values()) + j[1], mx)
if mx == 0xFFFFFFFF:
    print(0)
else:
    print(mx
Problem p03351 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
if abs(a-c) <= d or (abs(a-b) <= d && abs(b-c) <= d):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
    a, b, c, d = map(int, input().split())
    if abs(a-c) <= d or (abs(a-b) <= d && abs(b-c) <= d):
    	print('Yes')
    else:
       	print('No')
Problem p03434 (python)

Fixed submission:
n = int(input())
m = list(map(int, input().split()))
m.sort(reverse=True)
a = 0
b = 0
t = True
for i in m:
  if t:
    a += i
  else:
    b += i
  t = True if not(t) else False
print(a-b)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = map(int, input().split())
m.sort(reverse=True)
a = 0
b = 0
t = True
for i in m:
  if t:
    a += i
  else:
    b += i
  t = True if t else False
print(a-b)
Problem p03555 (python)

Fixed submission:
import sys
read = lambda: sys.stdin.readline().rstrip()
s1 = read()
s2 = read()
if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
read = lambda: sys.stdin.readline().rstrip()
s1 = read()
s2 = read()
if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print("YES")
else:
  print("NO")
Problem p02675 (python)

Fixed submission:
N=input()


if N[-1]=="3":
	print("bon")
elif N[-1] in ["0","1","6","8"]:
	print("pon")
else:
	print("hon")

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

if N[-1]　==　"3":
	print("bon")
elif N[-1] in ["1","6","8"]:
	print("pon")
else:
	print("hon")
Problem p02957 (python)

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


if (A+B)%2==0:
	print((A+B)//2)
else:
	print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
if (A+B)%2==0:
	print((A+B)//2)
else:
	print("IMPOSSIBLE")