Harryxun/stf_run huggingface dataset:
import sys
from itertools import combinations
try:
    from scipy.special import comb
except ImportError:
    from scipy.misc import comb

def main():
    input = sys.stdin.readline
    MOD = 10**9 + 7
    N, M, K = map(int, input().split())
    # The number of times that pieces are located on certain two tiles.
    num = int(comb(N*M-2, K-2))

    ans = 0
    # Column-wise distance
    for a, b in combinations(range(M), 2):
        ans += abs(a - b) * N**2 * num
        ans %= MOD

    # Row-wise distance
    for a, b in combinations(range(N), 2):
        ans += abs(a - b) * M**2 * num
        ans %= MOD

    return ans


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

import sys
from itertools import combinations

def comb_mod(n, r, MOD=10**9+7):
    if n < 0 or r < 0 or n < r:
        return 0

    factrial = [1] * (n+1)
    for k in range(1, n+1):
        factrial[k] = (factrial[k-1] * k) % MOD

    fact_inv = [1] * (n+1)
    fact_inv[n] = pow(factrial[n], MOD - 2, MOD)
    for k in range(n-1, -1, -1):
        fact_inv[k] = (fact_inv[k+1] * (k+1)) % MOD

    return (factrial[n] * fact_inv[r] * fact_inv[n-r]) % MOD


def main():
    input = sys.stdin.readline
    MOD = 10**9 + 7
    N, M, K = map(int, input().split())

    # The number of times that pieces are located on certain two tiles.
    num = comb_mod(N*M-2, K-2)

    ans = 0
    # Column-wise distance
    for i in range(M):
        ans += i * (M - i) * N**2 * num
        ans %= MOD

    # Row-wise distance
    for i in range(N):
        ans += i * (N - i) * M**2 * num
        ans %= MOD

    return ans


if __name__ == '__main__':
    print(main())
az = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sum_az = [0 for x in range(26)]

while True:
    x = raw_input()
    x.lower()
    for i in range(26):
        for j in range(len(x)):
            if x[j] == az[i]:
                sum_az[i] += 1


for i in range(26):
    print ("%s : %d" % (az[i], sum_az[i]))
                

### FIXED CODE ###

import sys
az =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
sum_az = [0 for x in range(26)]

for x in sys.stdin.read().lower():
    for i in range(26):
        if x == az[i]:
            sum_az[i] += 1


for i in range(26):
    print ("%s : %d" % (az[i], sum_az[i]))
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit(0)
ans = 1
for i in A:
  ans *= i
  if ans >= 10 ** 18:
    print(-1)
	exit(0)
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(0)
  exit(0)
ans = 1
for i in A:
  ans *= i
  if ans > 10 ** 18:
    print(-1)
    exit(0)
print(ans)
n = int(input())
maximum = 0
li = list(map(int,input().split()))
for i in range(n):
  if li[i] > maximum:
    maximum = li[i]
    s = i
  
sum = 0
for i in range(n):
  sum += li[i]
sum -= li[s]/2

print(sum)

### FIXED CODE ###

n = int(input())
l = [int(input()) for _ in [0]*n]

print(sum(l)-max(l)//2)
import math
A,B,H,M=map(int,input().split())
H=5*H+5*M/60
theta=6*abs(H-M) 
if theta>180:
    theta=360-theta
C=math.sqrt(A**2+B**2-2*A*B*(math.cos(math.radians(theta))))
print(C)

### FIXED CODE ###

N=list(map(int,input()))
if N[-1]==3:
    print("bon")
elif N[-1]==2 or N[-1]==4 or N[-1]==5 or N[-1]==7 or N[-1]==9:
    print("hon")
else:
    print("pon")
x, n = map(int, input().split())
ps = list(map(int, input().split()))
nums = list(range(1, 101))
for p in ps:
    nums.remove(p)
for i, num in enumerate(nums):
    if num > x:
        break
if i - 1 < 0:
    print(nums[i])
else:
    diff1 = abs(nums[i - 1] - x)
    diff2 = abs(nums[i] - x)
    if diff1 < diff2:
        print(nums[i - 1])
    elif diff1 > diff2:
        print(nums[i])
    else:
        print(nums[i-1])


### FIXED CODE ###

x, n = map(int, input().split())
ps = list(map(int, input().split()))
nums = list(range(-1, 102))
for p in ps:
    nums.remove(p)
min_diff = float("inf")
min_original = float("inf")
for num in nums:
    diff = abs(num - x)
    if diff < min_diff:
        min_diff = diff
        min_original = num
    elif diff == min_diff:
        if num < min_original:
            min_original = num
print(min_original)
import collections
import sys
input = sys.stdin.readline

n = int(input())
ans = [0] * n
tmp = []
#可能なすべてのx,y,zについてx^2+y^2+z^2+xy+yz+zxの値を求める
for x in range(1, int(n**0.5) + 1):
	for y in range(1, int(n**0.5) + 1):
		for z in range(1, int(n**0.5) + 1)
			tmp.append(x**2+y**2+z**2+x*y+y*z+z*x)
#x^2+y^2+z^2+xy+yz+zxの値の個数を数える
cnt = collections.Counter(tmp)
#各iについて、x^2+y^2+z^2+xy+yz+zxの値がiであるものの個数が答えとなる
for i in range(1, n+1):
	print(cnt[i])

### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])
N = raw_input("Please enter something: ")

return("ABC" + str(N))

### FIXED CODE ###

# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

print("ABC"+str(a))
import math
from functools import reduce
def lcm_base(x, y):
    kakeru = x*y
    gcd = math.gcd(x,y)
    ans = kakeru//gcd
    return ans
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
nums= list(map(int,input().split()))
ans = 0
lcmnum= lcm(nums)-1
for num in nums:
    ans+=(int(lcmnum)%num)
print(ans)

### FIXED CODE ###

import math
from functools import reduce
import fractions
def lcm_base(x, y):
    return (x * y)//fractions.gcd(x, y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
N = int(input())
nums= list(map(int,input().split()))
ans = 0
lcmnum= lcm(nums)-1
for num in nums:
    ans+=(int(lcmnum)%num)
print(ans)
import math

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

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

print(lcm(a, b))

### FIXED CODE ###

import fractions

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

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

print(lcm(a, b))
A, B = map(int, input().split())
if A > B:
    A, B = B, A

s = [1] * (A+1)
ans, t = 1, set()
i, lim = 2, A ** 0.5
while i < lim:
    if s[i] == 1:
        for j in range(i*2, A+1, i):
            s[j] = 0
        if A % i == 0 and B % i == 0:
            ans += 1
    i += 1

print(ans)

### FIXED CODE ###

A, B = map(int, input().split())
if A > B:
    A, B = B, A

length = int(A ** 0.5) + 2
Ax = A
s = [1] * length
ans, i, lim, t = 1, 2, A ** 0.5, set()
while i < lim:
    if s[i] == 1:
        for j in range(i*2, length, i):
            s[j] = 0
        if A % i == 0:
            if B % i == 0:
                ans += 1
            while Ax % i == 0:
                Ax //= i
    i += 1

if Ax >= length and B % Ax == 0:
    ans += 1
print(ans)
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    S = []
    for _ in range(N):
        t, d = map(int, input().split())
        S.append((d, t))
    S.sort(reverse = True)
    upperKCount = 0
    appeared = set()
    maxPoint = 0
    for i in range(K):
        maxPoint += S[i][0]
        if S[i][1] not in appeared:
            upperKCount += 1
            appeared |= {S[i][1]}
    maxPoint += upperKCount ** 2
    appeared = set()

    typeMax = []
    typeNum = 0
    typeLower = []
    others = 0
    for d, t in S:
        if t in appeared: 
            typeLower.append(d)
            others += 1
        else:
            typeMax.append(d)
            typeNum += 1
            appeared |= {t}
    typeMaxSum = [0] * (typeNum + 1)
    typeLowerSum = [0] * (others + 1)
    for i in range(typeNum): typeMaxSum[i+1] = typeMaxSum[i] + typeMax[i]
    for i in range(others): typeLowerSum[i+1] = typeLowerSum[i] + typeLower[i]
    if upperKCount < K:
        for k in range(upperKCount + 1, K+1):
            maxPoint = max(maxPoint, k ** 2 + typeMaxSum[k] + typeLowerSum[K - k])
    print(maxPoint)
    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import heapq as hq
from collections import deque
from copy import deepcopy
N, K = map(int, input().split())
Sushi = [None for _ in range(N)]
TotalType = set()
for _ in range(N):
    t, d = map(int, input().split())
    Sushi[_] = [d, t]
Sushi.sort(reverse = True)

ChosenType = set()
Double = []
hq.heapify(Double)
BasePoint = 0
for goodsushi in Sushi[:K]:
    BasePoint += goodsushi[0]
    if goodsushi[1] in ChosenType:
        hq.heappush(Double, goodsushi)
    else: ChosenType |= {goodsushi[1]}

NotChosen = deque(deepcopy(Sushi[K:]))
MaxHappiness = BasePoint + len(ChosenType)**2
while Double and NotChosen:
    TrushPoint, TrushType = hq.heappop(Double)
    BasePoint -= TrushPoint
    while NotChosen:
        addPoint, addType = NotChosen.popleft()
        if addType not in ChosenType:
            BasePoint += addPoint
            ChosenType |= {addType}
            break
    MaxHappiness = max(MaxHappiness, BasePoint + len(ChosenType)**2)
print(MaxHappiness)
n = input()
answer = 1
while != 1:
	answer *= n
	n -= 1
print answer

### FIXED CODE ###

n = input()
answer = 1
while n != 1:
	answer *= n
	n -= 1
print answer
while True:
    if s >= 10e9:
        for i in range(min(int(s**0.5), 10e9), 0, -1):
            if s % i == 0 and i <= 10e9 and s / i <= 10e9:
                x2 = i
                y3 = s//i
                break
    else:
        for i in range(1, min(int(s**0.5), 10e9) + 1):
            if s % i == 0 and i <= 10e9 and s / i <= 10e9:
                x2 = i - x1
                y3 = s//i
                break

    if x2 == 0 and y3 == 0:
        y2 = -1
        x3 += 1
        s -= x3
        continue
    break

print(x1, y1, x2, y2, x3, y3)


### FIXED CODE ###

s = int(input())

e = 10**9
if s == e**2:
    print(0, 0, e, 1, 0, e)
else:
    y = s//e + 1
    x = y*e - s
    print(0, 0, e, 1, x, y)
import sys
from bisect import bisect, bisect_left
import heapq

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = [int(a) for a in input().split()]
    A.sort()
    S = [0] * (N + 1)
    for i, a in enumerate(A): S[i + 1] = a + S[i]
 
    l, h = 1, A[N-1] * 2 + 1
    while h - l > 1: #最小値がｍ以上の要素をM個用意できるか
        m = (h + l) // 2
        count = 0
        for i, a in enumerate(A): count += N - bisect_left(A, m - a)
        if count >= M: l = m
        else: h = m

    total = 0
    count = 0
    Q = []
    heapq.heapify(Q)
    for i, a in enumerate(A):
        j = bisect_left(A, l - a)
        total += a * (N - j) + (S[N] - S[j])
        count += N - j
        for k in range(min(100, N - j)):
            heapq.heappush(Q, a + A[j + k])

    if count > M:
        for _ in range(count - M):
            minus = heapq.heappop(Q)
            total -= minus

    print(total)

    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
from bisect import bisect, bisect_left
import heapq

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = [int(a) for a in input().split()]
    A.sort()
    S = [0] * (N + 1)
    for i, a in enumerate(A): S[i + 1] = a + S[i]
 
    l, h = 1, A[N-1] * 2 + 1
    while h - l > 1: #最小値がｍ以上の要素をM個用意できるか
        m = (h + l) // 2
        count = 0
        for i, a in enumerate(A): count += N - bisect_left(A, m - a)
        if count >= M: 
            l = m
        else: h = m

    total = 0
    count = 0
    Q = []
    heapq.heapify(Q)
    min_out = 10000000
    for i, a in enumerate(A):
        j = bisect_left(A, l - a)  
        total += a * (N - j) + (S[N] - S[j])
        count += N - j
        if 0 <= j < N: min_out = min(min_out, a + A[j])

    if count > M:
        total -= min_out * (count - M)

    print(total)

    return 0

if __name__ == "__main__":
    solve()
from sys import exit

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

_a = -1
A = []
ans = 0

for _ in range(M):
    a_ = int(input())
    if _a + 1 == a_:
        print(0)
        exit()
    _a = a_
    A.append(_a)

step = [] * N
step[0] = 1

for s in range(1, N + 1):
    if s in A:
        step[s] = 0
        continue
    if s == 1:
        step[s] = 1
        continue
    else:
        step[s] = (step[s - 1] + step[s - 2]) % 1000000007

print(step[N])


### FIXED CODE ###

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

A = [False] * (N + 1)

for _ in range(M):
    A[int(input())] = True

step = [0] * (N + 1)

step[0] = 1

for s in range(1, N + 1):
    if A[s]:
        step[s] = 0
        continue
    if s == 1:
        step[s] = 1
        continue
    else:
        step[s] = step[s - 1] + step[s - 2]
        step[s] %= 1000000007

print(step[N])
class UnionFieldTree(object):
    def __init__(self, n):
        '''1-indexed'''
        self.parent = [i for i in range(n+1)] 
        self.size = [0] + [1] * n

    def merge(self, a, b):
        '''merge b into a'''
        a = self.root(a)
        b = self.root(b)
        self.parent[b] = self.parent[a]
        self.size[a] += self.size[b]

    def root(self, a):
        parent = self.parent[a]
        if parent == a:
            return a
        r = self.root(parent)
        self.parent[a] = r
        return r
    
    def same_group(self, a, b):
        return self.root(a) == self.root(b)


def main():
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]
    
    uf = UnionFieldTree(N)

    v_sum = N*(N-1)//2
    ans = [v_sum]

    for a, b in reversed(AB):
        if not uf.same_group(a, b):
            ra = uf.root(a)
            rb = uf.root(b)
            v_sum -= uf.size[ra] * uf.size[rb]
            uf.merge(a, b)
        ans.append(v_sum)

    [print(a) for a in reversed(ans[:M])]


main()




### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

class UnionFieldTree(object):
    def __init__(self, n):
        '''1-indexed'''
        self.parent = [i for i in range(n+1)] 
        self.size = [0] + [1] * n

    def merge(self, a, b):
        '''merge b into a'''
        a = self.root(a)
        b = self.root(b)
        self.parent[b] = self.parent[a]
        self.size[a] += self.size[b]

    def root(self, a):
        parent = self.parent[a]
        if parent == a:
            return a
        r = self.root(parent)
        self.parent[a] = r
        return r
    
    def same_group(self, a, b):
        return self.root(a) == self.root(b)


def main():
    N, M = map(int, input().split())
    AB = [map(int, input().split()) for _ in range(M)]
    
    uf = UnionFieldTree(N)

    v_sum = N*(N-1)//2
    ans = [v_sum]

    for a, b in reversed(AB):
        if not uf.same_group(a, b):
            ra = uf.root(a)
            rb = uf.root(b)
            v_sum -= uf.size[ra] * uf.size[rb]
            uf.merge(a, b)
        ans.append(v_sum)

    [print(a) for a in reversed(ans[:M])]


main()
import bisect

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

graph = [[] for _ in range(n)]
for i in range(n - 1):
    u, v = map(lambda x: int(x) - 1, input().split())
    graph[u].append(v)
    graph[v].append(u)

rooted = [[] for _ in range(n)]
que = [(0, -1)]
while que:
    node, parent = que.pop()
    for child in graph[node]:
        if child != parent:
            rooted[node].append(child)
            # rooted[child].append(node)
            que.append((child, node))
            # print(child + 1, node + 1)

table = [float('inf')] * n
lis = [None] * n
def dfs(node):
    p = bisect.bisect_left(table, a[node])
    table[p], old = a[node], table[p]
    for child in rooted[node]:
        dfs(child)
    table[p] = old
    lis[node] = p + 1

dfs(0)
print(*map(str, lis), sep="\n")


### FIXED CODE ###

import sys
import bisect
sys.setrecursionlimit(10**6)

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

graph = [[] for _ in range(n)]
for i in range(n - 1):
    u, v = map(lambda x: int(x) - 1, input().split())
    graph[u].append(v)
    graph[v].append(u)

rooted = [[] for _ in range(n)]
que = [(0, -1)]
while que:
    node, parent = que.pop()
    for child in graph[node]:
        if child != parent:
            rooted[node].append(child)
            # rooted[child].append(node)
            que.append((child, node))
            # print(child + 1, node + 1)

table = [float('inf')] * n
lis = [None] * n
def dfs(node, length=0):
    p = bisect.bisect_left(table, a[node])
    table[p], old = a[node], table[p]
    length = max(p + 1, length)
    for child in rooted[node]:
        dfs(child, length)
    table[p] = old
    lis[node] = length

dfs(0)
print(*map(str, lis), sep="\n")
class Com:
    def __init__(self, MAX = 1000000, MOD = 1000000007):
        self.MAX = MAX
        self.MOD = MOD
        self._fac = [0]*MAX
        self._finv = [0]*MAX
        self._inv = [0]*MAX
        self._fac[0], self._fac[1] = 1, 1
        self._finv[0], self._finv[1] = 1, 1
        self._inv[1] = 1
        for i in range(2,self.MAX):
            self._fac[i] = self._fac[i - 1] * i % self.MOD
            self._inv[i] = self.MOD - self._inv[self.MOD%i] * (self.MOD // i) % self.MOD
            self._finv[i] = self._finv[i - 1] * self._inv[i] % self.MOD
    
    def com(self, n, k):
        if (n < k):
            return 0
        if (n < 0 or k < 0):
            return 0
        return self._fac[n] * (self._finv[k] * self._finv[n - k] % self.MOD) % self.MOD
n = int(input())
A = list(map(int,input().split()))
amax = max(A)
com = Com()
ans = -1
MAX = -1
for a in A:
    if a == amax:continue
    if com.com(amax,a) > MAX:
        MAX = com.com(amax,a)
        ans = a
print(amax,ans)

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
amax = max(A)
AA = sorted(A,key=lambda x: abs(amax/2-x))
if AA[0] == amax:
    print(amax,AA[1])
else:
    print(amax,AA[0])
n = int(input())
stack = []
for _ in range(n):
    stack.append(int(input()))

for i in range(len(stack) - 1):
    for r1, r2 in zip(stack[::1], stack[i::1]):
        candidate.append(r2 - r3)
    candidate = [max(candidate)]

print(candidate[0])

### FIXED CODE ###

n = int(input())
stack = []
for _ in range(n):
    stack.append(int(input()))

maxv = -10**9
minv = stack[0]
for i in range(1, len(stack)):
    maxv = max(maxv, stack[i] - minv)
    minv = min(minv, stack[i])

print(maxv)
import math
n =int(input())
print(2*n*math.pi())

### FIXED CODE ###

import math
n =int(input())
print(2*n*math.pi)
S = input()
if ((S[0] == S[1]) and (S[0] !==S[2]) and (S[2] == S[3]))or((S[0] != S[1]) and (S[0] ==S[2]) and (S[1] == S[3]))or((S[0] != S[1]) and (S[1] == S[2]) and (S[0] == S[3])):
  print("Yes")
else:
  print("No")
  


### FIXED CODE ###

S = input()
if ((S[0] == S[1]) and (S[0] !=S[2]) and (S[2] == S[3]))or((S[0] != S[1]) and (S[0] ==S[2]) and (S[1] == S[3]))or((S[0] != S[1]) and (S[1] == S[2]) and (S[0] == S[3])):
  print("Yes")
else:
  print("No")
n, k = map(int, input().split())
h = list(map(int, input().split()))

h = sorted(h)
sum_of_k = 0
for i in range(k):
    sum_of_k += h[len(h)-i-1]
ans = sum(h)-sum_of_k
print(ans if ans >=0 else 0)


### FIXED CODE ###

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

h = sorted(h)
sum_of_k = 0
if k >= n:
    print(0)
    exit()
for i in range(k):
    sum_of_k += h[len(h)-i-1]
ans = sum(h)-sum_of_k
print(ans if ans >=0 else 0)
N=int(input())
s=0
L=[i for i in range(N)]
A=list(map(int,input().split()))
dic1={i:i+a for i,a in zip(L,A)}
dic2={i:i-a for i,a in zip(L,A)}
for p in range(N)
    z=[k for k,v in dic1.items() if v==p ]
    w=[k for k,v in dic2.items() if v==p ]
    for i,j in zip(z,w)
        if j>i:
            s+=1
print(s)

### FIXED CODE ###

def count(dic,x):
    if x in dic:
        dic[x]+=1
    else:
        dic[x]=1

N=int(input())
A=list(map(int,input().split()))
dic1={}
dic2={}
s=0
for i in range(N):
    count(dic1,i-A[i])
    count(dic2,i+A[i])
for x in dic1:
    if x in dic2:
        s+=dic1[x]*dic2[x]
print(s)
x,y,z= map(int, input().split())

print(z x y)

### FIXED CODE ###

x,y,z=map(int,input().split())
print(z,x,y)
a,b = map(int,input().split())
if (a * b) % 2:
  print(Even)
else:
  print(Odd)


### FIXED CODE ###

a,b = map(int,input().split())
if (a * b) % 2:
  print('Odd')
else:
  print('Even')
temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.add([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i, x]-points[j, x], 2) for x in range(D)]), 1/2)
    if l.is_integer():
      counter+=1
      
print(counter)

### FIXED CODE ###

temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.append([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i][x]-points[j][x], 2) for x in range(D)]), 1/2)
    if l.is_integer():
      counter+=1
      
print(counter)
n=input()
print(int(n[-3])*100)

### FIXED CODE ###

n=int(input())
while n>0:
    n-=1000
print(abs(n))
s = input()
if(s[2] == s[3] && s[4] == s[5]):
    print("Yes")
else:
    print("No")    


### FIXED CODE ###

s = input()
if(s[2] == s[3] and s[4] == s[5]):
    print("Yes")
else:
    print("No")
print(eval(input().split())

### FIXED CODE ###

print(eval(input()))
N,K = [int(i) for i in input().split()]
D = [int(i) for i in input().split()]
use = [0,1,2,3,4,5,6,7,8,9]
Keta = []
Keta.append(N // 1000)
Keta.append(N % 1000 // 100)
Keta.append(N % 1000 % 100 // 10)
Keta.append(N % 1000 % 100 % 10)
print("Keta is {}".format(Keta))
Keta_Min = []

for i in range(len(D)):
    use.remove(D[i])
print("use is {}".format(use))
for i in range(4):
    A = []
    for j in range(len(use)):
        if Keta[i] == 0:
            Keta_Min.append(0)
        elif Keta[i] <= use[j]:
            A.append(use[j])
            Keta_Min.append(min(A))

Answer = 0
Answer = Keta_Min[0] * 1000 + Keta_Min[1] * 100 + Keta_Min[2] * 10 + Keta_Min[3]
print(Answer)


### FIXED CODE ###

N,K = [int(i) for i in input().split()]
#D = [int(i) for i in input().split()]は数値代入
#文字列を複数代入
D = input().split()
#集合に置き換える(型はset)
D = set(D)
use = set(['0','1','2','3','4','5','6','7','8','9'])
use -= D

for i in range(N,100*N):
    if use >= set(str(i)):
        print(i)
        break
a, b, c=map(int,input().split())
print(a+b+c)

### FIXED CODE ###

a, b, c=map(int,list(input()))
print(a+b+c)
S=input().replace("abc","").replace("acb","").replace("bac","").replace("bca","").replace("cab","").replace("cba","")
if s:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

S = input()

S1='abc'
S2='acb'
S3='bac'
S4='bca'
S5='cab'
S6='cba'
if S==S1:
    print ('Yes')
elif S==S2:
    print ('Yes')
elif S==S3:
    print ('Yes')
elif S==S4:
    print ('Yes')
elif S==S5:
    print ('Yes')
elif S==S6:
    print ('Yes')
else:
    print ('No')
import math
n=int(input())
a=list(map(int,input().split()))
m=max(a)+1
g=a[0]
d=dict()
for i in a:
    g=math.gcd(g,i)
    if i in d:
        d[i]+=1
    else:
        d[i]=1
if g>1:
    print("not coprime")
else:
    p=[0]*(m)
    ch=0
    for i in range (2,m):
        if p[i]==1:
            continue
        p[i]=1
        ans=0
        for j in range (i,m,i):
            ans+=d[j]
        if ans>1:
            ch=1
            break
    if ch==1:
        print("setwise coprime")
    else:
        print("pairwise coprime")

### FIXED CODE ###

import math
mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
m=max(a)+1
g=a[0]
d=dict()
for i in a:
    g=math.gcd(g,i)
    if i in d:
        d[i]+=1
    else:
        d[i]=1
if g>1:
    print("not coprime")
else:
    p=[0]*(m)
    ch=0
    for i in range (2,m):
        if p[i]==1:
            continue
        p[i]=1
        ans=0
        for j in range (i,m,i):
            if j in d:
                ans+=d[j]
        if ans>1:
            ch=1
            break
    if ch==1:
        print("setwise coprime")
    else:
        print("pairwise coprime")