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

Fixed submission:

def main():
    y, x = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    x, y = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            link = False
            if a[j][i] == '#':
                if i-1 >= 0 and a[j][i-1] == '#':
                    link = True
                if i+1 < x and a[j][i+1] == '#':
                    link = True
                if j-1 >= 0 and a[j-1][i] == '#':
                    link = True
                if j+1 < y and a[j+1][i] == '#':
                    link = True

                if not link:
                    print('No')
                    return

    print('Yes')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    x, y = [int(i) for i in input().split()]
    a = []
    for i in range(y):
        a.append(input().strip())

    for i in range(x):
        for j in range(y):
            f = False
            if a[j][i] == '#':
                if i-1 > 0 and a[j][i-1] == '#':
                    f = True
                if i+1 < x and a[j][i+1] == '#':
                    f = True
                if j-1 > 0 and a[j-1][i] == '#':
                    f = True
                if j+1 < y and a[j+1][i] == '#':
                    f = True

                if not f:
                    print('No')
                    return

    print('Yes')

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

Fixed submission:
def main():
    n = int(input().strip())
    s = [input().strip() for _ in range(n)]
    m = int(input().strip())
    t = [input().strip() for _ in range(m)]


    cand = list(set(s))
    g = [s.count(c) - t.count(c) for c in cand]
    ans = max(g)
    if ans < 0:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b, k = [int(i) for i in input().split()]

    s = set()
    for i in range(k):
        if a <= a+i and a+i <= b:
            s.add(a+i)
    for i in reversed(range(k)):
        if a <= b-i and b-i <= b:
            s.add(b-i)

    ans = list(s)
    ans.sort()

    for a in ans:
        print(a)
            
if __name__ == '__main__':
    main()
Problem p03476 (python)

Fixed submission:
def calc_prime(n):
    primes = set(list(range(3, n, 2)))
    primes.add(2)
    for a in range(3, n, 2):
        for i in range(a, n):
            x = a * i
            if x >= n:
                break
            if x in primes:
                primes.remove(x)

    return primes


def collect_likes(ps):
    likes = set([p for p in ps if (p + 1) / 2 in ps])
    return likes


def line(xs, n):
    ps = list(xs)
    ps.sort()
    cs = [0] * n
    s = 0
    for i in range(n):
        if i in xs:
            cs[i] = s
            s += 1
        else:
            cs[i] = s

    return cs


def main():
    n = 10 ** 5 + 9
    primes = calc_prime(n)
    likes = collect_likes(primes)
    cums = line(likes, n)
    #print(sorted(list(primes))[:100])
    #print(sorted(list(likes))[:100])
    #print(cums[:10])

    q = int(input())
    for _ in range(q):
        l, r = [int(x) for x in input().split()]
        ans = cums[r + 1] - cums[l]
        print(ans)


main()

Buggy submission (verdict: Runtime Error):
def calc_prime(n):
    primes = set(list(range(3, n, 2)))
    primes.add(2)
    for a in range(3, n, 2):
        for i in range(a, n):
            x = a * i
            if x >= n:
                break
            if x in primes:
                primes.remove(x)

    return primes


def collect_likes(ps):
    likes = set([p for p in ps if (p + 1) / 2 in ps])
    return likes


def line(xs, n):
    ps = list(xs)
    ps.sort()
    cs = [0] * n
    s = 0
    for i in range(n):
        if i in xs:
            cs[i] = s
            s += 1
        else:
            cs[i] = s

    return cs


def main():
    n = 10 ** 5
    primes = calc_prime(n)
    likes = collect_likes(primes)
    cums = line(likes, n)
    #print(sorted(list(primes))[:100])
    #print(sorted(list(likes))[:100])
    #print(cums[:10])

    q = int(input())
    for _ in range(q):
        l, r = [int(x) for x in input().split()]
        ans = cums[r + 1] - cums[l]
        print(ans)


main()

Buggy submission (verdict: Runtime Error):
def calc_prime(n):
    primes = set(list(range(3, n, 2)))
    primes.add(2)
    for a in range(3, n, 2):
        for i in range(a, n):
            x = a * i
            if x >= n:
                break
            if x in primes:
                primes.remove(x)

    return primes


def collect_likes(ps):
    likes = set([p for p in ps if (p + 1) / 2 in ps])
    return likes


def line(xs, n):
    ps = list(xs)
    ps.sort()
    cs = [0] * n
    s = 0
    for i in range(n):
        if i in xs:
            cs[i] = s
            s += 1
        else:
            cs[i] = s

    return cs


def main():
    n = 10 ** 5
    primes = calc_prime(n)
    likes = collect_likes(primes)
    cums = line(likes, n)
    #print(sorted(list(primes))[:100])
    print(sorted(list(likes))[:100])
    #print(cums[:10])

    q = int(input())
    for _ in range(q):
        l, r = [int(x) for x in input().split()]
        ans = cums[r + 1] - cums[l]
        print(ans)


main()
Problem p02639 (python)

Fixed submission:
a,b,c,d,e=map(int,input().split())

if a==0:
    print('1')
if b==0:
    print('2')
if c==0:
    print('3')
if d==0:
    print('4')
if e==0:
    print('5')

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

if a=0:
    print('1')
if b=0:
    print('2')
if c=0:
    print('3')
if d=0:
    print('4')
if e=0:
    print('5')

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

if a=0
    print('1')
if b=0
    print('2')
if c=0
    print('3')
if d=0
    print('4')
if e=0
    print('5')
Problem p02675 (python)

Fixed submission:
a=input()

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8':
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9':
    print('hon')

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6

hh=h*30+30*m/60
if hh-mm<=180:
    cos = math.cos(math.radians(abs(hh-mm)))
else:
    cos = math.cos(math.radians(360-abs(hh-mm)))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6

hh=h*30+30*m/60
if hh-mm<=180:
    cos = math.cos(math.radians(abs(hh-mm)))
else:
    cos = math.cos(math.radians(abs(360-(mm-hh))))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b


mm=m*6
if m != 0:
    hh=h*30+30*m/60
else:
    hh=h*30

cos = math.cos(math.radians(abs(hh-mm)))
#print(cos)
cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b

hh=h*30
mm=m*6

cos = math.cos(math.radians(abs(hh-mm)))

cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)

Buggy submission (verdict: Runtime Error):
import math

a,b,h,m=map(int,input().split())

aa=a*a
bb=b*b

hh=h*30
mm=m*6

cos = math.cos(math.radians(abs(hh-mm)))

cc=aa+bb-2*a*b*cos

c=math.sqrt(cc)

print(c)

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

if a[-1]=='3':
    print('bon')
elif a[-1]=='0' or a[-1]=='1' or a[-1]=='6' or a[-1]=='8'
    print('pon')
elif a[-1]=='2' or a[-1]=='4' or a[-1]=='5' or a[-1]=='7' or a[-1]=='9'
    print('hon')
Problem p02647 (python)

Fixed submission:
def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = read_input()
K = min(K, 41)

for _ in range(K):
    B = [0]*N
    for i in range(N):
        start = max(i-A[i], 0)
        end = min(i+A[i], N-1)

        B[start] += 1
        if end+1 < N:
            B[end+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()


print(" ".join(map(str, A)))

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


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = read_input()
K = min(K, 41)

for _ in range(K):
    B = [0]*N
    for i in range(N):
        start = max(i-A[i], 0)
        end = min(i+A[i], N-1)

        B[start] += 1
        if end+1 < N:
            B[end+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()


print(" ".join(map(str, A)))

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


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
B = np.zeros(N, dtype="int")
coordinate = np.arange(1, N+1)

limit = np.log(N)
for j in range(K):
    for i in range(N):
        c = coordinate[i]
        B[i] = (A >= np.abs(coordinate - c)).sum()
    A = B.copy()
    if j > limit_count:
        break


print(" ".join(map(str, A.tolist())))

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


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
B = np.zeros(N, dtype="int")
coordinate = np.arange(1, N+1)


for _ in range(K):
    A = [(A >= np.abs(coordinate - coordinate[i])).sum() for i in range(N)]

print(" ".join(map(str, A.tolist())))
Problem p02639 (python)

Fixed submission:
x=input().split()
for i in range(5):
  if x[i]=='0': print(str(i+1))

Buggy submission (verdict: Runtime Error):
x=input.split()
for i in range(5):
  if x[i]=='0': print(str(i+1))
Problem p02714 (python)

Fixed submission:
def rest_col(s1,s2):
  if(s1=="R"):
    if(s2=="R"):
      return -1
    elif(s2=="G"):
       return 2
    else:
       return 1
  if(s1=="G"):
    if(s2=="G"):
      return -1
    elif(s2=="R"):
       return 2
    else:
       return 0
  if(s1=="B"):
    if(s2=="B"):
      return -1
    elif(s2=="R"):
       return 1
    else:
       return 0

str_c=["R","G","B"]
n=int(input())
s=input()
count=[[0,0,0] for i in range(n)] #count[i][c]はi番目以上で色cの個数
if(s[n-1]=="R"):
  count[n-1][0]=1
if(s[n-1]=="G"):
  count[n-1][1]=1
if(s[n-1]=="B"):
  count[n-1][2]=1
for i in range(1,n):
  count[n-1-i][0]=count[n-i][0]
  count[n-1-i][1]=count[n-i][1]
  count[n-1-i][2]=count[n-i][2]
  if(s[n-1-i]=="R"):
    count[n-1-i][0]+=1
  if(s[n-1-i]=="G"):
    count[n-1-i][1]+=1
  if(s[n-1-i]=="B"):
    count[n-1-i][2]+=1
ans=0
for a in range(n-1):
  for b in range(a,n-1):
    r=rest_col(s[a],s[b])
    if(r!=-1):
      ans+=count[b+1][r]
      if(2*b-a<len(s)):
        if(s[2*b-a]==str_c[r]):
          ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
def rest_col(s1,s2):
  if(s1=="R"):
    if(s2="R"):
      return -1
    elif(s2=="G"):
       return 2
    else:
       return 1
  if(s1=="G"):
    if(s2="G"):
      return -1
    elif(s2=="R"):
       return 2
    else:
       return 1
  if(s1=="B"):
    if(s2="B"):
      return -1
    elif(s2=="R"):
       return 1
    else:
       return 0

n=int(input())
s=input()
count=[[0,0,0] for i in range(n)]
for i in range(n):
  if(s[n-1-i]=="R"):
    count[n-1-i][0]+=1
  if(s[n-1-i]=="G"):
    count[n-1-i][1]+=1
  if(s[n-1-i]=="B"):
    count[n-1-i][2]+=1
ans=0
for a in range(n):
  for b in range(a,n):
    r=rest_color(s[a],s[b])
    if(r==-1):
      continue
    else:
      ans+=count[b+1][r]
print(ans)
Problem p02731 (python)

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

Buggy submission (verdict: Runtime Error):
l=map(int,input())
print((l/3)**3)
Problem p02732 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ct=[0]*n
cmb=[0]*n
s_cmb=0
for i in range(0,n):
  a[i]-=1
  ct[a[i]]+=1
for i in range(0,n):
  cmb[i]=ct[i]*(ct[i]-1)//2
  s_cmb+=cmb[i]
for i in range(0,n):
  print(s_cmb-cmb[a[i]]+(ct[a[i]]-1)*(ct[a[i]]-2)//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ct=[0]*n
cmb=[0]*n
s_cmb=0
for i in range(0,n):
  ct[a[i]]+=1
for i in range(0,n):
  cmb[i]=ct[i]*(ct[i]-1)//2
  s_cmb+=cmb[i]
for i in range(0,n):
  print(s_cmb-cmb[a[i]]+(ct[a[i]]-1)*(ct[a[i]]-2)//2)
Problem p02765 (python)

Fixed submission:
n,r=map(int,input().split());
print(r+100*max(10-n,0));

Buggy submission (verdict: Runtime Error):
n,r=map(int,input());
print(r+100*min(10-n,0));
Problem p02861 (python)

Fixed submission:
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*2/n)

Buggy submission (verdict: Runtime Error):
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[0])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
fac=1
for i in range(n):
  if(i!=0):
    fac*=i
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*(2n-2)/(fac*n))

Buggy submission (verdict: Runtime Error):
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[0])**2)**0.5

n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
fac=1
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
  fac*=i
print(ans*(2n-2)/fac)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
den=1
for i in range(n):
  ans+=(p[i][0]**2+p[i][1]**2)**0.5
  den*=i
print(ans/den)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=[list(map(int,input().split()))]
ans=0
den=1
for i in range(n):
  ans+=(p[i][0]**2+p[i][1]**2)**0.5
  den*=i
print(ans/den)
Problem p02900 (python)

Fixed submission:
def factorize(a):
    x=2
    ret=[]
    rt_a=a**0.5
    while x<=a:
        if(x>=rt_a):
            ret.append(a)
            break
        if(a%x==0):
            ret.append(x)
        while a%x==0:
            a//=x
        x+=1
    return ret

def gcd(a,b):
    tmp=a
    a=max(a,b)
    b=min(tmp,b)
    if(a%b==0):
        return b
    return gcd(b,a%b)

a,b=map(int,input().split())
print(len(set(factorize(gcd(a,b))))+1)

Buggy submission (verdict: Runtime Error):
import math
def factorize(a):
    x=2
    ret=[]
    while x<=a:
        while a%x==0:
            a//=x
            ret.append(x)
        x+=1
    return ret
a,b=map(int,input().split())
print(len(set(factorize(math.gcd(a,b))))+1)
Problem p03074 (python)

Fixed submission:
a = []

n,k = map(int, input().split())
for x in range(k+1):
  a.append(0)
q = input()

p = 0
c = 0
mx = 0

for i in range(n-1):
  p = p+1
  c = c+1  
  if q[i] == q[i+1]:
    lalala = 1

  elif (int(q[i]) == 1) & (int(q[i+1]) == 0) :
    p = p-a[0]
    if p > mx:
      mx = p
    
  elif (int(q[i]) == 0) & (int(q[i+1]) == 1):
    a.pop(0)
    a.append(c)
    c = 0

if int(q[n-1]) == 1:
  if p+1- a[0]> mx:
    mx = p +1 - a[0]
else:
  if p+1 -a[1] > mx:
    mx = p  -a[1] +1
  
  


print(mx)

Buggy submission (verdict: Runtime Error):
a = []

n,k = map(int, input().split())

for i in range(k):
  a.append(0)

q = input()


if a[0] = 1:
  a.append(0)

c = 0
mx = 0

for i in range(n-1):
  c = c+1  
  if q[i] == q[i+1]:
    lalala = 1

  if q[i] = 1 & q[i+1] = 0:
    for x in range(n+1):
      a[x] = a[x]+c
    c = 0
    if mx < a[0]:
      mx = a[0]
    pop(a[0])
    
  if q[i] = 0 & q[i+1] = 1:
    for x in range(n):
      a[x] = a[x]+c
    c = 0
    a.append(0)

for x in range(n):
  a[0] = a[0]+c+1
  if mx < a[0]:
    mx = a[0]
  pop(a[0])
 

if q[n-1] = 1:
  a[0] = a[0]+c+1
  if mx < a[0]:
    mx = a[0]
  pop(a[0])


print(mx)
Problem p02658 (python)

Fixed submission:
def main():
  N=int(input())
  A = list(map(int, input().split()))
  if 0 in A:
    print(0)
    return
  S=1
  for a in A:
    S*=a
    if S>10**18:
      print(-1)
      return
  print(S)


main()

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=np.array[input()]
S=1

for i in range(N):
  S=S*A[i]
  
if S>10^18:
  S=-1
  
print(S)
Problem p02660 (python)

Fixed submission:
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())
l = prime_factorize(N)
m = set(l)
l2 = list(m)
ans = 0

for i in range(len(l2)):
    x = l.count(l2[i])
    y = 1
    while x >= y:
        x = x - y
        y += 1
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
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())
l = prime_factorize(N)
m = set(l)
l2 = list(m)
ans = 0
for i in range(len(l2)):
    x = l.count(l2[i]))
    while x >= 2:
        x  = x/2
        ans += 1
print(ans)
Problem p02641 (python)

Fixed submission:
x, n = list(map(int, input().split()))
if n >= 1:
    p = list(map(int, input().split()))

    sample = list(range(0,max(p)+2)) 
    reject = list(set(p))

    for i in range(len(reject)):
        sample.remove(reject[i])

    champ = abs(sample[0] - x)
    ans = sample[0]
    for i in range(1, len(sample)):
        if abs(sample[i] - x) < champ:
            champ = abs(sample[i] - x)
            ans = sample[i]
        elif abs(sample[i] - x) == champ:
            if ans >= sample[i]:
                ans = sample[i]
            else:
                pass
        else:
            pass

    print(ans) 

else:
    print(x)

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

sample = list(range(0,max(p)+2)) 
reject = list(set(p))

for i in range(len(reject)):
    sample.remove(reject[i])

champ = abs(sample[0] - x)
ans = sample[0]
for i in range(1, len(sample)):
    if abs(sample[i] - x) < champ:
        champ = abs(sample[i] - x)
        ans = sample[i]
    elif abs(sample[i] - x) == champ:
        if ans >= sample[i]:
            ans = sample[i]
        else:
            pass
    else:
        pass
    
print(ans)
Problem p02713 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
 
K = int(read())
 
x = np.arange(1, K + 1)
nums = np.gcd.outer(np.gcd.outer(x, x), x)
print(nums.sum())

Buggy submission (verdict: Runtime Error):
K = int(input())
 
x = np.arange(1, K + 1)
nums = np.gcd.outer(np.gcd.outer(x, x), x)
print(nums.sum())

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
 
K = int(float(read())
 
x = np.arange(1, K + 1)
nums = np.gcd.outer(np.gcd.outer(x, x), x)
print(nums.sum())

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

k = int(input())

answer = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            answer += np.gcd.reduce([a,b,c])

print(answer)

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

k = int(input())



def gcd(*numbers):
    return reduce(math.gcd, numbers)

answer = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            answer += np.gcd.reduce([a,b,c])

print(answer)

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

import math

def gcd(*numbers):
    return reduce(math.gcd, numbers)

answer = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            answer += gcd(a,b,c)

print(answer)
Problem p02718 (python)

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

Buggy submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

// 文字列を1行入力
func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringReturned = scanner.Text()

	stringReturned = strings.TrimSpace(stringReturned)
	return
}

// 空白や空文字だけの値を除去したSplit()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}
	return
}

// デリミタで分割して文字列スライスを取得
func SplitStrStdin(delim string) (stringReturned []string) {
	// 文字列で1行取得
	stringInput := StrStdin()

	// 空白で分割
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

// デリミタで分割して整数値スライスを取得
func SplitIntStdin(delim string) (intSlices []int, err error) {
	// 文字列スライスを取得
	stringSplited := SplitStrStdin(" ")

	// 整数スライスに保存
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

func main() {
	input, _ := SplitIntStdin(" ")
	N, M := input[0], input[1]

	input, _ = SplitIntStdin(" ")
	input = input[0:N]
	sum := 0
	for _, x := range input {
		sum += x
	}

	var M_f float64 = float64(M)
	var sum_f float64 = float64(sum)

	count := 0
	for _, x := range input {
		var x_f float64 = float64(x)
		if x_f >= sum_f/(4.0*M_f) {
			count += 1
		}
	}
	fmt.Println(sum_f / (4.0 * M_f))
	fmt.Println(count)
}

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
cnt = 0
for a in A:
	if a >= S / (4*M):
	cnt += 1
if cnt >= M:
	print("Yes")
else:
print("No")