Harryxun/stf_run huggingface dataset:
import math
import numpy as np

# K = int(input())
ans = 0
for i in range(1,K+1):
#     print(1, (i,i,i))
    ans += np.gcd.reduce([i,i,i])

for i in range(1, K):
    for j in range(i+1, K+1):
#         print(3, (i,j,j))
        ans += 3 * np.gcd.reduce([i,j,j])
for i in range(1, K+1):
    for j in range(1, i):
#         print(3, (i,j,j))
        ans += 3 * np.gcd.reduce([i,j,j])
        
for i in range(1, K-1):
    for j in range(i+1, K):
        for k in range(j+1, K+1):
#             print(6, (i,j,k))
            ans += 6 * np.gcd.reduce([i,j,k])
print(ans)

### FIXED CODE ###

import numpy as np
 
K = int(input())
ans = 0

gcd2 = np.zeros((K+1, K+1), dtype=int)

for i in range(1, K):
    for j in range(i+1,K+1):
        gcd2[i,j] = gcd2[j,i] = np.gcd(i,j)
for i in range(1, K+1):
    gcd2[i,i] = i

for i in range(1,K+1):
    ans += i

for i in range(1, K):
    for j in range(i+1, K+1):
        ans += 3 * gcd2[i,j]
for i in range(1, K+1):
    for j in range(1, i):
        ans += 3 * gcd2[i,j]
        
for i in range(1, K-1):
    for j in range(i+1, K):
        for k in range(j+1, K+1):
            ans += 6 * gcd2[i,gcd2[j,k]]
            
print(ans)
h, w = map(int, input().split())
s = [] # h, w
for i in range(h):
    s += [','.join(input()).split(',')]

cost = [[1 if s[0][0] == '#' else 0 for i in range(h)] for j in range(w)]

for i in range(1, h + w - 1):
    for j in range(w if h < w else h):
        if j < h and i - j < w:
            if j >= 0 and i - j >= 0:
                if j == 0:
                    cost[j][i - j] = cost[j][i - j - 1]
                elif i - j == 0:
                    cost[j][i - j] = cost[j - 1][i - j]
                else:
                    cost[j][i - j] = cost[j - 1][i - j] if cost[j - 1][i - j] < cost[j][i - j - 1] else cost[j][i - j - 1]

                if s[j][i - j] == '#':
                    cost[j][i - j] += 1
                    
print(cost[h - 1][w - 1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [] # h, w
for i in range(h):
    s += [','.join(input()).split(',')]

cost = [[10000 for i in range(w)] for j in range(h)]

# h: j,  w: i - j
for hh in range(h):
    for ww in range(w):
        # 初期地点
        if hh == ww == 0:
            cost[0][0] = 0 if s[0][0] == '.' else 1

        if hh < h - 1:
            if s[hh][ww] == '.' and s[hh + 1][ww] == '#':
                cost[hh + 1][ww] = min(cost[hh][ww] + 1, cost[hh + 1][ww])
            else:
                cost[hh + 1][ww] = min(cost[hh][ww], cost[hh + 1][ww])
        if ww < w - 1:
            if s[hh][ww] == '.' and s[hh][ww + 1] == '#':
                cost[hh][ww + 1] = min(cost[hh][ww] + 1, cost[hh][ww + 1])
            else:
                cost[hh][ww + 1] = min(cost[hh][ww], cost[hh][ww + 1])

print(cost[h - 1][w - 1])
l = list(map(int, input().split()))
lists = [1]*l[0] + [0]*l[1] + [-1]*l[2]
sum = 0
for i in range(l[3]):
    sum += lists[i]
print(sum)

### FIXED CODE ###

a, b, c, k = map(int, input().split())
print(min(a, k, a*2+b-k))
x,a,b = map(int, input().split())
print((x-a)%b)

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)
#!/usr/bin/env python3
import sys
import numpy as np

def solve(H: int, W: int, S: "List[str]"):
    S = np.array(S)
    sh = np.zeros((H, W),dtype=np.int)
    sw = np.zeros((W, H),dtype=np.int)

    for i, a in enumerate(S):
        left = np.arange(1, len(a)+1)
        left[a==0] = 0
        left = np.maximum.accumulate(left)
        a_ = a[::-1]
        right = np.arange(1,len(a)+1)
        right[a_==0] = 0
        right = np.maximum.accumulate(right)
        right = len(a)+1 - right[::-1]
        k = ((right-left) - 1)
        k[a==1] =0
        sh[i] = k

    for i, a in enumerate(S.T):
        left = np.arange(1, len(a)+1)
        left[a==0] = 0
        left = np.maximum.accumulate(left)
        
        right = np.arange(1,len(a)+1)
        right[a[::-1]==0] = 0
        right = np.maximum.accumulate(right)
        right = len(a)+1 - right[::-1]
        k = ((right-left) - 1)
        k[a==1] =0
        sw[i] = k

    print(np.max(sw+sh.T)-1)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "0").replace("#", "1")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def solve(H: int, W: int, S: "List[int]"):
    # print(S)

    hcnts = [[0]*W for _ in range(H)]
    for h in range(H):
        hcnts[h][0] = S[h][0]
        for t in range(1,W):
            hcnts[h][t] = (S[h][t]+hcnts[h][t-1])*S[h][t]
    for h in range(H):
        for t in range(W-2,-1,-1):
            hcnts[h][t] = max(hcnts[h][t],hcnts[h][t+1])*bool(hcnts[h][t])

    wcnts = [[0]*W for _ in range(H)]
    for h in range(W):
        wcnts[0][h] = S[0][h]
        for t in range(1,H):
            wcnts[t][h] = (S[t][h]+wcnts[t-1][h])*S[t][h]
    for h in range(W):
        for t in range(H-2,-1,-1):
            wcnts[t][h] = max(wcnts[t][h],wcnts[t+1][h])*bool(wcnts[t][h])
    # print(hcnts)
    # print(wcnts)
    a = [hcnts[h][w]+wcnts[h][w]-1 for h in range(H) for w in range(W)]
    print(max(a))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [[ int(_.replace(".", "1").replace("#", "0")) for _ in next(tokens)] for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main()
import itertools

N, M = map(int, input().split())
S = []
for i in range(M):
    tmp = list(map(int, input().split()))
    S.append([tmp[1:]])
P = list(map(int, input().split()))


origin_list = [0, 1]
all_way = []
for i in itertools.product(origin_list, repeat=N):
    all_way.append(i)

ans = 0
for way in all_way:
    light = 0
    for i, s in enumerate(S):
        small_sum = 0
        for ss in s:
            if way[ss - 1] == 1:
                small_sum += 1
        if small_sum % 2 == P[i]:
            light += 1
    if light == M:
        ans += 1

print(ans)

### FIXED CODE ###

import itertools

N, M = map(int, input().split())
S = []
for i in range(M):
    tmp = list(map(int, input().split()))
    S.append([tmp[1:]])
P = list(map(int, input().split()))


origin_list = [0, 1]
all_way = []
for i in itertools.product(origin_list, repeat=N):
    all_way.append(i)

ans = 0
for way in all_way:
    light = 0
    for i, s in enumerate(S):
        small_sum = 0
        for ss in s:
            for sss in ss:
                if way[sss - 1] == 1:
                    small_sum += 1
            if small_sum % 2 == P[i]:
                light += 1
        if light == M:
            ans += 1

print(ans)
n = int(input())
b = [*map(int, input().split())]

a = []
a.append(b[0])
for i in range(1,n-1):
    a.append(min(b[i],b[i-1]))
a.append(b[-1])
print (sum(a))

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
a = [int(0) for i in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]
b.append(b[n-2])
for i in range(1,n-1):
    a[i] = min(b[i-1], b[i])
print(sum(a))
x = input()
yyyy, mm, dd = x.split("/")
if mm <= 4:
  print("Heisei")
else:
  print("TBD")
exit(0)

### FIXED CODE ###

x = input()
yyyy, mm, dd = x.split("/")
if int(mm) <= 4:
  print("Heisei")
else:
  print("TBD")
def merge_sort(alist):
    """Sort alist using mergesort.
    Returns a tuple of the number of comparisons and sorted list.

    >>> merge_sort([8, 5, 9, 2, 6, 3, 7, 1, 10, 4])
    (34, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
    """
    def _sort(left, right):
        count = 0
        if left + 1 < right:
            mid = (left + right) // 2
            count += _sort(left, mid)
            count += _sort(mid, right)
            count += merge(left, mid, right)

        return count

    def merge(left, mid, right):
        count = 0
        ll = alist[left:mid] + [SENTINEL]
        rl = alist[mid:right] + [SENTINEL]

        i = j = 0
        for k in range(left, right):
            count += 1
            if ll[i] <= rl[j]:
                alist[k] = ll[i]
                i += 1
            else:
                alist[k] = rl[j]
                j += 1

        return count

    comp = _sort(0, len(alist))
    return (comp, alist)


def run():
    _ = int(input())  # flake8: noqa

    li = [int(i) for i in input().split()]

    (c, s) = merge_sort(li)
    print(" ".join([str(i) for i in s]))
    print(c)


if __name__ == '__main__':
    run()



### FIXED CODE ###

SENTINEL = 10**9 + 1


def merge_sort(alist):
    """Sort alist using mergesort.
    Returns a tuple of the number of comparisons and sorted list.

    >>> merge_sort([8, 5, 9, 2, 6, 3, 7, 1, 10, 4])
    (34, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
    """
    def _sort(left, right):
        count = 0
        if left + 1 < right:
            mid = (left + right) // 2
            count += _sort(left, mid)
            count += _sort(mid, right)
            count += merge(left, mid, right)

        return count

    def merge(left, mid, right):
        count = 0
        ll = alist[left:mid] + [SENTINEL]
        rl = alist[mid:right] + [SENTINEL]

        i = j = 0
        for k in range(left, right):
            count += 1
            if ll[i] <= rl[j]:
                alist[k] = ll[i]
                i += 1
            else:
                alist[k] = rl[j]
                j += 1

        return count

    comp = _sort(0, len(alist))
    return (comp, alist)


def run():
    _ = int(input())  # flake8: noqa

    li = [int(i) for i in input().split()]

    (c, s) = merge_sort(li)
    print(" ".join([str(i) for i in s]))
    print(c)


if __name__ == '__main__':
    run()
n, k = map(int, input().split()) 
a_list = list(map(int, input().split())) 

rireki = [0] * (n+10)
curr_c = 1
rireki[1] = 0

no_loop_count = k
loop_cnt = 1

mugen = False
for i in range(n):
    next_c = a_list[curr_c-1]
    # print(i, curr_c, next_c)
    # if next_c == curr_c:
    #     mugen = True
    if next_c == 1:
        no_loop_count = 0
        loop_cnt = i + 1
        break
    elif rireki[next_c] == 0:
        rireki[next_c] = i+1
    else:
        # print(next_c)
        no_loop_count = rireki[next_c] -1
        loop_cnt = i - no_loop_count
        break
    curr_c = next_c

if loop_cnt ==0:
    loop_cnt = 1

# if not mugen:
if k <= no_loop_count:
    ans = rireki.index(k)
else:
    # print('k',k)
    # print('no', no_loop_count)
    # print('lo', loop_cnt)
    ind = (k-1-no_loop_count)%loop_cnt +1
    rireki_fix = [i-no_loop_count for i in rireki]
    # print(ind, 'ind')
    ans = rireki_fix.index(ind)
    # print(rireki_fix)
    print(ans)

### FIXED CODE ###

def main():
    n, k = map(int, input().split()) 
    al = list(map(int, input().split())) 
    city_l = [1]
    city_s = set([1])
    loop_city_l = []
    curr_city = 1
    cnt = 0
    for i in range(1,k+1):
        next_c = al[curr_city-1]
        if next_c in city_s:
            cnt = i
            first_city = city_l.index(next_c)
            loop_city_l = city_l[first_city:]
            break
        else:
            city_s.add(next_c)
            city_l.append(next_c)
        curr_city = next_c
    else:
        print(curr_city)
        return

    # print(loop_city_l)
    remained = k-cnt
    last_pos = remained%len(loop_city_l)
    print(loop_city_l[last_pos])

if __name__ == "__main__":
    main()
N,K,C=map(int,input().split())
S=list(input())
#print(S)
F=[]
cnt=C
num=1
for i in range(N):
    if cnt>=C and S[i]=="o":
        F.append([num,i])
        num+=1
        cnt=0
    else:
        F.append([F[-1][0],F[-1][1]])
        cnt+=1
#print(F)
E=[]
RS=S[::-1]
cnt=C
num=1
for i in range(N):
    if cnt>=C and S[N-i-1]=="o":
        E.append([num,N-1-i])
        num+=1
        cnt=0
    else:
        E.append([E[-1][0],E[-1][1]])
        cnt+=1
E=E[::-1]
#print(E)
ans=[]
for i in range(N):
    if i==0:
        if E[i+1][0]<K:
            ans.append(1)
    elif i==N-1:
        if F[i-1][0]<K:
            ans.append(N)
    else:
        cnt=F[i-1][0]+E[i+1][0]
        if E[i+1][1]-F[i-1][1]<C:
            cnt-=1
        if cnt<K:
            ans.append(i+1)
#print(ans)
if len(ans)==0:
    print("")
    exit()
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
    if S[i]=="o" and span >= C:
        maru += 1
        last = i
        F.append([maru,last])
        span = 0
    else:
        span += 1
        F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 10**9
span = C
E = []
for i in range(N):
    if s[i] == "o" and span >= C:
        maru += 1
        last = N-1-i
        E.append([maru,last])
        span = 0
    else:
        E.append([maru,last])
        span += 1
E = E[::-1]
#print(E)
F = [[0,-10**9]] + F + [[0,10**9]]
E = [[0,-10**9]] + E + [[0,10**9]]
#print(F)
#print(E)
ans = []
for i in range(1,N+1):
    cnt = F[i-1][0] + E[i+1][0]
    
    if S[i-1] == "o":
        if E[i+1][1] - F[i-1][1] < C:
            cnt -= 1
        if cnt == K-1:
            ans.append(i)
    #print(F[i-1],E[i+1],cnt)
for i in range(len(ans)):
    print(ans[i])
N, Q = [int(_) for _ in input().split()]
edge = [[] for _ in range(N)]

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


vertex = [0] * N
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    p -= 1
    vertex[p] += x


def dfs(n, parent):
    for to in edge[n]:
        if to == parent:
            continue
        vertex[to] += vertex[n]
        dfs(to, n)


dfs(0, -1)
print(*vertex)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N, Q = [int(_) for _ in input().split()]
edge = [[] for _ in range(N)]

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


vertex = [0] * N
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    p -= 1
    vertex[p] += x


def dfs(n, parent):
    for to in edge[n]:
        if to == parent:
            continue
        vertex[to] += vertex[n]
        dfs(to, n)


dfs(0, -1)
print(*vertex)
from itertools import accumulate


N, Q = list(map(int, input().split()))
S = input()
A = [list(map(int, input().split())) for i in range(Q)]

flg = []
for i in range(N-1):
    tmp_S = S[i:i+2]
    if tmp_S == 'AC':
        flg.append(1)
    else:
        flg.append(0)

flg2 = [0] + flg
flg2 = list(accumulate(flg2))

for a in A:
    print(flg2[a[1]-1] - flg2[a[0]-1])

### FIXED CODE ###

b = input()
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "G":
    print("C")
else:
    print("G")
input(S)
if S="SUN":
  print("7")
elif S="MON":
  print("6")
elif S="TUE":
  print("5")
elif S="WED":
  print("4")
elif S="THU":
  print("3")
elif S="FRI":
  print("2")
elif S="SAT":
  print("1")

### FIXED CODE ###

S=input()
if S=="SUN":
  print("7")
elif S=="MON":
  print("6")
elif S=="TUE":
  print("5")
elif S=="WED":
  print("4")
elif S=="THU":
  print("3")
elif S=="FRI":
  print("2")
elif S=="SAT":
  print("1")
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
broke = []
for j in range(m):
    broke.append(ii())

num = [1]
if broke[0] == 1:
    num.append(0)
    broke.pop(0)
else:
    num.append(1)

for i in range(2,n+1):
    if len(broke) and broke[0] == i:
        num.append(0)
        broke.pop(0)
    else:
        num.append((num[-1]+num[-2])%1000000007)

print(num[-1])

### FIXED CODE ###

def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
broke = []
for j in range(m):
    broke.append(ii())
if n > 1:
    num = [1]
    if len(broke) and broke[0] == 1:
        num.append(0)
        broke.pop(0)
    else:
        num.append(1)

    for i in range(2,n+1):
        if len(broke) and broke[0] == i:
            num.append(0)
            broke.pop(0)
        else:
            num.append((num[-1]+num[-2])%1000000007)
    print(num[-1])
else:
    print(1)
N, M = map(int, input().split())
ab = [tuple(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
 
 
class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n)]
        self.sizes = [1] * n
        self.rank = [0] * n
    def find(self, i):
        if self.parents[i] == i:
            return i
        else:
            self.parents[i] = self.find(self.parents[i])
            return self.parents[i]
    def unite(self, i, j):
        pi = self.find(i)
        pj = self.find(j)
        if pi != pj
            if self.rank[pi] < self.rank[pj]:
                self.sizes[pj] += self.sizes[pi]
                self.parents[pi] = pj 
            else: 
                self.sizes[pi] += self.sizes[pj]
                self.parents[pj] = pi 
                if self.rank[pi] == self.rank[pj]:
                    self.rank[pi] += 1
        
def main():
    uf = UnionFind(N)
    p = N * (N - 1) // 2
    ans = [p]
    for x, y in reversed(ab):
        px = uf.find(x)
        py = uf.find(y)
        if px != py:
            p -= uf.sizes[px] * uf.sizes[py]
            uf.unite(px, py)
        ans.append(p)
 
    for a in reversed(ans[:-1]):
        print(a)
 
 
main()


### FIXED CODE ###

N, M = map(int, input().split())
ab = [tuple(map(lambda x:int(x)-1, input().split())) for _ in range(M)]
 
 
class UnionFind:
    def __init__(self,size):
        self.rank = [-1 for _ in range(size)]
        self.number = [1 for _ in range(size)]
 
    def find(self,x):
        while self.rank[x] >= 0:
            x = self.rank[x]
        return x
 
    def union(self,x,y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 == s2:
            return
        if self.rank[s1] == self.rank[s2]:
            self.rank[s1] -= 1
            self.rank[s2] = s1
            self.number[s1] += self.number[s2]
        elif self.rank[s1] < self.rank[s2]:
            self.rank[s2] = s1
            self.number[s1] += self.number[s2]
        else:
            self.rank[s1] = s2
            self.number[s2] += self.number[s1]
 
 
def main():
    uf = UnionFind(N)
    p = N * (N - 1) // 2
    ans = [p]
    for x, y in reversed(ab):
        px = uf.find(x)
        py = uf.find(y)
        if px != py:
            p -= uf.number[px] * uf.number[py]
            uf.union(px, py)
        ans.append(p)
 
    for a in reversed(ans[:-1]):
        print(a)
 
 
main()
import collections
N = int(input())
A = [int(_) for _ in input().split()]


class Prime:
    @staticmethod
    def trial_division(x):
        if x % 2 == 0:
            return True
        for p in range(3, int(x**0.5 + 1), 2):
            if x % p == 0:
                return False
        return True

    @staticmethod
    def factorization(x):
        ret = {}
        i = 0
        while True:
            if x % 2:
                break
            x //= 2
            i += 1
        if i:
            ret[2] = i
        for p in range(3, int(x**0.5 + 1), 2):
            i = 0
            while True:
                if x % p:
                    if i:
                        ret[p] = i
                    break
                x //= p
                i += 1
        if x > 1:
            ret[x] = 1
        return ret

    @staticmethod
    def miller_rabin(n):
        def suspect(a, t, n):
            x = pow(a, t, n)
            n1 = n - 1
            while t != n1 and x != 1 and x != n1:
                x = pow(x, 2, n)
                t <<= 1
            return t & 1 or x == n1

        if n == 2:
            return True
        if n < 2 or n % 2 == 0:
            return False
        d = (n - 1) >> 1
        while d & 1 == 0:
            d >>= 1

        if n < 2**32:
            check_list = (2, 7, 61)
        elif n < 2**48:
            check_list = (2, 3, 5, 7, 11, 13, 17, 19, 23)
        else:
            check_list = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37)

        for i in check_list:
            if i >= n:
                break
            if not suspect(i, d, n):
                return False
        return True


c = collections.defaultdict(int)
for a in A:
    for p in Prime.factorization(a):
        c[p] += 1
x = max(c.values())
if x == 1:
    print('pairwise coprime')
elif x == N:
    print('not coprime')
else:
    print('setwise coprime')


### FIXED CODE ###

import collections
N = int(input())
A = [int(_) for _ in input().split()]


def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


d = collections.defaultdict(int)
for a in A:
    for x in prime_factorize(a):
        d[x] += 1
if len(d):
    e = max(d.values())
if len(d) == 0 or e == 1:
    ans = 'pairwise coprime'
elif e == N:
    ans = 'not coprime'
else:
    ans = 'setwise coprime'
print(ans)
import sys
sys.setrecursionlimit(10 ** 7)
A,B,C,D,E,F=map(int,input().split())
E=(100*E)/(100+E)
M=[]
S=[]
for i in range(F//100*A+1):
    for j in range(F//100*B+1):
        t=i*100*A+j*100*B
        if t<=F and t!=0:
            M.append(t)
for i in range(F//C+1):
    for j in range(F//D+1):
        ta=i*C+j*D
        if ta<=F and ta!=0:
            S.append(ta)
tmp=0
if len(M)==0 or len(S)==0:
    print(0,0)
    sys.exit()
for x in M:
    for y in S:
        f=x+y
        e=(100*y)/f
        if f<=F and e<=E:
            if e>=tmp:
                tmp=e
                ans1,ans2=f,y
print(ans1,ans2)

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
a=100*a
b=100*b
dp1=[0]*(f+1)
dp2=[0]*(f+1)
for i in range(f+1):
    if i%a==0:
        if i+a<=f:
            dp1[i+a]=1
for i in range(f+1):
    if i==0 or dp1[i]==1:
        if i+b<=f:
            dp1[i+b]=1
for i in range(f+1):
    if i%c==0:
        if i+c<=f:
            dp2[i+c]=1
for i in range(f+1):
    if i==0 or dp2[i]==1:
        if i+d<=f:
            dp2[i+d]=1

ans=[-1,-1,-1]
for i in range(f+1):
    if dp1[i]==1:
        x=min(f-i,(i//100)*e)
        k=-1
        for j in range(x,-1,-1):
            if dp2[j]==1 or j==0:
                k=j
                if ans[0]<100*k/(i+k):
                    ans=[100*k/(i+k),i+k,k]
                break
print(str(ans[1])+" "+str(ans[2]))
n=int(input())
s=input()
if n%2==0:
  s1=s[:n/2]
  s2=s[n/2:]
  if s1==s2:
    print("Yes")
  else:
    print("No")
else:
  print("No")

### FIXED CODE ###

N=int(input())
S=input()
if (N%2!=0):
    print('No')
else:
    a1=S[:int(N/2)]
    a2=S[int(N/2):]
    if (a1==a2):
        print('Yes')
    else:
        print('No')
n = int(input())
l = []
ans = 1
for _ in range(n) :
	l.append(int(input()))
if l[0] == 2 :
	print(1)
else :
	i = l[0] - 1
while True :
	if l[i] == 2 :
		ans += 1
		break
	i = l[i] - 1
	ans += 1
	if ans == n+1 :
		print('-1')
		exit()
print(ans)

### FIXED CODE ###

n = int(input())
l = []
ans = 1
for _ in range(n) :
	l.append(int(input()))
if l[0] == 2 :
	print(1)
else :
    i = l[0] - 1
    while True :
        if l[i] == 2 :
            ans += 1
            break
        i = l[i] - 1
        ans += 1
        if ans == n+1 :
            print(-1)
            exit()
    print(ans)