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

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

a, b = [0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

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

# A机から0〜N冊読んで、残り時間でB机から何冊読めるかを考える
lst = [0]*(N+1)

for i in range(N+1):
    time = 0
    time = sum(A[0:i])　# A机からi冊読んだときの所要時間
    if time > K:
        break # この時点で制限時間Kを超えていたらB机は無視する
    else:
        for j in range(M):
            # 
            if time + B[j] <= K:
                time = time + B[j]
            else:
                lst[i] = i + j
                break

res = max(lst)
print(res)

"""
3 4 240
60 90 120
80 150 80 150

3 4 730
60 90 120
80 150 80 150
"""

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

res = 0
time = 0

while time <= K:
    if A[0] <= B[0]:
        time = time + A.pop(0)
    else:
        time = time + B.pop(0)
    res += 1

print(res)
Problem p02624 (python)

Fixed submission:
# ABC172_D
N = int(input())
ans = 0

for i in range(1,N+1):
	ans += ((N//i)*(i+(N//i)*i))/2

print(int(ans))

Buggy submission (verdict: Runtime Error):
import sympy

N = int(input())

S = 0
for i in range(1,N+1):
    S += i * len(sympy.divisors(i))
print(S)
Problem p02777 (python)

Fixed submission:
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(3)]
ST = list(s[0].split())
S = str(ST[0])
T = str(ST[1])

AB = list(s[1].split())
A = int(AB[0])
B = int(AB[1])

U = str(s[2])


# Proccess
if U == S:
	A -= 1
else:
	B -= 1

# Output							
print(str(A)+" "+str(B))

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

# Input
s = [input() for i in range(3)]
ST = list(s[0].split())
S = str(ST[0])
T = str(ST[1])

AB = list(s[1].split())
A = int(AB[0])
B = int(AB[1])

U = str(s[3])


# Proccess
If U == S:
	A -= 1
else:
	B -= 1

# Output							
print(str(A)+" "+str(B))
Problem p02779 (python)

Fixed submission:
# C - Distinct or Not
N = int(input())
A = list(map(int, input().split()))

M = len(set(A))

if N == M:
    print("YES")
else:
    print("NO")

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

# Input
s = [input() for i in range(2)]
N = int(s[0])
As = sorted(list(s[1].split()))

# Proccess
for i in range(0,N):
	if As[i] == As[i+1]:
		Anser = "No"
		break
	else:
		Anser = "Yes"
		
# Output							
print(Anser)

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

# Input
s = [input() for i in range(2)]
N = int(s[0])
As = sorted(list(s[1].split()))

# Proccess
for i in range(N):
	if As[i] == As[i+1]:
		Anser = "No"
		break
	else:
		Anser = "Yes"
		
# Output							
print(Anser)
Problem p02790 (python)

Fixed submission:
a, b = map(int, input().split())
A = int(str(a)*b)
B = int(str(b)*a)

if A >= B:
    print(A)
else:
    print(B)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = int(str(a)**b)
B = int(str(b)**a)

if A >= B:
    print(A)
else:
    print(B)
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print("".join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(sum(S))
Problem p03042 (python)

Fixed submission:
S = input()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12:
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")

Buggy submission (verdict: Runtime Error):
S = input()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")
Problem p03242 (python)

Fixed submission:
s = list(str(input()))
ans = ""
for i in range(3):
    if s[i] == "1":
        ans = ans + "9"
    else:
        ans = ans + "1"
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())
ans = ""
for i in range(len(s)):
    if s[i] == 1:
        ans += 9
    else:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())
for i in range(len(s)):
    if s[i] == 1:
        s[i] = 9
    else:
        s[i] = 1
print(s)
Problem p03835 (python)

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
 import sys
 import copy
 sys.setrecursionlimit(1000000)
 K, S = map(int, input().split())
 ans = 0
 for x in range(K + 1):
     for y in range(K + 1):
         z = S - (x + y)
         if z >= 0 and z <= K:
             ans += 1
 print(ans)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
res = 0
for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if Z in range(K+1)
            res += 1

print(res)
Problem p02689 (python)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
t=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        t[b-1]=0
    elif H[a-1]<H[b-1]:
        t[a-1]=0
    else:
        t[a-1],t[b-1]=0,0
print(sum(t))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
t=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        t[b-1]=0
    elif H[a-1]<H[b-1]:
        t[a-1]=0
    else:
        t[a-1],a[b-1]=0,0
print(sum(t))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
H=list(map(int,input().split()))
a,ans=[],[]
for _ in range(M):
    a.append(list(map(int,input().split())))
for i in range(M):
    if H[(a[i][0])-1]>H[(a[i][1])-1]:
        ans.add(a[i][0])
    elif H[(a[i][0])-1]<H[(a[i][1])-1]:
        ans.append(a[i][1])
print(len(ans))
Problem p02695 (python)

Fixed submission:
import itertools
a=list(map(int,input().split()))
b=[]
ans=0
c=range(1,a[1]+1)
d=[]
for _ in range(a[2]):
    b.append(list(map(int,input().split())))


for i in itertools.combinations_with_replacement(c,a[0]):
    for l in range(a[2]):
        if i[b[l][1]-1]-i[b[l][0]-1]==b[l][2]:
            ans+=b[l][3]
    d.append(ans)
    ans=0
print(max(d))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=[]
ans=0
c=[]
for _ in range(a[2]):
    b.append(list(map(int,input().split())))

for i in range(1,a[1]+1):
    for j in range(i,a[1]+1):
        for k in range(j,a[1]+1):
            c=[i,j,k]
            for l in range(a[2]):
                if c[b[l][1]-1]-c[b[l][0]-1]==b[l][2]:
                    ans+=b[l][3]
            d.append(ans)
            ans=0
print(max(d))
Problem p02773 (python)

Fixed submission:
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
a=max(ans.values())
ans=[i for i,k in ans.items() if a==k]
print(*sorted(ans),sep="\n")

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
a=max(ans.values())
ans=[i for i,k in ans.items() if a==k]
print(*ans.sort(),sep="\n")

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
values,count=zip(*ans)
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])
Problem p02835 (python)

Fixed submission:
A,B,C=tuple(map(int,input().split()))
print("bust" if A+B+C>=22 else "win")

Buggy submission (verdict: Runtime Error):
fun main(args:Array<String>){
    val a=readLine()!!.split(" ").map{it.toInt()}
    if (a[0]+a[1]+a[2]>=22){
        println("bust")
    }else{
        println("win")
    }
}
Problem p02881 (python)

Fixed submission:
N=int(input())
ans=[]
for i in range(1,int(N**.5)+2):
    if N%i<1:
        ans.append(N//i+i-2)
print(min(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[]
for i in range(1,int(N**.5)):
    if N%i==0:
        ans.append(N//i+i-2)
print(min(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[]
for i in range(1,N**.5):
    if N%i==0:
        ans.append(N//i+i-2)
print(min(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[]
for i in range(1,N//2):
    if N%i==0:
        ans.append(N//i+i-2)
print(min(ans))
Problem p02623 (python)

Fixed submission:
import bisect
N,M,K = map(int,input().split())
A = [0]+list(map(int,input().split()))
K2 =K
count = 0
numa = 0
numb = 0
count2 = 0
for i in range(N+1):
    count += A[i]
    A[i] = count
#累積和
B = [0]+list(map(int,input().split()))
count = 0
for i in range(M+1):
    count += B[i]
    B[i] = count
#累積和

for i in range(N+1):#Aに対してBを探す
    K = K2
    if A[i] <= K:
        K -= A[i]
        if count2 < i + bisect.bisect_right(B, K):
            count2 = i + bisect.bisect_right(B, K)-1
    else:
        break
print(count2)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
count = 0
numa = 0
numb = 0
while True:
    if numa < len(A) and numb < len(B):#リストの番号をどちらも指定できる
        if A[numa] <= B[numb] and count + A[numa] <= K:#AがB以下
            count += A[numb]
            numa += 1
        elif A[numa] > B[numb] and count + B[numb] <= K:#AがBより大きい
            count += B[numb]
            numb +=1
        else:#これ以上本を取り除けない
            break
    
    elif numa >= len(A) and numb < len(B):#Aだけのリストが終了
        if count + B[numb]<=K:
            count += B[numb]
            numb += 1
        else:
            break
    elif numa < len(A) and numb >= len(B):#Bだけのリストが終了
        if count + A[numa]<=K:
            count += B[numa]
            numa += 1
        else:
            break
    else:#リストのどちらも終了
        break

print(numa+numb)
Problem p02627 (python)

Fixed submission:
a = input()
print("A" if a in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" else "a")

Buggy submission (verdict: Runtime Error):
import itertools
N,K = map(int,input().split())
A = map(int,input().split())
t = list(list(itertools.combinations(A,K)))
ans = sum(t[0])
for i in t:
    ans = min(ans,sum(i))
print(ans)
Problem p02552 (python)

Fixed submission:
x = int(input())
if x==1:
  print(0)
  
else:
  print(1)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x==1:
  print(0)
else if x==0:
  print(1)
Problem p02547 (python)

Fixed submission:
n = int(input())
count = 0
flag = False
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        if count == 2:
            flag = True
        else:
            count += 1
    else:
        count = 0
if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
flag = False
for i in range(n):
    a, b = map(int, input().split())
    if a == b:
        if count == 2:
            flag = True
        else:
            count += 1
    else:
        count = 0
if flag:
    print(Yes)
else:
    print("No")
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b % a, a)


A, B = map(int, input().split())
g = gcd(A, B)

print(A * B // g)

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
g = math.gcd(A, B)
print(A * B // g)
Problem p02863 (python)

Fixed submission:
N, M = map(int, input().split())
D = []
for i in range(N):
    t, v = map(int, input().split())
    D.append((t, v))

D.sort(key=lambda x:x[0])

DP = [[0 for j in range(M)] for i in range(N + 1)]

for i in range(1, N + 1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP[i][j] = max(DP[i - 1][j], DP[i - 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP[i][j] = DP[i - 1][j]
mv = 0
for l in range(N): #ラストオーダー
    mv = max(DP[l][M - 1] + D[l][1], mv)

print(mv)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
D = []
for i in range(N):
    t, v = map(int, input().split())
    D.append((t, v))

D.sort(key=lambda x:x[0])

DP1 = [[0 for j in range(M)] for i in range(N + 2)]
DP2 = [[0 for j in range(M)] for i in range(N + 2)]

for i in range(1, N + 1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP1[i][j] = max(DP1[i - 1][j], DP1[i - 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP1[i][j] = DP1[i - 1][j]

for i in range(N, 0, -1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP2[i][j] = max(DP2[i + 1][j], DP2[i + 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP2[i][j] = DP2[i + 1][j]

mv = 0
for l in range(N):
    mv = max(DP1[l][M - 1] + DP2[l + 2][l + 1] + D[l][1], mv)

print(mv)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
D = []
for i in range(N):
    t, v = map(int, input().split())
    D.append((t, v))

D.sort(key=lambda x:x[0])

DP1 = [[0 for j in range(M)] for i in range(N + 2)]
DP2 = [[0 for j in range(M)] for i in range(N + 2)]

for i in range(1, N + 1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP1[i][j] = max(DP1[i - 1][j], DP1[i - 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP1[i][j] = DP1[i - 1][j]

for i in range(N, 0, -1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP2[i][j] = max(DP2[i + 1][j], DP2[i + 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP2[i][j] = DP2[i + 1][j]

mv = 0
for l in range(N):
    mv = max(DP1[l][M - 1] + DP2[l][l + 1] + D[l][1], mv)

print(mv)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
D = []
for i in range(N):
    t, v = map(int, input().split())
    D.append((t, v))

D.sort(key=lambda x:x[0])

DP1 = [[0 for j in range(M)] for i in range(N + 2)]
DP2 = [[0 for j in range(M)] for i in range(N + 2)]

for i in range(1, N + 1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP1[i][j] = max(DP1[i - 1][j], DP1[i - 1][j - D[i - 1][0]] + D[i - 1][1])
        else:
            DP1[i][j] = DP1[i - 1][j]

for i in range(N - 1, 0, -1):
    for j in range(1, M):
        if j - D[i - 1][0] >= 0:
            DP2[i][j] = max(DP2[i + 1][j], DP2[i + 1][j - D[i][0]] + D[i][1])
        else:
            DP2[i][j] = DP2[i + 1][j]

mv = 0
for l in range(N):
    mv = max(DP1[l][M - 1] + DP2[l][l + 1] + D[l][1], mv)

print(mv)
Problem p02948 (python)

Fixed submission:
import  heapq
 
N, M = map(int, input().split())
data = [[int(x) for x in input().split()] for i in range(N)]
data.sort(reverse=True, key=lambda x: (-x[0], x[1]))
 
day = M
reward = 0
 
# d日前
q = []
i = 0
for d in range(1, M + 1):
    for t in range(i, N):
        if data[t][0] > d:
            break
        i += 1
        heapq.heappush(q, -1 * data[t][1])
    if q:
        reward += heapq.heappop(q)
 
print(-1 * reward)

Buggy submission (verdict: Runtime Error):
import  heapq

N, M = map(int, input().split())
data = [[int(x) for x in input().split()] for i in range(N)]

data.sort(reverse=True, key=lambda x: (-x[0], x[1]))

day = M
reward = 0

# d日前
q = []
i = 0
for d in range(1, M + 1):
    for t in range(i, N):
        if data[t][0] > d:
            break
        i += 1
        heapq.heappush(q, -1 * data[t][1])
    reward += heapq.heappop(q)

print(-1 * reward)
Problem p02990 (python)

Fixed submission:
def comb(a, b, mod):
    if a < b :
        return 0
    if (a // 2) < b:
        x = a - b
        # print(f'{b}　→ {x}')
        b = x
    t = 1
    for i in range(b):
        t *= (a - i) % mod
    s = 1
    for i in range(1, b + 1):
        s *= i % mod
    return (t // s) % mod

N, K = map(int, input().split())
r = N - K
mod = 1000000007

for i in range(1, K + 1):
        first = comb(r + 1, i, mod)
        if first == 0:
            second = 0
        else:
            second = comb(K - 1, i - 1, mod)
        print(first * second % mod)

Buggy submission (verdict: Runtime Error):
def comb(a, b, mod):
    if a // 2 < b:
        b = a - b
    t = 1
    for i in range(b):
        t *= (a - i) % mod
    s = 1
    for i in range(1, b + 1):
        s *= i % mod
    return (t // s) % mod



N, K = map(int, input().split())
r = N - K
mod = 1000000007

if K > N // 2:
    

for i in range(1, K + 1):
    print(comb(r + 1, i, mod) * comb(K - 1, i - 1, mod) % mod)
Problem p03011 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(a + b + c - max(a, b, c))

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a + b + c - , max(a, b, c))
Problem p03045 (python)

Fixed submission:
class union_find():
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [1 for i in range(n + 1)]

    def find(self, c):
        if self.par[c] == c:
            return c

        ret = self.find(self.par[c])
        self.par[c] = ret
        return ret

    def union(self, x, y):
        xr = self.find(x)
        yr = self.find(y)
        if xr == yr:
            return

        if self.rank[yr] > self.rank[xr]:
            self.par[xr] = yr
        else:
            self.par[yr] = xr
            if self.rank[xr] == self.rank[yr]:
                self.rank[xr] += 1

    def show(self):
        print('parent', self.par[1:])
        print('rank', self.rank[1:])

N, M = map(int, input().split())
uf = union_find(N)

for i in range(M):
    x, y, z = map(int, input().split())
    uf.union(x, y)


print([i == v for i, v in enumerate(uf.par)].count(True) - 1)

Buggy submission (verdict: Runtime Error):
class union_find():
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [1 for i in range(n + 1)]

    def find(self, c):
        if self.par[c] == c:
            return c

        ret = self.find(self.par[c])
        self.par[c] = ret
        return ret

    def union(self, x, y):
        xr = self.find(x)
        yr = self.find(y)
        if xr == yr:
            return

        if self.rank[yr] > self.rank[xr]:
            self.par[xr] = yr
        else:
            self.par[yr] = xr
            if self.rank[xr] == self.rank[yr]:
                self.rank[xr] += 1

    def show(self):
        print('parent', self.par[1:])
        print('rank', self.rank[1:])

N, M = map(int, input().split())
uf = union_find(N)

for i in range(M):
    x, y, z = map(int, input().split())
    uf.union(x, y)


print([i == v for i, v in enumerate(uf.par[])].count(True)) - 1
Problem p02912 (python)

Fixed submission:
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] *= -1
    heapq.heapify(A)

    for i in range(M):
        maxa = -1 * heapq.heappop(A)
        if maxa == 0:
            print("0")
            exit()
        heapq.heappush(A,  maxa // 2 * (-1))
    print(sum(A) * (-1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] *= -1
    heapq.heapify(A)

    for i in range(M):
        maxaa = -1 * heapq.heappop(A)
        if max(A) == 0:
            print("0")
            exit()
        heapq.heappush(A,  maxaa // 2 * (-1))
    print(sum(A) * (-1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(N):
       AA[i] = A[i] * (-1)
    heapq.heapify(AA)

    for i in range(M):
        maxaa=-1 * heapq.heappop(AA)
        if max(A) == 0:
            print("0")
            exit()
        heapq.heappush(AA,  maxaa // 2 * (-1))
    print(sum(AA) * (-1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    for i in range(N):
       AA[i] = A[i] * (-1))
    heapq.heapify(AA)

    for i in range(M):
        maxaa=-1 * heapq.heappop(AA)
        if max(A) == 0:
            print("0")
            exit()
        heapq.heappush(AA,  maxaa // 2 * (-1))
    print(sum(AA) * (-1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)


def input():
    return sys.stdin.readline().rstrip()


def dfs(a, m):
    if max(a) == 0:
        return 0
    if m == 0:
        return sum(a)
    a[a.index(max(a))] //= 2
    return dfs(a, m-1)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    print(dfs(A, M))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().rstrip()


def dfs(a, m):
    if max(a) == 0:
        return 0
    if m == 0:
        return sum(a)
    a[a.index(max(a))] //= 2
    return dfs(a, m-1)


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    print(dfs(A, M))


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

Fixed submission:
def main():
    S = input()
    if S[0] == S[1] == S[2] == S[3]:
        ans = "No"
    elif S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    S = input()
    if S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    elif S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    elif S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
    else:
    else:
        ans = "No"
    print(ans)


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

Fixed submission:
n = int(input())
print(len(set([input() for i in range(n)])))

Buggy submission (verdict: Runtime Error):
n = int(input().split())
mylist = list(range(0))
inp = ''
for i in range(n):
    inp = input()
    if (inp not in mylist):
        mylist.append(inp)
print(len(mylist))
Problem p02754 (python)

Fixed submission:
N,A,B = (int(x) for x in input().split())
S =  N % (A+B) - A
Acount = N % (A+B)
Ansn = int(N / (A + B)) * A
if S <= 0:
    print(Ansn + Acount)
else:
    print(Ansn + A)

Buggy submission (verdict: Runtime Error):
N,A,B = (int(x) for x in input().split())
S =  n % (A+B) - A
Acount = n % (A+B)
Ansn = n / (A+ B) * A
if S <= 0
    print(Ansn + Acount)
else
    print(Ansn + A)
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if(k < a):
    print(k)
elif(k <= a + b):
    print(a)
else:
    print(a - (k - (a + b)))

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if(k < a):
    pritn(k)
elif(a <= k <= a + b):
    print(a)
else:
    print(a - (k - (a + b)))
Problem p02766 (python)

Fixed submission:
n, k = map(int, input().split())
count = 0
while n >= k:
  n = n // k
  count += 1
print(count+1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
count == 0
while n >= k:
  n = n // k
  count += 1
print(count)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
print(r**2)