Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    minmp = 10000000
    def dfs(depth, pt):

        if depth==n:
            mp_tmp = 0
            all_used = True
            for k in range(3):
                if pt.count(k) == 0:
                    all_used = False
                    break

                sum_tmp = 0
                mp_tmp += (pt.count(k) - 1)*10
                for l in range(n):
                    if pt[l] == k:
                        sum_tmp += moto[l]
                
                mp_tmp += abs(sum_tmp-take[k])

            if all_used == True:
                global minmp
                minmp = min(minmp,mp_tmp)
                return
            else:
                return

        for i in range(4):
            pt[depth] = i
            dfs(depth+1, pt)

        return

    #入力をとる
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]


    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    pt  = [3]*n
    for i in range(n):
        dfs(i,pt)

    print(minmp)

main()

Fixed submission:
def main():
    #入力をとる
    n,a,b,c = map(int,input().split())
    moto = [int(input()) for i in range(n)]

    take = []
    take.append(a)
    take.append(b)
    take.append(c)

    mp = 10000000000
    pt= []
    #全探索
    for i in range(2**(2*n)):
        pt = []
        for j in range(n):
            if (i >> j*2)&1:
                if (i >> j*2+1)&1:
                    pt.append(3)
                else:
                    pt.append(1)
            else:
                if (i >> j*2+1)&1:
                    pt.append(2)
                else:
                    pt.append(0)       

        #keisan
        mp_tmp = 0
        all_used = True
        for k in range(3):
            if pt.count(k) == 0:
                all_used = False
                break

            sum_tmp = 0
            mp_tmp += (pt.count(k) - 1)*10
            for l in range(n):
                if pt[l] == k:
                    sum_tmp += moto[l]
            
            mp_tmp += abs(sum_tmp-take[k])

        if all_used == True:
            mp = min(mp_tmp, mp)
    print(mp)

main()
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x=map(int,input().split())
ans=0
for i in range(a,b+1):
    if i%x==0:
        ans += 1
print(ans)

Fixed submission:
a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
#sが全部Wか全部Bになるまでループ
while s.count('W')!=0 and s.count('B')!=0:
    #一番右がBならWを置き、sの一番右のWまでWにする
    if s[-1] == 'B':
        W_usiro = s.rfind('W')
        s = s[0:W_usiro+1] + s[W_usiro+1:].replace('B','W') + 'W'
    #一番右がWならBを置き、sの一番右のBまでBにする
    else:
        B_usiro = s.rfind('B')
        s = s[0:B_usiro+1] + s[B_usiro+1:].replace('W','B') + 'B'

    ans += 1

print(ans)

Fixed submission:
s = input()
ans = 0
now = s[0]
for i in range(1,len(s)):
    if now != s[i]:
        ans += 1
        now = s[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
penki = list(map(int,input().split()))

checked = [False]*100

for i in range(3):
    checked[penki[i]]=True

ans = checked.count(True)

print(ans)


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

checked = [False]*100

for i in range(3):
    checked[penki[i]-1]=True

ans = checked.count(True)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

T=[]
A=[]
for i in range(n):
    t,a=map(int,input().split())
    T.append(t)
    A.append(a)

#比に対する掛け率
kake = 1
sum_tmp = 0
t_tmp = 0
a_tmp = 0

for i in range(n):
    kake = 1
    #i+1回目の合計がi回目の合計より大きくなる最小の掛け率を計算する
    while kake*(T[i]+A[i]) < sum_tmp or kake*T[i] < t_tmp or kake*A[i] < a_tmp:
        kake += 1
    
    sum_tmp = kake*(T[i]+A[i])
    t_tmp = kake*T[i]
    a_tmp = kake*A[i]

ans = kake * (T[n-1]+A[n-1])
print(ans)

Fixed submission:
def main():
    n = int(input())

    T=[]
    A=[]
    for i in range(n):
        t,a=map(int,input().split())
        T.append(t)
        A.append(a)

    #比に対する掛け率
    kake = 1
    sum_tmp = 0
    t_tmp = 0
    a_tmp = 0
    for i in range(n):
        if i == 0:
            kake = 1
        else:
            #i+1回目の合計がi回目の合計より大きくなる最小の掛け率を計算する
            if sum_tmp % (T[i]+A[i]) == 0:
                kake_sum = sum_tmp // (T[i]+A[i])
            else:
                kake_sum = sum_tmp // (T[i]+A[i]) + 1
            
            if t_tmp % T[i] == 0:
                kake_t = t_tmp // T[i]
            else:
                kake_t = t_tmp // T[i] + 1
            
            if a_tmp % A[i] == 0:
                kake_a = a_tmp // A[i]
            else:
                kake_a = a_tmp // A[i] + 1
            
            kake = max(kake_sum, kake_t, kake_a)

        sum_tmp = kake*(T[i]+A[i])
        t_tmp = kake*T[i]
        a_tmp = kake*A[i]

    ans = kake * (T[n-1]+A[n-1])
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    #入力
    n, a = map(int,input().split())
    x = [0] + list(map(int,input().split()))

    sum_max = (n)*(max(x))+1

    #dp[i][j][k]:x1-xiからj枚選んで、合計をkにする選び方の数
    dp = [[[0]*sum_max for _ in range(n+1)] for _ in range(n+1)]

    dp[0][0][0] = 1

    for i in range(n+1):
        for j in range(n+1):
            for k in range(sum_max):
                #xi>kのとき
                if x[i]>k:
                    dp[i][j][k] = dp[i-1][j][k]
                elif k>=1 and x[i-1]<=k:
                    #xi<=kのとき
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

    count = 0
    for j in range(0,n+1):
        count += dp[n][j][j*a]
    
    print(count)


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    #入力
    n, a = map(int,input().split())
    x = [0] + list(map(int,input().split()))

    sum_max = (n)*(max(x))+1

    #dp[i][j][k]:x1-xiからj枚選んで、合計をkにする選び方の数
    dp = [[[0]*2501 for _ in range(n+1)] for _ in range(n+1)]

    dp[0][0][0] = 1

    for i in range(1,n+1):
        for j in range(n+1):
            for k in range(50*j+1):
                #xi>kのとき
                if x[i]>k:
                    dp[i][j][k] = dp[i-1][j][k]
                elif j>=1 and x[i]<=k:
                    #xi<=kのとき
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

    count = 0
    for j in range(1,n+1):
        count += dp[n][j][j*a]
    
    print(count)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    #入力
    n, a = map(int,input().split())
    x = list(map(int,input().split()))

    #パターン0~2^n
    #ptの0bit目が0->x1を選択する
    pt = 0
    count = 0

    for pt in range(2**n):
        #ptにしたがって選択カードの合計を計算
        sum_tmp = 0
        num_tmp = 0
        average = 0
        for j in range(n):
            if (pt >> j)&1 :
                sum_tmp += x[j]
                num_tmp += 1
        
        #選択カードの合計から平均を計算
        if num_tmp!=0:
            average = sum_tmp/num_tmp

        if average == a:
            count += 1
        
    print(count)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    #入力
    n, a = map(int,input().split())
    x = [0] + list(map(int,input().split()))

    sum_max = (n)*(max(x))+1

    #dp[i][j][k]:x1-xiからj枚選んで、合計をkにする選び方の数
    dp = [[[0]*2501 for _ in range(n+1)] for _ in range(n+1)]

    dp[0][0][0] = 1

    for i in range(1,n+1):
        for j in range(n+1):
            for k in range(50*j+1):
                #xi>kのとき
                if x[i]>k:
                    dp[i][j][k] = dp[i-1][j][k]
                elif j>=1 and x[i]<=k:
                    #xi<=kのとき
                    dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

    count = 0
    for j in range(1,n+1):
        count += dp[n][j][j*a]
    
    print(count)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = input()
a = input()
b = input()
c = input()

la = list(a)
lb = list(b)
lc = list(c)

total = 0
for i in range(int(n)):
    count = 0
    if la[i] != lb[i]:
        count += 1
    if la[i] != lc[i]:
        count += 1
    if lb[i] != lc[i]:
        count += 1

    if count == 3:
        total += 2
    elif count == 2:
        total += 1
    elif count == 1:
        total += 1
    else:
        total += 0

print(total)

Fixed submission:
i = input().split()
all = int(i[0])
x = int(i[1])
y = int(i[2])
t = 0
max = 0
if x > y:
    max = x - abs(x - y)
    t = x
elif y > x:
    max = y - abs(x - y)
    t = y 
else:
    t = x
    max = x

min = 0
nx = all - x
ny = all - y

if nx > ny:
    nt = nx
elif ny > nx:
    nt = ny
else:
    nt = nx
if t >= nt: 
    min = t - nt
else:
    min = 0
print("{0} {1}".format(max,min))
Buggy python submission (verdict: Runtime Error):
1. A,B,C =map(int,input().split())
2. print(max(A+B,A+C,B+C))

Fixed submission:
A,B,C =map(int,input().split())
print(min(A+B,A+C,B+C))
Buggy python submission (verdict: Runtime Error):
a=input()
i=0
n=[]
while i<len(a):
  n.append(a[i])
  i+=1
pd=n[0]+n[1]
sd=n[2]+n[3]
pd=int(pd)
sd=int(sd)
if sd==0 and pd==0:
  print('NA')
elif pd>12:
  if sd>=1 and sd<=12:
    print('YYMM')
  elif sd>12:
    print('NA')
  elif sd<1:
    print('NA')
elif pd==0:
  if sd>12:
    print('NA')
  if sd>0 and sd<=12:
    print('YYMM')
elif pd<=12:
  if sd>12:
    print ('MMYY')
  elif sd==0:
    print('MMYY')
  elif sd<=12 and sd!=0:
    print('AMBIGUOUS')

Fixed submission:
a=input().split()
a=list(map(int,a))
pos = a[1]-1
pal=input()
pal=list(pal)
pal[pos]=pal[pos].lower()
i=1
while i<a[0]:
  pal[0]=pal[0]+pal[i]
  i+=1
print (pal[0])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
MOD = 1000000007
N, M = map(int, input().split())
a = []
for _ in range(M):
    a.append(int(input()))


def getPatternNum(num):
    pattern = [0] * num
    for i in range(num):
        if i == 0 or i == 1:
            pattern[i] = 1
            continue
        pattern[i] = pattern[i - 2] + pattern[i - 1]
    return pattern


def solve():
    # 階段の連続してる数のリスト
    stepsList = [0] * (M + 1)
    maxSteps = 0
    stepsList[0] = a[0] - 1
    for j in range(1, M):
        stepsList[j] = a[j] - a[j - 1] - 1
        if stepsList[j] == 0:
            return 0
    stepsList[M] = N - a[M - 1] - 1
    pattern = getPatternNum(max(stepsList) + 1)
    # こわれてるところ以外のパターンを掛ける
    for k in range(len(stepsList)):
        if k == 0:
            total = pattern[stepsList[k]]

        else:
            total = total * (pattern[stepsList[k]]) % MOD

    return total


ans = solve()
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
MOD = 1000000007
N, M = map(int, input().split())
a = []
for _ in range(M):
    a.append(int(input()))

# 0-num段目までのパターン数を取得する
# numは連続した階段の一番高いところが何段目かを意味する


def getPatternNum(num):
    pattern = [0] * num
    for i in range(num):
        if i == 0 or i == 1:
            pattern[i] = 1
            continue
        pattern[i] = (pattern[i - 2] + pattern[i - 1]) % MOD
    return pattern


def solve():
    # 階段の連続してる数のリスト

    if M > 0:
        stepsList = [0] * (M + 1)
        maxSteps = 0
        stepsList[0] = a[0]
        for j in range(1, M):
            stepsList[j] = a[j] - a[j - 1] - 1
            if stepsList[j] == 0:
                return 0
        stepsList[M] = N - a[M - 1]
    else:
        stepsList = [N + 1]

    # 連続数が一番大きいところの一番上の段を引数でわたす
    pattern = getPatternNum(max(stepsList) + 1)

    # こわれてるところ以外のパターンを掛ける
    for k in range(len(stepsList)):
        if k == 0:
            # 連続段数が３なら一番上の段は０段目から数えて２段目になるため１引く
            total = pattern[stepsList[k] - 1]

        else:
            total = (total * (pattern[stepsList[k] - 1])) % MOD

    return total


print(solve())
Buggy python submission (verdict: Runtime Error):
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)


Fixed submission:
A, P = map(int, input().split())
P = A * 3 + P
print(int(P // 2))
Buggy python submission (verdict: Runtime Error):
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Fixed submission:
import numpy as np
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from nltk.classify.maxent import calculate_empirical_fcount
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)


Fixed submission:
import numpy as np
N = int(input())
SList = []
PList = []
dic = {}
Slist = []
aa = []
for _ in range(N):
    S, P = input().split()
    dic[S] = int(P)
    Slist.append(S)
    aa.append((int(P), S))
dic = sorted(dic.items())

sortedS = list(sorted(set(Slist)))

for i in range(len(sortedS)):
    tempV = []
    tempI = []
    for j in range(N):
        if aa[j][1] == sortedS[i]:
            tempV.append(aa[j][0])
            tempI.append(j)
    indexList = np.argsort(tempV)
    for k in reversed(indexList):
        print(tempI[k] + 1)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
inputData = input()
ID, Gate = map(int, inputData.split())
x = []
for i in range(Gate):
    inputId = input()
    idStart, idEnd = map(int, inputId.split())
    idList = list(range(idStart, idEnd + 1))
    x.append(idList)

# print(x[0])


def solve():

    for i in range(len(x)):
        if i == 0:
            matched = set(x[0])
            continue

        tempX = set(x[i])
        # print('++')
        # print(matched)
        # print(tempX)
        matched = set(list(matched & tempX))
        # print(matched)
        if len(matched) == 0:
            #
            return 0

    return len(matched)


ans = solve()
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-
inputData = input()
age, price = map(int, inputData.split())

if age >= 13:
    ans = price
elif age >= 6:
    ans = price / 2
else:
    ans = 0

print(int(ans))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()

cnt=N
for i in range(N+1):
    if (S[0:i+1].count("#") + S[i+1:N].count(".")) <= cnt:
        cnt = left.count("#") + right.count(".")
print(cnt)

Fixed submission:
N=int(input())
S=input()

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

cnt = 0
z = 0
if N == 1:
    print("0")
    exit()
else:
    for i in range(N-1):
        x = S[i]
        y = S[i+1]
        if x == "#":
            if y == ".":
                cnt += 1
                S = S[0:i+1] + "#" + S[i+2:N]
print(cnt)

Fixed submission:
N=int(input())
S=input()

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

cnt = 0
z = 0
if N == 1:
    print("0")
    exit()
else:
    for i in range(N-1):
        x = S[i]
        y = S[i+1]
        if x == "#":
            if y == ".":
                cnt += 1
                if i != N-1:
                    mae = S[0:i+1]
                    ato = S[i+2:N]
                    S = mae + "#" + ato

print(cnt)


Fixed submission:
N=int(input())
S=input()

if N==1:
    print("0")
else:
    cnt_left=0
    cnt_right=S.count(".")
    cnt = cnt_left + cnt_right
    for i in range(N):
        if S[i] == "#":
            cnt_left += 1
        else:
            cnt_right -= 1

        if cnt_left + cnt_right < cnt:
            cnt = cnt_left + cnt_right
    print(cnt)
Buggy python submission (verdict: Runtime Error):
import statistics as sta

N=int(input())
X=list(map(int,input().split()))

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)

Fixed submission:
import statistics as sta

N=int(input())
X=list(map(int,input().split()))

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)

Buggy python submission (verdict: Runtime Error):
import statistics
import copy

N=int(input())
X=list(map(int,input().split()))

for i in range(len(X)):
    A = copy.deepcopy(X)
    del A[i]
    print(statistics.median(A))


Fixed submission:
import statistics as sta

N=int(input())
X=list(map(int,input().split()))

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import statistics
import copy

N=int(input())
X=list(map(int,input().split()))

for i in range(len(X)):
    A = copy.deepcopy(X)
    del A[i]
    print(statistics.median(A))


Fixed submission:
import statistics as sta

N=int(input())
X=list(map(int,input().split()))

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def is_prime(n):
    if n == 1:
        return False
    if not isinstance(n,int):
        return False
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True

Q=int(input())
L,R=[],[]
for i in range(Q):
    l,r = list(map(int,input().split()))
    L.append(l)
    R.append(r)

list_2017_similar=[]
for i in range(1,100000):
    if is_prime(i) == True and is_prime(int((i+1)/2)) == True and i != 2:
        list_2017_similar.append(i)

for i in range(Q):
    cnt=0
    for j in list_2017_similar:
        if L[i] <= j <= R[i]:
            cnt += 1
    print(cnt)


Fixed submission:
import math

def is_prime(n):
    if n == 1:
        return False
    if not isinstance(n,int):
        return False
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True

Q=int(input())
L,R=[],[]
for i in range(Q):
    l,r = list(map(int,input().split()))
    L.append(l)
    R.append(r)

list_2017_similar_num=[0]
for i in range(1,100001):
    if i % 2 == 0:
        list_2017_similar_num.append(list_2017_similar_num[i-1])
    else:
        if is_prime(i) == True and is_prime(int((i+1)/2)) == True:
            list_2017_similar_num.append(list_2017_similar_num[i-1]+1)
        else:
            list_2017_similar_num.append(list_2017_similar_num[i-1])

for i in range(Q):
    print(list_2017_similar_num[R[i]] - list_2017_similar_num[L[i]-1])
Buggy python submission (verdict: Runtime Error):
listNAB = input().split()
listNABint = [int(s) for s in A]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(N):
    if A <= Placesum(i+1) & Placesum(i+1) <= B:
        sumcounter += i+1
        print(sumcounter)
print(sumcounter)

Fixed submission:
listNAB = input().split()
listNABint = [int(s) for s in listNAB]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(listNABint[0]):
    if listNABint[1] <= Placesum(i+1) & Placesum(i+1) <= listNABint[2]:
        sumcounter += i+1
print(sumcounter)
Buggy python submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
S = input()

for i in range(A):
    if S[i] == "-":
        print("No")
        exit()

if S[A] != "-":
    print("No")
    exit()

for i in range(A+1,A+1+B):
    if S[i] == "-":
        print("No")
        exit()

print("Yes")


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

cnt = 0
while X <= Y:
    X = X * 2
    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = input().split()
a_n = [int(s) for s in a]

list = []
for x in a_n:
    if list == []:
        list.append([x,1])
    else:
        counter = 0
        for y in list:
            if y[0] == x:
                y[1] += 1
                counter = 1220
        if counter == 0:
            list.append([x,1])

counter = 0
for y in list:
    if y[0] > y[1]:
        counter += y[1]
    elif y[0] < y[1]:
        counter += y[1] - y[0]
print(counter)

Fixed submission:
N = int(input())
a = input().split()
a_n = [int(s) for s in a]

dict = {}
for i in range(N):
    if a_n[i] in dict:
        dict[a_n[i]] += 1
    else:
        dict[a_n[i]] = 1

cnt = 0
for i in dict:
    if dict[i] > i:
        cnt += dict[i] - i
    elif dict[i] < i:
        cnt += dict[i]
print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = input().split()
a_n = [int(s) for s in a]

max = max(a_n)
a_n_num = [0]*(max+1)
for i in range(len(a_n)):
    a_n_num[a_n[i]] += 1

counter = 0
for i in range(len(a_n_num)):
    if a_n_num[i] > i:
        counter += a_n_num[i] - i
    elif a_n_num[i] < i:
        counter += a_n_num[i]

print(counter)


Fixed submission:
N = int(input())
a = input().split()
a_n = [int(s) for s in a]

dict = {}
for i in range(N):
    if a_n[i] in dict:
        dict[a_n[i]] += 1
    else:
        dict[a_n[i]] = 1

cnt = 0
for i in dict:
    if dict[i] > i:
        cnt += dict[i] - i
    elif dict[i] < i:
        cnt += dict[i]
print(cnt)
Buggy python submission (verdict: Runtime Error):
a = int(input())

x = str(a)
counter = 0
for i in range(3):
    if int(x[-1-i]) ==  1:
        counter += 1
print(counter)

Fixed submission:
a = input()

counter = 0
for i in range(3):
    if int(a[-1-i]) ==  1:
        counter += 1
print(counter)