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

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[]
for i in range(n):
    l.append([1,a[i]])
for i in range(m):
    l.append(list(map(int,input().split())))
l.sort(key=lambda x:x[1], reverse=True)
c=0
ans=0
for i in range(n+m):
    ans+=l[i][1]*l[i][0]
    c+=l[i][0]
    if c>n:
        ans-=l[i][1]*(c-n)
        break
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[]
for i in range(m):
    b,c=map(int,input().split())
    bc.append([b,c])
bc.sort(key=lambda x:x[1],reverse=True)
x=[0]*(m+3)
for i in range(m):
    x[i+1]=min(bisect.bisect_left(a,bc[i][1]), bc[i][0])+x[i]
    for j in range(x[i],x[i+1]+1):
        a[j]=bc[i][1]


print(sum(a))

Buggy submission (verdict: Runtime Error):
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[]
for i in range(m):
    b,c=map(int,input().split())
    bc.append([b,c])
bc.sort(key=lambda x:x[1],reverse=True)
x=[0]*(m+3)
for i in range(m):
    x[i+1]=min(bisect.bisect_left(a,bc[i][1]), bc[i][0])+x[i]
    for j in range(x[i],x[i+1]):
        a[j]=bc[i][1]


print(sum(a))

Buggy submission (verdict: Runtime Error):
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
bc=[]
for i in range(m):
    b,c=map(int,input().split())
    bc.append([b,c])
bc.sort(key=lambda x:x[1],reverse=True)
x=[0]*n
for i in range(m):
    x[i+1]=min(bisect.bisect_left(a,bc[i][1]), bc[i][0])+x[i]
    for j in range(x[i],x[i+1]):
        a[j]=bc[i][1]
    

print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=sum(a)
l=[]
for i in range(m):
    b,c=map(int,input().split())
    l.append((b,c))
l.sort(key=lambda x:x[1],reverse=True)
x=[]
for i in range(m):
    xx=[l[i][1]]*l[i][0]
    x.extend(xx)
c=0
while a[c]<x[c] :
    ans+=x[c]-a[c]
    c+=1
    if c>=len(a):
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=sum(a)
l=[]
for i in range(m):
    b,c=map(int,input().split())
    l.append((b,c))
l.sort(key=lambda x:x[1],reverse=True)
x=[]
for i in range(m):
    xx=[l[i][1]]*l[i][0]
    x.extend(xx)
c=0
while a[c]<x[c]:
    ans+=x[c]-a[c]
    c+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=sum(a)
l=[]
for i in range(m):
    b,c=map(int,input().split())
    l.append((b,c))
l.sort(key=lambda x:x[1],reverse=True)
x=[]
for i in range(m):
    xx=[l[i][1]]*l[i][0]
    x.extend(xx)
c=0
while a[c]<x[c]:
    ans+=x[c]-a[c]
    c+=1
print(ans)
Problem p03053 (python)

Fixed submission:
from collections import deque
h,w=map(int,input().split())
a=[input() for _ in range(h)]
dxy=[(0,1),(1,0),(-1,0),(0,-1)]
inf=float("inf")

dp=[[inf]*w for _ in range(h)]
q=deque()

for y,l in enumerate(a):
    for x,c in enumerate(l):
        if c=="#":
            dp[y][x]=0
            q.append((x,y))
ans=0
while q:
    x,y=q.popleft()
    d=dp[y][x]
    for dx,dy in dxy:
        nx,ny=x+dx,y+dy
        if not 0<=nx<w: continue
        if not 0<=ny<h: continue
        if dp[ny][nx]<=d+1: continue
        dp[ny][nx]=d+1
        q.append((nx,ny))
        ans=max(ans,d+1)
print(ans)

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

from collections import deque
d = [(1,0),(0,1),(-1,0),(0,-1)]
l = deque()
for i in range(H):
    for j in range(W):
        if a[i][j]=="#":
            l.append((j,i))
            a[i][j] = 0
            while l:
                x,y = l.popleft()
            for o,p in d:
                if y+p<0 or y+p>=H or x+o<0 or x+o>=W:
                    continue
                if a[y+p][x+o] == ".":
                    a[y+p][x+o] = a[y][x] + 1
                    l.append((x+i,y+j))
for k in range(3):
    for i in range(H):
        for j in range(W):
            if a[i][j]==k:
                l.append((j,i))
                while l:
                    x,y = l.popleft()
                for o,p in d:
                    if y+p<0 or y+p>=H or x+o<0 or x+o>=W:
                        continue
                    if a[y+p][x+o] == ".":
                        a[y+p][x+o] = a[y][x] + 1
                        l.append((x+i,y+j))

aa=[flatten for inner in a for flatten in inner]
print(max(aa))

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

from collections import deque
d = [(1,0),(0,1),(-1,0),(0,-1)]
l = deque()
for i in range(H):
    for j in range(W):
        if a[i][j]=="#":
            l.append((j,i))
            a[i][j] = 0
            while l:
                x,y = l.popleft()
            for o,p in d:
                if y+p<0 or y+p>=H or x+o<0 or x+o>=W:
                    continue
                if a[y+p][x+o] == ".":
                    a[y+p][x+o] = a[y][x] + 1
                    l.append((x+i,y+j))
for k in range(5):
    for i in range(H):
        for j in range(W):
            if a[i][j]==k:
                l.append((j,i))
                while l:
                    x,y = l.popleft()
                for o,p in d:
                    if y+p<0 or y+p>=H or x+o<0 or x+o>=W:
                        continue
                    if a[y+p][x+o] == ".":
                        a[y+p][x+o] = a[y][x] + 1
                        l.append((x+i,y+j))

aa=[flatten for inner in a for flatten in inner]
print(max(aa))
Problem p03631 (python)

Fixed submission:
n=str(input())

if n[0]==n[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=(int(x) for x in input().split())

if b<=c or d<=a:
    print(0)
else:
    print(min(b,d)-max(a,c))

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

if n[0]=n[2]:
    print("Yes")
else:
    print("No")
Problem p03634 (python)

Fixed submission:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n=int(input())
g=[[]for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    a,b=a-1,b-1
    g[a].append((b,c))
    g[b].append((a,c))


q,k=map(int,input().split())
k-=1

dist=[float("inf")]*n
dist[k]=0
def dfs(s):
    for v,c in g[s]:
        if dist[v]==float("inf"):
            dist[v]=dist[s]+c
            dfs(v)


dfs(k)

for _ in range(q):
    x,y=map(int,input().split())
    x,y=x-1,y-1
    print(dist[x]+dist[y])

Buggy submission (verdict: Runtime Error):
import sys, scipy
import numpy as np
from scipy.sparse import csr_matrix, isspmatrix_csr, isspmatrix_csc, isspmatrix
from scipy.sparse.csgraph._shortest_path import shortest_path
n=int(input())

g=[[0]*n for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    a,b=a-1,b-1
    g[a][b]=c
    g[b][a]=c

G=csr_matrix(g)

q,k=map(int,input().split())
k-=1
d=shortest_path(G, method="D", indices=k)

for _ in range(q):
    x,y=map(int,input().split())
    x,y=x-1,y-1
    print(int(d[x]+d[y]))

Buggy submission (verdict: Runtime Error):
import sys, scipy
import numpy as np
from scipy.sparse import csr_matrix, isspmatrix_csr, isspmatrix_csc, isspmatrix
from scipy.sparse.csgraph._shortest_path import shortest_path
n=int(input())

g=[[0]*n for _ in range(n)]
for _ in range(n-1):
    a,b,c=map(int,input().split())
    a,b=a-1,b-1
    g[a][b]=c
    g[b][a]=c

G=csr_matrix(g)

q,k=map(int,input().split())
k-=1
d=shortest_path(G, method="D", indices=k)

for _ in range(q):
    x,y=map(int,input().split())
    x,y=x-1,y-1
    print(int(d[x]+d[y]))
Problem p03775 (python)

Fixed submission:
n=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
l=make_divisors(n)
print(len(str(max(l[len(l)//2],l[len(l)//2-1]))))

Buggy submission (verdict: Runtime Error):
l=make_divisors(n)
Problem p03803 (python)

Fixed submission:
a,b = (int(x) for x in input().split())

if a==1:
    a=14
if b==1:
    b=14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
a,b = (int(x) for x in input.split())

if a==1:
    a=14
if b==1:
    b=14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
a,b = (int(x) for in input.split())

if a==1:
    a=14
if b==1:
    b=14

if a>b:
    print("Alice")
elif a<b:
    print("Bob")
else:
    print("Draw")
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        x=[]
        for k in range(m):
            x.append(a[i+k][j:j+m])
        if x==b:
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        x=[]
        for k in range(m):
            x.append(a[i+k][j+m])
        if x==b:
            print("Yes")
            exit()
print("No")
Problem p03834 (python)

Fixed submission:
s = input()
ss = s.replace("," , " ")
print(ss)

Buggy submission (verdict: Runtime Error):
s=input()
s[7]=" "
s[15]=" "
print(s)

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

s.raplace(","," ")
print(s)

Buggy submission (verdict: Runtime Error):
str(s)
s=input()

s.raplace(","," ")
print(s)

Buggy submission (verdict: Runtime Error):
s=str(input())
s.raplace(","," ")
print(s)

Buggy submission (verdict: Runtime Error):
s=str(input())
s[5]=" "
s[13]=" "
print(s)
Problem p02897 (python)

Fixed submission:
N = int(input())
if N%2 == 1:
  ans = (N//2+1)/N
else:
  ans = 0.5
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N%2 == 1:
  ans = (N//2+1)/(N//2)
else:
  ans = 0.5
print(ans)
Problem p02916 (python)

Fixed submission:
N = int(input())
A_list = list(map(int,input().split()))
B_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))
ans = sum(B_list)

for i in range(1,N):
    
    if A_list[i] == A_list[i-1]+1 :
        ans += C_list[A_list[i]-2]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int,input().split()))
B_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))
ans = sum(B_list)

for i in range(1,N):
    
    if A_list[i] == A_list[i-1]+1 :
        ans += C_list[i]
print(ans)
Problem p02990 (python)

Fixed submission:



N,K= map(int,input().split())
mod = 10**9+7
def comb(n,k):
  """power_funcを用いて(nCk) mod p を求める"""
  p = 10**9+7
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
R = N-K


for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
#    print(R,i)
    b_div = comb(K-1,i-1)%mod
    # RED
#    if (R+1)<i:
#        print('0')
#    else:
    r_div = comb(R+1,i)%mod
#        if i == K+1:
#            r_div += comb(R+1,i+1)%mod
        
#        print(b_div,r_div)
    print(int(b_div*r_div)%mod)

Buggy submission (verdict: Runtime Error):

from scipy.misc import comb
# a = comb(n, r)
#a = comb(n, r, exact=True)

N,K= map(int,input().split())
mod = 10**9+7
#def comb(n, k):
#    m = 1
#    if n< k:
#        m= 0
#    if n < 2 * k:
#        k = n - k
#    for i in range(1, k + 1):
#        m = m * (n - i + 1) / i  %mod  
#    return int(m)
#print(comb(1,2))
R = N-K


for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
#    print(R,i)
    b_div = comb(K-1,i-1)%mod
    # RED
#    if (R+1)<i:
#        print('0')
#    else:
    r_div = comb(R+1,i)%mod
#        if i == K+1:
#            r_div += comb(R+1,i+1)%mod
        
#        print(b_div,r_div)
    print(int(b_div*r_div)%mod)

Buggy submission (verdict: Runtime Error):

from scipy.special import comb
# a = comb(n, r)
#a = comb(n, r, exact=True)

N,K= map(int,input().split())
mod = 10**9+7
#def comb(n, k):
#    m = 1
#    if n< k:
#        m= 0
#    if n < 2 * k:
#        k = n - k
#    for i in range(1, k + 1):
#        m = m * (n - i + 1) / i  %mod  
#    return int(m)
#print(comb(1,2))
R = N-K


for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
#    print(R,i)
    b_div = comb(K-1,i-1)%mod
    # RED
#    if (R+1)<i:
#        print('0')
#    else:
    r_div = comb(R+1,i)%mod
#        if i == K+1:
#            r_div += comb(R+1,i+1)%mod
        
#        print(b_div,r_div)
    print(int(b_div*r_div)%mod)

Buggy submission (verdict: Runtime Error):


N,K= map(int,input().split())
mod = 10**9+7
def comb(n, k):
    m = 1
    if n < 2 * k:
        k = n - k
    for i in range(1, k + 1):
        m = m * (n - i + 1) / i    
    return int(m)

R = N-K

for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
    b_div = comb(K-1,i-1)%mod
    # RED
    r_div = comb(R+1,i)%mod
    if i == K+1:
        r_div += comb(R+1,i+1)%mod
    
#    print(b_div,r_div)
    print((b_div*r_div)%mod)
Problem p03209 (python)

Fixed submission:
N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
def dfs(N,X):
    #print(N,X)
    if N == 0:
        return 0 if X != 1 else 1
    elif X <= 1 + a[N-1]:
        return dfs(N-1, X-1)
    elif X == 2 + a[N-1]:
        return p[N-1] + 1
    elif X <= 2 + 2*a[N-1]:
        return p[N-1] + 1 + dfs(N-1, X-2-a[N-1])
    else:
        return 2*p[N-1]+1
    
print(dfs(N,K))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
def dfs(N,X):
    if N == 0:
        return 0 
    elif X <= 1 + a[N-1]:
        return dfs(N-1, X-1)
    elif X == 2 + a[N-1]:
        return p[N-1] + 1
    elif X <= 2 + 2*a[N-1]:
        return p[N-1] + 1 + dfs(N-1, X-2-a[N-1])
    else:
        2*p[N-1]+1
    
print(dfs(N,K))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)

a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
def dfs(N,X):
    if N == 0:
        return 0 
    elif X <= 1 + a[N-1]:
        return dfs(N-1, X-1)
    elif X == 2 + a[N-1]:
        return p[N-1]
    elif X <= 2 + 2*a[N-1]:
        return p[N-1] + 1 + dfs(N-1, X-2-a[N-1])
    else:
        2*p[N-1]+1
    
print(dfs(N,K))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
import sys
sys.setrecursionlimit(10000000)
def dfs(cur):
    if cur == 0:
        return 'p'
    l_1 = dfs(cur-1)
    if len(l_1) >= K:
        l_1 = l_1[:K]
    barger = 'b' + l_1 + 'p' + l_1 + 'b'
    return barger
ans = dfs(N)[:K].count('p')
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
def dfs(cur):
    if cur == 0:
        return 'p'
    l_1 = dfs(cur-1)
    barger = 'b' + l_1 + 'p' + l_1 + 'b'
    return barger
ans = dfs(N)[:K].count('p')
print(ans)
Problem p02689 (python)

Fixed submission:
h, m =map(int,input().strip().split())

height=list(map(int,input().strip().split()) )
lst=[1]*h

for i in range(m):
    a,b=map(int,input().strip().split())
    if height[a-1]>height[b-1]:
        lst[b-1]=0
    elif height[a-1]<height[b-1]:
        lst[a-1]=0
    else:
        lst[b - 1] = 0
        lst[a - 1] = 0

print(lst.count(1))

Buggy submission (verdict: Runtime Error):
height=list(map(int,input().strip().split()) )
lst=[1]*h

for i in range(m):
    a,b=map(int,input().strip().split())
    if height[a-1]>height[b-1]:
        lst[a-1]=1
        lst[b-1]=0
    elif height[a-1]<height[b-1]:
        lst[b-1]=1
        lst[a-1]=0
    else:
        lst[b - 1] = 0
        lst[a - 1] = 0
print(lst.count(1))
Problem p02689 (python)

Fixed submission:
#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(M):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))

Buggy submission (verdict: Runtime Error):
#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(N):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))

Buggy submission (verdict: Runtime Error):
#ABC166d
N, M = map(int,input().split())
H = list(map(int, input().split()))
count=[0]*M
A = [0]*M
B = [0]*M

for i in range(M):
    A[i], B[i] = map(int, input().split())

ans = [1]*N

for i in range(N):
    if H[A[i]-1] == H[B[i]-1]:
        ans[A[i]-1] = 0
        ans[B[i]-1] = 0
    elif H[A[i]-1] > H[B[i]-1]:
        ans[B[i]-1] = 0
    elif H[A[i]-1] < H[B[i]-1]:
        ans[A[i]-1] = 0
print(sum(ans))
Problem p02754 (python)

Fixed submission:
n, a, b = [int(i) for i in input().split()]
l = min(n % (a+b),a)
s = n // (a+b)
print(s*a+l)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
ans = []
flag = False

while flag is False:
    ans += [1]*a
    ans += [0]*b
    if len(ans) > n:
        flag = True
        #print(ans)
print(sum(ans[:n]))
Problem p02820 (python)

Fixed submission:
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = list(input())
score = 0
for i in range(k):
    if t[i] == "r":
        score += p
    elif t[i] == "s":
        score += r
    else:
        score += s
 
for i in range(k, len(t)):
    if t[i] != t[i-k]:
        if t[i] == "r":
            score += p
        elif t[i] == "s":
            score += r
        else:
            score += s
    else:
        t[i] = ""
 
print(score)

Buggy submission (verdict: Runtime Error):
# d
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
point = 0
for i in range(k):
    if t[i] == 'r':
        point += p
    elif t[i] == 's':
        point += r
    else:
        point += s

for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
    else:
        t[i] = ''

print(point)

Buggy submission (verdict: Runtime Error):
# d
n, k = [int(i) for i in input().split()]
r, s, p = [int(i) for i in input().split()]
t = np.array(list(input()))
point = 0
for i in range(k):
    if t[i] == 'r':
        point += p
    elif t[i] == 's':
        point += r
    else:
        point += s

for i in range(k, n):
    if t[i] != t[i-k]:
        if t[i] == 'r':
            point += p
        elif t[i] == 's':
            point += r
        else:
            point += s
    else:
        t[i] = ""

print(point)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = list(input())
score = 0
for i in range(k):
    if t[i] == "r":
        score += p
    elif t[i] == "s":
        score += r
    else:
        score += s
 
for i in range(k, len(t)):
    if t[i] != t[i-k]:
        if t[i] == "r":
            score += p
        elif t[i] == "s":
            score += r
        else:
            score += s
    else:
        t[i] = ""
 
print(score)
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = list(input())
score = 0
for i in range(k):
    if t[i] == "r":
        score += p
    elif t[i] == "s":
        score += r
    else:
        score += s

for i in range(k, len(t)):
    if t[i] != t[i-k]:
        if t[i] == "r":
            score += p
        elif t[i] == "s":
            score += r
        else:
            score += s
    else:
        t[i] = ""

print(score)
Problem p02831 (python)

Fixed submission:

x, y = input().split()
x = int(x)
y = int(y)
if x < y:
    a = y
    b = x
else:
    a = x
    b = y

while b:
    a, b = b, a % b

print(x * y // a)

Buggy submission (verdict: Runtime Error):
import math
x,y = input().split()
a = int(x)
b = int(y)
print(int((a*b)/math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
import math
x,y = input().split()
a = int(x)
b = int(y)
print((a*b)/math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
x,y = input().split()
a = int(x)
b = int(y)
for i in range(1,200000):
    if i%a == 0 and i%b ==0:
        return i
        m = i
        break
    else:
        pass

Buggy submission (verdict: Runtime Error):
x,y = input("Enter a two value: ").split()
a = int(x)
b = int(y)
for i in range(1,200000):
    if i%a == 0 and i%b ==0:
        return i
        m = i
        break
    else:
        pass
Problem p02832 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
cnt = 1
for x in a:
  if x == cnt:
    cnt += 1
  else:
    ans += 1
if ans == n:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
no = n
list1 = list(map(int, input().split()))
# for i in range(n):
#     m = int(input())
#     list1.append(m)
# print(list1)
if 1 not in list1:
    print("-1")
else:
    for i in range(len(list1)):
        if list1[i] is not 1:
            pass
        else:
            # print("The location where i hits 1 is:",i)
            a = i
            no = no -1
            increasingshit = 2
            break
    list2 = []
    maxno = max(list1)
    # print("Max of all inputs is:",maxno)
    # print("now increasingshit is",increasingshit)

    def A(a):
        global increasingshit
        global no
        for j in range(a,len(list1)):
            if list1[j] == increasingshit:
                no = no - 1
                increasingshit = increasingshit + 1
                a = j
                A(a)
            else:
                pass
    A(a)
    print(no)
Problem p02659 (python)

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b.replace('.',''))
print(a*b//100)

Buggy submission (verdict: Runtime Error):
a,b = input().split()
a = int(a)
b = int(float(b)*100)
result = ((a * b)//10)//10)
Problem p02753 (python)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
  	print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'AAA' or S === 'BBB':
  print('No')
else:
  print('Yes')
Problem p02757 (python)

Fixed submission:
N,P=map(int,input().split())
S=str(input())
ans=0

if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem = [0]*P
    mod = 0
    ten = 1
    rem[mod]=1
    for i in range(N):
        mod=(mod+int(S[N-i-1])*ten)%P
        ten=ten*10%P
        rem[mod]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)

Buggy submission (verdict: Runtime Error):
N,P=map(int,input().split())
S=str(input())
ans=0

if 10%P==0:
    for i in range(N):
        if int(S[i])%P==0:
            ans+=i+1
else:
    rem = [0]*P
    mod = 0
    ten = 1
    rem[mod]=1
    for i in range(N):
        mod=(mod+S[N-i-1]*ten)%P
        ten=ten*10%P
        rem[mod]+=1
    for j in rem:
        ans+=(j*(j-1))//2
print(ans)
Problem p02831 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions
a,b = (int(i) for i in input().split())
print(a * b // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
a,b = (int(i) for i in input().split())
print(a * b // math.gcd(a, b))
Problem p02594 (python)

Fixed submission:
X = int(input())
if X >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if X >= 30:
  print("Yes")
else:
  print("No")