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

Fixed submission:
# coding: utf-8
# Your code here!


n = [int(input()) for i in range(5)]
    
k = int(input())

ans = 0

for i in range(5):
    for j in range(5)[i+1:]:
        if n[j]-n[i]>k:
            ans+=1
            
if ans == 0:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

x,y,z,k = map(int,input().split())

A = sorted(map(int,input().split()))[::-1]
B = sorted(map(int,input().split()))[::-1]
C = sorted(map(int,input().split()))[::-1]

AB = [a+b for a in A for b in B]
AB.sort(reverse = True)

ans = [ab + c for ab in AB[:k] for c in C]
ans.sort(reverse = True)

for i in ans[:k]:
    print(i)
Problem p03315 (python)

Fixed submission:
# coding: utf-8
# Your code here!

x = input()

ans = 0
for i in x:
    if(i=="+"):
        ans+=1
    elif(i=="-"):
        ans-=1
        

print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
k = int(input())

count = 0
ans = []
minN = 10**15

for i in reversed(range(10)):
    for j in reversed(range(1,10**5)):
        num = str(j)+"9"*i
        n = sum([int(k) for k in num])
        n = int(num)/n
        if(minN > n or n==1):
            minN = n
            ans.append(num)

print(len(ans[0]),len(ans))
for i in list(reversed(ans))[:k]:
    print(i)
Problem p03332 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: utf-8 -*-

MOD = 998244353


############
l = raw_input()
N, A, B, K = [int(x) for x in l.split()]

Fac = [1] * (N+1)
invFac = [1] * (N+1)
for i in xrange(2, N+1):
	Fac[i] = (Fac[i-1] * i) % MOD
for i in xrange(2, N+1):
	invFac[i] = pow(Fac[i], MOD-2, MOD)

def C(n, m):
	return (((Fac[n] * invFac[m]) % MOD) * invFac[n-m]) % MOD

# print invFac[:20]

pl = []
for a in xrange(N+1):
	b = (K-A*a)//B
	if b < 0 or b > N:
		continue
	if A*a + B*b != K:
		continue
	pl.append((a, b))

# print pl

ans = 0
for a, b in pl:
	ans = (ans + (C(N, a) * C(N, b)) % MOD) % MOD
print ans

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: utf-8 -*-

MOD = 998244353


############
l = raw_input()
N, A, B, K = [int(x) for x in l.split()]

Fac = [1] * (N+1)
invFac = [1] * (N+1)
for i in xrange(2, N+1):
	Fac[i] = (Fac[i-1] * i) % MOD
for i in xrange(2, N+1):
	invFac[i] = pow(Fac[i], MOD-2, MOD)

def C(n, m):
	return (((Fac[n] * invFac[m]) % MOD) * invFac[n-m]) % MOD

# print invFac[:20]

pl = []
for a in xrange(N+1):
	b = (K-A*a)//B
	if b > N:
		continue
	if A*a + B*b != K:
		continue
	pl.append((a, b))

# print pl

ans = 0
for a, b in pl:
	ans = (ans + (C(N, a) * C(N, b)) % MOD) % MOD
print ans
Problem p02711 (python)

Fixed submission:
N = input()
 
for i in range(len(N)):
	if N[i] =='7':
		print("Yes")
		exit()
 
print("No")

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

for i in range(len(N)):
	if N[i] =='7':
    	print("Yes")
       	exit()

print("No")
Problem p02753 (python)

Fixed submission:
s = input()

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        print("Yes")
        exit()

print("No")

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


print( (n-1)*n/2+(m-1)*m/2)
Problem p02951 (python)

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

print(max(c-(a-b),0))

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

print(max(c-(a-b),0)
Problem p03127 (python)

Fixed submission:
import fractions

n = int(input())

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

ans = a[0]
for i in range(1,len(a)):
    ans = fractions.gcd(ans,a[i])


print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())

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

ans = a[0]
for i in range(1,len(a)):
    ans = math.gcd(ans,a[i])


print(ans)
Problem p03307 (python)

Fixed submission:
a = list(map(int,input().split()))
b = int(a[0])
if b %2 == 0:
    print(b)
else:
    print(b*2)

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

if a%2 == 0:
    print(a)
else:
    print(a*2)
Problem p03745 (python)

Fixed submission:
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

#N,*A = map(int,read().split())
N = int(input())
l = list(map(int,input().split()))

#最初の状態分を加算するため、1からカウント
ans = 1

S = 0 #現在の状態 増加 or 減少 or 初期化

for i in range(1,N):
    X = l[i] - l[i-1]

    X = 0 if X == 0 else 1 if X > 0 else -1

    #同じ値の時l[i] == l[i-1]
    if X == 0:
        continue

    #Stateが初期のときは現在の状態に更新
    elif S == 0:
        S = X

    #Stateが違うときは答えに加算して、Stateを初期値に
    elif S != X:
        ans += 1
        S = 0

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

#N,*A = map(int,read().split())
N = int(input())
A = list(map(int,input().split()))



#増減のメモ 
# A[i] > A[i+1]  :  1
# A[i] < A[i+1]  : -1
# A[i] == A[i+1] :  0
x = []
for i in range(N-1):
    if A[i]  < A[i+1]:
        x.append(1)
    elif A[i] > A[i+1]:
        x.append(-1)
    else:
        x.append(0)


res = 1  #答え

#print(len(x))
state = x[0] #単調増加 or 単調減少の二種で現在の状態を記録
i = 1
while  i < N-1:
    if x[i] ==  state or state == 0:
        pass
    else:
        if i != N -2:
            state = x[i+1]
            i+=1
            res+=1
    i+=1

if x[-1] != x[-2] and x[-1] != 0 and x[-2]!= 0 :
    print(res+1)
else:
    print(res)

Buggy submission (verdict: Runtime Error):
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

N = int(readline())
A = list(map(int,readline().split()))

res = 0

in_i = 0
de_i = 0
i = 0
while i < N-1:
    for j in range(i+1,N):
        if A[j] >= A[j-1]:continue
        else:
            break

    in_i = j
    for j in range(i+1,N):
        if A[j] <= A[j-1]:continue
        else:
            break
    de_i = j

    i = max(de_i,in_i)
    res+=1
#print(res)

if (A[-3] - A[-2])*(A[-2] - A[-1]) >= 0: print(res)
else: print(res+1)

Buggy submission (verdict: Runtime Error):
import sys

read= sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 1000000007
sys.setrecursionlimit(10**7)

N = int(readline())
A = list(map(int,readline().split()))

res = 0

in_i = 0
de_i = 0
i = 0
while i <= N-1:
    for j in range(i+1,N):
        if A[j] >= A[j-1]:continue
        else:
            break

    in_i = j
    for j in range(i+1,N):
        if A[j] <= A[j-1]:continue
        else:
            break
    de_i = j

    i = max(de_i,in_i)
    res+=1
print(i)

print(res)
Problem p02659 (python)

Fixed submission:
a,b=list(map(float, input().split()))
a=int(a)
b=round(b*100)
print((a*b)//100)

Buggy submission (verdict: Runtime Error):
a,b=list(map(int, input().split()))
print((a*b)//1)
Problem p02793 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
if x==1:
	print(1)
else:
	chk=lcm(a[0],a[1])
	for i in range(x):
		chk=lcm(chk,a[i])
	for i in range(x):
		ans=ans+(chk//a[i])
	print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

x=int(input())
a=list(map(int, input().split()))
ans=0
chk=lcm(a[0],a[1])
for i in range(x):
	chk=lcm(chk,a[i])
for i in range(x):
	ans=ans+(chk//a[i])
print(ans%(10**9+7))
Problem p03127 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse = False) 

B = [A[0]]
for i in range(N):
    if A[i]%A[0] != 0:
        B.append(A[i]%A[0])
B = set(B)
#B = sorted(B,reverse = False) 

#import math
import fractions
from functools import reduce

def gcd_list(numbers):
    #return reduce(math.gcd, numbers)
    return reduce(fractions.gcd, numbers)

print(gcd_list(B))

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

B = [A[0]]
for i in range(N):
    if A[i]%A[0] != 0:
        B.append(A[i]%A[0])
B = set(B)
B = sorted(B,reverse = False) 

#import math
import fractions
from functools import reduce

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

print(gcd_list(B))

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

B = [A[0]]
for i in range(N):
    if A[i]%A[0] != 0:
        B.append(A[i]%A[0])
B = set(B)
B = sorted(B,reverse = False) 


import math
from functools import reduce

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

print(gcd_list(B))
Problem p03137 (python)

Fixed submission:
N, M = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H,reverse = False) 

if N == 1:
    print(abs(H[M-1] - H[0]))
else:
    A = []
    for i in range(M-1):
        A.append(H[i+1] - H[i])
    A = sorted(A,reverse = False) 
    print(sum(A[:-N+1]))

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

X = sorted(X)
if N == 1:
    print(abs(X[M-1] -X[0]))
else:
    A=[]
    for i in range(M-1):
        A.append(abs(X[i]-X[i+1]))
print(sum(sorted(A)[:M-N]))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H,reverse = False) 

if N == 1:
    print(abs(H[M-1] - H[0]))
else:
    A = []
    for i in range(M-1):
        A.append(H[i+1] - H[i])
        A = sorted(A,reverse = False) 
print(sum(A[:-N+1]))

Buggy submission (verdict: Runtime Error):
N, M = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H,reverse = False) 

if N == 1:
    print(max(H)- min(H))
else:
    A = []
    for i in range(M-1):
        A.append(H[i+1] - H[i])
        A = sorted(A,reverse = False) 
print(sum(A[:-N+1]))
Problem p03208 (python)

Fixed submission:
from collections import Counter

N, K = list(map(int,input().split()))
H = []
for i in range(N):
    H.append(int(input()))
H = sorted(H,reverse = False)
C = Counter(H)
CH = list(C.values()) 

cnt = 0
for i in range(len(CH)):
    if CH[i] >= K:
        cnt += 1
        break
ans = 999999999999999
for i in range(N-K+1):
    ans = min(ans,H[K-1+i] - H[i]) 

if cnt != 0:
    print('0')
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N, K = list(map(int,input().split()))
H = []
for i in range(N):
    H.append(int(input()))
H = sorted(H,reverse = False)
C = Counter(H)
CH = list(C.values()) 

cnt = 0
for i in range(len(CH)):
    if CH[i] >= K:
        cnt += 1
        break
if cnt != 0:
    print('0')
else:
    #print(H[K-1] - H[0])
    print(min(H[K-1] - H[0],H[K] - H[1],H[K+1] - H[2]))
Problem p02629 (python)

Fixed submission:
n = int(input())
p = 26
while n > p:
  n -= p
  p *= 26

n -= 1
s = ''
while p > 1:
  n, r = divmod(n, 26)
  s = chr(97 + r) + s
  p //= 26
print(s)

Buggy submission (verdict: Runtime Error):
import Data.Char (chr)

solve :: Int -> Int -> (Int, String)
solve p n = (q, chr (97 + r) : s)
  where
    (m, s) = if n > p
               then solve (p * 26) (n - p)
               else (n - 1, "")
    (q, r) = m `divMod` 26

main :: IO ()
main = getLine >>= putStrLn . snd . solve 26 . read
Problem p03201 (python)

Fixed submission:
from collections import Counter
if __name__ == "__main__":
    N=int(input())
    lista=list(map(int,input().split()))
    mii=Counter(lista)
    si=set(lista)
    listb=[i for i in si]
    listb.sort()
    ans=0
    while(len(listb)>0):
        x=listb.pop()
        if mii[x]>0:
            k=1
            while k<=x:
                k*=2
            y=k-x
            if x==y:
                ans+=mii[x]//2
            elif y<x and y in si:
                m=min(mii[x],mii[y])
                ans+=m
                mii[y]-=m
            mii[x]=0
    print(ans)

Buggy submission (verdict: Runtime Error):
    N=int(input())
    lis=list(map(int,input().split()))
    lis.sort()
    sum=0
    while(len(lis)>1):
        v=lis.pop()
        k=1
        while k<=v:
            k*=2
        m=k-v
        if m in lis:
            sum+=1
            lis.remove(m)

    print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
    lis=list(map(int,input().split()))
    lis.sort(reverse=True)
    dis={}
    for x in lis:
        if x in dis.keys():
            dis[x]=dis[x]+1
        else:
            dis[x]=1
    lis=[]
    sum=0
    for key,value in dis.items():
        if value<=0:
            continue
        else:
            x = 1
            while (x<=key):
                x*=2
            another = x-key
            if another in dis.keys() and dis[another]>0:
                if another==key:
                    sum+=value//2
                else:
                    m=min(dis[another],value)
                    dis[another]-=m
                    sum+=m
            dis[key]=0
    print(sum)
Problem p02629 (python)

Fixed submission:
N = int(input())
alph = {key + 1: val for key, val in enumerate('abcdefghijklmnopqrstuvwxyz')}
alph[0] = 'z'
answer = ''
while N >= 1:
  answer = alph[N % 26] + answer
  if N == 26:
    break
  N = (N - 1) // 26

print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
alph = {key + 1: val for key, val in enumerate('abcdefghijklmnopqrstuvwxyz')}
answer = ''
while N >= 1:
  answer = alph[N % 26] + answer
  N //= 26

print(answer)
Problem p02629 (python)

Fixed submission:
n = int(input());
ans = '';
ptr = 0;
while(n>0):
  n-=1;
  temp = n%26;
  n=n//26;
  ans = chr(97+temp)+ ans 
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input());
ans = '';
while(n>0):
  temp = n%26;
  if(temp==0):
    temp+=26;
  n=n//26;
  ans = ord(96+i)+ ans 
print(ans)
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
n_l = [i for i in range(0,n*2,2)]
m_l = [i for i in range(1,m*2,2)]
hoge = n_l + m_l
count = 0
for i in hoge:
    for j in hoge:
        if (i!=j)&((i+j)%2==0):
            count+=1
print(int(count/2))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import math
import collections
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def get_result(key, c):
    ans = 0
    for d in c.items():
        if d[0] == key:
            value = d[1]-1
        else:
            value = d[1]
        if value > 1:
            ans += combinations_count(value, 2)
    return int(ans)
ans = {}
tmp = a.copy()
tmp.sort()
c = collections.Counter(tmp)
for k in range(n):
    key = a[k]
    if key in ans:
        print(ans[key])
    else:
        ans[key] = get_result(key, c)
        print(ans[key])
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for i in range(0, q):
    query = input()
    if query[0] == '1':
        s = s[::-1]
    else:
        if query[2] == '1':
            # 先頭
            s = ''.join([query[4],s])
        else:
            # 末尾
            s = ''.join([s,query[4]])
print(s)

Buggy submission (verdict: Runtime Error):
n, b, r = map(int, input().split())
count = 0
i = 0
while (n>i):
    for bi in range(b):
        count += 1
        i += 1
        if n <= i:
            break
    for ri in range(r):
        i += 1
        if n<=i:
            break
print(count)
Problem p02754 (python)

Fixed submission:
n, b, r = map(int, input().split())
i = 0
hoge = n // (b+r)
count = hoge*b
n = n - hoge*(b+r)
if n == 0:
    print(count)
while (n>i):
    count += b
    i += b
    if n<=i:
        print(count - (i-n))
        break
    i += r
    if n<=i:
        print(count)

Buggy submission (verdict: Runtime Error):
count = 0
i = 0
while (n>i):
    for bi in range(b):
        count += 1
        i += 1
        if n <= i:
            break
    for ri in range(r):
        i += 1
        if n<=i:
            break
print(count)

Buggy submission (verdict: Runtime Error):
count = 0
i = 0
while (n>i):
    for bi in range(b):
        count += 1
        i += 1
        if n <= i:
            break
    for ri in range(r):
        i += 1
        if n<=i:
            break
print(count)
Problem p02990 (python)

Fixed submission:
import math


def combination_count(n, r):
    if n - r < 0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

blue = K
red = N - K

num = 10 ** 9 + 7

for k in range(K):
    space_comb = combination_count(red + 1, k + 1)

    ball_comb = combination_count(K - 1, k)

    print((space_comb * ball_comb) % num)

Buggy submission (verdict: Runtime Error):
import math


def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

blue = K
red = N - K

num = 10 ** 9 + 7

for k in range(K):
    space_comb = combination_count(red + 1, k + 1)

    ball_comb = combination_count(K - 1, k)

    print((space_comb * ball_comb) % num)
Problem p03072 (python)

Fixed submission:
def main():
    N = int(input())
    H = [int(n) for n in input().split()]

    counter = 0
    for i, h in enumerate(H):
        canView = True
        for j in range(i):
            if H[j] > h:
                canView = False
        if canView:
            counter += 1

    print(counter)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    H = [int(n) for n in input().split()]

    counter = 0
    canView = False
    for i, h in enumerate(H):
        for j in range(i):
            if H[j] > h:
                canView = True
        if canView:
            counter += 1

    print(counter)


if __name__ == '__main__':
    main()



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

Fixed submission:
def main():
    a,b = input().split()
    a = int(a)
    b = int(b.replace('.', ''))
    print(a*b//100)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b = float, input().split()
    a = int(a)
    b = int(float(b)*100)
    print(a*b//100)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b = map(int, input().split())
    print(int(a*b))
if __name__ == "__main__":
    main()
Problem p02725 (python)

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

b = []
for i in range(n-1):
    b.append(a[i+1]-a[i])
b.append((k-a[n-1])+a[0])
print(k-max(b))

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

if a[0] == 0:
    print(a[n-1]-n[1])
else:
    print(a[n-1]-n[0])
Problem p02754 (python)

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

if a == 0:
    print(0)
elif a+b >= n:
    print(a) if a <= n else print(n)
else:
    ab = a + b
    ans = n // ab * a
    ans += a if n % ab > a else n % ab 
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
s = ''
for i in range(n):
    s += 'b'*a + 'r'*b
    if len(s) >= n: break
print(s[:n].count('b'))
Problem p03137 (python)

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

if n >= m:
    print(0)
else:
    x = sorted(x)
    xx = [x[i+1]-x[i] for i in range(len(x)-1)]

    xx = sorted(xx, reverse=True)
    xx = xx[n-1:]
    ans = 0
    for i in xx:
        ans+=i
    print(ans)

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

if n >= m:
    print(0)
else:
    x = sorted(x)
    x = [x[i+1]-x[i] for i in range(len(x)-1)]

    x = sorted(x, reverse=True)
    x = xx[n-1:]
    ans = 0
    for i in x:
        ans+=i
    print(ans)
Problem p02792 (python)

Fixed submission:
N = int(input())
import numpy as np
ans = 0
lis = [[0]*9]*9
lis = np.array(lis)
for i in range(1,N+1):
    a = i%10
    b = i//(10**(len(str(i))-1))
    if a != 0:
        lis[a-1][b-1] += 1
for j in range(9):
    for k in range(9):
        ans += lis[k][j]*lis[j][k]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
import numpy as np
ans = 0
lis = [[0]*9]*9
lis = np.array(lis)
for i in range(1,N+1):
    a = i%10
    b = i//(10**(len(str(i))-1))
    if a != 0:
        lis[a-1][b-1] += 1
for j in range(9):
    for k in range(9):
        ans += lis[k][j]*lis[j][k]
print(ans)
Problem p02831 (python)

Fixed submission:
a,b = map(int,input().split())
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a, b))
Problem p02912 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(lambda x: int(x)*(-1),input().split()))
import heapq
heapq.heapify(A)
for i in range(M):
  B = heapq.heappop(A)
  heapq.heappush(A,-1*((-B)//2))
print(-sum(A))

Buggy submission (verdict: Runtime Error):
import bisect
import collections
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
A = collections.deque(A)
for i in range(M):
  B = A.pop()
  bisect.insort_left(A,B//2)
print(sum(A))

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque
N,M = map(int,input().split())
A = (list(map(int,input().split())))
A.sort()
A = deque(A)
for i in range(M):
  mx = A.pop()
  insert_index = bisect.bisect_left(A,mx//2)
  A.insert(insert_index,mx//2)
print(sum(A))

Buggy submission (verdict: Runtime Error):
from bisect import insort
N,M = map(int,input().split())
A = (list(map(int,input().split())))
A.sort()
for i in range(M):
  mx = A.pop()
  insert_index = bisect.bisect_left(A,mx//2)
  A.insert(insert_index,mx//2)
print(sum(A))
Problem p03072 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
NowHeight = 0
ans = 0
for i in range(N):
  if NowHeight <= H[i]:
    NowHeight = H[i]
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = [int(input().split())]
 
ans = 1
for i in range(N):
    if  L[:i]>L[i]:
        continue
    else:
        ans = ans+1

Buggy submission (verdict: Runtime Error):
N = int(input())
L = map[int,input().split()]

ans = 1
for i in L
	if  L(:i)>L(i):
		continue
    else:
		ans = ans+1
Problem p03073 (python)

Fixed submission:
From0 = ['0','1']*(10**6)
From1 = ['1','0']*(10**6)
s = list(input())
F0 = From0[:len(s)]
F1 = From1[:len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))

Buggy submission (verdict: Runtime Error):
lis = [int(input()) for _ in range(6)]
if lis[0]/min(lis[1:]) == 1:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)

Buggy submission (verdict: Runtime Error):
lis = [int(input()) for _ in range(6)]
if lis[0] % min(lis[1:]) == 0:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)

Buggy submission (verdict: Runtime Error):
lis = [int(input()) for _ in range(6)]
if lis[0] % min(lis[1:]) == 0:
  print(5)
else:
  print(lis[0]//min(lis[1:])+5)

Buggy submission (verdict: Runtime Error):
From0 = ['0','1']*(10**6)
From1 = ['1','0']*(10**6)
s = list(input())
F0 = From0[::len(s)]
F1 = From1[::len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))

Buggy submission (verdict: Runtime Error):
From0 = ['0','1']*(10**5)
From1 = ['1','0']*(10**5)
s = list(input())
F0 = From0[::len(s)]
F1 = From1[::len(s)]
count_0 = 0
count_1 = 0
for i in range(len(s)):
  if s[i] != F0[i]:
    count_0 += 1
for i in range(len(s)):
  if s[i] != F1[i]:
    count_1 += 1
print(min(count_0,count_1))