Harryxun/stf_run huggingface dataset:
import math
n=int(input())
a=[int(i) for i in input().split()]

class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x,y : math.gcd(x,y), default=0):
        self.size = 2**(size-1).bit_length() # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2) # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres) # モノイドでは可換律は保証されていないので演算の方向に注意
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res
    
tree = SegmentTree(n)
for i in range(n):
    tree.update(i,a[i])

max_=tree.query(1,n)
for i in range(1,n-1):
    max_=max(max_,math.gcd(tree.query(0,i),tree.query(i+1,n)))
max_=max(max_,tree.query(0,n-1))
print(max_)

### FIXED CODE ###

import fractions
n=int(input())
a=[int(i) for i in input().split()]

class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x,y : fractions.gcd(x,y), default=0):
        self.size = 2**(size-1).bit_length() # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2) # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                rres = self.f(self.dat[r], rres) # モノイドでは可換律は保証されていないので演算の方向に注意
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res
    
tree = SegmentTree(n)
for i in range(n):
    tree.update(i,a[i])

max_=tree.query(1,n)
for i in range(1,n-1):
    max_=max(max_,fractions.gcd(tree.query(0,i),tree.query(i+1,n)))
max_=max(max_,tree.query(0,n-1))
print(max_)
A,B,C,D=map(int,input(.split()))

if(abs(C/B+1)>abs(A/C+1):
    print('No')

else:
    print('Yes')


### FIXED CODE ###

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


while(1):

    C=C-B
    if(C<=0):
        print('Yes')
        exit(0)
    A=A-D
    if(A<=0):
        print('No')
        exit(0)
n, eat = map(int, input().split())

pattiesCount = lambda level: (1 << (level + 1)) - 1
bunsCount = lambda level: (1 << (level + 1)) - 2
bothCount = lambda level: (1 << (level + 2)) - 3

# for i in range(51):
#     if pattiesCount(i) != p[i]:
#         raise Exception()
#     print(i, '->', pattiesCount(i), bunsCount(i), bothCount(i))

def doit(level, eat):
    if level == 0:
        if eat > 1:
            raise Exception()
        return int(eat == 1)
    both = bothCount(level - 1)
    patties = pattiesCount(level - 1)
    if eat == both + 2:
        return 1 + patties
    if eat < both + 2:
        return doit(level - 1, eat - 1)
    return 1 + patties + doit(level - 1, eat - 2 - both)


print(doit(n, eat))


### FIXED CODE ###

n, eat = map(int, input().split())

pattiesCount = lambda level: (1 << (level + 1)) - 1
bunsCount = lambda level: (1 << (level + 1)) - 2
bothCount = lambda level: (1 << (level + 2)) - 3

# for i in range(51):
#     if pattiesCount(i) != p[i]:
#         raise Exception()
#     print(i, '->', pattiesCount(i), bunsCount(i), bothCount(i))

def doit(level, eat):
    if level == 0:
        return int(eat >= 1)
    both = bothCount(level - 1)
    patties = pattiesCount(level - 1)
    if eat == both + 2:
        return 1 + patties
    if eat > both + 1:
        return 1 + patties + doit(level - 1, eat - 2 - both)
    return doit(level - 1, eat - 1)

print(doit(n, eat))
n, m = map(int, input().split())
a = [[] * n]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = None
    for j in range(m):
        c += a[j] * b[j]
    print(c)



### FIXED CODE ###

n, m = map(int, input().split())
A = [map(int, input().split()) for _ in [None] * n]
b = [int(input()) for _ in [None] * m]
for a in A:
    print(sum(i * j for i, j in zip(a, b)))
S = input()
print(S*2*3.14)

### FIXED CODE ###

S = int(input())
print(S*2*3.14)
from collections import Counter as co
hit,te,ji=map(int,input().split())
l=list(co(sorted([int(input()) for u in range(hit)])).items())
inc=0
ans=0
ef=len(l)
for ix in range(hit):
  k,v=l[inc]
  ans-=(-v//te)
  nokori=te-v%te if v%te else 0
  inc+=1
  if inc==ef:break
  while nokori:
    if l[inc][0]>k+ji:
      break
    if l[inc][1]<=nokori:
      nokori-=l[inc][1]
      inc+=1
      if inc==ef:break
    else:l[inc][1]-=nokori;break
print(ans+1 if nokori else ans)

### FIXED CODE ###

n,c,k=map(int,input().split())
ans=0
cnt=1
t=sorted([int(input())for s in range(n)])
while t:
    now=t.pop()
    ans+=1
    while t and cnt<c and t[-1]+k>=now:
        cnt+=1
        t.pop()
    cnt=1

print(ans)
import sys
sys.setrecursionlimit(10**10)

k = int(input())
l = len(str(k))+4
A = [str(i+1) for i in range(9)]
B = ["0"] + A
ans = []
#print(l)

def dfs(num,l):
    if len(num) >= l:
        ans.append(int(num))
    else:
        ans.append(int(num))
        for i in B:
            if abs(int(num[-1])-int(i)) < 2:
                dfs(num + i,l)
if k <= 9:
    print(k)
else:
    for i in A:
        dfs(i,l)
    ans = sorted(ans)
    #print(ans)
    print(ans[k-1])

### FIXED CODE ###

from collections import deque

K=int(input())

def bfs(k):
    queue = deque()
    for i in range(1, 10):#1~9までをqueueに追加しておく
        queue.append(i)
    cnt = 1
    
    while queue:
        x = queue.popleft()#左から取り出すと、自動的に小さい順から取り出せる
        if cnt == k:
            return x
        cnt += 1 #これまでのルンルン数の数
        last = x%10 #末尾の数字
        if last > 0:
            queue.append(x*10+last-1)#x-1⇒x⇒x+1の順にを末尾に追加すると順番になる。0と9に注意
        queue.append(x*10+last)
        if last < 9:
            queue.append(x*10+last+1)
            
print(bfs(K))
I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))
#####################################################
from collections import defaultdict
tree = defaultdict(list)
def inc(tree,counter,p,x):
    for i in tree[p]:
        counter[i-1]+=x
        inc(tree,counter,i,x)


n ,q = I0()
counter = [0]*n
for i in range(n-1):
    a,b=I0()
    tree[a].append(b)

for i in range(q):
    p,x = I0()
    counter[p-1]+=x
    inc(tree,counter,p,x)

print(*counter)

    


### FIXED CODE ###

I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))
#####################################################


from sys import stdin,setrecursionlimit
#from copy import deepcopy
 
setrecursionlimit(10**6)
input=stdin.readline

def dfs(p,father=-1):
    for i in tree[p]:
        if i == father:
            continue
        counter[i]+=counter[p]
        dfs(i,p)

n ,q = I0()
counter = [0]*n
tree = [[] for i in range(n)]
for i in range(n-1):
    a,b=I0()
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

for i in range(q):
    p,x = I0()
    counter[p-1]+=x
    

dfs(0)

print(*counter)

'''stack = [1]
while stack:
    yy = stack.pop()
    for i in tree[yy]:
        counter[i-1]+=counter[yy-1]
        stack.append(i)'''
import math
n,m=map(int,input().split())
arr=[None]*n
flag=True
ar=[]
for i in range(m):
	s,c=map(int,input().split())
	ar.append([s,c])
for  i in range(len(arr)):
	s=ar[i][0]
	c=ar[i][1]
	s-=1
	if s==0 and c==0 and n!=1:
		flag=False
		break
	if arr[s]==None:
		arr[s]=c 
	else:
		if arr[s]!=c:
			flag=False
			break
		else:
			continue 
if not flag:
	print(-1)
	exit()
# if arr[0]==0 and n!=1:
# 	print(-1)
# 	exit()
if arr[0]==None:
	arr[0]=1
if flag:
	for i in arr:
		if i==None:
			print(0,end="")
		else:
			print(i,end="")
	print()
else:
	print(-1)

### FIXED CODE ###

import math
n,m=map(int,input().split())
arr=[None]*n
flag=True
ar=[]
for i in range(m):
	s,c=map(int,input().split())
	ar.append([s,c])
if m==0 and n==1:
	print(0)
	exit()
for  i in range(len(ar)):
	s=ar[i][0]
	c=ar[i][1]
	s-=1
	if s==0 and c==0 and n!=1:
		flag=False
		break
	if arr[s]==None:
		arr[s]=c 
	else:
		if arr[s]!=c:
			flag=False
			break
		else:
			continue 
if not flag:
	print(-1)
	exit()
# if arr[0]==0 and n!=1:
# 	print(-1)
# 	exit()
if arr[0]==None:
	arr[0]=1
if flag:
	for i in arr:
		if i==None:
			print(0,end="")
		else:
			print(i,end="")
	print()
else:
	print(-1)
import bisect

s=input()
t=input()

condition=0

index=list()
for a in range(len(t)):
 index.append([i for i, x in enumerate(s) if x == t[a]])

for i in range(len(t)):
 if index[i]==[]:
   condition=1
   break

if condition==1:
  print(-1)
else:
  #print(index)
  b=index[0][0]
  j=1
  loop=0
  if len(t)==1:
    print(b+1)
  else:
   while j <= len(t)-1:
     c=bisect.bisect_left(index[j],b)
     #print(j,index[j],b,c,loop)
     if  c < index[j][len(index[j])-1]:
        b=index[j][c]
        #print(j,b,loop)
        j=j+1
        if j==len(t):
          print(b+loop+1)
          break
     else:
        loop=loop+len(s)
        b=index[j][0]
        j=j+1
        if j==len(t):
          print(b+loop+1)
          break
        if loop == len(s)*(10**100):
           print(-1)
           break
        



### FIXED CODE ###

import bisect

s=input()
t=input()

#index=list()
#for a in range(len(t)):
# index.append([i for i, x in enumerate(s) if x == t[a]])

char_appear = {ch: [] for ch in 'abcdefghijklmnopqrstuvwxyz'}
for i, ch in enumerate(s):
    char_appear[ch].append(i)
#print(char_appear['a'])
      
b=0
loop=0
condition=0

for j in range(len(t)):
  if len(char_appear[t[j]])<1:
    print(-1)
    condition=1
    break
  c=bisect.bisect(char_appear[t[j]],b)
 # print(j,char_appear[t[j]],b,c,loop)
  if j<1:
    b=char_appear[t[0]][0]    
  elif c == len(char_appear[t[j]]): #or c==char_appear[t[j]][len(char_appear[t[j]])-1]: 
     loop +=1
     b=char_appear[t[j]][0]
     if loop==10**100:
        print(-1)
        condition=1
        break
  else:
     b=char_appear[t[j]][c]
     #print(j,b,loop)


if condition==0:
 print(b+loop*len(s)+1)
n, m, l = map(int, input().split())
A = [[0] * m for i in range(n)]
B = [[0] * l for i in range(m)]
C = [[0] * n for i in range(l)]
for i in range(n):
    A[i] = [int(i) for i in input().split()]
for i in range(m):
    B[i] = [int(i) for i in input().split()]

for i in range(n):
    for j in range(l):
        tmp = 0
        for k in range(m):
            tmp += A[i][k] * B[k][j]
        C[i][j] = tmp
    print(' '.join(map(str, C[i])))



### FIXED CODE ###


# 提出用のインプット
n, m, l = map(int, input().split())
A = [[0] * m for i in range(n)]
B = [[0] * l for i in range(m)]
C = [[0] * l for i in range(n)]
for i in range(n):
    A[i] = [int(i) for i in input().split()]
for i in range(m):
    B[i] = [int(i) for i in input().split()]

# # 動作確認用のインプット
# with open(file='input_itp1_7_d_1.txt', mode='r', encoding='utf8') as input:
#     n, m, l = map(int, next(input).split())
#     A = [[0] * m for i in range(n)]
#     B = [[0] * l for i in range(m)]
#     C = [[0] * l for i in range(n)]
#     for i in range(n):
#         A[i] = [int(i) for i in next(input).split()]
#     print(A)
#     for i in range(m):
#         B[i] = [int(i) for i in next(input).split()]
#     print(B)

for row in range(n):
    for col in range(l):
        tmp = 0
        for k in range(m):
            tmp += A[row][k] * B[k][col]
        C[row][col] = tmp
    print(' '.join(map(str, C[row])))
import sys
input = sys.stdin.readline


def main():
    AB = []
    n = int(input())
    for i in range(n):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB = sorted(AB, key=lambda x: (x[1], -x[0]))
    time = 0
    for span, dead in zip(AB):
        time += span
        if time > dead:
            print('No')
            return
    print('Yes')
    return


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    AB = []
    n = int(input())
    for i in range(n):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB = sorted(AB, key=lambda x: (x[1], -x[0]))
    time = 0
    for span, dead in AB:
        time += span
        if time > dead:
            print('No')
            return
    print('Yes')
    return


if __name__ == "__main__":
    main()
n, d = list(map(int, split().input()))n, d = list(map(int, input().split()))
count = 0
for i in range(n):
  x, y = list(map(int, input().split()))
  p = x **2 + y **2
  if p <= d**2:
    count += 1
    
print(count)

### FIXED CODE ###

n, d = list(map(int, input().split()))
count = 0
for i in range(n):
  x, y = list(map(int, input().split()))
  p = x **2 + y **2
  if p <= d**2:
    count += 1
    
print(count)
n = int(input())
a = list(map(int, input().split()))

if n == 1:
    print(1)
    exit()
elif n == 2:
    if abs(a[0] - a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit()

d = {}
for x in a:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

d = sorted(d.items())

m = len(d)
ans = d[0][1]
if d[1][0] == d[0][0] + 1:
    ans += d[1][1]
r = d[m-1][1]
if d[m-2][0] == d[m-1][0] - 1:
    r += d[m-2][1]
ans = max(r, ans)

for i in range(1, m-1):
    r = d[i][1]
    if d[i-1][0] + 1 == d[i][0]:
        r += d[i-1][1]
    if d[i+1][0] - 1 == d[i][0]:
        r += d[i+1][1]
    ans = max(ans, r)


print(ans)



### FIXED CODE ###

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

d = {}
for x in a:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

d = sorted(d.items())

m = len(d)

if m == 1:
    print(d[0][1])
    exit()
elif m == 2:
    if d[1][0] - d[0][0] <= 2:
        print(d[0][1] + d[1][1])
    else:
        print(max(d[0][1], d[1][1]))
    exit()

ans = d[0][1]
if d[1][0] == d[0][0] + 1:
    ans += d[1][1]
r = d[m-1][1]
if d[m-2][0] == d[m-1][0] - 1:
    r += d[m-2][1]
ans = max(r, ans)

for i in range(1, m-1):
    r = d[i][1]
    if d[i-1][0] + 1 == d[i][0]:
        r += d[i-1][1]
    if d[i+1][0] - 1 == d[i][0]:
        r += d[i+1][1]
    ans = max(ans, r)


print(ans)
class Main:
    import math
    H = int(input())
    if H == 1:
        print(1)
    else:
        cnt = int(math.log(H, 2))
        num = 0
        for i in range(cnt+1):
            num += 2 ** i
            print(num)


### FIXED CODE ###

class Main:
    s = list(map(int, input().split()))
    h = s[0]
    a = s[1]
    cnt = 0
    if h >= a:
        while h > 0:
            h -= a
            cnt += 1

    else:
        cnt = 1
    print(cnt)
def m():
    def dfs(v, p, c, depth):
        depth[v] = c
        for child in graph[v]:
            if child == p:
                continue
            dfs(child, v, depth[v]+1, depth)
    n = int(input())
    graph = [[] for _ in range(n + 1)]
    depth_from1 = [0] * (n+1)
    depth_fromN = [0] * (n+1)
    depth_from1[1] = 0
    depth_fromN[n] = 0

    for _ in range(n-1):
        a, b = map(int, input().split())
        graph[a].append(b)
        graph[b].append(a)

    dfs(1, -1, 0, depth_from1)
    dfs(n, -1, 0, depth_fromN)
    fene = 0
    sn = 0

    for i in range(1,n+1):
        if depth_from1[i] <= depth_fromN[i]:
            fene += 1
        else:
            sn += 1
    if fene > sn:
        return "Fennec"
    else:
        return "Snuke"


print(m())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

def m():
    def dfs(v, p, c, depth):
        depth[v] = c
        for child in graph[v]:
            if child == p:
                continue
            dfs(child, v, depth[v]+1, depth)
    n = int(input())
    graph = [[] for _ in range(n + 1)]
    depth_from1 = [0] * (n+1)
    depth_fromN = [0] * (n+1)
    depth_from1[1] = 0
    depth_fromN[n] = 0

    for _ in range(n-1):
        a, b = map(int, input().split())
        graph[a].append(b)
        graph[b].append(a)

    dfs(1, -1, 0, depth_from1)
    dfs(n, -1, 0, depth_fromN)
    fene = 0
    sn = 0

    for i in range(1,n+1):
        if depth_from1[i] <= depth_fromN[i]:
            fene += 1
        else:
            sn += 1
    if fene > sn:
        return "Fennec"
    else:
        return "Snuke"


print(m())
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = [int(x) for x in stdin.readline().strip().split(" ")]

minv = 10000
num = 0

if N == 0:
  print(X)
else:
  for i in range(len(num_list)):
    if minv > abs(X - num_list[i]):
      minv = abs(X - num_list[i])
      num = i
  print(num)

### FIXED CODE ###

from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = []
if N != 0:
    num_list = [int(x) for x in stdin.readline().strip().split(" ")]


dec_num = X
inc_num = X
if N == 0:
    print(X)
elif X not in num_list:
    print(X)
else:
    while True:
        dec_num += -1
        inc_num += 1
        if dec_num not in num_list:
            print(dec_num)
            break
        if inc_num not in num_list:
            print(inc_num)
            break
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
cnt=0
for _ in range(H):
  cnt+=l.count("#")
if cnt==H+W-1:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W = map(int, input().split())
cnt=0
for _ in range(H):
  l = input()
  cnt+=l.count("#")
if cnt==H+W-1:
  print("Possible")
else:
  print("Impossible")
import sys
H,_=map(int,raw_input().spilt())
for _ in range(0,H):
    line=sys.stdin.readline()
    print line
    print line


### FIXED CODE ###

import sys
H,_=map(int,raw_input().split())
for _ in range(0,H):
    line=sys.stdin.readline()
    print line
    print line
a,b = map(int, input().split())
print(int(a*b*0.5))

### FIXED CODE ###

a,b,c = map(int, input().split())
print(int(a*b*0.5))
from collections import deque
d = deque()
for _ in range(int(input())):
  a = input()
  if "i" == a[0]: d.appendleft(int(a[1]))
  elif "F" == a[6]: d.popleft()
  elif "L" == a[6]: d.pop()
  else:
    try: d.remove(int(a[1]))
    except: pass
print(*d)


### FIXED CODE ###

from collections import deque
d = deque()
for _ in range(int(input())):
  a = input()
  if "i" == a[0]: d.appendleft(int(a[7:]))
  elif "F" == a[6]: d.popleft()
  elif "L" == a[6]: d.pop()
  else:
    try: d.remove(int(a[7:]))
    except: pass
print(*d)
S = list(input())
S1 = []
S2 = []
if i in range(len(S)):
    if i % 2 ==0 :
        S1.append('0')
        S2.append('1')
    else :
        S1.append('1')
        S2.append('0')
min1 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min1 += 1
min2 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min2 += 1 
print(min(min1,min2))


### FIXED CODE ###

S = input()
S1 = ''
S2 = ''
for i in range(len(S)):
    if i % 2 ==0 :
        S1 += '0'
        S2 += '1'
    else :
        S1 += '1'
        S2 += '0'
min1 = 0
for i in range(len(S)):
    if S[i] != S1[i]:
        min1 += 1
min2 = 0
for i in range(len(S)):
    if S[i] != S2[i]:
        min2 += 1 
print(min(min1,min2))
s = input()
t = input()

ans = 0
for i in range(len(s)-len(t)+1):
    if ans < count_ans(s[i:i+len(t)],t):
        ans = count_ans(s[i:i+len(t)],t)

print(len(t)-ans)

### FIXED CODE ###

s = input()
t = input()

def count_ans(a,b):
    ans = 0
    for c1,c2 in zip(a, b):
        if c1 == c2:
            ans += 1
    return ans

ans = 0
for i in range(len(s)-len(t)+1):
    ans_ = count_ans(s[i:i+len(t)],t)
    if ans < ans_:
        ans = ans_

print(len(t)-ans)
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

### FIXED CODE ###

x, y, z = input().split()
if x == y != z or x == z != y or x != y == z:
    print('Yes')
else:
    print('No')
n,a=map(int,raw_input().split())
x=map(int,raw_input().split())
ans=0
for i in range(1<<n):
    chk=0
    t=bin(i)[2:]
    t='0'*(n-len(t))+t
    for j,p in enumerate(t):
        if p=='1':
            chk+=x[j]
    if chk!=0 and chk==a*t.count('1'):
        ans+=1
print ans


### FIXED CODE ###

n,a=map(int,input().split())
l=[int(i) for i in input().split()]
ans=0
#dp=[[[0 for i in range(51)] for j in range(51)] for k in range(2501)]
dp=[[[0 for i in range(2501)] for j in range(51)] for k in range(51)]
dp[0][0][0]=1

for i in range(n):
    for j in range(50):
        for k in range(2501):
            if dp[i][j][k]:
                dp[i+1][j][k]+=dp[i][j][k]
                dp[i+1][j+1][k+l[i]]+=dp[i][j][k]
for i in range(1,n+1):
    ans+=dp[n][i][i*a]
print(ans)
n=int(input())
l=sorted(map(iny,input().split()))
m=l.pop(0)
M=l.pop(n-2)
print(M-m)

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
print(a[-1]-a[0])
n,k=map(int,input().split())
s=list(input())
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
print(s,end='' for i in range(n))

### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
if s[k-1]=='A':
  s[k-1]='a'
elif s[k-1]=='B':
  s[k-1]='b'
else:
  s[k-1]='c'
for i in range(n):
  print(s[i],end='')
n = int(input())
s =  input()
t = input()

for (ele,mele) in zip(s,t):
    print(ele+mele,end="")

### FIXED CODE ###

n = int(input())
s,t =  input().split()
for (ele,mele) in zip(s,t):
    print(ele+mele,end="")
import numpy as np
import fractions as fra

t=int(input())
ans=1
for _ in range(t):
    ans=ans*int(input())/fra.gcd(ans,int(input()))
print(ans)

### FIXED CODE ###



import numpy as np

def gcd(a,b):
    if(a>b):
        a,b=b,a
    if(a==0):return b
    return gcd(b%a,a)

t=int(input())
ans=1
for _ in range(t):
    k=int(input())
    ans=ans*k//gcd(ans,k)
print(ans)
y=int(input())
a=int(input())
b=int(input())

if y==1:
  print('Hello World')
else:
  print(a+b)


### FIXED CODE ###

y=int(input())

if y==1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(int(a+b))
C1 = list(input())
C2 = list(input())
C3 = list(imput())

print(C1[0]+C2[1]+C3[2])

### FIXED CODE ###

C1 = list(input())
C2 = list(input())
C3 = list(input())

print(C1[0]+C2[1]+C3[2])
from functools import reduce
from operator import add
X = int(input())
if X < 100: print(0)
else:
  dp = [1] + [0]*X
  dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1
  for i in range(106,X+1): dp[i] = min(reduce(add, [dp[i-(100+j)] for j in range(6)]),1)
  print(dp[-1])

### FIXED CODE ###

from functools import reduce
from operator import add
X = int(input())
if X <= 105:
  if X<100:  print(0)
  else: print(1)
else:
  dp = [1] + [0]*X
  dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1
  for i in range(106,X+1): dp[i] = min(reduce(add, [dp[i-(100+j)] for j in range(6)]),1)
  print(dp[-1])
n = int(input())
A = [int(i) for i in input().split()]
A=A.sort()
print(A[-1]-A[0])

### FIXED CODE ###

#encoding: utf-8

n = int(input())
A = [int(i) for i in input().split()]
A.sort()
print(A[-1]-A[0])