Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
a = list(input())
x = [[0] * n for j in range(n)]
for i in range(n):
    x[0][i] = int(a[i])
cnt = n
for i in range(1,n):
    cnt -= 1
    for j in range(cnt):
        x[i][j] = abs(x[i-1][j] - x[i-1][j+1])
print(x[n-1][0])

### FIXED CODE ###

def Lucas(n, k):
    if n&k == k:
        return 1
    else:
        return 0

n = int(input())
a = list(map(int, list(input())))
odd = 0
cnt = 0
for i in range(n):
    a[i] -= 1
    if a[i] == 1:
        odd += Lucas(n-1, i)
        cnt = 1
if odd % 2 == 1:
    print(1)
else:
    if cnt == 1:
        print(0)
    else:
        for i in range(n):
            a[i] //= 2
            if a[i] == 1:
                odd += Lucas(n-1, i)
        print(odd%2 * 2)
### BUGGY CODE ###

from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
B = [BC[k][0] for k in range(M)]
C = [BC[k][1] for k in range(M)]
A.sort()
BC.sort(key=lambda x: x[1], reverse=True)
for i in range(M):
    index = min(len([x for x in A if x < BC[i][1]]), BC[i][0])
    A = [BC[i][1]] * index + A[index:]
    A.sort()

print(sum(A))


### FIXED CODE ###

from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
BC.sort(key=lambda x: x[1], reverse=True)
for i in range(M):
    A.extend([BC[i][1]] * BC[i][0])
    if len(A) >= 2 * N:
        break

A.sort(reverse=True)
print(sum(A[:N]))
### BUGGY CODE ###

MOD = 1e9 + 7
N = int(input())
A = list(map(int, input().split()))
c = 0
for i in range(N):
    for j in range(i + 1, N):
        if i == j:
            continue
        c += (A[i] % MOD) * (A[j] % MOD)
        c %= MOD
print(int(c))

### FIXED CODE ###

MOD = 1000000007
N = int(input())
A = list(map(int, input().split()))
c = 0
S = 0
for a in A:
  S += a % MOD
  S %= MOD
for i in range(N):
    c += (A[i] % MOD) * ((S - A[i] % MOD) % MOD)
    c %= MOD
mod = pow(2, -1, 1000000007)
c = c * mod
c %= MOD
print(int(c))
### BUGGY CODE ###

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

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, reverse=True)
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * len(walkers)
import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    #print(left, right)
    ans = ans[:left] + [x] * (right-left) + ans[right:]
    #for i in range(left, right):
    #    #print(i)
    #    ans[i] = x
    
#print(walkers)
for a in ans:
    print(a)
    




    
    


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
### BUGGY CODE ###

s=input()
t=input()
L=[ [0]*(len(t)+1) for _ in range(len(s)+1) ]

def lcs(s,t):
    n=len(s)
    m=len(t)
    for i in range(0,n+1):
        for j in range(0,m+1):
            if i==0 or j==0:
                L[i][j]=0
            elif s[i-1]==t[j-1]:
                L[i][j]=L[i-1][j-1]+1
            else :
                L[i][j]=max(L[i-1][j],L[i][j-1])
lcs(s,t)
ans=[]
i=len(s)
j=len(t)
while L[i][j]!=0:
    if L[i][j]!=L[i-1][j] or L[i][j]!=L[i][j-1]:
        ans.append(s[i-1])
        i-=1
        j-=1
    else :
        if L[i][j]==L[i-1][j]:
            i-=1
            continue
        else :
            j-=1
            continue
print(''.join(ans[::-1]))

### FIXED CODE ###

"Template made by : https://codeforces.com/profile/c1729 , github repo : https://github.com/cheran-senthil/PyRival"
from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register

if sys.version_info[0] < 3:
    from io import BytesIO as stream
else:
    from io import StringIO as stream


if sys.version_info[0] < 3:
    class dict(dict):
        """dict() -> new empty dictionary"""
        def items(self):
            """D.items() -> a set-like object providing a view on D's items"""
            return dict.iteritems(self)

        def keys(self):
            """D.keys() -> a set-like object providing a view on D's keys"""
            return dict.iterkeys(self)

        def values(self):
            """D.values() -> an object providing a view on D's values"""
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip


def sync_with_stdio(sync=True):
    """Set whether the standard Python streams are allowed to buffer their I/O.

    Args:
        sync (bool, optional): The new synchronization setting.

    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    s=input()
    t=input()
    L=[ [0]*(len(t)+1) for _ in range(len(s)+1) ]
    
    def lcs(s,t):
        n=len(s)
        m=len(t)
        for i in range(0,n+1):
            for j in range(0,m+1):
                if i==0 or j==0:
                    L[i][j]=0
                elif s[i-1]==t[j-1]:
                    L[i][j]=L[i-1][j-1]+1
                else :
                    L[i][j]=max(L[i-1][j],L[i][j-1])
    lcs(s,t)
    ans=[]
    i=len(s)
    j=len(t)
    while L[i][j]!=0:
        if L[i][j]!=L[i-1][j] and L[i][j]!=L[i][j-1]:
            ans.append(s[i-1])
            i-=1
            j-=1
        else :
            if L[i][j]==L[i-1][j]:
                i-=1
                continue
            else :
                j-=1
                continue
    print(''.join(ans[::-1]))
if __name__ == '__main__':
    sync_with_stdio(False)
    main()
### BUGGY CODE ###

n=int(input())
ds=[int(s)for s in input().split(" ")]
m=int(input())
ts=[int(s)for s in input().split(" ")]
f=True
for t in ts:
    if t not in ds:
        print("NO")
        f=False
        break
    else:ds.pop(ds.index(t))
if f:print("YES")

### FIXED CODE ###

n=int(input())
dic={}
ds=[int(s)for s in input().split(" ")]
for d in ds:
    if d in dic:dic[d]+=1
    else:dic[d]=1
m=int(input())
ts=sorted([int(s)for s in input().split(" ")])
f=True
for t in ts:
    if t not in dic or dic[t]==0:
        print("NO")
        f=False
        break
    else:dic[t]-=1
if f:print("YES")
### BUGGY CODE ###

from collections import deque
H, W = map(int, input().split())
G = [list(input()) for i in range(H)]

black = 0
for g in G:
    black += g.count("#")


que = deque()
que.append([0, 0, 0])
direction = [(0, 1), (0, -1), (1, 0), (-1, 0)]

while que:
    nh, nw, cost = que.pop()
    G[nh][nw] = cost
    if (nh == H - 1) & (nw == W - 1):
        print(H * W - black - int(G[H - 1][W - 1]) - 1)
        break

    for dh, dw in direction:
        if (0 <= nh + dh < H) & (0 <= nw + dw < W):
            if G[nh + dh][nw + dw] == ".":
                que.appendleft((nh + dh, nw + dw, cost + 1))
else:
    print(-1)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
Field = [list(input()) for i in range(H)]

que = deque()
que.append([0, 0])
Field[0][0] = 0

while que:
    now = que.popleft()
    if now == [H-1, W-1]:
        break

    if now[0]+1 <= H -1:
        if Field[now[0]+1][now[1]] == ".":
            Field[now[0]+1][now[1]] = str(int(Field[now[0]][now[1]])+1)
            que.append([now[0]+1, now[1]])

    if now[0]-1 >= 0:
        if Field[now[0]-1][now[1]] == ".":
            Field[now[0]-1][now[1]] = str(int(Field[now[0]][now[1]])+1)
            que.append([now[0]-1, now[1]])

    if now[1] + 1 <= W -1:
        if Field[now[0]][now[1]+1] == ".":
            Field[now[0]][now[1]+1] = str(int(Field[now[0]][now[1]])+1)
            que.append([now[0], now[1]+1])

    if now[1] -1 >= 0:
        if Field[now[0]][now[1]-1] == ".":
            Field[now[0]][now[1]-1] = str(int(Field[now[0]][now[1]])+1)
            que.append([now[0], now[1]-1])
else:
    print(-1)
    exit()
Z = int(Field[H-1][W-1])

sharp_cnt = 0
for f in Field:
    sharp_cnt += f.count("#")

print(H*W - sharp_cnt - Z - 1)
### BUGGY CODE ###

#6
N = int(input())
S =list(str(input()))
a=[]
for i in range(N-2):
    for u in range(i+1,N-1):
        for y in range(u+1,N):
            a.append(S[i]+S[u]+S[y])
print(len(set(a)))

### FIXED CODE ###

N = int(input())
S =list(str(input()))
a=[]
ans=0
for i in range(10):
    for u in range(10):
        for y in range(10):
            moji=[str(i),str(u),str(y)]
            ti=0
            for t in range(N):
                if S[t]==moji[ti]:
                    ti+=1
                    if ti==3:
                        break
            if ti==3:
                ans+=1
                            
                
print(ans)
### BUGGY CODE ###

n = input()
for k in xrange(n):
    str1 = raw_input()
    str2 = raw_input()
    
    after = [0] * (len(str2) + 1)
    
    for i in xrange(1, len(str1) + 1):
        before = after + []
        for j in xrange(1, len(str2) + 1):
            if str1[i - 1] == str2[j - 1]:
                after[j] = before[j - 1] + 1
            else:
                after[j] = max(before[j], after[j - 1])
    print after[j]

### FIXED CODE ###

def LCS():
    str1 = raw_input()
    str2 = raw_input()
    
    after = [0] * (len(str2) + 1)
    
    for i in xrange(1, len(str1) + 1):
        before = after + []
        for j in xrange(1, len(str2) + 1):
             if str1[i - 1] == str2[j - 1]:
                 after[j] = before[j - 1] + 1
             elif after[j - 1] > before[j]: #this is equal to 'max(after[j - 1], before[j])'
                 after[j] = after[j - 1]
    return after[j]

n = input()
for k in xrange(n):
    print LCS()
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
res=1
for a in A:
    res*=a
    if res>10**18:
        res=-1
    
print(res if res>=0 else -1)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
res=1
for a in A:
    res*=a
    if res>10**18:
        res=-1
        break
print(0 if 0 in A else res)
### BUGGY CODE ###

import numpy as np
N = int(input())

x = np.array(list(map(int,input().split())))

for i in range(len(x)):
    print (np.argsort(x)[i]+1,"",end="")

### FIXED CODE ###

import numpy as np
N = int(input())

x = np.array(list(map(int,input().split())),dtype=np.int)

print (*np.argsort(x)+1)
### BUGGY CODE ###

#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    n, W = readi(2)
    ws, vs = zip(*readi(n, 2))
    dp = arr(n + 1, W + 1)
    for i in range(n):
        for w in range(W + 1):
            if w - ws[i] >= 0:
                dp[i + 1][w] = max(dp[i + 1][w], dp[i][w - ws[i]] + vs[i])
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w])
    print(dp[n][W])


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    n, W = readi(2)
    ws, vs = zip(*readi(n, 2))
    dp = arr(n + 1, W + 1)
    for i in range(n):
        for w in range(W + 1):
            if w - ws[i] >= 0:
                dp[i + 1][w] = max(dp[i + 1][w], dp[i][w - ws[i]] + vs[i])
            dp[i + 1][w] = max(dp[i + 1][w], dp[i][w])
    print(dp[n][W])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import numpy as np
n, k, q = map(int, input().split())

score = np.full(n, k)

for _ in range(q):
    a = int(input())
    mask = np.ones(n, dtype=bool)
    mask[a-1] = False
    score[mask] = score[mask] - 1
    
for s in score:
    if s <= 0:
        print("No")
    else :
        print("Yes")

### FIXED CODE ###

n, k, q = map(int, input().split())

score = [0] * n

for _ in range(q):
    a = int(input())
    score[a-1] +=1
    
s = sum(score)
for i in range(n):
    if k - (s-score[i]) <= 0:
        print("No")
    else :
        print("Yes")
### BUGGY CODE ###

N, A, B = map(int, input().split(' '))
blue = ''
red = ''
count = int(N / (A + B))

for i in range(A):
    blue = blue + 'b'
for i in range(B):
    red = red + 'r'
one_roop = blue + red
string = ''
for i in range(count):
    string = string + one_roop

if N % (A + B) != 0:
    string = string + one_roop[0:N % (A + B)]

print(string.count('b'))

### FIXED CODE ###

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

count = int(N / (A + B))
blue_balls = count * A

if N % (A + B) != 0:
    if N % (A + B) > A:
        blue_balls += A
    else:
        blue_balls += N % (A + B)

print(blue_balls)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))

a.sort()

ans = 0

for i in range(n):
    ai = a[i]

    if i != n-1:
        if ai == a[i+1]:
            continue

    if i != 0:
        if ai == a[i-1]:
            continue

    for j in range(i):
        aj = a[j]

        if aj*2 > ai:
            ans += 1
            break

        if ai % a[j] == 0:
            break
    else:
        ans += 1



print(ans)

### FIXED CODE ###

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

LIST=[0]*(10**6+1)

for a in A:
    LIST[a]+=1
ANS=0

for i in range(10**6+1):
    if LIST[i]==1:
        ANS+=1
    if LIST[i]!=0:
        for j in range(2*i,10**6+1,i):
            if LIST[j]!=0:
                LIST[j]+=1
print(ANS)
### BUGGY CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
if n <= k:
    print(0)
else:
    for i in range(k):
        l.pop(0)
    print(sum(l))

### FIXED CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
if n <= k:
    print(0)
else:
    print(sum(l[k:]))
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()
for i in range(Q):
    a,b = map(int,input().split())
    print(S[a-1:b].count("AC"))

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
p = [0]*(N)
a = 0
for i in range(-1,N-2):
    if S[i+1] == "A" and S[i+2]=="C":
        a+=1
    p[i+2]=a
#print(p)
for i in range(Q):
    a,b = map(int,input().split())
    print(p[b-1] - p[a-1])
### BUGGY CODE ###

import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class v:
    def __init__(self, f):
        self.f = f
        self.v = None
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n) 


def f(N, S, A, L, R, exist=False):
    if S == 0:
        return [[0, L - 1]]

    SS = sum(A[L:R + 1])
    if SS < S:
        return []
    if SS == S:
        return [[L, R]]
    if L == R:
        return []

    T1 = f(N, S, A, L + 1, R, exist)
    T2 = f(N, S - A[L], A, L + 1, R, True)

    if not exist and len(T2) > 0:
        for l in T2:
            l[0] = L
    T1.extend(T2)
    return T1


def main():
    N, S = read_values()
    A = read_list()
    
    R = f(N, S, A, 0, N - 1)
    res = 0
    for l, r in R:
        res += (l + 1) * (N - r) % mod
        res %= mod
    print(res)



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(100000)
# mod = 10 ** 9 + 7
mod = 998244353


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: int(x) - 1, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n)


def main():
    N, S = read_values()
    A = read_list()

    dp = [(0, 0, 0) for _ in range(S + 1)]
    dp[0] = (1, 1, 1)

    for a in A:
        for s in range(S, -1, -1):
            d1 = dp[s][0]
            d2 = (dp[s][1] + (0 if s - a < 0 else dp[s - a][1]) + d1) % mod
            d3 = (dp[s][2] + (0 if s - a < 0 else dp[s - a][1]) + d2) % mod
            dp[s] = (d1, d2, d3)

    print((dp[S][2] - dp[S][1]) % mod)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
a=list(map(int, input().split()))
l0=[0]*60
l1=[0]*60
for i in range(n):
    b=bin(a[i])[::-1]
    #print(b)
    for j in range(60):
        if j<len(b)-2:
            if b[j]=="0":
                l0[j]+=1
            else:
                l1[j]+=1
        else:
            l0[j]+=1
#print(l0,l1)
ans=0
for i in range(60):
    ans+=l0[i]*l1[i]*(2**i)
    if ans>=10**9+7:
        ans%=(10**9+7)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
import numpy as np
n=int(input())
a = np.array([int(i) for i in input().split()])

ans=0
for i in range(60):
    cnt=np.count_nonzero(a&1)
    ans+=(n-cnt)*cnt*(2**i)
    if ans>=10**9+7:
        ans%=(10**9+7)
    a>>=1
print(ans)
### BUGGY CODE ###

def maxHeapify(heap, i):
    while (i + 1) * 2 <= len(heap):
        left = (i + 1) * 2 - 1
        right = (i + 1) * 2
        largest = left if heap[left] > heap[i] and left <= len(heap) else i
        largest = right if heap[right] > heap[largest] and right <= len(heap) else largest
        if largest != i:
            heap[i], heap[largest] = heap[largest], heap[i]
            maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)
out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)

### FIXED CODE ###

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)

out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)
### BUGGY CODE ###

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

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

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
result = [0 for i in range(N)]
  
for i in range(N) :
  result[A[i]-1] = i+1

for i in range(N) :
  print(result[i], end="")
  print(" ", end="")
### BUGGY CODE ###

from itertools import combinations as co
from sys import stdin
n=int(input())
l=[int(x) for x in stdin.readline().rstrip().split()]
print(len([1 for a,s,d in co(l, 3) if abs(a-s)<d<a+s]))

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
from bisect import bisect_left as bl,bisect_right as br
for i in range(n):
    for j in range(i+1,n):
        a,s=l[i],l[j]
        ans+=-1-int(s<2*a)+bl(l,a+s)-br(l,s-a)
print(ans//3)
### BUGGY CODE ###

s = input()
ans = 0
for i in range(len(s)+1):
    left = s[0:i]
    right = s[i:]
    l = 0
    r = 0
    for i in range(len(left)-1,-1,-1):
        if left[i] != "<":
            break
        else:
            l += 1
    for i in range(len(right)):
        if right[i] != ">":
            break
        else:
            r += 1
    ans += max(l,r)
print(ans)

### FIXED CODE ###

from itertools import *
s = input()
g = [[k,len(list(v))] for k,v in groupby(s)]
ans = 0
for command,length in g:
    ans += length*(length+1)//2
for i in range(len(g)-1):
    if g[i][0] == "<":
        ans -= min(g[i][1],g[i+1][1])
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
index_lst = []
grid_0 = [0] * (W+1)
grid_0[1] = 1
for _ in range(1, H+1):
    index_lst = [i for i, j in enumerate(input(), 1) if j == '#']
    grid_1 = [0] * (W+1)
    for w in range(1, W+1):
      if w not in index_lst:
      	grid_1[w] = grid_1[w-1] + grid_0[w]
    grid_0 = grid_1

print(grid_0[-1] % (10**9+7))

### FIXED CODE ###

H, W = map(int, input().split())
m = 10**9+7
index_lst = []
grid_0 = [0] * (W+1)
grid_0[1] = 1
for _ in range(1, H+1):
  grid_1 = [0] * (W+1)
  for i, j in enumerate(input(), 1):
    if j == '.':
      grid_1[i] = (grid_0[i] + grid_1[i-1]) % m
  grid_0 = grid_1
    
print(grid_0[-1])