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

n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else: 
    x=1
    while x>0:
        c=sorted(b)
        if c[1]%c[0]!=0:
            c[1]=c[1]%c[0]
        else:
            c[1]=c[0]
        c=sorted(list(set(c)))
        if c[0]==1:
            x=0
        if len(c)==1:
            print(2)
            exit()
print(1)
            
    




### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(set(a))   
if len(b)==1:
    print(b[0])
    exit()
else:
    c=sorted(b)
    x=1
    while x>0:
        v=c[0]
        for i in range(len(c)):
            if i!=0:
                c[i]=c[i]%v
        while 0 in c:
            c.remove(0)
        c=sorted(list(set(c)))
        if len(c)==1:
            print(c[0])
            exit()
        if c[0]==1:
            x=0
print(1)
### BUGGY CODE ###

s = raw_input()
t = raw_input()
p, e, n = 0, 1, len(s)
ss = set(s)
for tt in t:
    q = p % n
    if not tt in ss:
        e = 0
        break
    if tt in s[q:]: p += s[q:].index(tt) + 1 
    else:   p += s.index(tt) + len(s[q:]) + 1
print((p+1)*e-1)

### FIXED CODE ###

import sys
import collections
import bisect
s = raw_input()
t = raw_input()
p, e, n = 0, 1, len(s)
ss = set(s)
idx = collections.defaultdict(list)
for i in xrange(n):
    idx[s[i]].append(i)
# print(idx)
for tt in t:
    q = p % n
    if not tt in idx:
        e = 0
        break
    indexs = idx[tt]
    # print(bisect.bisect(indexs, q), indexs)
    res = bisect.bisect_left(indexs, q)
    p += indexs[res] - q + 1 if res < len(indexs) else -q + n + indexs[0] + 1
print((p+1)*e-1)
### BUGGY CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
m = sorted(h,reverse=True)
if n <= k:
  print(0)
  exit()
for i in range(k):
  m.pop(0)
print(sum(m))

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
m = sorted(h,reverse=True)
if n <= k:
  print(0)
  exit()

q = sum(m[k:n])
print(q)
### BUGGY CODE ###

import re


def solve(ms):
    ans = 0
    rpc = 1
    while rpc > 0:
        r = re.subn('BW', 'WB', ms)
        rpc = r[1]
        ans = ans + rpc
        ms = r[0]
    return ans


print(solve(input()))

### FIXED CODE ###

def solve(s):
    ans = 0
    d = 0
    sl = len(s)
    for i in range(sl):
        if s[i] == "B":
            ans = ans + (sl - i - 1 - d)
            d = d + 1
    return ans


print(solve(input()))
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

s = input()
K = INT()


substr = []

for l in range(len(s)):
	r = l+1
	while r < len(s)+1:
		#print(l, r, substr)
		if bisect(substr, s[l:r]) == 5:
			break
		elif s[l:r] not in substr:
			insort(substr, s[l:r])
			substr = substr[:5]
			if s[l:r] in substr:
				r += 1

		if r == l+1:
			r += 1

#print(substr)
print(substr[K-1])


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

s = input()
K = INT()


substr = []

for l in range(len(s)):
	r = l+1
	while r < len(s)+1:
		#print(l, r, substr)
		if bisect(substr, s[l:r]) == 5:
			break
		elif s[l:r] in substr:
			r += 1
		elif s[l:r] not in substr:
			insort(substr, s[l:r])
			substr = substr[:5]
			if s[l:r] in substr:
				r += 1


#print(substr)
print(substr[K-1])
### BUGGY CODE ###

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

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

a = sorted(a)
max_a = a[-1]
left_med_a = a[n//2-1]
right_med_a = a[n//2]

if cmb(max_a, left_med_a) < cmb(max_a, right_med_a):
    print(max_a, right_med_a)
else:
    print(max_a, left_med_a)

### FIXED CODE ###

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

a = sorted(a)
max_a = a[-1]
max_a_harf = (max_a+1) // 2

ans = 0
for i in range(n):
    if abs(max_a_harf - a[i]) < abs(max_a_harf - ans):
        ans = a[i]

print(max_a, ans)
### BUGGY CODE ###

#https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e
def BF(p,n,s):
    inf=float("inf")
    d=[inf for i in range(n)]
    d[s-1]=0
    for i in range(2*n+1):
        for e in p:
            if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
                d[e[1]-1] = d[e[0]-1] + e[2]
        if i==2*n-1:t=d[-1]
        if i==2*n and t!=d[-1]:
            return [0,'inf']
    return list(map(lambda x:-x, d))

n,m,p=map(int,input().split())
g=[]
for _ in range(m):
  a,b,c=map(int,input().split())
  g.append([a,b,-(c-p)])
g.append([n,n+1,0])
ans=BF(g,n+1,1)[-1]
if ans=='inf':
  print(-1)
else:
  print(max(ans,0))

### FIXED CODE ###

#https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e
def BF(p,n,s):
    inf=float("inf")
    d=[inf for i in range(n)]
    d[s-1]=0
    for i in range(n+1):
        for e in p:
            if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
                d[e[1]-1] = d[e[0]-1] + e[2]
    ans1=d[-1]
    for i in range(n+1):
        for e in p:
            if e[0]!=inf and d[e[1]-1]>d[e[0]-1]+e[2]:
                d[e[1]-1] = d[e[0]-1] + e[2]
    ans2=d[-1]
    if ans1>ans2:
      return ['inf']
    else:
      return [-ans1]
n,m,p=map(int,input().split())
g=[]
for _ in range(m):
  a,b,c=map(int,input().split())
  g.append([a,b,-(c-p)])
g.append([n,n+1,0])
ans=BF(g,n+1,1)[-1]
if ans=='inf':
  print(-1)
else:
  print(max(ans,0))
### BUGGY CODE ###

s = input()
s = s[::-1]
lis = ['remaerd', 'resare', 'esare', 'maerd']
i = 0
j = 0
#s = s[::-1]
while i < len(s):
    while True:
        #print(s[i : j])
        if len(s[i : j]) == 8:
            print('NO')
            #quit()
        elif s[i : j] in lis:
            i = j
            j = i + 5
            break
        else:
            j += 1
print('YES')


### FIXED CODE ###

s = input()
s = s[::-1]
lis = ['remaerd', 'resare', 'esare', 'maerd']
i = 0
j = 0
#s = s[::-1]
while i < len(s):
    tmp = ''
    while j < len(s):
        tmp += s[j]
        #print(tmp)
        if len(tmp) == 8:
            print('NO')
            quit()
        elif tmp in lis:
            i = j + 1
            j = i
            break
        else:
            j += 1
print('YES')
### BUGGY CODE ###

n = int(input())
s = input()

res = float("inf")

for i in range(n):
    tmp_res = 0
    tmp = s[:i]
    tmptmp = s[i+1:]
    tmp_res += tmp.count("W")
    tmp_res += tmptmp.count("E")

    if tmp_res < res:
        res = tmp_res

print(res)



### FIXED CODE ###

import collections

n = int(input())
s = input()
s_w = s.count("W")
s_e = s.count("E")

w_array = [0 for x in range(n)]
e_array = [0 for x in range(n)]
w_tmp = 0
e_tmp = 0

for i in range(n):
    if s[i] == "W":
        w_tmp += 1
    else:
        e_tmp += 1
    w_array[i] += w_tmp
    e_array[i] += s_e - e_tmp

res = min(s[1:].count("E"), s[:-1].count("W"))

for count in range(1, n-1):
    if w_array[count]+e_array[count+1] < res:
        res = w_array[count]+e_array[count]

print(res)
### BUGGY CODE ###

n,w=map(int,input().split())
load=[list(map(int,input().split())) for i in range(n)]
dp=[[0 for i in range(w+1)]for j in range(n)]

for i in range(n):
  for j in range(w+1):
    if i==0:
      if j<load[i][0]:
        dp[i][j]=0
      else:
        dp[i][j]=load[i][1]
    else:
      if j<load[i][0]:
        dp[i][j]=dp[i-1][j]
      else:
        dp[i][j]=max(dp[i-1][j-load[i][0]]+load[i][1],dp[i-1][j])
print(dp[-1][-1])

### FIXED CODE ###

import numpy as np
n,W,*wv=map(int,open(0).read().split())
w=np.array(wv[::2])
v=np.array(wv[1::2])
dp=np.zeros([n+1,W+1],dtype=int)
for i in range(1,n+1):
  now=np.zeros(W+1,dtype=int)
  now[w[i-1]:]=dp[i-1][:-w[i-1]]+v[i-1]
  dp[i]=np.maximum(dp[i-1],now)
print(dp[-1][-1])
### BUGGY CODE ###

from heapq import heapify, heappush, heappop

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    h = a.copy()
    heapify(h)
    for _ in range(n):
        h_a = heappop(h)
        print(a.index(h_a)+1, end=' ')

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = [None] * n
    for idx, ea in enumerate(a):
        ans[ea-1] = idx+1
    print(*ans)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
X = int(input())
P = [2]
if X == 2:
    print(2)

    sys.exit()
for i in range(3, 10**6):
    for l in range(len(P)):
        if i % P[l] == 0:
            break
        elif l == len(P)-1 and i >= X:
            print(i)
            sys.exit()
        elif l == len(P)-1:
            P.append(i)


### FIXED CODE ###

import sys
X = int(input())
P = [2]
if X == 2:
    print(2)

    sys.exit()
for i in range(3, 10**6):
    for l in range(len(P)):
        if i % P[l] == 0:
            break
        elif l == len(P)-1 and i >= X:
            print(i)
            sys.exit()
        elif l == len(P)-1:
            P.append(i)
### BUGGY CODE ###

n, m = input().split()
n = int(n)
m = int(m)
 
result_list = []
for i in range(m):
    a,b=input().split()
    result_list.append((int(a), b))
 
# 正解した問題を入れるlist
done_list = []
pn_list = [0] * n
correct = 0
pn = 0
 
 
for result in result_list:
    if result[0] in done_list:
        pass
    elif result[1] == "WA":
        pn_list[result[0] - 1] += 1

    elif result[1] == "AC":
        done_list.append(result[0])
        correct += 1
        pn += pn_list[result[0] - 1]
    if len(done_list) == n:
        break
 
print(correct, pn)

### FIXED CODE ###

n, m = input().split()
n = int(n)
m = int(m)

# 正解した問題を入れるlist

correct = 0
pn = 0
done_list = [0] * n
pn_list = [0] * n

for i in range(m):
    a,b=input().split()
    
    if done_list[int(a)-1] == 0 and b == "AC":
        done_list[int(a)-1] += 1
        correct += 1
        pn += pn_list[int(a) - 1]
    elif b == "WA":
        pn_list[int(a) - 1] += 1

print(correct, pn)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
for i in range(n):
  t=0
  for k,v in c.items():
    if k==a[i]:
      v-=1
    t+=v*(v-1)//2
  print(t)

### FIXED CODE ###

# ABC159_D
from collections import defaultdict as dd
n=int(input())
a=list(map(int,input().split()))
d=dd(int)
for aa in a:
    d[aa]+=1
a_sum=0
for k,v in d.items():
    # if v>=2:
    a_sum+=v*(v-1)//2

for i,aa in enumerate(a):
    s=a_sum
    t=d[a[i]]
    s-=t*(t-1)//2
    t-=1
    s+=t*(t-1)//2
    print(s)
# for k,v in d.items()
### BUGGY CODE ###

from bisect import bisect_right, bisect_left
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
li_a.sort()
li_b.sort()
li_c.sort()
relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
for i in range(n):
    i += 1
    j = li_b[(-1)*i]
    k = bisect_right(li_c, j)
    relation_bc.append(len(li_c)-k)
ans = 0
for i in li_a:
    p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
    p = n - p
    if p >= 1:
        s = 0
        for j in range(p):
            s += relation_bc[j]
        ans += s
    else:
        continue
print(ans)

### FIXED CODE ###

from bisect import bisect_right, bisect_left
from itertools import accumulate
n = int(input())
li_a = list(map(int, input().split()))
li_b = list(map(int, input().split()))
li_c = list(map(int, input().split()))
li_a.sort()
li_b.sort()
li_c.sort()
relation_bc = [] #relation_bc[i] : 大きい方からi番目のbより大きいcがいくつあるか
for i in range(n):
    i += 1
    j = li_b[(-1)*i]
    k = bisect_right(li_c, j)
    relation_bc.append(len(li_c)-k)
ans = 0
li = list(accumulate(relation_bc))
for i in li_a:
    p = bisect_right(li_b, i) # i より大きいbがいくつあるか調べる
    p = n - p
    if p >= 1:
        ans += li[p-1]
    else:
        continue
print(ans)
### BUGGY CODE ###

def f(k, A):
    n = len(A)
    dp = [ [0] * (k+1) for _ in range(n) ]

    # init for last column
    for j in range(min(A[n - 1] + 1, k + 1)):
        dp[n - 1][j] = 1

    for i in range(n - 2, -1, -1):
        kount = 0
        for j in range(k + 1):
            # dp[i][j] = SUM dp[i - 1][ ...A[i] items before j...]
            # start = j - A[i]
            # if start < 0:
            #     start = 0
            # X = dp[i + 1][start:j + 1]
            # count = sum(X)
            kount += dp[i+1][j]
            if j > A[i]:
                kount -= dp[i+1][j - A[i] - 1]
#            assert kount == count
            assert dp[i][j] == 0
            dp[i][j] = kount

    return dp[0][-1] % 1000000007

assert f(4, [2, 3]) == 2
assert f(4, [1, 2, 3]) == 5
assert f(10, [9]) == 0
assert f(0, [0, 0]) == 1
assert f(100000, [100000, 100000, 100000, 100000]) == 665683269

n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = f(k, A)
print(ans)


### FIXED CODE ###

from itertools import accumulate

def f(k, A):
    n = len(A)

    mod = int(1e9 + 7)
    dp = [0] * (k + 1)

    # init for last column
    for j in range(min(A[n - 1], k) + 1):
        dp[j] = 1

    for i in range(n - 2, -1, -1):
        dp = list(accumulate(dp))
        a = A[i]
        dp[a+1:] = [x - y for x, y in zip(dp[a + 1:], dp)]
        dp = [x % mod for x in dp]

    return dp[-1] % mod

assert f(4, [2, 3]) == 2
assert f(4, [1, 2, 3]) == 5
assert f(10, [9]) == 0
assert f(0, [0, 0]) == 1
assert f(100000, [100000, 100000, 100000, 100000]) == 665683269

n, k = map(int, input().split())
A = list(map(int, input().split()))
ans = f(k, A)
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
n = int(sys.stdin.readline())
a = [int(x) for x in sys.stdin.readline().split()]
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
b_str = list(map(str, b))
print(" ".join(b_str))

### FIXED CODE ###

import sys
n = int(sys.stdin.readline())
a = [x for x in sys.stdin.readline().split()]
b = [a[i] for i in range(n) if i % 2 != 0]
rb = b[::-1]
c = [a[i] for i in range(n) if i % 2 == 0]
rc = c[::-1]

if n % 2 == 0:
    ans = rb + c
else:
    ans = rc + b

ans = " ".join(ans)
print(ans)
### BUGGY CODE ###

# Import
from collections import deque
import math

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class ModInt:
    def __init__(self, n, MOD):
        self.n = n
        self.MOD = MOD
    
    def __add__(self, o):
        return ModInt((self.n + o.n) % self.MOD, self.MOD)

    def __sub__(self, o):
        return ModInt((self.n - o.n + self.MOD) % self.MOD, self.MOD)

    def __mul__(self, o):
        return ModInt((self.n * o.n) % self.MOD, self.MOD)

    def __iadd__(self, o):
        self.n = (self.n + o.n) % self.MOD
        return self

    def __isub__(self, o):
        self.n = (self.n - o.n + self.MOD) % self.MOD
        return self

    def __imul__(self, o):
        self.n = (self.n * o.n) % self.MOD
        return self

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

MOD = 998244353
N, S = read_tupple()
A = read_array()

dp = [[ModInt(0, MOD) for j in range(S+1)] for i in range(N+1)]
dp[0][0] = ModInt(1, MOD)
for i in range(N):
    for j in range(S+1):
        dp[i + 1][j] += ModInt(2, MOD) * dp[i][j]
        if j - A[i] >= 0:
            dp[i + 1][j] += dp[i][j - A[i]]
print(dp[N][S])

### FIXED CODE ###

# Import
from collections import deque
import math

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return [type(i) for i in input().split()]
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
# class ModInt:
#     def __init__(self, n, MOD):
#         self.n = n
#         self.MOD = MOD
    
#     def __add__(self, o):
#         return ModInt((self.n + o.n) % self.MOD, self.MOD)

#     def __sub__(self, o):
#         return ModInt((self.n - o.n + self.MOD) % self.MOD, self.MOD)

#     def __mul__(self, o):
#         return ModInt((self.n * o.n) % self.MOD, self.MOD)

#     def __iadd__(self, o):
#         self.n = (self.n + o.n) % self.MOD
#         return self

#     def __isub__(self, o):
#         self.n = (self.n - o.n + self.MOD) % self.MOD
#         return self

#     def __imul__(self, o):
#         self.n = (self.n * o.n) % self.MOD
#         return self

#     def __str__(self): return str(self.n)

MOD = 998244353
N, S = read_tupple()
A = read_array()

dp = [[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(S+1):
        dp[i + 1][j] = (dp[i + 1][j] + 2 * dp[i][j]) % MOD
        if j - A[i] >= 0:
            dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - A[i]]) % MOD
print(dp[N][S])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, K = map(int, input().rstrip().split())
*h, = map(int, input().rstrip().split())
dp = [0] + [float('inf')]*(N-1)
for j in range(1,N):
    for i in range(max(0,j-K),j):
        dp[j] = min(dp[j],dp[i] + abs(h[j]-h[i]))
        # print("j -> {} || i -> {} || dp -> {} || h[j] -> {} || h[i] -> {}".format(j, i, dp, h[j], h[i]))
print(dp[-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = map(int, input().rstrip().split())
*h, = map(int, input().rstrip().split())
dp = [0] + [float('inf')]*(N-1)
for j in range(1,N):
    for i in range(max(0,j-K),j):
        dp[j] = min(dp[j],dp[i] + abs(h[j]-h[i]))
        # print("j -> {} || i -> {} || dp -> {} || h[j] -> {} || h[i] -> {}".format(j, i, dp, h[j], h[i]))
print(dp[-1])
### BUGGY CODE ###

n = int(input())
li = list(map(int, input().split()))
ans = 0

for a, aa in enumerate(li):
  if a < n - 2:
    for b, bb in enumerate(li[a+1:]):
      for c, cc in enumerate(li[a+1+b+1:]):
        if aa < bb + cc and bb < cc + aa and cc < aa + bb:
          ans += 1
            
print(ans)

### FIXED CODE ###

import bisect

n = int(input())
li = list(map(int, input().split()))
ans = 0

li.sort()

for i in range(n):
  for j in range(i+1, n):
    cnt = bisect.bisect_left(li, li[i]+li[j])
    ans += cnt - j - 1
            
print(ans)
### BUGGY CODE ###

n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
 
dp = [float('inf')]*n
 
for i in range(n):
  if i == 0:
    dp[0] = 0
    continue
    
  for j in range(0 if i-k < 0 else i-k,i):
    dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
  
  
print(dp[n-1])

### FIXED CODE ###

n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
 
dp = [float('inf')]*n
 
for i in range(n):
  if i == 0:
    dp[0] = 0
    continue
    
  for j in range(0 if i-k < 0 else i-k,i):
    dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
  
  
print(dp[n-1])
### BUGGY CODE ###

import math
N=int(input())

for i in range(1,N+1):
  n_max=math.ceil(math.sqrt(i))
  res=0
  for x in range(1,n_max+1):
    for y in range(1,n_max+1):
      for z in range(1,n_max+1):
        if x*x+y*y+z*z+x*y+y*z+z*x==i:
          res+=1
  print(res)

### FIXED CODE ###

import math
N=int(input())


n_max=math.ceil(math.sqrt(N))
res=[0]*(N+1)

for x in range(1,n_max+1):
  for y in range(1,n_max+1):
    for z in range(1,n_max+1):
      v=x*x+y*y+z*z+x*y+y*z+z*x
      if v <= N:
        res[v]+=1

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

N=int(input())
Sister=[int(input()) for i in range(N)]
set_Sister=set(Sister)
Paper=[]
for i in set_Sister:
  if Sister.count(i)%2==1:
    Paper.append(i)
print(len(Paper))

### FIXED CODE ###

N=int(input())
Sister={}
Paper=0
for i in range(N):
  index=int(input())
  if index not in Sister:
    Sister[index]=1
  else:
    Sister[index]+=1
for i in Sister:
  if Sister[i]%2==1:
    Paper+=1
print(Paper)
### BUGGY CODE ###

n,c=map(int,input().split())
d=[list(map(int,input().split()))for _ in range(c)]
l=[[i for i in[0]*c]for _ in range(3)]
for i in range(n):
  t=list(map(int,input().split()))
  for j in range(n):
    l[(i+j)%3][t[j]-1]+=1
c=10**18
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or k==i:continue
      c=min(c,sum(d[x][i]*l[0][x]+d[x][j]*l[1][x]+d[x][k]*l[2][x]for x in range(c)))
print(c)

### FIXED CODE ###

n,c=map(int,input().split())
d=[list(map(int,input().split()))for _ in range(c)]
l=[[i for i in[0]*c]for _ in range(3)]
for i in range(n):
  t=list(map(int,input().split()))
  for j in range(n):
    l[(i+j)%3][t[j]-1]+=1
a=10**18
for i in range(c):
  for j in range(c):
    for k in range(c):
      if i==j or j==k or k==i:continue
      a=min(a,sum(d[x][i]*l[0][x]+d[x][j]*l[1][x]+d[x][k]*l[2][x]for x in range(c)))
print(a)
### BUGGY CODE ###

import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

ans = [A[0]]
# print(ans)

for a in A[1:]:
    if a <= ans[0]:  # 色を増やすしかない
        ans.append(a)
        ans.sort()
    else:  # 既存の色のどこかに追加
        idx = bisect.bisect_left(ans, a)
        ans[idx-1] = a
    # print(a, ans)

# print(ans)
print(len(ans))


### FIXED CODE ###

import bisect
import collections

N = int(input())
A = [int(input()) for _ in range(N)]

ans = collections.deque([A[0]])

for a in A[1:]:
    if a <= ans[0]:  # 色を増やすしかない
        ans.appendleft(a)
    else:  # 既存の色のどこかに追加
        idx = bisect.bisect_left(ans, a)
        ans[idx-1] = a
    # print(a, ans)

# print(ans)
print(len(ans))