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

Fixed submission:
import sys
input = sys.stdin.readline

N, W = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]

INFTY = -1
MAX_V = 10**5
dp = [[INFTY]*(MAX_V+1) for _ in range(N)]
dp[0][S[0][1]] = S[0][0]

for i in range(1, N):
    w, v = S[i]
    for j in range(v):
        dp[i][j] = dp[i-1][j]

    if dp[i-1][v] == -1:
        dp[i][v] = w
    else:
        dp[i][v] = min(dp[i-1][v], w)

    for j in range(v+1, MAX_V+1):
        if dp[i-1][j] == -1 and dp[i-1][j-v] == -1:
            continue
        elif dp[i-1][j] == -1:
            if dp[i-1][j-v]+w > W:
                continue
            else:
                dp[i][j] = dp[i-1][j-v]+w
        elif dp[i-1][j-v] == -1:
            dp[i][j] = dp[i-1][j]
        else:
            if dp[i-1][j-v]+w > W:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j], dp[i-1][j-v]+w)

for i in range(MAX_V, 0, -1):
    if dp[N-1][i] != -1:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]

INFTY = -1
MAX_V = 10**5
dp = [[INFTY]*(MAX_V+1) for _ in range(N)]
dp[0][S[0][1]] = S[0][0]

for i in range(1, N):
    w, v = S[i]
    for j in range(v):
        dp[i][j] = dp[i-1][j]

    if dp[i-1][v] == -1:
        dp[i][v] = w
    else:
        dp[i][v] = min(dp[i-1][v], w)

    for j in range(v+1, MAX_V+1):
        if dp[i-1][j] == -1 and dp[i-1][j-v] == -1:
            pass
        elif dp[i-1][j] == -1:
            if dp[i-1][j-v]+w > W:
                pass
            else:
                dp[i][j] = dp[i-1][j-v]+w
        elif dp[i-1][j-w] == -1:
            dp[i][j] = dp[i-1][j]
        else:
            if dp[i-1][j-v]+w > W:
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = min(dp[i-1][j], dp[i-1][j-v]+w)

for i in range(MAX_V, 0, -1):
    if dp[N-1][i] != -1:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, W = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]

INFTY = -1*10**7
dp = [[0]*(W+1) for _ in range(N)]
dp[0][S[0][0]] = S[0][1]

for i in range(1, N):
    w, v = S[i]
    for j in range(w):
        dp[i][j] = dp[i-1][j]
    dp[i][w] = max(dp[i-1][w], S[i][1])
    for j in range(w+1, W+1):
        if dp[i-1][j] == 0 and dp[i-1][j-w] == 0:
            pass
        elif dp[i-1][j] == 0:
            dp[i][j] = dp[i-1][j-w]+v
        elif dp[i-1][j-w] == 0:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)

print(max(dp[N-1]))
Problem p03438 (python)

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

cnt = sum(B) - sum(A)
a, b = cnt, cnt
for i in range(N):
    if A[i] < B[i]:
        b -= (B[i]-A[i]+1)//2
    elif A[i] > B[i]:
        a -= A[i]-B[i]
    if a < 0 or b < 0:
        print("No")
        break
else:
    print("Yes")

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

cnt = sum(B) - sum(A)
a, b = cnt, cnt
for i in range(N):
    if A[i] < B[i]:
        b -= (B[i]-A[i+1])//2
    elif A[i] > B[i]:
        a -= A[i]-B[i]
    if a < 0 or b < 0:
        print("No")
        break
else:
    print("Yes")

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

cnt = sum(B) - sum(A)
a, b = cnt, cnt
for i in range(N):
    if A[i] < B[i]:
        cnt -= (B[i]-A[i+1])//2
    elif A[i] > B[i]:
        a -= A[i]-B[i]
    if a < 0 or b < 0:
        print("No")
        break
else:
    print("Yes")
Problem p03761 (python)

Fixed submission:
N = int(input())

S = [50]*26

for i in range(N):
    s = [0]*26
    for item in input():
        s[ord(item)-97] += 1
    for i in range(26):
        S[i] = min(S[i], s[i])

ans = ""
for i in range(26):
    ans += chr(97+i)*S[i]
print(ans)

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

S = [50]*26

for i in range(N):
    s = [0]*26
    for item in input():
        s[ord(item)-97] += 1
    for i in range(26):
        S[i] = min(S[i], s[i])

ans = ""
for i in range(N):
    ans += chr(97+i)*S[i]
print(ans)
Problem p02583 (python)

Fixed submission:
import itertools
 
N=int(input())
L=list(map(int,input().split()))

count=0

if len(L)<3:
    Lis=[]
else:
    Lis=list(itertools.combinations(L,3))
 
numb=len(Lis)

for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            #if Lis[i][0]<bpc:
            count+=1
 
print(count)

Buggy submission (verdict: Runtime Error):
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
elif Lis[0][0]==Lis[0][1] or Lis[0][0]==Lis[0][2] or Lis[0][1]==Lis[0][2]:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)
Problem p02606 (python)

Fixed submission:
L,R,d=(int(x) for x in input().split())

te=R-L+1
num=0

for i in range(te):
    if L%d==0:
        num+=1
        L+=1
    else:
        L+=1

print(num)

Buggy submission (verdict: Runtime Error):
L,R,d=(int(x) for x in input().split())

te=R-L+1
num=0

for i in range(te):
    if L%d==0:
        num+=1
        L+=1
    else:
        L+=1
    
    print(i)

print(num
Problem p02612 (python)

Fixed submission:
N=int(input())

n=1
kane=1000*n

while True:
    if N<=kane:
        print(kane-N)
        break
    else:
        n+=1
        kane=1000*n

Buggy submission (verdict: Runtime Error):
n=1
turi=1000*n

while N<1000*n:
  if N<1000*n:
    return turi=1000*n-N
  else:
    n+=1
Problem p02613 (python)

Fixed submission:
N=int(input())
inp=[]

for i in range(N):
    inp.append((input()))

c0=inp.count("AC")
c1=inp.count("WA")
c2=inp.count("TLE")
c3=inp.count("RE")

print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3))

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

for i in range(N):
    inp.append(int(input()))

c0=N.count("AC")
c1=N.count("WA")
c2=N.count("TLE")
c3=N.count("RE")

print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3))
Problem p02553 (python)

Fixed submission:
a,b,c,d = (int(x) for x in input().split())
ans = max(a*c,a*d,b*c,b*d)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = int(input(),split())
ans = -float("inf")
xrange = range(a,b+1)
yrange = range(c,d+1)
for x in xrange:
  for y in yrange:
    if x*y > ans:
      ans = x*y
Problem p02981 (python)

Fixed submission:
N,A,B = (int(x) for x in input().split())
print(min(N*A,B))

Buggy submission (verdict: Runtime Error):
N,A,B = (int(x) for x in input(),split())
print(min(N*A,B))
Problem p02982 (python)

Fixed submission:
N,D = (int(x) for x in input().split())
X = [None]*N
for i in range(N):
  X[i] = [float(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    dist = sum(sq)**0.5
    if dist == int(dist):
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,D = (int(x) for x in input().split())
X = []*N
for i in range(N):
  X[i] = [float(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    if isinstance(sum(sq)**0.5 , int):
      count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,D = (int(x) for x in input().split())
X = []*N
for i in range(N):
  X[i] = [int(x) for x in input().split()]
count = 0
for i in range(N-1):
  for j in range(i+1,N):
    sq = [(X[i][k]-X[j][k])**2 for k in range(D)]
    if isinstance(sum(sq)**0.5 , int):
      count += 1
print(count)
Problem p03276 (python)

Fixed submission:
N,K =(int(i) for i in input().split())
x = list((int(i) for i in input().split()))
i = 0
t_min = float("inf")
while i+K-1 <= N-1 :
  left = abs(x[i])+abs(x[i+K-1]-x[i])
  right = abs(x[i+K-1])+abs(x[i+K-1]-x[i])
  if min(left,right)<t_min:
    t_min = min(left,right)
  i += 1
print(t_min)

Buggy submission (verdict: Runtime Error):
N,K =(int(i) for i in input().split())
x = (int(i) for i in input().split())
i = 0
t_min = float("inf")
while i+K <= N :
  left = abs(x[i])+abs(x[i+K-1]-x[i])
  right = abs(x[i+K-1])+abs(x[i+K-1]-x[i])
  if min(left,right)<t_min:
    t_min = min(left,right)
  i += 1
print(t_min)
Problem p02664 (python)

Fixed submission:
t = input()
ans  = ''
for i in range(len(t)):
    if i == 0:
        if t[i] == '?':
            ans += 'D'
        else:
            ans += t[i]
    else:
        if t[i] =='?':
            if ans[i-1] == 'P':
                ans += 'D'
            else:
                ans += 'D'
        else:
            ans += t[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import math
t = input()
ans = ''
for i in range(len(t)):
    if i == 0:
        ans += t[i]
    else:
        if t[i] == '?':
            if  ans[i-1] == 'P':
                ans += 'D'
            elif ans[i-1] == 'D':
                ans += 'P'
        else:
            ans += t[i]
    #print(ans,i)
print(ans)
Problem p02756 (python)

Fixed submission:
from collections import deque
s = deque(input())
q = int(input())

ok = True
for i in range(q):
    query = input()
    if query[0] == '1':
        if ok:
            ok = False
        else:
            ok = True
    else:
        query = query.split()
        if ok:
            if query[1] == '1':
                s.appendleft(query[2])
            else:
                s.append(query[2])
        else:
            if query[1] == '1':
                s.append(query[2])
            else:
                s.appendleft(query[2])
if not ok:
    s.reverse()
print(''.join(list(s)))

Buggy submission (verdict: Runtime Error):
from collections import deque
s = deque(input())
q = int(input())

ok = True
for i in range(q):
    query = input()
    if query[0] == '1':
        if ok:
            ok = False
        else:
            ok = True
    else:
        query = query.split()
        if ok:
            if query[1] == '1':
                s.appendleft(query[2])
            else:
                s.append(query[2])
        else:
            if query[1] == '1':
                s.append(query[2])
            else:
                s.appendleft(query[2])
if not ok:
    s = s[::-1]
print(''.join(list(s)))
Problem p02885 (python)

Fixed submission:
a,b=map(int, input().split())
if b*2 >= a:
  print(0)
else:
  print(a-b*2)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
if b*2 >= a:
  print(0)
else:
  print(a-b*2)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
for i in range(k):
    if s[i] != '1':
        print(s[i])
        exit()
print(1)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
if s[0] == '1':
    print(s[1])
else:
    print(s[0])
Problem p02606 (python)

Fixed submission:
import math
a,b,c=list(map(int, input().split())) 
kotae1=math.floor(b/c)
kotae2=math.floor(a/c)
ans=kotae1-kotae2
if(a%c==0):
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,c=list(map(int, input().split())) 
kotae1=math.floor(b/c)
kotae2=math.floor(a/c)
ans=kotae1-kotae2
if(c==1):
    ans+=1
else:
    if(a==c):
    ans+=1
print(ans)
Problem p02664 (python)

Fixed submission:
s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))
Problem p02582 (python)

Fixed submission:
s = input().upper()
if s.count('RRR') == 1:
  print(3)
elif s.count('RR') == 1:
  print(2)
elif s.count('R') > 0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
days = input()
if days.contains("RRR"):
    print("3")
elif days.contains("RR"):
    print("2")
elif days.contains("R"):
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
S = input()
if S.contains("RRR"):
    print("3")
elif S.contains("RR"):
    print("2")
elif S.contains("R"):
    print("1")
else:
    print("0")
Problem p02675 (python)

Fixed submission:
n = input()
if n[-1] == "3":
    print("bon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == '8':
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
num=int(input())
if num[:-1]==0 or num[:-1]==1 or num[:-1]==6 or num[:-1]==8:
  print("pon")
elis num[:-1]==3:
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
num=int(input())
if num[:-1]==0 or num[:-1]==1 or num[:-1]==6 or num[:-1]==0:
  print("pon")
elis num[:-1]==3:
  print("bon")
else:
  print("hon")
Problem p02772 (python)

Fixed submission:
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

Buggy submission (verdict: Runtime Error):
1n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")
Problem p02783 (python)

Fixed submission:
H = input()
arr = [int(i) for i in H.split(' ')]
count = 1
if(arr[0]<arr[1]):
	print(count)
else:
	while arr[0]>arr[1]:
		arr[0] = arr[0] - arr[1]
		count = count + 1
	print(count)

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

i = 0

while h > 0:
    h = h - a
    i += 1

print(i)
Problem p02553 (python)

Fixed submission:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if d>0:
    print(b*d)
  else:
    print(a*d)
else:
  if b>0:
    if d>0:
      if b*d>a*c:
        print(b*d)
      else:
        print(a*c)
    else:
      print(a*c)
  else:
    if c>0:
      print(b*c)
    else:
      print(a*c)

Buggy submission (verdict: Runtime Error):
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if b*d>a*c
    print(b*d)
  else:
    print(a*c)
else:
  if a*c>b*d:
    print(a*c)
  else:
    print(b*d)
Problem p02576 (python)

Fixed submission:
A,B,C=input().split()
A=int(A)
B=int(B)
C=int(C)
D=A/B
D=int(D)
if A%B==0:
  print((D)*C)
else:
  print((D+1)*C)

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
A=int(A)
B=int(B)
C=int(C)
D=A/B
D=int(D)
if A%B=0:
  print((D)*C)
else:
  print((D+1)*C)
Problem p02658 (python)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=1
b.sort()
if b[0]==0:
  print(0)
else:
  for i in range(a):
    c=c*b[-i]
    if c>1000000000000000000:
      break
  if c>1000000000000000000:
    print(-1)
  else:
    print(c)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
for i in range(a):
  c=c*b[i]
  if c>1000000000000000000:
    print(-1)
    break
print(c)
Problem p02681 (python)

Fixed submission:
a=input()
b=input()
c=0
if (len(a)+1)!=len(b):
  print("No")
else:
  for i in range(len(a)):
    if a[i]==b[i]:
      c=c+1
  if c==len(a):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=0
if (len(a)+1)!=len(b):
  print("No")
else:
  for i in range(len(b)):
    if a[i]==b[i]:
      c=c+1
  if c==len(a):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=len(a)
print(a+a[len(b-1)]
Problem p02700 (python)

Fixed submission:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
e=0
while e==0:
  c=c-b
  if c<=0:
    print("Yes")
    break
  a=a-d
  if a<=0:
    print("No")
    break

Buggy submission (verdict: Runtime Error):
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
while true:
  c=c-b
  if c<=0:
    print("Yes")
    break
  a=a-d
  if a<=0:
    print("No")
    break
Problem p02765 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
if a>=10:
  print(b)
if a<10:
  print(b+(100*(10-a)))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
if a>=10:
  print(b)
else:
  print(int(b+100*(10-a))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
if a>=10:
  print(b)
else:
  print(int(b-100*(10-a))
Problem p02801 (python)

Fixed submission:
a=input()
if a=="a":
  print("b")
if a=="b":
  print("c")
if a=="c":
  print("d")
if a=="d":
  print("e")
if a=="e":
  print("f")
if a=="f":
  print("g")
if a=="g":
  print("h")
if a=="h":
  print("i")
if a=="i":
  print("j")
if a=="j":
  print("k")
if a=="k":
  print("l")
if a=="l":
  print("m")
if a=="m":
  print("n")
if a=="n":
  print("o")
if a=="o":
  print("p")
if a=="p":
  print("q")
if a=="q":
  print("r")
if a=="r":
  print("s")
if a=="s":
  print("t")
if a=="t":
  print("u")
if a=="u":
  print("v")
if a=="v":
  print("w")
if a=="w":
  print("x")
if a=="x":
  print("y")
if a=="y":
  print("z")

Buggy submission (verdict: Runtime Error):
a=input()
print(a+1)
Problem p02811 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
if a*500>=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
if a*500>=b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
N=int(N)
S=input()
count=0
for i in range(N-2):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    count=count+1
print(count)
Problem p02812 (python)

Fixed submission:
N=input()
N=int(N)
S=input()
count=0
for i in range(N-2):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N=input()
N=int(N)
S=input()
count=0
for i in range(N):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    count=count+1
print(count)
Problem p02830 (python)

Fixed submission:
a=int(input())
b,c=input().split()
d=""
for i in range(a):
  d=d+b[i]+c[i]
print(d)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=input()
c=input()
d=""
for i in range(a):
  d=d+b[i]+c[i]
print(d)
Problem p02887 (python)

Fixed submission:
a=int(input())
b=input()
c=0
for i in range(a-1):
  if b[i]==b[i+1]:
    c=c+1
print(a-c)

Buggy submission (verdict: Runtime Error):
a=int(input())a\
b=input()
c=0
for i in range(a-1):
  if b[i]==b[i+1]:
    c=c+1
print(a-c)
Problem p02910 (python)

Fixed submission:
a=input()
b=0
if (len(a))%2==0:
  for i in range(int(len(a)/2)):
    if a[2*i]=="R" or a[2*i]=="U" or a[2*i]=="D":
      b=b+1
    if a[2*i+1]=="L" or a[2*i+1]=="U" or a[2*i+1]=="D":
      b=b+1
  if b==len(a):
    print("Yes")
  else:
    print("No")
if (len(a))%2==1:
  for i in range(int(len(a)/2)+1):
    if a[2*i]=="R" or a[2*i]=="U" or a[2*i]=="D":
      b=b+1
  for i in range(int(len(a)/2)):
    if a[2*i+1]=="L" or a[2*i+1]=="U" or a[2*i+1]=="D":
      b=b+1
  if b==len(a):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
if a%2==0:
  for i in range(int(len(a)/2)):
    if a[2*i]=="R" or a[2*i]=="U" or a[2*i]=="D":
      b=b+1
    if a[2*i+1]=="L" or a[2*i+1]=="U" or a[2*i+1]=="D":
      b=b+1
  if b=len(a):
    print("Yes")
  else:
    print("No")
if a%2==1:
  for i in range(int(len(a)/2)+1):
    if a[2*i]=="R" or a[2*i]=="U" or a[2*i]=="D":
      b=b+1
  for i in range(int(len(a)/2)):
    if a[2*i+1]=="L" or a[2*i+1]=="U" or a[2*i+1]=="D":
      b=b+1
  if b=len(a):
    print("Yes")
  else:
    print("No")
Problem p03000 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
e=0
for i in range(a):
  if d+c[i]<=b:
    d=d+c[i]
    e=e+1
  else:
    break
print(e+1)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
d=0
for i in range(a):
  while d<b:
    d=d+b[i]
  print(d)
  break
Problem p03029 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
print(int((a*3+b)/2))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
print(int((a*3+b)/2)
Problem p03071 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
if a-b>=2:
  print(2*a-1)
if b-a>=2:
  print(2*b-1)
if -2<a-b<2:
  print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
if a-b>=2:
  print(2a-1)
if b-a>=2:
  print(2b-1)
else:
  print(a+b)
Problem p03101 (python)

Fixed submission:
a,b=input().split()
c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
print((a-c)*(b-d))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
c,d=input().split()
print((a-c)*(b-d))
Problem p03106 (python)

Fixed submission:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if a>=b:
  for i in range(101):
    if a%(b-i)==0 and b%(b-i)==0:
      d=d+1
      if d==c:
        print(b-i)
        break
if a<b:
  for i in range(101):
    if a%(a-i)==0 and b%(a-i)==0:
      d=d+1
      if d==c:
        print(a-i)
        break

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
count=o
while count<c:
  for i in range(100,0):
    if a%i==0 and b%i==0:
      count=count+1
print(i)
Problem p03110 (python)

Fixed submission:
a=int(input())
b=[input().split() for i in range(a)]
c=0
for i in range(a):
  if b[i][1]=="JPY":
    c=c+int(b[i][0])
  if b[i][1]=="BTC":
    c=c+float(b[i][0])*380000
print(c)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=[input().split() for i in range(a)]
c=0
for i in range(a):
  if b[i][1]=="JPY":
    c=c+int(b[i][0])
  if b[i][1]=="BTC":
    c=c+int(b[i][0])*380000
print(c)