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

Fixed submission:
import heapq

N,M = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x:x*(-1), A))

heapq.heapify(A)

for _ in range(M):
    A_max = heapq.heappop(A)*(-1)
    heapq.heappush(A, (A_max//2)*(-1))

print(sum(A)*(-1))

Buggy submission (verdict: Runtime Error):
class Node:
    def __init__(self,data,parent):
        self.data = data
        self.left = None
        self.right = None
        self.parent = parent
        self.same = 1

class BST:
    def __init__(self):
        self.root = None
    
    def insert(self,data):
        n = self.root
        if n == None:
            self.root = Node(data,None)
            return
        else:
            while True:
                if n.data > data:
                    if n.left is None:
                        n.left = Node(data,n)
                        return
                    n = n.left
                elif n.data < data:
                    if n.right is None:
                        n.right = Node(data,n)
                        return
                    n = n.right
                elif n.data == data:
                    n.same += 1
                    return
    
    def delete_max(self):
        n = self.root
        while True:
            if n.right == None:
                break
            else:
                n = n.right
        tmp = n.data//2
        if n.same > 1:
            n.same -= 1
        else:
            if n.left == None:
                n.parent.right = None
            else:
                n.parent.right = n.left
                n.left.parent = n.parent
        self.insert(tmp)
    
    def sum_bst(self,node):
        if node.left == None and node.right == None:
            return node.data*node.same
        else:
            s = node.data*node.same
            if node.left != None:
                s += self.sum_bst(node.left)
            if node.right != None:
                s += self.sum_bst(node.right)
            return s

N,M = map(int,input().split())

bst = BST()
for a in list(map(int,input().split())):
    bst.insert(a)
for i in range(M):
    bst.delete_max()
print(bst.sum_bst(bst.root))
Problem p03038 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(M)]
A.sort()
X.sort(key=lambda x:-x[1])

j = 0
for i in range(N):
    if X[j][1] < A[i]:
        break
    else:
        X[j][0] -= 1
        A[i] = X[j][1]
    if X[j][0] == 0:
        j += 1
    if j == M:
        break

print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
CB = {}
for _ in range(M):
    b,c = map(int,input().split())
    if c in CB.keys():
        CB[c] += b
    else:
        CB[c] = b

A.sort()

K = sorted(list(CB.keys()),reverse=True)
L = []
for k in K:
    L += [k]*CB[k]

res = 0
for i in range(min(N,len(L))):
    if L[i] >= A[i]:
        res += L[i]
    else:
        res += sum(A[i:])
        break
else:
    res += sum(A[i+1:])

print(res)
Problem p02819 (python)

Fixed submission:
x = int(input())

while True:
  n = 2
  while x % n != 0 and n <= x/2:
    n += 1
  if n < x/2:
    x += 1
    
  else:
    print(x)
    break

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

for i in range(10^5):
  while x % n != 0 or n =< x/2:
      n += 1
  if n =< x/2:
    x += 1
    
  else:
    print(x)
    break
Problem p02859 (python)

Fixed submission:
print(int(input())**2)

Buggy submission (verdict: Runtime Error):
return int(int(input())**2)

Buggy submission (verdict: Runtime Error):
return int(r**2)

Buggy submission (verdict: Runtime Error):
return int(input()**2)
Problem p03774 (python)

Fixed submission:
import numpy as np

def manhattan(x,y):
    return np.abs(x[0]-y[0]) + np.abs(x[1]-y[1])

N,M = map(int,raw_input().split())
students = np.zeros((N,2))
checkpoints = np.zeros((M,2))
for i in range(N):
    students[i][0],students[i][1] = map(int,raw_input().split())
#print a
for j in range(M):
    checkpoints[j][0],checkpoints[j][1] = map(int,raw_input().split())

index = np.zeros(N)
for i in range(N):
    min = 200000000
    for j in range(M):
        d = manhattan(students[i],checkpoints[j])
        if min > d:
            min = d
            index[i] = j
    print (index[i]+1).astype(np.int32)

Buggy submission (verdict: Runtime Error):
mport numpy as np
N,M = map(int,raw_input().split())
a = []
c = []
for i in range(N):
    a.append(map(int,raw_input().split()))
#print a
for j in range(M):
    c.append(map(int,raw_input().split()))
a = np.array(a)
c = np.array(c)
#print a.shape
#print c.shape
min = 100
index = np.zeros(N)
for i in range(N):
    for j in range(M):
        if min > np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1]):
            min = np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1])
            index[i] = j
        elif min == np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1]):
            if j < index[i]:
                index[i] = j
index = index.astype(np.int32)
for i in range(N):
    print index[i]+1

Buggy submission (verdict: Runtime Error):
mport numpy as np
N,M = map(int,raw_input().split())
a = []
c = []
for i in range(N):
    a.append(map(int,raw_input().split()))
#print a
for j in range(M):
    c.append(map(int,raw_input().split()))
a = np.array(a)
c = np.array(c)
#print a.shape
#print c.shape
min = 100
index = np.zeros(N)
for i in range(N):
    for j in range(M):
        if min > np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1]):
            min = np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1])
            index[i] = j
        if min == np.abs(a[i][0]-c[j][0])+np.abs(a[i][1]-c[j][1]):
            if j < index[i]:
                index[i] = j
index = index.astype(np.int32)
for i in range(N):
    print index[i]+1
Problem p03775 (python)

Fixed submission:
import numpy as np
def F(x,y):
    count = 1
    if x<=y:
        while y >= 10:
            y = y/10
            count += 1
        return count
    else :
        while x >= 10:
            x = x/10
            count += 1
        return count
#print F(1,13)
N = input()
min = 10**10
index = np.zeros(2)
for i in range(np.sqrt(N).astype(np.int32)):
    if N%(i+1) == 0:
       if min > F(i+1,N/(i+1)):
           min = F(i+1,N/(i+1))
           index[0] = i+1
           index[1] = N/(i+1)
       #print i+1, N/(i+1),F(i+1,N/(i+1)), min

print min

Buggy submission (verdict: Runtime Error):
mport numpy as np
def F(x,y):
    count = 1
    if x<=y:
        while y >= 10:
            y = y/10
            count += 1
    if x>y:
        while x >= 10:
            x = x/10
            count += 1
    return count
#print F(1,13)
N = input()
min = 10**10
for i in range(np.sqrt(N).astype(np.int32)):
    if N%(i+1) == 0:
       if min > F(i+1,N/(i+1)):
           min = F(i+1,N/(i+1))
       print i+1

print min
Problem p02661 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict


def main():
    n = int(input().strip())

    diff_a = defaultdict(int)
    diff_b = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        diff_a[a] += 1
        diff_b[b] += 1

    cur = 0
    for i in sorted(diff_a):
        cur += diff_a[i]
        if cur >= n // 2 + 1:
            b1 = i
            break
    cur = 0
    for i in sorted(diff_b, reverse=True):
        cur += diff_b[i]
        if cur >= n // 2 + 1:
            e1 = i
            break

    if n % 2 == 1:
        print(e1 - b1 + 1)
        return

    cur = 0
    for i in sorted(diff_a):
        cur += diff_a[i]
        if cur >= n // 2:
            b2 = i
            break
    cur = 0
    for i in sorted(diff_b, reverse=True):
        cur += diff_b[i]
        if cur >= n // 2:
            e2 = i
            break
    ans = e2 + e1 - (b1 + b2) + 1
    print(ans)


if __name__ == '__main__':
    main()

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


def main():
    n = int(input().strip())

    diff_a = defaultdict(int)
    diff_b = defaultdict(int)
    for _ in range(n):
        a, b = map(int, input().split())
        diff_a[a] += 1
        diff_b[b] += 1

    cur = 0
    for i in sorted(diff_a):
        cur += diff_a[i]
        if cur == n // 2 + 1:
            b1 = i
            break
    cur = 0
    for i in sorted(diff_b, reverse=True):
        cur += diff_b[i]
        if cur == n // 2 + 1:
            e1 = i
            break

    if n % 2 == 1:
        print(e1 - b1 + 1)
        return

    cur = 0
    for i in sorted(diff_a):
        cur += diff_a[i]
        if cur == n // 2:
            b2 = i
            break
    cur = 0
    for i in sorted(diff_b, reverse=True):
        cur += diff_b[i]
        if cur == n // 2:
            e2 = i
            break
    ans = e2 + e1 - (b1 + b2) + 1
    print(ans)


if __name__ == '__main__':
    main()
Problem p02990 (python)

Fixed submission:
import math
mod =1000000000+7

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

def convcal(a,b):
  kekka = (math.factorial(a) //math.factorial(a-b)  ) // math.factorial(b) 
  return kekka

for i in range(1,k+1):
  #print(i)
  #print(k-1,i-1)
  #print(n-k+1,i)
  if n-k+1-i>=0:
    print(convcal(k-1,i-1)% mod * convcal(n-k+1,i) % mod)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math
mod =1000000000+7

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

def convcal(a,b):
  kekka = (math.factorial(a) //math.factorial(a-b)  ) // math.factorial(b) 
  return kekka

for i in range(1,k+1):
  #print(i)
  #print(k-1,i-1)
  #print(n-k-1,i)
  print(convcal(k-1,i-1)*convcal(n-k+1,i) % mod)
Problem p03013 (python)

Fixed submission:
n,m=map(int, input().split())
a=[]
for i in range(m):
  a.append(int(input()))
  

mod=1000000007

dp=[0]*(n+1)
dp[0]=1


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

if m==0:
  dp[1]=1
  for i in range(n-1):
    dp[i+2]=dp[i+1]+dp[i]
  dp[i+2] = dp[i+2] % mod
  print(dp[n])
  exit()

if a[0]==1:
  dp[1]=0
else:
  dp[1]=1



a_i2=0
a_i1=0
a_i=0

for i in range(n-1):
  if i+2 == a[a_i2]:
      a_i2 += 1
      if a_i2 == m:
        a_i2 -= 1
  else:
    if i+1 == a[a_i1]:
      if i == a[a_i]:
        dp[i+2]=0
        a_i += 1
        if a_i == m:
          a_i -= 1
      else:
        dp[i+2]=dp[i]
      a_i1 += 1
      if a_i1 == m:
        a_i1 -= 1
    else:
      if i == a[a_i]:
        dp[i+2]=dp[i+1]
        a_i += 1
        if a_i == m:
          a_i -= 1
      else:
        dp[i+2]=dp[i+1]+dp[i]

  dp[i+2] = dp[i+2] % mod
  #print(dp)

print(dp[n])

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

mod=1000000007

dp=[0]*(n+1)
dp[0]=1
dp[1]=1

a_i2=0
a_i1=0
a_i=0

for i in range(n-1):
  if i+2 == a[a_i2]:
      a_i2 += 1
      if a_i2 == m:
        a_i2 -= 1
  else:
    if i+1 == a[a_i1]:
      if i == a[a_i]:
        dp[i+2]=0
        a_i += 1
        if a_i == m:
          a_i -= 1
      else:
        dp[i+2]=dp[i]
      a_i1 += 1
      if a_i1 == m:
        a_i1 -= 1
    else:
      if i == a[a_i]:
        dp[i+2]=dp[i+1]
        a_i += 1
        if a_i == m:
          a_i -= 1
      else:
        dp[i+2]=dp[i+1]+dp[i]

  dp[i+2] = dp[i+2] % mod
  #print(dp)

print(dp[n])
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
#print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
//print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
//print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)
Problem p02629 (python)

Fixed submission:
def main():
    N = int(input())
    A = [1]
    ret = []
    for _ in range(100):
        A.append(A[-1] * 26)
    for n in range(1, 100):
        # Nは何文字の番号か調べる
        if N > A[n]:
            N -= A[n]
            continue
        N -= 1
        for _ in range(n):
            N, r = divmod(N, 26)
            ret.append(r)
        break
    ret = [chr(ord('a') + x) for x in ret]
    return ''.join(reversed(ret))


print(main())

Buggy submission (verdict: Runtime Error):
N = int(input())
chr_num = 0
list_26 = [26 ** i for i in range(1, 12)]
for i in range(1, 12):
    if (N - sum(list_26[:i - 1])) // (26 ** i) == 0 or \
       ((N - sum(list_26[:i - 1])) == (26 ** i)):
        chr_num = i
        break
for j in range(chr_num):
    if j == 0:
        print(chr(((N - sum(list_26[:chr_num - 1])) % 26) + 96), end='')
    else:
        print(chr(((N - sum(list_26[:j])) // 26) + 97))
print()
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
if W >= S:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
flg = True
for i in range(2 * max(A, C) + 1):
    if i % 2 == 0:
        C -= B
        print('C: ', C)
        if C <= 0:
            flg = False
            print('Yes')
    else:
        A -= D
        if A <= 0:
            flg = False
            print('No')
    if not flg:
        break
Problem p02987 (python)

Fixed submission:
S = input()
if S[0] == S[1] and S[2] == S[3] and len(set(S)) == 2:
    print('Yes')
elif S[0] == S[2] and S[1] == S[3] and len(set(S)) == 2:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2] and len(set(S)) == 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
if S[0] == S[1] and S[2] == S[3] and len(set(S)) == 2:
    print('Yes')
elif S[0] == S[2] and S[1] == S[4] and len(set(S)) == 2:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2] and len(set(S)) == 2:
    print('Yes')
else:
    print('No')
Problem p02627 (python)

Fixed submission:

def main(T):
    if T.lower() == T:
        return "a"
    else:
        return "A"


T = input()
print(main(T))

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
s = Counter(A)
t=[0]*(10**5+1)
for i in range(10**5+1):
    t[i] = s[i]*i
    
for i in range(Q):
    B, C = map(int, input().split())
    num = t[B]//(B)
    t[B] = 0
    t[C] += num*(C)
    print(sum(t))
Problem p02629 (python)

Fixed submission:
N=int(input())
num=0
ans=""
for i in range(1,99):
    if 26**i >= N:
        N-=1
        for j in range(i):
            ans+=chr(97+N%26)
            N//=26
        break
    else:
        N-=26**i
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
num=0
ans=""
for i in range(1,9):
    if 26**i > N:
        N-=1
       for j in range(i):
           ans+=chr(ord("a")+N%26)
           N//=26
       break
    else:
       N-=26**i
print(ans[::-1])
Problem p03775 (python)

Fixed submission:
N=int(input())
for i in range(int(N ** 0.5 + 1),-1,-1):
    if N % i == 0:
        print(len(str(N // i)))
        exit(0)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
for i in range(int(math.sqrt(N))-1,N+1):
    if N%i==0:
        print(len(str(i)))
        exit(0)
Problem p02623 (python)

Fixed submission:
#　変数 n, m, k, arr1, arr2, acum1, acum2, ans

n, m, k = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))

acum1 = [0]
for i in range(n):
    acum1.append(acum1[-1] + arr1[i])
acum2 = [0]
for i in range(m):
    acum2.append(acum2[-1] + arr2[i])

ans = 0
j = m
for i in range(n+1):
    if acum1[i] > k:
        break
    while acum2[j] > k - acum1[i] and j > 0:
        j -= 1
    ans = max(ans, i+j)
print(ans)

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

acum1 = [0]
for i in range(n):
    acum1.append(acum1[-1] + a[i])

acum2 = [0]
for i in range(m):
    acum2.append(acum2[-1]+b[i])
i = 0
ans = 0
j = m
while acum1[i]<=k:
    while acum2[j]>k-acum1[i] and j>0:
        j -= 1
    ans = max(ans,i+j)
    i+=1
print(ans)

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

acum1 = [0]
for i in range(n):
    acum1.append(acum1[-1] + a[i])

acum2 = [0]
for i in range(m):
    acum2.append(acum2[-1]+b[i])
i = 0
ans = 0
j = m
while acum1[i]<k:
    while acum2[j]>k-acum1[i] and j>0:
        j -= 1
    ans = max(ans,i+j)
    i+=1
print(ans)

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

acum1 = [0]
for i in range(n):
    acum1.append(acum1[-1] + a[i])

acum2 = [0]
for i in range(m):
    acum2.append(acum2[-1]+b[i])
i = 0
ans = 0
while acum1[i]<k:
    j = m
    while acum2[j]>k-acum1[i] and j>0:
        j -= 1
    ans = max(ans,i+j)
    i+=1
print(ans)

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

s1 = [0]
for i in range(n):
    s1.append(s1[-1]+a[i])

s2 = [0]
for i in range(m):
    s2.append(s2[-1]+b[i])
ans = 0
for i in range(1,n):
    p = k-s1[i]
    j = 0
    while p-s2[j]>0:
        if p-s2[j]>0:
            p -= s2[j]
            j += 1
        else:
            break
    ans = max(i+j-1,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

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

a = deque(list(map(int,input().split())))
b = deque(list(map(int,input().split())))
cnt = 0
total = 0

while total+a[0] < k or total+b[0] < k:
    if len(a) > 0 and len(b) > 0:
        picked = min(a[0],b[0])
        if picked == a[0]:
            total += a.popleft()
            cnt += 1
        else:
            total += b.popleft()
            cnt += 1
    elif len(a) > 0 and len(b)==0:
        total +=a.popleft()
        cnt += 1
    elif len(b) > 0 and len(a)==0:
        total += b.popleft()
        cnt += 1
print(cnt)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(j) for j in input().split()]

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(j) for j in input().split()]

a, b = [0], [0]
for i in range(N):
    a.append[a[i] + A[i]]
for i in range(M):
    b.append[b[i] + B[i]]

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
Problem p02627 (python)

Fixed submission:
a = input()

if a.islower():
    print('a')
else:
    print('A')

Buggy submission (verdict: Runtime Error):
a = input()
big = range('A', 'Z')

if big.include(a):
    print 'A'
else:
    print 'a'
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int, input().split())
large = (B // K) * K
if A <= large:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().slice())
print("OK" if B - A >= K else "NG")
Problem p02701 (python)

Fixed submission:
n = int(input())   
x = [input() for i in range(n)]
print(len(list(set(x))))

Buggy submission (verdict: Runtime Error):
n = int(input())   
x = [input() for i in range(3)]
print(len(list(set(x))))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
print(list(set(s)).length)
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(n - 1):
    ans[A[i] - 1] += 1
for i in range(n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
i = 0
while i < N:
    num = 0
    for i in len(A):
        if A[i] == i + 1:
            num += 1
    print(num)
Problem p02693 (python)

Fixed submission:
K=int(input())
A, B = map(int, input().split())
a=A//K
b=A%K
c=B%K

if(b==0 or c==0):
  print("OK")
else:
  if(1<a):
    if(a*K<=B):
      print("OK")
    else:
      print("NG")
  else:
    print("NG")

Buggy submission (verdict: Runtime Error):
K=int(input())
A, B = map(int, input().split())
a=A//K
b=A%K
c=B%K

if(b==0 or c==0):
  print("OK")
else:
  if(1<a):
    if(a*K<=B):
      print("OK")
    else:
      print("NG")
  else:
    print("NG")
~
Problem p02754 (python)

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

if(A==0 & B==0):
  print("0")

else:
  r=N//(A+B)
  s=N%(A+B)
  if(A<s):
    s=A
  if(A!=0):
    t=(A*r)+s
  else:
    t=0
  print(t)

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

r=N//(A+B)
s=N%(A+B)

if(B=0):
  t=N//A + N%A

else:
  if(A!=0):
    t=(A*r)+s
  else:
    t=0

print(t)
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
s = ''
if a> b:
    for i in range(a):
        s = s+str(b)
else:
    for i in range(b):
        s = s+str(a)
print(s)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = ''
if a> b:
    for i in range(len(b)):
        s = s+str(a)
else:
    for i in range(len(a)):
        s = s+str(b)
print(s)
Problem p03013 (python)

Fixed submission:
BIG = 10**9+7

N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))


dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp[-1])

Buggy submission (verdict: Runtime Error):
BIG = 10**9+7

N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))

pre = a[0]
dame = False
for i in range(1,len(a)):
    if a[i]==pre:
        dame = True
    pre=a[i]

dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
dp[0]=1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

print(dp)

if dame:
    print(0)
else:
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
BIG = 10**9+7

N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))

pre = a[0]
dame = False
for i in range(1,len(a)):
    if a[i]==pre:
        dame = True
    pre=a[i]

dp = [0 for i in range(N+1)]
for item in a:
    dp[item]=-1
if a[0]!=0:
    dp[0] = 1
if a[0]!=0:
    if (len(a)>1 and a[1]!=0) or a[0]!=1:
        dp[1] = 2

if a[0] == 1:
    dp[1] = 0

for i in range(2,N+1):
    if dp[i]!= -1:
        dp[i] = dp[i-1]+dp[i-2]
        dp[i] = dp[i]%BIG
    else:
        dp[i]=0

#print(dp)

if dame:
    print(0)
else:
    print(dp[-1])

Buggy submission (verdict: Runtime Error):
STR = input().split()
N = int(STR[0])
M = int(STR[1])
Flag = True
a = []
a.append(-1)
for i in range(M):
    a.append(int(input()))
a.append(N+1)

for i in range(M+1):
    if (a[i+1]-a[i]) == 1:
        Flag = False

fib = []
fib.append(1)
fib.append(1)

for i in range(2,N):
    fib.append(fib[i-1] + fib[i-2])

SUM = 1
num = 0
for i in range(1,M+2):
    num = a[i]-1 - (a[i-1] +1)
    #print(a[i]-1)
    #print(a[i-1]+1)
    SUM = SUM * fib[num] % 1000000007
    #print(num)
    
if Flag:
    print(SUM)
else:
    print(0)