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

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
pn = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
      449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
lcm = dict()
mod = 10**9+7
for a in A:
    i = 0
    while a != 1 and i < len(pn):
        c = 0
        n = pn[i]
        while a % n == 0:
            a //= n
            c += 1
        if not n in lcm:
            lcm[n] = 0
        lcm[n] = max(lcm[n], c)
        i += 1
    if a != 1:
        if not a in lcm:
            lcm[a] = 1
l = 1
for n in lcm.keys():
    l *= pow(n, lcm[n], mod)
    l %= mod
ans = 0
for a in A:
    p = pow(a, mod-2, mod)
    ans += (l*p)
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
pn = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
      449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
lcm = dict()
mod = 10**9+7
for a in A:
    i = 0
    while a != 1:
        c = 0
        n = pn[i]
        while a % n == 0:
            a //= n
            c += 1
        if not n in lcm:
            lcm[n] = 0
        lcm[n] = max(lcm[n], c)
        i += 1
l = 1
for n in lcm.keys():
    l *= pow(n, lcm[n], mod)
    l %= mod
ans = 0
for a in A:
    p = pow(a, mod-2, mod)
    ans += (l*p)
    ans %= mod
print(ans)
Problem p02891 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- Coding: utf-8 -*-

import sys


def main():
    S = input()
    K = int(input())
    ary = []
    ans = 0
    n = 1

    for i, s in enumerate(S[1:]):
        if s == S[i]:
            n += 1
        else:
            ary.append(n)
            n = 1
    if n != 1:
        ary.append(n)

    if S[0] == S[-1]:
        for num in ary[1:-1]:
            ans += num//2
        ans *= K
        if len(ary) == 1:
            ans += ary[0]*K//2
        elif len(ary) < 1:
            ans = K//2
        else:
            ans += (ary[0]+ary[-1])//2*(K-1)
            ans += ary[0]//2+ary[-1]//2
    else:
        for num in ary:
            ans += num//2
        ans *= K
    print(ans)


if __name__ == '__main__':
    main()

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

import sys


def main():
    S = input()
    K = int(input())
    ary = []
    ans = 0
    n = 1

    for i, s in enumerate(S[1:]):
        if s == S[i]:
            n += 1
        else:
            ary.append(n)
            n = 1
    if n != 1:
        ary.append(n)

    if S[0] == S[-1]:
        for num in ary[1:-1]:
            ans += num//2
        ans *= K
        if len(ary) == 1:
            ans += ary[0]*K//2
        else:
            ans += (ary[0]+ary[-1])//2*(K-1)
            ans += ary[0]//2+ary[-1]//2
    else:
        for num in ary:
            ans += num//2
        ans *= K
    print(ans)


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

Fixed submission:
import sys
n = [int(i) for i in input().split()]
a = []
for i in range(n[1]):
    a.append(int(input()))

a.append(n[0]+1)
a = sorted(list(set(a)))


def k(i):
    ans = 1
    pri = 0
    for idx in range(i):
        tmp = ans
        ans += pri
        pri = tmp
    return ans


for i in range(1, len(a)):
    if a[i]-a[i-1] == 1:
        print(0)
        sys.exit()
j = -1
ans = 1
for i in a:
    ii = i-j-2
    ans = ans*k(ii)
    j = i
if len(a) == 1:
    ans = k(n[0])
print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
    import sys
    n = [int(i) for i in input().split()]
    a = []
    for i in range(n[1]):
        a.append(int(input()))
     
    a.append(n[0]+1)
    a = sorted(list(set(a)))
     
     
    def k(i):
        ans = 1
        pri = 0
        for idx in range(i):
            tmp = ans
            ans += pri
            pri = tmp
        return ans
     
     
    for i in range(1, len(a)):
        if a[i]-a[i-1] == 1:
            print(0)
            sys.exit()
    j = -1
    ans = 1
    for i in a:
        ii = i-j-2
        ans = ans*k(ii)
        j = i
    if len(a) == 1:
        ans = k(n[0])
    print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
import sys
n = [int(i) for i in input().split()]
a = []
for i in range(n[1]):
    a.append(int(input()))

a.append(n[0]+1)
a = sorted(list(set(a)))


def k(i):
    if i <= 1:
        return 1
    elif i == 2:
        return 2
    else:
        return k(i-2)+k(i-1)


for i in range(1, len(a)):
    if a[i]-a[i-1] == 1:
        print(0)
        sys.exit()
j = -1
ans = 1
for i in a:
    ii = i-j-2
    ans = ans*k(ii)
    j = i
if len(a) == 1:
    ans = k(n[0])
print(ans % 1000000007)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
print(reduce(gcd, A))

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


N = int(input())
A = [int(i) for i in input().split()]
print(reduce(math.gcd, A))
Problem p02546 (python)

Fixed submission:
s = input()
p = ""

if(s.endswith("s")):
  p = s + "es"
else:
  p = s + "s"

print(p)

Buggy submission (verdict: Runtime Error):
s = input()
p = ""

if(s.endswith("s")){
  p = s + "es"
}else{
  p = s + "s"
}

print(s)
Problem p02547 (python)

Fixed submission:
n=int(input())
flag=0
for i in range(n):
  a=list(map(int,input().split()))
  if a[0]==a[1]:
    flag+=1
  else:
    flag=0
  if flag==3:
    break
if flag==3:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(intpu())
flag=0
for i in range(n):
  a=list(map(int,input().split()))
  if a[0]==a[1]:
    flag+=1
  else:
    flag=0
  if flag==3:
    break
if flag==3:
  print("Yes")
else:
  print("No")
Problem p02860 (python)

Fixed submission:
N=int(input())
S=input()
ans="No"
if N%2==0:
  first=S[:int(N/2)]
  last=S[int(N/2):]
  if first==last:
    ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
and="No"
if N%2==0:
  first=S[:int(N/2)]
  last=S[int(N/2):]
  if first==last:
    ans="Yes"
print(ans)
Problem p02970 (python)

Fixed submission:
nd=list(map(int,input().split()))
ans=nd[0]//(2*nd[1]+1)
if nd[0]%(2*nd[1]+1)!=0:
  ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
nd=list(map(int,input().split()))
ans=nd[0]//(2*nd[1]+1)
if nd%(2*nd[1]+1)!=0:
  ans+=1
print(ans)
Problem p03013 (python)

Fixed submission:
lis=list(map(int,input().split()))
alist=[0]*(lis[0]+1)
for i in range(lis[1]):
    a=int(input())
    alist[a]=1
steps=[0]*(lis[0]+2)
steps[1]=1
mod=(10**9)+7
for i in range(2,lis[0]+2):
    if alist[i-1]==0:
        steps[i]=(steps[i-1]+steps[i-2])%mod
ans=steps[-1]
print(ans)

Buggy submission (verdict: Runtime Error):
lis=list(map(int,input().split()))
alist=[]
for i in range(lis[1]):
    alist.append(int(input()))
flag=0
ans=0
steps=[0]*(lis[0]+1)
if 1 in alist:
    steps[1]=0
    steps[2]=1
elif 2 in alist:
    steps[1]=1
    steps[2]=0
else:
    steps[1]=1
    steps[2]=2
for i in range(3,lis[0]+1):
    if i not in alist:
        steps[i]=(steps[i-1]+steps[i-2])%((10**9)+7)
ans=steps[-1]

print(ans)

Buggy submission (verdict: Runtime Error):
lis=list(map(int,input().split()))
alist=[-1]
for i in range(lis[1]):
    alist.append(int(input()))
alist.append(lis[0]+1)
flag=0
ans=0
for i in range(lis[1]):
    if alist[i+1]-alist[i]==1:
        flag=1
        break
if flag==0:
    steps=[0]*(lis[0]+1)
    if 1 in alist:
        steps[1]=0
        steps[2]=1
    elif 2 in alist:
        steps[1]=1
        steps[2]=1
    else:
        steps[1]=1
        steps[2]=2
    for i in range(3,lis[0]+1):
        if i in alist:
            steps[i]=steps[i-1]
            flag=2
        elif flag==2:
            steps[i]=steps[i-1]
            flag=3
        elif flag==3:
            steps[i]=steps[i-1]
            flag=0
        else:
            steps[i]=(steps[i-1]+steps[i-2])%((10**9)+7)
    ans=steps[-1]

print(ans)
Problem p03775 (python)

Fixed submission:
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#li=input().split()
#S=input()
#lis=list(map(int,input().split()))

n=int(input())

A=[0]
i=1
while i<=math.sqrt(n):
    if n%i==0:
        A.append(i)
    i+=1
B=[0]
s=[]
for i in range(len(A)-1):
    j=int(n/A[i+1])
    B.append(j)
    a=len(str(A[i+1]))
    b=len(str(B[i+1]))
    s.append(max(a,b))
ans=min(s)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=len(str(n))
from math import floor,sqrt
s=floor(sqrt(n))
f=[]
for i in range(2,1+s):
  if n%i==0:
    while True:
      f.append(i)
      n=n//i
      if n%i!=0:
        break
itr=2**(len(f))-1
l=len(f)
for i in range(2**(len(f)-1)):
  itr+=1
  litr=str(bin(itr))[3:]
  a,b=1,1
  for j in range(l):
    if litr[j]=="0":
      a*=f[j]
    else:
      b*=f[j]
    t=max(len(str(a)),len(str(b)))
    if t<ans:
      ans=t
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=len(str(n))
from math import floor,sqrt
s=floor(sqrt(n))
f=[]
for i in range(2,1+s):
  if n%i==0:
    while True:
      f.append(i)
      n=n//i
      if n%i!=0:
        break
itr=2**(len(f))-1
l=len(f)
for i in range(2**(len(f-1))):
  itr+=1
  litr=str(bin(itr))[3:]
  a,b=1,1
  for j in range(l):
    if litr[j]=="0":
      a*=f[j]
    else:
      b*=f[j]
    t=max(len(str(a)),len(str(b)))
    if t<ans:
      ans=t
print(ans)
Problem p02552 (python)

Fixed submission:
print(abs(int(input())-1))

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

print((10 ** N - 2 * 9 ** N + 8 ** N % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
print((10 ** int(input()) - 2 * 9 ** int(input()) + 8 ** int(input())) % (10 ** 9 + 7))
Problem p02570 (python)

Fixed submission:
D, T, S = map(int, input().split())

if T * S >= D:
	print("Yes")
else:
	print("No")

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

x = sum(A)
y = sum([A[i] ** 2 for i in range(N)])

print(((x ** 2 - y) // 2) % (10 ** 9 + 7))
Problem p02571 (python)

Fixed submission:
S, T = [input() for _ in range(2)]
answer = 1001

for i in range(len(S) - len(T) + 1):
	k = 0
	U = S[i:i + len(T)]
	for j in range(len(T)):
		if T[j] != U[j]:
			k += 1
	answer = min(answer, k)
print(answer)

Buggy submission (verdict: Runtime Error):
S, T = [input() for _ in range(2)]
answer = 1001

for i in range(len(S) - len(T) + 1):
	k = 0
	U = S[i:i + len(T)]
	for j in range(len(T)):
		if T(j) != U(j):
			k += 1
	answer = min(answer, k)
print(answer)
Problem p02572 (python)

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

x = sum(A)
y = sum([A[i] ** 2 for i in range(N)])

print(((x ** 2 - y) // 2) % (10 ** 9 + 7))

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

x = sum(A)
y = sum([A[i] ** 2 for i in range(n)])

print(((x ** 2 - y) / 2) % (10 ** 9 + 7))
Problem p02723 (python)

Fixed submission:
list=input().rstrip()
if list[2]==list[3] and list[4]==list[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
list=input().rstrip
if list[2]==list[3] and list[4]==list[5]:
	print("Yes")
else:
	print("No")
Problem p02711 (python)

Fixed submission:
N = input()
if '7' in N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = str(input())
if '7' in N:
  print('Yes'):
else:
  print('No')
Problem p02723 (python)

Fixed submission:
N = input()
N = str(N)
if (N[2] == N[3]) and (N[4] == N[5]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
if (N[2] == N[3]) and (N[4] == N[5]):
  return True
else:
  return False
Problem p02577 (python)

Fixed submission:
a=input()
ans=0
for i in a:
  ans = (ans+int(i))%9
print(["Yes","No"][ans>0])

Buggy submission (verdict: Runtime Error):
a=input()
ans=0
for i in a:
  ans = (ans+int(i))%9
print(["Yes","No"][ans])
Problem p03250 (python)

Fixed submission:

a,b,c=map(int,input().split())
if a<b:
  a,b=b,a
if b<c:
  b,c=c,b
if a<b:
  a,b=b,a
print(10*a+b+c)

Buggy submission (verdict: Runtime Error):
a,b,c=input()
if a<b:
  a,b=b,a
if b<c:
  b,c=c,b
if a<b:
  a,b=b,a
print(10*a+b+c)
Problem p02598 (python)

Fixed submission:
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,k = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    l = 1
    r = 10**9+1
    while l != r:
        mid = l+(r-l)//2
        nm = 0
        for i in a:
            nm += (i-1)//mid
        if nm > k:
            l = mid+1
        else:
            r = mid

    print(r)

    return None

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,k = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    l = 0
    r = 10**9+1
    while l != r:
        mid = l+(r-l)//2
        nm = 0
        for i in a:
            nm += (i-1)//mid
        if nm > k:
            l = mid+1
        else:
            r = mid

    print(r)

    return None

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

Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a = input()
    if a.isupper():
        print("A")
    else:
        print("a")

    return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a = input()
    if a.isupper():
        print(A)
    else:
        print(a)

    return

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

Fixed submission:
import numpy as np
import math
n, m, q = map(int,input().split())
max = 0
j = []
for i in range(q):
    aa,b,c,d = map(int,input().split())
    j.append([aa,b,c,d])

a = [0 for k in range(11)]
for i1 in range(1,11):
    a[1] = i1
    for i2 in range(i1,m+1):
        a[2] = i2
        for i3 in range(i2,m+1):
            a[3] = i3
            for i4 in range(i3,m+1):
                a[4] = i4
                for i5 in range(i4,m+1):
                    a[5] = i5
                    for i6 in range(i5,m+1):
                        a[6] = i6
                        for i7 in range(i6,m+1):
                            a[7] = i7
                            for i8 in range(i7,m+1):
                                a[8] = i8
                                for i9 in range(i8,m+1):
                                    a[9] = i9
                                    for i10 in range(i9,m+1):
                                        a[10] = i10
                                        s = 0
                                        for i in j:
                                            if a[i[1]]-a[i[0]] == i[2]:
                                                s += i[3]
                                        if max < s:
                                            max = s

print(max)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
n, m, q = map(int,input().split())
max = 0
j = []
for i in range(q):
    aa,b,c,d = map(int,input().split())
    j.append([aa,b,c,d])

a = [0 for k in range(11)]
for i1 in range(1,11):
    a[1] = i1
    for i2 in range(i1,11):
        a[2] = i2
        for i3 in range(i2,11):
            a[3] = i3
            for i4 in range(i3,11):
                a[4] = i4
                for i5 in range(i4,11):
                    a[5] = i5
                    for i6 in range(i5,11):
                        a[6] = i6
                        for i7 in range(i6,11):
                            a[7] = i7
                                for i8 in range(i7,11):
                                a[8] = i8
                                    for i9 in range(i8,11):
                                    a[9] = i9
                                        for i10 in range(i9,11):
                                        a[10] = i10
                                        s = 0
                                        for i in j:
                                            if a[i[1]]-a[i[0]] = i[2]:
                                                s += i[3]
                                        if max < s:
                                            max = s

print(max)
Problem p02707 (python)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
buka = [0 for i in range(n)]

for i in a:
    buka[i-1] += 1

for i in buka:
    print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(input().split())
buka = [0 for i in range(n)]

for i in a:
    buka[i] += 1

for i in buka:
    print(i)
Problem p02711 (python)

Fixed submission:
n = str(input())
if n[0] == "7" or n[1] == "7" or n[2] == "7":
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
if not n[0] == 7 and n[1] == 7 and n[2] == 7:
    print(No)
else:
    print(Yes)
Problem p02726 (python)

Fixed submission:
n, x, y = map(int,input().split())
num = [0 for i in range(n)]

for i in range(1,n+1):
    for j in range(i+1,n+1):
        ban = min([j-i,abs(x-i)+1+abs(y-j)])
        num[ban] += 1

for i in range(1,n):
    print(num[i])

Buggy submission (verdict: Runtime Error):
import math
n, x, y = map(int,input().split())
num = [0 for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        num[min([j-i,math.fabs(j-y)+1+math.fabs(i-x)])] += 1

for i in range(n):
    print(num[i])

Buggy submission (verdict: Runtime Error):
import math
n, x, y = map(int,input().split())
num = [0 for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        num[min([j-i,math.fabs(j-y)+1+math.fabs(i-x)] += 1

for i in range(n):
    print(num[i])

Buggy submission (verdict: Runtime Error):
import math
n, x, y = map(int,input().split())
num = [0 for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        num[min([j-i,math.fabs(j-y)+1+math.fabs(i-x))] += 1

for i in range(n):
    print(num[i])
Problem p02753 (python)

Fixed submission:
s = input()
if "A" in s and "B" in s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, a, b = map(int,input().split())
print((n//(a+b))*a+min([a,n%(a+b)]))
Problem p02832 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
now = 1
for i in range(n):
    if a[i] == now:
        now += 1
if now == 1:
    print(-1)
else:
    print(n-now+1)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
a = list(map(int,input().split()))
now = 1
for i in range(n):
    if a[i] == now:
        now += 1
if now == 1:
    print(-1)
else:
    print(n-now+1)
Problem p02879 (python)

Fixed submission:
a,b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  prit(-1)
Problem p03015 (python)

Fixed submission:
l = str(input())
ll = len(l)
mod = 10**9+7

ans = 0
t1 = 0
for i in range(ll):
    if l[i] == "0":
        continue
    ans = (ans+pow(2,t1,mod)*pow(3,ll-i-1,mod)%mod)%mod
    t1 += 1

ans = (ans+pow(2,t1,mod))%mod

print(ans)

Buggy submission (verdict: Runtime Error):
l = input()
mod = 10**9+7

def dfs(ni,t1,na):
    if ni == len(l):
        return (na+pow(2,t1,mod))%mod
    if l[ni] == "0":
        return dfs(ni+1,t1,na)
    else:
        na = (na+pow(2,t1,mod)*pow(3,len(l)-1-ni,mod)%mod)%mod
        return dfs(ni+1,t1+1,na)

ans=dfs(0,0,0)

print(ans)
Problem p03822 (python)

Fixed submission:
import sys
import resource
n = int(input())
sys.setrecursionlimit(10**5)

wl = [[] for i in range(n+1)]

for i in range(2,n+1):
    ai = int(input())
    wl[ai].append(i)

dp = [-1 for i in range(n+1)]

def calc_dp(a):
    if len(wl[a]) == 0:
        return 0
    else:
        dps = []
        for i in wl[a]:
            dps.append(calc_dp(i))
        dps.sort(reverse=True)
        ma = 0
        for i,dpi in enumerate(dps):
            if ma < dpi+i:
                ma = dpi+i
        return ma+1

print(calc_dp(1))

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

wl = [[] for i in range(n+1)]

for i in range(2,n+1):
    ai = int(input())
    wl[ai].append(i)

dp = [-1 for i in range(n+1)]

def calc_dp(a):
    if len(wl[a]) == 0:
        return 0
    else:
        dps = []
        for i in wl[a]:
            dps.append(calc_dp(i))
        dps.sort(reverse=True)
        ma = 0
        for i,dpi in enumerate(dps):
            if ma < dpi+i:
                ma = dpi+i
        return ma+1

print(calc_dp(1))
Problem p02546 (python)

Fixed submission:
s = input()
print(s+('es' if s[-1] == 's' else 's'))

Buggy submission (verdict: Runtime Error):
print(input().strip()+('es' if s[-1] == 's' else 's'))

Buggy submission (verdict: Runtime Error):
print(input()+('es' if s[-1] == 's' else 's'))