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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5+1)

for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
S = 0
for i in range(maxlen+1):
        S += ans [i]*i
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    S = S + ans[BC[i][0]] *BC[i][1] - ans[BC[i][0]]*BC[i][0]
    ans[BC[i][0]] = 0
    print(S)

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5+1)

for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
S = for i in range(maxlen+1):
        S += ans [i]*i
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    S = S + ans[BC[i][1]] *BC[i][1] - ans[BC[i][0]]*BC[i][0]    
    print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5)
for i in range (len(A)):
    ans[A[i]] += 1
maxlen = max(max(A),max(max(BC)))
for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    ans[BC[i][0]] = 0 

    S = 0
    for i in range(maxlen+1):
        S += ans [i]*i
    print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5)
for i in range (len(A)):
    ans[A[i]] += 1

for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    ans[BC[i][0]] = 0 

    S = 0
    for i in range(len(ans)):
        S += ans [i]*i
    print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)] 
ans = [0]*(10**5)
for i in range (len(A)):
    ans[A[i]] += 1

for i in range(Q):
    ans[BC[i][1]] += ans[BC[i][0]]
    ans[BC[i][0]] = 0 

    S = 0
    for i in range(len(ans)):
        S += ans [i]*i
    print(S)
Problem p02639 (python)

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

for i in range(5):
    if xs[i] == 0:
        print(i+1)

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

for i in range(5):
    if xs(i) == 0:
        print(i+1)
Problem p02646 (python)

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

if A < B:
    if (A+V*T >= B+ W*T):
        print("YES")
    else:
        print("NO")
else:
    if (A-V*T <= B - W*T):
        print("YES")
    else:
        print("NO")

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

if A < B:
    if (A+V*T >= B+ W*T):
        print("YES")
    else:
        print("NO")
else:
     if (A+V*T <= B+ W*T):
        print("YES")
    else:
        print("NO")
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
ans = 1
flg = 0
if A[-1] == 0:
    print(0)
else:
    for i in range(N):
        ans = ans * A[i]
        if ans > 10**18:
            flg = 1
            break


    if flg == 1:
        print(-1)
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
ans = 0
flg = 0
for i in range(N):
    ans = ans * A[i]
    if ans > 10**18:
        flg = 1
        break
if flg == 0:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
ans = 0
flg = 0
for i in range(N):
    ans = ans * A[i]
    if ans > 10**18:
        flg = 1
        break
if flg == 0:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(N):
    ans = ans * A[i]
print(ans)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if ((a*b)%2) == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int(), raw_input().split())
if ((a*b)%2) == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if ((a*b)%2) == 0:
  print('Even')
elif:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if ((a*b)%2) == 0:
  print('Even')
elif:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int(), input().split())
if ((a*b)%2) == 0:
  print('Even')
elif:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int(), raw_input().split())
if ((a*b)%2) == 0:
  print('Even')
elif:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a*b % 2 == 0 :
  print('Even')
elif :
  print('Odd')
Problem p03471 (python)

Fixed submission:
#C - Otoshidama
N, Y = map(int, input().split())

x_ans = -1
y_ans = -1
z_ans = -1
flg = 0

for x in range(N+1):
    for y in range(N+1-x):
        otoshidama = 10000*x + 5000*y + 1000*(N-x-y)
        if otoshidama == Y :
            flg = 1
            x_ans = x
            y_ans = y
            z_ans = N-x-y
print(x_ans, y_ans, z_ans)

Buggy submission (verdict: Runtime Error):
#C - Otoshidama
N, Y = map(int, input().split())

x_ans = -1
y_ans = -1
z_ans = -1
flg = 0

for x in range(N+1):
    for y in range(N+1-x):
        otoshidama = 10000*x + 5000*y + 1000*(N-x-z)
        if otoshidama == Y :
            flg = 1
            x_ans = x
            y_ans = y
            z_ans = z
print(x_ans, y_ans, z_ans)
Problem p03493 (python)

Fixed submission:
sss = input()
s1 = int(sss[0])
s2 = int(sss[1])
s3 = int(sss[2])
print(s1+s2+s3)

Buggy submission (verdict: Runtime Error):
sss = input()
s1 = int(sss[0])
s2 = int(sss[1])
s3 = int(sss[2])
print(%d, s1+s2+s3)
Problem p03494 (python)

Fixed submission:
n = int(input())
an = map(int, input().split())
anlist = list(an)
count = 0
flg = 0
while flg == 0:
  for i in range(n):
    if (anlist[i])%2 == 1:
      flg = 1
    else:
      anlist[i] = anlist[i]/2
  if flg == 0:
    count = count + 1
print(count)
flg = 0
count = 0

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

count = 0
flg = 0
while flg == 0:
  for i in n:
    if (int(an[i]))%2 == 1:
      flg = 1
    elif i == n-1 && flg == 0:
      count = count + 1
Problem p02658 (python)

Fixed submission:
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  if flag == 1:
    sum = sum * num
    if sum > upper:
      flag = 2
  if num == 0:
    flag = 0
    break
if flag == 2:
  print(-1)
else:
  print(sum * flag)

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = list(map(int, input().split()))
sum = 1
flag = 1
upper = pow(10, 18)
for num in nums:
  sum = sum * num
  if sum > upper && flag != 0:
    flag = 2
  if num == 0:
    flag = 0
if flag == 2:
  print(-1)
else:
  print(sum * flag)
Problem p03544 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(raw_input())

if N == 1:
    print(1)
else:
    L = [2, 1]
    for i in range(2, N + 1):
        L.append(L[i - 2] + L[i - 1])
    print L[N]

Buggy submission (verdict: Runtime Error):
N = raw_input()

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

print L[N]
Problem p03545 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = raw_input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

if A+B+C+D == 7:
    print '%s+%s+%s+%s=7' % (A, B, C, D)
elif A+B+C-D == 7:
    print '%s+%s+%s-%s=7' % (A, B, C, D)
elif A+B-C+D == 7:
    print '%s+%s-%s+%s=7' % (A, B, C, D)
elif A-B+C+D == 7:
    print '%s-%s+%s+%s=7' % (A, B, C, D)
elif A+B-C-D == 7:
    print '%s+%s-%s-%s=7' % (A, B, C, D)
elif A-B+C-D == 7:
    print '%s-%s+%s-%s=7' % (A, B, C, D)
elif A-B-C+D == 7:
    print '%s-%s-%s+%s=7' % (A, B, C, D)
elif A-B-C-D == 7:
    print '%s-%s-%s-%s=7' % (A, B, C, D)

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

if A+B+C+D == 7:
    print '%s+%s+%s+%s' % (A, B, C, D)
elif A+B+C-D == 7:
    print '%s+%s+%s-%s' % (A, B, C, D)
elif A+B-C+D == 7:
    print '%s+%s-%s+%s' % (A, B, C, D)
elif A-B+C+D == 7:
    print '%s-%s+%s+%s' % (A, B, C, D)
elif A+B-C-D == 7:
    print '%s+%s-%s-%s' % (A, B, C, D)
elif A-B+C-D == 7:
    print '%s-%s+%s-%s' % (A, B, C, D)
elif A-B-C+D == 7:
    print '%s-%s-%s+%s' % (A, B, C, D)
elif A-B-C-D == 7:
    print '%s-%s-%s-%s' % (A, B, C, D)
Problem p02705 (python)

Fixed submission:
import math
R=int(input())
L=2*math.pi*R
print(L)

Buggy submission (verdict: Runtime Error):
import math
N,M=input().split()
A=list(map(int, input().split()))
N=int(N)
if N>=sum(A):
	print(N-sum(A))
else:
	print(-1)
Problem p02783 (python)

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

count=0
while H>0:
  H=H-A
  count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K=input().split()
K=int(K)

A=list(map(int, input().split()))
A=np.array(A)
sort_A=np.sort(A)[::-1]
sort_A=sort_A[K:]

print(np.sum(sort_A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K=input().split()
N=int(N)
K=int(K)

A=list(map(int, input().split()))
A=np.array(A)
sort_A=np.sort(A)[::-1]
sort_A=sort_A[K:]

print(np.sum(sort_A))
Problem p02784 (python)

Fixed submission:
H,N=input().split()
H=int(H)
N=int(N)

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

count=0
for i in range(N):
  count+=A[i]

if count>=H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
H,N=input().split()
H=int(H)
N=int(N)

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

count=0
for i in range(N):
  count+=A[i]

if count=>H:
  print("yes")
else:
  print("no")
Problem p02811 (python)

Fixed submission:
k,x=input().split()

if 500*int(k)>=int(x):
	print("Yes")
else:
	print("No")

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

print(s.count('ABC'))
Problem p03161 (python)

Fixed submission:
import math
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[math.inf for i in range(n)]
dp[0]=0
for i in range(1,n):
    for j in range(1,k+1):
        if i-j<0:
            continue
        dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i])
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math
n,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[math.inf for _ in range(n)]
dp[0]=0
for i in range(1,n):
    for k in range(K):
        if i-k<0:
            continue
        else:
            dp[i]=min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))
        print(dp)
print(dp)
Problem p03854 (python)

Fixed submission:
WORDS = ['dream', 'dreamer', 'erase', 'eraser']
REVERSED_WORDS = [word[::-1] for word in WORDS]


def main(s):
    i = 0
    while i < len(s):
        for word in REVERSED_WORDS:
            if s[i:].startswith(word):
                i += len(word)
                break
        else:
            print('NO')
            break
    else:
        print('YES')


if __name__ == "__main__":
    main(input()[::-1])

Buggy submission (verdict: Runtime Error):
WORDS = ['dream', 'dreamer', 'erase', 'eraser']


def main(s):
    for word in WORDS:
        if delete_word(s, word):
            print('YES')
            break
    else:
        print('NO')


def delete_word(s, word):
    if s.endswith(word):
        s = s[:-len(word)]
        if len(s) == 0:
            return True
        for w in WORDS:
            if delete_word(s, w):
                return True
    else:
        return False


if __name__ == "__main__":
    main(input())

Buggy submission (verdict: Runtime Error):
def main(s):
    for word in ['dream', 'dreamer', 'erase', 'eraser']:
        if delete_word(s, word):
            print('YES')
            break
    else:
        print('NO')


def delete_word(s, word):
    if s.startswith(word):
        s = s[len(word):]
        if len(s) == 0:
            return True
        for w in ['dream', 'dreamer', 'erase', 'eraser']:
            if delete_word(s, w):
                return True
    else:
        return False


if __name__ == "__main__":
    main(input())

Buggy submission (verdict: Runtime Error):
WORDS = ['dream', 'dreamer', 'erase', 'eraser']


def main(s):
    for word in WORDS:
        if delete_word(s, word):
            print('YES')
            break
    else:
        print('NO')


def delete_word(s, word):
    if s.startswith(word):
        s = s[len(word):]
        if len(s) == 0:
            return True
        for w in WORDS:
            if delete_word(s, w):
                return True
    else:
        return False


if __name__ == "__main__":
    main(input())

Buggy submission (verdict: Runtime Error):
WORDS = ['dream', 'dreamer', 'erase', 'eraser']


def main(s):
    for word in WORDS:
        if delete_word(s, word):
            print('YES')
            break
    else:
        print('NO')


def delete_word(s, word):
    if s.startswith(word):
        s = s[len(word):]
        if len(s) == 0:
            return True
        for word in WORDS:
            if delete_word(s, word):
                return True
    else:
        return False


if __name__ == "__main__":
    main(input())
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
b = 0
c = 0
d = ""
l = 1 / (4 * m)
for i in a:
    b += i
b = b * l
while c < m:
  if a[c] < b:
    d = "No"
  else:
    d = "Yes"
  c += 1
print(d)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = a.sort(reverse = True)
b = sum(a)
c = 0
d = "Yes"
l = 1 / (4 * m)
b = b * l
while c < m:
  if a[c] < b:
    d = "No"
  c += 1
print(d)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = sort(a)
b = sum(a)
c = 0
d = "Yes"
l = 1 / (4 * m)
b = b * l
while c < m:
  if a[c] < b:
    d = "No"
  c += 1
print(d)
Problem p02730 (python)

Fixed submission:
n = input()
a = ((len(n) - 1)//2)
b = ((len(n) + 3)//2)-1
if n == n[::-1]:
    if n[:a] == n[-a::]:
        if n[b:] == n[:-b]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
a = (len(n) - 1)//2
b = (len(n) + 3)//2
if n == n[::-1]:
  if n[0:a-1] == n[0:a-1:-1]:
    if n[b-1:len(n)-1] == n[b-1:len(n)-1:-1]:
      print("Yes")
  	else:
      print("No")
  else:
    print("No")
else:
  print("No")
Problem p02789 (python)

Fixed submission:
n,m=map(int,input().split())
if n==m:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n==M:
    print("Yes")
else:
    print("No")
Problem p02802 (python)

Fixed submission:
n,m=input().split()
n=int(n)
m=int(m)
x=[False for i in range(n)]
count=[0 for i in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if(not x[p-1]):
    if(s=="AC"):
      x[p-1]=True
    else:
      count[p-1]=count[p-1]+1
ans=0
ans2=0
for i in range(n):
  if(x[i]):
    ans+=1
    ans2+=count[i]
print(ans,ans2)

Buggy submission (verdict: Runtime Error):
n=int(n)
m=int(m)
x=[false for i in range(n)]
count=[0 for i in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if(not x[p-1]):
    if(s=="AC"):
      x[p-1]=true
    else:
      count[p-1]=count[p-1]+1
ans=0
ans2=0
for i in range(ansn):
  if(x[i]):
    ans+=1
    ans2+=count[i]
print(ans,ans2)
Problem p02813 (python)

Fixed submission:
import math
import itertools
n=int(input())

a=list(map(str,input().split()))
b=list(map(str,input().split()))

p=str(math.factorial(n))

a_list = [''.join(v) for v in itertools.permutations(a)]
a_int = [int(i) for i in a_list]
a_int.sort()

a_=[int(i) for i in a]
b_=[int(j) for j in b]
x="".join(a)
y="".join(b)

p_=a_int.index(int(x))+1
q_=a_int.index(int(y))+1

sum=abs(p_-q_)
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(n)
m=int(m)
x=[false for i in range(n)]
count=[0 for i in range(n)]
for i in range(m):
  p,s=input().split()
  p=int(p)
  if(not x[p-1]):
    if(s=="AC"):
      x[p-1]=true
    else:
      count[p-1]=count[p-1]+1
ans=0
ans2=0
for i in range(ansn):
  if(x[i]):
    ans+=1
    ans2+=count[i]
print(ans,ans2)
Problem p02830 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
T=list(input()) 
sum=""
for i in range(N):
  sum+=S[i]
  sum+=T[i]
print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
T=list(input()) 
sum=""
for i in range(N):
  sum+=S[i]
  sum+=T[i]
print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
T=list(input())  
sum=""
for i in range(N):
  sum= sum+S[i]+T[i]
print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
T=list(input())  
sum=""
for i in range(n):
  sum= sum+s[i]+t[i]
print(sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
t=list(input())  
sum=""
for i in range(n):
  sum= sum+s[i]+t[i]
print(sum)
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if b-a<=0:
  print("delicious")
elif b-a>0 and x-(b-a)>=0:
  print("safe")
else:
  print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b-a<=0:
  print("delicious")
elif b-a=0 and x-(b-a)>=0:
  print("safe")
else:
  print("dangerous")
Problem p04011 (python)

Fixed submission:
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

if N > K:
  print(K*X+(N-K)*Y)
else:
  print(N*X)

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

if N=<K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)

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

if N=>K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)

Buggy submission (verdict: Runtime Error):
N=input()
K=input()
X=input()
Y=input()

if N=>K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)

Buggy submission (verdict: Runtime Error):
N=input()
K=input()
X=input()
Y=input()
if N<=K:
  print(N*X)
else:
  print(K*X + (N-K)*Y)

Buggy submission (verdict: Runtime Error):
a=input().split
int(a)
N=a(0) 
K=a(1)
X=a(2)
Y=a(3)
if N > K:
  tot = K*X+(N-K)*Y
else:
  tot = N*X
print(tot)
Problem p04012 (python)

Fixed submission:
import sys
w = list(input())
for i in w:
  if w.count(i) %2 == 1:
    print("No")
    sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
w = list(input())

for i in w.count(i):
  if i%2==1:
    print("No")
    sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
w = list(input())
for i in w:
  if count.w(i) %2 == 1:
    print("No")
    break
print("Yes")
Problem p04029 (python)

Fixed submission:
a = input()
a=int(a)
ans=0
for i in range(1,a+1):
  ans+=i
print(ans)

Buggy submission (verdict: Runtime Error):
a = input()
a=int(a)
ans=0
for i in ramge(1,a+1):
  ans+=i
print(ans)
Problem p04043 (python)

Fixed submission:
a=input().split()
a=[int(i) for i in a]
a.sort()
if a[0]==5 and a[1]==5 and a[2]==7:
	print("YES")
else:
 	print("NO")

Buggy submission (verdict: Runtime Error):
a=input().split()
a=[int(i) for i in a]
a.sort()
if a=[5, 5, 7]:
	print("YES")
else:
 	print("NO")

Buggy submission (verdict: Runtime Error):
a=[int(i) for i in input().split()]
a.sort()
if a=[5, 5, 7]:
	print("YES")
else:
 	print("NO")

Buggy submission (verdict: Runtime Error):
a=[int(i) for i in input().split()]
a.sort()
if a=[5, 5, 7]:
 print("YES")
else print("NO");

Buggy submission (verdict: Runtime Error):
a=[int(i) for i in input().split()]
a.sort()
if a=[5, 5, 7]:
 print("YES")
else print("NO"):
Problem p02582 (python)

Fixed submission:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = ns()
    if S == 'RRR':
        print(3)
    elif S == 'RRS' or S == 'SRR':
        print(2)
    elif S == 'SSR' or S == 'SRS' or S == 'RSS' or S == 'RSR':
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = ns()
    A = []
    ans = 0
    for s in S:
        if s == 'R':
            ans += 1
        else:
            A.append(ans)
            ans = 0
    print(max(A))


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

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1
for a in A:
    ans *= a
    if ans > 10 ** 18:
        print(-1)
        exit()
print(ans)

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

n = int(input())
a = list(map(int, input().split()))
a = np.array(a, dtype=np.float64)
ans = np.prod(a)
print(int(ans))
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np
n, m, x = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l = sorted(l)
l = np.array(l)
ans = np.sum(l, 0)[0]
ans_s = np.sum(l, 0)
if np.any(ans_s[1:] < x):
    print(-1)
    exit()
count = 0
for i in range(1, n + 1):
    for j in itertools.combinations(l, i):
        tot = np.sum(j, 0)
        if np.all(tot[1:] >= x) and tot[0] < ans:
            ans = tot[0]
            print(int(ans))
            exit()
Problem p02690 (python)

Fixed submission:
import numpy as np


def main():
    x = int(input())
    A = np.arange(-120, 120)
    a = A ** 5
    for i, a_1 in enumerate(a):
        for j, a_2 in enumerate(a):
            if a_1 - a_2 == x:
                print(A[i], A[j])
                return


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(x // 2 + 1):
    if pow(x - pow(i, 5), 1 / 5).is_integer():
        print(i, int(-pow(x - pow(i, 5), 1 / 5)))
        exit()

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(x // 2):
    if pow(x - pow(i, 5), 1 / 5).is_integer():
        print(i, int(-pow(x - pow(i, 5), 1 / 5)))
        exit()
Problem p02709 (python)

Fixed submission:
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = np.array(read().split(), np.int64)
I = np.argsort(A)[::-1].tolist()
A = A[I].tolist()

dp = np.zeros(1, np.int64)

for n, (i, x) in enumerate(zip(I, A)):
    newdp = np.zeros(len(dp) + 1, np.int64)
    left_ind = np.arange(len(dp))
    right_ind = N - 1 - n + left_ind
    left_cost = x * np.abs(left_ind - i)
    right_cost = x * np.abs(right_ind - i)
    np.maximum(newdp[:-1], dp + right_cost, out=newdp[:-1])
    np.maximum(newdp[1:], dp + left_cost, out=newdp[1:])
    dp = newdp

print(dp.max())

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
import itertools
n = int(input())
l = list(map(int, input().split()))
ans = 0
pos = [0] * n
for i in range(n):
    pos[i] = list(map(lambda x: abs(x - i), list(range(n))))
pos = np.array(pos)
tot = np.zeros(math.factorial(n))
for i in range(n):
    pos[i, :] = pos[i, :] * l[i]
for i, x in enumerate(itertools.permutations(range(n))):
    tot[i] = np.sum(pos[list(range(n)), x])
print(int(np.max(tot)))