Harryxun/stf_run huggingface dataset:
import sys
from fractions import Fraction
mod = 1000000007

def solve():
    input = sys.stdin.readline
    N = int(input())
    F = [[int(i) for i in input().split()] for _ in range(N)]
    D = dict()
    for x, y in F:
        if x == y == 0: tan = "NG"
        elif x == 0: tan = "Inf"
        elif y == 0: tan = 0
        else: tan = Fraction(y, x)

        if tan in D: D[tan] += 1
        else: D[tan] = 1

    ans = 1
    used = set()
    for key in D:
        if key not in used:
            this = D[key]
            used |= {key}
            if key == "Inf":
                op = (0 if 0 not in D else D[0])
                used |= {0}
            elif key == 0: 
                op = (0 if "Inf" not in D else D["Inf"])
                used |= {"Inf"}
            else: 
                nu, de = key.numerator, key.denominator
                op = (0 if Fraction(-de, nu) not in D else D[Fraction(-de, nu)])
                used |= {Fraction(-de, nu)}
            select = (pow(2, this, mod) + pow(2, op, mod) - 1) % mod
            ans *= select
            ans %= mod
    if "NG" in D: ans += D["NG"]
    ans = (ans - 1 + mod) % mod
    #print(D)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
from math import gcd
from fractions import Fraction
mod = 1000000007

def solve():
    input = sys.stdin.readline
    N = int(input())
    F = [[int(i) for i in input().split()] for _ in range(N)]
    D = dict()
    zero, inf, ng = 0, 0, 0
    for x, y in F:
        if x == 0 and y == 0: ng += 1
        elif x == 0: inf += 1
        elif y == 0: zero += 1
        else: 
            g = gcd(abs(x), abs(y))
            if x < 0:
                y *= -1
                x *= -1
            x //= g
            y //= g
            tan = (y, x)
            if tan in D: D[tan] += 1
            else: D[tan] = 1

    ans = 1
    ans *= (pow(2, zero, mod) + pow(2, inf, mod) - 1) % mod
    ans %= mod
    used = set()
    for key in D:
        if key not in used:
            this = D[key]
            used |= {key}
            y, x = key
            rev = ((-x, y) if y > 0 else (x, -y))
            op = (0 if rev not in D else D[rev])
            used |= {rev}
            select = (pow(2, this, mod) + pow(2, op, mod) - 1) % mod
            ans *= select
            ans %= mod
    ans += ng
    ans %= mod
    ans = (ans - 1 + mod) % mod
    #print(D)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
*a, = map(int, input().split())

s = [0]*(n+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
for i in range(len(s)):
    s[i] = (s[i] - i)%k

cnt = [0]*k
left = 0
right = k-1
if right > n:
    right = n

for i in range(right+1):
    cnt[s[i]] += 1

ans = 0
while left < right:
    ans += cnt[s[left]]-1
    if right == n:
        cnt[s[left]] -= 1
        left += 1
    else:
        cnt[s[left]] -= 1 
        left += 1
        right += 1
        cnt[s[right]] += 1 

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n, k = map(int, input().split())
*a, = map(int, input().split())

s = [0]*(n+1)
for i in range(len(a)):
    s[i+1] = s[i] + a[i]
for i in range(len(s)):
    s[i] = (s[i] - i)%k

from collections import defaultdict
cnt = defaultdict(int)

left = 0
right = k-1
if right > n:
    right = n

for i in range(right+1):
    cnt[s[i]] += 1

ans = 0
while left < right:
    ans += cnt[s[left]]-1
    if right == n:
        cnt[s[left]] -= 1
        left += 1
    else:
        cnt[s[left]] -= 1 
        left += 1
        right += 1
        cnt[s[right]] += 1 

print(ans)
n,a,b=input(),input(),input()
n=int(n)
a=int(a)
b=int(b)
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

### FIXED CODE ###

n,a,b=map(int, input().split())
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s)):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))


### FIXED CODE ###

import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s) - 1):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))
n,k=map(int,input().split())
x=list(map(int,input().split()))

if x[n-1]<0 :
    t=x[-k]
    print(t)
elif x[n-1]==0 :
    t=x[-k+1]
    print(t)

elif x[0]>0:
    t=x[k-1]
    print(t)
elif x[0]==0:
    t=x[k-1]
    print(t)

else:
    for i in range(n-1):
        if x[i]<0 and x[i+1]>=0 :
            i0=i+1
            break
#    print(i0)
    tmin=10**9
    for i in range(i0,i0+k-1):
        kt=i
        t=x[kt]*2-x[kt-k+1]
#        print("1",kt,kt-k+1,t,x[kt],x[kt-k+1])
        if t<tmin:
            tmin=t
    for i in range(i0+1-k,i0):
        kt=i
        t=-x[kt]*2+x[kt+k-1]
#        print("2",kt,kt+k-1,t,x[kt],x[kt+k-1])
        if t<tmin:
            tmin=t
    print(tmin)

### FIXED CODE ###

from bisect import bisect_right
from bisect import bisect_left

n,k=map(int,input().split())
#n=100000
#k=100000

#n=100000
#k=100000
x=list(map(int,input().split()))

if x[n-1]<0 :
    t=-x[-k]
#    print(1)
    print(t)
elif x[n-1]==0 :
    t=-x[-k+1]
#    print(2)
    print(t)

elif x[0]>0:
    t=x[k-1]
#    print(3)
    print(t)
elif x[0]==0:
    t=x[k-1-1]
#    print(4)
    print(t)

else:
    iz=bisect_left(x,0)
    if x[iz+1]==0:
        k=k-1
        tmin=10**9
#        print((iz-(k-1)+1),iz,n-1-(k-1))
        for i in range(max(0,iz-(k-1)+1),min(iz,n-1-(k-1)+1)):
            kt=i
            t1=-x[kt]+x[kt+(k-1)]*2
            t2=-x[kt]*2+x[kt+(k-1)]
#        print("2",kt,kt+k-1,t,x[kt],x[kt+k-1])
#            print(tmin,t1,t2)
            if t1<tmin:
                tmin=t1
            if t2<tmin:
                tmin=t2
    else:
        tmin=10**9
#        print((iz-(k-1)+1),iz,n-1-(k-1))
        for i in range(max(0,iz-(k-1)+1),min(iz,n-1-(k-1)+1)):
            kt=i
            t1=-x[kt]+x[kt+(k-1)]*2
            t2=-x[kt]*2+x[kt+(k-1)]
#        print("2",kt,kt+k-1,t,x[kt],x[kt+k-1])
#            print(tmin,t1,t2)
            if t1<tmin:
                tmin=t1
            if t2<tmin:
                tmin=t2
    print(tmin)
    
#  299993628 
# 1000000000        
#   99990701
N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(10 ** 5 + 1)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)

### FIXED CODE ###

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

L = [0 for _ in range(10 ** 5 + 2)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)
n = int(input())

print((n*n) - a)

### FIXED CODE ###

n = int(input())
a = int(input())

print(int((n*n) - a))
N, K = map(int, input().split())
A = list(map(int, input().split())).sort().reverse()

print(sum(A[:K]))

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A.reverse()
print(sum(A[:K]))
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.append()
B.append()
ans=0
for i in range(1,N+1):
	ans+=B[A[i-1]-1]
	if A[i-1]==A[i]-1:
		ans+=C[A[i-2]]
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.append(100)
B.append(100)
C.insert(0,0)
ans=0
for i in range(1,N+1):
	ans+=B[A[i-1]-1]
	if A[i-1]==A[i]-1:
		ans+=C[A[i-1]]
print(ans)
n,k = map(int, input().split())
from fractions import gcd

if n % k== 0:
  print 0
else:
  mini = n
  s = set()
  while True:
    if n > k:
      n = n % k
    else:
      n = abs(n-k)
    mini = min(n, mini)
    if n in s:
      print mini
      break
    s.add(n)
    

### FIXED CODE ###

n,k = map(int, raw_input().split())
from fractions import gcd

if n % k== 0:
  print 0
else:
  mini = n
  s = set()
  while True:
    if n > k:
      n = n % k
    else:
      n = abs(n-k)
    mini = min(n, mini)
    if n in s:
      print mini
      break
    s.add(n)
N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))

sort(p)
print(sum(p[:K]))

         
           

### FIXED CODE ###

N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))
 
p.sort()
print(sum(p[:K]))
N = input()

A = input().split(' ')

total = 0
B = [0]
dic = {}

for i in range(N):
    total += int(A[i])
    B.append(total)

for b in B:
    if b in dic:
        dic[b] +=1
    else:
        dic[b] = 1
def C(n):
    return int(n*(n-1)/2)

ans = 0;

for k,v in dic.items():
    ans += C(v)

print(ans)


### FIXED CODE ###

N = int(input())

A = input().split(' ')

total = 0
B = [0]
dic = {}

for i in range(N):
    total += int(A[i])
    B.append(total)

for b in B:
    if b in dic:
        dic[b] +=1
    else:
        dic[b] = 1
def C(n):
    return int(n*(n-1)/2)

ans = 0;

for k,v in dic.items():
    ans += C(v)

print(ans)
import numpy as np
N = int(input())
h = list(map(int, input().split()))
defa = np.inf
dp = [defa] * (N+1)

def rec(i):
  if dp[i] != defa:
    return dp[i]
  if i == 0:
    dp[i] = 0
    return 0
  res = defa
  res = min(res, rec(i-1)+np.abs(h[i] - h[i-1]))
  if i >= 2:
    res = min(res, rec(i-2)+np.abs(h[i] - h[i-2]))
  dp[i] = res
  return dp[i]
n = int(rec(N-1))
print(n)

### FIXED CODE ###

import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])
import sys
input = sys.stdin.readline
#from itertools import groupby
import numpy as np
def print_ans(N, input_line):
    """Test Case
    >>> print_ans(4, "0 1 1 2")
    2
    >>> print_ans(4, "1 1 1 1")
    0
    >>> print_ans(7, "0 3 2 1 2 2 1")
    24
    """
    ar = list(map(int,input_line.split()))
    ngflg = False
    if ar[0] != 0:
        ngflg = True
    ar = sorted(ar[1:])
    check_ar = list(set(ar))
    if check_ar[0] == 0:
        ngflg = True
    # for i in range(len(check_ar) - 1):
    #     if check_ar[i] + 1 != check_ar[i + 1]:
    #         ngflg = True
    ar = np.array(ar)
    tmp = np.split(ar, np.cumsum(np.unique(ar, return_counts=True)[1])[:-1])
    if ngflg:
        print("0")
    else:
        # ans_ar= np.array([int(k) ** len(list(g)) for k, g in groupby(ar)])
        ans = 1
        for i in range(1,len(tmp)):
            ans *=  len(tmp[i -1]) ** len(tmp[i])

        print(ans % 998244353)
        # print(np.prod(ans_ar) % 998244353)

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = input().rstrip()
    print_ans(N, ar)


### FIXED CODE ###

import sys
input = sys.stdin.readline
#from itertools import groupby
import numpy as np
def print_ans(N, input_line):
    """Test Case
    >>> print_ans(4, "0 1 1 2")
    2
    >>> print_ans(4, "1 1 1 1")
    0
    >>> print_ans(7, "0 3 2 1 2 2 1")
    24
    """
    ar = list(map(int,input_line.split()))
    ngflg = False
    if ar[0] != 0:
        ngflg = True
    k = max(ar)
    tmp_ar = [0] * (k + 1)
    for i in range(1,N):
        tmp_ar[ar[i]] += 1
    if tmp_ar[0] > 0:
        ngflg = True
    if ngflg:
        print("0")
    else:
        ans = 1
        for j in range(2, k + 1):
            ans *=  tmp_ar[j - 1] ** tmp_ar[j]

        print(ans % 998244353)
        # print(np.prod(ans_ar) % 998244353)

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = input().rstrip()
    print_ans(N, ar)
import math
N, M = map(int, input().split())
S = input()
T = input()
g = math.gcd(N, M)
flag = True
n = int(N / g)
m = int(M / g)
for k in range(g):
  flag *= int(S[n*m*k] == T[n*m*k])
if flag == 0:
  out = -1
else:
  out = n * m * g
print(out)

### FIXED CODE ###

import fractions
N, M = map(int, input().split())
S = input()
T = input()
g = fractions.gcd(N, M)
n = N // g
m = M // g
out = n * m * g
for k in range(g):
  if S[k * n] != T[k * m]:
    out = -1
    break
print(out)
import itertools

def q49(n, k, h):
    h.sort()
    a = [h[i+k-1]-h[i] for i in range(n-1)]
    return min(a)
            
N, K = [int(i) for i in input().split()]
h = []
for _ in range(N):
    h.append(int(input()))
print(q49(N, K, h))

### FIXED CODE ###

import itertools

def q49(n, k, h):
    h.sort()
    a = [h[i+k-1]-h[i] for i in range(n-k+1)]
    return min(a)
            
N, K = [int(i) for i in input().split()]
h = []
for _ in range(N):
    h.append(int(input()))
print(q49(N, K, h))
n,m = map(int,input().split())
l = [input().split() for _ in range(m)]

o = [l[i][0] for i in range(m)]
p = list(set(o))

t = 0
f = 0

for i in p:
  q = [l[j][1] for j in range(m) if l[j][0] == i ]
  tf = q.count("AC")
  if tf != 0:
    t = t + 1
  d = q.index("AC")
  f = f + d
print(t,f)

### FIXED CODE ###

n,m=map(int,input().split())
l=[0]*(n+1)
p=0
for _ in range(m):
  a,b=list(input().split())
  if str(b)=="AC" and l[int(a)]!=-1:
    p+=l[int(a)]
    l[int(a)]=-1
  elif str(b)=="WA" and l[int(a)]!=-1:
    l[int(a)]+=1
print(l.count(-1),p)
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2] - sum(a[1::2])))

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))
import math, sys

N=int(input())
S=input()
R_count=0
for i in range(N):
    if S[i]=="R":
        R_count+=1

ans=R_count
ind=S.index("R")
if ind>R_count:
    print(R_count)
    sys.exit()

#ans-=ind
S=S[ind:]
while S[0]=="R":
    S=S[1:]
    ans-=1
print(ans)

### FIXED CODE ###

import math, sys

N=int(input())
S=input()
R_count=0
if "R" not in S:
    print(0)
    sys.exit()
if "W" not in S:
    print(0)
    sys.exit()
if "R" not in S[S.index("W"):]:
    print(0)
    sys.exit()
for i in range(N):
    if S[i]=="R":
        R_count+=1

S=S[:R_count]
ans=S.count("W")
print(ans)
169A

#　1．入力をちゃんと受け取ること
# ex:「2 5」=>a=2,b=5と変数を作成する
# スペース区切りの入力を整数として受け取る例
a, b = map(int, input().split())
# print(a)
# print(b)

# 2．目的通りの計算をする
# ex:2つの整数AとBの掛け算をやる
answer = a * b

# 3.計算結果を出力する
print(answer)

### FIXED CODE ###

# 169A
#　1．入力をちゃんと受け取ること
# ex:「2 5」=>a=2,b=5と変数を作成する
# スペース区切りの入力を整数として受け取る例
a, b = map(int, input().split())
# print(a)
# print(b)

# 2．目的通りの計算をする
# ex:2つの整数AとBの掛け算をやる
answer = a * b

# 3.計算結果を出力する
print(answer)
N = input()
A = [int(x) for x in input().split()]
x=0
for i in A:
  if A%2==0:
    if not A%3==0 or A%5==0:
      print("DENIED")
      x=1
      break
    
  else:
   	continue
  break
if x !=0:
	print("APPROVED")
  

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
 
x=0
for i in A:

  if i%2==0:
    if not i%3==0 and not i%5==0:
      print("DENIED")
      x=1
      break
    else:
      continue
    
  else:
   	continue
  break
if x ==0:
	print("APPROVED")
# -*- coding: utf-8 -*-

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

d.sort()
t.sort()

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d = array_count(d)
t = array_count(t)

cand = [0] * 200000

for i in range(len(d)):
    cand[d[i][0]] += d[i][1]

for i in range(len(t)):
    cand[t[i][0]] -= t[i][1]

flag = True
for i in range(len(cand)):
    if cand[i] < 0:
        flag = False

if flag:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

# -*- coding: utf-8 -*-

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

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d.sort()
t.sort()

d = array_count(d)
t = array_count(t)

for i in range(len(t)):
    t[i][1] = -1 * t[i][1]
    d.append(t[i])

d.sort()

for i in range(1,len(d)):
    if d[i-1][0] == d[i][0]:
        d[i-1][1] = d[i-1][1] + d[i][1]
        d[i][1] = 0

flag = True

for i in range(len(d)):
    if d[i][1] < 0:
        flag = False
        break

if flag:
    print("YES")
else:
    print("NO")
from collections import defaultdict
N,M,*A = map(int, open('0').read().split())
ls = [0]*10
ls[1] = 2
ls[2] = 5
ls[3] = 5
ls[4] = 4
ls[5] = 5
ls[6] = 6
ls[7] = 3
ls[8] = 7
ls[9] = 6
dic = defaultdict(int)
for a in A:
  k = ls[a]
  dic[k] = max(dic[k],a)
dp = [-1]*(N+1)
for k in dic.keys():
  if k>N:
    continue
  dp[k] = dic[k]
for i in range(N+1):
  for k in dic.keys():
    if i-k>0 and dp[i-k]!=-1:
      s = str(dp[i-k])
      m = int(s+str(dic[k]))
      dp[i] = max(dp[i], m)
print(dp[N])

### FIXED CODE ###

n,m=map(int,input().split())
A=list(map(int,input().split()))
L=[0,2,5,5,4,5,6,3,7,6]
dp=[0]+[-1]*n
for i in range(n+1):
  for a in A:
    if i+L[a]<=n:
      dp[i+L[a]]=max(dp[i+L[a]],dp[i]*10+a)
print(dp[n])
n=int(input())
m=int(input())
print((n-1)*(m-1))

### FIXED CODE ###

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

print((n-1)*(m-1))
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[i + 1] % n) for i in range(n)]
    print(max(ans))
    
p_c()

### FIXED CODE ###

from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()
#n=int(input())
#A=[]
#X=[]
#Y=[]
#for i in range(n):
 # a=int(input())
 # A.append(a)
 # x=[]
 # y=[]
  #for j in range(a):
   # x1,y1=[int(s) for s in input().split()]
   # x.append(x1)
    #y.append(y1)
  #X.append(x)
  #Y.append(y)
  
#c=0
#for i in range(n):
 # l=[1]*n
  #for j in range(i, n-i):
   # if l[j]==0:continue
    #for k in range(A[j]):
    　#　l[X[j][k]] *= Y[j][k]
  #if c<l.count(1):
   # c=l.count(1) 
  
        
  
#print(c)  
  
  
  
  
  
  
  
  
  
  
  
  
  

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
R = 2**15+1
dp = [[0]*R for i in range(4)]
for i in range(1,182):
	dp[0][i**2] += 1
for k in range(1,4):
	for i in range(1,182):
		for j in range(i**2,R-i**2):
			dp[k][j+i**2] += dp[k-1][j]

while 1:
	n = input()
	if n == 0: break
	print sum(dp[i][n] for i in range(4))

### FIXED CODE ###

for loop in range(int(raw_input())):
    manu = raw_input()
    msg = raw_input()
    size = len(msg)
    
    for s in manu[::-1]:
        if   s == "J":
            msg = msg[-1]+msg[:-1] if size > 1 else msg
        elif s == "C":
            msg = msg[1:]+msg[0] if size > 1 else msg
        elif s == "E":
            if size == 1: continue
            if size%2 == 0:
                msg = msg[size/2:]+msg[:size/2]
            else:
                msg = msg[size/2+1:]+msg[size/2]+msg[:size/2]
        elif s == "A":
            msg = msg[::-1]
        elif s == "P":
            for i in range(len(msg)):
                if msg[i].isdigit():
                    msg = msg[:i]+str((int(msg[i])-1+10)%10)+msg[i+1:]
        elif s == "M":
            for i in range(len(msg)):
                if msg[i].isdigit():
                    msg = msg[:i]+str((int(msg[i])+1)%10)+msg[i+1:]
    
    print msg
import numpy as np
import sys
input = sys.stdin.readline


def get_primes(a=10**6):
    table = np.ones(a+1)
    table[:2] = False
    for i in range(2, a):
        table[i+i::i] = False
    primes = np.where(table==True)[0]
    return primes


def main():
    n = int(input())
    A = np.array(input().split(), dtype=np.int64)
    primes = get_primes(A.max())

    fact_counts = A.reshape([1, -1]) % primes.reshape([-1, 1]) == 0
    count = fact_counts.sum(axis=1).max()

    if count == 1:
        print("pairwise coprime")
    elif count != n:
        print("setwise coprime")
    else:
        print("not coprime")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = list(map(int, input().split()))

    counts = [0] * (10**6 + 1)
    for a in A:
        counts[a] += 1

    ans = 1
    for i in range(2, 10**6+1):
        co_primes = 0
        for j in range(i, 10**6+1, i):
            co_primes += counts[j]
        if ans < co_primes:
            ans = co_primes

    if ans == 1:
        print("pairwise coprime")
    elif ans < n:
        print("setwise coprime")
    else:
        print("not coprime")


if __name__ == "__main__":
    main()
S = input()
ans, prev, cur = 0, "", ""
for s in S:
    cur += 
    if cur != prev:
        ans += 1
        prev, cur = cur, ""
print(ans)

### FIXED CODE ###

S = input()
ans, prev, cur = 0, "", ""
for s in S:
    cur += s
    if cur != prev:
        ans += 1
        prev, cur = cur, ""
print(ans)
n, m = [int(x) for x in input().split()]
a_list = [0] * m
for i in range(m):
    a_list[i] = int(input())

mod = 1000000007

temp_list = [0] * (n + 1)
temp_list[0] = 1
if a_list[0] != 1:
    temp_list[1] = 1
    j = 0
else:
    j = 1

for i in range(2, n + 1):
    if j < m and i == a_list[j]:
        j += 1
        continue
    temp_list[i] = (temp_list[i - 2] + temp_list[i - 1]) % mod
print(temp_list[n])

### FIXED CODE ###

n, m = [int(x) for x in input().split()]
a_list = [0] * m
for i in range(m):
    a_list[i] = int(input())

mod = 1000000007

temp_list = [0] * (n + 1)
temp_list[0] = 1
temp_list[1] = 1
j = 0
if j < m and a_list[0] == 1:
    temp_list[1] = 0
    j = 1

for i in range(2, n + 1):
    if j < m and i == a_list[j]:
        j += 1
        continue
    temp_list[i] = (temp_list[i - 2] + temp_list[i - 1]) % mod
print(temp_list[n])