Harryxun/stf_run huggingface dataset:
n, k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

if n >= k:
    ans = -float('inf')
    for i in range(n):
        now = i
        score = []
        for j in range(k):
            now = p[now] - 1
            if j == 0:
                score.append(c[now])
            else:
                score.append(score[j-1] + c[now])
        ans = max(max(score), ans)
    print(ans)
else:
    ans = -float('inf')
    for i in range(n):
        now = i
        score = []
        check = [0] * n
        for j in range(k):
            go = p[now] - 1
            if check[go] == 1:
                break
            now = go
            if j == 0:
                score.append(c[now])
            else:
                score.append(score[j-1] + c[now])
            check[now] = 1
        d = k % j
        t = k // j
        score_2 = []
        for j in range(d):
            now = p[now] - 1
            if j == 0:
                score_2.append(c[now])
            else:
                score_2.append(score_2[j-1] + c[now])
        res = max(score)
        res_2 = score[-1] * t + max(score_2)
        ans = max(ans, res, res_2)

    print(ans)

### FIXED CODE ###

n, k = map(int,input().split())
p = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = -float('inf')
for i in range(n):
    score = []
    check = [0] * n
    now = i
    cycle = 0
    for _ in range(k):
        go = p[now] - 1
        if check[go] == 1:
            break
        now = go
        if len(score) == 0:
            score.append(c[now])
        else:
            score.append(score[-1] + c[now])
        check[now] = 1
        cycle += 1

    t = k // cycle
    m = k % cycle

    sum_cycle = score[-1]
    if m == 0:
        ans = max(sum_cycle * t, sum_cycle * (t - 1) + max(score), max(score), ans)
    else:
        ans = max(sum_cycle * t + max(score[:m]), sum_cycle * (t - 1) + max(score), max(score), ans)

print(ans)
def main():
    a, b, c, d, e, f = map(int, input().split())
    sugar = 0
    water = 0
    con = 0
    for i in range(f//100+1):
        if i%b == 0 or i%a == 0:
            w = i*100
            x = min(f-w, i*e)
            s = 0
        for j in range(x//c+1):
            ss = j*c
            s = max(s, ss+((x-ss)//d)*d)
        if w != 0:
            if con <= (100*s)/(w+s):
                water = w
                sugar = s
                con = (100*s)/(w+s)
    print(sugar+water, sugar)

if __name__ == "__main__":
    main()



### FIXED CODE ###

n = int(input())
a = int(input())
print(n**2 - a)
#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    n, m, k = map(int, sys.stdin.readline().split())
    fs = [tuple(map(int, sys.stdin.readline().split())) for _ in range(m)]
    bs = [tuple(map(int, sys.stdin.readline().split())) for _ in range(k)]

    g = [[] for _ in range(n)]
    for u, v in fs:
        g[u - 1].append(v - 1)
        g[v - 1].append(u - 1)
    for u in range(n):
        g[u] = set(g[u])

    bg = [[] for _ in range(n)]
    for u, v in bs:
        bg[u - 1].append(v - 1)
        bg[v - 1].append(u - 1)
    for u in range(n):
        bg[u] = set(bg[u])

    visited = [False] * n
    def get_component(g, root):
        cc = []
        def go(u):
            visited[u] = True
            cc.append(u)
            for v in g[u]:
                if not visited[v]:
                    go(v)
        go(root)
        return set(cc)

    ans = [0 for _ in range(n)]
    for u in range(n):
        if not visited[u]:
            cc = get_component(g, u)
            for v in cc:
                ans[v] = len(cc - g[v] - bg[v] - set([v]))

    print(" ".join(map(str, ans)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
import itertools

def main():
    n, m, k = map(int, sys.stdin.readline().split())
    fs = [tuple(map(int, sys.stdin.readline().split())) for _ in range(m)]
    bs = [tuple(map(int, sys.stdin.readline().split())) for _ in range(k)]

    g = [[] for _ in range(n)]
    for u, v in fs:
        g[u - 1].append(v - 1)
        g[v - 1].append(u - 1)

    bg = [[] for _ in range(n)]
    for u, v in bs:
        bg[u - 1].append(v - 1)
        bg[v - 1].append(u - 1)

    ccmembs = []
    ccmap = [-1] * n
    def color_component(ccid, root):
        stack = [root]
        ccmap[root] = ccid
        nmemb = 1
        while len(stack) > 0:
            u = stack.pop()
            for v in g[u]:
                if ccmap[v] < 0:
                    ccmap[v] = ccid
                    nmemb += 1
                    stack.append(v)
        return nmemb

    for u in range(n):
        if ccmap[u] < 0:
            ccmembs.append(color_component(len(ccmembs), u))

    for u in range(n):
        c = (ccmembs[ccmap[u]]
                - sum(1 for v in g[u] if ccmap[u] == ccmap[v])
                - sum(1 for v in bg[u] if ccmap[u] == ccmap[v])
                - 1)
        print(c, end=(' ' if u != n - 1 else '\n'))

if __name__ == '__main__':
    main()
import sys
input = sys.stdin.readline
from collections import deque

N, M , K = [int(x) for x in input().split()]
AB = []
G_F = [deque([]) for _ in range(N)]
G_B = [deque([]) for _ in range(N)]
G_F_s = [set() for _ in range(N)]
G_B_s = [set() for _ in range(N)]
for _ in range(M):
    AB = [int(x) for x in input().split()]
    G_F[AB[0] - 1].append(AB[1] - 1)
    G_F[AB[1] - 1].append(AB[0] - 1)
    G_F_s[AB[0] - 1].add(AB[1] - 1)
    G_F_s[AB[1] - 1].add(AB[0] - 1)

CD = []
for _ in range(K):
    CD = [int(x) for x in input().split()]

    G_B[CD[0] - 1].append(CD[1] - 1)
    G_B[CD[1] - 1].append(CD[0] - 1)
    G_B_s[CD[0] - 1].add(CD[1] - 1)
    G_B_s[CD[1] - 1].add(CD[0] - 1)

ans = 0
from collections import deque
G_F = deque(G_F)
G_B = deque(G_B)

# グラフの作成(無向グラフでは#を消す)

time = 0
arrive_time = [-1] * (N) # 到着時刻

# 深さ優先探索
def dfs(v, graph):
    global time
    time += 1
    stack = [v]
    arrive_time[v] = time
    while stack:
        v = stack[-1]
        if graph[v]:
            w = graph[v].popleft()
            if arrive_time[w] < 0:
                time += 1
                arrive_time[w] = time
                stack.append(w) 
        else:
            stack.pop()          
    return arrive_time
arrive_time = dfs(0, G)
if -1 in arrive_time:
    flag = 0
else:
    flag = 1
import copy
ans = [0] * N
for i in range(N - 1):
    for j in range(i + 1, N):
        if j in G_B_s[i] or j in G_F_s[i]:
            continue
        if flag:
            ans[i] += 1
            ans[j] += 1

print(*ans)




### FIXED CODE ###

import sys
input = sys.stdin.readline
 
n,m,k = map(int,input().split())
ab = [set() for _ in range(n)]
cd = [[] * n for _ in range(n)]

 
#Union Find
 
#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
 
#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]
 
#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

for _ in range(m):
    a, b = [int(x) for x in input().split()]
    unite(a - 1, b - 1)
    ab[a - 1].add(b - 1)
    ab[b - 1].add(a - 1)

for i in range(k):
    c, d = [int(x) for x in input().split()]
    if same(c - 1, d - 1):
        cd[c - 1].append(d - 1)
        cd[d - 1].append(c - 1)

ans = [0] * n

for i in range(n):
    ans[i] = size(i) - 1 - len(cd[i]) - len(ab[i])

print(*ans)
A, B = map(int, input().split())

if A <= 8 or B <= 8:
    return "Yay!"
else:
    return ":("

### FIXED CODE ###

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

if(A<=8 and B<=8):
    print("Yay!")
else:
    print(":(")
N=int(input())
values=[int(input()) for i in range(N)]
values.sort()
ret=0
for i in values:
    ret=(i+ret)*0.5
print(ret)

### FIXED CODE ###

N=int(input())
values=[int(thing) for thing in input().split(" ")]
values.sort()
ret=0
for i in values:
    if ret!=0:
        ret=(i+ret)*0.5
    else:
        ret=i
print(ret)
import itertools

n,m,q = input().split()
n = int(n)
m = int(m)
q = int(q)
num_list = []
a = list(range(1, n+1))
for i in range(q):
    num_list.append(list(map(int,input().split())))
ff = list(itertools.combinations_with_replacement(a, m))
max = 0
for i in range(len(ff)):
  s = 0
  for j in range(q):
    a,b,c,d = num_list[j]
    if ff[i][b-1] - ff[i][a-1] == c:
      s = s + d
  if max < s:
        max = s
print(max)
  

### FIXED CODE ###

import itertools

n,m,q = input().split()
n = int(n)
m = int(m)
q = int(q)
num_list = []
a = list(range(1, n+1))
for i in range(q):
    num_list.append(list(map(int,input().split())))
ff = list(itertools.combinations_with_replacement(range(1, m + 1), n))
max = 0
for i in range(len(ff)):
  s = 0
  for j in range(q):
    a,b,c,d = num_list[j]
    if ff[i][b-1] - ff[i][a-1] == c:
      s = s + d
  if max < s:
        max = s
print(max)
n=int(input())

a=2
b=1

if n==1:
  s=1
  n=2

for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

if s==1:
  ans = 1

print(ans)

### FIXED CODE ###

n=int(input())
 
a=2
b=1
s=0
 
if n==1:
  s=1
  n=2
 
for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn
 
if s==1:
  ans = 1
 
print(ans)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b,c;cin>>a>>b>>c;
  int ans=(a>=c||b>=c||a+b>=c);
  cout << bans(ans) << endl;
  return 0;
}


### FIXED CODE ###

a,b,c=map(int,input().split())
print("Yes" if a>=c or b>=c or a+b>=c else "No")
from math import floor
a,b = map(int,input().split())
print(math.floor(a*b))

### FIXED CODE ###

a,b=input().split()
a = int(a)
b = float(b)
b = round(b * 100)
ans = (a*b) // 100
print(ans)
mod=10**9+7
N,K=map(int,input().split())

tree=[]
for i in range(N+1):
  tree.append([])

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

answer=1
visited=[False]*(N+1)
def dfs(node,depth,cind):
  #print(node,depth,cind)
  global answer
  visited[node]=True
  
  if depth==0:
    answer*=K
    answer%=mod
  elif depth==1:
    answer*=K-1-cind
    answer%=mod
  else:
    answer*=K-2-cind
    answer%=mod
  
  next_nodes=tree[node]
  i=0
  for nn in next_nodes:
    if not visited[nn]:
      dfs(nn,depth+1,i)
      i+=1

node=1
dfs(node,0,0)
print(answer)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

mod=10**9+7
N,K=map(int,input().split())

tree=[]
for i in range(N+1):
  tree.append([])

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

answer=1
visited=[False]*(N+1)
def dfs(node,depth,cind):
  #print(node,depth,cind)
  global answer
  visited[node]=True
  
  if depth==0:
    answer*=K
    answer%=mod
  elif depth==1:
    answer*=K-1-cind
    answer%=mod
  else:
    answer*=K-2-cind
    answer%=mod
  
  next_nodes=tree[node]
  i=0
  for nn in next_nodes:
    if not visited[nn]:
      dfs(nn,depth+1,i)
      i+=1

node=N//2
dfs(node,0,0)
print(answer)
import numpy as np
N, M = list(map(int, input().split()))
can = []
for i in range(1, int(np.sqrt(M)) + 1):
	if M % i == 0:
		if N <= M // i:
			can.append(i)
		if N <= i:
			can.append(M // i)

if N == 1:
	print(M)
else:
	print(max(can))



### FIXED CODE ###

N, T = list(map(int, input().split()))
can = []
for _ in range(N):
	c, t = list(map(int, input().split()))
	if t <= T:
		can.append(c)
 
if len(can) == 0:
	print("TLE")
else:	
	print(min(can))
given = input()
a, b = given.split()
if a % 2 and b % 2:
  print("Odd")
else:
  print("Even")

### FIXED CODE ###

given = input()
s = given.split()

a = int(s[0])
b = int(s[1])

if a % 2 and b % 2:
  print("Odd")
else:
  print("Even")
from collections import defaultdict, deque
import sys
import heapq
import math

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    # N = int(input())
    N, M, P = [int(a) for a in input().split()]
    ABC = [
        [int(a) for a in input().split()]
        for _ in range(M)
    ]

    ABC = [(a, b, P - c) for a, b, c in ABC]

    table = [MAX] * (N + 1)
    table[1] = 0
    for _ in range(N):
        for a, b, c in ABC:
            if table[a] == MAX:
                continue
            if table[a] + c < table[b]:
                table[b] = table[a] + c
    if -table[N] < 0:
        print(0)
        return
    score = -table[N]
    for a, b, c in ABC:
        if table[a] == MAX:
            continue
        if table[a] + c < table[b]:
            table[b] = table[a] + c
    if -table[N] != score:
        raise ValueError()
        print(-1)
        return
    print(-table[N])


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict, deque
import sys
import heapq
import math

sys.setrecursionlimit(100000)

MIN = -10 ** 9
MAX = 10 ** 9 + 7


def main():
    # N = int(input())
    N, M, P = [int(a) for a in input().split()]
    ABC = [
        [int(a) for a in input().split()]
        for _ in range(M)
    ]

    FORWARD = defaultdict(lambda: [])
    BACK = defaultdict(lambda: [])
    for a, b, c in ABC:
        t = FORWARD[a]
        t.append((b, c))
        FORWARD[a] = t

        t = BACK[b]
        t.append((a, c))
        BACK[b] = t

    mem = {N}
    q = [N]
    while len(q) != 0:
        t = q.pop()
        for t2, _ in BACK[t]:
            if t2 in mem:
                continue
            q.append(t2)
            mem.add(t2)

    ABC = [(a, b, P - c) for a, b, c in ABC if a in mem and b in mem]

    table = [MAX] * (N + 1)
    history_table = [set() for _ in range(N + 1)]
    table[1] = 0
    # history_table[1] = {1}
    # table2 = [-1] * N
    for _ in range(len(mem)):
        for a, b, c in ABC:
            if table[a] == MAX:
                continue
            if table[a] + c < table[b]:
                # if b in history_table[a]:
                #     print(-1)
                #     return
                table[b] = table[a] + c
                # h2 = set(history_table[a])
                # h2.add(b)
                # history_table[b] = h2
    for a, b, c in ABC:
        if table[a] == MAX:
            continue
        if table[a] + c < table[b]:
            print(-1)
            return
    print(max(0, -table[N]))


if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split()))

count = [0 for i in range(max(A) + 1)]
for i in range(N):
    if A[i] == 0:
        count[A[i]] += 1
        count[A[i] + 1] += 1
    elif A[i] == max(A):
        count[A[i]] += 1
        count[A[i] - 1] += 1
    else:
        count[A[i] + 1] += 1
        count[A[i]] += 1
        count[A[i] - 1] += 1
print(max(count))

### FIXED CODE ###

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

maximum = max(A)
count = [0]*(maximum + 2)

for i in range(N):
    if A[i] == 0:
        count[0] += 1
        count[1] += 1
        
    elif A[i] == maximum:
        count[A[i]] += 1
        count[A[i] - 1] += 1
    
    else:
        count[A[i] + 1] += 1
        count[A[i]] += 1
        count[A[i] - 1] += 1

print(max(count))
x=input()
print(360/x)

### FIXED CODE ###

n = int(input())
import numpy as np
x=0
y=0
rad=0
k=1
while(1):
  y+=np.cos(rad*np.pi/180)
  x+=np.sin(rad*np.pi/180)
  if x<0.0001 and y<0.0001:
    print(k)
    break
  else:
    k+=1
    rad+=n
X, Y = map(int, input().split())  # 目的地
#
dp = [[0]*(X+1) for _ in range(Y+1)]

dp[2][1] = 1
dp[1][2] = 1

for i in range(Y+1):  # iがy座標にあたる
    for j in range(X+1):  # jがx座標にあたる
        if i < 2 or j < 2:
            continue
        dp[i][j] += dp[i-1][j-2] + dp[i-2][j-1]

print(dp[Y][X])

# dp_x = [0]*(X+1)
# dp_x[1] = 1
# dp_x[2] = 2
# for i in range(3, X+1):  # Xの動きだけ専門
#     dp_x[i] += dp_x[i-1] + dp_x[i-2]
#
# dp_y = [0]*(Y+1)
# dp_y[1] = 1
# dp_y[2] = 2
# for i in range(3, Y+1):
#     dp_y[i] += dp_y[i-1] + dp_y[i-2]
# print(dp_x[X-1]*dp_y[Y-1]%1000000007)
# # print(dp_x)
# # print(dp_y)


### FIXED CODE ###

# 階乗は英語でfactrial, ifacは階乗に対する逆元
def cmb(n, k, mod, fac, ifac):
    # nCkを求める
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):  # (mod mod)の世界における割り算に従ってテーブルを作る
    # 階乗, 階乗に対する逆元のテーブルを作成する
    fac = [1, 1]  # 階乗デーブル
    ifac = [1, 1]  # 階乗に対する逆元のテーブル
    inverse = [0, 1]  # 逆元そのもののテーブル

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac


X, Y = map(int, input().split())
MOD = 1000000007
if (X+Y) % 3 != 0:
    print(0)
else:
    m = (2*X-Y)//3
    n = X - 2*m
    if n < 0 or m < 0:
        print(0)
        exit()
    fac, ifac = make_tables(MOD, (X+Y)//3)
    ans = cmb(n+m, n, MOD, fac, ifac)
    print(ans)
A,B=input().split;
A-int(A);
B=int(B);
print(A*B);

### FIXED CODE ###

A,B=input().split();
A=int(A);
B=int(B);
print(A*B);
a = list(map(int,[input() for i in range(5)]))

if max(a[-1]) - min(a[-1]) > a[-1]:
  print(":(")
else:
  print("Yay!")


### FIXED CODE ###

a = list(map(int,[input() for i in range(6)]))

if max(a[:-1]) - min(a[:-1]) > a[-1]:
  print(":(")
else:
  print("Yay!")
N = int(input())
A = list(map(int,input().split()))

x = 1

y = 1000000000000000000

for i in A:
  x = x*i  

if (x>y):
    print(-1)
else:
    print(x)

### FIXED CODE ###

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

print(A*B)
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    M=I()
    d=[0]*M
    c=[0]*M
    for i in range(M):
        d[i]=I()
    for i in range(M):
        c[i]=I()
        
    ans=0
    
    def make(cc,dd):
        ans+=(cc-1)+(dd*cc)//10
        return (cc*dd)%10
    
    new_cnt=0
    new_d=M
    for i in range(M):
        new_cnt+=make(c[i],d[i])
    make(new_cnt,new_d)
    print(ans)

main()


### FIXED CODE ###

M=int(input())
dig=0
sum=0

for i in range(M):
    d,c=map(int,input().split())
    dig+=c
    sum+=d*c
    
print(dig-1+(sum-1)//9)
a , b = map(int , input().split)
c=str(a)+str(b)
c=int(c)
for i in range (20):
    if c!= int(i^2):
        print("Yes")  
        break      
    elif c==100:
        print("No")
        break

        

### FIXED CODE ###

a , b = map(int , input().split())
c=str(a)+str(b)
c=int(c)
for i in range (1000):
    if c== int(i*i):
        print("Yes")  
        break      
    elif i==1000-1:
        print("No")
        break
5 5 17 6 37 17 18

25 25 289 36 1369 289 324def rally(n , xl):

    ans = 0

    aaa = round(sum(xl) / n)

    for i in range(n):
        ans += (xl[i] - aaa)**2

    return ans

def main():
    n = int(input())
    xl = list(map(int , input().split()))
    print(rally(n , xl))

if __name__ == '__main__':
    main()


### FIXED CODE ###

def rally(n , xl):

    ans = 0

    aaa = round(sum(xl) / n)

    for i in range(n):
        ans += (xl[i] - aaa)**2

    return ans

def main():
    n = int(input())
    xl = list(map(int , input().split()))
    print(rally(n , xl))

if __name__ == '__main__':
    main()
#ABC050.A
A,B = map(int,input().split())
op = input()
if op == '+':
    print(A+B)
else:
    print(A-B)

### FIXED CODE ###

#ABC050.A
A,op,B = input().split()
if op =='+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))
n = int(input())
alist  = list(map(int,input().split()))
list1 = alist[1::2]
list2 = blist[0::2]
from collections import Counter
dic1 = Counter(list1)
dic2 = Counter(list2)
vlist1 = sorted(list(dic1.values()))
vlist2 = sorted(list(dic2.values()))
print(n - vlist1[-1] - vlist2[-1])

### FIXED CODE ###

n = int(input())
alist  = list(map(int,input().split()))
list1 = alist[1::2]
list2 = alist[0::2]
from collections import Counter
dic1 = Counter(list1).most_common()
dic2 = Counter(list2).most_common()
dic1.append([0,0])
dic2.append([0,0])
if dic1[0][0]!=dic2[0][0]:
  print(n - dic1[0][1] - dic2[0][1])
else:
  print(min(n - dic1[0][1] - dic2[1][1], n -dic1[1][1] - dic2[0][1]))
a,b=map(int,input().split())
print(a*b,2*a+2*b)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,2*a+2*b)
import math

K = int(input(K))

ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      tmp = math.gcd(a,b)
      ans += math.gcd(tmp, c)

print(ans)


### FIXED CODE ###

import math

K = int(input())

gcd_tmp = list()
total = 0
for b in range(1, K+1):
    for c in range(1, K+1):
        tmp = math.gcd(b, c)
        gcd_tmp.append(tmp)

gcd_tmp.sort()
length = len(gcd_tmp)

type_of_gcd = list()
num_of_gcd = list()

counter = 0
for i in range(length-1):
    counter += 1
    if gcd_tmp[i] != gcd_tmp[i+1]:
        type_of_gcd.append(gcd_tmp[i])
        num_of_gcd.append(counter)
        counter = 0
type_of_gcd.append(gcd_tmp[-1])
num_of_gcd.append(counter+1)

# print(gcd_tmp)
# print(type_of_gcd)
# print(num_of_gcd)


for a in range(1, K+1):
    for i in range(len(type_of_gcd)):
        tmp = math.gcd(a, type_of_gcd[i])
        total += tmp*num_of_gcd[i]

print(total)
N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp=[[0]*3 for _  in range(N)]
dp[0]=[a[0],b[0],c[0]]
for i in range(N-1):
    for j in range(2):
        for k in range(2):
            if j!=k:
                dp[i+1][j]=max(dp[i+1][j],dp[i][k] + a[i+1][j])
            else:
                pass

print(max(dp[N-1]))


    

### FIXED CODE ###

N = int(input())
a, b, c = [0] * N, [0] * N, [0] * N
for i in range(N):
	a[i], b[i], c[i] = map(int, input().split())
dp = [[0] * 3 for _ in range(N)]

dp[0] = [a[0], b[0], c[0]]
for i in range(N - 1):
	dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + a[i + 1], dp[i][2] + a[i + 1])
	dp[i + 1][1] = max(dp[i + 1][1], dp[i][0] + b[i + 1], dp[i][2] + b[i + 1])
	dp[i + 1][2] = max(dp[i + 1][2], dp[i][0] + c[i + 1], dp[i][1] + c[i + 1])
print(max(dp[N - 1]))
import math

def lcm(p,q):
    return (p*q) // math.gcd(p,q)

def g(x,k):
    return x // k

def f(x,c,d):
    return x - (g(x,c)+g(x,d)-g(x,lcm(c,d)))

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

print(f(b,c,d)-f(a-1,c,d))

### FIXED CODE ###

import fractions

def lcm(p,q):
    return (p*q) // fractions.gcd(p,q)

def g(x,k):
    return x // k

def f(x,c,d):
    return x - (g(x,c)+g(x,d)-g(x,lcm(c,d)))

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

print(f(b,c,d)-f(a-1,c,d))
D = input()

if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif: D == 23:
    print("Christmas Eve Eve")
elif: D == 22:
    print("Christmas Eve Eve Eve")

### FIXED CODE ###

D = int(input())

if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
elif D == 22:
    print("Christmas Eve Eve Eve")
# a: 総数hiki， b: 足の数
a, b = map(int, input().split())

# かめiひき
ans = 'No'
for i in range(a+1):
  total = 4*i + 2*(a-i)
  if total == b:
    ans = 'Yes'
    break

print(ans)

### FIXED CODE ###

a_list = list(map(int, input().split()))
print(1 + a_list.index(0))