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

Fixed submission:
N = input()
Nlen = len(N)
N = int(N)

def f(i, n, T, F, S):
  if i >= Nlen:
    return 1 if n <= N and T > 0 and F > 0 and S > 0 else 0
  n *= 10
  cnt = 0
  if n == 0:
    cnt += f(i+1, n, T  , F  , S  )
  cnt += f(i+1, n+3, T+1, F  , S  )
  cnt += f(i+1, n+5, T  , F+1, S  )
  cnt += f(i+1, n+7, T  , F  , S+1)
  return cnt

print(f(0, 0, 0, 0, 0))

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

def f(i, n, T, F, S):
  if i >= Nlen:
    return 1 if n <= N and T > 0 and F > 0 and S > 0 else 0
  n *= 10
  cnt = 0
  if n == 0:
    cnt += f(i+1, n, T  , F  , S  )
  cnt += f(i+1, n+3, T+1, F  , S  )
  cnt += f(i+1, n+5, T  , F+1, S  )
  cnt += f(i+1, n+7, T  , F  , S+1)

print(f(0, 0, 0, 0, 0))
Problem p03263 (python)

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

s = []
for i in range(H):
  for j in range(W-1):
    if M[i][j] & 1:
      s.append("{} {} {} {}".format(i+1, j+1, i+1, j+2))
      M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    s.append("{} {} {} {}".format(i+1, W, i+2, W))
    M[i+1][W-1] += 1
print(len(s))
print("\n".join(s))

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

for i in range(H):
  for j in range(W-1):
    if M[i][j] & 1:
      print(i+1, j+1, i+1, j+2)
      M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    print(i+1, j+1, i+2, j+1)
    M[i+1][j] += 1

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

for i in range(H):
  for j in range(W-1):
  if M[i][j] & 1:
    print(i, j, i, j+1):
    M[i][j+1] += 1
for i in range(H-1):
  if M[i][W-1] & 1:
    print(i, j, i+1, j)
    M[i+1][j] += 1
Problem p03371 (python)

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

print(min(min(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y), A * X + B * Y, max(X, Y) * 2 * C))

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

if 2 * C > A + B :
  print(A * X + B * Y)
else C < min(A, B):
  print(max(X, Y) * 2 * C)
else:
  print(min(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y))

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

print(mix(X, Y) * 2 * C + (A if X > Y else B) * abs(X-Y), A * X + B * Y, max(X, Y) * 2 * C)
Problem p03379 (python)

Fixed submission:
N = int(input())
a = sorted(map(lambda x, y: [int(y), x], range(1, N+1), input().split()))
 
m = N // 2
am = a[m][0]
amp = a[m-1][0]

a = sorted(zip(a, range(N)), key=lambda x:x[0][1])
for _, i in a:
  print(am if i < m else amp)

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

m = N // 2

for x in (a[m], a[m-1]):
  for i in range(m):
    print(x)
Problem p03408 (python)

Fixed submission:
d = dict()

def getv(a):
  M = int(input())
  for x in range(M):
    n = input()
    if d.get(n) is None:
      d[n] = 0
    d[n] += a

getv(1)
getv(-1)

print(max(0,d[sorted(d, key=lambda x:d[x], reverse=True)[0]]))

Buggy submission (verdict: Runtime Error):
d = dict()

def getv():
  M = int(input())
  for x in range(M):
    n = input()
    if d.get(n) is None:
      d[n] = 0
    d[n] += 1

getv(1)
getv(-1)

print(sorted(d, key=lambda x:x[1], reverse=True)[0])
Problem p03427 (python)

Fixed submission:
S = list(input())
N = [str(int(S[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Buggy submission (verdict: Runtime Error):
S = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(S)-1)
print("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))

Buggy submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)
print("{:.0f}".format(sum(map(int, N)))

Buggy submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)
print("{:.0f}".format(eval("".join(N))))

Buggy submission (verdict: Runtime Error):
N = list(input())
N = [str(int(N[0]) - 1)] + [9] * (len(N)-1)
print("{:.0f}".format(eval("".join(N))))
Problem p03435 (python)

Fixed submission:
C = [list(map(int, input().split()))  for _ in range(3)]

x = [list() for _ in range(2)]
y = [list() for _ in range(2)]
for i in range(3):
  for j in range(2):
    x[j].append(C[i][j] - C[i][j+1])
    y[j].append(C[j][i] - C[j+1][i])

out = False
for j in range(2):
  if min(x[j]) != max(x[j]):
    break
  if min(y[j]) != max(y[j]):
    break
else:
  print("Yes")
  out = True
if not out:
  print("No")

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

for i in range(2):
  for j in range(2):
    if C[i][j] - C[i][j+1] != C[i+1][j] - C[i+1][j+1] :
    break
    if C[j][i] - C[j+1][i] != C[j][i+1] - C[j+1][i+1] :
      break
else:
  print("Yes")
  out = True
if not out:
  print("No")
Problem p03437 (python)

Fixed submission:
X, Y = map(int, input().split())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

g = Y / gcd(X, Y)

if g == 1:
  print("-1")
else:
  if g == 2:
    g = 3
  else:
    g = 2
  ans = X * g
  if ans <= 1e18:
    print(ans)
  else:
    print("-1")

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x%y)

g = Y / gcd(X, Y)

if g == 1:
  print("-1")
else:
  if g == 2:
    g = 3
  else:
    g = 2
  ans = X * g
  if ans <= 1e18:
	print(ans)
  else:
    print("-1")
Problem p03457 (python)

Fixed submission:
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  p = x, y
else:
  print("Yes")

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

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  *p = x, y
else:
  print("Yes")
Problem p03487 (python)

Fixed submission:
N = input()
d = dict()
for x in map(int, input().split()):
  if d.get(x) is None:
    d[x] = 0
  d[x] += 1

print(sum((d[x]-x if d[x]>=x else d[x]) for x in d))

Buggy submission (verdict: Runtime Error):
N = input()
d = dict()
for x in map(int, input().split())
	if d.get(x) is None:
    	d[x] = 0
	d[x] += 1

print(sum((min(d[x], abs(d[x]-x) for x in d))))
Problem p03545 (python)

Fixed submission:
ABCD = input()
op ="+-"
for i in range(pow(2, 3)):
  v = i
  f = str(ABCD[0])
  for j in range(1,4):
    f += op[v%2] + ABCD[j]
    v //= 2
  if eval(f) == 7:
    print("{}=7".format(f))
    break

Buggy submission (verdict: Runtime Error):
ABCD = list(map(int, input()))
op ="+-"
for i in range(pow(2, 3)):
  v = i
  f = str(ABCD[j])
  for j in range(3):
    f += op[v%2] + ABCD[j]
    v //= 2
  if eval(f) == 7:
    print("{}=7", f)
    break
Problem p03549 (python)

Fixed submission:
N, M = map(int, input().split())
print("{:.0f}".format((1900 * M + 100 * (N-M)) / pow(1/2, M)))

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

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

S = []
pt = []
G = [-1] * (N+1)
idx = 0
cnt = 0
for pair in B:
    d = []
    for i, x in enumerate(pair):
        if G[x] >= 0:
            d.append(G[x])

    if len(d) <= 0:
        pt.append(1)
        for x in pair:
            G[x] = idx
        idx += 1
    elif len(d) == 1:
        pt.append(G.count(d[0]))
        for x in pair:
            G[x] = d[0]
    else:
        if d[0] == d[1]:
            pt.append(0)
        else:
            pt.append(G.count(d[0]) * G.count(d[1]))
            for i, x in enumerate(G):
                if x == d[1]:
                    G[i] = d[0]

cnt = 0
for x in pt[::-1]:
    cnt += x
    print(cnt)
Problem p03574 (python)

Fixed submission:
H, W = map(int, input().split())
 
Ss = [[-1 if c == "#" else 0 for c in input()] for _ in range(H)]
 
def plus(i, j):
  if 0 <= i < H and 0 <= j < W:
    if Ss[i][j] >= 0:
      Ss[i][j] += 1
 
for i in range(H):
  for j in range(W):
    if Ss[i][j] != -1:
      continue
    for x, y in ((x,y) for x in range(-1, 2) for y in range(-1, 2)):
      if x != 0 or y != 0:
        plus(i+x, j+y)
 
for i in range(H):
  for j in range(W):
    print("#" if Ss[i][j] == -1 else Ss[i][j], end="")
  print()

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())

Ss = [[-1 if c == "#" else 0 for c in input()] for _ in range(H)]

def plus(i, j):
  if 0 <= i < H and 0 <= j < W:
    if Ss[i][j] >= 0:
      Ss[i][j] += 1

for i in range(H):
  for j in range(W):
    for x, y in ((x,y) for x in range(-1, 2) for y in range(-1, 2):
      if x != 0 or y != 0:
        plus(i, j)

for i in range(H):
  for j in range(W):
    print("#" if Ss[i][j] == -1 else Ss[i][j], end="")
Problem p03624 (python)

Fixed submission:
X = set()
for x in input():
  X.add(x)
X = sorted(X)
c = bytes(["a".encode("sjis")[0] + sum([1 for i, x in enumerate(X) if x.encode("sjis")[0] == "a".encode("sjis")[0] + i])]).decode("sjis")

if c.encode("sjis")[0] > "z".encode("sjis")[0]:
  c = "None"

print(c)

Buggy submission (verdict: Runtime Error):
X = set()
for x in input():
  X.add(x.encode("sjis")[0])
X = sorted(X)
codeA = "a".encode("sjis")[0]
codes = [bytes(codeA + i).decode("sjis") for i in range(26)]
codes.append("None")

print(codes(sum([1 for i, x in enumerate(X) if x == codes[i]])))

Buggy submission (verdict: Runtime Error):
X = set()
for x in input():
  X.append(x)
X = sorted(X)
if X[0] != "a":
  c = "a"
else:
  c = ["a".enocode("sjis")[0] + sum([1 for i, x in enumerate(X) if x.encode("sjis")[0] == "a".encode("sjis")[0] + i])].decode("sjis")

if c.endode("sjis")[0] > "z".encode("sjis")[0]:
  c = "None"

print(c)
Problem p03627 (python)

Fixed submission:
N = int(input())

ans = 1
cnt = 2
w = 0
for Ai in sorted(map(int, input().split()), reverse=True):
  if w != Ai:
    w = Ai
  else:
    ans *= w
    cnt -= 1
    if cnt <= 0:
      break
    w = 0

print(ans if cnt <= 0 else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()), reverse=True)
 
p = [(i, x) for i, x, y in zip(range(N-1), A[:-1], A[1:]) if x == y]
print(p[0][1] * (p[1][1] if p[0][0] + 1 < p[1][0] else p[2][1]))

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

p = [x for x, y in zip(A[:-1], A[1:]) if x == y]
print(p[0] * p[1])
Problem p03633 (python)

Fixed submission:
N = int(input())

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 1
for x in (int(input()) for _ in range(N)):
  g = g * x // gcd(g, x)
print(g)

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 1
for x in (int(input()) for _ in range(N)):
  g = g * x / gcd(g, x)
print(g)

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

g = 0
for x in (map(int, input()) for _ in range(N)):
  g = gcd(g, x)
print(g)
Problem p03640 (python)

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

i = 0
buf = [0] * W
k = 1
for x, ai in zip(range(1, N+1), map(int, input().split())):
  for _ in range(ai):
    buf[i] = x
    i += 1
    if i >= W:
      print(" ".join(map(str, buf[::k])))
      i = 0
      k = -k

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

i = 0
buf = [0] * W
k = 1
for x, ai in aip(range(1, N+1), map(int, input().split())):
  for _ in range(ai)
	buf[i] = x
    i += 1
    if i >= W:
      print(" ".join(buf[::k]))
      i = 0
      k = -k
Problem p03659 (python)

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

s = sum(a)

w = None
for ai in a[:-1]:
  s -= 2 * ai
  if w is None:
    w = abs(s)
  else:
    w = min(w, abs(s))
print(w)

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

s = sum(a)

w = None
for i in a[:-1]:
  s -= 2 * a
  if w is None:
    w = s
  else:
    w = min(w, s)
print(w)
Problem p03672 (python)

Fixed submission:
S = input()
for i in range((len(S)-1)//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i*2)

Buggy submission (verdict: Runtime Error):
S = input()
for i in range(S//2, 0, -1):
  if S.find(S[:i], i) == i:
    break
print(i)
Problem p03695 (python)

Fixed submission:
N = int(input())


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input().split())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    else:
      if cnt > 0:
        ansOne += 1
        cnt = 0
      i+=1
    
  else:
    ansAny += 1

if ansAny <= 0:
  ansOne += 1
print("{} {}".format(max(ansOne, 1), ansOne + ansAny))

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


c = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]

i = 0
cnt = 0
ansOne = 0
ansAny = 0
for ai in sorted(map(int, input())):
  while i < len(c):
    if ai <= c[i]:
      cnt += 1
      break
    elif cnt > 0:
      ansOne += 1
      cnt = 0
    
  else:
    ansAny += 1
    continue

print("{} {}".format(max(ansOne, 1), min(len(c), ansOne + ansAny))
Problem p03699 (python)

Fixed submission:
N = int(input())
ssum = 0
not10min = -1
for si in (int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)

Buggy submission (verdict: Runtime Error):
N = int(input())
s =[int(input()) for _ in range(N)]
S = sum(s)
print(S-min([x for x in s if x % 10!=0]+[[0,S][(S%10)*1]]))

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

if sum(s) % 10 != 0:
  s -= min([for x in s if x % 10 == 0] + [s])

print(s)

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

if sum(s) % 10 != 0:
  s -= min([for x in s if s % 10 == 0] + [s])

print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
ssum = 0
not10min = -1
for si in map(int(input()) for _ in range(N)):
  ssum += si
  if si % 10 != 0:
    if not10min < 0:
      not10min = si
    else:
      not10min = min(not10min, si)

if ssum % 10 ==0:  
  if not10min >= 0:
    ssum -= not10min
  else:
    ssum = 0
print(ssum)
Problem p03733 (python)

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

f = None
p = None
ans = 0
for t in map(int, input().split()):
  if f is None:
    f = t
    p = f - T

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest
  p = t - f

print(ans)

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

f = None
p = None
ans = 0
for t in map(int, input().split())
  if f is None:
    f = t
    p = t - f

  ans += T
  rest = p + T - (t - f)
  if rest > 0:
    ans -= rest

  p = t - f

print(ans)
Problem p03739 (python)

Fixed submission:
N = input()
a = list(map(int, input().split()))
 
def f(x):
  cnt = 0
  cur = 0
  for ai in a:
    cur += ai
    cur *= x
    if cur <= 0:
      cnt += 1 - cur
      cur = 1
    cur *= x
    x *= -1
  return cnt
 
print(min(f(1), f(-1)))

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

def f(x):
  cnt = 0
  cur = 0
  for ai in a:
    cur += ai
    cur *= x
    if cur < 0:
      cnt += 1 - ai
    x *= -1
  print(cnt)

print(min(f(1), f(-1))
Problem p03760 (python)

Fixed submission:
O = input()
E = input()

tail = len(O) - len(E)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E))) + ["", O[-1]][tail])

Buggy submission (verdict: Runtime Error):
O = input()
E = input()

tail = len(O) - len(E)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E) + ["", O[-1]][tail])

Buggy submission (verdict: Runtime Error):
O = input()
E = input()

tail = len(E) - len(O)

print("".join((x + y for x, y in zip([O, O[:-1]][tail], E) + ["", O[-1]][tail])
Problem p03781 (python)

Fixed submission:
import math
x = int(input())

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(int(t)//2)
else:
  print(int(t)//2+1)

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

t = (-1 + math.sqrt(1 + 8 * x))
if t % 2 == 0:
  print(t//2)
else:
  print(t//2+1)
Problem p03796 (python)

Fixed submission:
def fraction(N):
  w = N
  for x in range(1, N):
    w = (w * x) % (1e9 + 7)
  return w
print("{:.0f}".format(fraction(int(input()))))

Buggy submission (verdict: Runtime Error):
def fraction(N):
  w = N
  for x in range(1, N):
    w *= x
  return w
print("{:.0f}".format(fraction(int(input())) % (1e9 + 7)))

Buggy submission (verdict: Runtime Error):
def fraction(N):
  w = N
  for x in range(1, N):
    w *= x
  return w
print("{:.0f}".format(fraction(int(input())) % (1e9 + 7)))

Buggy submission (verdict: Runtime Error):
def fraction(N):
  w = N
  for x in range(1, N):
    w *= x
  return w
print(fraction(int(input())) % (1e9 + 7))

Buggy submission (verdict: Runtime Error):
def fraction(N):
  if N <= 1:
    return 1
  else:
    return N * fraction(N-1)
print(fraction(int(input())) % (1e9 + 7))

Buggy submission (verdict: Runtime Error):
def fraction(N):
  if N <= 1:
    return 1
  else:
    return N * fraction(N-1)
print(fraction(int(input())))
Problem p03828 (python)

Fixed submission:
from functools import reduce
N = int(input())
g = 10 ** 9 + 7

def add(a, b):
  return (a + b) % g
def mul(a, b):
  return (a * b) % g

def adda(a, p1, p2):
    for x in range(len(a)):
        a[x] = add(p1[x], p2[x])

d = []
DP = [[0 for _ in range(N+1)] for _ in range(N+1)]
ans = [0 for _ in range(N+1)]
for i in range(2, N+1):
  for j in (x for x in d if x * x <= N):
    if i % j == 0:
      adda(DP[i], DP[j], DP[i//j])
      break
  else:
    d.append(i)
    DP[i][i] = 1
  adda(ans, ans, DP[i])

print(reduce(mul, [x + 1 for x in ans[1:N+1]]))

Buggy submission (verdict: Runtime Error):
sosu = []
N = int(input())
g = 10 ** 9 + 7
def add(a, b):
  return (a + b) % g

d = []
DP = [0] * (max(2,N)+1)
DP[1] = 0
DP[2] = 1
for i in range(2, N+1):
  for j in (x for x in d if j * j <= N):
    if i % j == 0:
      DP[i] = DP[j] + DP[i//j]
      break
  else:
    d.append(i)
    DP[i] = 1

print(DP[N]+1)
Problem p03944 (python)

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

left, bottom = 0, 0
right, top = W, H

for x, y, a in (map(int, input().split()) for _ in range(N)):
  
  if a == 1:
    left = max(left, x)
  elif a == 2:
    right = min(right, x)
  elif a == 3:
    bottom = max(bottom, y)
  else:
    top = min(top, y)

print(max(0, right-left) * max(0, top-bottom))

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

left, bottom = 0, 0
right, top = W, H

for x, y, a in map(int, input().split()):
  
  if a == 1:
    left = max(left, x)
  elif a == 2:
    right = min(right, x)
  elif a == 3:
    bottom = max(bottom, y)
  else:
    top = min(top, y)

print(max(0, right-left) * max(0, top-bottom))
Problem p03945 (python)

Fixed submission:
S = input()
print( sum([ 1 for x, y in zip(S[:-1], S[1:]) if x != y]) )

Buggy submission (verdict: Runtime Error):
s = input()
w = ""
cnt1 = 0
for x in s[1:]:
	if x != w:
      cnt1 += 1

cnt2 = 0
for x in s[-2::-1]:
	if x != w:
      cnt2 += 1

print(min(cnt1, cnt2))
Problem p03957 (python)

Fixed submission:
import re
S = input()
print(["Yes", "No"][re.match(".*C.*F.*", S) is None])

Buggy submission (verdict: Runtime Error):
import re
print(["No", "Yes"][re.Match("C.*F", input())])
Problem p04012 (python)

Fixed submission:
w = 0
codea = "a".encode()[0]
for x in input():
  w ^= 1 << (x.encode()[0] - codea)
print("No" if w!=0 else "Yes")

Buggy submission (verdict: Runtime Error):
w = 0
codea = "a".encode()
for x in input():
  w ^= 1 << (x.encode() - codea)
print("No" if w!=0 else "Yes")
Problem p02573 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
        
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x,y = y,x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x

n, m = map(int,input().split())

uf = UnionFind(n)

ab = [tuple(map(int,input().split())) for _ in range(m)]

for a,b in ab:
    uf.union(a-1,b-1)

ans = -1
for i in uf.parents:
    ans = min(i,ans)
    
print(-ans)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self,n):
        
        self.parents = [-1]*(n+1)

    def find(self, x):
        if self.parents[x] < x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def roots(self):
        return [i for i,x in enumerate(self.parents) if x < 0]

n,m = map(int,input().split())

uf = UnionFind(n)

for i in range(m):
    a,b = map(int,input().split())
    uf.union(a,b)

cnt = []
for i in uf.roots():
    cnt.append(i)
    
print(max(cnt))

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self,n):
        
        self.parents = [-1]*(n+1)

    def find(self, x):
        if self.parents[x] < x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        self.parents[x] += self.parents[y]
        self.parents[y] = x

n,m = map(int,input().split())

uf = UnionFind(n)

for i in range(m):
    a,b = map(int,input().split())
    uf.union(a,b)

print(abs(min(uf.parents)))
Problem p02641 (python)

Fixed submission:
x, n = map(int,input().split())

p = list(map(int,input().split()))

d =100
num = 0

if n == 0:
    num = x
else:
    for i in range(102):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
print(num)

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

p = list(map(int,input().split()))

p.append(x)

d =100

if n == 0:
    print(x)
else:
    for i in range(1,101):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
    print(num)

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

p = list(map(int,input().split()))

p.append(x)

d =100

for i in range(1,101):
    if i not in p:
        d_temp = abs(x-i)
        if d_temp < d:
            d = d_temp
            n_i = i

            
if n == 0:
    print(x)
else:
    print(n_i)