Harryxun/stf_run huggingface dataset:
N,M = map(int,input().split())
adj_list = { i: [] for i in range(1, N+1) }

for i in range(M):
  a,b = map(int, input().split())
  adj_list[a].append(b)
  adj_list[b].append(a)

visited = [False]*(N+1)
colors = [None] * (N)

def dfs(node, c):
  colors[node-1] = c
  visited[node] = True
  for nei in adj_list[node]:
    if colors[nei-1] == c:
      return False
    if not visited[nei]:
      dfs(nei, 1-c)

  return True

if dfs(1, 1):
  black = colors.count(1)
  print(black*(N-black) - M)
else:
  print(N*(N-1)//2 - M)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N,M = map(int,input().split())
adj_list = { i: [] for i in range(1, N+1) }

for i in range(M):
  a,b = map(int, input().split())
  adj_list[a].append(b)
  adj_list[b].append(a)

visited = [False]*(N+1)
colors = [None] * (N)
is_bipartite = True

## improved dfs ###
def dfs(node, c):
  colors[node-1] = c
  visited[node] = True
  for nei in adj_list[node]:
    if colors[nei-1] == c:
      return False
    if not visited[nei] and not dfs(nei, 1-c):
      return False

  return True

if dfs(1, 1):
  black = colors.count(1)
  print(black*(N-black) - M)
else:
  print(N*(N-1)//2 - M)
N = int(ipnut())

ans = N // 3
print(ans)


### FIXED CODE ###

N = int(input())

ans = N // 3
print(ans)
import math

def is_prime(n):
	for i in range(2,math.floor(math.sqrt(n))+1):
		if n!=2 or n%2==0:
			return False
		elif n%i==0:
			return False
    return True
 
cnt = 0
n=int(input())
for i in range(n):
    k=int(input())
    if is_prime(k):
        cnt += 1
 
print(cnt)


### FIXED CODE ###

import math

def is_prime(n):
	for i in range(2,math.floor(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True
 
cnt = 0
n=int(input())
for i in range(n):
    k=int(input())
    if is_prime(k):
        cnt+=1
print(cnt)
N,X,M = map(int,input().split())

ans = X
A = X
TF = True
srt = 1000000
retu = dict()
retu[X] = 1
loop = X
for i in range(N-1):
    if TF:
        A = A**2 % M
        if retu.get(A) != None:
          srt = j
          goal = i
          TF = False
          break   
        if TF:
          retu[A] = 1
          loop += A
    else:
      break
      
if N-1 > srt:
    n = (N-srt)//(goal-srt+1)
    saisyo = sum(retu[:srt])
    loop -= saisyo
    print(saisyo + loop*n + sum(retu[srt:N-n*(goal-srt+1)]))
    
else:
    print(sum(retu[:N]))


### FIXED CODE ###

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

candicate = [pow(i, 2, M) for i in range(M)]
ans = 0
now = X
A = [0]
X2 = pow(X, 2, M)

d = dict()

flag = True
for i in range(1, N+1):
    if i == 1:
        A.append(X)
    
    else:
        nxt = candicate[A[i-1]]

        if d.get(nxt) == None:
            if nxt == 0:
                A.append(nxt)
                break
            else:
                A.append(nxt)
                d[nxt] = i

        else:
            flag = False
            break


if flag:
    print(sum(A))
else:
    l = d[nxt]
    r = i - 1
    circle_total = 0
    for j in range(l, r+1):
        circle_total += A[j]
    
    for j in range(1, l):
        ans += A[j]

    width = r - l + 1
    N -= (l - 1)
    ans += circle_total * (N // width)

    for j in range(l, l + N % width):
        ans += A[j]

    print(ans)
from collections import deque

class Combination:
    def __init__(self, size, mod=10**9 + 7):
        self.size = size + 2
        self.mod = mod
        self.fact = [1, 1] + [0] * size
        self.factInv = [1, 1] + [0] * size
        self.inv = [0, 1] + [0] * size

        for i in range(2, self.size):
            self.fact[i] = self.fact[i - 1] * i % self.mod
            self.inv[i] = -self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.factInv[i] = self.factInv[i - 1] * self.inv[i] % self.mod

    def npr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * self.factInv[n - r] % self.mod

    def ncr(self, n, r):
        if n < r or n < 0 or r < 0:
            return 0
        return self.fact[n] * (self.factInv[r] * self.factInv[n - r] % self.mod) % self.mod

    def nhr(self, n, r):  # 重複組合せ
        return self.ncr(n + r - 1, n - 1)

    def factN(self, n):
        if n < 0:
            return 0
        return self.fact[n]

N, K = map(int, input().split())
comb = Combination(N + K)
MOD = 10**9 + 7

edges = [[] for _ in range(N)]
for _ in range(N - 1):
    fr, to = map(int, input().split())
    fr -= 1
    to -= 1
    edges[fr].append(to)
    edges[to].append(fr)

def dfs(now, pr):
    ret = 1

    cnt = 0
    for to in edges[now]:
        if to == pr:
            continue
        cnt += 1
        ret = (ret * dfs(to, now)) % MOD

    color = K - 1 if pr == -1 else K - 2
    ret = (ret * comb.npr(color, cnt)) % MOD

    return ret

print(dfs(0, -1) * K % MOD)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

MOD = 10**9 + 7
N, K = map(int,input().split())

edge = [[] for _ in range(N)]

for _ in range(N-1) :
    fromNode, toNode = map(int,input().split())

    fromNode -= 1
    toNode -= 1

    edge[fromNode].append(toNode)
    edge[toNode].append(fromNode)

# 深さ優先探索
def bfs(nowNode, fromNode) :
    colorNum = K  # 使用可能な色の数
    if fromNode == -1 :  # 根の場合
        colorNum -= 1
    else :
        colorNum -= 2

    if len(edge[nowNode]) - 1 > K :  # つながっている頂点数 - 1(親) == K までOK
        return 0

    caseNum = 1
    for nextNode in edge[nowNode] :
        if nextNode == fromNode :
            continue
        caseNum *= colorNum
        colorNum -= 1
        caseNum = caseNum % MOD

    for nextNode in edge[nowNode] :
        if nextNode == fromNode :
            continue
        caseNum *= bfs(nextNode, nowNode)
        caseNum = caseNum % MOD

    return caseNum

ans = bfs(0, - 1) * K
ans = ans % MOD
print(ans)
S, T = list(input().split())
s = len(S)
t = len(T)
list1 = [] 
list2 = []
n = 0


for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:
        
        if x == T[m]:
            list1.append(1)
            m +=1
        else:
            list1.append(0)
            m +=1
    
    list2.append(sum(list1))
    list1 = []
   
print(t - max(list2))

### FIXED CODE ###

S = input()
T = input()
s = len(S)
t = len(T)
l1 = [] 
l2 = []
n = 0
for i in range(n, s-t+1): 
    ss = S[n:t + n]
    n += 1
    m = 0
    for x in ss:       
        if x == T[m]:
            l1.append(1)
            m +=1
        elif x != T[m]:
            l1.append(0)
            m +=1   
    l2.append(sum(l1))
    l1 = [ ]
print(t - max(l2))
def check(a, b):
  return b if a == 0 else check(b%a, a)
n = [int(i) for i in input().split(" ")]
print(int(n[0]*n[1]/check(n[0], n[1])))*

### FIXED CODE ###

def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))
M = int(input())
A = list(map(int,input().split()))
B = [0]*(M+1)
C = [0]*2
D = [0]*2

for i in range(len(A)):
	B[ A[i] ] += 1 # カウント

for i in range(len(B)):
	# 一個しかなかったら条件を満たさないのでするー
	if B[i] < 2: 
        continue

	# 2個以上あれば長方形にスタック
	C.append(i)

	# 4個以上あれば正方形にスタック
	if B[i] >= 4: 
        D.append(i)
# C を降順でソート
C = sorted(C, reverse=True)

rect = C[0] * C[1]
s = max(D)
square = s * s

print(max(rect,square))

### FIXED CODE ###

M = int(input())
A = list(map(int,input().split()))
B = {}
C = [0]*2
D = [0]*2

for i in range(len(A)):
	a = str(A[i])
	# 存在したらカウントアップ
	if (a in B): B[ str(A[i]) ] += 1 # カウント
	# 存在しなかったら 1 で初期化
	else: B[ str(A[i]) ] = 1 # カウント
	# {"1":2, "2":3, "3":1}

for i in B:
	# 一個しかなかったら条件を満たさないのでスルー
	# i: string, B[i] = count
	if B[i] < 2: continue

	# 2個以上あれば長方形にスタック
	C.append(int(i))

	# 4個以上あれば正方形にスタック
	if B[i] >= 4: D.append(int(i))

# C を降順でソート
C = sorted(C, reverse=True)

rect = C[0] * C[1]
s = max(D)
square = s * s

print(max(rect,square))
import sys
input = sys.stdin.readline
a, b, c = input().split()
if b - a == c - b:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

import sys
input = sys.stdin.readline
a, b, c = [int(x) for x in input().split()]
if b - a == c - b:
    print("YES")
else:
    print("NO")
R = int(input())
print(2*pi*R)

### FIXED CODE ###

R = int(input())
print(2*3.141592*R)
from collections import deque

K = int(input())

count = 0
ans = 0
Q = deque([1,2,3,4,5,6,7,8,9])
while count != K:
  a = Q.popleft()
  b = a%10
  if b != 0:
    Q.append(q*10 + b - 1)
  Q.append(q*10)
  if b != 9:
    Q.append(q*10 + b + 1)
  count += 1
  ans = q
print(q)

### FIXED CODE ###

from collections import deque
 
K = int(input())
 
count = 0
Q = deque([1,2,3,4,5,6,7,8,9])
while count != K:
  a = Q.popleft()
  b = a%10
  if b != 0:
    Q.append(a*10 + b - 1)
  Q.append(a*10 + b)
  if b != 9:
    Q.append(a*10 + b + 1)
  count += 1
  #print(Q)
print(a)
import math
A, B = map(int, input().split())
math.floor(A*B)

### FIXED CODE ###

def resolve():
    A, B = input().split()
    ans = int(A)*int(B[0])*100+int(A)*int(B[2:])
    print(str(ans)[:-2] if len(str(ans)) >= 3 else "0")
resolve()
A, B, C, D map(int, input().split())

print(max(min(B, D) - max(A, C), 0))


### FIXED CODE ###

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

print(max(min(B, D) - max(A, C), 0))
N = int(input())
al = [int(a) for a in input().split()]
a = [ "4" if al[i]%4==0 else "k" if al[i]%2!=0 else "g" for i in range(N)]
if a.count("k") == a.count("4"):
	print("Yes")
elif (a.count("k") - 1) == a.count("4")  and a.count("g")==0:
	print("Yes")
else:
	print("No")


### FIXED CODE ###

n, m  = (int(i) for i in input().split())
if m > 1:
	gaiku = (n-1)*(m-1)
print(gaiku)
N,K=map(int,input().split())
import math
s=0
if N-K>=0:
  N-=(N-K+1)
for j in range(1,N+1):
  if (K/j)%2==0:
    s+=math.log(K//j,2)
  else:
    s+=int(math.log(K/j),2)+1
print(float(N/(s+N)))
    


### FIXED CODE ###

N,K=map(int,input().split())
S=input()
s=""
for j in range(N):
  if j==K-1:
    s+=str.lower(S[K-1])
  else:
    s+=S[j]
print(s)
A,B=map(int,input().split())
if A==B:
    print('Draw')
else:
    if A==1:
        print('Alice')
    elif B==1:
        print('Bob')
    else:
        if A > B:
        print('Alice')
        else:
        print('Bob')


### FIXED CODE ###

A,B=map(int,input().split())
if A==B:
    print('Draw')
else:
    if A==1:
        print('Alice')
    elif B==1:
        print('Bob')
    else:
        if A > B:
            print('Alice')
        else:
            print('Bob')
import numpy as np
import sys
import collections
import copy
deque=collections.deque
fastinput=sys.stdin.readline
whites=deque()
firstwhite=deque()
H,W=map(int,input().split())
A=[list(fastinput().rstrip()) for j in range(W)]
rinsetsu=np.zeros((H*W,H*W))
F=np.zeros((1,H*W))

def UDLR(i,j):#各フラグごとに、白なら隣接追加　黒ならfirstwhite追加
    ID=W*i+j
    next2black=0
    rinsetsu[ID][ID]=1
    if i!=0:
        if A[i-1][j]==".":
            rinsetsu[ID][ID-W]=1
        else:F[0][ID]=1
    if i!=H-1:
        if A[i+1][j]==".":
            rinsetsu[ID][ID+W]=1
        else:F[0][ID]=1
    if j!=0:
        if A[i][j-1]==".":
            rinsetsu[ID][ID-1]=1
        else:F[0][ID]=1
    if j!=W-1:
        if A[i][j+1]==".":
            rinsetsu[ID][ID+1]=1
        else:F[0][ID]=1      

for k,i in enumerate(A):
    for l,j in enumerate(i):
        if j==".":
            whites.append(W*k+l)
            UDLR(k,l)
whitess=len(whites)
rinsetsuMatrix=np.matrix(rinsetsu)
ct=1
while 1:
    ct+=1
    F=np.dot(F,rinsetsuMatrix)
    sums=np.array(np.sum(F, axis=0))
    if sum([bool(i) for i in sums[0]])==whitess:
        print(ct)
        break

### FIXED CODE ###

import collections
H,W=map(int,input().split())
went=[[False]*W for i in range(H)]
queue=collections.deque()
for hoge in range(H):
    for huga,t in enumerate(input()):
        if t=="#":
            went[hoge][huga]=True
            queue.append([hoge,huga,0])
while queue:
    curx,cury,ct=queue.popleft()
    for dx,dy in [[1,0],[-1,0],[0,1],[0,-1]]:
        newx,newy=curx+dx,cury+dy
        newct=ct+1
        if 0<=newx<H and 0<=newy<W and (not went[newx][newy]):
            went[newx][newy]=True
            queue.append([newx,newy,newct])
print(ct)
def insertionSort(A,n,g):
    for i in range(g,n,1):
        v = int(A[i])
        j = i - g
        while j >= 0 and int(A[j]) > v:
            global cnt
            A[j + g] = A[j]
            j = j - g
            cnt = cnt + 1
        A[j+g] = str(v)
             
def shellSort(A,n):
    global cnt
    G = []
    cnt = 0
    h = 1
    while h <= n:
        G.append(h)
        h = 3*h + 1
         
    m = len(G)
    print(m)
    G.reverse()
    print(' '.join(map(str, G)))
    for i in range(0,m,1):
        insertionSort(A,n,G[i])
    print(cnt)
         
 
n = int(input())
#改行で標準入力を受け付ける場合
A = []
for i in range(n):
    A.append(input())
shellSort(A,n)
print('\n'.join(A))


### FIXED CODE ###

import sys


def print_A(A):
    for i in range(len(A)):
        sys.stdout.write(str(A[i]))
        if i!= len(A) -1:
            sys.stdout.write(' ')
    print()


def insertionSort(A,n,g):
    cnt = 0
    for i in range(g,n):
        v = A[i]
        j = i - g
        while (j>=0) and (A[j] > v):
            A[j + g] = A[j]
            j -= g
            cnt +=1
        A[j + g] = v
    return cnt

def shellSort(A,n,G):
    cnt = 0
    for i in range(len(G)):
        cnt += insertionSort(A,n,G[i])
    return cnt
        

def get_gap(n):
    G = []
    h = 1
    cnt = 1
    while h <= n:
        G.append(h)
        h = 3*h + 1
        cnt +=1
    if len(G) == 0: G.append(1)
    return list(reversed(G))


n = int(input())
A = [0] * n
for i in range(n):
    A[i] = int(input())
    
G = get_gap(n)
m = len(G)
cnt = shellSort(A,n,G)

print(m)
print_A(G)
print(cnt)
for i in range(n):
    print(A[i])
A, B, C = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mi = 10**6
for i in range(M):
  x, y, c = map(int, input().split())
  tmp = A[x-1] + B[y-1] - c
  if mi > tmp:
    mi = tmp
A.sort()
B.sort()
tmp = A[0] + B[0]
if mi > tmp:
  mi = tmp
print(mi)

### FIXED CODE ###

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mi = 10**6
for i in range(M):
  x, y, c = map(int, input().split())
  tmp = a[x-1] + b[y-1] - c
  if mi > tmp:
    mi = tmp
a.sort()
b.sort()
tmp = a[0] + b[0]
if mi > tmp:
  mi = tmp
print(mi)
import sys
s=input()
t=input()
if s==t:
  print("No")
  sys.exit()
S=list(s)
T=list(t)
for i in s:
  if i in t:
    S.remove(i)
    T.remove(i)
S.sort()
T.sort()
a="".join(S)
b="".join(T)
if a=="":
  print("Yes")
  sys.exit()
for j in b:
  if ord(a[0])<ord(j):
    print("Yes")
    break
else:
  print("No")

### FIXED CODE ###

s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
s="".join(s)
t="".join(t)
for i in range(min(len(s),len(t))):
  if ord(s[i])==ord(t[i]):
    continue
  elif ord(s[i])<ord(t[i]):
    print("Yes")
    break
  else:
    print("No")
    break
else:
  if len(s)<len(t):
    print("Yes")
  else:
    print("No")
S = input()[::-1]
MOD = 10**9+7
dp = (1,0,0,0,0,0,0,0,0,0,0,0,0)
p = 1
for i, s in enumerate(S):
    nx = [0,]*13
    if s == '?':
        for k in range(10):
            q = (k*p)%13
            for j, d in enumerate(dp):
                nx[(j+q)%13] += d
    else:
        q = (int(s)*p)%13
        for j, d in enumerate(dp):
            nx[(j+q)%13] += d
    dp = (n % MOD for n in nx)
    p = (10*p)%13
print(dp[5])

### FIXED CODE ###

A, B = map(int, input().split())
if (A + B) % 2 == 0:
    print((A+B)//2)
else:
    print('IMPOSSIBLE')
while True:
  H, W = map(int, raw_input().split())
   if H == 0 and W == 0:
      break
  print (("#" * W + "\n") * H)

### FIXED CODE ###

while True:
  H, W = map(int, raw_input().split())
  if H == 0 and W == 0:
      break
  print (("#" * W + "\n") * H)
a,p=int(input().split())
print((3*a+p)//2)

### FIXED CODE ###

a,p=map(int,input().split())
print((3*a+p)//2)
n = int(input())
x,y = map(int,input().split())
a = [x]
b = [y]
for i in range(n-1):
    x,y = map(int,input().split())
    if(a[-1] < x):
        a.append(x)
    elif(a[0] > x):
        a = [x] + a
    else:
        for j in range(len(a)):
            if(a[j] > x):
                a.insert(j,x)
                break
    if(b[-1] < y):
        b.append(y)
    elif(b[0] > y):
        b = [y] + b
    else:
        for j in range(len(b)):
            if(b[j] > y):
                b.insert(j,y)
                break
if(n%2 == 1):
    print(b[n//2]-a[n//2]+1)
else:
    print(b[n//2] + b[-1+n//2] - a[n//2] - a[-1+n//2]+1)

### FIXED CODE ###

n = int(input())
t = []
for i in range(2,int(-(-n**0.5//1))+1):
    if(n%i == 0):
        cmp = 0
        while(n%i == 0):
            cmp += 1
            n //= i
        t.append([i,cmp])
    if(n == 1):
        break
if(n != 1):
    z = 1
else:
    z = 0
z -= len(t)
for i in range(len(t)):
    j = 1
    while(t[i][1] >= 0):
        t[i][1] -= j
        j += 1
        z += 1
print(z)
N = int(input());
A = list(map(int,input().split()))

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

l = lcm(A)
ans = 0
for i in A:
	ans += l/i

MOD = 1000000007
print(int(ans%MOD))

### FIXED CODE ###

N = int(input());
A = list(map(int,input().split()))

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in a:
        x = (x * i) // gcd(x, i)
    return x

l = lcm(A)
ans = 0
for i in A:
	ans += l//i

MOD = 10**9+7
print(ans%MOD)
import sys
N = int(input())
num_list = list(map(int, input().split()))
c = 1
if 0 in num_list:
    print(0)
    sys.exit(1)
    
for i in range(N):
        c = c * num_list[i]

if c <= 10 ** 18:
    print(c)
else:
    print(-1)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 1

if 0 in A:
  ans = 0
  N = 0

for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break

print(ans)
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    if N == 1:
        ans = list_S[t]
    else:
        ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[i-1]]
                ans += "\n"
print(ans)

### FIXED CODE ###

import collections

N = int(input())
S = [input() for i in range(N)]
c =collections.Counter(S)
C = c.most_common()
list_C = []
for i in range(len(c)):
    list_C.append(C[i][1])
m = 1
for i in range(len(list_C)-1):
    if list_C[i]==list_C[i+1]:
        m += 1
    else:
        break
ans= []
for i in range(m):
    ans.append(C[i][0])
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])
p=[int(input()) for i in range(int(input()))]
print(sum(p)-max(p)//2)

### FIXED CODE ###

str = "Christmas"
for i in range(25-int(input())):
    str += " Eve"
print(str)
n = int(input())
l = 0
r = n-1
mid = (l+r)/2
print(l)
s1 = raw_input()
if s1 == 'Vacant':
    exit()
print(mid)
s2 = raw_input()
if s2 == 'Vacant':
    exit()
while True:
    print("before:",l,r)
    if (mid-l) % 2 == int(s1 != s2):
        l = mid
        s1 = s2
    else:
        r = mid
    print("after:",l,r)
    mid = (l+r)/2
    if mid == l:
        break
    print(mid)
    s2 = raw_input()
    if s2 == 'Vacant':
        break
print(mid+1)
s1 = raw_input()


### FIXED CODE ###

n = int(input())
l = 0
r = n-1
mid = (l+r)/2
print(l)
s1 = raw_input()
if s1 == 'Vacant':
    exit(0)
print(mid)
s2 = raw_input()
if s2 == 'Vacant':
    exit(0)
while True:
    #print("before:",l,r)
    if (mid-l) % 2 == int(s1 != s2):
        l = mid
        s1 = s2
    else:
        r = mid
    #print("after:",l,r)
    mid = (l+r)/2
    if mid == l:
        break
    print(mid)
    s2 = raw_input()
    if s2 == 'Vacant':
        exit(0)
print(mid+1)
s1 = raw_input()
#ABC118_C

import fraction

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

x = fraction.gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = fraction.gcd(x,a[i])
        
print(x)

### FIXED CODE ###

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

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

x = gcd(a[0],a[1])

if n != 2:
    for i in range(2,n):
        x = gcd(x,a[i])
        
print(x)
a,b,c = map(int,input().split())
if a < b and b < c :
	print('Yes')
else：
	print('No')
  


### FIXED CODE ###

a,b,c = map(int,input().split())
if a < b and b < c :
	print('Yes')
else:
	print('No')
def main():
    N = input()
    ans = 0
    for i in range(N):
        ans += i
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    print(int((N*(N-1))//2))

if __name__ == '__main__':
    main()
n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(keta, 10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')

### FIXED CODE ###

n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')
def sub():
    N, Hs = [input() for _ in range(2)]
    Hs = [int(e) for e in Hs.split(" ")]
    count = 1
    maxH = Hs[0]
    for i in range(1, N):
        h = Hs[i]
        if h >= maxH:
            count = count + 1
            maxH = h


    print("{}".format(count))

sub()



### FIXED CODE ###

def sub():
    N, Hs = [input() for _ in range(2)]
    Hs = [int(e) for e in Hs.split(" ")]
    count = 1
    maxH = Hs[0]
    for i in range(1, int(N)):
        h = Hs[i]
        if h >= maxH:
            count = count + 1
            maxH = h


    print("{}".format(count))

sub()
n = int(input())
s = input()
if s%2==1:
  print('No')
else:
  print('Yes' if s[:n//2]==s[n//2:] else 'No')

### FIXED CODE ###

n = int(input())
s = input()
if n%2==1:
  print('No')
else:
  m = n//2
  print('Yes' if s[:m]==s[m:] else 'No')
A,B,K = [int(_) for _ in input().split]
M = A*B
print(M * K)

### FIXED CODE ###

A,B,K = [int(_) for _ in input().split()]
c = 0
i = 100
while True:
    if A%i == B%i == 0:
        c += 1
    if c == K:
        break
    i -= 1
print(i)
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from collections import accumulate as acc
import operator as op
import copy as cp
import math 

n=ri()
s=input()
cnt=n
if n==1:
  print(1)
  
else:
  for i in range(n-1):
    if s[i]==s[i+1]:
      cnt-=1
  print(cnt)

### FIXED CODE ###

def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from itertools import accumulate as acc
import operator as op
import copy as cp
import math 

n=ri()
s=input()
cnt=n
if n==1:
  print(1)
  
else:
  for i in range(n-1):
    if s[i]==s[i+1]:
      cnt-=1
  print(cnt)
s=input()
n=len(n)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)

### FIXED CODE ###

s=input()
n=len(s)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)
t, x = map(int, input())
print(t/x)

### FIXED CODE ###

t, x = map(int, input().split())
print(t/x)
k,n=map(int,input().split())
for i in range(n):
  print(-n+1+i)
print(0)
for i in range(n):
  printf(i)

### FIXED CODE ###

k,n=map(int,input().split())
for i in range(k-1):
  print(n-k+i+1,end=" ")
print(n,end=" ")
for i in range(k-1):
  print(n+i+1,end=" ")