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

Fixed submission:
import numpy as np
from fractions import gcd
from functools import reduce

def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())

a = list(map(int, input().split(' ')))

devisor = gcd_list(a)

a = np.array(a) / devisor
child = a.prod()
child *= devisor

mother = 0

for m in range(n):
    mother += np.delete(a, m).prod()

x = child / mother

print(x)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input())

a = list(map(int, input().split(' ')))

devisor = gcd_list(a)

a = np.array(a) / devisor
child = a.prod()
child *= devisor

mother = 0

for m in range(n):
    mother += np.delete(a, m).prod()

x = child / mother

print(x)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n = int(input())

a = list(map(int, input().split(' ')))

devisor = gcd_list(a)

a = np.array(a) / devisor
child = a.prod()
child *= devisor

mother = 0

for m in range(n):
    mother += np.delete(a, m).prod()

x = child / mother

print(x)
Problem p02936 (python)

Fixed submission:
# dfs(深さ優先探索)

N, Q = map(int, input().split(' '))

num_list = [0] * (N+1)

tree_list = [[] for _ in range(N+1)]

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

for _ in range(Q):
    p, x = map(int, input().split())
    num_list[p] += x

q = [1]
checked = [0] * (N+1)

while q:
    v=q.pop()
    checked[v] = 1
    for u in tree_list[v]:
        if checked[u] == 1:
            continue
        num_list[u] += num_list[v]
        q.append(u)

print(*num_list[1:])

Buggy submission (verdict: Runtime Error):
num_list = [0] * (N)
a_b_list = []

for _ in range(N-1):
    a_b_list.append(list(map(int, input().split())))

for _ in range(Q):
    p, x = map(int, input().split())
    num_list[p-1] += x

for a_b in a_b_list:
    num_list[a_b[1]-1] += num_list[a_b[0]-1]

print(*num_list)
Problem p02945 (python)

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

answers = [A+B, A-B, A*B]
print(max(answers))

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

answers = [A+B, A-B, A*B, A/B]
print(max(answers))
Problem p03067 (python)

Fixed submission:
a, b, c = map(int, input().split(' '))

if a > b and b > c and a > c:
    print('No')
if a > c and a > b and c > b:
    print('Yes')
elif b > a and b > c and a > c:
    print('No')
elif b > c and c > a and b > a:
    print('Yes')
elif c > a and c > b and a > b:
    print('No')
elif  c > b and c > a and b > a:
    print('No')

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

s = S.lstrip('.').rstrip('#')

w = s.count('.')
b = n - w

if w < b:
    print(w)
else:
    print(b)
Problem p02756 (python)

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


class Node:
    def __init__(self, value=None, prev=None, next=None):
        self.value = value
        self.prev = prev
        self.next = next

    def __str__(self):
        return str(self.value)


class LinkedList:
    def __init__(self, initial_string=None):
        self.first = Node()
        self.last = Node()
        self.first.next = self.last
        self.last.prev = self.first
        self.should_reverse = False
        for s in initial_string:
            self.insert_last(s)

    def _insert_first(self, value=None):
        prev_next = self.first.next
        self.first.next = Node(value, self.first, prev_next)
        prev_next.prev = self.first.next

    def _insert_last(self, value=None):
        prev_prev = self.last.prev
        self.last.prev = Node(value, prev_prev, self.last)
        prev_prev.next = self.last.prev

    def insert_first(self, value=None):
        if self.should_reverse:
            self._insert_last(value)
        else:
            self._insert_first(value)

    def insert_last(self, value=None):
        if self.should_reverse:
            self._insert_first(value)
        else:
            self._insert_last(value)

    def set_reverse(self):
        self.should_reverse = not self.should_reverse

    def _print(self):
        node = self.first.next
        while node is not None:
            if node.value is not None:
                print(node, end="")
            node = node.next
        print("")

    def _print_reverse(self):
        node = self.last.prev
        while node is not None:
            if node.value is not None:
                print(node, end="")
            node = node.prev
        print("")

    def print_list(self):
        if self.should_reverse:
            self._print_reverse()
        else:
            self._print()


def formation():
    global S, Q

    linked_list = LinkedList(S)

    for _ in range(Q):
        t_str = input()

        if t_str[0] == '1':
            linked_list.set_reverse()
        else:
            split = t_str.split(' ')
            f = split[1]
            c = split[2]
            if f == '1':
                linked_list.insert_first(c)
            else:
                linked_list.insert_last(c)

    linked_list.print_list()


formation()

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


def formation():
    global S, Q

    ls = list(S)
    do_rev = False
    for _ in range(Q):
        t_str = input()

        if t_str[0] == '1':
            do_rev = not do_rev
        else:
            splited = t_str.split(' ')
            f = splited[1]
            c = splited[2]
            if f == '1':
                if do_rev:
                    ls.append(c)
                else:
                    ls.insert(0, c)
            else:
                if do_rev:
                    ls.insert(0, c)
                else:
                    ls.append(c)
        print(ls)

    if do_rev:
        ls.reverse()

    return ''.join(ls)


print(formation())
Problem p02909 (python)

Fixed submission:
d = {'Sunny': 'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(d[input()])

Buggy submission (verdict: Runtime Error):

N, M = list(map(lambda x:int(x), input().split(' ')))
l = list(map(lambda x:int(x), input().split(' ')))

maxheap = MaxHeap(l)

WARI = 0.5
for _ in range(0, M):
    v = int(maxheap.pop() * WARI)
    maxheap.push(v)

SUM = 0
for _ in range(0, N):
    SUM += maxheap.pop()

print(SUM)
Problem p02657 (python)

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

print(A*B)

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

a=N%10

if a==2 or a==4 or a==5 or a==7 or a==9:
  print('hon')
elif a==0 or a==1 or a==6 or a==8:
  print('pon')
else:
  print('bon')
Problem p02658 (python)

Fixed submission:
import numpy as np

N=int(input())
A=np.ones(N)
a=np.ones(N)

A=map(int,input().rstrip().split())


a=sorted(A,reverse=True)

a_product=1
flag_1e18=False
flag_0=False

if a[N-1]==0:
  flag_0=True

for i in range(0,N,1):
  a_product=a_product*a[i]
  if a_product>1e18:
    flag_1e18=True
    break
  else:
    continue
    
if flag_1e18==True and flag_0==False:
  print(-1)
elif flag_0==True:
  print(0)
else:
  print(a_product)

Buggy submission (verdict: Runtime Error):
import numpy as np

N=int(input())
A=np.ones(N)
a=np.ones(N)

A=map(int,input().rstrip().split())


a=sorted(A,reverse=True)

a_product=1
flag_1e18=False
flag_0=False

if a[N-1]==0:
  flag_0=True

for i in range(0,N,1):
  a_product=a_product*a[i]
  if a_product>1e18:
    flag_1e18=True
    break
  else:
    continue
    
if flag_1e18==True and flag_0==False:
  print(-1)
elif flag_0==True:
  print(0)
else:
  print(A_product)

Buggy submission (verdict: Runtime Error):
import numpy as np

N=int(input())
A=np.ones(N)
a=np.ones(N)

A=map(int,input().rstrip().split())


a=sorted(A,reverse=True)

a_product=1
flag_1e18=False
flag_0=False

if a[N-1]==0:
  flag_0=True

for i in range(0,N,1):
  a_product=a_product*a[i]
  if a_product>1e18:
    flag_1e18=True
  else:
    continue
    
if flag_1e18==True and flag_0==False:
  print(-1)
elif flag_0==True:
  print(0)
else:
  print(A_product)
Problem p02910 (python)

Fixed submission:
S=input()
flag=False
for i in range(len(S)):
  if i%2==0:
    if S[i]!='R' and S[i]!='U' and S[i]!='D':
      flag=True
  else:
    if S[i]!='L' and S[i]!='U' and S[i]!='D':
      flag=True
if flag==True:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
flag=False
for i in range(len(S)):
  if i%2==0:
    if S[i]!='R' and S[i]!='U' and S[i]!='D':
      flag=True
  else:
    if S[i]!='L' and S[i]!='U' and S[i]!='D':
      flag=True
if flag=True:
  print('No')
else:
  print('Yes')
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
if N!=1:
  L=list(map(int,input().split()))
  tot=0
  count=1
  for i in range(N):
    tot+=L[i]
    if X>=tot:
      count+=1
  print(count)
else:
  L=int(input())
  if X>=L:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
if N!=1:
  L=list(map(int,input().split()))
  tot=0
  count=0
  while X>=tot:
    tot+=L[count]
    count+=1
  print(count)
else:
  L=int(input())
  if X>=L:
    print(2)
  else:
    print(1)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
tot=0
count=0
while X>=tot:
  tot+=L[count]
  count+=1
print(count)
Problem p03477 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
 
if (A+B)>(C+D):
  print('Left')
elif (A+B)==(C+D):
  print('Balanced')
else:
  print('Right')

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

if (A+B)>(C+D):
  print('left')
elif (A+B)=(C+D):
  print('Balanced')
else:
  print('Right')
Problem p03852 (python)

Fixed submission:
c=input()
 
if c=='a' or c=='i' or c=='u' or c=='e' or c=='o':
  print('vowel')
else:
  print('consonant')

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

if c=='a' of c=='i' or c=='u' or c=='e' or c=='o':
  print('vowel')
else:
  print('consonant')
Problem p02639 (python)

Fixed submission:
s = list(map(int, input().split()))
for i in range(len(s)):
  if s[i]==0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
X,N = map(int, input().split())
if N ==0:
  print(X)
  exit() 
if N !=0:
  p = list(map(int, input().split()))
if p.count(X) == 0:
  print(X)
  exit()
for a in range(1000):
  if p.count(X-a) ==0:
    print(X-a)
    exit()
  elif p.count(X+a) ==0:
    print(X+a)
    exit()
Problem p02641 (python)

Fixed submission:
X,N = map(int, input().split())
if N ==0:
  print(X)
  exit() 
if N !=0:
  p = list(map(int, input().split()))
if p.count(X) == 0:
  print(X)
  exit()
for a in range(1000):
  if p.count(X-a) ==0:
    print(X-a)
    exit()
  elif p.count(X+a) ==0:
    print(X+a)
    exit()

Buggy submission (verdict: Runtime Error):
X,N = map(int, input().split())
if N ==0:
  print(X)
  exit() 
if N ==0:
  print(X)
  exit() 
if p.count(X) == 0:
  print(X)
  exit()
for a in range(1000):
  if p.count(X-a) ==0:
    print(X-a)
    exit()
  elif p.count(X+a) ==0:
    print(X+a)
    exit()
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
Amax = A[-1]
dp = [1]*(Amax+1)
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:
    for q in range(Amax//p+1):
      dp[p*q] = 0
    if A[i] != A[i+1]: 
      ans += 1
if dp[Amax] == 1:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=0
for a in range(N):
  newA = [A[a]%n for n in A]
  newA.pop(a)
  print(newA)
  if 0 in newA:
    ans = ans
  else:
    ans += 1
  
print(ans)
Problem p02646 (python)

Fixed submission:
A, V=map(int,input().split())
B, W=map(int,input().split())
T =int(input())
D = abs(A-B)

if (V-W)*T>=D:
  print("YES")
#elif 10**9-A<=V*T and A<B:
#  print("YES")
#elif abs(-10**9-A)<=V*T and A>B:
#  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N, K= map(int,input().split())
A = list(map(int,input().split()))
p=0
while p<K:
  B=[0]*N
  for i in range(N):
    count = 0
    for j in range(N):
      if A[j]+1>abs(j-i):
        count +=1
    B[i] = count
  if min(A)==N:
    break
  A = B
  p +=1
print(*A)
Problem p02647 (python)

Fixed submission:
N, K= map(int,input().split())
A = list(map(int,input().split()))
a=A[:]
for _ in range(K):
  B=[0]*(N+1)
  for i in range(N):
    t = a[i]
    B[max(i-t,0)] +=1
    B[min(i+t+1,N)] -=1
  for i in range(N):
    B[i+1] += B[i]
  a=B[:N]        
  if min(a)==N:
    break
print(*a)

Buggy submission (verdict: Runtime Error):
#import numpy as np
N, K= map(int,input().split())
A = list(map(int,input().split()))
a=A[:]
for _ in range(K)
  B=[0]*(N+1)
  for i in range(N):
    t = a[i]
    B[max(i-t,0)] +=1
    B[min(i+t+1,N)] -=1
  for i in range(N):
    B[i+1] += B[i]
    a=B[:N]        
  if min(a)==N:
    break
print(*a)
Problem p02731 (python)

Fixed submission:
a=int(input())
print((a/3)**3)

Buggy submission (verdict: Runtime Error):
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
C=list(set(L))
x=0
for i in range(len(C)):
  a = L.count(C[i])
  x += int(a*(a-1)/2)  
for K in range(N):
  print(x-L.count(L[K])+1)
Problem p03087 (python)

Fixed submission:
import numpy as np
N, Q=map(int,input().split())
S=input()
L =[list(map(int,input().split()))for i in range(Q)]
c = [0]*(N)  #ACのチェック
s = [0]*(N)  #ACの累積和
ans = [0]*Q 

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    c[i+1] = 1
s = np.cumsum(c)
for i in range(Q):
  ans[i] = s[L[i][1]-1]-s[L[i][0]-1]

for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, Q=map(int,input().split())
S=input()
L =[list(map(int,input().split()))for i in range(Q)]
c = [0]*(N)  #ACのチェック
s = [0]*(N)  #ACの累積和
ans = [0]*Q 

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    c[i+1] = 1
s = np.cumsum(c)
for i in range(Q):
  ans[i] = s[L[i][1]-1]-s[L[i][0]-1]

for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, Q=map(int,input().split())
S=input()
L =[list(map(int,input().split()))for i in range(Q)]
c = [0]*(N)  #ACのチェック
s = [0]*(N)  #ACの累積和
ans = [0]*Q 

for i in range(N-1):
  if S[i] == "A" and S[i+1] == "C":
    c[i+1] = 1
s = np.cumsum(c)
for i in range(Q):
  ans[i] = s[L[i][1]-1]-s[L[i][0]-1]

for i in ans:
  print(i)
Problem p03323 (python)

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

if max(A)<=8:
  print("Yay!")
else:
  print(":(")

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

if max(A)<=8:
  print(Yay!)
else:
  print(:()
Problem p03324 (python)

Fixed submission:
D, N =map(int, input().split())
if N != 100:
  print(100**D*N)
else:
  print(100**D*101)

Buggy submission (verdict: Runtime Error):
D, N =map(int, input().split())
if N != 100:
  print(100**D*N)
else:
  print(100**d*101)

Buggy submission (verdict: Runtime Error):
D, N =map(int, input().split())
if N != 100:
  print(100**D*N)
else:
  print(100**d*101)
Problem p03355 (python)

Fixed submission:
s=input()
K=int(input())
D=[]
for i in range(len(s)+1):
  for j in range(min(len(s)-i,5)):
    D.append(s[i:i+j+1])
D = sorted(list(set(D)))
#print(D)
print(D[K-1])

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
D=[]
for i in range(len(s)):
  for j in range(len(s)-i-1):
    D.append(s[i:i+j+1])
D = sorted(list(set(D)))
print(D[K-1])
Problem p02642 (python)

Fixed submission:
n = int(input())
nums = [int(e) for e in input().split()]
import numpy as np

ans= np.zeros(max(nums)+1)

for i in nums:
    if ans[i] >1:
        continue
    else:
        ans[i::i] +=1

cnt = 0
for i in nums:
    if ans[i] ==1:
        cnt +=1

print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(e) for e in input().split()]
import numpy as np
npnums = np.array(nums)

cnt = 0 #個数のカウント

test = np.zeros(n*n).reshape(n,n)
for i,v in enumerate(nums):
    test[i] +=v

mask = (test % npnums ==0)

for i in mask:
    if np.count_nonzero(i) >1:
        cnt+=1

print(n-cnt)
Problem p02658 (python)

Fixed submission:
n = int(input())
lista = [int(e) for e in input().split()]

if 0 in lista:
    ans = 0
else:
    ans = 1
    for i in lista:
        ans *= i
        if ans>10**18:
            ans = -1
            break

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
lista = [int(e) for e in input().split()]
lista = np.array(lista)
ans = np.cumprod(lista)

if ans > 10**18:
    ans=-1

print(ans)
Problem p02677 (python)

Fixed submission:
a, b, h, m = [int(e) for e in input().split()]
import math

x = ((a*math.cos(math.pi/6*(h+m/60))-b*math.cos(math.pi/30*m))**2 + (a*math.sin(math.pi/6*(h+m/60))-b*math.sin(math.pi/30*m))**2 )**(1/2)

print(x)

Buggy submission (verdict: Runtime Error):
import math

x = ((a*math.cos(math.pi/6*(h+m/60))-b*math.cos(math.pi/30*m))**2 + (a*math.sin(math.pi/6*(h+m/60))-b*math.sin(math.pi/30*m))**2 )**(1/2)

print(x)
Problem p02683 (python)

Fixed submission:
n, m, x = [int(e) for e in input().split()]

import numpy as np

all = np.zeros(n*(m+1)).reshape(n,m+1)

for i in range(n):
    all[i] += [int(e) for e in input().split()]

bool_list = np.array([])
a = []
b = []
def make(n):
    if len(a) == n:
        b.append([0 for _ in range(n)])
        for i,v in enumerate(a) :
            if v == True:
                b[-1][i] = True
            else:
                b[-1][i] = False
    else:
        for i in [True,False]:
            a.append(i)
            make(n)
            a.pop()

make(n)
c=np.array(b)

dp=10**10

for i in c:
    if (all[i][:,1:].sum(axis = 0) >=x).all() :
        dp = min(dp,all[i][:,0].sum(axis = 0))

if dp ==10**10:
    dp = -1
print(int(dp))

Buggy submission (verdict: Runtime Error):

n, m, x = [int(e) for e in input().split()]

import numpy as np

all = np.zeros(n*(m+1)).reshape(n,m+1)

for i in range(n):
    all[i] += [int(e) for e in input().split()]

bool_list = np.array([])
a = []
b = []
def make(n):
    if len(a) == n:
        b.append([0 for _ in range(n)])
        for i,v in enumerate(a) :
            if v == True:
                b[-1][i] = True
            else:
                b[-1][i] = False
    else:
        for i in [True,False]:
            a.append(i)
            make(n)
            a.pop()

make(n)
c=np.array(b)

dp=[10**10]

for i in c:
    if all[i][:,1].sum(axis = 0) >=x :
        dp = min(dp,all[i][:,0].sum(axis = 0))

if dp ==[10**10]:
    dp = [-1]
print(int(dp[0]))

Buggy submission (verdict: Runtime Error):

n, m, x = [int(e) for e in input().split()]

import numpy as np

all = np.zeros(n*(m+1)).reshape(n,m+1)

for i in range(n):
    all[i] += [int(e) for e in input().split()]

bool_list = np.array([])
a = []
b = []
def make(n):
    if len(a) == n:
        b.append([0 for _ in range(n)])
        for i,v in enumerate(a) :
            if v == True:
                b[-1][i] = True
            else:
                b[-1][i] = False
    else:
        for i in [True,False]:
            a.append(i)
            make(n)
            a.pop()

make(n)
c=np.array(b)

dp=[10**10]

for i in c:
    if all[i][:,1].sum(axis = 0) >=x :
        dp = min(dp,all[i][:,0].sum(axis = 0))


print(int(dp))
Problem p03162 (python)

Fixed submission:
n = int(input())

abc=list()
for i in range(n):
    abc.append([int(e) for e in input().split()])

A=[]
B=[]
C=[]

A.append(abc[0][0])
B.append(abc[0][1])
C.append(abc[0][2])

for i in range(1,n):
    a = abc[i][0] + max(B[-1],C[-1])
    b = abc[i][1] + max(A[-1],C[-1])
    c = abc[i][2] + max(A[-1],B[-1])
    A.append(a)
    B.append(b)
    C.append(c)

print(max(A[-1],B[-1],C[-1]))

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

abc=list()
for i in range(n):
    abc.append([int(e) for e in input().split()])

A=[]
B=[]
C=[]

for i in range(n):
    a = abc[i][0] + max(B[-1],C[-1])
    b = abc[i][1] + max(A[-1],C[-1])
    c = abc[i][2] + max(A[-1],B[-1])
    A.append(a)
    B.append(b)
    C.append(c)

print(max(A[-1],B[-1],C[-1]))
Problem p02687 (python)

Fixed submission:

n = input()

if n == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):

n = input()

if n == ABC:
    print("ARC")
else:
    print("ABC")
Problem p02696 (python)

Fixed submission:
import numpy as np
import math

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

i = B-1

if i >= N:
  x = N
else:
  x = B-1

print(math.floor((A*x)/B) - A * math.floor((x/B)))

Buggy submission (verdict: Runtime Error):
import numpy as np

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

l = np.zeros(N)

for i in range(1,N+1):
    l[i-1] = np.floor((A*i)/B) - A * np.floor(i/B)

print(int(np.max(l)))

Buggy submission (verdict: Runtime Error):
import numpy as np
import math

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

l = np.zeros(N+1)

for i in range(1,N+1):
    l[i] = math.floor((A*i)/B) - A * math.floor(i/B)

print(int(np.max(l)))
Problem p02778 (python)

Fixed submission:
s = input()
x = ""
for i in s:
	x+="x"
print(x)

Buggy submission (verdict: Runtime Error):
s = input()
x = ""
for i in s
	x+="x"
print(x)
Problem p02801 (python)

Fixed submission:
print(chr(ord(input())+1))

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

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

if N * M - sum(A) > K:
	print(-1)
else:
  	print(max(N*M -sum(A) , 0))

Buggy submission (verdict: Runtime Error):
print(chr(ord(input()+1))
Problem p02811 (python)

Fixed submission:
k,x = map(int,input().split())
if k*500 >=x:
	print('Yes')
else:
  print('No')

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

fac = [0] * 8
fac[1] = 1
for i in range(2, N):
    fac[i] = i * fac[i - 1]

a = 0
l = list(range(1, N + 1))
for i in range(N):
    a += l.index(P[i]) * fac[len(l) - 1]
    l.remove(P[i])

b = 0
l = list(range(1, N + 1))
for i in range(N):
    b += l.index(Q[i]) * fac[len(l) - 1]
    l.remove(Q[i])

print(abs(a - b))

Buggy submission (verdict: Runtime Error):
k,x = map(int,input().split())
if k*500 >=x:
	input('Yes')
else:
  input('No')

Buggy submission (verdict: Runtime Error):
k,x = map(int,input().split())
if(k*500 >=x)
	input('Yes')
else:
  input('No')
Problem p02812 (python)

Fixed submission:
N = int(input())


S = str(input())

print(S.count('ABC'))

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

print(S.count('ABC'))
Problem p02830 (python)

Fixed submission:
N = int(input())
S, T = input().split()
s = ""
for i in range(N):
  s += S[i] + T[i]
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = input().stlip

s=''

for i in range(N):
  s+=S[i]+T[i]
  
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = (input().stlip)

s=''

for i in range(N):
  s+=S[i]+T[i]
  
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
S,T = str(input().stlip)

s=''

for i in range(N):
  s+=S[i]+T[i]
  
print(s)