Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# vim: set fileencoding=utf-8 :
k, s = map(int, raw_input().split())
patterns = []

for x in range(k + 1):
    nokori = s - x
    for y in range(k + 1):
        if 0 <= nokori - y <= k:
            patterns.append([x, y, nokori - y])

ct = len(patterns)
print(ct)


### FIXED CODE ###

# vim: set fileencoding=utf-8 :
k, s = map(int, raw_input().split())
patterns = []
ct = 0

for x in range(k + 1):
    nokori = s - x
    for y in range(k + 1):
        if 0 <= nokori - y <= k:
            ct += 1

print(ct)
### BUGGY CODE ###

r,c=map(int,input().split())
grid=[input() for _ in [0]*r]
ans=sum([grid[i].count(".") for i in range(r)])
q=[]
[[q.append([i,j]) for j in range(c) if grid[i][j]=="#"] for i in range(r)]
visit=[[grid[i][j]=="#" for j in range(c)] for i in range(r)]
d=[(1,0),(-1,0),(0,1),(0,-1)]
cnt=0

while q:
    qq=[]
    while q:
        i,j=q.pop()
        for dx,dy in d:
            if 0<=i+dx<r and 0<=j+dy<c:
                if i+dx==r-1 and j+dy==c-1:
                    flag=True
                if visit[i+dx][j+dy]==False:
                    visit[i+dx][j+dy]=True
                    qq.append([i+dx,j+dy])
    q=qq
    cnt+=1
    
print(cnt-1)

### FIXED CODE ###

H,W = list(map(int,input().split()))
A = [list(str(input())) for i in range(H)]
 
black = []
 
cnt = 0
 
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            black.append([i,j])
 
length = len(black)
            
while (length < H*W):
    gray = []
    for l in black:
        if l[1] != 0:
            c1 = (l[0],l[1]-1)
            if A[c1[0]][c1[1]] == ".":
                gray.append(c1)
                A[c1[0]][c1[1]] = "#"
        if l[1] != W-1:
            c2 = (l[0],l[1]+1)
            if  A[c2[0]][c2[1]] == ".":
                gray.append(c2)
                A[c2[0]][c2[1]] = "#"
        if l[0] != 0:
            c3 = (l[0]-1,l[1])
            if  A[c3[0]][c3[1]] == ".":
                gray.append(c3)
                A[c3[0]][c3[1]] = "#"
        if l[0] != H-1:
            c4 = (l[0]+1,l[1])
            if  A[c4[0]][c4[1]] == ".":
                gray.append(c4)
                A[c4[0]][c4[1]] = "#"
    
    gray = list(set(gray))
    black = [l for l in gray]
    
    cnt += 1
    length += len(black)
    
print(cnt)
### BUGGY CODE ###

n,m=map(int, input().split())
a=[list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x: x[1],reverse=True)
x=[1 for i in range(m)]
ans=0
count=0
for i in range(n):
    if a[i][0]<=m:
        for j in range(a[i][0]-1,m):
            if x[j]==1:
                ans+=a[i][1]
                x[j]=-1
                break
            

print(ans)

        


        
        
    
    
        



### FIXED CODE ###

import heapq
def heapify(x):
    for i in reversed(range(n//2)):
        _siftup(x, i)
 
n,m = map(int,input().split())
 
l = []
for i in range(n):
    ab = list(map(int,input().split()))
    l.append(ab)
l.sort()
q = []
ans = 0
cnt = 0
for i in range(1,m+1):
    while cnt < n and l[cnt][0] == i:
        heapq.heappush(q,-l[cnt][1])
        cnt += 1
    
    if len(q) != 0:
        ans += -heapq.heappop(q)
 
print(ans)
### BUGGY CODE ###



def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    H,W=MI()
    A=[]
    A.append(list("#"*(W+2)))
    for i in range(H):
        A.append(list("#"+input()+"#"))
    A.append(list("#"*(W+2)))
    
    
    import queue
    q=queue.Queue()
    
    inf=-1
    dMap=[[inf]*(W+2)for _ in range(H+2)]
    for i in range(1,H+1):
        for j in range(1,W+1):
            if A[i][j]=="#":
                q.put((i,j,0))
                dMap[i][j]=0
                
    for i in range(H+2):
        dMap[i][0]=0
        dMap[i][-1]=0
        
    for j in range(W+2):
        dMap[0][j]=0
        dMap[-1][j]=0
        
    
    dx=[0,0,1,-1]
    dy=[1,-1,0,0]
    
    ans=0
    while not q.empty():
        ii,jj,d=q.get()
        dMap[ii][jj]=d
        ans=max(ans,dMap[ii][jj])
        for k in range(4):
            nxt_i=ii+dx[k]
            nxt_j=jj+dy[k]
            if dMap[nxt_i][nxt_j]==inf:
                q.put((nxt_i,nxt_j,d+1))
                
    print(ans)
                
                
    
            

main()


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]

black_idx = []
for h in range(H):
    for w in range(W):
        if A[h][w] == "#":
            black_idx.append([h,w])

distance = [[float("inf")]*W for _ in range(H)]
for b in black_idx:
    distance[b[0]][b[1]] = 0

d = deque(black_idx)
ans = 0

while d:
    y, x = d.popleft()
    for new_y, new_x in ([y+1, x], [y, x+1], [y-1, x], [y, x-1]):
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1 and distance[y][x] + 1 < distance[new_y][new_x]:
            distance[new_y][new_x] = distance[y][x] + 1
            ans = max(ans, distance[y][x] + 1)
            d.append([new_y, new_x])

print(ans)
### BUGGY CODE ###

n, k = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

INF = 10 ** 18
DP = [INF] * n
DP[0] = 0

for i in range(1, n):
    DP[i] = min(DP[i-j] + abs(H[i] - H[i-j]) if i - j >= 0 else INF for j in range(1, k+1))

print(DP[n-1])

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

INF = 10 ** 18
DP = [INF] * n
DP[0] = 0

for i in range(n):
    for j in range(1, k+1):
        if i + j >= n:
            break
        DP[i+j] = min(DP[i+j], DP[i] + abs(H[i+j] - H[i]))

print(DP[n-1])
### BUGGY CODE ###

def resolve():
    N = int(input())
    A = [int(input()) for n in range(N)]
    B = A.copy()
    B.sort()
    for i in range(N):
        if max(A) > A[i]:
            print(max(A))
        elif max(A) == A[i]:
            if A.count(max(A)) >= 2:
                print(max(A))
            else:
                print(B[-2])
    return

resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = [int(input()) for n in range(N)]
    B = A.copy()
    B.sort()
    mx = max(A)
    count = A.count(mx)

    for i in range(N):
        if mx > A[i]:
            print(mx)
        elif mx == A[i]:
            if count >= 2:
                print(mx)
            else:
                print(B[-2])
    return


resolve()
### BUGGY CODE ###

import queue
INF=-1

N,M=[int(e) for e in input().split(' ')]

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

for i in range(M):
    u,v=[int(e) for e in input().split(' ')]
    to[u-1].append(v-1)
S,T=[int(e)-1 for e in input().split(' ')]

dist=[[INF for i in range(3)] for j in range(N)]
q=queue.Queue()
q.put([S,0])
dist[S][0]=0

while(not q.empty()):
    v,l=q.get()
    for v_to in to[v]:
        nl=(l+1)%3
        if dist[v_to][nl] != INF:
            continue
        dist[v_to][nl]=dist[v][l]+1
        q.put([v_to,nl])
ans=dist[T][0]
if ans == INF:
    ans = -1
else:
    ans=ans//3

print(ans)


### FIXED CODE ###

#import queue
from collections import deque
INF=-1

N,M=[int(e) for e in input().split(' ')]

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

for i in range(M):
    u,v=[int(e) for e in input().split(' ')]
    to[u-1].append(v-1)
S,T=[int(e)-1 for e in input().split(' ')]

dist=[[INF for i in range(3)] for j in range(N)]

q=deque([])
q.append([S,0])

dist[S][0]=0

while(q):
    v,l=q.popleft()
    for v_to in to[v]:
        nl=(l+1)%3
        if dist[v_to][nl] != INF:
            continue
        dist[v_to][nl]=dist[v][l]+1
        q.append([v_to,nl])
ans=dist[T][0]
if ans == INF:
    ans = -1
else:
    ans=ans//3

print(ans)
### BUGGY CODE ###

from collections import deque


def main():

    h, w = map(int, input().split())
    a = [input() for _ in range(h)]

    d = [[-1] * w for _ in range(h)]

    def bfs():
        q = deque()
        for i in range(h):
            for j in range(w):
                if a[i][j] == "#":
                    q.append((j, i))
                    d[i][j] = 0

        dxy = (1, 0), (-1, 0), (0, 1), (0, -1)

        ans = 0
        while q:
            ux, uy = q.popleft()
            for dx, dy in dxy:
                vx = ux + dx
                vy = uy + dy
                if 0 <= vx <= w - 1 and 0 <= vy <= h - 1 and a[vy][vx] == "." and d[vy][vx] == -1:
                    d[vy][vx] = d[uy][ux] + 1
                    ans = max(ans, d[vy][vx])
                    q.append((vx, vy))

        return ans

    ans = bfs()
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from scipy.ndimage import distance_transform_cdt


def main():
    h, w = map(int, input().split())
    a = [list(input()) for _ in range(h)]

    sq = [[1 if e == "." else 0 for e in row] for row in a]

    cnt = distance_transform_cdt(sq, metric="taxicab")

    print(cnt.max())


if __name__ == "__main__":
    main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
s = input()
q = int(input())

for i in range(q):
    query = input()
    if query == "1":
        s = s[::-1]
    else:
        x, q2_1, q2_2 = query.split()
        if q2_1 == "1":
            s = q2_2+s
        else:
            s += q2_2
print(s)

### FIXED CODE ###

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

s = list(input())
q = int(input())

a = deque(s)
reverse = False

for i in range(q):
    query = input()
    if query == "1":
        if reverse:
            reverse = False
        else:
            reverse = True
    else:
        x, q2_1, q2_2 = query.split()
        if q2_1 == "1":
            if reverse:
                a.append(q2_2)
            else:
                a.appendleft(q2_2)
        else:
            if reverse:
                a.appendleft(q2_2)
            else:
                a.append(q2_2)

s = list(a)
if reverse:
    s = s[::-1]
    print("".join(s))
else:
    print("".join(s))
### BUGGY CODE ###

n,m = map(int,input().split())
H = list(map(int,input().split()))
A,B = [0]*m,[0]*m
for i in range(m): A[i],B[i] = map(int,input().split())

ans = 0
for i in range(n):
    count = 1
    for j in range(m):
        if i != A[j]-1: continue
        if H[i] <= H[B[j]-1]:
            count = 0
            break
    for j in range(m):
        if i != B[j]-1: continue
        if H[i] <= H[A[j]-1]:
            count = 0
            break
    ans += count
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
judge = [1]*n
H = list(map(int,input().split()))

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    if H[a] > H[b]:
        judge[b] *= 0
    elif H[a] < H[b]:
        judge[a] *= 0
    else:
        judge[a] *= 0
        judge[b] *= 0
print(sum(judge))
### BUGGY CODE ###

n = int(input())
list = list(map(int, input().split()))
list.sort()
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if list[i] + list[j] > list[k]:
                ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
list = list(map(int, input().split()))
list.sort()
import bisect
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        index = bisect.bisect_left(list, list[i]+list[j])
        ans += index - j -1
print(ans)
### BUGGY CODE ###

def sol():
    n=int(input())
    a=[int(i) for i in input().split()]
    ans=n
    for i in range(n-1):
        w=x=a[i]
        for j in range(i+1,n):
            w+=a[j]
            x^=a[j]
            if w!=x: break
            ans+=1
    print(ans)

if __name__=="__main__":
    sol()

### FIXED CODE ###

def sol():
    n=int(input())+1
    a=[int(i) for i in input().split()]+[2**21-1]
    ans=0
    i=j=w=x=0
    while i<n-1:
        while j<n and w==x:
            w+=a[j]
            x^=a[j]
            j+=1
        ans+=(j-i-1)
        w-=a[i]
        x^=a[i]
        i+=1
    print(ans)

if __name__=="__main__":
    sol()
### BUGGY CODE ###

# input
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x, y, c = [0] * M, [0] * M, [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())
ans = float("inf")

for i in range(M):
    ans = min(ans, a[x[i]-1] + b[y[i]-1] - c[i])

for i in range(A):
    for j in range(B):
        ans = min(ans, a[i] + b[j])
print(ans)


### FIXED CODE ###

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a) + min(b)
for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1] + b[y-1] - c)
print(ans)
### BUGGY CODE ###

import collections
n = int(input())
a_list = list(map(int, input().split()))
a_dict = dict(collections.Counter(a_list))
sorted_dict = sorted(a_dict.items(), key=lambda x:x[0])
flag_list = [1] * len(sorted_dict)
i = 0
for key, count in sorted_dict:
    if flag_list[i] == 0:
        i += 1
        continue
    if count > 1:
        flag_list[i] = 0
    i += 1
    j = i
    for key1, count1 in sorted_dict[i:]:
        if flag_list[j] == 0:
            j += 1
            continue
        if key1 % key == 0:
            flag_list[j] = 0
        j += 1
print(sum(flag_list))

### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
a_set = set(a_list)
m = max(a_list)
a_list.sort()
 
pre_a = 0
for a in a_list:
    if a == pre_a:
        a_set.discard(a)
    if a in a_set:
        j = a * 2
        while j <= m:
            a_set.discard(j)
            j += a
    pre_a = a

print(len(a_set))
### BUGGY CODE ###

N,X,Y = list(map(int, input().split()))

dp = [[0]*(N+1) for _ in range(N+1)]

for i in range(1,N+1):
    for j in range(i+1,N+1):
        dp[i][j] = min(j-i,abs(j-Y)+abs(i-X)+1)

dp = sum(dp,[])
for j in range(1,N):
    print(dp.count(j))



### FIXED CODE ###

N,X,Y = list(map(int, input().split()))

ans = [0]*(N+1)

for i in range(1,N+1):
    for j in range(i+1,N+1):
        ans[min(j-i,abs(j-Y)+abs(i-X)+1)] += 1

for j in range(1,N):
    print(ans[j])
### BUGGY CODE ###

s = input()
ans = 0
for i in range(len(s)-3):
    for j in range(i+3, len(s)):
        n = int(s[i:j+1])
        if n % 2019 == 0:
            ans += 1
print(ans)


### FIXED CODE ###

s = input()[::-1]
m = 2019
ans = 0
x = 1
tot = 0
cnt = [0] * m
cnt[0] = 1
for s in s:
    tot += int(s) * x
    tot %= m
    #ans += cnt[tot]
    x *= 10
    x %= m
    cnt[tot] += 1

print(sum(i*(i-1)//2 for i in cnt))
### BUGGY CODE ###

N = int(input())

A=[]
B=[]
saidai = 0
for i in range(N):
    x = input()
    A.append(x)
    y = A.count(x)
    B.append([x, y])
    saidai = max(y, saidai)
B.sort() 
for i in range(N):
    if B[i][1] == saidai:
        print(B[i][0])

### FIXED CODE ###

from collections import Counter
N = int(input())
 
A=[]
for i in range(N):
    A.append(input())

B = Counter(A)

saidai = max(B.values())

C=[]
for i, j in B.items():
    if j == saidai:
        C.append(i)
C.sort()
for i in C:
    print(i)
### BUGGY CODE ###

### ABC104C - All Green
from itertools import permutations


def main():
    D, G = map(int, input().split())
    A = [(0, 0)] + [tuple(map(int, input().split())) for _ in range(D)]
    ans = float("inf")
    for perm in permutations(range(1, D + 1), D):
        cur, cnt = G, 0
        for i in perm:
            point, (num, bonus) = i * 100, A[i]
            if cur / point < num:
                cnt += cur // point
                cur -= point * (cur // point)
            else:
                cnt += num
                cur -= point * num + bonus
            if cur <= 0:
                ans = min(ans, cnt)
                break
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC104C - All Green
def ans(g, i, L):
    # Assume the case using question no.i
    if i == 0:  # base case
        return float("inf")

    n = min(g // (i * 100), L[i][0])  # n:count
    s = n * i * 100  # s:score

    # add bonus if available
    if n == L[i][0]:
        s += L[i][1]

    # make up for the shortage
    if s < g:
        n += ans(g - s, i - 1, L)

    # compare to other cases without question no.i recursively
    return min(n, ans(g, i - 1, L))


def main():
    d, g = list(map(int, input().rstrip().split()))
    arr = [0] + [list(map(int, input().rstrip().split())) for _ in range(d)]
    print(ans(g, d, arr))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())

A = list(map(int, input().split()))  # n個の文字列がリストに格納される

for i in range(N-1):
    print(A.count(i+1))
    while i+1 in A:
        A.remove(i+1)

print('0')

### FIXED CODE ###

N = int(input())

A = list(map(int, input().split()))  # n個の文字列がリストに格納される

ans = [0] * N

for a in A:
    ans[a-1] += 1

print(*ans,sep='\n')
### BUGGY CODE ###

n = int(input())
n_list = list(map(int, input().split()))
q = int(input())

for i in range(q):
    b, c = map(int, input().split())
    n_list = [i if i != b else c for i in n_list]
    print(sum(n_list))



### FIXED CODE ###

n = int(input())
n_list = list(map(int, input().split()))
q = int(input())

n_dic = {}
for i in n_list:
    n_dic.setdefault(i, 0)
    n_dic[i] += 1

result = 0
for k in n_dic:
    result += k * n_dic[k]

for i in range(q):
    b, c = map(int, input().split())
    if b in n_dic:
        n_dic.setdefault(c, 0)
        n_dic[c] += n_dic[b]
        result = result + (c-b)*n_dic[b]
        del n_dic[b]

    print(result)
### BUGGY CODE ###

import itertools

N = int(input())
li = list(map(int, input().split()))
t = []

max = 0

for i in itertools.permutations(range(N)):
  t.append(i)

for i in t:
  count = 0
  for n in range(N-1):
    if n == 0:
      count = (li[i[n]] + li[i[n+1]]) / 2
    else:
      count = (count + li[i[n+1]]) / 2

  if max < count:
    max = count

print(max)

### FIXED CODE ###

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

t = sorted(li)
ans = 0

for i in range(N-1):
  if i == 0:
    ans = (t[i] + t[i+1]) / 2
  else:
    ans = (ans + t[i+1]) / 2

print(ans)
### BUGGY CODE ###

N=int(input())
A=[int(input()) for _ in range(N)]

A.sort()

B=[]
while A!=[]:
  B.append(A.pop())
  A=A[::-1]
  
if B[0]>B[-1]:
  B.insert(0,B[-1])
  B=B[:-1]
  
ans=0
for i in range(N-1):
  ans+=abs(B[i]-B[i+1])
  
print(ans)

### FIXED CODE ###

N=int(input())
A=[int(input()) for _ in range(N)]

A.sort(reverse=True)
if len(A)%2==0:
  print(A[len(A)//2-1]-A[len(A)//2]+2*sum(A[:len(A)//2-1])-2*sum(A[len(A)//2+1:]))
else:
  tmp1=-A[len(A)//2]-A[len(A)//2+1]+2*sum(A[:len(A)//2])-2*sum(A[len(A)//2+2:])
  tmp2=A[len(A)//2-1]+A[len(A)//2]+2*sum(A[:len(A)//2-1])-2*sum(A[len(A)//2+1:])
  print(tmp1 if tmp1>tmp2 else tmp2)
### BUGGY CODE ###

h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])


### FIXED CODE ###

h,n = map(int,input().split())
dp = [int(1e18)] * (h+1)
dp[0] = 0
for i in range(n):
    a, b = map(int, input().split())
    for j in range(h):
        nj = min(j+a, h)
        dp[nj] = min(dp[nj], dp[j]+b)
print(dp[h])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = list(map(int, input().split()))
Q = int(input())

d = dict()
for num in S:
    d.setdefault(num, 0)
    d[num] += 1

for _ in range(Q):
    b, c = map(int, input().split())
    d.setdefault(c, 0)
    d.setdefault(b, 0)
    d[c] += d[b]
    d[b] = 0
    ans = sum(s*t for s, t in d.items())
    print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = list(map(int, input().split()))
Q = int(input())

d = dict()
for num in S:
    d.setdefault(num, 0)
    d[num] += 1


ans = sum(s*t for s, t in d.items())

for _ in range(Q):
    b, c = map(int, input().split())
    d.setdefault(c, 0)
    d.setdefault(b, 0)
    ans += (c-b)*d[b]
    d[c] += d[b]
    d[b] = 0
    print(ans)
### BUGGY CODE ###

x,y,a,b,c = (int(x) for x in input().split())
list_p = list(map(int,input().split()))
list_q = list(map(int,input().split()))
list_r = list(map(int,input().split()))
list_p.sort()
list_q.sort()
list_r.sort()
list_p.reverse()
list_q.reverse()
list_r.reverse()
list_total =[]
for i in range(x):
    list_total.append(list_p[i])
for i in range(y):
    list_total.append(list_q[i])
list_total.sort()
for i in range(c):
    if list_r[0]>list_total[0]:
        list_total[0]=list_r[0]
        list_total.sort()
        list_r.pop(0)
print(sum(list_total))

### FIXED CODE ###

x,y,a,b,c = (int(x) for x in input().split())
list_p = list(map(int,input().split()))
list_q = list(map(int,input().split()))
list_r = list(map(int,input().split()))
list_p.sort()
list_q.sort()
list_p.reverse()
list_q.reverse()
for i in range(x):
    list_r.append(list_p[i])
for i in range(y):
    list_r.append(list_q[i])
list_r.sort()
list_r.reverse()
sum=0
for i in range(x+y):
    sum+=list_r[i]
print(sum)
### BUGGY CODE ###

import re

H, W = map(int, input().split())
S_list = [input() for _ in range(H)]

l_count = [[i.span()[0] for i in re.finditer('#', s+'#')] for s in S_list]

r_count = [[i.span()[0] for i in re.finditer('#', ''.join(s)+'#')] for s in list(zip(*S_list))]

ans = 0
    
for h in range(H):
    for w in range(W):
        if S_list[h][w] == '.':
            l_light = 0
            r_light = 0
            for l in l_count[h]:
                if(w < l):
                    l_light = l - l_light
                    break
                l_light = l+1
            for r in r_count[w]:
                if(h < r):
                    r_light = r - r_light
                    break
                r_light = r+1
            
            ans = max(ans, l_light+r_light-1)

print(ans)

### FIXED CODE ###

import numpy as np

H, W = map(int, input().split())
S_list = [list(input()) for _ in range(H)]
S_list=(np.array(S_list) ==".")*1

L = np.zeros((H, W), int)
R = np.zeros((H, W), int)
U = np.zeros((H, W), int)
D = np.zeros((H, W), int)

for w in range(W):
    if w == 0:
        L[:,w] = S_list[:,w]
        R[:,W-w-1] = S_list[:,W-w-1]
    else:
        L[:,w] = (L[:,w-1]+1) * S_list[:,w]
        R[:,W-w-1] = (R[:,W-w]+1) * S_list[:,W-w-1]

for h in range(H):
    if h == 0:
        U[h,:] = S_list[h,:]
        D[H-h-1,:] = S_list[H-h-1,:]
    else:
        U[h,:] = (U[h-1,:]+1) * S_list[h,:]
        D[H-h-1,:] = (D[H-h,:]+1) * S_list[H-h-1,:]
        
ans = max(np.max(L+R+U+D-3), 0)

print(ans)
### BUGGY CODE ###

import math
import copy

n=int(input())
a=list(map(int,input().split()))
a.sort()
ch5=0
for  M in a:
  if M==1:
    ch5+=1
    a.remove(M)
  if M>1:
    break
if ch5>0:
  a.append(1)
B=copy.deepcopy(a)


dp=[0 for _ in range(1000000+1)]

sosuu = [2]
A = 1000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
    for L2 in sosuu:
        if L % L2 == 0:
            break # 素数でないことがわかったらそれ以上ループする必要はない
    else: # break で抜けることがなかったら L は素数（Python 特有の制御構文）
        sosuu.append(L)
        
L=len(a)

if len(a)>79000:
  g=a[0]
  for h in range(1,L):
    g=math.gcd(g,a[h])
    
  if g==1:
    print('setwise coprime')
    
  else:
    print('not coprime')
  
  

else:
  ch1=0
  ch3=0
  for w in sosuu:
    ch2=0
    for q in range(L):
      if B[q]%w==0:
        ch2+=1
        S=B[q]
        while S%w==0:
          S=S//w
        B[q]=S
    if ch2>1:
      ch3+=1
  d={}
  ch4=0
  for u in B:
      if u>1000:
        if u not in d:
          d[u]=0
        else:
          ch4+=1
  if ch3==0 and ch4==0:
    print('pairwise coprime')
    
      
  
  
    
  else:
    g=a[0]
    for h in range(1,L):
      g=math.gcd(g,a[h])
    
    if g==1:
      print('setwise coprime')
    
    else:
      print('not coprime')
      
     



### FIXED CODE ###

import math

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

dp=[0 for _ in range(1000001)]

for d in a:
  dp[d]+=1
  
ch1=0
for i in  range(2,1000001):
  ch=0
  x=i
  while x<=1000000:
    ch+=dp[x]
    x+=i
  if ch>1:
    ch1+=1
    
if ch1==0:
  print('pairwise coprime')
  
else:
  g=a[0]
  for h in range(1,n):
    g=math.gcd(g,a[h])
    
  if g==1:
    print('setwise coprime')
    
  else:
    print('not coprime')