Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
A, B, Q = [int(a) for a in input().split(" ")]
S = sorted([int(input()) for i in range(A)])
T = sorted([int(input()) for i in range(B)])
X = [int(input()) for i in range(Q)]
INF = float("inf")

def search(arr, x):
    l, r = (0, len(arr))
    while r-l>1:
        med = (l+r)//2
        if arr[med] == x:
            return med
        l, r = (l, med) if x<arr[med] else (med+1, r)
    return l

for x in X:
    s1 = min(search(S, x), len(S)-1)
    t1 = min(search(T, x), len(T)-1)
    ss, ts = None, None
    
    if S[s1]==x:
        ss = (0, 0)
    elif s1==0 and x<S[s1]:
        ss = (INF, abs(S[s1]-x))
    elif s1==len(S)-1 and S[s1]<x:
        ss = (abs(S[s1]-x), INF)
    elif S[s1]<x:
        ss = (abs(S[s1]-x), abs(S[s1+1]-x))
    else:
        ss = (abs(S[s1-1]-x), abs(S[s1]-x))
    
    if T[t1]==x:
        ts = (0, 0)
    elif t1==0 and x<T[t1]:
        ts = (INF, abs(T[t1]-x))
    elif t1==len(T)-1 and T[t1]<x:
        ts = (abs(T[t1]-x), INF)
    elif T[t1]<x:
        ts = (abs(T[t1]-x), abs(T[t1+1]-x))
    else:
        ts = (abs(T[t1-1]-x), abs(T[t1]-x))

    ans = min([max(ss[0], ts[0]), max(ss[1], ts[1]),
               2*ss[0]+ts[1], 2*ss[1]+ts[0], ss[0]+2*ts[1], ss[1]+2*ts[0]])
    print(ans)


Fixed submission:
A, B, Q = [int(a) for a in input().split(" ")]
S = sorted([int(input()) for i in range(A)])
T = sorted([int(input()) for i in range(B)])
X = [int(input()) for i in range(Q)]
INF = float("inf")

def search(arr, x):
    l, r = (0, len(arr))
    while r-l>1:
        med = (l+r)//2
        if arr[med] == x:
            return med
        l, r = (l, med) if x<arr[med] else (med+1, r)
    return l

for x in X:
    s1 = min(search(S, x), len(S)-1)
    t1 = min(search(T, x), len(T)-1)
    ss, ts = None, None
    
    if S[s1]==x:
        ss = (0, 0)
    elif s1==0 and x<S[s1]:
        ss = (INF, abs(S[s1]-x))
    elif s1==len(S)-1 and S[s1]<x:
        ss = (abs(S[s1]-x), INF)
    elif S[s1]<x:
        ss = (abs(S[s1]-x), abs(S[s1+1]-x))
    else:
        ss = (abs(S[s1-1]-x), abs(S[s1]-x))
    
    if T[t1]==x:
        ts = (0, 0)
    elif t1==0 and x<T[t1]:
        ts = (INF, abs(T[t1]-x))
    elif t1==len(T)-1 and T[t1]<x:
        ts = (abs(T[t1]-x), INF)
    elif T[t1]<x:
        ts = (abs(T[t1]-x), abs(T[t1+1]-x))
    else:
        ts = (abs(T[t1-1]-x), abs(T[t1]-x))

    ans = min([max(ss[0], ts[0]), max(ss[1], ts[1]),
               2*ss[0]+ts[1], 2*ss[1]+ts[0], ss[0]+2*ts[1], ss[1]+2*ts[0]])
    print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = [int(a) for a in input().split(" ")]
X = sorted([int(a) for a in input().split(" ")])
intervals = [a-b for a, b in zip(X[1:], X[:-1])]
prev, curr = [0]*(M-1), [0]*(M-1)

if M==1:
    print(0)
else:
    maxv = 0
    for i in range(M-1):
        maxv = max(intervals[i], maxv)
        prev[i] = maxv

    for i in range(N-2):
        curr[i+1] = -10**10
        for j in range(i+2, M-1):
            curr[j] = max(prev[j-2]+intervals[j], curr[j-1])
        prev, curr = curr, prev
    print(sum(intervals)-prev[-1])

Fixed submission:
N, M = [int(a) for a in input().split(" ")]
X = sorted([int(a) for a in input().split(" ")])
intervals = sorted([a-b for a, b in zip(X[1:], X[:-1])])[::-1]
if M > N:
    print(sum(intervals) - sum(intervals[:N-1]))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
S, T=input(), input()
dic = {}
for i in range(len(S)):
    s, t = S[i], T[i]
    if s!=t:
        S=S.replace(s, "*")
        S=S.replace(t, s)
        S=S.replace("*", t)
    if S[:i] != T[:i]:
        print("No")
        exit()
print("Yes")


Fixed submission:
S, T=input(), input()
src, trg = {}, {}
for i in range(len(S)):
    s, t = S[i], T[i]
    if (s in src and src[s] != t) or (t in trg and trg[t] != s):
        print("No")
        exit()
    src[s] = t
    trg[t] = s
print("Yes")
Buggy python submission (verdict: Runtime Error):
N,I=[int(a) for a in input().split(" ")]
print(N-i+1)

Fixed submission:
N,I=[int(a) for a in input().split(" ")]
print(N-I+1)
Buggy python submission (verdict: Runtime Error):
A,B=[int(a) for input().split(" ")]
print((A-1)*(B-1))

Fixed submission:
A,B=[int(a) for a in input().split(" ")]
print((A-1)*(B-1))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
print(0)
S0 = input()[0]
if S0=="V":exit()
print(N-1)
if input()[0]=="V":exit()

r,l=0,N-1
while r-l>1:
    med=(r+l)//2
    print(med)
    S1=input()[0]
    if S1=="V":
        exit()
    elif (med%2==0 and S1==S0) or (med%2==1 and S1!=S0):
        r=med
    else:
        l=med
print(r)


Fixed submission:
N=int(input())
print(0)
S0 = input()[0]
if S0=="V":exit()
print(N-1)
if input()[0]=="V":exit()

l,r=0,N-1
while r-l>1:
    med=(r+l)//2
    print(med)
    S1=input()[0]
    if S1=="V":
        exit()
    elif (med%2==0 and S1==S0) or (med%2==1 and S1!=S0):
        l=med
    else:
        r=med
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
print(0)
S0 = input()[0]
if S0=="V":exit()
print(N-1)
if input()[0]=="V":exit()

r,l=0,N-1
while r-l>1:
    med=(r+l)//2
    print(med)
    S1=input()[0]
    if S1=="V":
        exit()
    elif (med%2==0 and S1==S0) or (med%2==1 and S1!=S0):
        r=med
    else:
        l=med
print(l)


Fixed submission:
N=int(input())
print(0)
S0 = input()[0]
if S0=="V":exit()
print(N-1)
if input()[0]=="V":exit()

l,r=0,N-1
while r-l>1:
    med=(r+l)//2
    print(med)
    S1=input()[0]
    if S1=="V":
        exit()
    elif (med%2==0 and S1==S0) or (med%2==1 and S1!=S0):
        l=med
    else:
        r=med
print(r)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000)

N,M=[int(a) for a in input().split()]
AB=[[int(a) for a in input().split()] for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

visited = [False]*N
WH = [None]*N

def dfs(curr, is_white):
    if visited[curr]:
        return WH[curr]^is_white
    WH[curr] = is_white
    visited[curr] = True
    ans = False
    for node in edges[curr]:
        ans |= dfs(node, not is_white)
    return ans

if dfs(0, True):
    print((N*(N-1))//2 - M)
else:
    nw = sum(WH)
    print(nw*(N-nw)-sum([WH[a-1]^WH[b-1] for a, b in AB]))


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N,M=[int(a) for a in input().split()]
AB=[[int(a) for a in input().split()] for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

colors = [0]*N
def dfs(curr, c):
    colors[curr] = c
    for node in edges[curr]:
        if colors[node] == colors[curr]:
            return False
        if colors[node]== 0 and not dfs(node, -c):
            return False
    return True

if not dfs(0, 1):
    print((N*(N-1))//2 - M)
else:
    WH = [c==1 for c in colors]
    nw = sum(WH)
    print(nw*(N-nw)-sum([WH[a-1]^WH[b-1] for a, b in AB]))

Buggy python submission (verdict: Runtime Error):
N,M=[int(a) for a in input().split()]
AB=[[int(a) for a in input().split()] for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

visited = [False]*N
WH = [None]*N

def dfs(curr, is_white):
    if visited[curr]:
        return WH[curr]^is_white
    WH[curr] = is_white
    visited[curr] = True
    ans = False
    for node in edges[curr]:
        ans |= dfs(node, not is_white)
    return ans

if dfs(0, True):
    print((N*(N-1))//2 - M)
else:
    nw = sum(WH)
    print(nw*(N-nw)-sum([WH[a-1]^WH[b-1] for a, b in AB]))

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N,M=[int(a) for a in input().split()]
AB=[[int(a) for a in input().split()] for _ in range(M)]
edges = [[] for _ in range(N)]
for a, b in AB:
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

colors = [0]*N
def dfs(curr, c):
    colors[curr] = c
    for node in edges[curr]:
        if colors[node] == colors[curr]:
            return False
        if colors[node]== 0 and not dfs(node, -c):
            return False
    return True

if not dfs(0, 1):
    print((N*(N-1))//2 - M)
else:
    WH = [c==1 for c in colors]
    nw = sum(WH)
    print(nw*(N-nw)-sum([WH[a-1]^WH[b-1] for a, b in AB]))
Buggy python submission (verdict: Runtime Error):
N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]
paths=paths[::-1]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")

Buggy python submission (verdict: Runtime Error):
N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]
paths=paths[::-1]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)
ans=None

if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    A=max_
    y=len([a for a in A if a==max_])
    x=N-y
    nc=A-x
    ans=(A-x)>0 and y >=2*(A-x)
else:
    ans=N>=2*min_ or min_+1==N

print("Yes" if ans else "No")


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
min_,max_=min(A),max(A)

def f(n,k):
    return n%k==0 if k>0 else False

ans=None
if max_-min_ > 1:
    ans=False
elif max_-min_ == 1:
    k=max_
    nk=len([a for a in A if a==max_])
    nk1=N-nk
    ans=f(nk,k-nk1)
else:
    ans=f(N,min_) or f(N,min_+1)

if ans is True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
from heapq import heapreplace, heapify
N=int(input())
A=np.array([int(a) for a in input().split(" ")])
lheap, rheap = list(A[:N]), list(-A[2*N:])
heapify(lheap)
heapify(rheap)
Lsum, Rsum = sum(lheap), sum(rheap)
left = [Lsum]
right = [Rsum]

for i in range(N):
    if A[N+i] > lheap[0]:
        Lsum += (A[N+i]-lheap[0])
        heapreplace(lheap, A[N+i])
    
    if -A[2*N-i-1] > rheap[0]:
        Rsum += (-A[2*N-i-1]-rheap[0])
        heapreplace(rheap, -A[2*N-i-1])
    
    left.append(Lsum)
    right.append(Rsum)
print(max(np.array(left)+np.array(right)[::-1]))

Fixed submission:
import numpy as np
from heapq import heapreplace, heapify
N=int(input())
A=np.array([int(a) for a in input().split(" ")])
lheap, rheap = list(A[:N]), list(-A[2*N:])
heapify(lheap)
heapify(rheap)
Lsum, Rsum = sum(lheap), sum(rheap)
left = [Lsum]
right = [Rsum]

for i in range(N):
    if A[N+i] > lheap[0]:
        Lsum += (A[N+i]-lheap[0])
        heapreplace(lheap, A[N+i])
    
    if -A[2*N-i-1] > rheap[0]:
        Rsum += (-A[2*N-i-1]-rheap[0])
        heapreplace(rheap, -A[2*N-i-1])
    
    left.append(Lsum)
    right.append(Rsum)
print(max(np.array(left)+np.array(right)[::-1]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
       a〔int(input())〕=i
print(a)
       


Fixed submission:
import math
n=int(input())
print(math.ceil(n/2)/n)

Buggy python submission (verdict: Runtime Error):
n=int(input())
print(math.ceil(n/2)/n)

Fixed submission:
import math
n=int(input())
print(math.ceil(n/2)/n)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[0]*n
for i in range(n):
       a[int(input())]=i+1
print(a)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
  ans[A[i]-1]=i+1
print(*ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
       a〔int(input())〕=i+ 1
print(a)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
  ans[A[i]-1]=i+1
print(*ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
a.append(0)
a.insert(0,0)
print(a)

Fixed submission:
A,B,C,D=[int(input()) for i in range(4)]
print(min(A,B)+min(C,D))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
print(a)

Fixed submission:
A,B,C,D=[int(input()) for i in range(4)]
print(min(A,B)+min(C,D))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(3):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(3):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Fixed submission:
A,B,C,D=[int(input()) for i in range(4)]
print(min(A,B)+min(C,D))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp


Fixed submission:
A,B,C,D=[int(input()) for i in range(4)]
print(min(A,B)+min(C,D))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
print(a)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)

for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
tmp=0
ans=0
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for j in range(n):
    ans=cost+abs(a[j]-a[j+2])-abs(a[j+1]-a[j])-abs(a[j+1]-a[j+2])
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cost=abs(a[n-1])
a.append(0)
a.insert(0,0)
for i in range(n):
    tmp=abs(a[i]-a[i+1])
    cost+=tmp
for i in range(n):
    ans=cost+abs(a[i]-a[i+2])-abs(a[i+1]-a[i])-abs(a[i+1]-a[i+2])
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(input().split())
B = []
 
for x in range(1,N+1):
    B.append(A.index(str(x)) + 1)
print(*B)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N +1)

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

print(*B[1:])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = tuple(input().split())
B = []

for x in range(1,N+1):
    m = A.index(str(x)) + 1
    B.append(str(m))
print(" ".join(B))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N +1)

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

print(*B[1:])

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

for x in range(1,N+1):
    m = A.index(x) + 1
    B.append(str(m))
print(" ".join(B))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N +1)

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

print(*B[1:])

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

for x in range(1,N+1):
    m = A.index(x) + 1
    B.append(m)
print(*B)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0] * (N +1)

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

print(*B[1:])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

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

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


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

N = int(input())

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

B = [0 for _ in range(N)]
i = 1

for x in A:
    B[x - 1] = i
    i += 1

print(' '.join(map(str, B)))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N, K, Q = map(int, input().split())

A = []
for _ in range(Q):
    A.append(int(input()))

part = []
for _ in range(N):
    part.append(K)

for ans in A:
    for i in range(N):
        part[i] -= 1

    part[ans - 1] += 1

for x in part:
    if x <= 0:
        print('No')
    else:
        print('Yes')


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

N, K, Q = map(int, input().split())

part = [K - Q for _ in range(N)]

for _ in range(Q):
    part[int(input()) - 1] += 1

for x in part:
    if x <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

ans = 0
for y in range(1, N):
    ans += y

print(ans)


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

N = int(input())

ans = ((N + 1) * N) // 2
ans -= N

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N = int(input())

power = 1

for x in range(1, N + 1):
    power *= x

mod = 10 ** 9
mod += 7

answer = power % mod
print(answer)


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

import math

N = int(input())

power = 1

mod = 10 ** 9
mod += 7

power = math.factorial(N)

print(power % mod)
Buggy python submission (verdict: Runtime Error):
k = int(input())
print(k**k

Fixed submission:
k = int(input())
print(k**3)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd as bltin_gcd


def coprime2(a, b):
    return bltin_gcd(a, b) == 1


def cf(x1,x2):
    cf = [1]
    for i in range(2, min(x1, x2) + 1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf


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

# 公約数
divisor_list = cf(A, B)

# print(divisor_list)

counts = []
for i in divisor_list:
    if i == 1:
        continue

    other_list = list(filter(lambda x: x != i, divisor_list))

    count = 0
    nums = []
    for j in other_list:
        if coprime2(i, j):
            for n in nums:
                if not coprime2(j, n):
                    break
            else:
                nums.append(j)
                count = count + 1

    counts.append(count)

if not counts:
    print(1)
else:
    print(max(counts) + 1)

Fixed submission:
d = {
    'Sunny': 'Cloudy',
    'Cloudy': 'Rainy',
    'Rainy': 'Sunny'
}

i = input()

print(d[i])

Buggy python submission (verdict: Runtime Error):
n, k, q = map(int, input().split())

adict = {i + 1: k for i in range(n)}

answer = [int(input()) for _ in range(q)]

for k, v in adict.items():
    adict[k] = v - (q - answer.count(k))

    if adict[k] > 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
d = {
    'Sunny': 'Cloudy',
    'Cloudy': 'Rainy',
    'Rainy': 'Sunny'
}

i = input()

print(d[i])
Buggy python submission (verdict: Runtime Error):
W,H = map(int, input().split())
pic = [input().split() for i in range(H)]
for i in range(H):
  print(''.join(pic[i]))
  print(''.join(pic[i]))

Fixed submission:
H,W = map(int,input().split())
pic = [input().split() for i in range(H)]
for i in range(H):
  print(''.join(pic[i]))
  print(''.join(pic[i]))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
n = 0
for i in range(a,b+1):
  if i % x == 0:
    n += 1
  else:
    pass
print(n)

Fixed submission:
import math
a,b,x = map(int,input().split())
def f(p):
  if p >= 0:
    return p//x + 1
  else:
    return 0
print(f(b)-f(a-1))

Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
n = 0
for i in range(a,b+1):
  if x % i == 0:
    n += 1
  else:
    pass
print(n)

Fixed submission:
import math
a,b,x = map(int,input().split())
def f(p):
  if p >= 0:
    return p//x + 1
  else:
    return 0
print(f(b)-f(a-1))