Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
print(n,m)

li=[1]*(n+1)

se=set()
se.add(1)
for  i in range(m):
	x,y=map(int,input().split())
	li[x]-=1
	li[y]+=1
	print(li)
	if x in se:
		se.add(y)
	if li[x]==0:
		se.remove(x)
print(len(se))

### FIXED CODE ###

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

li=[1]*(n+1)

se=set()
se.add(1)
for  i in range(m):
	x,y=map(int,input().split())
	li[x]-=1
	li[y]+=1
	if x in se:
		se.add(y)
		if li[x]==0:
			se.remove(x)
print(len(se))
n=input()
if n[1]=n[2]=n[3]=n[4] or n[1]=n[2]=n[3]!=n[4] or n[2]=n[3]=n[4]!=n[1]:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

n=raw_input()
if n[0]==n[1]==n[2]==n[3] or n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print "Yes"
else:
  print "No"
a,b = map(int ,input().split())
if(a*b%2 == 0):
	return("Even")
return("Odd")

### FIXED CODE ###

a, b = map(int,input().split())
if(a*b)%2==0:
	print("Even")
else:
	print("Odd")
N = int(input())
dic = {}
for i in range(N):
  s = input()
  if s not in dic:
    dic[s] = 1
  else:
    dic[s] += 1
M = int(input())
for i in range(M):
  s = input()
  if s not in dic:
    dic[s] = -1
  else:
    dic[s] -= 1
print(max(list(dic.values()))

### FIXED CODE ###

from collections import Counter  

blue = []
red = []
N = int(input())
for i in range(N):
    blue.append(input())
M = int(input())
for j in range(M):
    red.append(input())
b = Counter(blue)
r = Counter(red)
print(max([0] + [b[x] - r[x] for x in b]))
INF=int(1e6)

N=int(input())
heights=[int(x) for x in input().split()]
dp=[INF]*N
if(N==1):
  print(dp[0])
  return

dp[1]=heights[1]-heights[0]

for i in range(2,N):
	dp[i]=min(dp[i-1],dp[i-2])

    
print(dp[N])

### FIXED CODE ###

INF=int(1e6)

N=int(input())
heights=[int(x) for x in input().split()]
# print('heights: ',heights)
dp=[INF]*N
# print(dp)
if(N==1):
  print(dp[0])
  exit()

dp[0]=0
dp[1]=abs(heights[1]-heights[0])

for i in range(2,N):
	dp[i]= min(abs(heights[i]- heights[i-1])+ dp[i-1],abs(heights[i]- heights[i-2])+ dp[i-2])


# print('dp: ',dp)
print(dp[N-1])

#30->60->60->50
#30   30  30  40
N,M=map(int,iuput().split())
print(N(N-1)/2 +M(M-1)/2)


### FIXED CODE ###

N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
a,b=map(int.input().split())
if (a+b)%2==1:
    print("IMPOSSIBLE")
else:
    print((a+b)//2)

### FIXED CODE ###

a,b=map(int,input().split())
c=(a+b)/2
if c%1==0:
    print(int(c))
else:
    print('IMPOSSIBLE')
import math

r = 50000000
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

count = 0
n = int(raw_input())
for i in range(n):
    m = int(raw_input())
    if p[m-1]:
        count += 1
    except:
        break
print count

### FIXED CODE ###

def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0
	
n = int(raw_input())
print sum(isPrime(int(raw_input())) for i in range(n))
S = tuple((input()))
S = [int(s) for s in S]

flag=0
for i in [0,1]:
    if flag==1:
        break
    for j in [0,1]:
        if flag==1:
            break
        for k in [0,1]:
            value = S[0]
            if i==0:
                value+=S[1]
            else:
                value-=S[1]
            if j==0:
                value+=S[2]
            else:
                value-=S[2]
            if j==0:
                value+=S[3]
            else:
                value-=S[3]
            if value==7:
                flag=1
                x = i
                y = j
                z = k
            if flag==1:
                break
if x==0:
    a = "+"
else:
    a = "-"
if y==0:
    b = "+"
else:
    b = "-"
if z==0:
    c = "+"
else:
    c = "-"

print("{}{}{}{}{}{}{}=7".format(S[0], a, S[1], b, S[2], c, S[3]))

### FIXED CODE ###

import itertools
A, B, C, D =  list(input())

for ops in itertools.product(["+", "-"], repeat=3):
    eq = A+ops[0]+B+ops[1]+C+ops[2]+D
    x = eval(eq)
    if x == 7:
        break
 
print(eq+'=7')
n, m, x = map(int, input().split())
a = list(map(int, input().split()))
cost_0, cost_n = 0, 0

if max(a) <= x or min(a) >= x:
    print(0)
    exit(1)

for i in range(x + 1):
    if i in a:
        cost_0 += 1

for i in range(x, n + 1):
    if i in a:
        cost_n += 1

print(min(cost_0, cost_n))

### FIXED CODE ###

n, m, x = map(int, input().split())
a = list(map(int, input().split()))
cost_0, cost_n = 0, 0

# if max(a) <= x or min(a) >= x:
#     print(0)
#     exit(1)

for i in range(1, x):
    if i in a:
        cost_0 += 1

for i in range(x + 1, n):
    if i in a:
        cost_n += 1

print(min(cost_0, cost_n))
S = input()

print(S[0] + len(S) + S[-1])

### FIXED CODE ###

S = input()

print(S[0] + str(len(S)-2) + S[-1])
input()
A = list(map(int, input().split())
min_num = min(A)
max_num = max(A)
sum_num = sum(A)
print("{} {} {}".format(min_num, max_num, sum_num))

### FIXED CODE ###

input()
a = list(map(int, input().split()))
print(min(a) ,max(a) ,sum(a))
N = int(input())
A = [int(e) for e in range(N)]
V = 0
for i in range(N):
    V += 1/A[i]
print(1/V)

### FIXED CODE ###

N = int(input())
A = [int(e) for e in input().split()]
V = 0
for i in range(N):
    V += 1/A[i]
print(1/V)
import sys

def dfs(s, t):
    global V, d

    if t in V[s]:
        return True

    d[s] = 1
    for v in V[s]:
        if d[v] == 0:
            if dfs(v, t):
                return True

    return False

lines = sys.stdin.readlines()
if lines[0] == "In preparation.":
    print "In preparation."

n, m = map(int, lines[0].split())
V = [[] for _ in range(n)]
for i in range(1, m + 1):
    c = map(int, lines[i].split())
    V[c[0]].append(c[1])
    V[c[1]].append(c[0])

q = int(lines[m + 1])
for i in range(m + 2, m + q + 2):
    c = map(int, lines[i].split())
    d = [0] * (n)
    if dfs(c[0], c[1]):
        print "yes"
    else:
        print "no"

### FIXED CODE ###

def bfs(i, c):
    global V, C

    q = [i]
    while len(q) > 0:
        j = q.pop()
        if C[j] == -1:
            C[j] = c
            q += V[j]

n, m = map(int, raw_input().split())
V = [[] for _ in range(n)]
C = [-1] * n
for _ in range(m):
    l, r = map(int, raw_input().split())
    V[l].append(r)
    V[r].append(l)

c = 0
for i in range(n):
    if C[i] == -1:
        bfs(i, c)
        c += 1

q = int(raw_input())
for _ in range(q):
    s, t = map(int, raw_input().split())
    if C[s] == C[t]:
        print "yes"
    else:
        print "no"
n, m = map(int, input().split())
a = list(map(int, input().split()))

n_use = dict(zip(range(1, 10), [2, 5, 5, 4, 5, 6, 3, 7, 6]))
dp = [(0, 0)]*(n+1) # digit and produced number
for a_j in a:
    dp[n_use[a_j]] = (1, max(dp[n_use[a_j]][1], a_j))
for i in range(1, n+1):
    for a_j in a:
        d_cur, path_cur = dp[i]
        i_prev = i - n_use[a_j]
        if i_prev < 0:
            continue
        if dp[i_prev][0] == 0:
            continue
        else:
            d_prev, path_prev = dp[i_prev]
            path_new = a_j*pow(10, d_prev) + path_prev
            if path_new > path_cur:
                dp[i] = (d_prev+1, path_new)
            
# print(dp)
print(dp[-1][1])

### FIXED CODE ###

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

n_use = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [0]+[-float('inf')]*n

for i in range(1, n+1):
    for a_j in a:
        i_prev = i - n_use[a_j]
        if i_prev < 0:
            continue
        else:
            dp[i] = max(dp[i], dp[i_prev]*10+a_j)
# print(dp)
print(dp[-1])
L, R = map(int,input().split())

mod = 2019
for i in range(100):
  if L <= (3**i)%(1e9+7) <= R or L <= (673**i)%(1e9+7) <= R or L <= (3*673*i)%(1e9+7) <= R or L <= (3*i)%(1e9+7) <= R or L <= (673*i)%(1e9+7) <= R or L <= ((3*673)**i)%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

### FIXED CODE ###

L, R = map(int,input().split())

R = min(R, L+673)
ans = 2018
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i*j%2019)
print(ans)
# -*- coding: utf-8 -*-
import math

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

r = {}

for j in a:
    for i in range(1, int(j**0.5)+1):
        if j % i == 0:
            if i in r.keys():
                r[i] += 1
            else:
                r[i] = 1
            if i != j // i:
                if j//i in r.keys():
                    r[j//i] += 1
                else:
                    r[j//i] = 1
m = n - 1
r_a = sorted([i[0] for i in r.items() if i[1] >= m], reverse=True)
print(r_a[0])


### FIXED CODE ###

# -*- coding: utf-8 -*-
import re
import math

[a,b,t] = [int(x) for x in input().split()]

print(math.floor((t+0.5)/a)*b)
import math
a, b, c, d = map(int, input().split())
lcm = int(c*d/math.gcd(c, d))
ans = (b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm)
print(ans)


### FIXED CODE ###

import fractions
a, b, c, d = map(int, input().split())
a = a-1
lcm = int(c*d/fractions.gcd(c, d))
ans = (b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm)
print(ans)
import math

cnt = 0
m = 0
g = []

def insertion_sort(a, n, g):
# cnt+=1 のときにローカルスコープの外を見にいくようにするため
    global cnt
    for i in range(g, n):
        v = a[i]
        k = i - g
        while k >= 0 and a[k] > v:
            a[k+g] = a[k]
            k -= g
            cnt += 1
        a[k+g] = v

def shell_sort(a, n):
    global m, g
    g = []
    h = 1
    while h <= n:
        g.append(h)
        h = h * 3 + 1
    g.reverse()
    m = len(g)
    for i in g:
        insertion_sort(a, n, i)

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
shell_sort(a, n)
print(m)
print(" ".join(map(str, g)))
print(cnt)
for i in a:
    print(i)


### FIXED CODE ###

cnt = 0
m = 0
g = []

def insertion_sort(a, n, g):
# cnt+=1 のときにローカルスコープの外を見にいくようにするため
    global cnt
    for i in range(g, n):
        v = a[i]
        k = i - g
        while k >= 0 and a[k] > v:
            a[k+g] = a[k]
            k -= g
            cnt += 1
        a[k+g] = v

def shell_sort(a, n):
    global m, g
    h = 1
    while h <= n:
        g.append(h)
        h = h * 3 + 1
    g.reverse()
    m = len(g)
    for i in range(m):
        insertion_sort(a, n, g[i])

n = int(input())
a = [int(input()) for i in range(n)]
shell_sort(a, n)
print(m)
print(*g)
print(cnt)
for i in a:
    print(i)
n = int(stdin.readline().rstrip())
data = [int(stdin.readline().rstrip()) for _ in range(n)]
data = sorted(data, reverse=True)
data[0] *= 0.5
data[0] = int(data[0])

print(sum(data))

### FIXED CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
data = [int(stdin.readline().rstrip()) for _ in range(n)]
data = sorted(data, reverse=True)
data[0] *= 0.5
data[0] = int(data[0])

print(sum(data))
def main():
    n, m = map(int, input().split())
    ac = [0] * m
    pena = [0] * m

    for _ in range(m):
        p, s = map(str, input().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            pena[p] += 1
        else:
            ac[p] = 1
    print()


if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np


def main():
    n, m = map(int, input().split())
    ac = np.array([0] * n)
    pena = np.array([0] * n)
    # 
    for _ in range(m):
        p, s = map(str, input().split())
        p = int(p) - 1
        if ac[p] == 0 and s == 'WA':
            pena[p] += 1
        else:
            ac[p] = 1
    print(sum(ac), sum(ac * pena))


if __name__ == '__main__':
    main()
from sympy import nextprime

# input
X = int(input())

print(nextprime(X))

### FIXED CODE ###

# check
def is_prime(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    else:
        for p in range(2, n):
            if n % p == 0:
                return False
        else:
            return True


# input
X = int(input())

while is_prime(X) is False:
    X += 1

print(X)
n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1

for i in range(1, 3):
    if l[i] == -1:
        l[i] = 0
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)

### FIXED CODE ###

n, m = map(int, input().split())
l = [-1]*n

r = True
for i in range(m):
    s, c = map(int, input().split())
    if l[s-1] == -1:
        l[s-1] = c
    else:
        if l[s-1] != c:
            r = False

if l[0] == -1:
    if n == 1:
        l[0] = 0
    else:
        l[0] = 1
if l[0] == 0:
    if n != 1:
        r = False
        
for i in range(1, n):
    if l[i] == -1:
        l[i] = 0
        
if r == True:
    print("".join(map(str, l)))
else:
    print(-1)
N = int(input())
t,a = map(int,input().split())
height = [int(input()) for i in range(N)]
subduction = [float(abs(t-height[i]*0.006-a)) for i in range(N)]
print(min(subduction)) 


### FIXED CODE ###

N = int(input())
t,a = map(int,input().split())
height = list(map(int,input().split()))
subduction = [float(abs(t-height[i]*0.006-a)) for i in range(N)]
ans = float(10**7)
lst = []
for i in range(N):
  if ans > subduction[i]:
    ans = subduction[i]
    lst.append(i)
print(lst[-1]+1)
x = int(input())

count = 0
for i in range(0, x):
    a =  int(input())
    for j in range ( 2,  a ):
        if a % j == 0:
             count += 1
	if j * j > a:
             break;
        
print(x-count)
        



### FIXED CODE ###

x = int(input())

count = 0
for i in range(0, x):
    a =  int(input())
    for j in range ( 2,  a ):
        c = int(a)
        if a % j == 0:
            count += 1
            break;
        if j * j  > c:
            break;
        
print(x-count)
s = {}
s['a']=raw_input()
s['b']=raw_input()
s['c']=raw_input()
def solve(s):
  turn = 'a'
  while True:
    if len(s[turn]) == 0:
      return turn.upper()
    nxt, s[turn] = s[turn][0], s[turn][1:]
   	turn = nxt
print solve(s)

### FIXED CODE ###

def solve(s):
  turn = 'a'
  while True:
    if len(s[turn]) == 0:
      return turn.upper()
    nxt, s[turn] = s[turn][0], s[turn][1:]
    turn = nxt

s = {}
s['a']=raw_input()
s['b']=raw_input()
s['c']=raw_input()
print solve(s)
a,b=map(int,input().split())
if a!=b:
    print(b//a+1)
else:
    priint(b//a)

### FIXED CODE ###

a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    x=(b-1)//(a-1)
    if (b-1)%(a-1)==0:
        print(x)
    else:
        print(x+1)
else:
    print(1)
N = input()
K = input()
X = input()
Y = input()

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)


### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)
def segfunc(x,y):return max(x,y)
ide_ele=0
class segtree():
  def __init__(self,init_val,segfunc=segfunc,ide_ele=ide_ele):
    n=len(init_val)
    self.segfunc=segfunc
    self.ide_ele=ide_ele
    self.num=1<<(n-1).bit_length()
    self.tree=[ide_ele]*2*self.num
    for i in range(n):
      self.tree[self.num+i]=init_val[i]
    for i in range(self.num-1,0,-1):
      self.tree[i]=self.segfunc(self.tree[2*i], self.tree[2*i+1])
  def update(self,k,x):
    k+=self.num
    self.tree[k]=x
    while k>1:
      self.tree[k>>1]=self.segfunc(self.tree[k],self.tree[k^1])
      k>>=1
  def query(self,l,r):
    res=self.ide_ele
    l+=self.num
    r+=self.num+1
    while l<r:
      if l&1:
        res=self.segfunc(res,self.tree[l])
        l+=1
      if r&1:
        res=self.segfunc(res,self.tree[r-1])
      l>>=1
      r>>=1
    return res
def isok(mid,key):
  return st.query(x,mid)>=key
def b_search(x,key):
  ng=x-1
  ok=n
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if isok(mid,key):ok=mid
    else:ng=mid
  return ok+1
n,q=map(int,input().split())
a=list(map(int,input().split()))
st=segtree(a)
ans=[]
for _ in range(q):
  c,x,y=map(int,input().split())
  if c==1:st.update(x-1,y)
  elif c==2:ans+=[st.query(x-1,y)]
  else:ans+=[b_search(x,y)]
print(*ans,sep='\n')


### FIXED CODE ###

def segfunc(x,y):return max(x,y)
ide_ele=0
class segtree():
  def __init__(self,init_val,segfunc=segfunc,ide_ele=ide_ele):
    n=len(init_val)
    self.segfunc=segfunc
    self.ide_ele=ide_ele
    self.num=1<<(n-1).bit_length()
    self.tree=[ide_ele]*2*self.num
    for i in range(n):
      self.tree[self.num+i]=init_val[i]
    for i in range(self.num-1,0,-1):
      self.tree[i]=self.segfunc(self.tree[2*i], self.tree[2*i+1])
  def update(self,k,x):
    k+=self.num
    self.tree[k]=x
    while k>1:
      self.tree[k>>1]=self.segfunc(self.tree[k],self.tree[k^1])
      k>>=1
  def query(self,l,r):
    res=self.ide_ele
    l+=self.num
    r+=self.num+1
    while l<r:
      if l&1:
        res=self.segfunc(res,self.tree[l])
        l+=1
      if r&1:
        res=self.segfunc(res,self.tree[r-1])
      l>>=1
      r>>=1
    return res
def isok(mid,key):
  return st.query(x-1,mid-1)>=key
def b_search(x,key):
  ng=x-1
  ok=n+1
  while abs(ng-ok)>1:
    mid=(ng+ok)//2
    if isok(mid,key):ok=mid
    else:ng=mid
  return ok
n,q=map(int,input().split())
a=list(map(int,input().split()))
st=segtree(a)
ans=[]
for _ in range(q):
  c,x,y=map(int,input().split())
  if c==1:st.update(x-1,y)
  elif c==2:ans+=[st.query(x-1,y-1)]
  else:ans+=[b_search(x,y)]
print(*ans,sep='\n')
N, K = map(int, input().split())
S = input()
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S [K-1] == 'B':
  S[K-1] = 'b'
else:
  S[K-1] = 'c'
print(S)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower() + S[K:])
q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*int(MAX)

print('YES')

### FIXED CODE ###


q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

dic = {}

for k in x :
    if k in dic.keys() :
        dic[k] += 1
    else :
        dic[k] = 1
    
for i in y :
    if i in dic.keys() :
        dic[i] -= 1
        if dic[i] == -1 :
            print('NO')
            exit()
    else :
        print('NO')
        exit()
print('YES')
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod
n,a,b=map(int,input().split())
modd = 10**9+7
print(2**n-comb(n,a,modd)-comb(n,b,modd)-1)

### FIXED CODE ###

n,k = map(int,input().split())
if n >= 10:
    print(k)
else:
    print(100*(10-n)+k)
n=input()
loan=10**5
for i in xrange(n):
    loan+=loan*0.05
    if loan%1000!=0:
        loan-=loan%1000
        loan+=10**3
    else:
        loan-=loan%1000
print(int(loan)

### FIXED CODE ###

n=input()
loan=10**5
for i in xrange(n):
    loan+=loan*0.05
    if loan%1000!=0:
        loan-=loan%1000
        loan+=10**3
    else:
        loan-=loan%1000
print(int(loan))
A,B=map(int,input().split())
min_a=12.5*A;max_a=(100a+1)/8
min_b=10*B;max_b=min_b+1
if(max_b<min_a or max_a<min_b):
  print(-1)
else:
  print(int(round(max(12.5*A,10*B)+0.4999999,0)))

### FIXED CODE ###

A, B =map(int, input().split())
max_A=(A+1)*25/2
max_B=10*(B+1)
p=int(round(max([A*12.5,B*10])+0.4999999999,0))
print(p if(p<min([(A+1)*25/2, 10*(B+1)]) and not(4<5*A-4*B) and not(5*A-4*B<-5)) else -1)
a, b = map(int, input())
print( (a+b+1)/2 )

### FIXED CODE ###

a, b = map(int, input().split())
print( (a+b+1)//2 )
from math import gcd

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

# 解説AC(a*loga)
ans = 0
cnt = [0] * (max(a) + 1)
for ai in a:
    ans = gcd(ans, ai)
    cnt[ai] += 1

if ans != 1:
    print('not coprime')
elif any(sum(cnt[i::i]) > 1 for i in range(max(a) + 1)):
    print('setwise coprime')
else:
    print('pairwise coprime')


### FIXED CODE ###

from math import gcd


def eratosthenes(n):
    prime = []
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if n <= p ** 2:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return data


def factorize(N):  # 素因数分解
    for p in prime_list:
        if p * p > N:
            break
        if N % p == 0 and (p in num):
            print('setwise coprime')
            exit()
        while N % p == 0:
            N //= p
            num.add(p)
    if N > 1:
        if N in num:
            print('setwise coprime')
            exit()
        num.add(N)


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

ans = 0
for ai in a:
    ans = gcd(ans, ai)
if ans != 1:
    print('not coprime')
    exit()

prime_list = eratosthenes(10 ** 6)
num = set()
for ai in a:
    factorize(ai)
else:
    print('pairwise coprime')
class Puzzle:
    def __init__(self,panel,space,cnt):
        self.panel=panel
        self.space=space
        self.cnt=cnt

d=(1,-1,4,-4)
model=map(str,range(8)):
def check(s):
    if s==model
        return True
    return False

def bfs(s):
    m=set()
    que=[s]
    m.add(tuple(s.panel))
    while que!=[]:
        now=que[0]
        del que[0]
        if check(now.panel):
            return now.cnt
        idx1=now.space
        for i in range(4):
            idx2=idx1+d[i]
            if idx2<0 or idx2>7:
                continue
            if (idx1==3 and d[i]==1) or (idx1==4 and d[i]==-1):
                continue
            next_panel=now.panel[:]
            next_panel[idx2],next_panel[idx1]=now.panel[idx1],now.panel[idx2]
            next=Puzzle(next_panel,idx2,now.cnt+1)
            if tuple(next.panel) not in m:
                m.add(tuple(next.panel))
                que.append(next)
    return -1

while True:
    try:
        panel=raw_input().split()
    except EOFError:
        break
    space=panel.index("0")
    s=Puzzle(panel,space,0)
    ans=bfs(s)
    print ans

### FIXED CODE ###

from collections import defaultdict
d=(1,-1,4,-4)

def solve():
    que=["01234567"]
    while que!=[]:
        v=que[0]
        del que[0]
        pos=v.index("0")
        for i in range(4):
            idx2=pos+d[i]
            if idx2<0 or idx2>7:
                continue
            if (pos==3 and d[i]==1) or (pos==4 and d[i]==-1):
                continue
            u=list(v)
            u[pos],u[pos+d[i]]=u[pos+d[i]],u[pos]
            u="".join(u)
            if res[u]==0:
                que.append(u)
                res[u]=res[v]+1
res=defaultdict(int)
res["01234567"]=1
solve()
while True:
    try:
        s=raw_input().split()
    except EOFError:
        break
    s="".join(s)
    print res[s]-1
n, m =map(int,input().split())
A = list(map(int,input().split()))
BC = [tuple(map(int,input().split()))for i in range(m)]

A.sort()
BC.sort(key= lambda x : -x[1])


i = 0
for b, c in BC:
    for _ in range(b):
        if c <=  A[i] : break
        A[i] = c
        i += 1
        if i >= n: break
    else:
        continue
print(sum(A))

### FIXED CODE ###

n, m =map(int,input().split())
A = list(map(int,input().split()))
BC = [tuple(map(int,input().split()))for i in range(m)]

A.sort()
BC.sort(key= lambda x : -x[1])


i = 0
for b, c in BC:
    for _ in range(b):
        if c <=  A[i] : break
        A[i] = c
        i += 1
        if i >= n: break
    else:continue
    break
print(sum(A))
a=int(input())
b=0
c=[0]*a
for i in range(1,a+1):
  while 1:
    b%=2
    if b%2!=0:
      c[i]=b
      break
    b+=1
print(max(c))
      
  

### FIXED CODE ###

a=int(input())
b=0
for i in range(7):
  if 2**i<=a:
    b=2**i
print(b)
import functools
import math

n = int(input())
a = [int(i) for i in input().split()]
l = []
for i in range(n):
 b = a[i]
 del a[i]
 l.append(functools.reduce(math.gcd, a))
 a.insert(i,b)
print(max(l))

### FIXED CODE ###

import fractions
n = int(input())
a = list(map(int,input().split()))
l = []
m = []
l.append(0)
m.append(0)
for i in range(n):
    l.append(fractions.gcd(l[i],a[i]))
    m.append(fractions.gcd(m[i],a[-(i+1)]))
b = [fractions.gcd(l[i],m[-(i+2)]) for i in range(n)]
print(max(b))
s=input();c=[f=0]*26
for i in s:c[ord(i)-97]+=1
for i in c:f+=i%2
print("YNeos"[!!f::2])

### FIXED CODE ###

s=input();c=[0]*26;f=0
for i in s:c[ord(i)-97]+=1
for i in c:f+=i%2
print("YNeos"[(f>0)::2])