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

def neighbor(N, edges):
    neighbor_list = [[] for _ in range(N)]
    for a, b in edges:
        neighbor_list[a-1] += [b]
        neighbor_list[b-1] += [a]
        
    return neighbor_list

def paint(N, K, nlist, clist, p2c, combi):
    p2c_next = {}
    for parent in p2c:
        for children in p2c[parent]:
            # childrenに対し、Kからparentの塗られている近接の数を引いた数だけ組み合わせを掛ける
            combi *= (K - 1 - len([t for t in nlist[parent - 1] if clist[t - 1]]))
            clist[children - 1] = True #子供の頂点を塗る
        # 次の世代のリスト
            p2c_next.update({children:[gc for gc in nlist[children - 1] if gc != parent]})
            
    return clist, p2c_next, combi


if __name__ == '__main__':
    N, K = map(int, input().split())
    edges = [None]*(N-1)
    
    for i in range(N-1):
        edges[i] = list(map(int, input().split()))
    
    nlist = neighbor(N, edges)
    
    p2c= {1:nlist[1-1]}
    combi = K
    clist = [False]*N
    clist[0] = True
    for i in range(N):
        clist, p2c, combi = paint(N, K, nlist, clist=clist, p2c=p2c, combi=combi)
        if len(p2c) == 0:
            break
    
    print(combi%1000000007)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def neighbor(N, edges):
    neighbor_list = [[] for _ in range(N)]
    for a, b in edges:
        neighbor_list[a-1] += [b-1]
        neighbor_list[b-1] += [a-1]
        
    return neighbor_list


def paint(K, nlist, now_num, from_num, case_num):
        mod = 1000000007
        if  from_num == -1:
            can_use_color = K - 1
        else:
            can_use_color = K - 2
        
        if len(nlist[now_num]) - 1 > can_use_color:
            return 0
        
        for child in nlist[now_num]:
            if child == from_num:
                continue
            else:
                case_num *= can_use_color
                can_use_color -= 1
                case_num %= mod
        
        for child in nlist[now_num]:
            if child == from_num:
                continue
            else:
                case_num = paint(K, nlist, child, now_num, case_num)
        return case_num%mod
            

if __name__ == '__main__':
    N, K = map(int, input().split())
    edges = [None]*(N-1)
    
    for i in range(N-1):
        edges[i] = list(map(int, input().split()))
    
    nlist = neighbor(N, edges)


    print(paint(K, nlist, 0, -1, K))
### BUGGY CODE ###

from collections import Counter

n = int(input())
lst = [input() for _ in range(n)]

counter_lst = []
counter_num = []
for i in range(n):
    a = Counter(lst[i])
    if a in counter_lst:
        m = counter_lst.index(a)
        counter_num[m] += 1
    else:
        counter_lst.append(a)
        counter_num.append(1)
    
res = 0
for i in counter_num:
    if i > 1:
        res += i * (i-1) // 2
print(res)

### FIXED CODE ###

n = int(input())
lst = [input() for _ in range(n)]

dic = dict()
res = 0
for i in range(n):
    sorted_string = "".join(sorted(lst[i]))
    if sorted_string in dic:
        dic[sorted_string] += 1
        res += dic[sorted_string]
    else:
        dic[sorted_string] = 0
    
print(res)
### BUGGY CODE ###

def gcd(x , y):
    while y != 0:
        x , y = y , x % y
    return x
N = int(input())
A = list(map(int ,input().split()))
max_val = 0
if N == 2:
    print(max(A[1], A[0]))
    exit()
for i in range(N):
    work = A[:i] + A[i + 1:]
    for j in range(1 , len(work)):
        if j == 1:
            tmp = gcd(work[0],work[1])
        else:
            tmp = gcd(tmp , work[j])
    if max_val < tmp:
        max_val = tmp
print(max_val)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
def gcd(x , y):
    while y != 0:
        x , y = y , x % y
    return x
N = int(input())
A = list(map(int ,input().split()))
max_val = 0
if N == 2:
    print(max(A[1], A[0]))
    exit()
right = []
left = []
work_right = gcd(A[N - 2] , A[N - 1])
right.append(A[N - 1])
work_left = gcd(A[0] , A[1])
left.append(A[0])
for i in range(1 , N - 1):
    work_left = gcd(work_left , A[i])
    left.append(work_left)
    work_right = gcd(work_right , A[N - i - 1])
    right.append(work_right)
#print(right)
#print(left)
right.reverse()
max_val = 0
for i in range(N):
    if i == 0:
        max_val = right[0]
    elif i == N - 1:
        if max_val < left[-1]:
            max_val = left[-1]
    else:
        tmp = gcd(right[i] , left[i - 1])
        if tmp > max_val:
            max_val = tmp
print(max_val)
'''
for i in range(N):
    work = A[:i] + A[i + 1:]
    for j in range(1 , len(work)):
        if j == 1:
            tmp = gcd(work[0],work[1])
        else:
            tmp = gcd(tmp , work[j])
    if max_val < tmp:
        max_val = tmp
print(max_val)
'''
### BUGGY CODE ###

import numpy as np
from scipy.sparse import csr_matrix, csgraph
n, m, s, t = map(int, input().split())
src = [list(map(int, input().split())) for _ in range(m)]
u, v, a, b = zip(*src)
pa = csgraph.dijkstra(csr_matrix((a, (u, v)), (n + 1, n + 1), dtype=np.int32),
                      False, s)
pb = csgraph.dijkstra(csr_matrix((b, (u, v)), (n + 1, n + 1), dtype=np.int32),
                      False, t)

dist = [int(pa[-1] + pb[-1])]
for i in range(n - 1, 0, -1):
    dist.append(min(dist[-1], int(pa[i] + pb[i])))

snuk = 10 ** 15
print(*(snuk - d for d in reversed(dist)), sep='\n')

### FIXED CODE ###

from heapq import heappop, heappush
n, m, s, t = map(int, input().split())
edge_a = [set() for _ in range(n + 1)]
edge_b = [set() for _ in range(n + 1)]
for _ in range(m):
    u, v, a, b = map(int, input().split())
    edge_a[u].add((v, a))
    edge_a[v].add((u, a))
    edge_b[u].add((v, b))
    edge_b[v].add((u, b))

def dijkstra(edge, s):
    sp = [10 ** 19] * (n + 1)
    sp[s] = 0
    q = [(0, s)]
    while q:
        dist, s = heappop(q)
        for t, w in edge[s]:
            if dist + w < sp[t]:
                sp[t] = dist + w
                heappush(q, (sp[t], t))
    return sp

sp_a = dijkstra(edge_a, s)
sp_b = dijkstra(edge_b, t)
dist = [int(sp_a[-1] + sp_b[-1])]
for i in range(n - 1, 0, -1):
    dist.append(min(dist[-1], int(sp_a[i] + sp_b[i])))

snuk = 10 ** 15
print(*(snuk - d for d in reversed(dist)), sep='\n')
### BUGGY CODE ###

from collections import deque
n = int(input())
tree = [[] for _ in range(n)]
edge = []
max_c = [0]*n
color = [set() for _ in range(n)]
ans = dict()
for i in range(n-1):
    a,b = map(int,input().split())
    edge.append([a,b])
    tree[a-1].append(b)
    tree[b-1].append(a)
    max_c[a-1] += 1
    max_c[b-1] += 1
print(max(max_c))

work_q = deque([])
visited = set()
work_q.append(1)
visited.add(1)
while work_q:
    here = work_q.popleft()
    for i in tree[here-1]:
        col = 1
        if i not in visited:
            work_q.append(i)
            visited.add(i)
            while col in color[here-1]:
                col += 1
            color[here-1].add(col)
            color[i-1].add(col)
            ans[(here-1,i-1)] = col
            col += 1

for i in range(n-1):
    print(ans[edge[i][0]-1,edge[i][1]-1])


### FIXED CODE ###

import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

n = int(input())
edge = [[] for _ in range(n+1)]
for i in range(n-1):
    a, b = map(int,input().split())
    edge[a].append((b, i))
    edge[b].append((a, i))
colors = 0
for i, line in enumerate(edge):
    colors = max(colors, len(line))
print(colors)
work_q = deque()
work_q.append((1, -1, -1))
color = [-1] * (n - 1)

while work_q:
    here, prev, col = work_q.popleft()
    cnt = 1
    for to, ind in edge[here]:
        if to == prev:
            continue
        if cnt == col:
            cnt += 1
        color[ind] = cnt
        work_q.append((to, here, cnt))
        cnt += 1
print(*color, sep="\n")
### BUGGY CODE ###

S = input()
li = list(S)
ans = 0
found = 1
while found != 0:
    found = 0
    for i in range(len(li)-1):
        if li[i] != li[i+1]:
            del li[i+1]
            del li[i]
            ans += 2
            found = 1
            break
print(ans)



### FIXED CODE ###

S = input()
no1 = S.count('1')
no0 = S.count('0')
print(len(S) - abs(no1 - no0))
### BUGGY CODE ###

N,Q = map(int, input().split())
S = input()
count = S.count("AC")
index = []
for i in range(count):
    if i == 0:
        index.append(S.find("AC"))
    else:
        index.append(S.find("AC", i + 1))

for i in range(Q):
    num = 0
    l, r = map(int, input().split())
    for j in index:
        if l-1 <= j <= r - 2:#indexnumberに揃えて, かつACの1番目のindex番号で判定
            num += 1
    print(num)

### FIXED CODE ###

import time
N,Q = map(int, input().split())
S = input()
AC = [0]*(N+1)

for i in range(N):
    if S[i:i+2] == "AC":
        AC[i+1] = AC[i] + 1
    else:
        AC[i+1] = AC[i]

for i in range(Q):
    l, r = map(int, input().split())
    print(AC[r-1] - AC[l-1])
### BUGGY CODE ###

import queue
import sys
input = sys.stdin.readline
def main():
    q = queue.Queue()
    h,w=map(int,input().split())
    a=[list(input()) for i in range(h)]
    x=[[-1,0],[1,0],[0,-1],[0,1]]
    for i in range(h):
        for j in range(w):
            if a[i][j]=="#":
                for k in x:
                    if 0<=i+k[0]<h and 0<=j+k[1]<w and a[i+k[0]][j+k[1]]==".":
                        q.put([i+k[0],j+k[1],1])
    ans=0
    while not q.empty():
        v=q.get()
        for k in x:
            if 0<=v[0]+k[0]<h and 0<=v[1]+k[1]<w and a[v[0]+k[0]][v[1]+k[1]]==".":
                q.put([v[0]+k[0],v[1]+k[1],v[2]+1])
                ans=v[2]+1
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque 
import sys
input = sys.stdin.readline
def main():
    q = deque([])
    h,w=map(int,input().split())
    a=[list(input()) for i in range(h)]
    x=[[-1,0],[1,0],[0,-1],[0,1]]
    for i in range(h):
        for j in range(w):
            if a[i][j]=="#":
                for k in x:
                    if 0<=i+k[0]<h and 0<=j+k[1]<w and a[i+k[0]][j+k[1]]==".":
                        a[i+k[0]][j+k[1]]="0"
                        q.append([i+k[0],j+k[1],1])
    ans=0
    while q:
        v=q.popleft()
        for k in x:
            if 0<=v[0]+k[0]<h and 0<=v[1]+k[1]<w and a[v[0]+k[0]][v[1]+k[1]]==".":
                a[v[0]+k[0]][v[1]+k[1]]="0"
                q.append([v[0]+k[0],v[1]+k[1],v[2]+1])
                ans=v[2]+1
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import bisect

N=int(input())
D=sorted([int(i) for i in input().split()])
D.append(10**10)
M=int(input())
T=[int(i) for i in input().split()]

for t in T:
    bl=bisect.bisect_left(D,t)
    if D[bl]==t:
        del D[bl]
    else:
        print('NO')
        exit()
print('YES')

### FIXED CODE ###

from collections import defaultdict

N=int(input())
d = defaultdict(int)
for D in input().split():
    d[int(D)]+=1
M=int(input())
T=[int(i) for i in input().split()]

for t in T:
    if d[t]>=1:
        d[t]-=1
    else:
        print('NO')
        exit()
print('YES')
### BUGGY CODE ###

import sys
n,m=map(int,input().split())
a=list(map(int,sys.stdin))
dp=[0]*(n+1)
dp[0]=1
if 1 not in a:dp[1]=1
for i in range(2,n+1):
    if i in a:continue
    if dp[i-1]==dp[i-2]==0:break
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])

### FIXED CODE ###

import sys
n,m=map(int,input().split())
a=set(map(int,sys.stdin))
dp=[0]*(n+1)
dp[0]=1
if 1 not in a:dp[1]=1
for i in range(2,n+1):
    if i in a:continue
    if dp[i-1]==dp[i-2]==0:break
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])
### BUGGY CODE ###

def pow(x, n, mod):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x % mod
    x = x*x % mod
    n = n >> 1
  return ans

def kaijou_k(n, k, mod):
    a = 1
    for i in range(k, n+1):
        a *= i % mod
    return a

def main():
    n, a, b = map(int, input().split())
    mod = 10**9 +7
    allsum = pow(2, n, mod)-1
    abunbo = kaijou_k(n, n-a+1, mod)
    abunsi = kaijou_k(a, 1, mod)
    asum = abunbo * pow(abunsi, mod-2, mod) % mod
    bbunbo = kaijou_k(n, n-b+1, mod)
    bbunsi = kaijou_k(b, 1, mod)
    bsum = bbunbo * pow(bbunsi, mod-2, mod) % mod
    ans = allsum - asum - bsum
    print(ans)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def pow(x, n, mod):
  ans = 1
  while(n > 0):
    if(bin(n & 1) == bin(1)):
      ans = ans*x % mod
    x = x*x % mod
    n = n >> 1
  return ans

def kaijou_k(n, k, mod):
    a = 1
    for i in range(k, n+1):
        a *= i
        a %= mod
    return a %mod

def main():
    n, a, b = map(int, input().split())
    mod = 10**9 +7
    allsum = pow(2, n, mod)-1
    abunbo = kaijou_k(n, n-a+1, mod)
    abunsi = kaijou_k(a, 1, mod)
    asum = abunbo * pow(abunsi, mod-2, mod) % mod
    bbunbo = kaijou_k(n, n-b+1, mod)
    bbunsi = kaijou_k(b, 1, mod)
    bsum = bbunbo * pow(bbunsi, mod-2, mod) % mod
    ans = (allsum - asum - bsum) % mod
    print(ans)

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

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

MOD = 10 ** 9 + 7

NM = N * M

fact = [1 for _ in range(NM+1)]
for i in range(1, NM+1):
    fact[i] = fact[i-1] * i

def combination(n, m):
    return fact[n] // fact[n-m] //fact[m]

pattern = combination(NM-2, K-2) % MOD

def diff_x_pattern(val):
    # for d in range(1, val):
    #     ret += (val - d) * d
    return val * (val - 1) * val // 2 - (val - 1) * (2 * val - 1) * val // 6

ans = M * M * diff_x_pattern(N)
ans += N * N * diff_x_pattern(M)
print((ans*pattern)%MOD)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7

def combination(n, m):
    c = 1
    m = min(n-m, m)
    for i in range(m):
        c = c * (n-i) * pow(m-i, MOD-2, MOD) % MOD
    return c

pattern = combination(N*M-2, K-2)

def diff_x_pattern(val):
    ret = 0
    for d in range(1, val):
        ret += ((val - d) * d) % MOD
    return ret

ans = (M * M * diff_x_pattern(N)) % MOD
ans += (N * N * diff_x_pattern(M)) % MOD
print((ans*pattern)%MOD)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
cnt = 0
while True:
    i = 0
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] /=2
            i += 1
        else:
            i += 1
            break
print(cnt)


### FIXED CODE ###

N = input()
A = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in A):
    A = [int(j / 2) for j in A]
    cnt += 1
print(cnt)
### BUGGY CODE ###


def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

def isOK(index,key,li):
    if li[index] >= key:
        #不等号にイコールを入れないとokはliの中でkey以下の数字がいくつあるかを表し、
        #ここの不等号にイコールを入れると
        #okはliの中でkey未満の数字がいくつあるかを表すようになる
        return True
    else:
        return False
def binary_search(key,li):
    ng = -1
    ok = len(li)
    while abs(ok - ng) > 1:
        mid = ok + ng //2
        if isOK(mid,key,li):
            ok = mid
        else:
            ng = mid
    return ok
    #liはsortしておくことに注意


n = I()
a_li = sorted(LI())
b_li = sorted(LI())
c_li= sorted(LI())
ans = 0
for i in range(n):
    C = c_li[i]
    k = binary_search(C,b_li)
    for j in range(k):
        B = b_li[j]
        l = binary_search(B,a_li)
        ans += l
print(ans)


### FIXED CODE ###

import bisect

def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！
n = I()
a_li = sorted(LI())
b_li = sorted(LI())
c_li= sorted(LI())
ans = 0
for i in range(n):
  B = b_li[i]
  k = n - bisect.bisect_right(c_li,B)
  l = bisect.bisect_left(a_li,B)
  ans += k*l
print(ans)
### BUGGY CODE ###

from sys import stdin
from collections import deque


class BFS():
    def __init__(self, grid_graph):
        # grid表現
        self.graph = grid_graph
        self.H = len(self.graph)
        self.W = len(self.graph[0])
        # 始点からの距離
        self.dist = [[-1]*self.W for i in range(self.H)]
        # キュー
        self.que = deque()

    def bfs(self, sv_arr):
        dx = [ 1, 0,-1, 0]
        dy = [ 0, 1, 0,-1]

        # 初期条件(0-indexed)
        for sv in sv_arr:
            self.dist[sv[0]][sv[1]] = 0
            self.que.append(sv)

        while len(self.que)>0:
            v = self.que.popleft()
            for _dx, _dy in zip(dx,dy):
                nv = [v[0]+_dx,v[1]+_dy]
                if 0<=nv[0]<self.H and 0<=nv[1]<self.W:
                    if self.dist[nv[0]][nv[1]] != -1:
                        continue
                    self.dist[nv[0]][nv[1]] = self.dist[v[0]][v[1]] + 1
                    self.que.append(nv)


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    H, W = list(map(int,_in[0].split(' ')))  # type:list(int)
    graph = []
    for i in range(H):
        _ = list(_in[i+1])  # type:list(str)
        graph.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    bfs = BFS(graph)

    sv_arr = []
    for i in range(H):
        for j in range(W):
            if graph[i][j] == '#':
                sv_arr.append([i,j])
    bfs.bfs(sv_arr)
    cnt = max(sum(bfs.dist,[]))
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


### FIXED CODE ###

from sys import stdin
from collections import deque


class BFS():
    def __init__(self, grid_graph):
        # grid表現
        self.graph = grid_graph
        self.H = len(self.graph)
        self.W = len(self.graph[0])
        # 始点からの距離
        self.dist = [[-1]*self.W for i in range(self.H)]
        # キュー
        self.que = deque()

    def bfs(self, sv_arr):
        dx = [ 1, 0,-1, 0]
        dy = [ 0, 1, 0,-1]

        # 初期条件(0-indexed)
        for sv in sv_arr:
            self.dist[sv[0]][sv[1]] = 0
            self.que.append(sv)

        while self.que:
            v = self.que.popleft()
            for _dx, _dy in zip(dx,dy):
                nv = [v[0]+_dx,v[1]+_dy]
                if not 0<=nv[0]<self.H: continue 
                if not 0<=nv[1]<self.W: continue
                if self.dist[nv[0]][nv[1]] != -1: continue
                self.dist[nv[0]][nv[1]] = self.dist[v[0]][v[1]] + 1
                self.que.append(nv)


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    H, W = list(map(int,_in[0].split(' ')))  # type:list(int)
    graph = []
    for i in range(H):
        _ = list(_in[i+1])  # type:list(str)
        graph.append(_)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    bfs = BFS(graph)

    sv_arr = []
    for i in range(H):
        for j in range(W):
            if bfs.graph[i][j] == '#':
                sv_arr.append([i,j])

    bfs.bfs(sv_arr)
    cnt = max(max(_) for _ in bfs.dist)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


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

from functools import reduce

n = int(input())
a = [int(_) for _ in input().split()]
#mul = 0

#for i in range(n):
mul = reduce(lambda x,y: x*y, a)

if mul>10**18:
  mul = -1


print(mul)

### FIXED CODE ###

n = int(input())
a = [int(_) for _ in input().split()]

if 0 in a:
  print(0)
  exit()

mul = 1
for i in a:
  mul *= i
  if mul > 10**18:
    print(-1)
    exit()

print(mul)
### BUGGY CODE ###

import numpy as np

N = int(input())
X = str(input())
num_one = X.count("1")

dp = [-1] * N
dp[0] = 0
def dfs(n):
    if dp[n] == -1:
        dp[n] = 1 + dfs(n % bin(n).count('1'))
    return dp[n]

num_one = X.count("1")
zero_ver = np.array([pow(2,  i, num_one + 1) for i in range(N)])
one_ver = np.array([-1])
if num_one != 1:
    one_ver = np.array([pow(2,  i, num_one - 1) for i in range(N)])
bool_arr = np.array([True if X[N-i-1] == "1" else False for i in range(N)])
for i in range(1,N+1):
    tmp_bool = bool_arr.copy()
    start = 0
    if tmp_bool[N-i] == False:
        tmp_bool[N-i] = True
        start = sum(zero_ver[tmp_bool]) % (num_one + 1)
        print(dfs(start)+1)
    else:
        if sum(one_ver) == -1:
            print(0)
        else:
            tmp_bool[N-i] = False
            start = sum(one_ver[tmp_bool]) %  (num_one - 1)
            print(dfs(start)+1)


### FIXED CODE ###

import numpy as np

N = int(input())
X = str(input())
num_one = X.count("1")

dp = [-1] * N
dp[0] = 0
def dfs(n):
    if dp[n] == -1:
        dp[n] = 1 + dfs(n % bin(n).count('1'))
    return dp[n]

num_one = X.count("1")
bool_arr = np.array([True if X[N-i-1] == "1" else False for i in range(N)])
zero_ver = np.array([pow(2,  i, num_one + 1) for i in range(N)])
zero_ver_sum = sum(zero_ver[bool_arr])

one_ver = -1
one_ver_sum = 0
flag = False
if num_one != 1:
    one_ver = np.array([pow(2,  i, num_one - 1) for i in range(N)])
    one_ver_sum = sum(one_ver[bool_arr])
else:
    flag = True
for i in range(1,N+1):
    start = 0
    if bool_arr[N-i] == False:
        start = (zero_ver_sum + pow(2, N - i, num_one + 1)) % (num_one + 1)
        print(dfs(start)+1)
    else:
        if flag:
            print(0)
        else:
            start = (one_ver_sum - pow(2, N - i, num_one - 1))  %  (num_one - 1)
            print(dfs(start)+1)
### BUGGY CODE ###

K = int(input())
gcd = lambda a,b : a if b == 0 else gcd(b, a % b)
r = range(1,K+1)
print(sum(gcd(gcd(a,b),c)for a in r for b in r for c in r))

### FIXED CODE ###

from math import gcd
K = int(input())
r = range(1,K+1)
print(sum(gcd(gcd(a,b),c)for a in r for b in r for c in r))
### BUGGY CODE ###

N = int(input())

for n in range(1, N+1):
    s = n//5
    cnt = 0
    flag = 0
    f2 = 0
    for x in range(1, s+1):
        for y in range(x, s+1):
            for z in range(y, s+1):
                siki = x**2 + y**2 + z**2 + x*y + y*z + z*x

                if siki == n:
                    # print('ans = ', siki)
                    if (x==y)and(y==z):
                        cnt += 1
                    elif (x!=y)and(y!=z):
                        cnt += 6
                    else:
                        cnt += 3
                # elif siki > n:
                    flag = 1
                    break
                elif siki > n:
                    f2 += 1
                    # print('fs= ', f2)
                    # print('x,y,z= ',x,y,z)
                    break

            if flag or f2==2:
                break
        if flag or f2==3:
            break
    print(cnt)

### FIXED CODE ###

n=int(input())

ans=[0]*(n+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1

for i in range(1,n+1):
    print(ans[i])
### BUGGY CODE ###


if __name__ == '__main__':
    N=int(input())
    sheet=[]
    for i in range(N):
        temp=int(input())
        sheet.append(temp)

    sheet.sort()
    count=0
    for i in range(len(sheet)):
        number=sheet.count(sheet[i])
        if number%2==1:
            count+=1

    print(count)

### FIXED CODE ###


if __name__ == '__main__':
    N=int(input())
    sheet=[]
    for i in range(N):
        temp=int(input())
        sheet.append(temp)
    sheet.sort()
    count=0
    i=0
    while i<N:
        s=sheet[i]
        j=i
        while i<N and sheet[i]==s:
            i+=1
        d=i-j
        if d%2==1:
            count+=1

    print(count)
### BUGGY CODE ###

N = int(input())
sum = 0
A = list(map(int,input().split()))
Asum = 1
flag = 0
for i in A:
    Asum = Asum * int(i)
if Asum > 10**18:
    flag = 1

if flag == 0 :
    print(Asum)
else:
    print(-1)

### FIXED CODE ###

import sys
N = int(input())
sum = 0
A = list(map(int,input().split()))
flag = 0
if 0 in A:
    print(0)
    sys.exit()
Asum = 1
for i in A:
    Asum = Asum * int(i)
    if Asum > 10**18:
        flag = 1
        break

if flag == 0 :
    print(Asum)
else:
    print(-1)