Harryxun/stf_run huggingface dataset:
import math

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

list_a = []
list_b = []
sqrt_a = math.sqrt(a)
sqrt_b = math.sqrt(b)


for i in range(2, float(sqrt_a) ):  
  if (a % (i) == 0):
    list_a.append( i )
    while( a % (i) == 0 ):
      a = a//(i)
      
for i in range(2, float(sqrt_b) ):  
  if (b % (i) == 0):
    list_b.append( i )
    while( b % (i ) == 0 ):
      b = b//(i)

#print(list_a)
#print(list_b)

set_a = set(list_a)
set_b = set(list_b)

set_ab = set_a & set_b
  
print(len(set_ab) + 1)
      

### FIXED CODE ###

import math

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

list_a = []
list_b = []
sqrt_a = math.sqrt(a)
sqrt_b = math.sqrt(b)


for i in range(2, int(sqrt_a) ):  
  if (a % (i) == 0):
    list_a.append( i )
    while( a % (i) == 0 ):
      a = a//(i)
if a > 1:
  list_a.append(a)
      
for i in range(2, int(sqrt_b) ):  
  if (b % (i) == 0):
    list_b.append( i )
    while( b % (i ) == 0 ):
      b = b//(i)
if b > 1:
  list_b.append(b)

#print(list_a)
#print(list_b)

set_a = set(list_a)
set_b = set(list_b)

set_ab = set_a & set_b
  
print(len(set_ab) + 1)
def nums (X,Y):
   B = (X*4-Y)/(4-2)
    D = X-B
    if B + D == X and Y == (B*2 + D*4):
          print("True")
    else:
           print("False")


### FIXED CODE ###

x,y = map (int, input ().split())

a = (4*x - y)/2
b = (y-2*x)/2
if y % 2 == 0 and a >= 0 and b >= 0:
    print("Yes")
else:
    print("No")
n = int(input().rstrip())
s = list(input())

for i in range(n):
    
    if s[i] == s[i+1]:
        s.pop(s[i+1])
        
print(len(s))

### FIXED CODE ###

# coding: utf-8


n = int(input().rstrip())
s = list(input())
count = 0
 
 
for i in range(n):
    
    try:
        if s[i] == s[i+1]:
            count += 1
    except IndexError:
        break
        
        
print(len(s) - count)
INFTY = 10**5
P = [1 for _ in range(INFTY)]
P[0]=0
P[1]=0
for i in range(2,int(INFTY**0.5)+1):
    for j in range(i*i,INFTY,i):
        P[j] = 0
N,M = map(int,input().split())
if N==1:
    x = M
elif P[M]==1:
    x = 1
else:
    b = M//N
    for i in range(b,0,-1):
        if M%i==0:
            x = i
            break
print(x)

### FIXED CODE ###

N,M = map(int,input().split())
k = 1
for i in range(1,int(M**0.5)+1):
    if M%i==0:
        a = i
        b = M//i
        k1 = 1
        k2 = 1
        if b>=N:
            k1 = a
        if a>=N:
            k2 = b
        k = max(k,k1,k2)
print(k)
l,r = map(int,input().split())
diff = r - l

if(diff >= 2019):
  print(0)
else:
  lmod = l % 2019
  rmod = r % 2019
  if(rmod  < lmod):
    print(0)
  else:
    ans =2020
    for i in range(l,r+1):
      for j in range(i+1,r+1):
        print("{} {}".format(i,j))
        if((i*j) % 2019 < ans):
          ans = (i*j) % 2019
    print(ans)

### FIXED CODE ###

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

print(min(n*a,b))
import math
n = int(input())
print(math.factorial(n) / (pow(10, 9) + 7))


### FIXED CODE ###

import math
n = int(input())
b = pow(10, 9) + 7
print(math.factorial(n) % b)
Sa = str(input())
Sb = str(input())
Sc = str(input())

turn = Sa.pop(0)

while Sa <> [] or Sb <> [] or Sc <> []:
    if turn == "a":
        turn += Sa.pop(0)
    elif turn == "b":
        turn += Sb.pop(0)
    elif turn == "c":
        turn += Sc.pop(0)

if Sa == []:
    print("A")
elif Sb == []:
    print("B")
else:
    print("C")

### FIXED CODE ###

Sa = list(input())
Sb = list(input())
Sc = list(input())

turn = Sa.pop(0)

for i in range(len(Sa)+len(Sb)+len(Sc)):
    if turn == "a":
        if len(Sa) != 0:
            turn = Sa.pop(0)
        else:
            print("A")
            quit()
    elif turn == "b":
        if len(Sb) != 0:
            turn = Sb.pop(0)
        else:
            print("B")
            quit()
    elif turn == "c":
        if len(Sc) != 0:
            turn = Sc.pop(0)
        else:
            print("C")
            quit()
N=input()
K=int(input())
l=len(N)
dp=[[0]*(l+1) for i in range(K+1)]
dp[0][0]=1
x=0
for i,n in enumerate(N):
    n=int(n)
    dp[0][i+1]=1
    if n==0:
        for j in range(1,K+1):
            dp[j][i+1]=dp[j][i]+dp[j-1][i]*9
    else:
        for j in range(1,K+1):
        dp[j][i+1]=dp[j][i]+dp[j-1][i]*9 if i-j>-1 else 0 if i-j<-1 else n if i==0 else (dp[j-1][i]-1)*9+n
print(dp[-1][-1])

### FIXED CODE ###

N=input()
K=int(input())
l=len(N)
dp=[[0]+[1]*l]+[[0]*(l+1) for i in range(K)]
dp2=[[1]+[0]*l]+[[0]*(l+1) for i in range(K)]
for i,n in enumerate(N):
    n=int(n)
    for j in range(K):
        dp[j+1][i+1]=dp[j][i]*9+dp[j+1][i]+(dp2[j][i]*(n-1)+dp2[j+1][i] if n>0 else 0)
        dp2[j+1][i+1]=dp2[j][i] if n>0 else dp2[j+1][i]
print(dp[-1][-1]+dp2[-1][-1])
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

def dtime(a):
    for i in range(9):
        if a%10==0:
            return a
        else:
            a+=1

for dd in dish:
    for i in range(0,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dtime(dd)

print(result+buf)


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(0,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dd
    for i in range(1,10):
        if result % 10 == 0:
            break
        result+=1
        
print(result+buf)
def rec(n):
  if dp[n] != -1:
    return dp[n]
  else:
    max_n = 0
    for i in graph[n]:
      max_n = max(max_n, rec(i)+1)
    dp[n] = max_n
    return dp[n]
  
N, M = list(map(int, input().split()))

dp = [-1]*n # nを始点としたときの最大値

graph = [[] for _ in range(N)]
for _ in range(M):
  xi, yi = list(map(int, input().split()))
  graph[xi-1].append(yi-1)

ans = 0
for n in range(N):
  ans = max(rec(n), ans)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

def rec(n):
  if dp[n] != -1:
    return dp[n]
  else:
    max_n = 0
    for i in graph[n]:
      max_n = max(max_n, rec(i)+1)
    dp[n] = max_n
    return dp[n]
  
N, M = list(map(int, input().split()))

dp = [-1]*N # nを始点としたときの最大値

graph = [[] for _ in range(N)]
for _ in range(M):
  xi, yi = list(map(int, input().split()))
  graph[xi-1].append(yi-1)

ans = 0
for n in range(N):
  ans = max(rec(n), ans)
print(ans)
def main():
    N, K = map(int, input().split())
    TD = [tuple(map(int, input().split())) for _ in range(N)]
    TD.sort(key=lambda x: x[1], reverse=True)
    s = set()
    rep = []
    for t, d in TD[:K]:
        if t in s:
            rep.append(d)
        else:
            s.add(t)
    m = sum(d for _, d in TD[:K])
    p = len(s) ** 2 + m
    for t, d in TD[K:]:
        if t in s:
            continue
        m += d - rep.pop()
        s.add(t)
        p = max(p, len(s) ** 2 + m)
        if not rep:
            break
    return p

print(main())


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    TD = [tuple(map(int, input().split())) for _ in range(N)]
    TD.sort(key=lambda x: x[1], reverse=True)
    s = set()
    rep = []
    for t, d in TD[:K]:
        if t in s:
            rep.append(d)
        else:
            s.add(t)
    m = sum(d for _, d in TD[:K])
    p = len(s) ** 2 + m
    for t, d in TD[K:]:
        if not rep:
            break
        if t in s:
            continue
        m += d - rep.pop()
        s.add(t)
        p = max(p, len(s) ** 2 + m)
    return p

print(main())
w, h, x, y = map(int, input().split())
out = 0
if (x == w/2 and y!= 0 and y != h) or (y == h/2 and x != 0 and x != w) or (h*x == w*y and x !=0 and x != w):
  out = 1
print(w*h/2, out)

### FIXED CODE ###

x, a = map(int, input().split())
if x < a:
  print(0)
else:
  print(10)
def c():
    N = int(input())
    abc = [list(map(int, input().split())) for _ in range(N)]
    dp = [[0] * N for _ in range(3)]
    for i in range(N):
        dp[0][i] = max(dp[1][i - 1] + abc[i][0], dp[2][i - 1] + abc[i][0])
        dp[1][i] = max(dp[0][i - 1] + abc[i][1], dp[2][i - 1] + abc[i][1])
        dp[2][i] = max(dp[0][i - 1] + abc[i][2], dp[1][i - 1] + abc[i][2])
    return max(dp[:][i])


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

### FIXED CODE ###

def c():
    N = int(input())
    abc = [list(map(int, input().split())) for _ in range(N)]
    dp = [[0] * N for _ in range(3)]
    dp[0][0], dp[1][0], dp[2][0] = abc[0][0], abc[0][1], abc[0][2]
    i = 0
    for i in range(1, N):
        dp[0][i] = max(dp[1][i - 1] + abc[i][0], dp[2][i - 1] + abc[i][0])
        dp[1][i] = max(dp[0][i - 1] + abc[i][1], dp[2][i - 1] + abc[i][1])
        dp[2][i] = max(dp[0][i - 1] + abc[i][2], dp[1][i - 1] + abc[i][2])
    return max(dp[0][i], dp[1][i], dp[2][i])


if __name__ == '__main__':
    ans = c()
    print(ans)
入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
入力Pを何個かの塊にわかる
塊の中では1個の駒による操作が行われる、
1回にとなりの1ますに歯科移動できない
すなわちそのなかでの最大と最小の差の絶対値

"""
#solution:
#潜 影 蛇 手 ! !
N,M=pin()
P=sorted(list(pin()))#大小関係を整理する
#print("*",P)
PP=[abs(P[j+1]-P[j]) for j in range(M-1)]
#print(PP)
Q=sorted(PP)
#print(Q)
if N>=M:#この場合必ず1個の拠点に1個以上のコマが置けるのでこのままでいい
    print(0)
else:
    for i in range(N-1):
        Q.pop()
    print(sum(Q))

### FIXED CODE ###

#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
入力Pを何個かの塊にわかる
塊の中では1個の駒による操作が行われる、
1回にとなりの1ますに歯科移動できない
すなわちそのなかでの最大と最小の差の絶対値

"""
#solution:
#潜 影 蛇 手 ! !
N,M=pin()
P=sorted(list(pin()))#大小関係を整理する
#print("*",P)
PP=[abs(P[j+1]-P[j]) for j in range(M-1)]
#print(PP)
Q=sorted(PP)
#print(Q)
if N>=M:#この場合必ず1個の拠点に1個以上のコマが置けるのでこのままでいい
    print(0)
else:
    for i in range(N-1):
        Q.pop()
    print(sum(Q))
n, k, q = map(int, input().split())
a = [input() for i in range(q)]

p = [k - q] * n

for i in range(q):
    p[int(a[i]) - 1] += 1

for i in range(n):
    if p[i] > 0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

s = input()
 
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
from fractions import Fraction
a,b=input().split()
A=float(a)
B=Fraction(b)
print(int(a*b))

### FIXED CODE ###

from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))
import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]

#貪欲初期解
t = []
memo = [0 for _ in range(26)]
for i in range(d):
    scores = []
    for j in range(26):
        delta_score = 0
        delta_score += s[i][j]
        for k in range(26):
            if j == k:
                continue
            delta_score -= c[k] * (i+1 - memo[k])
        scores.append((delta_score, j))

    scores.sort(key=lambda x: -x[0])
    choice = scores[0][1]
    t.append(choice+1)
    memo[choice] = i+1

#局所探索
def delta_scoring(t, x, y):
    delta_score = 0
    before_ti, after_ti = 0, d+1
    before_y, after_y = 0, d+1

    for i in range(x):
        if t[i] == t[x]:
            before_ti = i+1
        if t[i] == y:
            before_y = i+1

    for i in range(x+1, d):
        if t[i] == t[x]:
            after_ti = i+1
            break
    for i in range(x+1, d):
        if t[i] == y:
            after_y = i+1
            break

    delta_score -= s[x][t[x]]
    delta_score += s[x][y]
    delta_score -= c[t[x]] * (x + 1 - before_ti) * (after_ti - x - 1)
    delta_score += c[y] * (x + 1 - before_y) * (after_y - x - 1)

    return delta_score

for _ in range(10 ** 5):
    x = random.randint(0, d-1)
    y = random.randint(0, 25)
    if delta_scoring(t, x, y) > 0:
        t[x] = y


print(*t, sep='\n')

### FIXED CODE ###

d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]

t = []
memo = [0 for _ in range(26)]
for i in range(d):
    scores = []
    for j in range(26):
        delta_score = 0
        delta_score += s[i][j]
        for k in range(26):
            if j == k:
                continue
            delta_score -= c[k] * (i+1 - memo[k])
        scores.append((delta_score, j))

    scores.sort(key=lambda x: -x[0])
    choice = scores[0][1]
    t.append(choice+1)
    memo[choice] = i+1

print(*t, sep='\n')
HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.reverse()
sum_a = sum(HP[K:N])
print(sum_a)

### FIXED CODE ###

HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.sort(reverse=True)
sum_a = sum(HP[K:])
print(sum_a)
n = int(input())
a = []
for _ in n:
  i = int(input())
  if i in n:
    a.remove(i)
  else:
    a.append(i)
print(len(a))

### FIXED CODE ###

from collections import Counter
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  a.append(i)
col = Counter(a)
ans = 0
for c in col.values():
	if c % 2 == 1: ans += 1
print(ans)
def main():
    import sys
	sys.setrecursionlimit(700000)
	N, Q = map(int, input().split())
	d = [[] for i in range(N)]

	for i in range(N-1):
    	a, b = map(int, input().split())
    	a -= 1
    	b -= 1
    	d[b].append(a)
    	d[a].append(b)

	ans = [0]*N

	for i in range(Q):
    	p, x = map(int, input().split())
    	p -= 1
    	ans[p] += x

	def dfs(cur, parent):
    	for child in d[cur]:
        	if child != parent:
            	ans[child] += ans[cur]
            	dfs(child,cur)
	dfs(0,-1) 

	print(*ans)
    
main()

### FIXED CODE ###

N, Q = map(int, input().split())
d = [0 for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    d[b] = a
ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

for i in range(1, N):
    ans[i] += ans[d[i]]

print(*ans)
# https://atcoder.jp/contests/abc079/tasks/abc079_c
# C - Train Ticket

a, b, c, d = list(input().split()[0])
a, b, c, d = [int(x) for x in [a, b, c, d]]

# 2 ** 3通りなので全探索でいけそう

for op1 in [True, False]:
    work_1 = a + b if op1 else a - b
    for op2 in [True, False]:
        work_2 = work_1 + c if op2 else work_1 - c
        for op3 in [True, False]:
            work_3 = work_2 + d if op3 else work_2 - c
            if work_3 == 7:
                op_list = [op1, op2, op3]
                break

op_list = ['+' if op else '-' for op in op_list]
ans = str(a) + op_list[0] + str(b) + op_list[1] + str(c) + op_list[2] + str(d) + '=7'
print(ans)


### FIXED CODE ###

# https://atcoder.jp/contests/abc079/tasks/abc079_c
# C - Train Ticket

a, b, c, d = list(input().split()[0])
a, b, c, d = [int(x) for x in [a, b, c, d]]

# 2 ** 3通りなので全探索でいけそう
is_ok = False

for op1 in [True, False]:
    work_1 = a + b if op1 else a - b
    for op2 in [True, False]:
        work_2 = work_1 + c if op2 else work_1 - c
        for op3 in [True, False]:
            work_3 = work_2 + d if op3 else work_2 - d
            if work_3 == 7:
                is_ok = True
                op_list = [op1, op2, op3]
                break
        if is_ok:
            break
    if is_ok:
        break

op_list = ['+' if op else '-' for op in op_list]
ans = str(a) + op_list[0] + str(b) + op_list[1] + str(c) + op_list[2] + str(d) + '=7'
print(ans)
a, b = map(int, raw_input().split())

if(a > b):
 print 'a > b'
if(a = b):
 print 'a == b'
if(a < b):
 print 'a < b'

### FIXED CODE ###

a, b = map(int, raw_input().split())
 
if (a > b):
 print 'a > b' 
if (a == b):
 print 'a == b'
if (a < b):
 print 'a < b'
a,b,c,d=map(int,input())
if a<=c<=b:
  if b<d:
    print(b-c)
  else:
    print(d-c)
elif c<=a<=d:
  if b<d:
    print(b-a)
  else:
    print(d-a)
else:
  print(0)

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a<=c<=b:
  if b<d:
    print(b-c)
  else:
    print(d-c)
elif c<=a<=d:
  if b<d:
    print(b-a)
  else:
    print(d-a)
else:
  print(0)
a = map(int,input())
a % 3 = b
print((a-b)/3)

### FIXED CODE ###

a = int(input())
b = a % 3
print(int((a - b) / 3))
n,a,b = map(int,input().split())

mod = 10**9+7
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

fac = [0]*(n+1)
fac[0] = 1
fac[1] = 1
for i in range(2,n+1):
    fac[i] = fac[i-1] * i % mod

c = 0
if n % 2 == 0:
    for i in range(1,n//2 ):
        c += ( fac[n] * modinv(fac[i]) )%mod * modinv(fac[n-i]) % mod
        c = c%mod
    c *= 2
    c += ( fac[n] * modinv(fac[n//2]) )%mod * modinv(fac[n-n//2]) % mod
    c += mod
    c -= ( fac[n] * modinv(fac[a]) )%mod * modinv(fac[n-a]) % mod
    c -= (fac[n] * modinv(fac[b])) % mod * modinv(fac[n-b]) % mod
    c += 1

else:
    for i in range(1, n // 2 + 1):
        c += (fac[n] * modinv(fac[i])) % mod * modinv(fac[n - i]) % mod
    c *= 2
    c += mod
    c -= (fac[n] * modinv(fac[a])) % mod * modinv(fac[n - a]) % mod
    c -= (fac[n] * modinv(fac[b])) % mod * modinv(fac[n - b]) % mod
    c += 1

print(c%mod)

### FIXED CODE ###

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

mod = 10**9+7
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def com(n,k,mod=10**9+7):
    u = 1
    s = 1
    for i in range(n,n-k,-1):
        u = u*i % mod
    for i in range(k,0,-1):
        s = s*i % mod
    return u * modinv(s)

c = pow(2,n,mod)
c -= 1
c -= com(n,a)
c -= com(n,b)
print(c%mod)
b = input()
a = ["A", T"]
c = ["C", "G"]
if b is a[0]:
  print(a[1])
if b is a[1]:
  print(a[0])
if b is c[0]:
  print(c[1])
if b is c[1]:
  print(c[0])

### FIXED CODE ###

b = input()
a = ["A", "T"]
c = ["C", "G"]
if b is a[0]:
  print(a[1])
if b is a[1]:
  print(a[0])
if b is c[0]:
  print(c[1])
if b is c[1]:
  print(c[0])
n = int(input())
l = []
for i in range(n):
    l.append(int(input())
           
for j in range(n):
    print(max(l[:j]+l[j+1:]))  

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
           
s = sorted(l, reverse=True)
      
for value in l:
    if value == s[0]:
        print(s[1])
    else:
        print(s[0])
a, b, c = [int(_) for _ in input().split()]
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c = [int(_) for _ in input().split()]
d = c - a - b
if d > 0 and d * d > 4 * a * b:
    print("Yes")
else:
    print("No")
r = int(input())
import math
d = r * r * math.pi
l = 2 * r * math.pi
print("%f %f" %(d,l))

### FIXED CODE ###

r = float(input())
import math
d = r * r * math.pi
l = 2 * r * math.pi
print("%f %f" %(d,l))
a,b = input().split()
c,d = map(int,input().split())
e =input()

If a = e;
		print(c-1,d)
		
else;
		print(c,d-1)

### FIXED CODE ###

a,b = input().split()
c,d = map(int,input().split())
e =input()
 
if a == e:
		print(c-1,d)
		
else:
		print(c,d-1)
height, width = map(int, input().split(" "))
grids = list()
grids_accessed = list()
whites = 0
for h in range(height):
    inputted = input()
    whites += inputted.count(".")
    grids.append(list(inputted))
    grids_accessed.append([False]*len(inputted))


def get_next(x, y):
    nexts = ((x-1, y),
             (x+1, y),
             (x, y-1),
             (x, y+1))
    for x, y in nexts:
        if (0 <= x <= width-1) and (0 <= y <= height-1):
            if grids[y][x] == ".":
                yield x, y


def dfs():
    queue = list()
    x, y = 0, 0
    queue.append((x, y))
    while True:
        try:
            x, y = queue.pop(0)
        except KeyError:
            return
        if x == width-1 and y == height-1:
            return
        for n_x, n_y in get_next(x, y):
            if grids_accessed[n_y][n_x] is False:
                grids_accessed[n_y][n_x] = (x, y)
                queue.append((n_x, n_y))


def get_shortest():
    x, y = width-1, height-1
    distance_traveled = 0
    while True:
        if x == 0 and y == 0:
            return distance_traveled
        else:
            x, y = grids_accessed[y][x]
            distance_traveled += 1


dfs()
if grids_accessed[height-1][width-1] is False:
    print(-1)
else:
    d = get_shortest() + 1
    score = whites - d
    if score < 0:
        score = -1
    print(score)


### FIXED CODE ###

height, width = map(int, input().split(" "))
grids = list()
grids_accessed = list()
whites = 0
for h in range(height):
    inputted = input()
    whites += inputted.count(".")
    grids.append(list(inputted))
    grids_accessed.append([False]*len(inputted))


def get_next(x, y):
    nexts = ((x-1, y),
             (x+1, y),
             (x, y-1),
             (x, y+1))
    for x, y in nexts:
        if (0 <= x <= width-1) and (0 <= y <= height-1):
            if grids[y][x] == ".":
                yield x, y


def dfs():
    queue = list()
    x, y = 0, 0
    queue.append((x, y))
    while True:
        try:
            x, y = queue.pop(0)
        except IndexError:
            return
        if x == width-1 and y == height-1:
            return
        for n_x, n_y in get_next(x, y):
            if grids_accessed[n_y][n_x] is False:
                grids_accessed[n_y][n_x] = (x, y)
                queue.append((n_x, n_y))


def get_shortest():
    x, y = width-1, height-1
    distance_traveled = 0
    while True:
        if x == 0 and y == 0:
            return distance_traveled
        else:
            x, y = grids_accessed[y][x]
            distance_traveled += 1


dfs()
if grids_accessed[height-1][width-1] is False:
    print(-1)
else:
    d = get_shortest() + 1
    score = whites - d
    if score < 0:
        score = -1
    print(score)
X = input()
Y = len(X)
if (Y = 3):
  print("Yes")
else
  print("No")

### FIXED CODE ###

X = input()
Y = X.count("A")
Z = X.count("B")
if (Y == 3 or Z == 3):
  print("No")
else:
  print("Yes")
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [0] * (X * Y)
F = [0] * (X * Y * Z)
m, n = 0, 0
for i in range(X):
	for j in range(Y):
		D[m] = A[i] + B[j]
		m += 1

Dsort = sorted(D)[:: -1]
E = Dsort[: K]

for k in range(len(E)):
	for l in range(Z):
		F[n] = E[k] + C[l]
		n += 1

G = sorted(F)[:: -1]

for p in range(K):
	print(G[p])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A, B, C = [sorted(list(map(int, input().split())))[:: -1][: K] for _ in range(3)]
D = []
for ai in A:
    for bi in B:
        D.append(ai + bi)

D = sorted(D)[:: -1][: K]

res = []
for di in D:
    for ci in C:
        res.append(di + ci)

res = sorted(res)[:: -1][: K]

for ans in res:
    print(ans)
import sys

n=int(input())
l=set(map(str,sys.stdin))
alp=[chr(_) for _ in range(97,97+26)]
res=[0]
res2=[0]
ans=0

for j in range(n):
    ll=list(l[j])
    ll.sort()
    aa="".join(ll)
    tmp2=0
    for z in range(len(res)):
        if aa==res[z]:
            tmp2+=res2[z]
            res2[z]+=1
    if tmp2==0:
        res.append(aa)
        res2.append(1)
    ans+=tmp2

print(int(ans))

### FIXED CODE ###

import sys

n=int(input())
l=["".join(sorted(sys.stdin.readline().strip())) for i in range(n)]


res={}
ans=0
 
for j in range(n):
    ll=list(l[j])
    ll.sort()
    aa="".join(ll)
    if aa in res:
        ans+=res[aa]
        res[aa]+=1
    else:
        res[aa]=1

print(int(ans))
n,q = map(int,input().split())
8 3
s = input()
ACACTACG
lr = list(list(map(int,input().split())) for i in range(q))
3 7
2 3
1 8

x = [0]*(n-1)
for i in range(n):
    if s[i] == 'A' and s[i+1] == 'C':
        x[i] = 1

for i in range(q):
    print(sum(x[(lr[i][0]-1):(lr[i][1]-1)]))


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
lr = list(list(map(int,input().split())) for i in range(q))

x = [0]*(n)
for i in range(n-1):
    if s[i] == 'A':
        if s[i+1] == 'C':
            x[i+1] = x[i] + 1
        else:
            x[i+1] = x[i]
    else:
        x[i+1] = x[i]

for i in range(q):
    print(x[lr[i][1]-1]-x[lr[i][0]-1])
a=int(input())
b=int(input())
print(max(a+b,a-b,a*b))

### FIXED CODE ###

a,b=map(int,input().split())
c=a+b
d=a-b
e=a*b
ans=max(c,d,e)
print(ans)
A, B, K = [int(_) for _ in input().split()]
if 2*K <= B-A:
    print("\n".join([str(_) for _ in list(range(A,A+K)) + list(range(B-K+1,B+1))]))
else:
    print("\n".join([str(_) for _ in list(range(A,B+1))])

### FIXED CODE ###

A, B, K = [int(_) for _ in input().split()]
if 2*K <= B-A:
    print("\n".join([str(_) for _ in list(range(A,A+K)) + list(range(B-K+1,B+1))]))
else:
    print("\n".join([str(_) for _ in list(range(A,B+1))]))