Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
R = S.count("R")
G = S.count("G")
B = S.count("B")

ans = R*G*B
for i in range(N-2):
    for j in range(i,N-1):
        k = 2*j - i
        if k < N:
            tmp = []
            tmp.append(S[i])
            tmp.append(S[j])
            tmp.append(S[k])
            if len(set(tmp)) == 3:
                ans -= 1

print(ans)

Fixed submission:
N = int(input())
S = input()
R = S.count("R")
G = S.count("G")
ans = R*G*(N-R-G)

for i in range(N-2):
    for j in range(i,N-1):
        k = 2*j - i
        if k < N:
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -= 1

            
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def combination(n,r,mod=10**9+7):
    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod

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

num = {}
for i in A:
    if i not in num:
        num[i] = 1
    else:
        num[i] += 1


values = list(num.values())
keys = list(num.keys())
S = 0
for i in range(len(keys)):
    if values[i] >= 2:
        S += combination(values[i],2)

for i in range(N):
    if num[A[i]] >= 3:
        print(S-combination(num[A[i]],2)+combination(num[A[i]]-1,2))
    elif num[A[i]] == 2:
        print(S-1)
    else:
        print(S)

Fixed submission:

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

num = {}
for i in A:##O(N)
    if i not in num:
        num[i] = 1
    else:
        num[i] += 1


values = list(num.values())
keys = list(num.keys())
S = 0
for i in range(len(keys)):##O(N*2)
    if values[i] >= 2:
        S += values[i]*(values[i]-1)//2

for i in range(N):
    if num[A[i]] >= 3:
        print(S-num[A[i]]*(num[A[i]]-1)//2+(num[A[i]]-1)*(num[A[i]]-2)//2)
    elif num[A[i]] == 2:
        print(S-1)
    else:
        print(S)
Buggy python submission (verdict: Runtime Error):
from numpy import sqrt
a,b,c = map(int,input().split())

if a+b+2*sqrt(a*b)<c:
  print("Yes")
else:
  print("No)

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

if c - b - a <= 0:
    print("No")
elif 4*a*b < (c-b-a)**2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(s)) == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(S)) == 1:
  print("Yes")
else:
  print("No)

Fixed submission:
S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(list(s))) == 1:
  print("Yes")
else:
  print("No)

Fixed submission:
S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
S = input()
S.replace("hi",":")
if len(set(s)) == 1:
  print("Yes")
else:
  print("No)

Fixed submission:
S = input()
if S.count("hi") == len(S)/2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Q = int(input())
for i in range(Q):
    a = list(input().split())
    if len(a) == 1:##T_i=1
        S.reverse()
    else:#T_i == 2
        if a[1] == "1":
            S.insert(0,a[2])
        else:
            S.append(a[2])

for i in range(len(S)):
    print(S[i],end="")


Fixed submission:
S = input()
Q = int(input())
Atama = []
Osiri = []
rev = [0]*Q
for i in range(Q):
    a = list(input().split())
    if len(a) == 1:##T_i=1
        rev[i] = 1
    else:#T_i == 2
        if a[1] == "1":
            Atama.append([i,a[2],1])
        else:
            Osiri.append([i,a[2],-1])

##revの累積和
Rev = []
tmp = 0
r = sum(rev)
for i in range(len(rev)):
    r -= rev[i]
    Rev.append(r)
##print(Rev)
for i in range(len(Atama)):
    Atama[i][2] *= (-1)**Rev[Atama[i][0]]
for i in range(len(Osiri)):
    Osiri[i][2] *= (-1)**Rev[Osiri[i][0]]

Ans = Atama+Osiri
Ans.sort()
##print(Ans)
fw = ""
aw = ""
N = len(Ans)
for i in range(N):
    if Ans[i][2] == 1:
        fw += Ans[i][1]
    else:
        aw += Ans[i][1]

if sum(rev)%2 == 1:
    S = S[::-1]
fw = fw[::-1]

print(fw+S+aw)
Buggy python submission (verdict: Runtime Error):
def same(h):
    if len(h)==0:
        return True
    else:
        if len(set(h))==1:
            return True
        else:
            return False

N,M = map(int,input().split())
if M == 0:
    print(1)
    exit()
h = []
t = []
o = []
if N == 1:
    for i in range(M):
        s,c = map(int,input().split())
        o.append(o)
    if same(o):
        if o[0] == 0:
            print(-1)
        else:
            print(o[0])
    else:
        print(-1)
if N == 2:
    for i in range(M):
        s,c = map(int,input().split())
        tmp = c *(10**(-s+3))
        if s == 1:
            h.append(tmp)
        elif s == 2:
            t.append(tmp)
    if same(h) and same(t):
        h.append(0)
        t.append(0)
        ans = h[0]+t[0]
        if ans==0:
            print(-1)
        else:
            print(ans)
    else:
        print(-1)

if N == 3:
    for i in range(M):
        s,c = map(int,input().split())
        tmp = c *(10**(-s+3))
        if s == 1:
            h.append(tmp)
        elif s == 2:
            t.append(tmp)
        elif s == 3:
            o.append(tmp)
    if same(o) and same(h) and same(t):
        h.append(0)
        t.append(0)
        o.append(0)
        ans = h[0]+t[0]+o[0]
        if ans==0:
            print(-1)
        else:
            print(ans)
    else:
        print(-1)

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

sc = []
for i in range(M):
    s,c = map(int,input().split())
    c = str(c)
    sc.append([s-1,c])

for i in range(10**N+1):
    tmp = str(i)
    flag = False
    count = 0
    if len(tmp) == N:
        for s,c in sc:
            if tmp[s] == c:
                count += 1
        if count == M:
            flag = True
    if flag:
        print(tmp)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def combination(n,r,mod=10**9+7):
    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod
  
mod = int(1e9+7)
n,a,b= map(int,input().split())
 
S = (pow(2,n)-1)%mod
A = combination(n,a)
B = combination(n,b)
ans = (S-A-B)%mod
 
print(ans)

Fixed submission:
def combination(n,r,mod=10**9+7):
    n1 = n+1
    r = min(r,n-r)
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom,mod-2,mod) % mod

def power_func(a,n,p):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
            res=(res*a) %p
    return res

mod = int(1e9+7)
n,a,b= map(int,input().split())

S = (power_func(2,n,mod) - 1)%mod
A = combination(n,a)
B = combination(n,b)
ans = (S-A-B)%mod

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
SS = []
for i in range(N):
    tmp = input()
    S.append(tmp)
    if tmp not in SS:
        SS.append(tmp)
S.sort()
SS.sort()
T = {}
for i in range(N):
    if S[i] in T:
        T[S[i]] += 1
    else:
        T[S[i]] = 1
m = 0
for i in SS:
    m = max(T[i],m)
##print("--------")
for i in SS:
    if T[i] == m:
        print(i)

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

for i in range(N):
    tmp = input()
    S.append(tmp)
S.sort()
if N == 1:
    print(S[0])
    exit()
ans = []
SS = []
count = 1

for i in range(N-1):
    if i == N-2:
        if S[i] == S[i+1]:
            count += 1
            ans.append(count)
            SS.append(S[i])
        else:
            ans.append(count)
            SS.append(S[i])
            ans.append(1)
            SS.append(S[i+1])
    elif S[i] == S[i+1]:
        count += 1
    else:
        ans.append(count)
        SS.append(S[i])
        count = 1

m = max(ans)

for i in range(len(SS)):
    if ans[i] == m:
        print(SS[i])
Buggy python submission (verdict: Runtime Error):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A,B)

Fixed submission:
S = input()

ans = ""
for i in range(len(S)):
    ans += "x"

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

if len(set(a)) == N:
  print('YES')
else:
  print('NO')

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

A.sort()
ans = "YES"
for i in range(N-1):
    if A[i] == A[i+1]:
        ans = "NO"
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))
 
a = [0]*N
f = sum(p[:K])

for i in range(N-K):
    f = f + p[i+K] - p[i]
    a[i] = f
    
num = 0

for i in range(1,N-K):
    if a[i] > a[i-1]:
        num = i
ans = 0

for i in range(num+1,num+K+1):
    ans += (p[i]+1)/2

print(ans)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
 
for i in range(N):
    p[i] = (p[i]+1)/2
a = [0]*(N-K+1)
f = sum(p[:K])
a[0] = f

for i in range(N-K):
    f = f + p[i+K] - p[i]
    a[i+1] = f

print(max(a))
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split()))

minp = P[0]
ans = 0

for i in range(N)::
    minp = min(minp,P[i])
    if minp == P[i]:
        ans += 1

print(ans)



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

minp = P[0]
ans = 0

for i in range(N):
    if i != 0:
        minp = min(minp,P[i])
    if minp == P[i]:
        ans += 1

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

xl = []

for i in range(N):
    xl.append(list(map(int,input().split())))

itv = []

for i in range(N):
    right = xl[i][0] + xl[i][1]  ##right
    left = xl[i][0] - xl[i][1]  ##left   
    itv.append([right,left])
itv.sort()

ass = 0
tt = -1e10
for i in range(N):
    if tt <= itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)


            



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

ans = [0]*N

if S == 1e9:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = 1 
else:
    for i in range(K):
        ans[i] = S
    for i in range(K,N):
        ans[i] = S+1
    

print(*ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+2)
ACed = [0]*(N+2)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+N)
ACed = [0]*(N+M)
tmp_num = [0]*(M+N)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        tmp_num[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1
        WA[num] = tmp_num[num]

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+3) ##WAするのは提出数
ACed = [0]*(N+3) ##ACするのは問題数

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    elif RES[i][1] == "AC":
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+N)
ACed = [0]*(N+M)
tmp_num = [0]*(M+N)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        tmp_num[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1
        WA[num] = tmp_num[num]

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+1)
ACed = [0]*(N+1)

for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        WA[num] += 1
    else:
        ACed[num] = 1

print(sum(ACed),end=" ")
print(sum(WA))

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

RES = []

for i in range(M):
    RES.append(list(input().split()))

WA = [0]*(M+N)
ACed = [0]*(N+M)
tmp_num = [0]*(M+N)
tmp = 0
for i in range(M):
    num = int(RES[i][0])
    if RES[i][1] == "WA" and not ACed[num]:
        tmp_num[num] += 1
    elif RES[i][1] == "WA" and ACed[num]:
        tmp += 1
    else:
        ACed[num] = 1
        WA[num] = tmp_num[num]

print(sum(ACed),end=" ")
print(sum(WA))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
def dfs_2d(H,W,M,start,goal):
    que = deque()
    que.append([start[0],start[1]])
    distance = [[-1 for i in range(W)] for j in range(H)]
    dxdy = [[1,0],[-1,0],[0,1],[0,-1]]##4方向

    distance[start[0]][start[1]] = 0

    flag = False
    
    while que:
        x,y = que.popleft()

        if x == goal[0] and y == goal[1]:
            return distance[goal[0]][goal[1]]
        
        for i,j in dxdy:
            dx = x + i
            dy = y + j
            if 0 <= dx <= H-1 and 0 <= dy <= W-1 and M[dx][dy] != "#":
                distance[dx][dy] = distance[x][y] + 1
                que.append([dx,dy])
    return -1

def main():
    H,W = map(int,input().split())
    M = []
    for i in range(H):
        M.append(input())
    ans = 0
    for i in range(H):
        for j in range(W):
            for h in range(H):
                for k in range(W):
                    if M[i][j] != "#" and M[h][k] != "#":
                        start = [i,j]
                        goal = [h,k]
                        ans = max(ans,dfs_2d(H,W,M,start,goal))

    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import deque
def dfs_2d(H,W,M,start):
    que = deque()
    que.append([start[0],start[1]])
    distance = [[-1 for i in range(W)] for j in range(H)]
    dxdy = [[1,0],[-1,0],[0,1],[0,-1]]##4方向

    distance[start[0]][start[1]] = 0

    flag = False
    
    while que:
        x,y = que.popleft()
        for i,j in dxdy:
            dx = x + i
            dy = y + j
            if 0 <= dx <= H-1 and 0 <= dy <= W-1 and M[dx][dy] != "#" and distance[dx][dy] == -1:
                distance[dx][dy] = distance[x][y] + 1
                que.append([dx,dy])
                
    return max(max(i) for i in distance)

def main():
    H,W = map(int,input().split())
    M = []
    for i in range(H):
        M.append(input())
    ans = 0
    for i in range(H):
        for j in range(W):
            if M[i][j] != "#":
                start = [i,j]
                ans = max(ans,dfs_2d(H,W,M,start))

    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np 
import sys

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm(a, b):
    return (a * b)//gcd(a,b)

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

A = np.array(a)

##while np.sum(A%2) == 0:
  ##  A = A//2

if np.sum(A%2) != len(A):
    print("0")
    sys.exit()
    
tmp = 1##LCM

for i in range(N):
    tmp = lcm(tmp,a[i]//2)

if tmp > M:
    print("0")

else:
    print((M//tmp+1)//2)

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


if 500*K>=X:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=input()
print(input().count("ABC")

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

for i in range(len(S)-2):
    tmp = 0
    if S[i]=="A" and S[i+1] == "B" and S[i+2] == "C":
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import math

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

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

print(lcm(a,b))

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


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

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

print(lcm(a,b))

Buggy python submission (verdict: Runtime Error):
import math

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

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

print(lcm(a,b))

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


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

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

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

dis1 = (A1 - B1) * T1
dis2 = (A2 - B2) * T2

if dis1 == -dis2:
    print("infinity")

elif (dis1<0 and dis2<0) or (dis1>0 and dis2>0):
    print("0")

else:
    S = abs(dis1//(dis1+dis2))
    R = abs(dis1%(dis1+dis2)) 
    if rem == 0:
        ans = S*2 
    else:
        ans = S*2 + 1
    
    print(ans)
 

Fixed submission:
T1,T2 = map(int,input().split())
A1,A2 = map(int,input().split())
B1,B2 = map(int,input().split())

dis1 = (A1 - B1) * T1
dis2 = (A2 - B2) * T2

if dis1 > 0:
    dis1 = -dis1
    dis2 = -dis2

if dis1 + dis2 <0:
    print(0)

elif dis1 == -dis2:
    print("infinity")
    
else:
    S = dis1//(dis1+dis2)
    R = dis1%(dis1+dis2) 
    if R == 0:
        ans = S*2 
    else:
        ans = S*2 + 1
    
    print(abs(ans))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
S = input()[::-1]

if M >= N:
    print(N)
    exit()

p = -1
for i in reversed(range(1,M+1)):
    if S[i] == "0":
        p = i
        break

if p == -1:
    print(-1)
    exit()
print(p)
ps = [p]
for _ in range(N//M):
    tmp = -1
    for i in reversed(range(ps[-1]+1,ps[-1]+M+1)):
        try:
            if S[i] == "0":
                ps.append(i)
                tmp = i
                break
        except:
            pass
    if tmp == -1:
        print(-1)
        exit()
pp = [ps[i+1]-ps[i] for i in range(len(ps)-1)]
print(*pp[::-1],ps[0])


Fixed submission:
N,M = map(int,input().split())
S = input()[::-1]

if M >= N:
    print(N)
    exit()

p = -1
for i in reversed(range(1,M+1)):
    if S[i] == "0":
        p = i
        break

if p == -1:
    print(-1)
    exit()

ps = [p]
while 1:
    tmp = -1
    for i in reversed(range(ps[-1]+1,ps[-1]+M+1)):
        try:
            if S[i] == "0" or i == N:
                ps.append(i)
                tmp = i
                break
        except:
            pass
    if tmp == -1:
        print(-1)
        exit()
    if ps[-1] == N:
        break

pp = ([ps[i+1]-ps[i] for i in range(len(ps)-1)])[::-1] + [ps[0]]
print(*pp)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
ans = float("inf")

for i in range(1,int(math.sqrt(N))):
    if N%i == 0:
        ans = min(ans,i+N//i-2)
print(int(ans))


Fixed submission:
import math
N = int(input())
ans = float("inf")

for i in range(1,int(math.sqrt(N))+1):
    if N%i == 0:
        ans = min(ans,i+N//i-2)
print(int(ans))

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
ans = float("inf")

for i in range(1,int(math.sqrt(N))):
    if N%i == 0:
        ans = min(ans,i+N/i-2)
print(int(ans))


Fixed submission:
import math
N = int(input())
ans = float("inf")

for i in range(1,int(math.sqrt(N))+1):
    if N%i == 0:
        ans = min(ans,i+N//i-2)
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


N = int(input())
L = list(map(int,input().split()))
L.sort()
L = np.array(L)
ans = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        length = L[i]+L[j]
        tmp = L[j+1:]
        tmp = tmp[tmp<length]
        ans += len(tmp)
                 

print(ans)

Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

ans = 0

for i in range(N):
    for j in range(i+1,N):
        ans += bisect.bisect_left(L,L[i]+L[j]) - (j+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
n = int(input())

cnt = 0
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    s[i+1] = "1"
    cnt += 1
print(cnt*n)

Fixed submission:
S = list(input())
K = int(input())
l = len(S)

if len(set(S)) == 1:
    print(l*K//2)
    exit()
else:
    ans = 0
    tmp = ""
    count = [1]
    for i in range(l-1):
        if S[i] == S[i+1]:
            count[-1] += 1
        else:
            count.append(1)
    
    for i in count:
        ans += i//2*K

    if S[0] == S[-1] and count[0]%2 == count[-1]%2:
        ans += K-1

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

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

B = [0]*N

for i in A:
    B[i-1] = A.index(i)+1

for i in B:
    print(i,end=" ")

Fixed submission:
N = int(input())

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

B = [0]*N

for i in range(N):
    B[A[i]-1] = i+1

print(*B)

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

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

for i in range(N):
    print(A.index(i)+1,end=" ")

Fixed submission:
N = int(input())

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

B = [0]*N

for i in range(N):
    B[A[i]-1] = i+1

print(*B)

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

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

for i in range(N):
    print(A.index(i+1)+1,end=" ")

Fixed submission:
N = int(input())

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

B = [0]*N

for i in range(N):
    B[A[i]-1] = i+1

print(*B)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))

while M>0:
    A[A.index(max(A))] /= 2
    M -= 1


ans = 0

for i in A:
    ans += int(i)

print(ans)


Fixed submission:
import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))

A.sort()

while M>0:
    A[N-1] /= 2
    M -= 1
    A[A.index(max(A))],A[N-1] = A[N-1],max(A)


ans = 0

for i in A:
    ans += int(i)

print(ans)


Fixed submission:
import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))

A.sort()

while M>0:
    A[N-1] /= 2
    M -= 1
    A.sort() 

ans = 0

for i in A:
    ans += int(i)

print(ans)


Fixed submission:
import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        count += 1

print(min(N-1,count+2*K))

Fixed submission:
N,K = map(int,input().split())
S = input()
count = 0

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        count += 1

print(min(N-1,count+2*K))