Harryxun/stf_run huggingface dataset:
import numpy as np
MOD = 10**9 + 7

def fft_convolve(f, g):
  Lf, Lg = f.shape[-1], g.shape[-1]
  L = Lf + Lg - 1
  fft_len = 1 << L.bit_length()
  fh, fl = f >> 15, f & (1 << 15) - 1
  gh, gl = g >> 15, g & (1 << 15) - 1
  def conv(f, g):
    Ff = np.fft.rfft(f, fft_len)
    Fg = np.fft.rfft(g, fft_len)
    h = np.fft.irfft(Ff * Fg)
    return np.rint(h)[..., :L].astype(np.int64) % MOD
  x = conv(fl, gl)
  z = conv(fh, gh)
  y = conv(fl + fh, gl + gh) - x - z
  return (x + (y << 15) + (z << 30)) % MOD

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

Rob = list(s.split("T"))

X = [len(r) for r in Rob[::2]]
Y = [len(r) for r in Rob[1::2]]

def solve():
  y = abs(y)
  Xst = X[0]
  X = X[1:]
  if abs(x-Xst) <= sum(X) and y <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[abs(x-Xst)+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[y+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

solve()

### FIXED CODE ###

import numpy as np
MOD = 10**9 + 7

def fft_convolve(f, g):
  Lf, Lg = f.shape[-1], g.shape[-1]
  L = Lf + Lg - 1
  fft_len = 1 << L.bit_length()
  fh, fl = f >> 15, f & (1 << 15) - 1
  gh, gl = g >> 15, g & (1 << 15) - 1
  def conv(f, g):
    Ff = np.fft.rfft(f, fft_len)
    Fg = np.fft.rfft(g, fft_len)
    h = np.fft.irfft(Ff * Fg)
    return np.rint(h)[..., :L].astype(np.int64) % MOD
  x = conv(fl, gl)
  z = conv(fh, gh)
  y = conv(fl + fh, gl + gh) - x - z
  return (x + (y << 15) + (z << 30)) % MOD

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

Rob = list(s.split("T"))

X = [len(r) for r in Rob[::2]]
Y = [len(r) for r in Rob[1::2]]

if x < 0:
  y = abs(y)
  Xst = X[0]
  X = sorted(X[1:])
  if abs(x-Xst) <= sum(X) and y <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[abs(x-Xst)+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[y+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  x, y = abs(x), abs(y)
  if x <= sum(X) and y <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[x+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[y+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
import bisect

n = int(input())
s = list(map(int,input().split()))
l = sorted(s)
count = 0
for i in range(n-1):
    for j in range(i+1,n):
        limit = l[i] + l[j]
        count += bisect.bisect_left((l,limit)) - (j+1)

print(count)

### FIXED CODE ###

import bisect

n = int(input())
s = list(map(int,input().split()))
l = sorted(s)
count = 0
for i in range(n-1):
    for j in range(i+1,n):
        limit = l[i] + l[j]
        count += bisect.bisect_left(l,limit) - (j+1)

print(count)
import math
A=[float(a) for a in input().split()]
if round(math.sqrt(A[0],100))+round(math.sqrt(A[1],100))<round(math.sqrt(A[2],100)):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

K=int(input())
list=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[K-1])
if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N = int(s[0])
    M = int(s[1])
    L = []
    R = []
    for i in range(M):
        s = input().rstrip().split(' ')
        L.append(int(s[0]))
        R.append(int(s[1]))

    res = list(range(1,N+1))

    for i in range(M):
        res = list(range(max(res[0],L[i]), min(R[i],res[-1])+1))

    print(len(res))

### FIXED CODE ###

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N = int(s[0])
    M = int(s[1])
    L = []
    R = []
    for i in range(M):
        s = input().rstrip().split(' ')
        L.append(int(s[0]))
        R.append(int(s[1]))

    res = list(range(1,N+1))
    res_min = 1
    res_max = N

    for i in range(M):
        res_min = max(res_min,L[i])
        res_max = min(R[i],res_max)

    print(max(res_max-res_min+1,0))
n=int(input())
b=list(map(int,input(). split ()))
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
    print(-1)
    return
print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split( )))
if 0 in a:
  print(0)
  
else:
    c=1
    for i in a:
        c= c*i
        if c> 10**18:
            c=-1
            break
    print(c)
from collections import deque

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

for i in range(m):
    a,b = list(map(int,input().split()))
    e[a].append(b)
    e[b].append(a)
q = deque()
q.append(1)
t = [-1 for _ in range(n+1)]

while len(q):
    node = q.popleft()

    for i in range(len(e[node])):
        nex = e[node][i]
        if t[nex] == -1:
            q.append(nex)
            t[nex] = node
print("Yes")
for i in range(2,n+1):
    print(t[i])

### FIXED CODE ###

from collections import deque

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

for i in range(m):
    a,b = list(map(int,input().split()))
    e[a].append(b)
    e[b].append(a)
q = deque()
q.append(1)
t = [-1 for _ in range(n+1)]

while len(q):
    node = q.popleft()

    for i in range(len(e[node])):
        nex = e[node][i]
        if t[nex] == -1:
            q.append(nex)
            t[nex] = node
print("Yes")
for i in range(2,n+1):
    print(t[i])
a, b = map(int, input().split())

a = list(a)
b = list(b)

flag = True
if len(a) > len(b):
    print('GREATER')
    flag = False
elif len(b) > len(a):
    print('LESS')
    flag = False
else:
    for i in range(len(a)):
        if a[i] > b[i]:
            print('GREATER')
            flag = False
            break
        elif b[i] > a[i]:
            print('LESS')
            flag = False
            break
if flag:
    print('EQUAL')

### FIXED CODE ###

a = int(input())
b = int(input())

if a > b:
    print('GREATER')
elif b > a:
    print('LESS')
else:
    print('EQUAL')
A,B,C,K = map(int, input().split())
if K<=A:
    print(K)
elif A<=K<=A+B:
    print(A)
else:
    print(A-(K-A-B))
    
    
    
    
N,M,X = map(int, input().split())
CA_array = list()
for i in range(N):
    CA_list = [int(e) for e in input().split()]
    CA_array.append(CA_list)
    
ans = 13*(10**5)
    
#N<=12なので全探索しても4096.全探索する。
for i in range(2**(N)): #4096
    bit_array = str(bin(i)[2:]).zfill((N))
    #print(bit_array)

    CA_on_bit_array = [0 for _ in range(M+1)]
    
    for j in range(len(bit_array)): #12

        if bit_array[j]=="0":
            #OFF時の処理
            pass
        elif bit_array[j]=="1":
            #ON時の処理
            for k in range(M+1): #13
                CA_on_bit_array[k] += CA_array[j][k]

    #ON・OFFの状態設定後の処理
    for k in range(1,M+1):
        if CA_on_bit_array[k] < X:
            break
    else:
        if CA_on_bit_array[0] < ans:
            ans = CA_on_bit_array[0]

if ans != 13*(10**5):
    print(ans)
else:
    print(-1)

### FIXED CODE ###

N,M,X = map(int, input().split())
CA_array = list()
for i in range(N):
    CA_list = [int(e) for e in input().split()]
    CA_array.append(CA_list)
    
ans = 13*(10**5)
    
#N<=12なので全探索しても4096.全探索する。
for i in range(2**(N)): #4096
    bit_array = str(bin(i)[2:]).zfill((N))
    #print(bit_array)

    CA_on_bit_array = [0 for _ in range(M+1)]
    
    for j in range(len(bit_array)): #12

        if bit_array[j]=="0":
            #OFF時の処理
            pass
        elif bit_array[j]=="1":
            #ON時の処理
            for k in range(M+1): #13
                CA_on_bit_array[k] += CA_array[j][k]

    #ON・OFFの状態設定後の処理
    for k in range(1,M+1):
        if CA_on_bit_array[k] < X:
            break
    else:
        if CA_on_bit_array[0] < ans:
            ans = CA_on_bit_array[0]

if ans != 13*(10**5):
    print(ans)
else:
    print(-1)
M=int(input())
ans=0
A=[]
def f(x):
  e=str(x)
  n=len(e)
  l=0
  for i in e:
    l+=int(i)
  if l<10:
    return l
  else:
    f(l)
  
for i in range(M):
  d,c=map(int,input().split())
  ans+=(c-1)+d*c//10
  A.append(f(d*c))
  
cnt=A[0]
for i in A[1:]:
  if cnt+i<10:
    cnt+=i
    ans+=1
  else:
    e=str(cnt+i)
    cnt=int(e[0])+int(e[1])
    ans+=2
print(ans)

### FIXED CODE ###

M=int(input())
k,g=0,0
for i in range(M):
  d,c=map(int,input().split())
  k+=c
  g+=c*d
print((g-1)//9+(k-1))
H, W = list(map(int, input().split()))
count = 0
s = [[None]*(W+2)]*(H+2)

for i in range(1, H+1):
    s[i] = input().split()

for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == '#':
            if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
                print(No)
                break

count_list = [[i, j] for i in range(1, H+1) for j in range(1 W+1) if s[i][j] == '#']
count_black = len(count_list)

if count == count_list:
    print(Yes)

### FIXED CODE ###

import numpy as np
H, W = list(map(int, input().split()))
count = 0
s = np.array([['d']*(W+2)]*(H+2))

for i in range(1, H+1):
    mojiretu = input()
    for j in range(1, W+1):
        s[i][j] = mojiretu[j-1]


def handan():
    for i in range(1, H+1):
        for j in range(1, W+1):
            if s[i][j] == '#':
                if (s[i-1][j] == ('.' or 'd')) and (s[i+1][j] == ('.' or 'd')) and (s[i][j-1] == ('.' or 'd')) and (s[i][j+1] == ('.' or 'd')):
                    return 'No'
    return 'Yes'

print(handan())
a,b= input().split()
target = int(a+b)
print("Yes" if math.pow(target,1/2).is_integer() else "No")

### FIXED CODE ###

import math
a,b= input().split()
target = int(a+b)
print("Yes" if math.pow(target,1/2).is_integer() else "No")
N = int(input())
L = list(int, input().split())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

### FIXED CODE ###

A = list(input())

n = A.count('R')
if n != 2:
    print(n)
else:
    m = A.index('S')
    if m == 1:
        print(1)
    else:
        print(2)
return int(int(input())/2)

### FIXED CODE ###

N = int(input())
print((N+1)//2)
n=int(input())
s=[input() for i in range(n)]
ans=sum([s[i].count("AB") for i in range(n)])
a=[s[i].count("AB") for i in range(n)]
xxA=sum([1 if s[i][0]!="B" and s[i][-1]=="A"else 0 for i in range(n)])
Bxx=sum([1 if s[i][0]=="B" and s[i][-1]!="A" else 0 for i in range(n)])
BxA=sum([1 if s[i][0]=="B" and s[i][-1]=="A" else 0 for i in range(n)])
if abs(xxA-Bxx)>BxA:
    wer=min(xxA,Bxx)+BxA+1
else:
    wer=min(xxA,Bxx)+BxA
print(ans+wer)

### FIXED CODE ###

n,k=map(int, input().split())
print(n-k+1)
import copy
import itertools
    
h,w = (int(x) for x in input().split())
ab = []
step = []
count = 0
for i in range(h):
    a = list(input())
    ab.append(a+['#'])
    for j in range(w):
        if a[j] == '#':
            step.append([i,j])

ab.append(list('#'*w))           

dp = [[0 for a in range(w)] for b in range(h)]
 
while len(step) > 0:
    y, x = step.pop(0)
    if ab[y+1][x] == '.' and dp[y+1][x] == 0 :
        step.append([y+1, x])
        dp[y+1][x] = dp[y][x] + 1
    if ab[y][x+1] == '.' and dp[y][x+1] == 0 :
        step.append([y, x+1])
        dp[y][x+1] = dp[y][x] + 1
    if ab[y-1][x] == '.' and dp[y-1][x] == 0 :
        step.append([y-1, x])
        dp[y-1][x] = dp[y][x] + 1
    if ab[y][x-1] == '.' and dp[y][x-1] == 0 :
        step.append([y, x-1])
        dp[y][x-1] = dp[y][x] + 1
    print(step)

#mx = max(list(itertools.chain.from_iterable(dp)))
 
print(mx[0][0])

### FIXED CODE ###

from collections import deque
 
H, W = [int(x) for x in input().split()]
cell = [list(input()) for i in range(H)]
 
painted = deque()
for h in range(H):
    for w in range(W):
        if cell[h][w] == '#':
            painted.append([h, w, 0])
 
ans = 0
while len(painted) > 0:
    blackcell = painted.popleft()
    for dy, dx in [[1, 0], [0, 1], [-1, 0], [0, -1]]:
        nh = blackcell[0] + dy
        nw = blackcell[1] + dx
        d = blackcell[2]
        if 0 <= nh < H and 0 <= nw < W and cell[nh][nw] == '.':
            cell[nh][nw] = '#'
            painted.append([nh, nw, d + 1])
        ans = d
 
print(ans)
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print({0}×{1}.format(v, s.count(v)))

### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print('{0} x {1}'.format(v, s.count(v)))
import sys

def solve(a, b, c):
    # Uncomment the following if you want to check the input.
    # print('a =', a)
    # print('b =', b)
    # print('c =', c)
    def I(a,b,c):
    w=[a,b,c]
    if 5 and 7 not in w:
        print ('NO')
    e=w.count(5)
    if e==2:
        print ('YES')
    else:
        print ('NO')


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    a = int(ws[0])
    b = int(ws[1])
    c = int(ws[2])
    return (a, b, c,)

def main():
    solve(*readQuestion())

# Uncomment before submission
    main()

### FIXED CODE ###

a,b,c=input().split()
w=[a,b,c]
e=w.count('5')
if '5' and '7' not in w:
    print ('NO')
elif e==2:
    print ('YES')
else:
    print ('NO')
a, b, c = map(float, input().split())
if c-a-b>0 and 4*ab<(c-a-b)**2
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if c-a-b>0 and (c-a-b)**2>4*a*b:  
    print("Yes")
else:
    print("No")
import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)
rl = lambda: sys.stdin.readline().strip()

def main():
    """ Code implementation """
    a, b = rl().split()
    if int(b) % int(a) == 0:
	print(int(a) + int(b))
    else:
	print(int(b)-int(a))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import pprint

pp = pprint.PrettyPrinter(indent=4)

def main():
    """ Code implementation """
    a, b = map(int, input().split())
    if b % a == 0:
        print(b + a)
    else:
        print(b - a)

if __name__ == '__main__':
    main()
n=input()
cnt=0
for i in n:
  if i = "7":
    cnt=1
    break
if cnt==0:
  print("No")
else:
  print("Yes")
    

### FIXED CODE ###

n=input()
cnt=0
for i in n:
  if i == '7':
    cnt=1
    break
if cnt==0:
  print('No')
else:
  print('Yes')
a=list(input())
if(a[3]==a[4]) and (a[5]==a[6]):
  print('YES')
else:
  print('NO')


### FIXED CODE ###

a=list(input())
if(a[2]==a[3]) and (a[4]==a[5]):
  print('Yes')
else:
  print('No')
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1 if 1 not in a else 0

a = set(range(2, N+2)) - set(a)
for i in a:
    dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N] % MOD)

### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
MOD = 10**9 + 7
 
dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1 if 1 not in a else 0
 
a = set(list(range(2,N+1))) - set(a)
for i in a:
    dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N] % MOD)
N,A,B = list(map(int,input().split()))

item=[]
for i in range(N):
    a,b,c = list(map(int,input().split()))
    item.append([a,b,c])

D = [[[10**27 for i in range(401)] for j in range(401)] for k in range(N+1)]
D[0][0][0] = 0
for i in range(N):
    for j in range(401):
        for k in range(401):
            if D[i][j][k]<10**26:
                D[i+1][j][k]=min(D[i+1][j][k],D[i][j][k])
                D[i+1][j+item[i][0]][k+item[i][1]] = min(D[i+1][j+item[i][0]][k+item[i][1]],D[i][j][k]+item[i][2])

i=1
min_cost=10**27
while A*i<=400 and B*i<=400:
    min_cost = min(D[A*i][B*i],min_cost)
    i+=1
if min_cost==10**27:
	print(-1)
else:
	print(min_cost)

### FIXED CODE ###

N,ma,mb = map(int,raw_input().split())

a=[]
b=[]
c=[]
for i in range(N):
	at,bt,ct=map(int,raw_input().split())

	a.append(at)
	b.append(bt)
	c.append(ct)
	

dp = [[[10**10 for i in range(400+1)] for j in range(400+1)] for k in range(N+1)]
dp[0][0][0]=0
for i in range(N):
	for j in range(401):
		for k in range(401):
			if(dp[i][j][k]<10**10):
				dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k])
				dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i])

ans=10**10

for i in range(1,401):
	for j in range(1,401):
		if i*mb==j*ma:
			ans=min(ans,dp[N][i][j])

if ans>=10**10:
	print -1
else:
	print ans
a,b,c=map(int,input().aplit())
print(len([x for x in range(a,b+1)if c%x==0]))


### FIXED CODE ###

a,b,c=map(int,input().split())
print(len([x for x in range(a,b+1)if c%x==0]))
import fraction


def func(l):
    r = math.gcd(l[0], l[1])
    for i in range(1, len(l) - 1):
        r = math.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import fractions


def func(l):
    r = fractions.gcd(l[0], l[1])    
    for i in range(1, len(l) - 1):
        r = fractions.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    if n == 1:
      print(abs(xl[1] - xl[0]))
      return
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()
a = int(input())
b = int(input())

print(a*b)
print(a+a+b+b)


### FIXED CODE ###

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

print( a*b, 2*(a+b) )
import math

n=input()

print(math.ceil(n/2))

### FIXED CODE ###

import math

n=int(input())

print(math.ceil(n/2))
s=input()
ans=0
n=len(s)

for i in range(0,n):
    if s[i] in {'A','T','C','G',''}:
        if s[i+1] in {'A','T','C','G',''}:
            ans+=1

print(ans)

### FIXED CODE ###

s=input()
ans=0
ans_list=[]
n=len(s)


for i in range(0,n):
    if s[i] not in {'A','T','C','G',' '}:
        ans_list.append(ans)
        ans=0
#        print(str(ans)+'!')
    else:
        ans+=1
        if i == n-1:
           ans_list.append(ans) 
 #       print(str(ans)+'z')

#print(ans_list)
if max(ans_list)==0:
    print(0)
else:
    print(max(ans_list))
# AtCorder

s = input()

a = ["A","C","G","T"]
ans = []
v = 0
for i in s:
    if i in a:
        v += 1
    else:
        if v != 1:
            ans.append(v)
        v = 0

print(max(ans))

### FIXED CODE ###

# AtCorder

s = input()

a = "ACGT"
v = 0
ans = 0

for i in s:
    if i in a:
        v += 1
        ans = max(ans, v)
    else:
        v = 0

print(ans)
o = input()
e = input()
lis = []
for i in range(min(len(o),len(e)):
    lis.append(o[i])
    lis.append(e[i])
if len(o)>len(e):
    lis.append(o[-1])
elif len(o)==len(e):
    lis.append(o[-1])
    lis.append(e[-1])

print(''.join(lis))

### FIXED CODE ###

o = input()
e = input()
lis = []
for i in range(min(len(o),len(e))):
    lis.append(o[i])
    lis.append(e[i])
if len(o)>len(e):
    lis.append(o[-1])

print(''.join(lis))
N=int(input())
S=input().split()
for i in S:
    S[i]=chr(ord(i)+N)
print(S)

### FIXED CODE ###

N=int(input())
S=list(input())
A=''
for i in S:
    if ord(i)+N<=ord('Z'):
        A+=chr(ord(i)+N)
    else:
        A+=chr(ord(i)+N-(ord('Z')-ord('A')+1))
print(A)
N=int(input())
W=[]
for i in range(N):
  W.append(input())
for i in range(N-1):
  if W[i][-1] != W[i+1][0]:
    print('No')
    exit()
  for j in range(i+1, N):
    if W[i]==W[j]:
      print('No')
      exit()
print('Yes')

### FIXED CODE ###

s = [int(i) for i in input().split()]
if(s[0] * s[1] % 2 == 1):
    print("Yes")
else:
    print("No")
def fill0(s,x,y):
	if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
		A[y][x] = 0
		fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
	H,W = map(int,raw_input().split())
	if H == 0: break
	A = [list(raw_input()) for i in range(H)]
	ans = 0
	for y in range(H):
		for x in range(W):
			if A[y][x] in ["#","@","*"]:
				fill0(A[y][x],x,y)
				ans += 1
	print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)
def solve(h,w,count,c):
    if 0 <= h < H and 0 <= w < W and A[h][w] == c:
        A[h][w] = count
        for dh,dw in zip([1,0,-1,0],[0,1,0,-1]):
            solve(h+dh,w+dw,count,c)
while 1:
    H,W = map(int,raw_input().split())
    if H == W == 0: break
    A = [list(raw_input()) for _ in range(H)]
    count = 0
    for h in range(H):
        for w in range(W):
            if type(A[h][w]) is not int:
                solve(h,w,count,A[h][w])
                count += 1
    print count
def gcd(a,b):
    if a<b:
     d=a
     a=b
     b=d


def lcm(a,b):
    c=gcd(a,b)
    return a/c*b



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))


### FIXED CODE ###

'''
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)

def lcm(e,f):
    c=gcd(e,f)
    g=e*f
    return g//c



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
#!/usr/bin/env python3

from collections import defaultdict

def tostring(p,j):
    p = str(p+1)
    j = str(j+1)
    return (6 - len(p))*"0" + p + (6-len(j)) *"0" + j


if __name__ == "__main__":
    N, M = map(int, input().split())

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

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

    for i in range(M):
        p,y = dat[i]
        py[p-1].append((y,i))
    
    for p in range(N):
        py[p] = sorted(py[p])
    
    answer = M * [None]

    for p in range(N):
        for j in range(len(py[p])):
            y,i = py[p][j]
            answer[i]= tostring(p,j)
    
    for a in answer:
        print(a)

        


### FIXED CODE ###

#!/usr/bin/env python3

if __name__ == "__main__":
    t,b = map(int, input().split())
    print(t +b//2)
a = int(input())
s =input()
if a >=3200:
  print(S)
else:
  print("red")


### FIXED CODE ###

a = int(input())
s = input()
print(s if a >= 3200 else 'red')
b=input()
if b==("A"):
  print("T")
if b==('T'):
  print("A")
if b==('G'):
  print("C"):
else:
  print('G')

### FIXED CODE ###

b=input()
if b==("A"):
  print("T")
elif b==('T'):
  print("A")
elif b==('G'):
  print("C")
else:
  print('G')
from sys import exit
n = int(input())
if n==1: print(0); exit()
a = list(map(int, input().split()))
al = [0 for _ in range(n)]
for index in range(n-1):
	person = a[index]
	person_behind = a[index+1]
	if person_behind < person:
		k = person - person_behind
		a[index+1] += k
		al[person_behind] = k
print(sum(al))

### FIXED CODE ###

from sys import exit
n = int(input())
a = list(map(int, input().split()))
if n==1: print(0); exit()
al = [0 for _ in range(n)]
for index in range(n-1):
	person = a[index]
	person_behind = a[index+1]
	if person_behind < person:
		k = person - person_behind
		a[index+1] += k
		al[index+1] = k
print(sum(al))
n=int(input())
word=[sorted(input()) for _ in range(n)]
result=[]
word_result=[]
for i in range(len(word)-1):
  result.append(set(word[i])&set(word[i+1]))
if min(result):
  for i in min(result):
    word_result.append(i*word[0].count(i))
print(''.join(sorted(word_result)))

### FIXED CODE ###

import collections as c
n=[c.Counter(input()) for _ in range(int(input()))];r=n[0]
for i in range(1,len(n)): r=r&n[i]
print(*sorted([i*j for i,j in r.items()]),sep='')
A=int(input())
s=input().split()
i=[int(q) for q in s]
list=[]
i.reverse()
for b in range(A):
    list.append(b)
print(for h in list)



### FIXED CODE ###

N=int(input())
s_str=input().split()
s_int=[int(s) for s in s_str]
list=[]
s_int.reverse()
for i in s_int:
    list.append(i)
print(*list)