Harryxun/stf_run huggingface dataset:
import itertools as it

n,m=map(int,input().split())
ans=[]
for i in range(n):
    a,b=map(int,input().split())
    ans.append([a,b])
    ans.append([b,a])
  
a=0
for e in it.permutations(range(n)):
    count=0
    if e[0]!=0:
        break
    
    for i in range(len(e)-1):
        if [e[i]+1,e[i+1]+1] in ans:
            count=1
        else:
            count=0
            
    a+=count
    
print(a)

### FIXED CODE ###

import itertools as it
import sys

N, M = map(int, input().split())
if N==0 or M==0:
    print(0)
    sys.exit()
a=[]

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

ans=0
for e in it.permutations(range(N)):
    if e[0]!=0:
        break
        
    count=1
    for j in range(N-1):
        if [e[j]+1,e[j+1]+1] in a:
            count*=1
        else:
            count*=0
            break
            
    ans+=count

print(ans)
from functools import reduce

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def mgcd(*a)
    return reduce(gcd, a)

k = int(input())
ans = 0
for i in range(1, k+1):
  for j in range(1, k+1):
    for l in range(1, k+1):
      tmp = mgcd(i, j, l)
      if i == j== k:
        ans += tmp
      else:
        ans += tmp*3
print(ans)

### FIXED CODE ###

from math import gcd

k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            ans += gcd(i, gcd(j,m))
print(ans)
n = input()
A = map(int, raw_input().split())

Q = input()
m = map(int, raw_input().split())

f = []

for i in range(n):
    j = 2000
  for j in range(2000):
    if(j + A < 2000 && f[j] == 1):
      f[j + A] == 1
    
for i in range(Q):
    if(f[m] == 1):
    print "yes"
  else:
    print "no"

### FIXED CODE ###

n = int(raw_input())
A = map(int,raw_input().split())
Q = int(raw_input())
m = map(int,raw_input().split())

def s(i, m):
  if m == 0:
    return True
  if i >= n or m > sum(A):
    return False
  r = s(i + 1, m) or s(i + 1, m - A[i])
  return r

for j in range(Q):
  if s(0, m[j]):
    print "yes"
  else:
    print "no"
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N, K = NMI()
    A = NLI()
    ng = 0
    ok = 10**10

    for i in range(100):
        mid = (ok + ng) // 2
        tmp = 0
        for a in A:
            if a % mid == 0:
                tmp += a // mid - 1
            else:
                tmp += a // mid
        if tmp <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N, K = NMI()
    A = NLI()
    ng = 0
    ok = 10**10

    for i in range(100):
        mid = (ok + ng) // 2
        if mid == 0:
            break
        tmp = 0
        for a in A:
            if a % mid == 0:
                tmp += a // mid - 1
            else:
                tmp += a // mid
        if tmp <= K:
            ok = mid
        else:
            ng = mid

    print(ok)


if __name__ == "__main__":
    main()
a = [input().split() for l in range(1)]
tap = a[0]
need = a[1]
count = 1
needed_tap = 0
while count < need:
  count = count + (tap - 1)
  needed_tap = needed_tap +1

print(str(needed_tap))


### FIXED CODE ###

i = list(map(int, input().split()))

tap = int(i[0])
need = int(i[1])
count = 1
needed_tap = 0
while count < need:
  count = count + (tap - 1)
  needed_tap = needed_tap +1
 
print(str(needed_tap))
n, a, b, k = [int(i) for i in input().split()]
p = 998244353

def fact(n, p):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

f = list(fact(n+1, p))
rf = list(invfact(n+1, f, p))
rf.reverse()
ans = 0

for x in range(n+1):
    y = (k-x*a)/b
    if not y.is_integer():
        continue
    y = int(y)

    ans += (f[n] * rf[x] % p * rf[n-x] % p) * (f[n] * rf[y] % p * rf[n-y] % p) % p

print(ans%p)

### FIXED CODE ###

n, a, b, k = [int(i) for i in input().split()]
p = 998244353

def fact(n, p):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

f = list(fact(n+1, p))
rf = list(invfact(n+1, f, p))
rf.reverse()
ans = 0

for x in range(n+1):
    y = (k-x*a)/b
    if not y.is_integer() or y > n or y < 0:
        continue
    y = int(y)

    ans += (f[n] * rf[x] % p * rf[n-x] % p) * (f[n] * rf[y] % p * rf[n-y] % p) % p

print(ans%p)
import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
l = int(((N*N)+1)/2)
b = []
for i in range(l):
    b.append(1)
    b.append(-1)
b = b[:-1]
c = (np.array(b).reshape(N,N)
# print(b)
# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
g = np.eye(N)
x = 2*(np.dot(inv,a))
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
# l = int(((N*N)+1)/2)
b = []
for i in range(N):
    if i%2==0:
        b.append(1)
    else:
        b.append(-1)
c = np.dot(np.array(b),a)
x = [c]
for j in range(1,N):
    x_j = 2*a[j-1] - x[j-1]
    x.append(x_j)
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))
import platform
ver = platform.python_version_tuple()
if int(ver[1]) < 5:
    from fractions import gcd
else:
    from math import gcd
from sys import stdin

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()

    L = lcm(N, M)
    ans = [None] * 100000
    for i in range(N):
        j = i * (L // N)
        if ans[j] is None or ans[j] == S[i]:
            ans[j] = S[i]
        else:
            print(-1)
            return
    for i in range(M):
        j = i * (L // M)
        if ans[j] is None or ans[j] == T[i]:
            ans[j] = T[i]
        else:
            print(-1)
            return
    print(L)

input = lambda: stdin.readline().rstrip()
lcm = lambda x, y: x * y // gcd(x, y)
main()


### FIXED CODE ###

import platform
ver = platform.python_version_tuple()
if int(ver[1]) < 5:
    from fractions import gcd
else:
    from math import gcd

from sys import stdin
from bisect import bisect

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()

    L = lcm(N, M)
    s = [i * (L // N) + 1 for i in range(N)]
    t = [i * (L // M) + 1 for i in range(M)]
    for i, x in enumerate(s):
        n = bisect(t, x)
        if t[n-1] == x:
            if T[n-1] != S[i]:
                print(-1)
                return
    print(L)

input = lambda: stdin.readline().rstrip()
lcm = lambda x, y: x * y // gcd(x, y)
main()
s = input()
    ans = ''
    for i in range(len(s)):
        if s[i] == '0':
            ans += '0'
            
        elif s[i] == '1':
            ans += '1'
            
        else:
            if ans != '':
                ans = ans[:-1]
                
    print(ans)

### FIXED CODE ###

s = input()
ans = ''
for i in range(len(s)):
	if s[i] == '0':
		ans += '0'    
	elif s[i] == '1':
		ans += '1'    
	else:
		if ans != '':
			ans = ans[:-1]    
print(ans)
a,b,c = list(map(int,input().split()))
a.sort()
if a == [5,5,7]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a = list(map(int,input().split()))
a.sort()
if a == [5,5,7]:
    print("YES")
else:
    print("NO")
# -*-coding:utf-8

import math

def main():

    x1, y1, x2, y2 = map(int, input().split())

    print(math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*-coding:utf-8

import math

def main():

    x1, y1, x2, y2 = map(float, input().split())

    print(math.sqrt(pow(x2-x1, 2) + pow(y2-y1, 2)))

if __name__ == '__main__':
    main()
n = int(input())
a = [int(input()) for i in range(n)]
for i in a:
  if i == 1:
    print("first")
    exit()
xor = a[0]
for i in range(1,n):
  xor ^= a[i]
if xor %2 == 0:
  assert n == 10**5 and xor == 0 and a[0] > 90000
  print("second")
else:
  print("first")

### FIXED CODE ###

n,p = map(int,input().split())
import math
def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n //= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff
so = factorization(p)
ans = 1
for i,j in so:
    ans *= i**(j//n)
print(ans)
n, k = map(int, input().split())
c = 10**9+7
tm = [0] + [1]*k
a = k//2
ans = k*(k+1)//2 - a*(a+1)//2
for i in range(k//2, 0, -1):
    a = k//i
    t = (left_bin(a, n, c) - sum([tm[j*i] for j in range(2, a+1)])) % c
    ans = (ans + t*i) % c
    tm[i] = t
print(ans)


### FIXED CODE ###

def left_bin(a, n, c):
    ns = [int(i) for i in bin(n)[3:]]
    t = a
    for i in ns:
        t = t*t % c
        if i == 1:
            t = t*a % c
    return t


n, k = map(int, input().split())
c = 10**9+7
tm = [0] + [1]*k
a = k//2
ans = k*(k+1)//2 - a*(a+1)//2
for i in range(k//2, 0, -1):
    a = k//i
    t = (left_bin(a, n, c) - sum([tm[j*i] for j in range(2, a+1)])) % c
    ans = (ans + t*i) % c
    tm[i] = t
print(ans)
<>=~$";print+$'+$`/2,$/

### FIXED CODE ###

a,b=map(int,input().split());print(a+b//2)
n = int(input())
a = list(map(int,input().split()))
a.sorted()
ans = 0
for i in range(len(a)):
	ans += a[i]
print("%d %d %d" % a[0],a[len(a)-1],ans)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(len(a)):
	ans += a[i]
print("%d %d %d" % (a[0],a[len(a)-1],ans))
k,x,y = map(int,input().split())

if x%k>>0 :
    if x<= (x/k+1)*k <＝y :
        print('OK')
    else:
        print('NO')

if x%k ==0:

    print('OK')




### FIXED CODE ###

k= int(input())
x,y = map(int,input().split())
if 1<=x<=y<=1000 and 1<=k<=1000:
    pass



    if x%k>>0 :
        if x<= (x//k+1)*k <=y :
            print('OK')
        else:
            print('NG')
    else:
        print('OK')

else:
    print('NG')
a,b = ma()
c=d=e=-1
b=b//1000
for i in range(a):
    for j in range(a-i):
        if b == i*10 + j*5 + (a-i-j): 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)

### FIXED CODE ###

def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a,b = ma()
c=d=e=-1
for i in range(a+1):
    for j in range(a-i+1):
        if b == i*10000 + j*5000 + (a-i-j)*1000: 
            c,d,e=i,j,a-i-j
            break
print(c,d,e)
k,x=map(int, input().split())
print(" ".join([x-k+1+i for i in range(2k+1)]))

### FIXED CODE ###

k,x=map(int, input().split())
print(" ".join([str(x-k+i) for i in range(1, 2*k)]))
n = int(input())
B = list(map(int,(input().split())))

list_A = [0]*n

list_A[0] = B[0]
list_A[i-1] = B[i-2]
for i in range(1:n-2):
    list_A[i] = max(B[i],B[i+1])

print(sum(list_A))




### FIXED CODE ###

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

list_A = [0]*n

list_A[0] = B[0]
list_A[n-1] = B[n-2]
for i in range(1,n-1):
    list_A[i] = min(B[i-1],B[i])

print(sum(list_A))
s = list(input())
pos = 0
str_len = len(s)
count = 0
state = 0

while pos < str_len:
    if state == 0:
        if s[pos] == "A":
            state = 1
        pos += 1
    elif state == 1:
        if s[pos] == "B":
            state = 2
        elif s[pos] == "A":
            state = 1
        else:
            state = 0
        pos += 1
    elif state == 2:
        if s[pos] == "C":
            s[pos-2:pos+1] = "BCA"
            pos -= 3
            if pos < 0:
                pos = 0
            count += 1
            print(s)
        elif s[pos] == "A":
            state = 1
            pos += 1
        else:
            state = 0
            pos += 1

print(count)


### FIXED CODE ###

s = input()
pos = 0
str_len = len(s)
count = 0
seq_a = 0
seq_bc = 0

while pos < str_len:
    if s[pos] == "A":
        while pos < str_len and s[pos] == "A":
            seq_a += 1
            pos += 1
        if pos + 1 < str_len and s[pos] == "B" and s[pos+1] == "C":
            while pos < str_len and s[pos] == "B" and pos + 1 < str_len and s[pos+1] == "C":
                seq_bc += 1
                pos += 2
            count += seq_a * seq_bc
            if pos < str_len and s[pos] != "A":
                seq_a = 0
            seq_bc = 0
        else:
            pos += 1
            seq_a = 0
    else:
        pos += 1
        seq_a = 0

print(count)
lst=input().split()
lst=list(map(lambda i:int(i),lst))
a,b,C=lst[0],lst[1],lst[2]
S=(1/2)*a*b*math.sin(math.radians(C))



### FIXED CODE ###

import math
lst=input().split()
lst=list(map(lambda i:int(i),lst))
a,b,C=lst[0],lst[1],lst[2]
S=(1/2)*a*b*math.sin(math.radians(C))
h=(2/a)*S
c=(a**2+b**2-2*a*b*math.cos(math.radians(C)))**(1/2)
L=a+b+c
print(S)
print(L)
print(h)
n = input()

sm = 0
if len(n)%2 != 0:
    for i in range(0, len(n)-2, 2):
        sm += 9*10**i
    sm += int(n[1:])+1
else:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
        
print(sm)

### FIXED CODE ###

n = input()

sm = 0
if int(n) <= 9:
    sm = n
elif len(n)%2 != 0:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
    sm += int(n)-10**int(len(n)-1)+1
else:
    for i in range(0, len(n)-1, 2):
        sm += 9*10**i
        
print(sm)
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
a.sort()
parent = [a[-1]]
rest = a[:-1]

for _ in range(n):
    next_parent = []
    next_rest = []
    for i in parent[::-1]:
        while(rest):
            x = rest.pop()
            if x < i:
                next_parent.append(x)
                break
            else:
                next_rest.append(x)
                continue
    parent += next_parent
    parent.sort()
    next_rest.reverse()
    rest += next_rest

if len(parent) == 2**n:
    print("Yes")
else:
    print("No") 


### FIXED CODE ###

a = int(input())
print(a*a*a)
#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
tes = [[-1]*N for i in range(N)]
for i in range(N):
    A = int(readline())
    for j in range(A):
        x,y = map(int,readline().rstrip().split())
        tes[i][x-1] = y

cnt = 0
for i in range(2**N):
    hon = [0]*N
    for j in range(N):
        if (i>>j)&1:
            hon[j] = 1
    flag = True
    for j in range(N):
        if hon[j]:
            for k in range(N):
                if tes[j][k] != hon[k]:
                    flag = False
                    break
        if not flag:
            break
    if flag:
        cnt = max(cnt,hon.count(1))
print(cnt)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

A,B,C = map(int,readline().rstrip().split())
if (A+B+C) <=21:
    print("win")
else:
    print("bust")
X = int(input())
fact = [(i,i**5) for i in range(-10**2,10**2)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)

### FIXED CODE ###

X = int(input())
fact = [(i,i**5) for i in range(-10**3,10**3)]

for i in range(0,len(fact)):
    for j in range(i+1,len(fact)):
        if abs(fact[i][1] - fact[j][1]) == X:
            A = fact[j][0]
            B = fact[i][0]
            break;
        

print(A,B)
a = int(input())
if a == 3 | a == 5 | a == 7:
  print('YES')
else:
  Print('NO')  

### FIXED CODE ###

a = int(input())
if a == 3 or a == 5 or a == 7:
  print('YES')
else:
  print('NO')
#include <stdio.h>

int main(void)
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

    if (x>=r && y>=r)
    {
        if (x+r<=W && y+r<=H)
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
    }
    else
    {
        printf("No");
    }
    return 0;
}



### FIXED CODE ###

W,H,x,y,r = map(int, input().split())
if (0<= x-r and x+r <=W and 0<= y-r and y+r <= H):
    print('Yes')
else:
    print('No')
import bisect

def prime_num(num):
    if num == 1:
        return False
    else:
        i = 2
        while i*i <= num:
            if num%i == 0:
                return False
            i += 1
        return True

def prime_list(max_num):
    prime_list = [2]
    for n in range(1,max_num+1,2):
        if n == 1:
            continue
        else:
            if prime_num(n):
                prime_list.append(n)
    return prime_list

prime_list = prime_list(10**5)

Q = int(input())

for i in range(Q):
    l,r = map(int, input().split())
    ans = 0
    for n in range(l,r+1,2):
        #check
        tar1 = n
        tar2 = (n+1)//2

        ind1 = bisect.bisect_left(prime_list, tar1,0,len(prime_list))
        ind2 = bisect.bisect_left(prime_list, tar2,0,len(prime_list))

        if tar1 == prime_list[ind1] and tar2 == prime_list[ind2]:
            ans += 1
    print(ans)


### FIXED CODE ###

import bisect

def prime_num(num):
    if num == 1:
        return False
    else:
        i = 2
        while i*i <= num:
            if num%i == 0:
                return False
            i += 1
        return True

def prime_list(max_num):
    prime_list = [2]

    lens = 1
    n = 3
    while prime_list[-1] <= 10**5:
        if prime_num(n):
            prime_list.append(n)
            lens += 1
        n += 2

    count_list = [0 for i in range(max_num+1)]
    cnt = 0

    for n in range(3,max_num+1,2):

        tar1 = n
        tar2 = (n+1)//2

        ind2 = bisect.bisect_left(prime_list, tar2, 0, len(prime_list))
        if tar2 == prime_list[ind2]:

            ind1 = bisect.bisect_left(prime_list, tar1, 0, len(prime_list))
            if tar1 == prime_list[ind1]:
                cnt += 1

        count_list[n] = cnt
        count_list[n+1] = cnt

    return count_list

count_list = prime_list(10**5)
# print(count_list[91] - count_list[13-1])
# exit()

Q = int(input())

for i in range(Q):
    l,r = map(int, input().split())

    ans = count_list[r] - count_list[l - 1]
    print(ans)
# -*- coding: utf-8 -*-
from collections import deque

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

positives = deque(sorted(a))
negatives = deque([positives.popleft()])
for i in range(n - 2):
    if positives[i] < 0:
        negatives.append(positives.popleft())
    else:
        break

# print M
print(sum(positives) - sum(negatives))

x = negatives.pop()
while len(positives) > 1:
    y = positives.popleft()
    print(x, y)
    x -= y
negatives.append(x)

x = positives.popleft()
while len(negatives) > 0:
    y = negatives.pop()
    print(x, y)
    x = x - y

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import deque

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

positives = deque(sorted(a))
negatives = deque([positives.popleft()])
while len(positives) > 1:
    if positives[0] < 0:
        negatives.append(positives.popleft())
    else:
        break

# print M
print(sum(positives) - sum(negatives))

while len(positives) > 1:
    y = positives.popleft()
    x = negatives.pop()
    print(x, y)
    negatives.append(x - y)

x = positives.popleft()

while len(negatives) > 0:
    y = negatives.pop()
    print(x, y)
    x = x - y
W, H, x, y, r = [int(i) for i in input().split()]

if x + r <= W and y = r >= 0 and x - r >= 0 and y + r <= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

W, H, x, y, r = [int(i) for i in input().split()]

if x + r <= W and y + r >= 0 and x - r >= 0 and y + r <= H:
    print("Yes")
else:
    print("No")
n=list(input())
k=int(input())
if n[0]=='1':
  print(n[1])
else:
  print(n[0])

### FIXED CODE ###

n=list(input())
k=int(input())
if len(n)==1 and n[0]=='1':
  print('1')
else:
  one_list=[]
  while len(n)!=0:
    if n[0]=='1':
      one_list.append(n.pop(0))
    else:
      break
  if k<=len(one_list):
    print('1')
  else:
    print(n[0])
days , assi = map(int,input().split())
lst = []
while(assi > 0):
    a = int(input())
    assi -= 1
    lst.append(a)
    tot = sum(lst)
if (days > tot):
    print(days-tot)
elif (days == tot):
    print(days-tot)
else:
    print('-1')

### FIXED CODE ###

days , assi = map(int,input().split())
lst = []
lst = [int(i) for i in input().split()]
tot = sum(lst)
if (tot>days):
    print(-1)
else:
    print(days-tot)
N =int(input())
A = list(map(int, input().split()))

#２整数の最大公約数を求める

def gcd(x,y): 
    while y != 0:
        x , y = y , x % y 
    return x



#N 整数の最大公約数を求める
#A = [A[0],...,A[N]] とする

def gcd(A):
    ans = A[0]
    for i in range(1,N) #range(1,N)= 1,2,...,N-1
        ans = gcd(ans, A[i])
    return ans
print(gcd(A))

### FIXED CODE ###

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

#２整数の最大公約数を求める

def gcd2(x,y): 
    while y != 0:
        x , y = y , x % y 
    return x



#N 整数の最大公約数を求める
#A = [A[0],...,A[N]] とする

def gcd(A):
    ans = A[0]
    for i in range(1,N): #range(1,N)= 1,2,...,N-1
        ans = gcd2(ans, A[i])
    return ans
print(gcd(A))
from heapq import heappush, heappop

N, M = map(int, input().split())
salary = [[] for i in range(M+1)]
for i in range(N):
    A, B = map(int, input().split())
    salary[A].append(B)
queue = []
ans = 0

for i in range(1, M+1):
    for s in salary[i]:
        heappush(queue, -s)
    if queue:
        ans += -heappop(queue)

print(ans)


### FIXED CODE ###

from heapq import heappush, heappop

N, M = map(int, input().split())
salary = [[] for i in range(M+1)]
for i in range(N):
    A, B = map(int, input().split())
    if A <= M:
        salary[A].append(B)
queue = []
ans = 0

for i in range(1, M+1):
    for s in salary[i]:
        heappush(queue, -s)
    if queue:
        ans += -heappop(queue)

print(ans)
A,B,C=list(mao(int,input().split()))
print(max(0,C-(A-B)))

### FIXED CODE ###

A,B,C=list(map(int,input().split()))
print(max(0,C-(A-B)))