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

Fixed submission:
s=input()
dp=[[-1 for _ in range(4)] for _ in range(len(s)+1)]
dp[len(s)][3]=1
for i in range(len(s),-1,-1):
    for j in range(3,-1,-1):
        if j<3:
            dp[len(s)][j]=0
        if i<len(s):
            dp[i][3]=3*dp[i+1][3] if s[i]=='?' else dp[i+1][3]
            dp[i][3]%=1e9+7
        if i<len(s) and j<3:
            m1=3 if s[i]=='?' else 1
            m2=1 if s[i]=='?' or s[i]==list('ABC')[j] else 0
            dp[i][j]=m1*dp[i+1][j]+m2*dp[i+1][j+1]
            dp[i][j]%=1e9+7
print(int(dp[0][0]))

Buggy submission (verdict: Runtime Error):
s=input()
dp=[[-1 for _ in range(4)] for _ in range(len(s)+1)]
dp[len(s)][3]=1
for i in range(len(s),-1,-1):
    for j in range(3,-1,-1):
        if j<3:
            dp[len(s)][j]=0
        if i<len(s):
            dp[i][3]=3*dp[i+1][3] if s[i]=='?' else dp[i+1][3]
        if i<len(s) and j<3:
            m1=3 if s[i]=='?' else 1
            m2=1 if s[i]=='?' or s[i]==list('ABC')[j] else 0
            dp[i][j]=m1*dp[i+1][j]+m2*dp[i+1][j+1]
print(int(dp[0][0]%(1e9+7)))
Problem p03634 (python)

Fixed submission:
n=int(input())
abc=[list(map(int,input().split())) for _ in range(n-1)]
q,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(q)]

z=[[] for _ in range(n)]
for a,b,c in abc:
    z[a-1].append([b-1,c])
    z[b-1].append([a-1,c])

depth=[0 for _ in range(n)]
from collections import deque
que=deque([])
v,p,d=k-1,-1,0
que.append((v,p,d))
while que:
    v,p,d=que.pop()
    depth[v]=d
    for t in z[v]:
        if t[0]==p:
            continue
        que.append((t[0],v,d+t[1]))
for x,y in xy:
    print(depth[x-1]+depth[y-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
abc=[list(map(int,input().split())) for _ in range(n-1)]
q,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(q)]

z=[[] for _ in range(n)]
for a,b,c in abc:
    z[a-1].append([b-1,c])
    z[b-1].append([a-1,c])

depth=[0 for _ in range(100010)]
def dfs(v,p,d):
    depth[v]=d
    for t in z[v]:
        if t[0]==p:
            continue
        dfs(t[0],v,d+t[1])
dfs(k-1,-1,0)
for x,y in xy:
    print(depth[x-1]+depth[y-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
abc=[list(map(int,input().split())) for _ in range(n-1)]
q,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(q)]

z=[[] for _ in range(n)]
for a,b,c in abc:
    z[a-1].append([b-1,c])
    z[b-1].append([a-1,c])

depth=[0 for _ in range(n)]
def dfs(v,p,d):
    depth[v]=d
    for t in z[v]:
        if t[0]==p:
            continue
        dfs(t[0],v,d+t[1])
dfs(k-1,-1,0)
for x,y in xy:
    print(depth[x-1]+depth[y-1])
Problem p03745 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
if n==1:
    print(1)
else:
    u=a[0]<=a[1]
    d=a[0]>=a[1]
    res=0
    for i in range(2,n):
        u=u and a[i-1]<=a[i]
        d=d and a[i-1]>=a[i]
        #print(i,u,d)
        if not any([u,d]):
            res+=1
            u=True
            d=True
    print(res+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
u=a[0]<=a[1]
d=a[0]>=a[1]
res=0
for i in range(2,n):
    u=u and a[i-1]<=a[i]
    d=d and a[i-1]>=a[i]
    #print(i,u,d)
    if not any([u,d]):
        res+=1
        u=True
        d=True
print(res+1)
Problem p03775 (python)

Fixed submission:
n = int(input())
a,b=[],[]
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        a.append(i)
        b.append(int(n/i))
ans=[]
for i in range(len(a)):
    ans.append(max(len(str(a[i])),len(str(b[i]))))
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b=[],[]
for i in range(1,int(n**0.5)):
    if n%i==0:
        a.append(i)
        b.append(n//i)
ans=[]
for i in range(len(a)):
    ans.append(max(len(str(a[i])),len(str(b[i]))))
print(min(ans))
Problem p02847 (python)

Fixed submission:
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
S = input()

if S in days:
  days_till_next_sunday = len(days) - days.index(S)

print(days_till_next_sunday)

Buggy submission (verdict: Runtime Error):
days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

s = input()

days_till_next_sunday = len(days) - days.index(s)

print(days_till_next_sunday)
Problem p02987 (python)

Fixed submission:
# coding: utf-8
# A - Fifty-Fifty

s = input()
c = []
dict = {}
for i in s:
    if i in dict:
        dict[i] +=1
    else:
        dict[i] = 1
        c.append(i)

if dict[c[0]] == 4:
    print("No")
elif dict[c[0]] == dict[c[1]] == 2 and len(dict) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# A - Fifty-Fifty

s = input()
c = []
dict = {}
for i in s:
    if i in dict:
        dict[i] +=1
    else:
        dict[i] = 1
        c.append(i)
if dict[c[0]] == dict[c[1]] == 2 and len(dict) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# A - Fifty-Fifty

s = input()
c = []
dict = {}
for i in s:
    if i in dict:
        dict[i] +=1
    else:
        dict[i] = 1
        c.append(i)
if dict[c[0]] == dict[c[1]] and len(dict) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# A - Fifty-Fifty

s = input()
c = []
dict = {}
for i in s:
    if i in dict:
        dict[i] +=1
    else:
        dict[i] = 1
        c.append(i)
if dict[c[0]] == dict[c[1]]:
    print("Yes")
else:
    print("No")
Problem p02897 (python)

Fixed submission:
n = int(input())
odd_cnt= len([a for a in range(n+1) if a%2==1])

prob= (odd_cnt)/float(n)

print (prob)

Buggy submission (verdict: Runtime Error):
n= int(input())
a_list=list(map(int,input().split()))
f_list=[0]*n

for i in a_list:
  f_list[i-1]= a_list.index(i)+1

print(n)
for i in f_list:
    print(i,end=' ')
print('')
Problem p02847 (python)

Fixed submission:
day = input()
     
if(day=="SUN"):
  print(7)
elif(day=="MON"):
  print(6)
elif(day=="TUE"):
  print(5)
elif(day=="WED"):
  print(4)
elif(day=="THU"):
  print(3)
elif(day=="FRI"):
  print(2)
elif(day=="SAT"):
  print(1)

Buggy submission (verdict: Runtime Error):
day = input()
 
if(day=="SUN"):
  print(7)
elif(day=="MON"):
  print(6)
elif(day=="TUE"):
  print(5)
elif(day=="WEN"):
  print(4)
elif(day=="THU"):
  print(3)
elif(day=="FRI"):
  print(2)
elif(day=="SAT"):

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

if(day=="SUN"):
  print(7)
elif(day=="MON"):
  print(6)
elif(day=="TUE"):
  print(5)
elif(day=="WEN"):
  print(4)
elif(day=="THU"):
  print(3)
elif(day=="FRI"):
  print(2)
elif(day=="SAT"):
  print(1)
Problem p02847 (python)

Fixed submission:
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT':
    print(1)

Buggy submission (verdict: Runtime Error):
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT'
    print(1)

Buggy submission (verdict: Runtime Error):
S=input()
if S=='SUN':
    print(7)
elif S=='MON':
    print(6)
elif S=='TUE':
    print(5)
elif S=='WED':
    print(4)
elif S=='THU':
    print(3)
elif S=='FRI':
    print(2)
elif S=='SAT'
print(1)

Buggy submission (verdict: Runtime Error):
S=input()
if S='SUN':
    print(7)
elif S='MON':
    print(6)
elif S='TUE':
    print(5)
elif S='WED':
    print(4)
elif S='THU':
    print(3)
elif S='FRI':
    print(2)
elif S='SAT'
print(1)
Problem p02879 (python)

Fixed submission:
a,b=map(int,(input().split()))
if a<10 and b<10:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int(input().split()))
if a<10 and b<10:
    print(a*b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)
Problem p02881 (python)

Fixed submission:
from math import sqrt
N=int(input())
for i in range(int(sqrt(N))+1,-1,-1):
    if N%i==0:
        print(i-1+N//i-1)
        exit()

Buggy submission (verdict: Runtime Error):
import sqrt from math
N=int(input())
for i in range(int(sqrt(N))+1,-1,-1):
    if N%i==0:
        print(i-1+N//i-1)
        exit()

Buggy submission (verdict: Runtime Error):
import sqrt from math
N=int(input())
for i in range(int(sqrt)+1,-1,-1):
    if N%i==0:
        print(i-1+N//i-1)
        exit()
Problem p02897 (python)

Fixed submission:
import numpy as np

N = int(input())

nums_list = np.arange(1,N+1)
odd_list = nums_list[nums_list%2==1]
print(len(odd_list)/len(nums_list))

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

N = int(input())
A_i = np.array(list(map(int, input().split())))
stu = [[nums+1,student] for nums, student in enumerate(A_i)]

hh = np.full(N, np.nan)
for i, j in stu:
    hh[j-1] = i
    print(int(hh[j-1]))

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

N = int(input())
A_i = np.array(list(map(int, input().split())))
stu = [[nums+1,student] for nums, student in enumerate(A_i)]

hh = np.full(N, np.nan)
for i, j in stu:
    hh[j-1] = i
    
for i in hh:
  print(i)

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

import numpy as np

nums_list = np.arange(1,N)
odd_list = nums_list[nums_list%2==1]

print(len(odd_list)/len(nums_list))
Problem p03834 (python)

Fixed submission:
print(*input().split(","))

Buggy submission (verdict: Runtime Error):
s = input()
print(c.split(,))
Problem p02862 (python)

Fixed submission:
## D
import numpy as np
import math

def cmb(n, k, mod):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % mod
 
    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % mod
 
    return (numerator * pow(denominator, mod-2, mod)) % mod
    
    return int((n_frac * n_r_ifrac * r_ifrac) % mod)

mod = 10**9+7
x,y = map(int, input().split()) 
is_ok = True
b = (2 * x - y) / 3
a = x - 2 * b
if not (a.is_integer() and b.is_integer()):
    ans = 0
    is_ok = False
    
a = int(a)
b = int(b)
if a < 0 or b < 0:
    ans = 0
    is_ok = False
if is_ok:    
    ans = cmb(a+b, a, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
#D
import numpy as np
import math
def power(x, y, mod):
    if y == 0:
        t = 1
    elif y == 1:
        t = x % mod
    elif y % 2 == 0:
        t = (power(x, int(y/2), mod) ** 2) % mod
    else:
        t = (x * (power(x, int(y/2), mod) ** 2)) % mod
    return t
    
    
def frac_mod(n, mod, f=1):
    for i in range(1, n + 1):
        f = (f * i) % mod
    return f

def ifrac_mod(n, mod, f_inv=1):
    for i in range(n, 1, -1):
        f_inv = (f_inv * power(i, mod-2, mod)) % mod
    return f_inv

def cmb_mod(n, r, mod):
    n_frac = frac_mod(n, mod)
    n_r_ifrac = ifrac_mod(n-r, mod)
    r_ifrac = ifrac_mod(r, mod)
    
    return int((n_frac * n_r_ifrac * r_ifrac) % mod)
mod = 10**9+7
x,y = map(int, input().split())
a = np.array([[1,2], [2,1]])
b = np.array([x,y])
res = np.linalg.solve(a,b)
is_ok = True
if not (res[0].is_integer() and res[1].is_integer()):
    is_ok = False
    ans = 0
x_res = int(res[0])
y_res = int(res[1])
if is_ok:
    ans = cmb_mod(x_res+y_res, x_res, mod)
print(ans)
Problem p02912 (python)

Fixed submission:
import heapq
N, M = map(int, input().split())
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for i in range(M):
    a = -int(heapq.heappop(A) / 2)
    heapq.heappush(A, -a)
print(-sum(A))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
A = np.array(np.log2(sorted(list(map(int, input().split())), reverse=True)).astype(np.float64))
#print(A)
while True:
    A_m = np.where(A >= int(A[0]))
    if len(A_m[0]) <= M:
        A[A_m] -= 1.
        A = np.sort(A)[::-1]
        M -= len(A_m[0])
        #print(A, M)
    else:
        A[:M] -= 1.
        break
    if A[0] < 0:
        break
#print(A)
A = (2 ** A).astype(np.int64)
#print(A)
print(np.sum(A))
Problem p02984 (python)

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

s = sum(a)
b = [a[i] for i in range(n) if i % 2 == 1]
x1 = s - 2 * sum(b)
x = []
x.append(x1)
xi = x1
for i in range(0, n-1, 1):
    #print(a[i])
    xi_1 = 2 * a[i] - xi
    x.append(xi_1)
    #print(xi_1)
    xi = xi_1
    
print(" ".join(map(str, x)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from numpy.linalg import solve

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

right = np.asarray(a)*2
left = np.zeros([n,n])
for i in range(n):
    if i != n-1:
        left[i,i:i+2] = 1
    else:
        left[i,0] = 1
        left[i,i] = 1
        
out = list(map(int, solve(left, right)))
print(" ".join(map(str, out)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from numpy.linalg import solve

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

right = np.asarray(a)*2
left = np.zeros([n,n])
for i,_ in enumerate(a):
    if i != n-1:
        left[i,i:i+2] = 1
    else:
        left[i,0] = 1
        left[i,i] = 1
        
out = list(map(int, solve(left, right)))
print(" ".join(map(str, out)))

Buggy submission (verdict: Runtime Error):

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

right = np.asarray(a)*2
left = np.zeros([n,n])
for i,_ in enumerate(a):
    if i != n-1:
        left[i,i:i+2] = 1
    else:
        left[i,0] = 1
        left[i,i] = 1
        
out = list(map(int, solve(left, right)))
print(" ".join(map(str, out)))
Problem p02987 (python)

Fixed submission:
str = input()

chars = {}
for char in str:
    if char in chars:
        chars[char] += 1
    else:
        chars[char] = 1
        
if len(chars) == 2 and chars[str[0]] == 2:
    print("Yes")
    
else:
    print("No")

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

char_count = 1
for i in range(3):
    if str[0] == str[i+1]:
        char_count += 1
    else:
        char2 = i+1
        char2_count = 0
        
if char_count == 2:
    for char in str:
        if str[char2] == char:
            char2_count += 1
            
    if char2_count == 2:
        print("Yes")
        
    else:
        print("No")
        
else:
    ("No")
    
    
print(char_count, char2_count)
Problem p02912 (python)

Fixed submission:
import heapq
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
for i in range(n):
  a[i] *= -1

heapq.heapify(a)
for i in range(m):
    heapq.heapreplace(a, int(a[0] / 2))

print(sum(a)*-1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
val = list(map(int,input().split()))
my_index = val.index
for _in range(m):
  val[my_index(max(val))] = max(val)//2
print(sum(val))
Problem p02881 (python)

Fixed submission:
import math
n = int(input())
ans = 1 + n

max = math.ceil(n**0.5)

for i in range (2, max+1):
    if n % i == 0 and i + n / i < ans:
        ans = i + n / i

print(int(ans - 2))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 1 + n
if n % 2 == 0:
    max = n / 2 + 1
else:
    max = (n + 1) / 2

for i in range (1, max):
    if max % i == 0 and i + max / i < ans:
        ans = i + max /i

print(int(ans - 2))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 1 + n
if n % 2 == 0:
    max = n / 2 + 1
else:
    max = (n + 1) / 2

for i in range (1, max):
    if n % i == 0 and i + n / i < ans:
        ans = i + n /i

print(int(ans - 2))
Problem p02951 (python)

Fixed submission:
A,B,C = map(int,input().split())
print(C-(A-B)) if C-(A-B) > 0 else print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
ok = True
for i in range(N - 2):
    if (H[i] > H[i + 1] and H[i + 1] > H[i + 2]) or H[i]-H[i+1]>1:
        ok = False
if H[-2] - H[-1] > 1:
    ok = False
if ok:
    print("Yes")
else:
    print("No")
Problem p02990 (python)

Fixed submission:
import math
N, K = map(int, input().split())
def comb(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N, K = map(int, input().split())
def comb(n, r):
    if n < 0 or r < 0:
        return 1
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N, K = map(int, input().split())
def comb(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N, K = map(int, input().split())
def comb(n, r):
    if n == 0:
        return 1
    else:
        return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in range(1, K + 1):
    print((comb(K-1,i-1) * comb(N-K+1,i))%(10**9+7))
Problem p03011 (python)

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

PQR.sort()

print(PQR[0]+PQR[1])

Buggy submission (verdict: Runtime Error):
def fib(n):
    a1 = 2
    a2 = 1 
    if n==2:
        return 2
    elif n==1:
        return 1
    else:
        count = 1
        for i in range(n-2):
            count = a1 + a2
            a2 = a1
            a1 = count
        return count
        
N,M = list(map(int,input().split()))
ans = 1
z = False

if M == 0:
    print(fib(N)) 
else:
    a = [int(input()) for _ in range(M)]

    for i in range(M):
        if i != 0:
            if a[i]-a[i-1] != 1:
                ans *= fib(a[i]-a[i-1]-2)
            else:
                z = True
                break
        else:
            ans *= fib(a[i]-1)

    ans *= fib(N-a[-1]-1)

    if z:
        print(0)
    else:
        print(str(ans%1000000007))
Problem p03135 (python)

Fixed submission:
#ABC117 A
T, X = map(int, input().split())
print(T/X)

Buggy submission (verdict: Runtime Error):
#ABC117 A
T, X = input(split())
print(T/X)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
if M == 1 or N>=M:
    print(0)
else:
    X.sort()
    X_difs = [X[i+1] - X[i] for i in range(M-1)]
    X_difs.sort()
    for _ in range(N-1):
        X_difs.pop(-1)
    print(sum(X_difs))

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

if M == 1:
    print(0)
else:
    X.sort()
    X_difs = np.array(X)
    X_difs = np.diff(X_difs)
    X_difs[::-1].sort()
    for _ in range(N-1):
        X_difs = np.delete(X_difs, 0)
        
    print(sum(X_difs))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
if M == 1:
    print(0)
else:
    X.sort()
    X_difs = [X[i+1] - X[i] for i in range(M-1)]
    X_difs.sort()
    for _ in range(N-1):
        X_difs.pop(-1)
    print(sum(X_difs))
Problem p03253 (python)

Fixed submission:
import math
def factorize(m):
    fct = []
    b = 2
    while b * b <= m:
        cnt = 0
        while m % b == 0:
            m //= b
            cnt += 1
        if cnt > 0:
            fct.append(cnt)
        b += 1
    if m > 1:
        fct.append(1)
    return fct

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

N, M = map(int, input().split())
ans = 1
M_fct = factorize(M)

for mf in M_fct:
    #mf[1]個をN通りに分ける→comb(mf[1]+N-1,mf[1])
    ans *= comb(N + mf - 1, mf)
    ans %= 10**9+7
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def factorize(m):
    b = 2
    fct = [0]*(10**5)
    while b * b <= m:
        while m % b == 0:
            m //= b
            fct[b] +=1
        b = b + 1
    if m > 1:
        fct[m]+=1
    return fct

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

N, M = map(int, input().split())
ans = 1
M_fact = factorize(M)

for i in M_fact:
    if i != 0: #i個をN通りに分ける→i+N-1,i
        ans *= comb(N+i-1,i)
print(ans%(10**9+7))
Problem p02912 (python)

Fixed submission:
import heapq
 
N, M = list(map(int, input().split()))
A = input().split(" ")
neg_A = [-int(a) for a in A]
 
heapq.heapify(neg_A)
 
for t in range(M):
    heapq.heappush(neg_A, -(-heapq.heappop(neg_A)//2))
print(-sum(neg_A))

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

# %%
A = list(map(lambda x: int(x), input().split(' ')))
A.sort()
A = A[::-1]

for _ in range(M):
    A[0] = A[0] // 2
    for i in range(N):
        if A[i+1] > A[i]:
            A[i+1], A[i] = A[i:i+2]
        else:
            break
    
print('{}'.format(sum(A)))
Problem p02880 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())

if n > 81:
    print('No')
    sys.exit()


for i in range(1, 10):
    for j in range(1, 10):
        if n == i * j:
            print('Yes')
            sys.exit()

print('No')

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())

if n > 81:
    print('No')
    sys.exit()
if n < 10:
  	print('Yes')
    sys.exit()

for i in range(1, 10):
    for j in range(1, 10):
        if n == i * j:
            print('Yes')
            sys.exit()

print('No')

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())

if n > 81:
    print('No')
    sys.exit()
if n < 10:
  	print('Yes')
    sys.exit()

for i in range(1, 10):
    for j in range(1, 10):
        if n == i * j:
            print('Yes')
            sys.exit()

print('No')

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]

n = int(input())

if n > 81:
    print('No')
    sys.exit()
if n < 10:
  	print('Yes')
    sys.exit()

for i in range(1, 10):
    for j in range(1, 10):
        if n == i * j:
            print('Yes')
            sys.exit()

print('No')
Problem p02912 (python)

Fixed submission:
import heapq
import sys
def input():
    return sys.stdin.readline()[:-1]

# input
N, M = map(int, input().split())
a = []

for i in input().split():
    heapq.heappush(a, -int(i))

for j in range(M):
    highest = heapq.heappop(a)
    heapq.heappush(a, -(- highest // 2))

print(-sum(a))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy
import sys
from itertools import combinations_with_replacement
def input():
    return sys.stdin.readline()[:-1]
# input
N, M = map(int, input().split())
As = list(map(int, input().split()))
ind = [i for i in range(N)]

min_val = None
for combo in combinations_with_replacement(ind, M):
    price = deepcopy(As)
    for i in combo:
        price[i] = math.floor(price[i]/2)
    if min_val is None:
        min_val = sum(price)
    else:
        if sum(price) <= min_val:
            min_val = sum(price)

print(min_val)
Problem p03272 (python)

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

print(N + 1 - i)
print()

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

print(N + 1 - i)
hibiki@hibiki-MB-E410
Problem p02897 (python)

Fixed submission:
input_line=input().rstrip()
kisuu=0
for number in range(1,int(input_line)+1):
  if number%2==1:
    kisuu=kisuu+1
possi=kisuu/int(input_line)
print(possi)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(map(int,input().split(" ")))
jisho={}
for i in S:
    a=S.index(i)+1
    jisho[a]=i
jisho=sorted(jisho.items(), key=lambda x:x[1])
for i in range(0,len(jisho)):
    print(jisho[i][0],end=" ")

Buggy submission (verdict: Runtime Error):
input_line=input().rstrip.split()
kisuu=0
for number in range(1,int(input_line)+1):
  if number%2==1:
    kisuu=kisuu+1
possi=kisuu/int(input_line)
print(possi)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
if(s[:n//2]==s[n//2:] and n%2==0):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
print(s[:n/2]==s[n/2:] and n%2==0)