Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8

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

count = 0
for i, a in enumerate(A):
    for offset in range(N - i):
        if (a + A[i + offset]) == offset:
            count += 1
print(count)


Fixed submission:
#coding: utf-8

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

L = {}
for i, a in enumerate(A):
    k = i + a
    if k not in L:
        L[k] = 1
    else:
        L[k] += 1

count = 0
for j, a in enumerate(A):
    k = j - a
    if k in L:
        count += L[k]
print(count)
Buggy python submission (verdict: Runtime Error):
i=int(intput())
print(i*i)


Fixed submission:
i=int(input())
print(i*i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
A = 0


for i in range(N):
  s = input()
  if s in S:
    pass
  else:
    S.append(s)
    A += 1

print(A)

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



for i in range(N):
  S.add(input())


print(len(S))
Buggy python submission (verdict: Runtime Error):
S = list(input())
flag = True

if len(S) % 2 == 0:
  for i in range(0, len(S), 2):
  if S[i] == 'h' and S[i + 1] == 'i':
    pass
  else:
    flag = not flag
    break
else:
  flag = not flag

if flag:
  print("Yes")
else:
  print("No")

Fixed submission:
S = list(input())
flag = True

if len(S) % 2 == 0:
  for i in range(0, len(S), 2):
    if S[i] == 'h' and S[i + 1] == 'i':
      pass
    else:
      flag = not flag
      break
else:
  flag = not flag

if flag:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S = list(input())
flag = True


for i in range(0, len(S), 2):
  if S[i] == 'h' and S[i + 1] == 'i':
    pass
  else:
    flag = not flag
    break

if flag:
  print("Yes")
else:
  print("No")

Fixed submission:
S = list(input())
flag = True

if len(S) % 2 == 0:
  for i in range(0, len(S), 2):
    if S[i] == 'h' and S[i + 1] == 'i':
      pass
    else:
      flag = not flag
      break
else:
  flag = not flag

if flag:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

min_cost = min(a) + min(b)

for i in range(M):
  x = list(map(int,input().split()))
  cost = a[x[0]] + b[x[1]] - x[2]

  if min_cost > cost:
    min_cost = cost

print(min_cost)

Fixed submission:
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

min_cost = min(a) + min(b)

for i in range(M):
  x = list(map(int,input().split()))
  cost = a[x[0] - 1] + b[x[1] - 1] - x[2]

  if min_cost > cost:
    min_cost = cost

print(min_cost)
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Q = int(input())
R = True

for i in range(Q):
  q = list(input().split())
  if int(q[0]) == 1:
    R = not R
  else:
    if int(q[1]) == 1:
      if R:
        S.insert(0, q[2])
        
      else:
        S.append(q[2])
    else:
      if R:
        S.append(q[2])
      else:
        S.insert(0, q[2])

if R:
  print(''.join(S))
else:
  print(''.join(S[::-1]))

Fixed submission:
S = list(input())
S_r = []
Q = int(input())
R = True

for i in range(Q):
  q = list(input().split())
  if int(q[0]) == 1:
    R = not R
  else:
    if int(q[1]) == 1:
      if R:
        S_r.append(q[2])
      else:
        S.append(q[2])
    else:
      if R:
        S.append(q[2])
      else:
        S_r.append(q[2])

if not S_r:
  if R:
    print(''.join(S))
  else:
    print(''.join(S[::-1]))
else:
  if R:
    print(''.join(S_r[::-1]), end="")
    print(''.join(S))
  else:
    print(''.join(S[::-1]), end="")
    print(''.join(S_r))

Buggy python submission (verdict: Runtime Error):
S = list(input())
Q = int(input())
S_r = []
S_l = []

n = 0

for i in range(Q):
  q = list(input().split())
  if int(q[0]) == 1:
    n += 1
  else:
      if int(q[1]) == 1:
        S_l.append(q[2])
        S_r = S
        n += 1
        break
      else:
        S_r.append(q[2])
        S_l = S
        n += 1
        break

  if i == Q-1:
    if not S_r and not S_l
      print(''.join(S))
    elif not S_r
      print(''.join(S_l[::-1]), end="")
      print(''.join(S))
    elif not S_l
      print(''.join(S), end="")
      print(''.join(S_r))

for i in range(Q - n):
  q = list(input().split())
  if int(q[0]) == 1:
    temp = S_r[-1]
    S_r[-1] = S_l[-1]
    S_l[-1] = temp
  else:
    if int(q[1]) == 1:
      S_l.append(q[2])
    else:
      S_r.append(q[2])

print(''.join(S_l[::-1]), end="")
print(''.join(S_r))

Fixed submission:
S = list(input())
S_r = []
Q = int(input())
R = True

for i in range(Q):
  q = list(input().split())
  if int(q[0]) == 1:
    R = not R
  else:
    if int(q[1]) == 1:
      if R:
        S_r.append(q[2])
      else:
        S.append(q[2])
    else:
      if R:
        S.append(q[2])
      else:
        S_r.append(q[2])

if not S_r:
  if R:
    print(''.join(S))
  else:
    print(''.join(S[::-1]))
else:
  if R:
    print(''.join(S_r[::-1]), end="")
    print(''.join(S))
  else:
    print(''.join(S[::-1]), end="")
    print(''.join(S_r))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n, a, b = s.split()
n, a, b =  int(n), int(a), int(b)


a0 = 1
a1 = 1 
for i in range(1, a+1):
  a0 = a0 * (n - i + 1) % 1000000007
  a1 = a1 * i % 1000000007

b0 = 1
b1 = 1 
for i in range(1, b+1):
  b0 = b0 * (n - i + 1) % 1000000007
  b1 = b1 * i % 1000000007

A = (pow(2, n) - 1 - a0 * pow(a1, 1000000005) - b0 * pow(b1, 1000000005)) % 1000000007

def pow(x, n):
    ans = 1
    while n:
        if n % 2:
            ans = ans * x % 1000000007
        x *= x % 1000000007
        n >>= 1
    return ans % 1000000007

print(A)

Fixed submission:
def pow(x, n):
    ans = 1
    while n:
        if n % 2:
            ans = ans * x % 1000000007
        x *= x % 1000000007
        n >>= 1
    return ans % 1000000007

s = input()
n, a, b = s.split()
n, a, b =  int(n), int(a), int(b)


a0 = 1
a1 = 1 
for i in range(1, a+1):
  a0 = a0 * (n - i + 1) % 1000000007
  a1 = a1 * i % 1000000007

b0 = 1
b1 = 1 
for i in range(1, b+1):
  b0 = b0 * (n - i + 1) % 1000000007
  b1 = b1 * i % 1000000007

A = (pow(2, n) - 1 - a0 * pow(a1, 1000000005) - b0 * pow(b1, 1000000005)) % 1000000007

print(A)
Buggy python submission (verdict: Runtime Error):
s = input()
print(a)

Fixed submission:
a = input()
if a == 'ABC':
  print('ARC')
else:
  print('ABC')
Buggy python submission (verdict: Runtime Error):
import sys
N, M = map(int, sys.stdin.readline().rstrip().split())
h_i = [int(x) for x in sys.stdin.readline().rstrip().split()]
ab = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(M)]

J = [1 for i in range(N)]
for li in ab:
  if h_i[li[0]] < h_i[li[1]]:
    J[li[0]] = 0
  elif h_i[li[0]] == h_i[li[1]]:
    J[li[0]] = J[li[1]] = 0
  else:
    J[li[1]] = 0
print(J)

Fixed submission:
import sys
N, M = map(int, sys.stdin.readline().rstrip().split())
h_i = [int(x) for x in sys.stdin.readline().rstrip().split()]
ab = [list(map(int, sys.stdin.readline().rstrip().split())) for _ in range(M)]
 
J = [1 for i in range(N)]
#print(ab,J)

for li in ab:
  #print(li)
  if h_i[li[0]-1] < h_i[li[1]-1]:
    J[li[0]-1] = 0
  elif h_i[li[0]-1] == h_i[li[1]-1]:
    J[li[0]-1] = J[li[1]-1] = 0
  else:
    J[li[1]-1] = 0
print(J.count(1))
Buggy python submission (verdict: Runtime Error):
import sys
N = int(sys.stdin.readline())
list = []
for i in range(N):
  S = sys.stdin.readline()
  if S not in list:
    list.append(S)
print(len(list))

Fixed submission:
S, W = map(int, input().split())
print('safe' if S > W else 'unsafe')
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
As = list(map(int, input().split()))
for i in range(1,N):
    print(As.count(i))
print(0)

Fixed submission:
# -*- coding: utf-8 -*-
from collections import Counter
N = int(input())
As = list(map(int, input().split()))
c = Counter(As)
for i in range(1,N):
    print(c[i])
print(0)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
  
if A*B%2 == 0:
    print("Even")
else:
  pritn("False")

Fixed submission:
a, b = map(int, input().split())
if (a*b)%2 ==0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
# python3

#===============================================================================
from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()
##==============================================================================


def solve(X):
    B = 0
    while True:
        x1 = X + (B) ** 5
        A = int(x1 ** (1/5.0))
        if A ** 5 == x1:
            return str(A) + " " + str(B)
        x2 = X + (-B) ** 5
        A = int(x1 ** (1/5.0))
        if A ** 5 == x2:
            return str(A) + " " + str(-B)
        B += 1


if __name__ == '__main__':
    X = iint()
    print(solve(X))


Fixed submission:
# python3

#===============================================================================
from collections import defaultdict, Counter
from functools import lru_cache
from heapq import heappush, heappop
from math import gcd, floor, ceil
from sys import stdin, stdout

def ilist():
    return [int(x) for x in stdin.readline().strip().split(" ")]
def iint():
    return int(stdin.readline().strip())
def istr():
    return stdin.readline().strip()
##==============================================================================


def solve(X):
    c = {}
    for i in range(1000):
        c[i] = i ** 5
        c[-i] = -c[i]
    for i in c:
        for j in c:
            if c[i] - c[j] == X:
                return str(i) + " " + str(j)


if __name__ == '__main__':
    X = iint()
    print(solve(X))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = []
for _ in range(N):
    k.append(input())
    x = set(k)
print (len(x))

Fixed submission:
N = int(input())
k = set()
for _ in range(N):
    k.add(input())
print (len(k))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = []
x = []
for i in range(0, N):
    a = input()
    k.append(a)
for i in k:
    if i not in x:
        x.append(i)
print (len(x))

Fixed submission:
N = int(input())
k = set()
for _ in range(N):
    k.add(input())
print (len(k))

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)
k = []
x = []
for i in range(0, N):
    a = input()
    k.append(a)
for i in k:
    if i not in x:
        x.append(i)
print (len(x))

Fixed submission:
N = int(input())
k = set()
for _ in range(N):
    k.add(input())
print (len(k))

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)
k =[]
x = []
for i in range(0,N):
    a = input()
    k.append(a)
for j in k:
    if j not in x:
        x.append(j)
m = len(x)
print (m)

Fixed submission:
N = int(input())
k = set()
for _ in range(N):
    k.add(input())
print (len(k))

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)
k =[]
x = []
for i in range(0,N):
    a = input()
    k.append(a)
for j in k:
    if j not in x:
        x.append(j)
m = len(x)
print (m)

Fixed submission:
N = int(input())
k = set()
for _ in range(N):
    k.add(input())
print (len(k))
Buggy python submission (verdict: Runtime Error):
N = 7
if N > = 100 and N <=999:
  print (Yes)
else:
  print (No)
    

Fixed submission:
N = eval(input())
a = str(N)
k=[]
for i in a:
    if i == "7":
        k.append(i)
if len(k) > 0:
    print ("Yes")
else:
    print ("No")
Buggy python submission (verdict: Runtime Error):
from itertools import product
N = (input())
d = 0
res = [ele for ele in product(range(1,N+1),repeat=3)]
a =(res)
for i in a:
    if i[0]==i[1]==i[2]:
        d = d+i[0]
    else:
        d = d+1
print(d)


Fixed submission:
import math
a = int(input())
b = 0
for i in range(1,a+1):
    for j in range(1,a+1):
        c = math.gcd(i,j)
        for k in range(1,a+1):
            d = math.gcd(c,k)
            b +=d
print (b)

Buggy python submission (verdict: Runtime Error):
import itertools
def all_passwords(chars,length):
    b = []
    c= 0
    for i in itertools.product(int(chars), repeat=length):
        a = ''.join(i)
        b.append(a)
    return b
print (all_passwords(12,2))


Fixed submission:
import math
a = int(input())
b = 0
for i in range(1,a+1):
    for j in range(1,a+1):
        c = math.gcd(i,j)
        for k in range(1,a+1):
            d = math.gcd(c,k)
            b +=d
print (b)
Buggy python submission (verdict: Runtime Error):
a = input()
if a[2] ==a[3]:
    print ("Yes")
else:
    print ("No")

Fixed submission:
a = input()
if a[2] ==a[3] and a[4]==a[5]:
    print ("Yes")
else:
    print ("No")
Buggy python submission (verdict: Runtime Error):
K, N = list(map(int, input().split()))
an = list(map(int,input().split()))

min_list = []
for i in range(N):
    if i == 0:
        left = an[i] + K - an[-1]
        right = an[i+1] - an[i]
    elif i == N-1:
        left = an[i] - an[i-1]
        right = an[0] + K - an[N-1]
    else:
        left = an[i] - an[i-1]
        right = an[i+1] - an[i]
    min_list.append(min(K-left, K-right))
print(min(n_list))

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

min_list = []
for i in range(N):
    if i == 0:
        left = an[i] + K - an[-1]
        right = an[i+1] - an[i]
    elif i == N-1:
        left = an[i] - an[i-1]
        right = an[0] + K - an[N-1]
    else:
        left = an[i] - an[i-1]
        right = an[i+1] - an[i]
    min_list.append(min(K-left, K-right))
print(min(min_list))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
dp = [[0, 0, 0] for _ in range(N+3)]

for i, x in enumerate(a, start=3):
    dp[i][2] = max(dp[i-2][0], x+dp[i-2][2], x+dp[i-3][1])
    dp[i][1] = max(x+dp[i-2][1], x+dp[i-3][0])
    dp[i][0] = x + dp[i-2][0]

if N & 1 == 0:
    print(max(
        dp[N+2][0],
        dp[N+2][1],
        dp[N+1][0]
    ))
else:
    print(max(
        dp[N+2][1],
        dp[N+2][2],
        dp[N+1][0],
        dp[N+1][1]
    ))


Fixed submission:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from math import sqrt

def prime_division(x):
    q = int(sqrt(x))
    a = []
    for i in range(2,q+1):
        ex = 0
        while x%i == 0:
            ex += 1
            x //= i
        if ex>0:
            a.append([i,ex])
    if x>q:
        a.append([x,1])
    return a

def divisorlist(z): # z : output of prime_division
    #ddprint(f"dvl {z}")
    if len(z)==1:
        return [z[0][0]**i for i in range(z[0][1]+1)]
    y = divisorlist(z[1:])
    s = []
    for i in range(z[0][1]+1):
        for j in y:
            s.append((z[0][0]**i)*j)
    return s

n,k = inm()
d = [0]*(k+1)
d[1] = pow(k,n,R)
sm = 0
for i in range(k,1,-1):
    d[i] = (d[i]+pow(k//i,n,R))
    ps = divisorlist(prime_division(i))
    for p in ps:
        if p!=i:
            d[p] = (d[p]-d[i])%R
    sm = (sm+d[i]*i)%R
#ddprint(d)
print((sm+d[1])%R)
Buggy python submission (verdict: Runtime Error):
s = input()
# print(s[2:len(s)])
l = len(s)
count = 0


# for i, j in itertools.combinations(range(len(s)+1), 2):
#     if(int(s[i:j]) % 2019 == 0):
#         count = count + 1
#
# print(count)

for i in range(2019):
    count2 = 0
    for j in range(l):
        if int(s[j:l]) % 2019 == i:
            count2 = count2 + 1
    count = count + (count2 * (count2 - 1)) / 2
print(int(count))

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

Buggy python submission (verdict: Runtime Error):
s = input()
count = 0

for i in range(len(s)):
    for j in range(len(s) - i):
        if int(s[i:i+j+1]) % 2019 == 0:
            count = count + 1

print(count)

Fixed submission:
s, w = map(int, input().split())
if s > w:
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
#%%
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(A[K - 1])

#%%
from decimal import *
getcontext().prec = 20

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

sqrt_ab = Decimal(a).sqrt() + Decimal(b).sqrt()
sqrt_c = Decimal(c).sqrt()

if sqrt_ab < sqrt_c:
    print('Yes')
else:
    print('No')


Fixed submission:
from decimal import *
getcontext().prec = 20

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

sqrt_ab = Decimal(a).sqrt() + Decimal(b).sqrt()
sqrt_c = Decimal(c).sqrt()

if sqrt_ab < sqrt_c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = input()
X = list( map(int, input().split()))
X.sort()

min_a = X[0]
max_a = X[-1]
mid = (min + max) // 2

sum_min = 0
sum_max = 0
    
def calc(x, min, max):
    mid = (min + max) // 2
    sum_min = 0
    sum_max = 0
    for value in x:
        sum_min += (value - min) ** 2
        sum_max += (value - max) ** 2
    
    if abs(min - max) <= 1:
        if sum_min < sum_max:
            return int(sum_min)
        else:
            return int(sum_max)
    elif sum_min < sum_max:
        return calc(x, min, mid)
    else:
        return calc(x, mid, max)
    
    return -1
    
ans = calc(X, min_a, max_a)
print(ans)

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

min_a = X[0]
max_a = X[-1]

sum_min = 0
sum_max = 0
    
def calc(x, min, max):
    mid = (min + max) // 2
    sum_min = 0
    sum_max = 0
    for value in x:
        sum_min += (value - min) ** 2
        sum_max += (value - max) ** 2
    
    if abs(min - max) <= 1:
        if sum_min < sum_max:
            return int(sum_min)
        else:
            return int(sum_max)
    elif sum_min < sum_max:
        return calc(x, min, mid)
    else:
        return calc(x, mid, max)
    
    return -1
    
ans = calc(X, min_a, max_a)
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
if (H*W)%2==0:
    B=int((H*W)/2)
    print (B)
else:
    if (H+W)%2==0:
        C=int((H*W+1)/2)
        print (C)
    else:
        D=int((H*W-1)/2)
        print(D)



Fixed submission:
K=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])

Buggy python submission (verdict: Runtime Error):
[H,W]=map(int,input().split())
if (H*W)%2==0:
    B=int((H*W)/2)
    print (B)
else:
    if (H+W)%2==0:
        C=int((H*W+1)/2)
        print (C)
    else:
        D=int((H*W-1)/2)
        print(D)


Fixed submission:
K=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])

Buggy python submission (verdict: Runtime Error):
[H,W]=map(int,input().split())
if (H*W)%2==0:
    print (int((H*W)/2))
else:
    if (H+W)%2==0:
        print (int((H*W+1)/2))
    else:
        print(int((H*W-1)/2))

Fixed submission:
K=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])

Buggy python submission (verdict: Runtime Error):
[H,W]=map(int,input().split())
if (H*W)%2==0:
    print (int((H*W)/2))
else:
    if (H+W)%2==0:
        print (int((H*W+1)/2))
    else:
        print(int((H*W-1)/2))

Fixed submission:
K=int(input())
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])
Buggy python submission (verdict: Runtime Error):
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 or num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

Fixed submission:
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 and num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

Fixed submission:
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 and num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

Fixed submission:
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 and num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
initInput = input()
tmpList = initInput.split()
inputN = int(tmpList[0])
inputA = int(tmpList[1])
inputB = int(tmpList[2])
arrayList = []
num = 0
arrayNum = 0
blueballNum = 0
while len(arrayList)  < inputN:
    if num % 2 == 0:
        for a in range(inputA):
            arrayList = arrayList +  ['a']
            arrayNum = arrayNum + 1
            blueballNum = blueballNum + 1
    else:
        for b in range(inputB):
            arrayList = arrayList +  ['b']
            arrayNum = arrayNum + 1

    num += 1

blueballNum = blueballNum - (len(arrayList) - inputN)
    
print(blueballNum)

Fixed submission:
strStation = input()

if strStation == 'AAA' or strStation == 'BBB':
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
print('unsafe') if int(input()) <= int(input()) else print('safe')

Fixed submission:
S, W = input().split(' ')
print('unsafe') if int(S) <= int(W) else print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
member, start, round = list(map(int, input().split()))
answer = []
counter = []
for i in range(round):
    answer.append(int(input()))

for i in range(1, member+1):
    counter.append(answer.count(i))

for i in range(member):
    if (start - (round - counter[i])) <= 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
member, start, round = list(map(int, input().split()))
answer = [0] * (member+1)
for i in range(round):
    answer[int(input())] += 1
for i in range(member):
    if start - (round - answer[i+1]) <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
a=int(input())

print(a*π)

Fixed submission:
a=int(input())

print(a*2*3.14)
Buggy python submission (verdict: Runtime Error):
S = input()
if(S="ABC"):
    print("ARC")
else:
    print("ABC")

Fixed submission:
S = input()
if(S=="ABC"):
    print("ARC")
else:
    print("ABC")