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

Fixed submission:
def readInts():
  return list(map(int, input().split()))

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    cnt +=1
    
if cnt >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def readInts():
  return list(map(int, input(), split()))

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    cnt +=1
    
if cnt >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def readInts():
  return list(map(int, input(), split()))

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    cnt +=1
    
if cnt >= m: print("Yes")
  else: print("No")
Problem p02909 (python)

Fixed submission:
s=input()
 
list=["Sunny","Cloudy","Rainy"]
print(list[(list.index(s)+1)%3])

Buggy submission (verdict: Runtime Error):
s=input()
if s=="Rainy":
    print("Sunny")
 
list=["Sunny","Cloudy","Rainy"]
print(list[list.index(s)+1])
Problem p03325 (python)

Fixed submission:
import sys
n = int(input())
a = input().split(' ')
for i in range(len(a)):
	a[i] = int(a[i])
res = 0
for x in a :
	while (x % 2 == 0) :
		res += 1
		x /= 2
print (res)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
a = [*map(int,input().split())]
res = 0
for x in a :
	while (x % 2 == 0) :
		res += 1
		x /= 2
print (res)
Problem p02717 (python)

Fixed submission:
x, y, z = map(str, input().split())
print(z + " " + x + " " + y)

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

print(li[2] + " " + li[0] + " " + li[1])

Buggy submission (verdict: Runtime Error):
1 2 3

li = input().split()

print(li[3] + " " + li[2] + " " + li[1])
Problem p03470 (python)

Fixed submission:
N = input()
d = [input() for i in range(int(N))]
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
N = input()
d = [input() for i in range(N)]
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
N = input()
d = [input() for i in range(N)]
print(len(set(d)) - 1)

Buggy submission (verdict: Runtime Error):
N = input()
d = [input() for i in range(int(N))]
print(len(set(d))

Buggy submission (verdict: Runtime Error):
N = input()
d = [input() for i in range(N)]
print(len(set(d))
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
 
ans = min(n % k, abs(n % k - k))
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
A=list(map(int,input().split()))
 
S=sum(A)
ans=0
for i in range(a):
    if A[i]>=S/(4*b):
        ans+=1
if ans>=b:
    print('Yes')
else:
    print('No')
Problem p02921 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=0
c=1
while c<b:
    c-=1
    c+=a
    ans+=1
print(ans)
Problem p03377 (python)

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
low = 0
high  = 0
 
for i in input().split():
    if int(i) < c:
        low += 1
    else:
        high += 1
 
print(min(low, high))
Problem p03433 (python)

Fixed submission:
N = int(input())
a = int(input())
if (N % 500) <= a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
a.sort(reverse=True)

ans=0
for i in range(N):
    if i % 2 ==0:
        ans += a[i]
    else:
        ans -= a[i]
print(ans)
Problem p03737 (python)

Fixed submission:
a = input().split()
out = ""
for s in a:
  out += s[0].upper()
print(out)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
    print("GREATER")
elif a<b:
    print("LESS")
else:
    print("EQUAL")
Problem p02802 (python)

Fixed submission:
import sys
from collections import defaultdict

n, m = map(int, input().split())
ac = 0
wa = defaultdict(lambda: 0)
already = set()
for line in sys.stdin:
    y, z = line.strip().split()
    y = int(y)
    if y in already:
        continue
    if z == 'AC':
        ac += 1
        already.add(y)
    else:
        wa[y] += 1
    
print(ac, sum(wa[i] for i in already))

Buggy submission (verdict: Runtime Error):

 
penaltyCount = dict()
penaltyCount = defaultdict(lambda: 0, penaltyCount)
 
correct = 0
penalty = 0
 
for i in range(m):
    submission = input.split()
    p = int(submission[0]) - 1
    status = submission[1]
Problem p02811 (python)

Fixed submission:
i,j=map(int,input().split())
if i*500>=j:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
i(j)=map(int,input().split())
if i*500>=j:
    print("Yes")
else:
    print("No")
Problem p02812 (python)

Fixed submission:
i = int(input())
j = input()
    
print(j.count('ABC'))

Buggy submission (verdict: Runtime Error):
i = int(input())
j = input()
    
print(count('ABC'))
Problem p02813 (python)

Fixed submission:
N=int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
from itertools import permutations
L=list(permutations(list(range(1,N+1))))
print(abs(L.index(P)-L.index(Q)))

Buggy submission (verdict: Runtime Error):
    N=int(input())
    P=tuple(map(int,input().split()))
    Q=tuple(map(int,input().split()))
     
    from itertools import permutations
     
    L=list(permutations(list(range(1,N+1))))
     
    print(abs(L.index(P)-L.index(Q)))
Problem p02817 (python)

Fixed submission:
s = str(input()).split(" ")
print(s[1] + s[0])

Buggy submission (verdict: Runtime Error):
str = input(.split(' '))

print(str[1]+str[0])
Problem p02837 (python)

Fixed submission:
n = int(input())

times = n
table = []
for _ in range(times):
    a = int(input())
    temp = []
    for _ in range(a):
        x , y = map(int,input().split())
        temp.append([x-1,y])
    table.append(temp)  


def check(i,n):
    flg = True
    for j in range(n):
        if i>>j & 1:
            for x,y in table[j]:
                if (i>>x)&1 != y:
                    flg = False
                    return flg
    return flg
ans = 0
for i in range(2**n):
    if check(i,n):
        ans = max(bin(i).count("1"),ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
test_list = [[[int(i) for i in input().split()] for j in range(int(input()))] for k in range(n)]
    
man_list = [[int(j) for j in bin(i)[2:].zfill(n)] for i in range(2**n)]
    
ans = 0
bad = 0
    
for man in man_list:
    for j in range(n):
        if man[j] == 1:
            for k in test_list[j]:
            x = k[0] - 1
            y = k[1]
            if man[x] != y:
                bad = 1
                break
    if bad == 1:
        bad = 0
        break
    else:
        ans = max(ans, sum(man))
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
test_list = [[[int(i) for i in input().split()] for j in range(int(input()))] for k in range(n)]
    
man_list = [[int(j) for j in bin(i)[2:].zfill(n)] for i in range(2**n)]
    
ans = 0
bad = 0
    
for man in man_list:
    for j in range(n):
        if man[j] == 1:
            for k in test_list[j]:
            x = k[0] - 1
            y = k[1]
            if man[x] != y:
                bad = 1
                break
        if bad == 1:
            bad = 0
            break
        else:
            ans = max(ans, sum(man))
    
print(ans)
Problem p02946 (python)

Fixed submission:
import io

nim,mike=map(int,input().split())
for i in range(mike-nim+1,mike+nim):
    print(i)

Buggy submission (verdict: Runtime Error):
import io

nim,mike=map(int,input().split())
for i in range(mike-nim+1,b+nim):
    print(i)
Problem p02993 (python)

Fixed submission:
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
import io
import math
# libraries

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

if m<=0<=m+n-1:
  print(sum(range(m,m+n)))

  elif m<0:
  print(sum(range(m,m+n-1)))

  else:
  print(sum(range(m+1,m+n)))
Problem p02994 (python)

Fixed submission:
nim, lima = map(int, input().split())
if lima<=0<=lima+nim-1:
    print(sum(range(lima,lima+nim)))
elif lima<0:
    print(sum(range(lima,lima+nim-1)))
else:
    print(sum(range(lima+1,lima+nim)))

Buggy submission (verdict: Runtime Error):
import io
import math
# libraries

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

if m<=0<=m+n-1:
  print(sum(range(m,m+n)))

  elif m<0:
  print(sum(range(m,m+n-1)))

  else:
  print(sum(range(m+1,m+n)))
Problem p03014 (python)

Fixed submission:
import numpy as np
h,w = map(int,input().split())
ar = np.array([list(input()) for _ in range(h)]) == '.'
#print(ar)
l = np.zeros((h,w),dtype=int)
r = np.zeros((h,w),dtype=int)
u = np.zeros((h,w),dtype=int)
d = np.zeros((h,w),dtype=int)

for i in range(h):
  u[i] = (u[i-1]+1)*ar[i]
  #print(u)
  d[-i-1] = (d[-i]+1)*ar[-i-1]
  #print(d)
  
for j in range(w):
  l[:,j] = (l[:,j-1]+1)*ar[:,j]
  #print(l)
  r[:,-j-1] = (r[:,-j]+1)*ar[:,-j-1]
  #print(r)
print(np.max(u+d+l+r)-3)

Buggy submission (verdict: Runtime Error):
# solution

import numpy as np
n,m = map(int,input().split())
ar = np.array([list(input()) for _ in range(h)]) == '.'
l = np.zeros((n,m),dtype=int)
r = np.zeros((n,m),dtype=int)
u = np.zeros((n,m),dtype=int)
d = np.zeros((n,m),dtype=int)

for i in range(n):
  u[i] = (u[i-1]+1)*ar[i]
  d[-i-1] = (d[-i]+1)*ar[-i-1]
  
for j in range(m):
  l[:,j] = (l[:,j-1]+1)*ar[:,j]
  r[:,-j-1] = (r[:,-j]+1)*ar[:,-j-1]
print(np.max(u+d+l+r)-3)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a>b:
  print(a+a-1)
elif a<b:
  print(b+b-1)
else:
  print(a+b)

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

if n>m:
  print(n+n-1)
  
elif n<b:
  print(m+m-1)

  else:
  print(n+m)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n>m:
  print(n+n-1)
elif n<b:
  print(m+m-1)
else:
  print(n+m)
Problem p03457 (python)

Fixed submission:
# solution

import io

array = [1]

def tommy(numbers):
  t, x, y = map(int, numbers.split())
  time_x = t - x
  time_y = time_x - y
  if time_y%2 == 0 and time_y >=0:
    array.append(1)
  else:
    array.append(-1)

data = int(input())

counter = 0

while counter < data:
  tommy(input())
  counter += 1

if array.count(1) == data+1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# solution

import io

array = [1]

def tommy(numbers):
  t, x, y = map(int, numbers.split())
  time_x = t - x
  time_y = time_x - y
  if time_y%2 == 0 and time_y >=0:
    array.append(1)
  else:
    array.append(-1)

data = int(input())

counter = 0

while counter < data:
  tommy(input())
  counter += 1

if array.counter(1) == data+1:
  print('Yes')
else:
  print('No')
Problem p03485 (python)

Fixed submission:
print(-(-eval(input().replace(" ","+"))//2))

Buggy submission (verdict: Runtime Error):
# solution
import io

print("Yes" if sorted(input()) < sorted(input(),reverse = True) else "No")
Problem p03573 (python)

Fixed submission:
n,m,k=map(int,input().split())
if n==m:print(k)
elif n==k:print(m)
else:print(n)

Buggy submission (verdict: Runtime Error):
# solution
import io
import math

nim, mike = map(int, input().split())
data = [['.'] * (mike+2)]
data += [['.'] + list(input()) + ['.'] for _ in range(nim)]
data += [['.'] * (mike+2)]

result = []
for i in range(1, nim + 1):
  strings = str()
  for j in range(1, mike + 1):
    counter = 0
    if data[i][j] == '.':
      for k in range(-1, 2, 1):
        for l in range(-1, 2, 1):
          if data[i+k][j+l] == '#':
            counter += 1
      strings += str(counter)
    else:
      strings += '#'
  result += [strings]
    
for i in result:
  print (i)
Problem p03962 (python)

Fixed submission:
# solution

cols = set( map( int, input().split() ) )

print( len( cols ) )

Buggy submission (verdict: Runtime Error):
# solution

nim, mike = map(int, input().split())
print(mike * (mike - 1) ** (nim - 1))
Problem p04012 (python)

Fixed submission:
data = input()
print("Yes" if all([data.count(i)%2==0 for i in set(data)]) else "No")

Buggy submission (verdict: Runtime Error):
# solution

data = input()
for i in data:
    if data.count(i) % 2:
        print('No')
    	exit()
print('Yes')
Problem p04043 (python)

Fixed submission:
import math

if sorted(input().split())==['5','5','7']:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
s = []

for i in range(n):
    s.append(input())

s.sort()

print("".join(s))

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
sam = []

for i in range(n):
    sam.append(input())

sam.sort()

print("".join(sam))
Problem p02730 (python)

Fixed submission:
def palindrome(word):
  if len(word) <= 1:
    return True
  if word[0] != word[-1]:
    return False
  return palindrome(word[1:-1])
 
word = input()
n = len(word) // 2
issuper = palindrome(word[:n]) and palindrome(word[n+1:]) and palindrome(word)
print("Yes" if issuper else "No")

Buggy submission (verdict: Runtime Error):
def palindrome(word):
  if len(word) <= 1:
    return True
  if word[0] != word[-1]:
    return False
  return palindrome(word[1:-1])
 
word = input().lower()
n = len(word) // 2
issuper = palindrome(word[:n]) and palindrome(word[n+1:])
print("Yes" if issuper else "No"))

Buggy submission (verdict: Runtime Error):
def palindrome(word):
  if len(word) <= 1:
    return True
  if word[0] != word[-1]:
    return False
  return palindrome(word[1:-1])

word = input()
n = len(word) // 2
issuper = palindrome(word[:n]) and palindrome(word[n+1:])
print("Yes" if isupper else "No")
Problem p02801 (python)

Fixed submission:
x = input()
y = ord(x)
y += 1
x = chr(y)
print(x)

Buggy submission (verdict: Runtime Error):
params = input().split(' ')
n = eval(params[1])
 
acfoundfor = []
 
penalties = 0
points = 0
 
for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])
    status = submission[1]
    
    if p in acfoundfor:
        continue
 
    if status == 'AC':
        points += 1
        acfoundfor.append(p)
    else:
        penalties += 1
        
print(points, penalties)

Buggy submission (verdict: Runtime Error):
import sys

x = sys.argv[1]

y = ord(x)
y += 1
x = chr(y)
print(x)
Problem p02811 (python)

Fixed submission:
numbers = input().split(' ')
a = int(numbers[0])
b = int(numbers[1])

if a*500 >= b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    if word[i:i+3] == 'abc':
      counter += 1
      
print(counter)
Problem p02812 (python)

Fixed submission:
l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)-2):
  if word[i:i+3] == 'ABC':
    counter += 1
      
print(counter)

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

word = input()

counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    if word[i:i+2] == 'abc':
      counter += 1
      
return counter
Problem p02812 (python)

Fixed submission:
if __name__ == '__main__':
    # We have a string S of length N consisting of uppercase English letters.
    n = input()
    s = input()
    num = 0
    for i in range(len(s)):
        if 'ABC' in s:
            num += 1
            s = s.replace('ABC', '', 1)
    print(num)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    # We have a string S of length N consisting of uppercase English letters.
    temp = input().split('\n')
    n = temp[0]
    s = temp[1]
    num = 0
    if 'ABC' in s:
        num += 1
        s = s.replace('ABC', '')
    print(num)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    # We have a string S of length N consisting of uppercase English letters.
    temp = input().split('\n')
    n = temp[0]
    s = temp[1]
    num = 0
    if 'ABC' in s:
        num += 1
        s.replace('ABC', '')
    print(num)
Problem p02813 (python)

Fixed submission:
import itertools

if __name__ == '__main__':
    # P and Q are both rearrangements of (1, 2, ..., N)).
    # N! possible permutations of size N
    # among them, let P and Q be the a-th and the b-th
    n = int(input())
    p = input().split(' ')
    q = input().split(' ')

    for i in range(0, len(q)):
        p[i] = int(p[i])
        q[i] = int(q[i])

    realnums = p.copy()

    realnums.sort()

    perm = list(itertools.permutations(realnums))

    it = 0

    qplace = 0
    pplace = 0

    for i in perm:
        if list(i) == q:
            qplace = it
        if list(i) == p:
            pplace = it
        it += 1
    print(abs(qplace - pplace))

Buggy submission (verdict: Runtime Error):
import itertools

if __name__ == '__main__':
    # P and Q are both rearrangements of (1, 2, ..., N)).
    # N! possible permutations of size N
    # among them, let P and Q be the a-th and the b-th
    n = int(input())
    p = list(map(int, input().split(' ')))
    q = list(map(int, input().split(' ')))

    realnums = p.copy()

    realnums.sort()

    perm = list(itertools.permutations(realnums))
    
    print(abs(perm.index(p) - perm.index(q)))
Problem p02718 (python)

Fixed submission:
n,m = map(int,input().split())
A = [int(x) for x in input().split()]
B = sum(A)
a = 0
for i in range(n):
    if A[i] >= B/(4*m):
        a += 1
if a >= m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
A = list(input().split())
B = sum(A)
a = 0
for i in range(n):
    if A[i] >= B/(4*m):
        a += 1
if a >= m:
    print("Yes")
else:
    print("No")
Problem p02730 (python)

Fixed submission:
A = list(input())
A1 = list(reversed(A))
#print((len(A)-1)/2-1)
 
B = A[:(len(A)-1)//2]
B1 = list(reversed(B))
 
C = A[(len(A)+3)//2-1:]
C1 = list(reversed(C))
 
if A == A1 and B == B1 and C == C1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = list(input())
A1 = reversed(A)

B = A[0:(len(A)-1)/2-1]
B1 = reversed(B)

C = A[(len(A)+3)/2-1:-1]
C1 = reversed(C)

if A == A1 and B == B1 and C == C1:
    print("Yes")
else:
    print("No")
Problem p02756 (python)

Fixed submission:
x = input()
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
    
a = ""
b = ""
c = 0
for i in range(n):
    if s[i][0] == "1":
        c += 1
        c = c%2
    else:
        if c == 0:
            if s[i][1] == "1":
                a = s[i][2] + a
            else:
                b = b + s[i][2]
        else:
            if s[i][1] == "1":
                b = b + s[i][2]
            else:
                a = s[i][2] + a
if c == 0:
    print(a + x + b)
else:
    print(''.join(list(reversed(b))) + ''.join(list(reversed(x))) + ''.join(list(reversed(a))))

Buggy submission (verdict: Runtime Error):
x = input()
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
    
a = ""
b = ""
c = 0
for i in range(n):
    if s[i][0] == "1":
        c += 1
        c = c%2
    else:
        if c == 0:
            if s[i][1] == "1":
                a = s[i][2] + a
            else:
                b = b + s[i][2]
        else:
            if s[i][1] == "1":
                b = b + s[i][2]
            else:
                a = s[i][2] + a
if c == 0:
    print(a + x + b)
else:
    print(reverse(b) + x + reverse(a))

Buggy submission (verdict: Runtime Error):
x = input()
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)
    
a = ""
b = ""
c = 0
for i in range(n):
    if s[i][0] == "1":
        c += 1
        c = c%2
    else:
        if c == 0:
            if s[i][1] == "1":
                a = s[i][2] + a
            else:
                b.append(s[i][2])
        else:
            if s[i][1] == "1":
                b.append(s[i][2])
            else:
                a = s[i][2] + a
if c == 0:
    print(a + x + b)
else:
    print(b + x + a)

Buggy submission (verdict: Runtime Error):
from collections import deque
d = deque()
S = input()
d.append(S)
s = []
n = int(input())
for i in range(n):
    array = list(map(str,input().split()))
    s.append(array)

for i in range(N):
    if s[i][0] == "1":
        d.reverse()
    else:
        if s[i][1] == "1":
            d.extendleft(s[i][2])
        else:
            d.extend(s[i][2])

print("".join(list(d)))
Problem p02760 (python)

Fixed submission:
s = []
for i in range(3):
    array = list(map(int,input().split()))
    s.append(array)
N = int(input())
t = [int(input()) for i in range(N)]
 
for i in range(N):
    for j in range(3):
        for l in range(3):
            if t[i] == s[j][l]:
                s[j][l] = 0
 
if sum(s[0]) == 0 or sum(s[1]) == 0 or sum(s[2]) == 0 or s[0][0]+s[1][0]+s[2][0] == 0 or s[0][1]+s[1][1]+s[2][1] == 0 or s[0][2]+s[1][2]+s[2][2] == 0 or s[0][0]+s[1][1]+s[2][2] == 0 or s[2][0]+s[1][1]+s[0][2] == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = []
for i in range(3):
    array = list(map(int,input().split()))
    s.append(array)
N = int(input())
t = [int(input()) for i in range(N)]

for i in range(N):
    for j in range(3):
        for l in range(3):
            if t[i] == s[j][l]
            s[j][l] = 0

if sum(s[0]) == 0 or sum(s[1]) == 0 or sum(s[2]) == 0 or s[0][0]+s[1][0]+s[2][0] == 0 or s[0][1]+s[1][1]+s[2][1] == 0 or s[0][2]+s[1][2]+s[2][2] == 0 or s[0][0]+s[1][1]+s[2][2] == 0 or s[2][0]+s[1][1]+s[0][2] == 0:
    print("Yes")
else:
    print("No")
Problem p02768 (python)

Fixed submission:
M,A,B = [int(x) for x in input().split()]

mod = 10**9+7

def cmb(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) % mod * pow(i+1, mod-2, mod) % mod
    return res

def binary(n):
    return bin(n)[2:]


def pow_by_binary_exponentiation(a, x, n): # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y
d = pow_by_binary_exponentiation(2,M,mod)-1
    
d1 = cmb(M,A,mod)
d2 = cmb(M,B,mod)
print((d-d1-d2)%mod)

Buggy submission (verdict: Runtime Error):
M,A,B = [int(x) for x in input().split()]

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 200000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



def binary(n):
    return bin(n)[2:]


def pow_by_binary_exponentiation(a, x, n): # a^x mod n
    x = [int(b) for b in binary(x)]
    y = a
    for i in range(1, len(x)):
        y = (y**2) % n
        if x[i] == 1:
            y = (y * a) % n
    return y
d = pow_by_binary_exponentiation(2,M,mod)-1
    
d1 = cmb(M,A,mod)
d2 = cmb(M,B,mod)
print((d-d1-d2)%mod)
Problem p02772 (python)

Fixed submission:
N = int(input())
s = [int(x) for x in input().split()]
 
a = 0
for i in range(N):
    if s[i]/2 == s[i]//2:
        if s[i]/3 == s[i]//3 or s[i]/5 == s[i]//5:
          a = a + 1
    else:
        a = a + 1
 
if a == N:
    print("APPROVED")
else:
    print("DENIED")

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

a = 0
for i in range(N):
    if s[i]/2 == s[i]//2:
        if s[i]/3 == s[i]//3 or s[i]/5 == s[i]//5:
          a = a + 1
    else:
        a = a + 1

if a == N:
    print("APPROVED")
else:
    print("DENIED")
Problem p02778 (python)

Fixed submission:
S = input()
t = ["x" for i in range(len(S))]
print("".join(t))

Buggy submission (verdict: Runtime Error):
S = input()
t = ["x" for i in range(len(s))]
print(*t)

Buggy submission (verdict: Runtime Error):
S = input()
t = [x for i in range(len(s))]
print(*t)