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

Fixed submission:
import queue
h,w = map(int,input().split())
mas = []
black_num = 0
inf = 10 ** 7
for i in range(h):
    row = list(input())
    mas.append(row)
for i in range(h):
    for j in range(w):
        if mas[i][j] == "#":
            black_num += 1
dx = [0,0,1,-1]
dy = [1,-1,0,0]
def bfs():
    q = []
    q.append([0,0])
    step = []
    for i in range(h):
        step.append([-1] * w)
    for i in range(h):
        for j in range(w):
            step[i][j] = inf
    step[0][0] = 0
    while not len(q) == 0:
        s = q[0]
        q = q[1:]
        if s[0] == h-1 and s[1] == w-1:
            break
        for i in range(4):
            nx = s[0] + dx[i]
            ny = s[1] + dy[i]
            if(0 <= nx < h and 0 <= ny < w and mas[nx][ny] != '#' and step[nx][ny] == inf):
                q.append([nx,ny])
                step[nx][ny] = step[s[0]][s[1]] + 1
    
    if(step[h-1][w-1] == inf):
        return -1
    else:
        return step[h-1][w-1]

least = bfs()
if(least == -1):
    print(-1)
else:
    print(h * w - black_num - least - 1)

Buggy submission (verdict: Runtime Error):
import queue
h,w = map(int,input().split())
mas = []
black_num = 0
for i in range(h):
    row = list(input())
    mas.append(row)
for i in range(h):
    for j in range(w):
        if mas[i][j] == "#":
            black_num += 1
dx = [0,0,1,-1]
dy = [1,-1,0,0]
def bfs():
    q = queue.Queue()
    q.put([0,0])
    step = mas.copy()
    for i in range(h):
        for j in range(w):
            step[i][j] = -1
    step[0][0] = 0
    while not q.empty():
        s = q.get()
        if s[0] == h-1 and s[1] == w-1:
            break
        for i in range(4):
            nx = s[0] + dx[i]
            ny = s[1] + dy[i]
            if(0 <= nx < h and 0 <= ny < w and mas[nx][ny] !="#" and step[nx][ny] == -1):
                q.put([nx,ny])
                step[nx][ny] = step[s[0]][s[1]] + 1
    return ste[h-1][w-1]

least = bfs()
if(least == -1):
    print(-1)
else:
    print(h * w - black_num - least - 1)
Problem p03495 (python)

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

d = {}
for a in A:
    d[a] = d.get(a, 0) + 1

if len(d) <= k:
    print(0)
else:
    d = sorted(d.values())
    cnt = 0
    for i in range(len(d)-k):
        cnt += d[i]
    print(cnt)

Buggy submission (verdict: Runtime Error):
import collections

N, K = map(int, input().split())
a = list(map(int, input().split())

import collections 
def solve():
  c = list(collections.Counter(a).values())
  c.sort()
  if(len(c)<=k):
    print(0)
  else:
    print(sum(c[:len(c)-k]))
 
solve()

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = list(map(int, input().split())
import collections 
def solve():
  c = list(collections.Counter(a).values())
  c.sort()
  if(len(c)<=k):
    print(0)
  else:
    print(sum(c[:len(c)-k]))
 
solve()
Problem p03545 (python)

Fixed submission:
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
if a + b + c + d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a + b + c - d == 7:
    print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a + b - c - d == 7:
    print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b - c - d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a - b - c + d == 7:
    print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a - b + c + d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a - b + c - d == 7:
    print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
else:
    print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")

Buggy submission (verdict: Runtime Error):
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
op = ["+","-"]
def pc(x,y,op):
    if op == "+":
        return x + y
    elif op == "-":
        return x - y
li = []
ope = []
ans = 0
for i in op:
    ans = pc(a,b,i)
    for j in op:
        ans = pc(ans,c,j)
        for k in op:
            ans = pc(ans,d,k)
            li.append(ans)
            ope.append(str(a)+i+str(b)+j+str(c)+k+str(d)+"=7")
print(ope[li.index(7)])
Problem p03547 (python)

Fixed submission:
x,y = input().split()
li = ["A","B","C","D","E","F"]
nx = li.index(x)
ny = li.index(y)
if nx > ny:
    print(">")
elif nx == ny:
    print("=")
else:
    print("<")

Buggy submission (verdict: Runtime Error):
x,y = input().split()
li = ["A","B","C","D","E"]
nx = li.index(x)
ny = li.index(y)
if nx > ny:
    print(">")
if nx == ny:
    print("=")
else:
    print("<")

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
if x > y:
    print(">")
if x == y:
    print("=")
else:
    print("<")
Problem p03607 (python)

Fixed submission:
n = int(input())
A = {}
for i in range(n):
    a = int(input())
    A[a] = A.get(a, 0)+1
    A[a] %= 2
s = 0
for v in A.values():
    s += v
print(s)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [0]*(10**9+5)
for i in range(n):
    a = int(input())
    A[a-1]+=1
    A[a-1]%=2
print(sum(A))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [0]*(10**9+5)
for i in range(n):
    a = int(input())
    A[a]+=1
    A[a]%=2
print(sum(A))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [0]*(10**5+5)
for i in range(n):
    a = int(input())
    A[a-1]+=1
    A[a-1]%=2
print(sum(A))
Problem p02536 (python)

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

#Union-Find木
#par[i]:iの親　deep[i]:iの深さ　size[i]:iの大きさ
par=[i for i in range(n)]
deep=[1]*n
size=[1]*n

#親を見つける
def find(x):
  if par[x]==x:
    return x
  else:
    return find(par[x])

#二つのグループを統合する
def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if deep[x]<deep[y]:
    par[x]=y
    size[y]+=size[x]
  else:
    par[y]=x
    size[x]+=size[y]
    if deep[x]==deep[y]:
      deep[x]+=1

#xとyが同じグループに属するかどうか
def same(x,y):
  return find(x)==find(y)

#xが属するグループの要素数を返す
def group_count(x):
  return size[find(x)]
  
for i in range(m):
  a,b=map(int,input().split())
  unite(a-1,b-1)
  
from collections import Counter
x=[]
for i in par:
  x.append(find(i))
x=Counter(x)
print(len(x)-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
#Union-Find木
#par[i]:iの親　deep[i]:iの深さ　size[i]:iの大きさ
par=[i for i in range(n)]
deep=[1]*n
size=[1]*n

#親を見つける
def find(x):
  if par[x]==x:
    return x
  else:
    return find(par[x])

#二つのグループを統合する
def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return
  if deep[x]<deep[y]:
    par[x]=y
    size[y]+=size[x]
  else:
    par[y]=x
    size[x]+=size[y]
    if deep[x]==deep[y]:
      deep[x]+=1

#xとyが同じグループに属するかどうか
def same(x,y):
  return find(x)==find(y)

#xが属するグループの要素数を返す
def group_count(x):
  return size[find(x)]

#連結成分の個数を返す
def count():
  check=set()
  for i in par:
    parent=find(i)
    if parent not in check:
      check.add(parent)
  return len(check)

for i in range(m):
  a,b=map(int,input().split())
  unite(a,b)
print(count()-1)
Problem p02658 (python)

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

ans=1

if 0 in A:
    print(0)
    exit()

for i in A:
   ans=ans*i
   if ans>10**18:
    print(-1)
    exit()


print(ans)

Buggy submission (verdict: Runtime Error):
def main ():
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
print(0)
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1)
return
print(prod)
main ()

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    a=1
    for i in A:
        a=a*i
        if a>1000000000000000000:
            print(-1)
        else:
            print(a)
Problem p02660 (python)

Fixed submission:
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
 
n=int(input())
c= collections.Counter(prime_factorize(n))
#ここまでで素因数分解して個数が何個あるかcheckしてる
sum=0
for i in c:
    n=1
    while n*(n+1)/2<=c[i]:
        n=n+1
    sum=sum+n-1
print(sum)

Buggy submission (verdict: Runtime Error):
a,b=list(map(float,input().split()))
c=a*(b*100)
d=int(c//100)
print(d)
Problem p02678 (python)

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

#隣接リスト
road=[[] for i in range(n+1)]
for i in range(m):
    road[road_input[i][0]].append(road_input[i][1])
    road[road_input[i][1]].append(road_input[i][0])

from collections import deque
q=deque([1])
ans=[-1 for i in range(n)]
while len(q)>0:
  p=q.popleft()
  for i in road[p]:
    if ans[i-1]== -1:
      ans[i-1]=p
      q.append(i)

print("Yes")
for j in range(1,n):
    print(ans[j])

Buggy submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
road=[[] for i in range(m)]
#隣接行列表現だとo(n^2)で間に合わないので隣接リスト表現でいく
for i in range(m):
  a,b=list(map(int,input().split()))
  road[a-1].append(b)
  road[b-1].append(a)
from collections import deque
q=deque([1])
check=[0 for i in range(n)]
check[0]=1
ans=[0 for i in range(n)]
while len(q)>0:
  p=q.popleft()
  for i in range(len(road[p-1])):
    if check[road[p-1][i]-1]==0:
      q.append(road[p-1][i])
      check[road[p-1][i]-1]=1
      ans[road[p-1][i]-1]=p
print("Yes")

for i in range(1,n):
  print(ans[i])
Problem p02684 (python)

Fixed submission:
n,k=list(map(int,input().split()))
A=[i for i in range(1,n+1)]
B=list(map(int,input().split())) 
road=dict(zip(A,B))

#残りi回移動する、移動前に自分がいるところをj
#def walk(i,j):
#        return road[j]
#    else:
#        return walk(i-1,road[j])

j=1
C=[-1 for i in range(n)]
dp=dict(zip(A,C))
dp[1]=0
num=0
while dp[j]!=k-1:
    j=road[j]
    num=num+1
    if dp[j]== -1:
        dp[j]=num
    else:
        t=num-dp[j]
        pre=dp[j]
        itti=j
        break
    if num==k-1:
        print(road[j])
        exit()

mod=(k-pre)%t

for i in range(mod):
    itti=road[itti]
print(itti)

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
A=[i for i in range(1,n+1)]
B=list(map(int,input().split())) 
road=dict(zip(A,B))

#残りi回移動する、移動前に自分がいるところをj
def walk(i,j):
    if i==1:
        return road[j]
    else:
        return walk(i-1,road[j])

print(walk(k,1))
Problem p02691 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
L=[]
R=[]
for i in range(n):
  L.append(i+A[i])
  R.append(i-A[i])
from collections import Counter
zisyo=Counter(R)
ans=0
for i in L:
  ans=ans+zisyo.get(i,0)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
L=[]
R=[]
for i in range(n):
  L.append(i+A[i])
  R.append(i-A[i])
from collections import Counter
zisyo=R.Counter(R)
ans=0
for i in L:
  ans=ans+get(i,0)
print(ans)
Problem p02714 (python)

Fixed submission:
n=int(input())
s=list(input())
a=s.count("R")
b=s.count("G")
c=s.count("B")
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    k=2*j-i
    if n-1>=k and (s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]): 
      ans=ans+1
print(a*b*c-ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
a=s.count("R")
b=s.count("G")
c=s.count("B")
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    k=2*j-i
    if n>=k and (s[i]==s[j] or s[i]==s[k] or s[j]==s[k]): 
      ans=ans+1
print(abc-ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=[i for i in range(1,n+1)]
from itertools import combinations
c=list(combinations(k,3))
ans=0
for i in range(len(c)):
  p=int(c[i][0])
  q=int(c[i][1])
  r=int(c[i][2])
  if s[p]!=s[q] and s[q]!=s[r] and s[p]!=s[r] and q-p!=r-q:
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=[i for i in range(1,n+1)]
from itertools import combinations
c=list(combinations(k,3))
ans=0
for i in range(len(c)):
  p=c[i][0]
  q=c[i][1]
  r=c[i][2]
  if s[p]!=s[q] and s[q]!=s[r] and s[p]!=s[r] and q-p!=r-q:
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=[i for i in range(1,n+1)]
from itertools import combinations
c=list(combinations(k,2))
ans=0
for i in range(len(c)):
  p=c[i][0]
  q=c[i][1]
  r=c[i][2]
  if s[p]!=s[q] and s[q]!=s[r] and s[p]!=s[r] and q-p!=r-q:
    ans=ans+1
print(ans)
Problem p02717 (python)

Fixed submission:
a=list(input().split(" "))
print(a[2]+" "+a[0]+" "+a[1] )

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split(" ")))
n=a[0]
m=a[1]
touhyou=list(map(int,input().split(" ")))
s=flaot(sum(touhyou)/4/m)
list=[]
for i in touhyou:
  if i>=s:
    list.append(i)
if len(list)>=m:
  print("Yes")
else:
  print("No" )
Problem p02718 (python)

Fixed submission:
a=list(map(int,input().split()))
n=a[0]
m=a[1]
touhyou=list(map(int,input().split()))
s=float(sum(touhyou)/4/m)
list=[]
for i in touhyou:
  if i>=s:
    list.append(i)
if len(list)>=m:
  print("Yes")
else:
  print("No" )

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split(" ")))
n=a[0]
m=a[1]
touhyou=list(map(int,input().split(" ")))
s=flaot(sum(touhyou)/4/m)
list=[]
for i in touhyou:
  if i>=s:
    list.append(i)
if len(list)>=m:
  print("Yes")
else:
  print("No" )
a=list(map(int,input().split(" ")))
n=a[0]
m=a[1]
touhyou=list(map(int,input().split(" ")))
s=flaot(sum(touhyou)/4/m)
list=[]
for i in touhyou:
  if i>=s:
    list.append(i)
if len(list)>=m:
  print("Yes")
else:
  print("No" )
Problem p02719 (python)

Fixed submission:
list=list(map(int,input().split()))
x=list[0]
k=list[1]
if list[0]>=list[1]:
  x=x%k
z=abs(k-x)
if z >=x:
  print(x)
else:
  print(z)

Buggy submission (verdict: Runtime Error):
list=list(map(int,input().split()))
x=list[0]
k=list[1]
if list[0]>=list[1]:
  y=x%k
z=k-y
if z >=y:
  print(y)
else:
  print(z)

Buggy submission (verdict: Runtime Error):
list=list(map(int,input().split()))
k=list[1]
y=max(list)%min(list)
z=k-y
if z >=y:
  print(y)
else:
  print(z)
Problem p02720 (python)

Fixed submission:
from collections import deque
a=int(input())
q=deque([1,2,3,4,5,6,7,8,9])
def dfs(k):
  while k<=a:
    s=q.popleft()
    if s%10-1>=0:
      q.append(s*10+s%10-1)
      k=k+1
      if k==a:
        print(q.pop())
    q.append(s*10+s%10)
    k=k+1
    if k==a:
        print(q.pop())
    if s%10+1<=9:
      q.append(s*10+s%10+1)
      k=k+1
      if k==a:
        print(q.pop())
  
 
if a<=9:
  print(a)
else:
  dfs(9)

Buggy submission (verdict: Runtime Error):
from collections import deque
a=int(input())
q=deque([1,2,3,4,5,6,7,8,9])
def dfs(k):
  while k=a:
    s=q.popleft()
    if s-1>=0:
      q.aapend(s*10+s-1)
      n=n+1
    q.append(s*10+s)
    k=k+1
    if s+1<=9:
      q.append(s*10+s+1)
      k=k+1
  print(q.pop())
 
if a<=9:
  print(a)
else:
  dfs(9)

Buggy submission (verdict: Runtime Error):
from collections import deque
a=int(input())
q=deque([1,2,3,4,5,6,7,8,9])
def dfs(k):
  while k=a:
    s=q.popleft()
    if s-1>=0:
      q.aapend(s*10+s-1)
      n=n+1
    q.append(s*10+s)
    k=k+1
    if s+1<=9:
      q.append(s*10+s+1)
      k=k+1
  print(q.pop())

if a<=9:
  print(a)
else:
  dfs(9)
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
kouho=p[:X]+q[:Y]
kouho.sort()
for i in range(min(C,X+Y)):
    kouho[i]=max(kouho[i],r[i])
print(sum(kouho))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
kouho=p[:X]+q[:Y]
kouho.sort()
for i in range(C):
    kouho[i]=max(kouho[i],r[i])
print(sum(kouho))
Problem p02731 (python)

Fixed submission:
L=int(input())
print((L**3)/27)

Buggy submission (verdict: Runtime Error):
print((L**3)/27)
Problem p02756 (python)

Fixed submission:
from collections import deque
s=deque(list(input()))
q=int(input())
rev=0
for i in range(q):
    t=list(input().split())
    if t[0]=="1":
        rev=rev+1
    else:
        if t[1]=="1":
            if rev%2==0:
                s.appendleft(t[2])
            else:
                s.append(t[2])
        else:
            if rev%2==0:
                s.append(t[2])
            else:
                s.appendleft(t[2])
if rev%2==0:
    print("".join(s))
else:
    s.reverse()
    print("".join(s))

Buggy submission (verdict: Runtime Error):
s=list(input())
q=int(input())
rev=0
for i in range(q):
    t=list(input().split())
    if t[0]=="1":
        rev=rev+1
    else:
        if t[1]=="1":
            if rev%2==0:
                s.appendleft(t[2])
            else:
                s.append(t[2])
        else:
            if rev%2==0:
                s.append(t[2])
            else:
                s.appendleft(t[2])
if rev%2==0:
    print("".join(s))
else:
    s.reverse()
    print("".join(s))

Buggy submission (verdict: Runtime Error):
s=list(input())
q=int(input())
rev=0
for i in range(q):
    t=list(input().split())
    if t[0]=="1":
        rev=rev+1
    else:
        if t[1]=="1":
            if rev%2==0:
                s.insert(0,t[2])
            else:
                s.append(t[2])
        else:
            if rev%2==0:
                s.append(t[2])
            else:
                s.insert(0,t[2])
if rev%2==0:
    print("".join(s))
else:
    print("".join(s.reverse()))

Buggy submission (verdict: Runtime Error):
s=list(int(input()))
q=int(input())
for i in range(q):
    t=list(input())
    if t[0]==1:
        s.reverse()
    else:
        if t[1]==1:
            s.insert(0,t[2])
        else:
            s.append(t[2])
print("".join(s))
Problem p02761 (python)

Fixed submission:
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and (ans[0]==0 or ans[0]==-1):
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))

Buggy submission (verdict: Runtime Error):
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and (ans[0]==0　or ans[0]==-1)
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))

Buggy submission (verdict: Runtime Error):
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and ans[0]==0　or ans[0]==-1
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))

Buggy submission (verdict: Runtime Error):
import sys
n,m=list(map(int,input().split()))
ans=[-1 for i in range(n)]

for i in range(m):
  s,c=list(map(int,input().split()))
  if n!=1 and s==1 and c==0:
    print(-1)
    sys.exit()
  if ans[s-1]==-1 or ans[s-1]==c:
    ans[s-1]=c
  else:
    print(-1)
    sys.exit()

    
if n==1 and ans[0]==0　or -1
  print(0)
  sys.exit()
if ans[0]==-1:
  ans[0]=1
for i in range(1,n):
  if ans[i]==-1:
    ans[i]=0
ans=map(str, ans)
print("".join(ans))
Problem p02778 (python)

Fixed submission:
s=input()
n=len(s)
ans=[]
for i in range(n):
  ans.append("x")
print("".join(ans))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=[]
for i in range(n):
  ans.append("x")
print("",join(ans))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
ans=0
for i in range(n):
  ans.append("x")
print("",join(ans))
Problem p02910 (python)

Fixed submission:
import sys
s=list(input())
for i in range(len(s)):
  if i%2==0 and s[i]=="L":
    print("No")
    sys.exit()
  if i%2==1 and s[i]=="R":
    print("No")
    sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s=list(input())
for i in range(len(s)):
  if i%2==0 and s[i]=="L":
    print("No")
    sys.exit()
  if i%2==1 and s[i]=="R":
    print("No")
    sys.exit()
print(Yes)
Problem p02923 (python)

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

ans=[]
sum=0


for i in range(1,n):
  if h[i]<=h[i-1]:
    sum=sum+1
    ans.append(sum)
  else:
    sum=0
  
if len(ans)==0:
  print(0)
else:
  print(max(ans))

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

ans=[]
sum=0


for i in range(1,n):
  if h[i]<=h[i-1]:
    sum=sum+1
    ans.append(sum)
  else:
    sum=0
  

print(max(ans))
Problem p02934 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sum=0
for i in range(n):
  sum=sum+1/a[i]
print(1/sum)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
sum=0
for i in range(n):
  sum=sum+1/a[i]
print(1/ans)
Problem p02952 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(i))%2==1:
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(1,n+1):
  if len(i)%2==1:
    ans=ans+1
print(ans)
Problem p02969 (python)

Fixed submission:
r=int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
r=int(input())
print(3*a*a)
Problem p02994 (python)

Fixed submission:
n,k=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(k+i)
l.sort()
if max(l)>=0 and min(l)<=0:
  print(sum(l))
elif max(l)<0:
  print(sum(l)-l[n-1])
else:
  print(sum(l)-l[0])

Buggy submission (verdict: Runtime Error):
n,k=list(map(int,input().split()))
l=[]
for i in range(n):
  l.append(k+i)
l.sort()
if max(l)=>0 and min(l)<=0:
  print(sum(l))
elif max(l)<0:
  print(sum(l)-l[n-1])
else:
  print(sum(l)-l[0])
Problem p03086 (python)

Fixed submission:
s=list(input())
n=len(s)
sum=0
ans=0
check=["A","T","C","G"]
for i in range(n):
  if s[i] in check:
    sum=sum+1
  else:
    ans=max(ans,sum)
    sum=0
print(max(ans,sum))

Buggy submission (verdict: Runtime Error):
s=list(input())
n=len(s)
sum=0
ans=[]
check=["A","T","C","G"]
for i in range(n):
  if s[i] in check:
    sum=sum+1
  else:
    ans.append(sum)
    sum=0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s=list(input())
t=[]
for i in range(len(s)):
    if s[i]!="A" and s[i]!="C" and s[i]!="G"and s[i]!="T":
        t.append(i)
t=[-1]+t
u=[]
for i in range(len(t)-1):
    u.append(t[i+1]-t[i])
print(max(u)-1)
Problem p03087 (python)

Fixed submission:
from itertools import accumulate
n,q=list(map(int,input().split()))
s=list(input())
l=[0]*q
r=[0]*q
for i in range(q):
  l[i],r[i]=list(map(int,input().split()))
A=[]
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    A.append(1)
  else:
    A.append(0)
check=[0]+A+[0]
check=list(accumulate(check))
for i in range(q):
  print(check[r[i]-1]-check[l[i]-1])

Buggy submission (verdict: Runtime Error):
n,q=list(map(int,input().split()))
s=list(input())
l=[0]*q
r=[0]*q
for i in range(q):
  l[i],r[i]=list(map(int(input().split())))
A=[]
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="C":
    A.append(1)
  else:
    A.append(0)
check=[0]+A
check=list(accumulate(check))
for i in range(q):
  print(check[r[i]]-check[l[i]+1])
Problem p03281 (python)

Fixed submission:
n=int(input())
def yakusuu(n):
  num=0
  if n%2==1:
    for i in range(1,n+1):
      if n%i==0:
        num=num+1
  return num 

ans=0
for i in range(n+1):
  if yakusuu(i)==8:
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
def yakusuu(n):
  num=0
  for i in range(1,n):
    if n%i==0:
      num=num+1
  return num==8
ans=0
for i in range(n):
  if def(i):
    ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
#import math
N=int(input())
def yakusuu(n):
  num=_0
  for i in range(1,n):
    if n%i==0:
      num=num+1
  return num==8
ans=0
for i in range(n):
  if def(i):
    ans=ans+1
print(ans)