Harryxun/stf_run huggingface dataset:
import math
n=int(input())
a=list(map(int,input().split()))
soin = [0]*(10**5+1)
if a.count(1)==n:
    print("pairwise coprime")
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            while temp % i == 0:
                temp //= i
            arr.append(i)

    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)

    return arr


if len(a)>78498:
    ans=a[0]
    for i in a:
        ans=math.gcd(ans,i)
    if ans==1:
        print("setwise coprime")
    else:
        print("not coprime")
else:
    for i in a:
        for num in factorization(i):
            soin[num]+=1
    if max(soin)==1:
        print("pairwise coprime")
    elif max(soin)==n and 1 not in a:
        print("not coprime")
    else:print("setwise coprime")


### FIXED CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
soin = [0]*(10**6+1)
if a.count(1)==n:
    print("pairwise coprime")
    exit()

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            while temp % i == 0:
                temp //= i
            arr.append(i)

    if temp != 1:
        arr.append(temp)

    if arr == []:
        arr.append(n)

    return arr


if len(a)>80000:
    ans=a[0]
    for i in a:
        ans=math.gcd(ans,i)
    if ans==1:
        print("setwise coprime")
    else:
        print("not coprime")
else:
    for i in a:
        if i ==1:continue
        for num in factorization(i):
            soin[num]+=1
    if max(soin)==1:
        print("pairwise coprime")
    elif max(soin)==n and 1 not in a:
        print("not coprime")
    else:print("setwise coprime")
N = int(input())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1, 30):
        ans += (N // 2) // (5 ** i)

print(ans)


### FIXED CODE ###

N = int(input())
if N % 2 == 1:
    print(0)
else:
    ans = 0
    for i in range(1, 30):
        ans += (N // 2) // (5 ** i)
    print(ans)
sx,sy,tx,ty = [int(i) for i in input().split()]
ans = ""
for i in range(ty-sy):
    ans += "U"
for i in range(tx-sx):
    ans += "R"
for i in range(ty-sy):
    ans += "D"
for i in range(tx-sx):
    ans += "L"
ans += "L"
for i in range(ty-sy+1):
    ans += "U"
for i in range(tx-sx+1):
    ans += "R"
ans += "D"
ans += "R"
for i in range(ty-sy+1):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
ans += "U"

print(ans==ex)

### FIXED CODE ###

sx,sy,tx,ty = [int(i) for i in input().split()]
ans = ""
for i in range(ty-sy):
    ans += "U"
for i in range(tx-sx):
    ans += "R"
for i in range(ty-sy):
    ans += "D"
for i in range(tx-sx):
    ans += "L"
ans += "L"
for i in range(ty-sy+1):
    ans += "U"
for i in range(tx-sx+1):
    ans += "R"
ans += "D"
ans += "R"
for i in range(ty-sy+1):
    ans += "D"
for i in range(tx-sx+1):
    ans += "L"
ans += "U"

print(ans)
N,K=map(int,input())
L=list(map(int,input().split()))
L.sort(reverse=True)
print(sum(L[:K]))

### FIXED CODE ###

N,K=map(int,input().split())
L=list(map(int,input().split()))
L.sort(reverse=True)
print(sum(L[:K]))
def lcs():
    A = input()
    B = input()

    m = len(A)
    n = len(B)

    dp = [[0 for i in range(n + 1)] for j in range(m + 1)]

    maxl = 0

    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if A[i - 1] == B[j - 1]:
                dp[i][j] = dp[i - 1][j - 1] + 1
            else:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])

            maxl = max(maxl, dp[i][j])

    return maxl

n = input()
for _ in range(n):
    print(lcs())

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_C

最長共通部分列
"""


c = []
def prep_array(X, Y):
    global c
    """ 値が0の2次元配列を用意する。サイズは入力データの最大値を想定して縦横(1000+1)以上必要。 """
    # from array import array
    # c = [array('I', [0] * (len(X)+1)) for _ in range(len(Y)+1)]  #  arrayで用意
    c = [[0]*(len(Y)+2) for _ in range(len(X)+2)] #  リストで用意
    return c


def check_max(array):
    """ 2次元配列の中の最大の値を返す """
    max_lcs = 0
    for row in array:
        temp_max = max(row)
        if temp_max > max_lcs:
            max_lcs = temp_max
    return max_lcs


def calc_lcs4(X, Y, c):
    """
    Y[j]のアクセス方法を変更
    リストの値を一旦変数に保存するように変更
    最長共通部分長を関数内で計算するように変更
    4/5 のテストデータを使用してプロファイリングすると実効時間は 5.6秒
    """
    X = ' ' + X
    Y = ' ' + Y
    m = len(X)
    n = len(Y)
    max_lcs = 0

    pre_row = c[0]
    for i in range(1, m):
        row = c[i]
        XX = X[i]
        for j, YY in enumerate(Y):
            if XX == YY:
                pr_j1 = pre_row[j - 1]
                row[j] = pr_j1 + 1
                if pr_j1+1 > max_lcs:
                   max_lcs = pr_j1 + 1
            else:
                pr_j = pre_row[j]
                r_j1 = row[j-1]
                if pr_j >= r_j1:
                    row[j] = pr_j
                else:
                    row[j] = r_j1
        pre_row = row
    return max_lcs


if __name__ == '__main__':
    # データの入力
    num = int(input())
    #f = open('input.txt')
    #num = int(f.readline())

    for _ in range(num):
        X = input().strip()
        Y = input().strip()

        # 処理の実行
        result = calc_lcs4(X, Y, prep_array(X, Y))

        # 結果の表示
        print(result)
import math
N = 10**9+7
n = int(input())
a = list(map(int,input().split()))

ans = 0

ma = int(math.log2(max(a)))
if ma<0:
    ma=0
for i in range(ma+2):
    sum=0
    for j in range(n):
        sum+=(a[j]>>i) & 1
    ans+=sum*(n-sum)*pow(2,i,N)
    ans%=10**9+7
print(ans)


### FIXED CODE ###

import numpy as np
N = 10**9+7
n = int(input())
a = np.array(input().split(), np.int64)

ans = 0

po = 1
for i in range(61):
    bit = (a>>i) & 1
    s=np.count_nonzero(bit)
    ans+=s*(n-s)%N*po
    ans%=N
    po*=2
    po%=N
print(ans)
s = str(input())
r = 0
a = s.find("R")
if a==-1:
    print(r)
else:
    r+=1
    while(s[a+1]=="R"):
        r+=1
        a+=1
    print(r)

### FIXED CODE ###


s = str(input())
r = 0
a = s.find("R")
if a==-1:
    print(r)
else:
    r+=1
    if a<2:
        while(s[a+1]=="R"):
            r+=1
            a+=1
            if a==2:
                break
    print(r)
# coding: utf-8
# Your code here!

def Bellman_Ford(g,start):
    n = len(g)    
    dist = [float("inf")]*n
    dist[start] = 0
    a0 = float("inf")
    
    for i in range(2):
        updated = False
        for v in range(n):
            for to, cost in g[v]:
                if dist[to] <= dist[v] + cost: continue
                dist[to] = dist[v] + cost
                updated = True
        if not updated: break
        if i <= 0: a0 = dist[-1]
    if a0 != dist[-1]: return None, False
    return dist, True


import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]
g = [[] for _ in range(n)]
for i in range(m):
    a,b,c = [int(i) for i in readline().split()]
    g[a-1].append((b-1,-c))
#    g[b-1].append((a-1,c))

dist, TF = Bellman_Ford(g, 0)

if TF: print(-dist[-1])
else: print("inf")

if n==2 and m==2: assert False



### FIXED CODE ###

# coding: utf-8
# Your code here!

def Bellman_Ford(g,start):
    n = len(g)    
    dist = [float("inf")]*n
    dist[start] = 0
    a0 = float("inf")
    negative = [False]*n
    for i in range((2*n)):
        updated = False
        for v in range(n):
            for to, cost in g[v]:
                if negative[v]: negative[to] = True
                if dist[to] <= dist[v] + cost: continue
                dist[to] = dist[v] + cost
                updated = True
                if i >= n:
                    negative[to] = True
        if not updated: break
    if negative[-1]: return None, False
    return dist, True


import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]
g = [[] for _ in range(n)]
for i in range(m):
    a,b,c = [int(i) for i in readline().split()]
    g[a-1].append((b-1,-c))
#    g[b-1].append((a-1,c))

dist, TF = Bellman_Ford(g, 0)

if TF: print(-dist[-1])
else: print("inf")
import math

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


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


C_num = B // C - A // C

D_num = B // D - A // D

lcm = lcm(C, D)
CD_num = B // lcm - A // lcm


# Cで割れる時
tasu = 0
if (A % C == 0):
    tasu += 1
tasu += C_num

# Dで割れる時
if (A % D == 0):
    tasu += 1
tasu += D_num

# CでもDでも割れる
hiku = 0
if (A % lcm == 0):
    hiku += 1
hiku += CD_num

print((B - A + 1) - (tasu - hiku))


### FIXED CODE ###

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(x, y):
    return (x * y) // gcd(x, y)


C_num = B // C - A // C

D_num = B // D - A // D

lcm = lcm(C, D)
CD_num = B // lcm - A // lcm


# Cで割れる時
tasu = 0
if (A % C == 0):
    tasu += 1
tasu += C_num

# Dで割れる時
if (A % D == 0):
    tasu += 1
tasu += D_num

# CでもDでも割れる
hiku = 0
if (A % lcm == 0):
    hiku += 1
hiku += CD_num

print((B - A + 1) - (tasu - hiku))
from math import atan, degrees
a, b, x = map(int, input().split())

ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
print(ans)

### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())

#ans = max(90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x))), 90 - degrees(atan(2 * x / (a * b ** 2))))
if a ** 2 * b == x:
    ans = 0
else:
    if 0.5 * a ** 2 * b < x:
        ans = 90 - degrees(atan(0.5 * a ** 3/(a ** 2 * b - x)))
    else:
        ans = 90 - degrees(atan(2 * x / (a * b ** 2)))

print(ans)
import numpy as np
from numba import njit, b1, i4, i8, f8

@njit((i8, i8, i8[:]), cache=True)
def main():
    H, W, M = map(int, input().split())
    row = np.zeros(W)
    col = np.zeros(H)
    memo = []
    for _ in range(M):
        h, w = map(int, input().split())
        h -=1
        w -=1
        row[w] += 1
        col[h] += 1
        memo.append((h, w))

    col_max = col.max()
    row_max = row.max()

    max_col_indexs = np.where(col == col_max)[0]
    max_row_indexs = np.where(row == row_max)[0]

    ans = col_max + row_max -1
    for c in max_col_indexs:
        for r in max_row_indexs:
            if (c, r) not in memo:
                ans = ans = col_max + row_max
                break

    print(int(ans))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
def main():
    H, W, M = map(int, input().split())
    row = np.zeros(W)
    col = np.zeros(H)
    memo = []
    for _ in range(M):
        h, w = map(int, input().split())
        h -=1
        w -=1
        row[w] += 1
        col[h] += 1
        memo.append((h, w))

    col_max = col.max()
    row_max = row.max()

    max_col_indexs = np.where(col == col_max)[0]
    max_row_indexs = np.where(row == row_max)[0]

    ans = col_max + row_max -1
    memo = set(memo)
    for c in max_col_indexs:
        for r in max_row_indexs:
            if (c, r) not in memo:
                ans = ans = col_max + row_max
                print(int(ans))
                exit()

    print(int(ans))

if __name__ == "__main__":
    main()
def main():
    from collections import deque
    from functools import reduce
    from math import gcd

    def gcd3(*numbers):
        return reduce(gcd, numbers)

    K = int(input())
    ans = 0

    for _ in range(1, K + 1):
        for _ in range(1, K + 1):
            for _ in range(1, K + 1):
                ans += gcd3(_, b, c)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import deque
from functools import reduce
from math import gcd

def gcd3(*numbers):
    return reduce(gcd, numbers)

K = int(input())
ans = 0

for _ in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += gcd3(_, b, c)
print(ans)
from math import ceil
tmp1 = list(map(int,input().split()))
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(tmp1)
print(tmp2)
print(sum(tmp1)-max(tmp2))

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
from math import ceil
tmp1 = [A,B,C,D,E]
tmp2 = list()
for j in range(5):
    if tmp1[j]%10 == 0:
        tmp2.append(0)
    else:
        tmp2.append(10 - tmp1[j]%10)
for i in range(5):
    tmp1[i] = ceil(tmp1[i]/10)*10
print(sum(tmp1)-max(tmp2))
import math
A,B,K=map(int,input().split())
C=math.gcd(A,B)
count=0
for x in range(C,-1,-1):
    if C%x==0:
        count+=1
        if count==K:
            print(x)
            break

### FIXED CODE ###

import fractions
A,B,K=map(int,input().split())
C=fractions.gcd(A,B)
cnt=0
for x in range(C,0,-1):
    if C%x==0:
        cnt+=1
        if cnt==K:
            print(x)
            break
N = int(input())
H = list(map(int,input().split()))
dp = [-1]*N

def dfs(pos):
  if pos >= N:
    return 99999999
  if pos == N-1:
    return 0
  if pos == N-2:
    return abs(H[pos+1] - H[pos])
  if dp[pos] != -1:
    return dp[pos]
  s1 = dfs(pos+1) + abs(H[pos+1] - H[pos])
  s2 = dfs(pos+2) + abs(H[pos+2] - H[pos])
  dp[pos] = min(s1, s2)
  return dp[pos]

print(dfs(0))

### FIXED CODE ###

N = int(input())
h = [int(i) for i in input().split()]+[0 for _ in range(2)]
dp = [float('inf') for _ in range(N+2)]

dp[0] = 0
for i in range(N-1):
  dp[i+1] = min(dp[i]+abs(h[i]-h[i+1]), dp[i+1])
  dp[i+2] = min(dp[i]+abs(h[i]-h[i+2]), dp[i+2])
print(dp[N-1])
N = int(input())

for i in range(N):
	d = int(input())

dset = set(d)
print(len(dset))

### FIXED CODE ###

N = int(input())

d=[]
for i in range(N):
	d.append(int(input()))

dset = set(d)
print(len(dset))
x=input()
if x<1200:
    print("ABC")
else:
    print("ARC")

### FIXED CODE ###

x=int(input())
if x<1200:
    print("ABC")
else:
    print("ARC")
a=int(input())/9

if str(a)[-1]=='0':
  print('Yes')
else:
  print('NO')
    

### FIXED CODE ###

a=int(input())%9
if a==0:
  print('Yes')
else:
  print('No')
n= int(input())
a=list(map(int, input().split()))
ans=0
a.sort(reverse=True)
for b in a:
    if b:
        bi=format(b, 'b')
        x=2**len(bi)-b
        if x==b and a.count(x)>1:
            ans+=1
            b=None
            a[a.index(x)]=None
        elif x!=b:
            ans+=1
            a[a.index(x)]=None
            b=None
print(ans)
  

### FIXED CODE ###

import collections
import bisect
n= int(input())
a=list(map(int, input().split()))
c=collections.Counter(a)
ans=0
des=sorted(a,reverse=True)
# asc=sorted(a)

for i in des:
    if c[i]>0:
        bi=format(i, 'b')
        x=2**len(bi)-i
        c[i]-=1
        if c[x]>0:
            c[x]-=1
            ans+=1
print(ans)
while True:
    
    l = input().split()
    h = int(l[0])
    w = int(l[1])

    if h == 0 and w ==0:
        break
    
    flag = 0

    for i in range(h*(w+1)):
        if (i+1) % (w+1) == 0:
            print("")
            if w % 2 == 0:
                flag += 1
            if i == h*(w+1)-1:
                print("")


        else:
            if flag % 2 == 0:
             print("#", end="")
             flag += 1
            else:
             print(".", end="")
             flag += 1

### FIXED CODE ###

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

for i in range(n):
    if i == n-1:
        print(given_list[n-i-1])
    else:
        print(given_list[n-i-1], end=" ")
A,B,C = list(map(int,input()))
if A >= B and B >= C:
  print(A*10 + B+C)
elif B >= C and C >=A:
  print(B*10 + C+A)
elif C >= A and A >= B:
  print(C*10 + A+B)

### FIXED CODE ###

A,B,C = list(map(int,input().split()))
if A >= B and B >= C:
  print(A*10 + B+C)
elif B >= C and C >=A:
  print(B*10 + C+A)
elif C >= A and A >= B:
  print(C*10 + A+B)
elif A >= B and C >= B:
  print(A*10 + B+C)
elif B >= A and A >= C:
  print(B*10 + A+C)
elif C >= A and B >= A:
  print(C*10 + A+B)
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

visited = []
x=0
for i in range(n):
  x = a[x]
  if x in visited:
    for j in range(i):
      if visited[j] == x:
        first = j
        break
    T = i - j
    break
  else:
    visited.append(a[i])
mod = (k-first) % T
print(a[first+mod]+1)


### FIXED CODE ###

n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

visited = [-1 for i in range(n+1)] # 訪れていたら訪れたときの添字を格納する。
points = []
p = 1
while visited[p] == -1:
  visited[p] = len(points)
  points.append(p)
  p = a[p-1] #添字に直す

T = len(points) - visited[p]
s = visited[p]

if k < s:
  print(points[k])
else:
  mod = (k - s) % T
  print(points[s+mod])
s = input()
ans = 0, cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)

### FIXED CODE ###

s = input()
ans = 0
cnt = 0
for c in s:
  if c in ['A', 'C', 'T', 'G']:
    cnt += 1
    if cnt > ans:
      ans = cnt
  else:
    cnt = 0
print(ans)
import numpy as np
N, *L = map(int, open('0').read().split())
A = np.array(L[:N])
B = np.array(L[N:2*N])
C = np.array(L[2*N:])
A.sort()
B.sort()
C.sort()
binf = np.zeros(N)
j = 0
binf = np.searchsorted(A,B)
bs = np.cumsum(binf)
bs = np.concatenate([[0],bs])
cinf = np.searchsorted(B,C)
ans = np.sum(bs[cinf])
print(ans)

### FIXED CODE ###

import numpy as np
N, *L = map(int, open(0).read().split())
A = np.array(L[:N])
B = np.array(L[N:2*N])
C = np.array(L[2*N:])
A.sort()
B.sort()
C.sort()
binf = np.zeros(N)
j = 0
binf = np.searchsorted(A,B)
bs = np.cumsum(binf)
bs = np.concatenate([[0],bs])
cinf = np.searchsorted(B,C)
ans = np.sum(bs[cinf])
print(ans)
#from numpy import*
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix

from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def main():
    n=int(input())
    graph=[[0]*n for i in range(n)]
    for i in range(n-1):
        a,b,c=map(int,input().split())
        graph[a-1][b-1]=c
        graph[b-1][a-1]=c
    graph=csr_matrix(graph)
    d = shortest_path(csgraph=graph)
    q,k=map(int,input().split())
    for i in range(q):
        a,b=map(int,input().split())
        print(int(d[a-1][k-1]+d[k-1][b-1]))
if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import *
from heapq import*
import sys
input=lambda:sys.stdin.readline()

d=defaultdict(list)
n=int(input())

for s in range(n-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
    d[b].append([a,c])
#defaultdict(<class 'list'>, {1: [[2, 1], [3, 1]], 2: [[1, 1], [3, 3]], 3: [[1, 1], [2, 3]]})

def DIJKSTRA(point,d):
    cost      = {node:float("inf") for node in d.keys()}
    Q         = []  #頂点のリスト
    cost[point]=0  #開始地点のコストをゼロとする（当たり前
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

q,k=map(int,input().split())
y=DIJKSTRA(k,d)

for i in range(q):
    a,b=map(int,input().split())
    print(y[a]+y[b])
# C - Lower
def main():
    n = int(input())
    h = list(map(int, input().split()))
    cnt = 0
    ans = []

    for i in range(n-1):
        if h[i] >= h[i+1]:
            cnt += 1
            if i == n-2:
                ans.append(cnt)

        else:
            ans.append(cnt)
            cnt = 0
    print(max(ans))


if __name__ ==  "__main__":
    main()

### FIXED CODE ###

# C - Lower
def main():
    n = int(input())
    h = list(map(int, input().split()))
    cnt = 0
    ans = []

    if n == 1:
        print(0)
        exit()
    for i in range(n-1):
        if h[i] >= h[i+1]:
            cnt += 1
            if i == n-2:
                ans.append(cnt)

        else:
            ans.append(cnt)
            cnt = 0
    print(max(ans))


if __name__ ==  "__main__":
    main()
n = input()
a = n.index("A")
n = len(n) - n[::-1].index("Z")
print(len(n[a:n+1]))

### FIXED CODE ###

n = input()
print(n.rfind("Z") - n.find("A") + 1)
=[int(x) for x in input.split()]
a=[int(x) for x in input.split()]
 
sol=[]
for i in range(n-1):
  sol.append(a[i+1]-a[i])
sol.append(a[0]-a[n-1]+k)
 
sol.sort()
#unwanted segment of max length removed while printing
print(sum(sol)[0:n-1])


### FIXED CODE ###

k,n=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]
 
sol=[]
for i in range(n-1):
  sol.append(a[i+1]-a[i])
sol.append(a[0]-a[n-1]+k)
 
sol.sort()
print(sum(sol[:n-1]))
list = input().split()
a = bin(int(list[0])-1)
b = int(list[1])-1
print(pow(b,a)*int(list[1]))

### FIXED CODE ###

list = input().split()
a = (int(list[0])-1)
b = int(list[1])-1
print(pow(b,a)*int(list[1]))
total = 0
if K < A:
    print(A)
else:
    total += A
    K = K - A
    if K < B:
        print(total)
    else:
        K = K - B
        if K < C:
            total -= K
            print(total)
        else:
            total -= C
            print(total)

### FIXED CODE ###

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

total = 0
if K <= A:
    print(K)
else:
    total += A
    K = K - A
    if K <= B:
        print(total)
    else:
        K = K - B
        if K <= C:
            total -= K
            print(total)
        else:
            total -= C
            print(total)
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
a = reversed(list(set(A)))
B = []
for k in range(len(a)):
    i = a[k]
    if A.count(i) >= 4:
        if len(B) == 0:
            print(i**2)
            exit()
        else:
            B.append(i)
            if len(B) >= 2:
                print(B[0]*B[1])
                exit()

    if A.count(i) >= 2:
        B.append(i)
        if len(B) >= 2:
            print(B[0]*B[1])
            exit()
if len(B) <= 1:
    print(0)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import collections

n = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
l = c.most_common()
L = [ l[i] for i in range(len(l)) if l[i][1] >= 2 ]
b = sorted(L,reverse = True)
if len(b) == 0:
    ans = 0
elif len(b) == 1 and b[0][1] < 4:
    ans = 0
else:
    if b[0][1] >= 4:
        ans = b[0][0]**2
    else:
        ans = b[0][0]*b[1][0]
print(ans)
a, b = map(int, input().split()) 
A = [list(input().split())   for i in range(b)]

lines =[]
for j in A:
  for k in j:
    if "#" in k:
      lines.append(k)
lines_t = ["".join(list(i)) for i in zip(*lines)]
B=[]
for g in lines_t:
    if "#" in g:
      B.append(g)
C=[]
C= ["".join(list(i)) for i in zip(*B)]
for v in C:
  print(v)

### FIXED CODE ###

a, b = map(int, input().split())
A = [list(input().split()) for i in range(a)]

lines = []
for j in A:
    for k in j:
        if "#" in k:
            lines.append(k)
lines_t = ["".join(list(i)) for i in zip(*lines)]
B = []
for g in lines_t:
    if "#" in g:
        B.append(g)
C = []
C = ["".join(list(i)) for i in zip(*B)]
for v in C:
    print(v)
n, k, q = map(int, input().split())
point = [0] * (n+1)
for _ in range(n):
  a = int(input())
  point[a] += 1

for i in range(1, n+1):
  if k + point[i] > q:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

n, k, q = map(int, input().split())
point = [0] * (n+1)
for _ in range(q):
  a = int(input())
  point[a] += 1

for i in range(1, n+1):
  if k + point[i] > q:
    print('Yes')
  else:
    print('No')