Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
N = int(input())
d = defaultdict(int)
tmp = N
for i in range(2, int(math.sqrt(N))+1):
    while tmp % i == 0:
        d[i] += 1
        tmp /= i

if tmp > 1:
    d[tmp] += 1
ans = 0
for key, value in d.items():
    i = value
    j = 1
    while value >= j:
       ans += 1
       value -= j
       j += 1
print(ans)

Fixed submission:
import math
from collections import defaultdict
N = int(input())
d = defaultdict(int)
tmp = N
for i in range(2, int(math.sqrt(N))+1):
    while tmp % i == 0:
        d[i] += 1
        tmp /= i

if tmp > 1:
    d[tmp] += 1
ans = 0
for key, value in d.items():
    i = value
    j = 1
    while value >= j:
       ans += 1
       value -= j
       j += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

l = [[0]*N for _ in range(60)]

for i in range(60):
    for j in range(N):
        if i == 0:
            l[i][j] = A[j] - 1
        else:
            tmp = l[i-1][j]
            l[i][j] =l[i-1][tmp]
ans = -1
for i in range(59, -1, -1):
    if K >> i & 1:
        if ans == -1:
            ans = l[i][0]
        else:
            ans = l[i][ans]
print(ans+1)


Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= 1

reached = [0] * N

next = A[0]
cnt = 1
while not reached[next]:
    reached[next] = cnt
    next = A[next]
    cnt += 1

cnt2 = 1
start = next
#print("start:"+ str(start))
next = A[start]
while  start != next:
    cnt2 += 1
    next = A[next]

if K < cnt:
    #print("K<cnt")
    for i in range(N):
        if reached[i] == K:
            print(i+1)
elif K == cnt:
    #print("K==cnt")
    print(start+1)
elif K > cnt:
    #print("K > cnt")
    #print("K:"+str(K))
    #print("cnt:"+str(cnt))
    #print("cnt2:"+str(cnt2))
    tmp = K - cnt
    r = tmp % cnt2
    next = A[start]
    for i in range(r-1):
        next = A[next]
    if r == 0:
        print(start+1)
    else:
        print(next+1)

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

l = [[0]*N for _ in range(100)]

for i in range(100):
    for j in range(N):
        if i == 0:
            l[i][j] = A[j] - 1
        else:
            tmp = l[i-1][j]
            l[i][j] =l[i-1][tmp]
ans = -1
for i in range(99, -1, -1):
    if K >> i & 1:
        if ans == -1:
            ans = l[i][0]
        else:
            ans = l[i][ans]
print(ans+1)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= 1

reached = [0] * N

next = A[0]
cnt = 1
while not reached[next]:
    reached[next] = cnt
    next = A[next]
    cnt += 1

cnt2 = 1
start = next
#print("start:"+ str(start))
next = A[start]
while  start != next:
    cnt2 += 1
    next = A[next]

if K < cnt:
    #print("K<cnt")
    for i in range(N):
        if reached[i] == K:
            print(i+1)
elif K == cnt:
    #print("K==cnt")
    print(start+1)
elif K > cnt:
    #print("K > cnt")
    #print("K:"+str(K))
    #print("cnt:"+str(cnt))
    #print("cnt2:"+str(cnt2))
    tmp = K - cnt
    r = tmp % cnt2
    next = A[start]
    for i in range(r-1):
        next = A[next]
    if r == 0:
        print(start+1)
    else:
        print(next+1)
Buggy python submission (verdict: Runtime Error):


n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
i = 0
sumac = 0
sumwa = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and ac[p - 1] == 0:
        wa[p - 1] += 1
    elif s == "AC" and ac[p - 1] == 0:
        ac[p - 1] += 1
        sumac += 1
        sumwa += wa[p - 1]

print(str(int(ac)) + " " + str(int(wa)))

Fixed submission:
n, m = map(int, input().split())
ps = []
for i in range(m):
    p, s = input().split()
    ps.append([int(p), s])
flag = [False for _ in range(n)]
ac = [0 for _ in range(n)]
wa = [0 for _ in range(n)]
i = 0
sumac = 0
sumwa = 0

for i in range(m):
    p = ps[i][0]
    s = ps[i][1]
    if s == "WA" and ac[p - 1] == 0:
        wa[p - 1] += 1
    elif s == "AC" and ac[p - 1] == 0:
        ac[p - 1] += 1
        sumac += 1
        sumwa += wa[p - 1]

print(str(sumac) + " " + str(sumwa))
Buggy python submission (verdict: Runtime Error):
from collections import deque
h, w = map(int, input().split())

maze = [list(input()) for _ in range(h)]
#print(maze)
ans = 0
def solve(sx, sy):
    reached = [[0 for _ in range(w)] for _ in range(h)]
    d = deque()
    d.append([sx, sy])
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]    
    while d:
        x, y = d.popleft()
        for i in range(4):
            next_y = y + dy[i]
            next_x = x + dx[i]
            if next_x < 0 or next_x > h - 1 or next_y < 0 or next_y > w - 1:
                continue
            if maze[next_x][next_y] == "#":
                continue
            if reached[next_x][next_y] != 0:
                continue
            d.append([next_x, next_y])
            reached[next_x][next_y] = reached[x][y] + 1
    return max(reached)

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            res = solve(i, j)
            ans = max(ans, res)
print(ans)

Fixed submission:
from collections import deque
h, w = map(int, input().split())

maze = [list(input()) for _ in range(h)]
#print(maze)
ans = 0
def solve(sx, sy):
    INF = 1000000
    reached = [[INF for _ in range(w)] for _ in range(h)]
    reached[sx][sy] = 0
    d = deque()
    d.append([sx, sy])
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]    
    while d:
        x, y = d.popleft()
        for i in range(4):
            next_y = y + dy[i]
            next_x = x + dx[i]
            if next_x < 0 or next_x > h - 1 or next_y < 0 or next_y > w - 1:
                continue
            if maze[next_x][next_y] == "#":
                continue
            if reached[next_x][next_y] != INF:
                continue
            d.append([next_x, next_y])
            reached[next_x][next_y] = reached[x][y] + 1
    gl = 0
    for i in range(h):
        for j in range(w):
            if maze[i][j] == ".":
                gl = max(gl, reached[i][j])
    return gl

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            res = solve(i, j)
            ans = max(ans, res)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
M = 10**9+7
for i in range(60):
    x = 0
    for j in range(N):     
        if A[j]>>i & 1:
            x += 1
    now = x * (N - x) % M
    for j in range(i):
        now = now * 2 % M
    ans += now
    ans %= M
print(ans)


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

ans = 0
M = 10**9+7
for i in range(60):
    x = 0
    for j in range(N):     
        if A[j]>>i & 1:
            x += 1
    now = x * (N - x) % M
    for j in range(i):
        now = now * 2 % M
    ans += now
    ans %= M
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

# 集合を使う
shugo = set()
for i in range(N - 2):
    for j in range(i+1, N -1):
        for k in range(j + 1, N):
            shugo.add(S[i] + S[j] + S[k])
print(len(shugo))

Fixed submission:
N = int(input())
S = input()
flag = False
ans = 0
for i in range(1000):
    p = str(i).zfill(3)
    a = [-1, -1, -1]
    for j in range(len(S)):
        if p[0] == S[j]:
            a[0] = j
            break
    if a[0] != -1:
        for k in range(a[0] + 1, len(S)):
            if p[1] == S[k]:
                a[1] = k
                break
    else:
        continue
    if a[1] != -1:
        for l in range(a[1] + 1, len(S)):
            if p[2] == S[l]:
                a[2] = l
                break
    else:
        continue
    if a[2] != -1:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N = int(input())
S = input()

# 集合を使う
shugo = set()

keta = [i for i in range(N)]
r = N - 3

ncr = list(combinations(keta, r))

for i in ncr:
    s = ""
    for j in range(len(S)):
        if j in i:
            pass
        else:
            s += S[j]
    shugo.add(s)

print(len(shugo))

Fixed submission:
N = int(input())
S = input()
flag = False
ans = 0
for i in range(1000):
    p = str(i).zfill(3)
    a = [-1, -1, -1]
    for j in range(len(S)):
        if p[0] == S[j]:
            a[0] = j
            break
    if a[0] != -1:
        for k in range(a[0] + 1, len(S)):
            if p[1] == S[k]:
                a[1] = k
                break
    else:
        continue
    if a[1] != -1:
        for l in range(a[1] + 1, len(S)):
            if p[2] == S[l]:
                a[2] = l
                break
    else:
        continue
    if a[2] != -1:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N = int(input())
S = input()

# 集合を使う
shugo = set()

keta = [i for i in range(N)]
r = N - 3

ncr = list(combinations(keta, r))

for i in ncr:
    s = ""
    for j in range(len(S)):
        if j in i:
            pass
        else:
            s += S[j]
    shugo.add(s)

print(len(shugo))

Fixed submission:
N = int(input())
S = input()
flag = False
ans = 0
for i in range(1000):
    p = str(i).zfill(3)
    a = [-1, -1, -1]
    for j in range(len(S)):
        if p[0] == S[j]:
            a[0] = j
            break
    if a[0] != -1:
        for k in range(a[0] + 1, len(S)):
            if p[1] == S[k]:
                a[1] = k
                break
    else:
        continue
    if a[1] != -1:
        for l in range(a[1] + 1, len(S)):
            if p[2] == S[l]:
                a[2] = l
                break
    else:
        continue
    if a[2] != -1:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, X = map(int, input().split())
l = 0
r = 10**9+1


def keta(n):
    cnt = 0
    while n > 0:
        n //= 10
        cnt += 1
    return cnt

while r-l > 1:
    c = (l + r) // 2
    keta_c = keta(c)
    if A * c + B * keta_c <= X:
        l = c
    else:
        r = c

print(l)

Fixed submission:
S = input()

day = {"SUN":7, "MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}

print(day[S])
Buggy python submission (verdict: Runtime Error):
N = int(input())

def dfs(v, c, p):
    k = 1
    for _v, _id in V[v]:
        if _v == p:
            continue
        if k == c:
            k += 1
        C[_id] = k
        dfs(_v, k, v)
        k += 1

V = [[] for _ in range(N)]
C = [-1 for _ in range(N-1)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    V[a].append([b, i])
    V[b].append([a, i])

dfs(0, -1, -1)
print(max(C))
for i in range(N-1):
    print(C[i])

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N = int(input())

V = [[] for _ in range(N)]
C = [-1 for _ in range(N - 1)]


# v:頂点, c:色, p:親
def dfs(v, c, p):
    k = 1
    for _v, _id  in V[v]:
        if _v == p:
            continue
        if k == c:
            k += 1
        C[_id] = k
        dfs(_v, k, v)
        k += 1

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    V[a].append([b, i])
    V[b].append([a, i])
#print(V)
dfs(0, -1, -1)
print(max(C))
for i in C:
    print(i)

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

V = [[] for _ in range(N)]
C = [-1 for _ in range(N - 1)]


# v:頂点, c:色, p:親
def dfs(v, c, p):
    k = 1
    for _v, _id  in V[v]:
        if _v == p:
            continue
        if k == c:
            k += 1
        C[_id] = k
        dfs(_v, k, v)
        k += 1

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    V[a].append([b, i])
    V[b].append([a, i])
print(V)
dfs(0, -1, -1)
print(max(C))
for i in C:
    print(i)


Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N = int(input())

V = [[] for _ in range(N)]
C = [-1 for _ in range(N - 1)]


# v:頂点, c:色, p:親
def dfs(v, c, p):
    k = 1
    for _v, _id  in V[v]:
        if _v == p:
            continue
        if k == c:
            k += 1
        C[_id] = k
        dfs(_v, k, v)
        k += 1

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    V[a].append([b, i])
    V[b].append([a, i])
#print(V)
dfs(0, -1, -1)
print(max(C))
for i in C:
    print(i)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
a = 0
for i in range(X + 1):
    N = i
    if (X - N) % 2 != 0:
        continue
    M = (X - N) / 2
    
    x = N + 2 * M
    y = 2 * N + M
    if X == x and Y == y:
        a = N
#print(a)

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
if a != 0:
    ans = cmb(X-1,a,mod)
    print(ans)
else:
    print("0")

Fixed submission:
X, Y = map(int, input().split())
a = 0
b = 0
for i in range(X + 1):
    N = i
    if (X - N) % 2 != 0 and N != X:
        continue
    M = int((X - N) / 2)
    
    x = N + 2 * M
    y = 2 * N + M
    if X == x and Y == y:
        a = N
        b = M
#print(a)

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if a != 0 and b != 0:
    #print(a, b)
    ans = cmb(a + b,a) % (10**9+7)
    print(ans)
elif a == 0 and b != 0:
    print("1")
elif a != 0 and b == 0:
    print("1") 
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
S = input()
d = []
lt = 0
gt = 0
for i in range(len(S)):
    if i == 0:
        continue
    if S[i - 1]  == S[i] and S[i] == "<":
        lt += 1
    if S[i - 1] == S[i] and S[i] == ">":
        gt += 1
    if S[i - 1] != S[i] and S[i-1] == "<":
        d.append("<" * (lt + 1))
        lt = 0
    if S[i - 1] != S[i] and S[i - 1] == ">":
        d.append(">" * (gt + 1))
        gt = 0
    if i == len(S) - 1 and S[i] == "<":
        d.append("<" * (lt + 1))
    if i == len(S) - 1 and S[i] == ">":
        d.append(">" * (gt + 1))
    
print(d)
ans=0

if d[0][0] == "<":
    i = 0
    while i < len(d) - 1:
        if i != len(d) - 1:
            if len(d[i]) >= len(d[i + 1]):
                for i in range(1, len(d[i])+1):
                    ans += i
                for i in range(1, len(d)):
                    ans += i
                i += 2
            elif len(d[i]) < len(d[i + 1]):
                for i in range(1, len(d[i])+1):
                    ans += i
                for i in range(1, len(d)):
                    ans += i
                i+= 2
        elif i  == len(d) - 1:
            for i in range(1, len(d[i])+1):
                ans += i
                i += 1

if d[0][0] ==">":
    ans += (len(d[i]) + 1) * len(d[i]) / 2
    i = 1
    while i < len(d) - 1:
        if i != len(d) - 1:
            if len(d[i]) >= len(d[i + 1]):
                ans += (len(d[i]) + 1) * len(d[i]) / 2 + (len(d[i+1])) * len(d[i + 1]) / 2
                i += 2
            elif len(d[i]) < len(d[i + 1]):
                ans += (len(d[i])) * len(d[i]) / 2 + (len(d[i+1])+1) * len(d[i + 1]) / 2
                i += 2
        elif i  == len(d) - 1:
            ans +=  (len(d[i]) + 1) * len(d[i]) / 2

print(ans)
    

                

        
# min_d = 0
# for i in d:
#     min_d = min(min_d, d[i])

# d = list(map(lambda x: x + abs(min_d), d))

# if S[0] == "<":
#     d[0] = 0

# ans = 0
# for i in range(len(S)):
#     ans += d[i]
# print(d)
# print(ans)
            

Fixed submission:
S = input()
a = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == "<":
        a[i+1] = max(a[i+1], a[i] + 1)
for i in range(len(S)-1,-1,-1):
    if S[i] == ">":
        a[i] = max(a[i], a[i+1] + 1)
        
print(sum(a))
Buggy python submission (verdict: Runtime Error):
from math import atan, degrees
a, b, x = map(int, input().split())

#ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
if 0.5 * a ** 2 * b < x:
    ans = 90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x)))
else:
    ans = 90 - degrees(atan(2 * x / (a * b ** 2)))
print(ans)

Fixed submission:
from math import atan, degrees
a, b, x = map(int, input().split())

#ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
if a ** 2 * b == x:
    ans = 0
else:
    if 0.5 * a ** 2 * b < x:
        ans = 90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x)))
    else:
        ans = 90 - degrees(atan(2 * x / (a * b ** 2)))

print(ans)

Buggy python submission (verdict: Runtime Error):
from math import atan, degrees
a, b, x = map(int, input().split())

ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
print(ans)

Fixed submission:
from math import atan, degrees
a, b, x = map(int, input().split())

#ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
if a ** 2 * b == x:
    ans = 0
else:
    if 0.5 * a ** 2 * b < x:
        ans = 90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x)))
    else:
        ans = 90 - degrees(atan(2 * x / (a * b ** 2)))

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
d=[[0 for _ in range(100)] for _ in range(4)]
ans = [0,0,0,0]
l = len(S)
odd_diff = 0
even_diff = 0
if l == 1:
    ans = K // 2
    print(ans)
if l > 1:
    for i in range(4):
        s = S * (i + 1)
        l = len(s)
        for j in range(l-1):
            
            if j == 0 and s[j] == s[j+1]:
                ans[i] += 1
                d[i][0] = 1
            if j > 0 and s[j] == s[j+1] and d[i][j-1] == 0:
                ans[i] += 1
                d[i][j] = 1
    if K <= 4:
        print(ans[K-1])
    elif K > 4 and K % 2 == 0:
        even_diff = ans[3] - ans[1]
        print(int(ans[1]+(K/2)*even_diff))
    elif K > 4 and K % 2 == 1:
        odd_diff = ans[2] - ans[0]
        print(int(ans[0]+(K//2)*odd_diff))

Fixed submission:
S = input()
K = int(input())
d=[[0 for _ in range(400)] for _ in range(4)]
ans = [0,0,0,0]
l = len(S)
odd_diff = 0
even_diff = 0
if l == 1:
    print(int(K//2))
if l > 1:
    for i in range(4):
        s = S * (i + 1)
        l = len(s)
        for j in range(l-1):
            
            if j == 0 and s[j] == s[j+1]:
                ans[i] += 1
                d[i][0] = 1
            if j > 0 and s[j] == s[j+1] and d[i][j-1] == 0:
                ans[i] += 1
                d[i][j] = 1
    if K <= 4:
        print(int(ans[K-1]))
    elif K > 4 and K % 2 == 0:
        even_diff = ans[3] - ans[1]
        print(int(ans[1]+(K/2-1)*even_diff))
    elif K > 4 and K % 2 == 1:
        odd_diff = ans[2] - ans[0]
        print(int(ans[0]+(K//2)*odd_diff))

Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
d=[[0 for _ in range(100)] for _ in range(4)]
ans = [0,0,0,0]
l = len(S)
odd_diff = 0
even_diff = 0
if l == 1:
    ans = K // 2
    print(ans)
if l > 1:
    for i in range(4):
        s = S * (i + 1)
        l = len(s)
        for j in range(l-1):
            
            if j == 0 and s[j] == s[j+1]:
                ans[i] += 1
                d[i][0] = 1
            if j > 0 and s[j] == s[j+1] and d[i][j-1] == 0:
                ans[i] += 1
                d[i][j] = 1
    if K <= 4:
        print(ans[K-1])
    elif K > 4 and K % 2 == 0:
        even_diff = ans[3] - ans[1]
        print(ans[1]+(K/2)*even_diff)
    elif K > 4 and K % 2 == 1:
        odd_diff = ans[2] - ans[0]
        print(ans[0]+(K//2)*odd_diff)

Fixed submission:
S = input()
K = int(input())
d=[[0 for _ in range(400)] for _ in range(4)]
ans = [0,0,0,0]
l = len(S)
odd_diff = 0
even_diff = 0
if l == 1:
    print(int(K//2))
if l > 1:
    for i in range(4):
        s = S * (i + 1)
        l = len(s)
        for j in range(l-1):
            
            if j == 0 and s[j] == s[j+1]:
                ans[i] += 1
                d[i][0] = 1
            if j > 0 and s[j] == s[j+1] and d[i][j-1] == 0:
                ans[i] += 1
                d[i][j] = 1
    if K <= 4:
        print(int(ans[K-1]))
    elif K > 4 and K % 2 == 0:
        even_diff = ans[3] - ans[1]
        print(int(ans[1]+(K/2-1)*even_diff))
    elif K > 4 and K % 2 == 1:
        odd_diff = ans[2] - ans[0]
        print(int(ans[0]+(K//2)*odd_diff))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
T = []
for i in range(1,N+1):
    T.append(str(A.index(i)+1))
print(" ".join(T))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
T = [0 for i in range(N)]
for i in range(N):
    T[A[i] - 1] = str(i + 1)
print(" ".join(T))
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0
for i in range(3):
    if s[i] == t[i]:
        ans += 1
print(ans)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))

tmp = 0
cnt = 0
i = 0
while tmp <= x and i <= len(l):
    d = tmp + l[i]
    tmp = d
    cnt += 1
    i += 1

print(cnt)

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

d = []
d.append(0)
for i in range(n):
    d.append(d[i]+l[i])
ans = 0
for i in d:
    if i <= x:
        ans += 1

print(ans)

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

tmp = 0
cnt = 0
i = 0
while tmp <= x:
    d = tmp + l[i]
    tmp = d
    cnt += 1
    i += 1

print(cnt)

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

d = []
d.append(0)
for i in range(n):
    d.append(d[i]+l[i])
ans = 0
for i in d:
    if i <= x:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
MOD = 10 ** 9 + 7
dp = [0 for _ in range(N)]
for _ in range(M):
    a = int(input())
    a -= 1
    dp[a] = -1
if dp[0] == 0:
    dp[0] = 1
if dp[1] == 0:
    if dp[0] == 1:
        dp[1] = 2
    else:
        dp[1] = 1

for i in range(2, N):
    if dp[i] != -1:
        if dp[i-1] != -1:
            dp[i] += dp[i-1]
        if dp[i-2] != -1:
            dp[i] += dp[i-2]
print(dp[N-1] % MOD)

Fixed submission:
N, M = map(int, input().split())
MOD = 10 ** 9 + 7
dp = [0 for _ in range(N+1)]
for _ in range(M):
    a = int(input())
    dp[a] = -1
dp[0] = 1
if dp[1] == 0:
    dp[1] = 1

for i in range(2, N+1):
    if dp[i] != -1:
        if dp[i-1] != -1:
            dp[i] += dp[i-1]
        if dp[i-2] != -1:
            dp[i] += dp[i-2]

print(dp[N] % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = 10 ** 9
dp = [INF]*N
dp[0] = 0
for i in range(N):
    for j in range(K):
        target=i+j+1
        if target < N:
            tmp = dp[i] + abs(H[i]-H[target])
            dp[target] = min(dp[target], tmp)
print(dp[N-1])

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = 10 ** 9
dp = [INF]*N
dp[0] = 0
for i in range(N):
    for j in range(K):
        target=i+j+1
        if target < N:
            tmp = dp[i] + abs(H[i]-H[target])
            dp[target] = min(dp[target], tmp)
print(dp[N-1])