Harryxun/stf_run huggingface dataset:
N = int(raw_input())
num_list = map(int, raw_input().split())


c = 0
flag = 1
while flag:
    flag =0
    for j in range(N-1,0,-1):
        if num_list[j] < num_list[j-1]:
            a = num_list[j]
            num_list[j] = numlist[j-1]
            num_list[j-1] = a
            c += 1
            flag =1
print " ".join(map(str,num_list))
print c

### FIXED CODE ###

N = int(raw_input())
num_list = map(int, raw_input().split())

c = 0
flag = 1
while flag==1:
    flag =0
    for j in range(N-1,0,-1):
        if num_list[j] < num_list[j-1]:
            a = num_list[j]
            num_list[j] = num_list[j-1]
            num_list[j-1] = a
            c += 1
            flag =1

print " ".join(map(str,num_list))
print c
import math

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

def count_step(n):
    num=n//2
    count=0
    for i in range(num+1):
        N=n-i
        if i==0:
            count+=1
        elif i==1:
            count+=N
        else:
            nume=1
            denom=1
            for j in range(i):
                nume*=(N-j)
                denom*=(j+1)
            count+=int(nume/denom)
    return count

if M!=0:
    a2=[a[0]-1]
    
    for i in range(M-1):
        p=a[i+1]-a[i]-2
        
        a2.append(p)
    
    a2.append(N-a[M-1]-1)

p=1
for i in range(M-1):
    if a[i]+1==a[i+1]:
        p=0
        break

if p==0:
    pattern=0
else:
    pattern=1
    if M==0:
        pattern=count_step(N)
    else:
        for i in range(len(a2)):
            pattern*=count_step(a2[i])

print(pattern%1000000007)

### FIXED CODE ###

N,M=map(int,input().split())
a=[0]
for _ in range(M):
    a.append(int(input()))

b=[]
num=0
if len(a)>1:
    b.append(a[1]-a[0]-1)
    for i in range(1,M):
            b.append(a[i+1]-a[i]-2)
    b.append(N-a[M]-1)
else:
    b.append(N)

num=max(b)


mod=1000000007

def fib(n,num):
    fib=[0 for i in range(num+10)]
    fib[0]=1
    fib[1]=1
    for i in range(2,num+1):
        fib[i]=fib[i-1]+fib[i-2]
    return fib[n]

if -1 in b:
    print(0)
else:
    p=1
    for j in range(M+1):
        p*=fib(b[j],num)
    print(p%mod)
def text_match_words(text, words):
	match_words = []
	for word in words:
		if word == text[:len(word)]:
			match_words.append(word)
	return match_words

def is_match_for(text, words):
	if "" == text: 
		return True
	else:
		match_words = text_match_words(text, words)
		if [] == match_words:
			return False
		else:
			return any([is_match_for(text[len(match_word):], words) for match_word in match_words])

if is_match_for(input(), ("dream", "dreamer", "erase", "eraser")):
	print("YES")
else:
	print("NO")

### FIXED CODE ###

import re

if re.match("(dream|dreamer|erase|eraser)*$", input()):
    print("YES")
else:
    print("NO")
n = int(input())
mod = 10**9 + 7
import math

def cnt(n, i):
    if i == 1:
        return 1
    else:
        l = n - 3*i
        m = i-1
        return  math.factorial(l + m)//(math.factorial(l)*math.factorial(m))
        

if n == 2 or n == 1:
    print(0)
if n == 3:
    print(1)
if n > 3:
    ans = 0
    iter = n // 3
    for i in range(1, iter + 1):
        if i*3 <= n:
            ans += cnt(n, i)%mod
        else:
            continue
        
print(ans % mod)

### FIXED CODE ###

n = int(input())
mod = 10**9 + 7
import math

def cnt(n, i):
    if i == 1:
        return 1
    else:
        l = n - 3*i
        m = i-1
        return  math.factorial(l + m)//(math.factorial(l)*math.factorial(m))
        

if n == 2 or n == 1:
    print(0)
    exit()
if n == 3:
    print(1)
    exit()
else:
    ans = 0
    iter = n // 3
    for i in range(1, iter + 1):
        if i*3 <= n:
            ans += cnt(n, i)%mod
        else:
            continue
        
print(ans % mod)
import sys
sys.setrecursionlimit(10**7)

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

par = [i for i in range(n+1)]
rank = [0]*(n+1)
size = [1]*(n+1)

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

def same(x, y):
    return root(x) == root(y)

def unite(x, y):
    xx = root(x)
    yy = root(y)
    if xx == yy:
        return
    if rank[xx] < rank[yy]:
        par[xx] = yy
        size[yy] += size[xx]
    else:
        par[yy] = xx
        size[xx] += size[yy]
        if rank[xx] == rank[yy]:
            rank[yy] += 1

ab=[list(map(int, input().split())) for _ in range(m)]

ans=[0]*m
ans[m-1]=n*(n-1)//2

for i in range(M-1, 0, -1):
    a = ab[i][0]
    b = ab[i][1]
    if root(a) != root(b):
        ans[i-1] = ans[i] - size[root(a)]*size[root(b)]
    else:
        ans[i-1] = ans[i]
    unite(a,b)

for ans_i in ans:
    print(ans_i)


### FIXED CODE ###

import sys
# sys.setrecursionlimit(10**7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1]*n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
ab=[list(map(int, input().split())) for _ in range(m)]

uf = UnionFind(n)
tmp_ans = n*(n-1)//2
ans = []
for i in range(m):
    ans.append(tmp_ans)
    a=ab[m-1-i][0]
    b=ab[m-1-i][1]
    a-=1
    b-=1
    if not uf.is_same(a,b):
        tmp_ans-=uf.size(a)*uf.size(b)
    uf.union(a,b)

ans.reverse()
for i in ans:
    print(i)
def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b):
N,X=map(int,input().split())
print(3*(N-gcd(N,X))

### FIXED CODE ###

def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
N,X=map(int,input().split())
print(3*(N-gcd(N,X)))
a = input().split()
b = input()
c = int(0)

for i in range(int(a[0])):
  if int(b[i]) <= 9 and int(b[i]) >= 0:
    pass
  else:
    c = 1

if b[int(a[0])] != "-":
  c = 1

for i in range(int(a[0]) + 1, int(a[0]) + int(a[1]) + 1):
  if int(b[i]) <= 9 and int(b[i]) >= 0:
    pass
  else:
    c = 1

if c == 1:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

a = input().split()
b = input()
c = int(0)

for i in range(int(a[0])):
  if b[i] == "-":
    c = 1
  else:
    pass

if b[int(a[0])] != "-":
  c = 1

for i in range(int(a[0]) + 1, int(a[0]) + int(a[1]) + 1):
  if b[i] == "-":
    c = 1
  else:
    pass

if c == 1:
  print("No")
else:
  print("Yes")
import sys
from itertools import combinations

N,M,X = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(N)]
A=[0]*(M+1)

for i in range(N):
    for j in range(1,M+1):
        A[j]+=CA[i][j]

for i in range(1,M+1):
    if A[i] <X:
        print(-1)
        sys.exit()

ans=sum(A)

for i in range(1,N+1):
    for e in combinations(range(N),i):
        c = 0
        A = [0]*(M+1)
        for f in e:
            c += CA[f][0]
            for j in range(M):
                A[i] += CA[f][j+1]
        if min(A) >= X:
            ans = min(ans,c)
else:
    print(ans)

### FIXED CODE ###


import sys
from itertools import combinations

N,M,X = map(int,input().split())
CA = [list(map(int,input().split())) for _ in range(N)]
A=[0]*(M+1)

ans=0

for i in range(N):
    ans+=CA[i][0]
    for j in range(1,M+1):
        A[j]+=CA[i][j]


for i in range(1,M+1):
    if A[i] <X:
        print(-1)
        sys.exit()


for i in range(1,N+1):
    for e in combinations(range(N),i):
        c = 0
        A = [0]*M
        for f in e:
            c += CA[f][0]
            for j in range(M):
                A[j] += CA[f][j+1]
        if min(A) >= X:
            ans = min(ans,c)
        
else:
    print(ans)
number = int(input())

for i in range(number):
  tri = map(int, input().split(" "))
  if tri[0] > tri[1]:
    buf = tri[0]
    tri[0] = tri[1]
    tri[1] = buf
  if tri[1] > tri[2]:
    buf = tri[1]
    tri[1] = tri[2]
    tri[2] = buf
  if tri[0] * tri[0] + tri[1] * tri[1] == tri[2] * tri[2]:
    print("YES")
  else:
    print("NO")


### FIXED CODE ###

import math

num = int(input())

for i in range(num):
    try:
        sides = list(map(int, input().split(" ")))
        sides.sort()

        if int(math.pow(sides[0], 2)) + int(math.pow(sides[1], 2)) == int(math.pow(sides[2], 2)):
            print("YES")
        else:
            print("NO")

    except:
        break
n = int(input())
for i in range(n):
    if (i+1)**2 > n:
        break
    elif (i+1)**2 <= n:
        ans = (i + 1)**2
print(ans)

### FIXED CODE ###

c1 = input()
c2 = input()
if (c1[0] == c2[2]) and (c1[1] == c2[1]) and (c1[2] == c2[0]):
    print("YES")
else:
    print("NO")
n, m = map(int, input().split())
l = [[] for _ in range(m)]
for i in range(m):
  a, b  = map(int, input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

import itertools
ans = 0
for p in itertools.permutations(range(n)):
    if p[0] == 0:
        flag = 1
        for i in range(n-1):
            if p[i+1] in l[p[i]]:
                pass
            else:
                flag = 0
    if flag == 1:
        ans += 1
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
L = [[] for i in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
    
import itertools
count = 0
for p in itertools.permutations(range(N)):
    if p[0] == 0:
#         print("p",p)
        flag = True
        for i in range(N-1):
#             print(p[i+1], L[p[i]])
            if not p[i+1] in L[p[i]]:
                flag = False
#             print(flag)
        if flag:
            count += 1
print(count)
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
list = [K-Q] *N
for i in range(Q):
  list[A[i]-1] += 1
for i in range(N):
  if list[i] >= 1:
    print('Yes')
  else:
    print('No')
from C import ans


n = int(input())
n_list = [int(i) for i in input().split()]

s = sum(a**2 for a in n_list)
ans = sum(n_list) ** 2 - s

print((ans//2)%(10**9+7))

### FIXED CODE ###

n = int(input())
n_list = [int(i) for i in input().split()]

s = sum(a**2 for a in n_list)
ans = sum(n_list) ** 2 - s

print((ans//2)%(10**9+7))
(a, b, c) = [int(i) for i in input().rstrip().split()]

count = 0
for x in range(a, b + 1)
 if c % x == 0:
  count++
print(count)

### FIXED CODE ###

(a, b, c) = [int(i) for i in input().split()]

count = 0
for x in range(a, b + 1):
 if c % x == 0:
  count += 1

print(count)
from collections import deque

N, M = map(int,input().split())
ac = [0] * M
pena = [0] * M

for a in range(M):
    p,s = input().split()
    
    p = int(p) - 1

    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = 1
    else:
        pena[p] += 1

AC = 0
PENA = 0

for a in ac:
    AC += a
    if a:
        PENA += pena[ac.index(a)]

print(AC,PENA)

### FIXED CODE ###

from collections import deque

N, M = map(int,input().split())
ac = [0] * N
pena = [0] * N

for a in range(M):
    p,s = input().split()
    
    p = int(p) - 1

    if ac[p]:
        continue
    if s == 'AC':
        ac[p] = 1
    else:
        pena[p] += 1

AC = 0
PENA = 0

for a in range(N):
    AC += ac[a]
    if ac[a]:
        PENA += pena[a]

print(AC,PENA)
D = int(input()), T = int(input()), S = int(input())

travel_time = D * S
if travel_time <= T:
  print "yes"
  else: print "no"
  

### FIXED CODE ###

d,s,t = map(int,input().split())
print('Yes' if d/s <= t else 'No')
import math

a,b = input().split()

B_low = math.ceil(b * 10)
A_high = math.floor((a+1) * 12.5)

if A_high < B_low:
    print('-1')
else:
    print(B_low)

### FIXED CODE ###

a,b = map(int, input().split())

ans = -1
for i in range(10,12501):
    if int(i*0.08) == a and int(i * 0.1) == b:
        ans = i
        break
        
print(ans)
import sys

i = int(raw_input())

print(i**3)

### FIXED CODE ###

import sys

i = int(input())

print(i**3)
N = int(input())
L = list(map(int, input(.split())))
if sum(L[:N-1]) < max(L):
    print('Yes')
else:      
    print('No')

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
if max(l) < sum(l) - max(l):
    print('Yes')
else:
    print('No')
for i in range(len(d1)):
    for j in range(len(d1)): 
        if(i != j and j > i):
            sum += int(d1[i])*int(d1[j])

print(sum)



### FIXED CODE ###

N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(len(d1)): 
        if(i != j and j > i):
            sum += int(d1[i])*int(d1[j])

print(sum)
S, W = map(int, input().split())
    if S >= W:
        print('safe')
    else:
      S < W
      print('unsafe')

### FIXED CODE ###

s,w=map(int,input().split())
if s>w:
    print('safe')
else :
    print('unsafe')
n=int(input())
monsters=list(map(int, input().split()))
battle=list(map(int, input().split()))
remain=0
win=0
for i in range(n):
    if remain != 0:
        win += remai
        battle[i] -= remain
        remain = 0
    if monsters[i] < battle[i]:
        win += monsters[i]
        monsters[i+1] -= battle[i] - monsters[i]
    else:
        win += battle[i]
        remain = monsters[i] - battle[i]
print(win)

### FIXED CODE ###

n=int(input())
monsters=list(map(int, input().split()))
battle=list(map(int, input().split()))
remain=0
win=0
for i in range(n):
    if monsters[i] < battle[i]:
        win += monsters[i]
        if monsters[i+1] >= battle[i] - monsters[i]:
            win += battle[i] - monsters[i]
            monsters[i+1] -= battle[i] - monsters[i]
        else:
            win += monsters[i+1]
            monsters[i+1] = 0
    else:
        win += battle[i]
print(win)
l = input().split()
H = int(l[0])
W = int(l[0])

S = []
for i in range(H):
    l = input().split()
    S.append(l[0])

# print(H, W, S)

TS = []
for i in range(W):
    tmp = ''
    for j in range(H):
        tmp += S[j][i]
    TS.append(tmp)

# print(TS)

HL = []
for i in range(H):
    l = 0
    begin = 0
    tmp = []
    for j in range(W):
        if S[i][j] == '.':
            l += 1
        else:
            tmp.extend([l]*(j - begin))
            tmp.append(0)
            begin = j + 1
            l = 0
    if begin != W:
        tmp.extend([l]*(W - begin))
    HL.append(tmp)

WL = []
for i in range(W):
    l = 0
    begin = 0
    tmp = []
    for j in range(H):
        if TS[i][j] == '.':
            l += 1
        else:
            tmp.extend([l]*(j - begin))
            tmp.append(0)
            begin = j + 1
            l = 0
    if begin != W:
        tmp.extend([l]*(W - begin))
    WL.append(tmp)

# print(HL)
# print(WL)

max_l = 0
for i in range(H):
    for j in range(W):
        l = HL[i][j] + WL[j][i]
        if l > max_l:
            max_l = l
print(max_l - 1)


### FIXED CODE ###

l = input().split()
H = int(l[0])
W = int(l[1])

S = []
for i in range(H):
    l = input().split()
    S.append(l[0])

# print(H, W, S)

# TS = []
# for i in range(W):
#     tmp = ''
#     for j in range(H):
#         tmp += S[j][i]
#     TS.append(tmp)

# print(TS)

HL = []
for i in range(H):
    l = 0
    begin = 0
    tmp = []
    for j in range(W):
        if S[i][j] == '.':
            l += 1
        else:
            tmp.extend([l]*(j - begin))
            tmp.append(0)
            begin = j + 1
            l = 0
    if begin != W:
        tmp.extend([l]*(W - begin))
    HL.append(tmp)

WL = []
for i in range(W):
    l = 0
    begin = 0
    tmp = []
    for j in range(H):
        if S[j][i] == '.':
            l += 1
        else:
            tmp.extend([l]*(j - begin))
            tmp.append(0)
            begin = j + 1
            l = 0
    if begin != H:
        tmp.extend([l]*(H - begin))
    WL.append(tmp)

max_l = 0
for i in range(H):
    for j in range(W):
        l = HL[i][j] + WL[j][i]
        max_l = max(l, max_l)
print(max_l - 1)
import sys

A = list(list(map(int, input().split())) for _ in range(3))
N = int(input())
num = list(int(input()) for _ in range(N))

for i in range(3):
    for j in range(3):
        if A[i][j] in num:
            A[i][j] = -1
            
if A[0][0] == -1 and A[0][1] == -1 and A[0][2] == -1:
    print("Yes")
    sys.exit()
elif A[1][0] == -1 and A[1][1] == -1 and A[1][2] == -1:
    print("Yes")
    sys.exit()
elif A[2][0] == -1 and A[2][1] == -1 and A[2][2] == -1:
    print("Yes")
    sys.exit()
elif A[0][0] == -1 and A[1][0] == -1 and A[2][0] == -1:
    print("Yes")
    sys.exit()
elif A[0][1] == -1 and A[1][1] == -1 and A[2][1] == -1:
    print("Yes")
    sys.exit()
elif A[0][2] == -1 and A[1][2] == -1 and A[2][2] == -1:
    print("Yes")
    sys.exit()
elif A[0][0] == -1 and A[1][1] == -1 and A[1][1] == -1:
    print("Yes")
    sys.exit()
elif A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1:
    print("Yes")
    sys.exit()
    
print("No")

### FIXED CODE ###

n = int(input())

r = n // 2
a = n % 2
print(r + a)
t=list(input())
if t[0]=='?' and t[1]=='P':
    t[0]=t[0].replace('?','P')
elif t[0]=='?' and t[1]=='D':
    t[0]=t[0].replace('?','D')
for i in range(1,len(t)-1):
    if t[i]=='?' and t[i+1]=='D':
        t[i]=t[i].replace('?','P')
    elif t[i]=='?' and t[i+1]=='P':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='D':
        t[i]=t[i].replace('?','P')
        t[i+1]=t[i+1].replace('?','D')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
        t[i+1]=t[i+1].replace('?','D')
if t[-1]=='?' and t[-2]=='P' or t[-2]=='D':
    t[-1]=t[-1].replace('?','D')
for i in t:
    print(i,end='')

### FIXED CODE ###

t=list(input())
if t[0]=='?':
    t[0]=t[0].replace('?','D')
for i in range(1,len(t)-1):
    if t[i]=='?' and t[i+1]=='D' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='P' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='D' and t[i-1]=='D':
        t[i]=t[i].replace('?','P')
    elif t[i]=='?' and t[i+1]=='P' and t[i-1]=='D':
        t[i]=t[i].replace('?','D')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='D':
        t[i]=t[i].replace('?','P')
    elif t[i]=='?' and t[i+1]=='?' and t[i-1]=='P':
        t[i]=t[i].replace('?','D')
if t[-1]=='?':
    t[-1]=t[-1].replace('?','D')
for i in t:
    print(i,end='')
# 0028
array = []
while True:
    try:
        a = input()
        array.append(int(a))
    except EOFError:
        break
s = set(array)
mx = max(list(map(lambda a: array.count(a), s)))
modes = list(filter(lambda a: array.count(a) == mx), sorted(s))
print(*modes, sep = '\n')

### FIXED CODE ###

# 0028
array = []
while True:
    try:
        a = input()
        array.append(int(a))
    except EOFError: break
s = set(array)
mx = max(sorted(s, reverse=True), key = array.count)
for a in sorted(s, key = array.count, reverse=True):
    print(a)
    if a == mx: break
s = list(input())
n = len(s)
if n==n[::-1] and n[0:int((n-1)/2)]==n[0:int((n-1)/2)][::-1] and n[int((n+3)/2-1):n]==n[int((n+3)/2-1):n][::-1]:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

s = input()

ss = s[::-1]
n = len(s)
s1 = s[0:int((n-1)/2)]
ss1 = s1[::-1]
s2 = s[int((n+3)/2-1):n]
ss2 = s2[::-1]

if s==ss and s1==ss1 and s2==ss2:
  print('Yes')
else:
  print('No')
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=0
count=0
i=0
while D<=X:
    count=count+1
    D=D+L[i]
    i=i+1
print(count)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[0]
count=1
for i in range(N):
    D.append(D[i]+L[i])
    if D[i+1]<=X:
        count=count+1
print(count)
import sys
import numpy as np 

h, w = map(int, sys.stdin.readline().split())
s = np.array([list(sys.stdin.readline().rstrip()) for _ in range(h)], dtype='U')
s = np.pad(s, 1)

def main():
    l = np.zeros((h+2, w+2), dtype=np.int64)
    r = np.zeros((h+2, w+2), dtype=np.int64)
    u = np.zeros((h+2, w+2), dtype=np.int64)
    d = np.zeros((h+2, w+2), dtype=np.int64)

    for i in range(1, w+1):
        bl = s[:, i] == '#'
        l[~bl, i] = l[~bl, i-1] + 1
        i = w+1-i
        bl = s[:, i] == '#'
        r[~bl, i] = r[~bl, i+1] + 1
    
    for i in range(1, h+1):
        bl = s[i, :] == '#'
        u[i, ~bl] = u[i-1, ~bl] + 1
        i = h+1-i
        bl = s[i, :] == '#'
        d[i, ~bl] = d[i+1, ~bl] + 1
    
    res = l + r + u + d - 3
    return np.amax(res[1:h+1, 1:w+1])

if __name__ == '__main__':
    ans = main()
    print(ans)

### FIXED CODE ###

import sys
import numpy as np 

h, w = map(int, sys.stdin.readline().split())
grid = np.array([list(sys.stdin.readline().rstrip()) for _ in range(h)], dtype='U')
grid = np.pad(grid, 1, mode='constant')

def main():
    cnt = np.zeros((h+2, w+2))
    cnt[grid == '.'] = np.inf
    
    l = cnt.copy()
    r = cnt.copy()
    u = cnt.copy()
    d = cnt.copy()

    for i in range(1, w+1):
        l[1:h+1, i] = np.minimum(l[1:h+1, i], l[1:h+1, i-1]+1)
        i = w + 1 - i
        r[1:h+1, i] = np.minimum(r[1:h+1, i], r[1:h+1, i+1]+1)
    
    for i in range(1, h+1):
        u[i, 1:w+1] = np.minimum(u[i, 1:w+1], u[i-1, 1:w+1]+1)
        i = h + 1 - i
        d[i, 1:w+1] = np.minimum(d[i, 1:w+1], d[i+1, 1:w+1]+1)
    
    res = np.maximum(l + r + u + d - 3, 0).astype(np.int64)
    return np.amax(res)

if __name__ == '__main__':
    ans = main()
    print(ans)
S=input()
x="None"
num=[False for i in range(26)]
for i in range(len(S)):
    num[ord(S[i])-ord("a")]=True

for j in range(26):
    if !num[j]:
        x=chr(j+ord("a"))
        break

print(x)


### FIXED CODE ###

S=input()
x="None"
T="abcdefghijklmnopqrstuvwxyz"
num=[0 for i in range(26)]
for i in range(26):
    num[i]+=S.count(T[i])

for j in range(26):
    if num[j]==0:
        x=T[j]
        break

print(x)
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break

### FIXED CODE ###

import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0  or (math.ceil(i ** (1/3)))**3 == i or (math.ceil(i ** (1/5)))**5 == i:
        print(i)
        break
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    if gcd == 1:
        print(1)
    else:
        ls = [True] * (gcd + 1)
        ls[0] = False
        ls[1] = False
        c = [1]
        for i in range(2, int(len(ls) ** 0.5) + 2):
            if ls[i]:
                if a % i == 0 and b % i == 0:
                    c.append(i)
                for j in range(i, len(ls), i):
                    ls[j] = False
        print(c)
        print(len(c))


if __name__ == '__main__':
    slove()


### FIXED CODE ###

def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    a, b = list(map(int, input().rstrip('\n').split()))
    gcd = fractions.gcd(a, b)
    cnt = 1
    for i in range(2, int(gcd ** 0.5) + 1):
        if gcd % i == 0:
            cnt += 1
            while True:
                if gcd % i == 0:
                    gcd //= i
                else:
                    break
    if gcd != 1:
        cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()