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

Fixed submission:
if __name__ == "__main__":
  a, b, c = map(int, input().split())
  
  res_1 = a - b
  
  res_2 = c - res_1
  if res_2 <= 0:
    print(0)
  else:
    print(res_2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
  print("Yes")
  exit()

h_list = [int(h) for h in input().split()]

for index in range(0,n-1):
  if h_list[index] > h_list[index+1]:
    h_list[index] = h_list[index]-1

for index in range(1, n):
  if h_list[index-1] > h_list[index]:
    print("No")
    exit()
print("Yes")
Problem p02990 (python)

Fixed submission:
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1), 1)
  denom = reduce(mul, range(1, r+1), 1)
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1):
  print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)

Buggy submission (verdict: Runtime Error):
from itertools import combinations, groupby
from operator import mul
from functools import reduce

def ncr(n,r):
  r = min(r, n-r)
  if r == 0: return 1
  numer = reduce(mul, range(n, n-r, -1))
  denom = reduce(mul, range(1, r+1))
  return numer//denom

N, K = map(int,input().split())
MOD = 10**9 + 7

for k in range(1,K+1):
  print((ncr(N-K+1,k)*ncr(K-1,k-1))%MOD)
Problem p03013 (python)

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

if n == 1:
  print(1)
  exit()

f = [0 for i in range(n)]
f[-2:] = [1, 1]
for i in range(m):
  f[int(input())-1] = -1

div_num = 1000000007

for i in range(n-2)[::-1]:
  if f[i] == -1:
    continue
  if f[i+1] == -1 and f[i+2] == -1:
    print(0)
    exit()
  elif f[i+1] == -1 and f[i+2] != -1:
    f[i] = f[i+2]
  elif f[i+1] != -1 and f[i+2] == -1:
    f[i] = f[i+1]
  else:
    f[i] = f[i+1]+f[i+2]

if f[0] != -1 and f[1] != -1:
  print(int((f[0]+f[1])%div_num))
elif f[0] == -1 and f[1] != -1:
  print(int(f[1]%div_num))
elif f[0] != -1 and f[1] == -1:
  print(int(f[0]%div_num))
else:
  print(0)

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

if n == 1:
  print(1)
  exit()

f = [0 for i in range(n+1)]
f[-2:] = [1, 1]
for i in range(m):
  f[int(input())-1] = -1

div_num = 1000000007

for index in range(n-1)[::-1]:
  i = index + 1
  if f[i] == -1:
    continue
  if f[i+1] == -1 and f[i+2] == -1:
    print(0)
    exit()
  elif f[i+1] == -1 and f[i+2] != -1:
    f[i] = f[i+2]
  elif f[i+1] != -1 and f[i+2] == -1:
    f[i] = f[i+1]
  else:
    f[i] = f[i+1]+f[i+2]

print(int(f[0]%div_num))

Buggy submission (verdict: Runtime Error):
n, m  = map(int, input().split())
alist = [int(input()) for i in range(m)]
div_num = 1000000007

f = [1, 1]
for i in range(n-1)[::-1]:
  flag1 = True if i+1 not in alist else False
  flag2 = True if i+2 not in alist else False
  if flag1 is False and flag2 is False:
    print(0)
    exit()
  elif falg1 is False and flag2 is True:
    f = [f[1]] + [f[0]]
  elif flag1 is True and flag2 is False:
    f = [f[0]] + [f[0]]
  else:
    f = [f[0]+f[1]] + [f[0]]
     
print(int(f[0]%div_num))

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

def cases(idx_start, idx_end):
  cases = 0
  for r in range((idx_end - idx_start)//2+1):
    n = idx_end - idx_start - r
    cases += factorial(n) / factorial(r) / factorial(n - r)
  return cases

n, m  = map(int, input().split())
alist = [int(input()) for i in range(m)]
div_num = 1000000007

if m == 0:
  print(cases(1,n+1)%div_num)
  exit()

ans = cases(1,alist[0])
for i in range(1,m):
  if alist[i] - alist[i-1] <= 1:
    print(0)
    exit()
  ans *= cases(alist[i-1]+1, alist[i])
ans *= cases(alist[-1]+1, n+1)
print(int(ans%div_num))

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

def cases(idx_start, idx_end):
  cases = 0
  for r in range((idx_end - idx_start)//2+1):
    n = idx_end - idx_start - r
    cases += factorial(n) / factorial(r) / factorial(n - r)
  return cases

n, m  = map(int, input().split())
alist = [int(input()) for i in range(m)]
div_num = 1000000007

ans = cases(1,alist[0])
for i in range(1,m):
  if alist[i] - alist[i-1] <= 1:
    print(0)
    exit()
  ans *= cases(alist[i-1]+1, alist[i])
ans *= cases(alist[-1]+1, n+1)
print(int(ans%div_num))
Problem p03038 (python)

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num >= N: break
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]) if num != N else ans)

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
  if num >= N: break
print(ans+sum(A[num:]) if num != N else ans)

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]) if num != N else ans)

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]))
Problem p03327 (python)

Fixed submission:
[print('ABC') if int(input()) < 1000 else print('ABD')]

Buggy submission (verdict: Runtime Error):
import sys
from itertools import permutations

N,C = map(int,input().split())
D = [list(map(int,sys.stdin.readline().split())) for _ in range(C)]
grids = [list(map(int,sys.stdin.readline().split())) for _ in range(N)]

ans = float('inf')
for cmb in permutations([i for i in range(1,C+1)],3):
  tmp_ans = 0
  for j, row in enumerate(grids):
    for i, val in enumerate(row):
      if val != cmb[(i+j+2)%3]: tmp_ans += D[val-1][cmb[(i+j+2)%3]-1]
      #print(i, j, val, cmb, tmp_ans)
  ans = min(tmp_ans, ans)
  #print(ans, tmp_ans, cmb)
print(ans)
Problem p03631 (python)

Fixed submission:
N = input()
print('Yes' if N == ''.join([n for n in N[::-1]]) else 'No')

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
inf = float('inf')

def solve(graph, n, start_node, end_node):
  if start_node == end_node:
    return 0

  global costs_dict
  key = str(start_node) + '-' + str(end_node)
  if key in costs_dict:
    return costs_dict[key][end_node]

  costs = [inf for _ in range(n)]
  costs[start_node] = 0
  flgs = [False for _ in range(n)]

  while not all(flgs):
    prv_node = _get_min_idx(flgs,costs)
    flgs[prv_node] = True

    for node, dis in graph[prv_node]:
      if costs[node] > costs[prv_node] + dis:
        costs[node] = costs[prv_node] + dis
  costs_dict[key] = costs  
  return costs[end_node]
    
    
def _get_min_idx(flgs, costs):
    min_cost = inf
    min_idx = None
    cnt = 0
    for cost, flg in zip(costs, flgs):
      if min_cost > cost and flg is False:
        min_cost = cost
        min_idx = cnt
      cnt += 1
    return min_idx
        

n =int(input())
graph = defaultdict(list)
costs_dict = {}

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

q, k = map(int, input().split())
k -= 1
for _ in range(q):
  x, y = map(int, input().split())
  print( solve(graph, n, x-1, k) + solve(graph, n, k, y-1))
Problem p03986 (python)

Fixed submission:
def sol():
  ti = 0
  ans = lenX
  for i in range(lenX//2):
    while S[i]>=T[ti]:
      ti += 1
      if ti>=lenX//2:return ans
    ans -= 2    
    ti += 1
    if ti>=lenX//2:return ans
  return ans

X = input()
lenX = len(X)
S = []
T = []
for i,x in enumerate(X):
  if x == 'S':S.append(i)
  else:T.append(i)

print(sol())

Buggy submission (verdict: Runtime Error):
def sol():
  ti = 0
  ans = lenX
  for i in range(lenX//2):
    while S[i]>=T[ti]:
      ti += 1
      if ti>=lenX//2:
        return ans
    ans -= 2    
    ti += 1
  return ans

X = input()
lenX = len(X)
S = []
T = []
for i,x in enumerate(X):
  if x == 'S':S.append(i)
  else:T.append(i)

print(sol())
Problem p02627 (python)

Fixed submission:
alpha = input()
if alpha.isupper():
  output = 'A'
else:
  output = 'a'

print(output)

Buggy submission (verdict: Runtime Error):
alpha = input()
if alpha.isupper():
  output = A
else:
  output = a

print(output)

Buggy submission (verdict: Runtime Error):
alpha = input()
if alpha.isupper():
  output = A
else:
  ourput = a

print(output)
Problem p02916 (python)

Fixed submission:
N = int(input())
A = tuple(int(x) for x in input().split())
B = tuple(int(x) for x in input().split())
C = tuple(int(x) for x in input().split())

satisfy = sum(B)

for i in range(N-1):
  if A[i+1]-A[i] is 1:
    satisfy += C[A[i]-1]

print(satisfy)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = tuple(int(x) for x in input().split())
B = tuple(int(x) for x in input().split())
C = tuple(int(x) for x in input().split())

satisfy = sum(B)

for i in range(len(A)-1):
  if A[i+1]-A[i] is 1:
    satisfy += C[A[i]]

print(satisfy)
Problem p02712 (python)

Fixed submission:
m = int(input())
     
def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
      
  return (fizz > 0) & (buzz > 0)
     
res = 0
     
for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
        
print(res)

Buggy submission (verdict: Runtime Error):
    m = int(input())
     
    def fizz_buzz(i):
      fizz = i % 3
      buzz = i % 5
      
      return (fizz > 0) && (buzz > 1)
     
    res = 0
     
    for i in range(m):
      use_i = i+1
      if fizz_buzz(use_i):
        res += use_i
        
    print(res)

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

def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
  
  return (fizz > 0) && (buzz > 1)

res = 0

for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
    
print(res)
Problem p02712 (python)

Fixed submission:
N = int(input())
a = N//3
b = N//5
c = N//15

ans = (N*(N+1)//2) - (3*a*(a+1)//2) -(5*b*(b+1)//2) + (15*c*(c+1)//2)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N//3
b = N//5
c = N//15

ans = (N*(N+1)/2) - 3*a(a+1)/2 -5*b(b+1)/2 + 15*c(c+1)/2
print(int(ans))
Problem p02881 (python)

Fixed submission:
N = int(input())
count = 1+N
for i in range(1,int(N**0.5)+1):
  if N % i == 0 and i + N/i < count:
    count = i+ N/i
count = int(count)
print(count-2)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 1+N
for i in range(1,N/2 +1):
  if N % i == 0 and i + N/i < count:
    count = i+ N/i
count = int(count)
print(count-2)
Problem p02897 (python)

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

if N%2 == 0:
  print(1/2)
else:
  print(((N+1)/2)/N)

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

if N%2 = 0:
  print(1/2)
else:
  print(((N+1)/2)/N)

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

if N%2 = 0:
  print(1/2)
else:
  print(((N+1)/2)/N)
Problem p02933 (python)

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

if N < 3200:
  print("red")
else:
  print(a)

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

if a < 3200:
  print("red")
else:
  print(s)
Problem p02959 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
count =0
for i in range(N):
  if A[i] >= B[i]  and A[i] >= 0:
    count += B[i]
    A[i] = A[i] - B[i]
  elif A[i] < B[i] and A[i] >= 0:
    if A[i+1]-B[i]+A[i] > 0:
      count += B[i]
    else:
      count += A[i] +A[i+1]
    A[i+1] -=  B[i] - A[i]
    A[i] = -1
  elif A[i] < 0:
    if A[i+1] >= B[i]:
      count += B[i]
      A[i+1] = A[i+1]- B[i]
    else:
      count += A[i+1]
      A[i+1] -= B[i]
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
count =0
X = A[-1]
for i in range(N):
  if A[i] >= B[i]  and A[i] >= 0:
    count += B[i]
  elif A[i] < B[i] and A[i] >= 0:
    A[i+1] = A[i+1] - (B[i] - A[i])
    count += A[i]
if A[-1] >= 0:
  count += X - A[N+1]
else:
  count += X
print(count)
Problem p02987 (python)

Fixed submission:
N = input()
S = sorted(N)
flag = True
if S[0] != S[1]:
  flag = False
if S[2] != S[3]:
  flag = False
if S[1] == S[2]:
  flag = False
if flag == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
S.sort()
flag = True
if S[0] != S[1]:
  flag = False
if S[2] != S[3]:
  flag = False
if flag == True:
  print("YES")
else:
  print("NO")
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int,input().split()))
d.sort()
ans = d[int((N/2))]-d[int(N/2)-1]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
d.sort()
ans = d[(N/2)+1]-d[N/2]
Problem p02729 (python)

Fixed submission:
import functools

@functools.lru_cache(maxsize=None)
def factorial(N):
    if N == 0:
        return 1
    if N == 1:
        return 1
    else:
        return N * factorial(N - 1)


def c(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(r) * factorial(n-r))


N, M = [int(x) for x in input().split()]

print(
    c(N, 2) + c(M, 2)
)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from EmurateInput import input
import functools

@functools.lru_cache(maxsize=None)
def factorial(N):
    if N == 0:
        return 1
    if N == 1:
        return 1
    else:
        return N * factorial(N - 1)


def c(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(r) * factorial(n-r))


N, M = [int(x) for x in input().split()]

print(
    c(N, 2) + c(M, 2)
)
Problem p02897 (python)

Fixed submission:
N = int(input())

print("{0:.10f}".format((N // 2 + N % 2) / N))

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

print((N // 2 + N % 2) / )N
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s > w:
    print("safe")
else:
    print("unsafe")

Buggy submission (verdict: Runtime Error):
s = input()
for v in range(6,101):
    ans += s.count(str(v*2019))
print(str(ans))
Problem p02729 (python)

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(ans)))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(ans))
Problem p02695 (python)

Fixed submission:
import itertools
N,M,Q=map(int,input().split())
L=[]
for q in range(Q):
    L.append(list(map(int,input().split())))

A = itertools.combinations_with_replacement([q for q in range(1,(M+1))], N)
count=[]
for a in A:
    tmp=0
    for l in L:
        
        if a[l[1]-1] - a[l[0]-1] == l[2]:
            tmp+=l[3]
    count.append(tmp)

print(max(count))

Buggy submission (verdict: Runtime Error):
import itertools
N,M,Q=map(int,input().split())
L=[]
for q in range(Q):
    L.append(list(map(int,input().split())))

A = itertools.combinations([q for q in range(1,(M+1))], N)
count=[]
for a in A:
    tmp=0
    for l in L:
        if a[l[1]-1] - a[l[0]-1] == l[2]:
            tmp+=l[3]
        else:
            pass
    count.append(tmp)

print(max(count))

Buggy submission (verdict: Runtime Error):
import itertools
N,M,Q=map(int,input().split())
L=[]
for q in range(Q):
    L.append(list(map(int,input().split())))

A = itertools.combinations([q for q in range(1,(M+1))], N)
# print(L)
# print(A)
count=[]
for a in A:
    tmp=[]
    for l in L:
        try:
            if a[l[1]-1] - a[l[0]-1] == l[2]:
                tmp.append(l[3])
            else:
                pass
        except:
            pass
    # print(tmp)
    count.append(sum(tmp))

# print(count)

print(max(count))

Buggy submission (verdict: Runtime Error):
import itertools
N,M,Q=map(int,input().split())
L=[]
for q in range(Q):
    L.append(list(map(int,input().split())))

A = list(itertools.combinations([q for q in range(1,(M+1))], N))
# print(L)
# print(A)
count=[]
for a in A:
    # tmp=0
    tmp=[]
    for l in L:
        if a[l[1]-1] - a[l[0]-1] == l[2]:
            tmp.append(l[3])
        else:
            pass
    # print(tmp)
    count.append(sum(tmp))

# print(count)

print(max(count))
Problem p02725 (python)

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

max = K-A[-1]+A[0]
for i in range(N-1):
    if max < A[i+1]-A[i]:
        max = A[i+1]-A[i]

print(K-max)

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

max = K-A[-1]+A[0]
for i in range(N-1):
    if last < A[i+1]-A[i]:
        max = A[i+1]-A[i]

print(K-max)
Problem p02819 (python)

Fixed submission:
import math

X=int(input())

def isprime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    m = int(math.sqrt(n)) +1
    for p in range(3, m, 2): 
        if n % p == 0:
            return False
    return True

def nextprime(n):
    if n < 2:
        return 2
    if n < 7:
        return {2: 3, 3: 5, 4: 5, 5: 7, 6: 7}[n]
    nn = 6*(n//6)
    if nn == n:
        n += 1
        if isprime(n):
            return n
        n += 4
    elif n - nn == 5:
        n += 2
        if isprime(n):
            return n
        n += 4
    else:
        n = nn + 5
    while 1:
        if isprime(n):
            return n
        n += 2
        if isprime(n):
            return n
        n += 4

print(X if isprime(X) else nextprime(X))

Buggy submission (verdict: Runtime Error):
from sympy import nextprime,isprime
X=int(input())
print(X if isprime(X) else nextprime(X))

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
X=int(input())
print(nextprime(X))
Problem p02766 (python)

Fixed submission:
import math

def finddigit(n, b):
    dig = (math.floor(math.log(n)/math.log(b))+1)
    print(dig)

n,b = map(int,input().split())
finddigit(n,b)

Buggy submission (verdict: Runtime Error):
import math

def finddigit(n, b):
    dig = (math.floor(math.log(n)/math.log(b))+1)
    print(dig)

finddigit(n,b)
Problem p02773 (python)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
Problem p02777 (python)

Fixed submission:
S, T = input().split()
A ,B = input().split()
U = str(input())
if(U == S):
   A = int(A) - 1
elif(U==T):
    B = int(B) -1
print(A,B)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
n1, n2 = int(input()).split()
i = input()
if(i==s):
  return n1=n1-1
elif(i==t)
  return n2=n2-1
print(n1,n2)
Problem p02847 (python)

Fixed submission:
s=input()
if s == 'SUN':
  print(7)
if s == 'MON':
  print(6)
if s == 'TUE':
  print(5)
if s == 'WED':
  print(4)
if s == 'THU':
  print(3)
if s == 'FRI':
  print(2)
if s == 'SAT':
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
if s is 'SUN':
  print(7)
if s is 'MON:
  print(6)
if s is 'TUE':
  print(5)
if s is 'WED:
  print(4)
if s is 'THU':
  print(3)
if s is 'FRI:
  print(2)
if s is 'SAT':
  print(1)
Problem p02933 (python)

Fixed submission:
n = int(input())
s = input()
print('red' if n < 3200 else s)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
print('red' if a < 3200 else s)
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(max(0,c-(a-b))
Problem p03041 (python)

Fixed submission:
n, a = list(map(int, input().split()))
s = input()
print(s[:a - 1] + s[a - 1].lower() + s[a:])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s[k - 1] = s[k - 1].lower()
print(s)
Problem p03107 (python)

Fixed submission:
s = input()
print(min(s.count('1'), s.count('0'))*2)

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

class UnionFind:
  def __init__(self, n):
    self.par = [-1 for _ in range(n)]
  def root(self, x):
    return x if self.par[x] < 0 else self.root(self.par[x])
  def unite(self, x, y):
    x, y = self.root(x), self.root(y)
    if x != y:
      if self.par[y] < self.par[x]:
        x, y = y, x
      self.par[x] += self.par[y]
      self.par[y] = x
    return x != y
  def find(self, x, y):
    return self.root(x) == self.root(y)
  def size(self, x):
    return -self.par[self.root(x)]

n, m = map(int, input().split())
tree = UnionFind(n)
b = []
for _ in range(m):
  a, c = map(int, input().split())
  b.append([a - 1, c - 1])
b.reverse()
ans = [sum(range(n))]
for i, p in enumerate(b):
  if not tree.find(p[0], p[1]):
    ans.append(ans[-1] - tree.size(p[0])*tree.size(p[1]))
    tree.unite(p[0], p[1])
  elif i != m - 1:
    ans.append(ans[-1])
for i in reversed(ans):
  print(i)

Buggy submission (verdict: Runtime Error):
s = input()
print(min(s.count(1), s.count(0))*2)
Problem p03317 (python)

Fixed submission:
[print(int((n[0] - 2) / (n[1] - 1) + 1)) for n in [list(map(int, input().split()))]]

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

Fixed submission:
if input().isupper():
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
if input().issuper():
  print("a")
else:
  print("a")
Problem p02771 (python)

Fixed submission:
n = list(map(int,input().split()))
a = 0
for i in (1,2):
    if n[0] == n[i]:
        a += 1
if a == 1:
    ans = "Yes"
elif a == 2 or n[1] != n[2]:
    ans = "No"
else:
    ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
n = list(map(int,input().split()))
a = 0
for i in (1,2):
    if n[0] == n[i]:
        a += 1
if a == 1:
    ans = "Yes"
elif a == 2 or n[1] != n[2]:
    ans = "No"
print(ans)
Problem p02880 (python)

Fixed submission:
n = int(input())
ans = "No"
for i in range(1,10):
    if n % i == 0 and n // i < 10 :
        ans = "Yes"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(2,10):
    if n % i = 0 and n // i < 10 :
        ans = "Yes"
        break()
print(ans)