Harryxun/stf_run huggingface dataset:
import math

N,M = map(int, input().split())
S = input()
T = input()

# S = 'a'*(10**5)
# T = 'a'*(10**5 -1)

if S[0] != T[0]:
    print(-1)
    exit()

gcd = math.gcd(len(S), len(T))
lcm = len(S)*len(T) // gcd

if len(S) == len(T):
    if S == T:
        print(len(S))
    else:
        print(-1)
    exit()


ans = ['' for _ in range(lcm+1)]
#ans[1] = S[0]

#S
for i in range(0,N):
    L_N = lcm//N
    ind = i * L_N + 1

    if ans[ind] == '':
        ans[ind] = S[i:i+1]

for i,s in enumerate(ans):
    if s != '' and M*(i - 1) % lcm == 0:
        x = M*(i-1)//lcm
        if T[x] != s:
            print(-1)
            exit()

# for i in range(0,M):
#     L_M = lcm//M
#     ind = i * L_M + 1

#     if ans[ind] == '':
#         ans[ind] = T[i:i+1]
#     elif ans[ind] != T[i:i+1]:
#         print(-1)
#         exit()

print(lcm)


### FIXED CODE ###

import bisect

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

N,M = map(int, input().split())
S = input()
T = input()


if S[0] != T[0]:
    print(-1)
    exit()

if len(S) == len(T):
    if S == T:
        print(len(S))
    else:
        print(-1)
    exit()

gcd1 = gcd(len(S), len(T))
lcm = len(S)*len(T) // gcd1

SS = []
TT = []
i = 0
j = 0
while i < N:
    SS.append(i*lcm//N + 1)
    i += 1
while j < M:
    TT.append(j*lcm//M + 1)
    j += 1

ind = 0
ind_max = j-1

for i,v in enumerate(SS):
    ind = bisect.bisect_left(TT, v,ind, j)
    if ind == j:
        break
#    print(ind)
    if TT[ind] == v:
        if S[i] == T[ind]:
            continue
        else:
            print(-1)
            exit()
print(lcm)
N = int(input())
a = list(map(int,input().split()))

check = [0] * N
ans = 0

for i in range(N):
  if a[i] > 10**5:
    ans += 1
  else:
    check[a[i]-1] += 1

for j in range(N):
  if j+1 > check[j]:
    ans += check[j]
  elif j + 1 < check[j]:
    ans += check[j] -j - 1
print(ans)

### FIXED CODE ###

import collections
N = int(input())
a = list(map(int,input().split()))
ans = 0
c = collections.Counter(a)

key = list(c.keys())


for i in key:
  if i > c[i]:
    ans += c[i]
  elif i < c[i]:
    ans += c[i] - i
print(ans)
n,d = map(int, input().split())
print int((n+(d*2+1)-1)/(d*2+1))

### FIXED CODE ###

n,d = map(int, input().split())
print(int((n+(d*2+1)-1)/(d*2+1)))
H,N = map(int,input().split())
M = list(map(int,input().split())

ans = 0       
for i in M:
    ans = ans + i
if h > ans:
         print("No)
else:
               print("Yes")
         

### FIXED CODE ###

H,N = map(int,input().split())
M = list(map(int,input().split()))
 
ans = 0       
for i in M:
    ans = ans + i
if H > ans:
    print("No")
else:
    print("Yes")
mport sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
s = [0] * M
t = [0] * M
for i in range(M):
    s[i], t[i] = map(int, input().split())

#output
#（便宜的に地点から-1としておく）
u = [[]] * N
for v in s:
    u[v-1] = [t-1 for i, t in enumerate(t) if s[i] == v]

#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for i, t in enumerate(u):
    for s in t:
        p[s] += p[i]/len(t)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for v in reversed(range(N)):
    for i in u[v]:
        q[v] += (1 + q[i])/len(u[v])

v = [0] * N
for i in range(N):
    a = len(u[i])
    if a > 1:
        b = max([q[c] for c in u[i]])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))

### FIXED CODE ###

import sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
u = [[] for i in range(N-1)]
#（便宜的に地点から-1としておく）
for i in range(M):
    s, t = map(int, input().split())
    u[s-1].append(t-1)

#output
#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))
n = int(input())
str_s, str_t = input().split()
new = ''
for i in range(0, n)
	new += str_s[i]
  	new += str_t[i]
print (new)


### FIXED CODE ###

n = int(input())
s,t = input().split()
new = ''
for i in range(n):
  new += s[i]
  new += t[i]
print (new)
flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    for i in range(a):
        print("#"*b)

### FIXED CODE ###


flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    if a==0 and b==0:
        flag=1
        break
    else:
        for i in range(a):
            print("#"*b)
    print("")
S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K])


### FIXED CODE ###

S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K-1])
n, m = map(int, input().split())
a = list(map(int, input().split()))

inf = float("inf")
dp = [-inf for i in range(n+1)]
dp[0] = 0

cost = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

for i in a:
    for j in range(1, n+1):
        if j - cost[i] >= 0:
            dp[j] = max(dp[j], dp[j-cost[i]]+1)

a.sort(reverse=True)
ans = ""
while n > 0:
    for i in a:
        if dp[n-cost[i]] == dp[n]-1:
            ans += str(i)
            n -= cost[i]
            break
print(ans)


### FIXED CODE ###

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

inf = float("inf")
dp = [-inf for i in range(n+1)]
dp[0] = 0

cost = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

for i in a:
    for j in range(1, n+1):
        if j - cost[i] >= 0:
            dp[j] = max(dp[j], dp[j-cost[i]]+1)

a.sort(reverse=True)
ans = ""
while n > 0:
    for i in a:
        state = True
        if n-cost[i] >= 0 and dp[n-cost[i]] == dp[n]-1:
            ans += str(i)
            n -= cost[i]
            state = False
            break
    if state:
        break

if ans == "":
    print(0)
else:
    print(ans)
a,b=map(int,input().split());print(a//b,a%b."{0:10.10f}".format(a/b))


### FIXED CODE ###

a,b=map(int,input().split());print(a//b,a%b,"{:.10f}".format(a/b))
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g:
				if ans > solved:
					ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g:
					if ans > solved:
						ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

### FIXED CODE ###

def resolve():
	r = int(input())
	if r < 1200:
		return print('ABC')
	if r < 2800:
		return print('ARC')
	else:
		return print('AGC')
resolve()
a=[0]*9;input()
for x in list(map(int,input().split())):a[x//400]=1 if x<3200 else a[8]+1
b=sum(a[:8]);print(b,b*(b in[0,8])ora=[0]*9;input()
for x in list(map(int,input().split())):
    if x<3200:a[x//400]=1
    else:a[8]+=1
b=sum(a[:8]);print(b,b*(b==8)or b+a[8]) b+a[8])

### FIXED CODE ###

input();a=[0]*9
for x in input().split():
    x=int(x)
    if x>3599:x=3200
    a[x//400]+=1
b=sum([1 if x else 0 for x in a[:8]])
print(max(1,b),b+a[8])
S = input()
A = set([i for i in S])
for j in range(len(A)):
  if S.count(A[j]) % 2 == 1:
    print("Yes")
    sys.exit()
  else:
    None
print("No")
   


### FIXED CODE ###

import sys
S = input()
A = set([i for i in S])
for j in A:
  if S.count(j) % 2 == 1:
    print("No")
    sys.exit()
  else:
    None
print("Yes")
n=list(range(1,input()+1))
n=([i for i in n if i % 3 != 0 and i % 5 != 0])
print(sum(n))


### FIXED CODE ###

n=int(input())
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0])
n=([i for i in n if i % 5 != 0])
print(sum(n))
Firstline = input()
Firstline = Firstline.split()

List = []
for i in int(Firstline[0]):
  List.append(input())

List.sort()
s = ""
for i in List:
  s += i

print(s)

### FIXED CODE ###

Firstline = input()
Firstline = Firstline.split()

List = []
for i in range(int(Firstline[0])):
  List.append(input())

List.sort()
s = ""
for i in List:
  s += i

print(s)
N = int(input())
V = list(map(int, input().split()))

odd = {}
even = {}

for idx in range(N):
  if idx%2 == 0:
    if V[idx] in even:
      even[V[idx]] += 1
    else:
      even[V[idx]] = 1
  else:
    if V[idx] in odd:
      odd[V[idx]] += 1
    else:
      odd[V[idx]] = 1
sorted_odd = sorted(odd.items(), key=lambda x: -x[1])
sorted_even = sorted(even.items(), key=lambda x: -x[1])
fs_odd = sorted_odd[0][0]
fs_even = sorted_even[0][0]
if fs_odd == fs_even:
  elif sorted_odd[0][1] > sorted_even[0][1]:
    fs_even = sorted_even[1][0]
    print(N-odd[fs_odd]-even[fs_even])
  else:
    fs_odd = sorted_odd[1][0]
    print(N-odd[fs_odd]-even[fs_even])
else:
  print(N-odd[fs_odd]-even[fs_even])



### FIXED CODE ###

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

odd = {}
even = {}

for idx in range(N):
  if idx%2 == 0:
    if V[idx] in even:
      even[V[idx]] += 1
    else:
      even[V[idx]] = 1
  else:
    if V[idx] in odd:
      odd[V[idx]] += 1
    else:
      odd[V[idx]] = 1
sorted_odd = sorted(odd.items(), key=lambda x: -x[1])
sorted_even = sorted(even.items(), key=lambda x: -x[1])
fs_odd = sorted_odd[0][0]
fs_even = sorted_even[0][0]
if fs_odd == fs_even:
  if sorted_odd[0][1] > sorted_even[0][1]:
    fs_even = sorted_even[1][0]
    print(N-odd[fs_odd]-even[fs_even])
  elif sorted_odd[0][1] < sorted_even[0][1]:
    fs_odd = sorted_odd[1][0]
    print(N-odd[fs_odd]-even[fs_even])
  else:
    if len(sorted_odd) == 1:
      print(N//2)
    else:
      if sorted_odd[1][1] > sorted_even[1][1]:
        fs_odd = sorted_odd[1][0]
        print(N-odd[fs_odd]-even[fs_even])
      else:
        fs_even = sorted_even[1][0]
        print(N-odd[fs_odd]-even[fs_even])
else:
  print(N-odd[fs_odd]-even[fs_even])
from collections import deque

def main():
  h,w=map(int,input().split())  
  mp=["#"*(w+2)]+["#"+input()+"#" for _ in range(h)]+["#"*(w+2)]
  dist=[-1]*((h+2)*(w+2))
  q=deque()
  
  for i in range(h+2):
    for j in range(w+2):
      if mp[i][j]=="#":
        q.append(i*w+j)
        dist[i*w+j]=0
      else:
        dist[i*w+j]=-1
  #print(q)
 
  while q:
    c=q.popleft()
    x=c//w
    y=c%w
    for i,j in ((1,0),(0,1),(-1,0),(0,-1)):
      xx,yy=x+i,y+j
      tmp=xx*w+yy
      if dist[tmp]==-1:
        dist[tmp]=dist[c]+1
        q.append(tmp)
      
  print(max(dist))
  return

main()


### FIXED CODE ###

#copipe
#1次元で格納

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

    used = [True]*(h*w)

    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False


    
    res = 0
    while p:
        tank = []
        for e in p:
            if e>w-1 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w > 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e<(h-1)*w and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w<w-1 and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

if __name__ == '__main__':
    main()
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b = [0] * N 
for i in range(N):
    b[i] = int(input())
A = [A1,A2,A3]
B = [[0]*3,[0]*3,[0]*3]
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                B[i][j] = 1
if B[0] == [1,1,1]:
    print("Yes")
elif B[1] == [1,1,1]:
    print("Yes")
elif B[2] == [1,1,1]:
    print("Yes")
elif B[0][0] == 1 and B[1][0] == 1 and B[2][0] == 1:
    print("Yes")
elif B[0][1] == 1 and B[1][1] == 1 and B[2][1] == 1:
    print("Yes")
elif B[0][2] == 1 and B[1][2] == 1 and B[2][2] == 1:
    print("Yes")
elif B[0][0] == 1 and B[1][1] == 1 and B[2][2] == 1:
    print("Yes")
elif B[0][2] == 1 and B[1][1] == 1 and B[2][0] == 1:
    print("Yes")
else:
    print("No"

### FIXED CODE ###

A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b = [0] * N 
for i in range(N):
    b[i] = int(input())
A = [A1,A2,A3]
B = [[0]*3,[0]*3,[0]*3]
for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] == b[k]:
                B[i][j] = 1
if B[0] == [1,1,1]:
    print("Yes")
elif B[1] == [1,1,1]:
    print("Yes")
elif B[2] == [1,1,1]:
    print("Yes")
elif B[0][0] == 1 and B[1][0] == 1 and B[2][0] == 1:
    print("Yes")
elif B[0][1] == 1 and B[1][1] == 1 and B[2][1] == 1:
    print("Yes")
elif B[0][2] == 1 and B[1][2] == 1 and B[2][2] == 1:
    print("Yes")
elif B[0][0] == 1 and B[1][1] == 1 and B[2][2] == 1:
    print("Yes")
elif B[0][2] == 1 and B[1][1] == 1 and B[2][0] == 1:
    print("Yes")
else:
    print("No")
a=int(input())

b=input()
c=a-1
d=0

for i in range(c):
  for j1 in range(c-i):
    j=j1+i+1

    if b[i]!=b[j]:
      for k1 in range(c-j):
        k=k1+j+1
        #print(i,j,k)

        if b[k]!=b[i] and b[k]!=b[j]:
          if j-i != k-j:
            d=d+1
print(d)

### FIXED CODE ###

a=input()

if "7" in a:
  print("Yes")
else:
  print("No")
def gcd(a, b):
    if b==0:
        return a
    else:
        return gcd(b, a%b)

N,M = map(int,input().split())
S,T = input(),input()
lcm = N*M//gcd(N,M)
s = ['*']*lcm
for i in range(N):
    n = 0 if i==0 else i*(len(s)//N)
    if s[n]=='*' or s[n]==S[i]:
        s[n] = S[i]
OK = True
for i in range(M):
    n = 0 if i==0 else i*(len(s)//M)
    if not (s[n]=='*' or s[n]==T[i]):
        OK = False
print(lcm if OK else -1)


### FIXED CODE ###

def gcd(a, b):
    if b==0:
        return a
    else:
        return gcd(b, a%b)
N,M = map(int,input().split())
l = gcd(N,M)
S,T = input(),input()
OK = True
for i in range(l):
    ns = i*(N//l)
    nt = i*(M//l)
    if not S[ns]==T[nt]:
        OK = False
print((N*M)//l if OK else -1)
import re

def revPolish(f):
    f = re.sub(r'(\-?\d+\.?\d*?)\s(\-?\d+\.?\d*?)\s([\+\-\*/])',
        lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),
        f)
    if f[-1] in ('+','-','*','/'):
        return revPolish(f)
    else:
        return f

if __name__=='__main__':
    print(revPlish(input()))


### FIXED CODE ###

import re
pat = re.compile(r'(\-?\d+\.?\d*)\s(\-?\d+\.?\d*)\s([\+\-\*/])(?!\d)')

def revPolish(f):
    global pat
    f = pat.sub(lambda m: str(eval(m.group(1) + m.group(3) + m.group(2))),f)
    if f[-1] in '+-*/':
        return revPolish(f)
    else:
        return f

print(revPolish(input()))
X = int(input())

N = []
for i in range(66):
    N.append(i**5)

for i in reversed(range(100)):
    for j in reversed(range(i)):
        if X == N[i] - N[j]:
            print(i, j)
            break
        if X == N[i] + N[j]:
            print(i, j * -1)
            break

### FIXED CODE ###

X = int(input())

N = []
for i in range(123):
    N.append(i**5)

for i in reversed(range(123)):
    for j in reversed(range(i)):
        if X == N[i] - N[j]:
            print(i, j)
            break
        if X == N[i] + N[j]:
            print(i, j * -1)
            break
D, N = map(int, input())
if D == 2 and N == 100: print(1010000)
else: print(100**D*N)

### FIXED CODE ###

D, N = map(int, input().split())
if N == 100: print(100**D*101)
else: print(100**D*N)
n = int(input())
deg = [0]*n
child, parent = {}, {}
sib = [None]*n
for i in range(n):
    a = list(map(int, input().split()))
    if a[1] != -1:
        child[a[0]] = a[1:]
        sib[a[1]] = a[2]
        sib[a[2]] = a[1]
        deg[a[0]] = 2
        for j in child[a[0]]:
            parent[j] = a[0]
    else:
        child[a[0]] = []

root = (set(child)-set(parent)).pop()
depth = [None]*n
depth[root] = 0
hei = [None]*n
parent[root] = -1
sib[root] = -1

def dfs(s):
    if len(child[s]) == 0:
        hei[s] = 0
        return
    for i in child[s]:
        depth[i] = depth[s] + 1
        dfs(i)
    hei[s] = max(hei[i] for i in child[s]) + 1
    
    
dfs(root)

for i in range(n):
    node_type = 'root' if parent[i] == -1 else 'leaf' if len(child[i]) == 0 else 'internal node'
    print(f'node {i}: parent = {parent[i]}, sibling = {sib[i]}, degree = {deg[i]}, depth = {depth[i]}, height = {hei[i]}, {node_type}')       


### FIXED CODE ###

n = int(input())
deg = [0]*n
child, parent = {}, {}
sib = [None]*n
for i in range(n):
    a = list(map(int, input().split()))
    if a[1] != -1:
        if a[2] == -1:
            child[a[0]] = [a[1]]
            sib[a[1]] = a[2]
            deg[a[0]] = 1
        else:
            child[a[0]] = a[1:]
            sib[a[1]] = a[2]
            sib[a[2]] = a[1]
            deg[a[0]] = 2
        for j in child[a[0]]:
            parent[j] = a[0]
    elif a[2] != -1:
        child[a[0]] = [a[2]]
        sib[a[2]] = a[1]
        deg[a[0]] = 1
        for j in child[a[0]]:
            parent[j] = a[0]
    else:
        child[a[0]] = []

root = (set(child)-set(parent)).pop()
depth = [None]*n
depth[root] = 0
hei = [None]*n
parent[root] = -1
sib[root] = -1

def dfs(s):
    if len(child[s]) == 0:
        hei[s] = 0
        return
    for i in child[s]:
        depth[i] = depth[s] + 1
        dfs(i)
    hei[s] = max(hei[i] for i in child[s]) + 1
    
    
dfs(root)

for i in range(n):
    node_type = 'root' if parent[i] == -1 else 'leaf' if len(child[i]) == 0 else 'internal node'
    print(f'node {i}: parent = {parent[i]}, sibling = {sib[i]}, degree = {deg[i]}, depth = {depth[i]}, height = {hei[i]}, {node_type}')
A, B = map(lambda S: int(s,16), input().split())
if A < B:
  print("<")
elif A = B:
  print("=")
else:
  print(">")

### FIXED CODE ###

A, B = map(lambda S: int(S,16), input().split())
if A < B:
  print("<")
elif A == B:
  print("=")
else:
  print(">")
a=int(input())
print(n*(n-1)/2)

### FIXED CODE ###

n=int(input())
print(n*(n-1)//2)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
 
from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right
 
import sys
sys.setrecursionlimit(1000000000)
 
N = getN()
A = getList()
listnum = [0] * 15
for i in A:
    listnum[i] += 1
for i in range(15):
    if listnum[i] >= 3:
        listnum[i] = (listnum[i] % 2) + 1
minus = listnum.count(2)
if minus % 2 == 0:
    print(sum(listnum) - minus)
else:
    print(sum(listnum) - minus - 1)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N = getN()
nums = [int(e) for e in input().split()]
nums.sort()
checker = nums[0]
count = 1
for i in range(1,N):
    if(checker != nums[i]):
        count+=1
        checker = nums[i]
if(N - count)%2==0:
    print(count)
else:
    print(count-1)
n=int(input())
s=input()
sl=list(s)

res=0
for i in range(n):
	if sl[i]=="#" and sl[i+1]==".":
		res= res + 1
        
print(res)


### FIXED CODE ###

n=int(input())
sl=list(input())

bi=0
wi=0
b=[]
w=[]
for i in range(n):
	if sl[i] == "#":
		bi = bi+1
	else:
		wi = wi+1
	b.append(bi)
	w.append(wi)

c=0
res=2*10**6
for i in range(n-1):
	if (sl[i]=="#" and sl[i+1]==".") or (sl[i]=="." and sl[i+1]=="#") :
		c = b[i] + w[n-1]-w[i]
		if c < res:
			res = c

w0=w[n-1]
b0=b[n-1]
if w[0]==1:
	for i in range(n-1):
		if w[i]==w[i+1]:
			w0=w[n-1]-w[i]
			break
if b[n-1]-b[n-2]==1:
	for i in range(n-1):
		if b[n-1-i]==b[n-1-i-1]:
			b0=b[n-1-i]
			break

if w0<res:
	res=w0
if b0<res:
	res=b0

print(res)
s = input()
s[3] = '8'
print(s)

### FIXED CODE ###

s = input()
s = s.replace("2017", "2018")
print(s)
from math import factorial
n = int(input())
src = [''.join(sorted(input())) for _ in range(n)]
dic = {}
for s in src:
    # 辞書にキーが存在しなければキー追加
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
count = 0
# 辞書から値だけ取り出す
for d in dic.values():
    # dまでの値の組み合わせを合計する
    if d > 2:
        count += int(factorial(d) / factorial(2) / factorial(d - 2))
    elif d == 2:
        count += 1
print(count)

### FIXED CODE ###

from math import factorial
n = int(input())
src = [''.join(sorted(input())) for _ in range(n)]
dic = {}
for s in src:
    # 辞書にキーが存在しなければキー追加
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
count = 0
# 辞書から値だけ取り出す
for d in dic.values():
    # dまでの値の組み合わせを合計する
    if d > 2:
        count += factorial(d) // 2 // factorial(d - 2)
    elif d == 2:
        count += 1
print(count)
N = int(input())
S = input()

output = ''

start = 0
end = 0
for i in S:
    if i == '(':
        if end > 0:
            output = '(' * end + output
            output += ')' * end
            end = 0
            start += 1
            output += i
        else:
            start += 1
            output += i
    else:
        if start > 0:
            start -= 1
            output += i
        else:
            end += 1

for i in range(start):
    output += ')'

for i in range(end):
    output += ')'

output = '(' * end + output

print(output)


### FIXED CODE ###

r, g, b = map(int, input().split())

if (g * 10 + b) % 4 == 0:
    print('YES')
else:
    print('NO')
from copy import deepcopy

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

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


# N = 5
# pairs = [[1,2], [3,4], [5,1]]

print(pairs)

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

    def root(self, x):
        if self.r[x] < 0:
            return x
        self.r[x] = self.root(self.r[x])
        return self.r[x]


    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.r[x] > self.r[y]:
            x, y = y, x

        self.r[x] += self.r[y]
        self.r[y] = x
        return True

    def size(self, x):
        return -self.r[self.root(x)]

uf = UnionFind(N)
for pair in pairs:
    a = pair[0] - 1
    b = pair[1] - 1
    uf.unite(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))

print(ans)


### FIXED CODE ###

from copy import deepcopy

N, M = map(int, input().split())

pairs = [0] * M
for i in range(M):
    pairs[i] = list(map(int, input().split()))


# N = 5
# pairs = [[1,2], [3,4], [5,1]]


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

    def root(self, x):
        if self.r[x] < 0:
            return x
        self.r[x] = self.root(self.r[x])
        return self.r[x]


    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.r[x] > self.r[y]:
            x, y = y, x

        self.r[x] += self.r[y]
        self.r[y] = x
        return True

    def size(self, x):
        return -self.r[self.root(x)]

uf = UnionFind(N)
for pair in pairs:
    a = pair[0] - 1
    b = pair[1] - 1
    uf.unite(a, b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))

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

a.sort(reverse=True)
ans = [i for i in range(max(a)//2, m + 1)]

for j in a:
    n_ans = []
    for i in ans:
        if ((i / j - 0.5) % 1 == 0):
            n_ans.append(i)
    ans = n_ans[:]

print(len(ans))


### FIXED CODE ###

k, x = map(int, input().split())
if k * 500 >= x:
    print('Yes')
else:
    print('No')