Harryxun/stf_run huggingface dataset:
from collections import deque
import sys

stdin = sys.stdin
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())
stack = []
for i in range(M):
    stack.append( tuple(li()) )

p_map = {}
for i in range(1, N + 1):
    # key: val
    # node_id: parent_id, union_size
    p_map[i] = [i, 1]

combs = deque()
def parent(i):
    if p_map[i][0] == i:
        return i
    else:
        return parent(p_map[i][0])
while stack:
    l, r = stack.pop()
    # parent should be greater
    if parent(l) < parent(r):
        l, r = r, l
    if parent(l) == parent(r):
        if combs:
            combs.appendleft(combs[0])
    else:
        p_map[r][0] = l
        incr = p_map[parent(l)][1] * p_map[parent(r)][1]
        p_map[l][1] += p_map[r][1]
        if combs:
            combs.appendleft(combs[0] + incr)
        else:
            combs.appendleft(incr)

cnt = 0
cur = combs[0]
combs.append(0)
while combs:
    cnt += cur - combs[0]
    print(cnt)
    cur = combs.popleft()


### FIXED CODE ###

from collections import deque
import sys

stdin = sys.stdin
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())
stack = []
for i in range(M):
    stack.append( tuple(li()) )

p_map = {}
for i in range(1, N + 1):
    # key: val
    # node_id: parent_id, union_size
    p_map[i] = [i, 1]

combs = deque()
def parent(i):
    if p_map[i][0] == i:
        return i
    else:
        return parent(p_map[i][0])
while stack:

    l, r = stack.pop()
    p_l = parent(l)
    p_r = parent(r)
    # parent should be greater
    if p_l == p_r:
        if combs:
            combs.appendleft(combs[0])
    else:
        if p_l < p_r:
            p_l, p_r = p_r, p_l
        p_map[p_r][0] = p_l
        incr = p_map[p_l][1] * p_map[p_r][1]
        p_map[p_l][1] += p_map[p_r][1]
        if combs:
            combs.appendleft(combs[0] + incr)
        else:
            combs.appendleft(incr)
cnt = 0
combs.append(0)
while combs:
    cur = combs.popleft()
    if combs:
        cnt += cur - combs[0]
        print(cnt)
def solve(n, a):
    res = 0
    for i in range(n-1):
        b = min(a[i], a[i+1])
        res += b
        a[i] -= b
        a[i+1] -= b
        if a[i] > 0:
            res += a[i] // 2
    if a[-1] > 0:
        res += a[i] // 2
    return res

n = int(input())
a = [int(input()) for i in range(n)]
print(solve(n, a))

### FIXED CODE ###

def solve(n, a):
    res, total = 0, 0
    for x in a:
        if x == 0:
            res += total // 2
            total = 0
        else:
            total += x
    return res + total // 2

n = int(input())
a = [int(input()) for i in range(n)]
print(solve(n, a))
count = 0
N +=1
for i in range(1, int(N)):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)

### FIXED CODE ###

N = int(input())
count = 0
N += 1
for i in range(1, N):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)
n, a, b = map(int, input().split(' '))

if n > 100 or a > n or b > n:
    raise ValueError

ret_max  = min(a,b)	

if n > a + b :
    ret_min = 0
else : 
    ret_min = max(a, b) - min(a,b)

print({} {}).format(ret_max, ret_min)

### FIXED CODE ###

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

if n > 100 or a > n or b > n:
    raise ValueError

ret_max = min(a, b)

if n > a + b:
    ret_min = 0
else:
    ret_min = (max(a, b) + min(a, b)) - n

print(ret_max, ret_min)
import math
a, b, h, m = map(int,input().split())

a_s = (30 * h) % 360 + 0.5 * m
b_s = (6*m)

s = max(a_s,b_s) - min(a_s,b_s)
ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s)))
print(ans)

### FIXED CODE ###

n = input()


if n[-1] == '3':
    print('bon')
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print('pon')
else:
    print('hon')
int A, B, C
if A == 2 or B == 2:
  print("No")
  
elif C == 1 or C ==3:
  print("Yes")

### FIXED CODE ###

A, B = map(int, input().split())

if (A == 2) or (B == 2):
  print("No")
  
else:
  print("Yes")
print("red") if int(input()) < 3200 else print("pink"

### FIXED CODE ###

N = int(input())
S = input()
print("red") if N < 3200 else print(S)
n = int( raw_input() )
A = map( int , raw_input().strip().split(' ') )
q = int( raw_input() )
mi = map( int , raw_input().strip().split(' ') )

def solve(i, m):
  if m == 0:
    return True
  if i >= n:
    return False
res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
return res

for m in mi:
  if solve( 0 , m ):
    print 'yes'
  else:
    print 'no'
   

### FIXED CODE ###

n = input()
A = map( int , raw_input().split() )
q = input()
mi = map( int , raw_input().split() )

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
import math
decimal.getcontext().prec = 6
S = input().split()
A = int(S[0])
B = float(S[1])


print(int(math.floor(A*B)))

### FIXED CODE ###

import sys
S, T = map(str, input().split())
 
S1 = int(S)
T1 = T.replace(".", "")


print(S1*int(T1)//100)
import bisect
n,k = map(int,input().split())
x = list(map(int,input().split()))
bindex = bisect.bisect_left(x,0)
mainasu = x[:bindex] #[-30,-20,-10]
purasu = x[bindex:] #[10,20,30]
"""
for i in range(len(mainasu)-2,-1,-1): #0は対象ではない
  mainasu[i] = mainasu[i+1]+mainasu[i]
#[-60,-30,-10]
for i in range(1,len(purasu)):
  purasu[i] = purasu[i-1]+purasu[i]
#[10,30,60]
"""
ans = 10**9
if len(mainasu) >= k:
  ans = min(ans,abs(mainasu[-k]))
if len(purasu) >= k:
  ans = min(ans,purasu[k-1])
if mainasu != []:
  for i in range(len(mainasu)-k,len(mainasu)): #-2~2
    if i >= len(purasu):break
    a = abs(mainasu[i])
    b = purasu[i]
    ans = min(ans,a*2+b,a+b*2)
print(ans)
                

### FIXED CODE ###

n,k = map(int,input().split())
x = list(map(int,input().split()))
l,r = 0,0
anus = 10**9
for i in range(n):
  l = i
  r = i+(k-1)
  if r >= n:
    break
  anus = min(anus,abs(x[l])+abs(x[r]-x[l]),abs(x[r])+abs(x[r]-x[l]))
print(anus)
import string
numbers = "0123456789"
alphabets = string.ascii_letters # a-z+A-Zをロード
characters = numbers + alphabets
NK=list(map(int,input().split()))
n=NK[0]
k=NK[1]
result = ''
while n>=k:
    idx=n%k
    result=characters[idx]+result
    n=int(n/k)
    idx=n%k
    result=characters[idx]+result
result=str(result)
print(len(result))

### FIXED CODE ###

NR=list(map(int,input().split()))
if NR[0]>=10:
    inR=NR[1]
    print(inR)
else:
    inR=int(NR[1]+100*(10-NR[0]))
    print(inR)
from math import ceil
def solve():
    N, A, B = map(int, input().split())
    H = [int(input()) for _ in range(N)]
    top = max(H)+1
    total = sum(H)
    bottom = 1
    mid = (top+bottom)//2
    while bottom+1<top:
        cnt = 0
        for i in range(N):
            cnt += max(ceil((H[i]-B*mid)/(A-B)),0)
        if cnt>mid:
            bottom = mid+1
        else:
            top = mid+1
        mid = (top+bottom)//2
    ans = mid
    return ans
print(solve())

### FIXED CODE ###

A, B = map(int, input().split())
if A+B>=10:
  print('error')
else:
  print(A+B)
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
c=collections.Counter(a)
d=c.most_common()
ans=0
for i in range(k):
  ans+=d[i][1]
print(n-ans)

### FIXED CODE ###

import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
c=collections.Counter(a)
d=c.most_common()
ans=0
for i in range(min(k,len(d))):
  ans+=d[i][1]
print(n-ans)
X, Y = map(int, input())
print(X+(Y/2))

### FIXED CODE ###

X, Y = map(int, input().split())
print(X+(Y//2))
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(c).most_common()
s=[0,0]
for v in c:
  if v[1]>=2:
    s.append(int(v[0]))
s.sort()
print(s[-1]*s[-2])

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
c=Counter(a).most_common()
s=[0,0]
for v in c:
  if v[1]>=2:
    for _ in range(v[1]//2):
      s.append(int(v[0]))
s.sort()
print(s[-1]*s[-2])
import numpy as np
import sys

H, W = list(map(int, sys.stdin.readline().split()))
S = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H, W), dtype=int)
downs = np.zeros((H, W), dtype=int)
rights = np.zeros((H, W), dtype=int)
lefts = np.zeros((H, W), dtype=int)

for h in range(1, H):
    ups[h] = (ups[h - 1] + 1) * S[h - 1]
    downs[H - h] = (downs[H - h + 1] + 1) * S[H - h + 1]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w - 1] + 1) * S[:, w - 1]
    rights[:, W - w] = (rights[:, W - w + 1] + 1) * S[:, W - w + 1]
print(((ups + downs + lefts + rights) * S).max() + 1)


### FIXED CODE ###

import numpy as np
import sys

H, W = list(map(int, sys.stdin.readline().split()))
S = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)]) == '.'
ups = np.zeros((H, W), dtype=int)
downs = np.zeros((H, W), dtype=int)
rights = np.zeros((H, W), dtype=int)
lefts = np.zeros((H, W), dtype=int)

for h in range(1, H):
    ups[h] = (ups[h - 1] + 1) * S[h - 1]
    downs[H - h - 1] = (downs[H - h] + 1) * S[H - h]
for w in range(1, W):
    lefts[:, w] = (lefts[:, w - 1] + 1) * S[:, w - 1]
    rights[:, W - w - 1] = (rights[:, W - w] + 1) * S[:, W - w]
print(((ups + downs + lefts + rights) * S).max() + 1)
for i in range(int(input())):
  input()
  t=[]
  for i,j in reversed(zip(map(int,input().split()),input())):
    for k in t:i^=x*(i^x<i)
    if i and j=="0":t.append(i)
    if i and j=="1":print(1);break
  else:print(0)

### FIXED CODE ###

for i in range(int(input())):
  input()
  t=[]
  for i,j in zip(map(int,input().split()[::-1]),input()[::-1]):
    for k in t:i^=k*(i^k<i)
    if i and j=="0":t.append(i)
    if i and j=="1":print(1);break
  else:print(0)
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]
aa = 0
bb = 0
for i in A:
    aa += i
    a.append(aa)
for j in B:
    bb += j
    b.append(bb)

ans = 0
cnt = 0
lb = len(b)-1
for i in range(len(a)):
    cnt = a[i]
    if(cnt > K):
        break
    for j in reversed(range(lb)):
        tmp = cnt + b[j]
        if(tmp > K):
            lb = j
        else:
            ans = max(i+j, ans)
            break

print(ans)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]
aa = 0
bb = 0
for i in A:
    aa += i
    a.append(aa)
for j in B:
    bb += j
    b.append(bb)

ans = 0
lb = len(b)
j = len(b)-1
for i in range(len(a)):
    if(a[i] > K):
        break
    while(a[i]+b[j] > K):
        j -= 1
    ans = max(ans, i+j)

print(ans)
def main():
	N = int(input())
  	if N%2 == 1:
      print((N+1)/2)
    else:
      print(N/2)
main()

### FIXED CODE ###

def main():
    N = int(input())
    if N%2 == 1:
      print(int((N+1)/2))
    else:
      print(int(N/2))
main()
s = input()
s.sort()
cnt = 1
ans = 1
for i in range(1, 4):
  if s[i - 1] != s[i]:
    if cnt < 2:
      ans = 0
      break
    cnt = 1
  if not ans:
    break
if cnt > 2:
  ans = 0
if not ans:
  print("No")
else:
  print("Yes")


### FIXED CODE ###

s = list(input())
s.sort()
cnt = 1
ans = 1
# print(s)
for i in range(1, 4):
  # print(cnt)
  if s[i - 1] != s[i]:
    if cnt < 2:
      ans = 0
      break
    cnt = -1
  if not ans:
    break
  cnt += 1
if cnt > 3:
  ans = 0
if not ans:
  print("No")
else:
  print("Yes")
n = int(input())
s = input()
a = list(s)
print(a)
b = 1
while b != 0:
    b = 0
    #i = 1
    #print(i)
    for i in range(1,len(a)):
        if a[i-1] == a[i]:
            del a[i]
            print(a)
            b = b + 1
            #print(b)
            break
print(len(a))

### FIXED CODE ###

N = int(input())
S = input()
s = S[0]
ans = 1
for i in range(1,N):
    if S[i] != s:
        ans += 1
        s = S[i]
print(ans)
#ABC042B
N,L=map(int,input().split())

a=[]
for i in range(n)
    a.append(input())
    
a.sort()

print(''.join(a))

### FIXED CODE ###

a,b,c=(int(x) for x in input().split())
mylist=[a,b,c]
if mylist.count(5) == 2:
    if mylist.count(7) == 1:
        print('YES')
    else:
        print('NO')
else:
    print('NO')
def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]


def solve():
    n, t = LI()
    T = LI()
    sentou = [0] * (T[-1] + t + 1)
    
    i = 0
    while i < len(T):
        sentou[T[i]] += 1
        sentou[T[i] + t] -= 1
        i += 1

    j = 1
    while j < len(sentou):
        sentou[j] += sentou[j - 1]
        j += 1

    print(n * t - (sum(sentou) - (sentou.count(1) + len(sentou) - sentou.count(1) - sentou.count(0))))

solve()

### FIXED CODE ###

def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]


def solve():
    n, t = LI()
    T = LI()

    ans = 0
    for i in range(len(T) - 1):
        ans += min(t, T[i + 1] - T[i])

    print(ans + t)


solve()
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
total=0
for i in range(M):
  total+=A[i]
if A[M]>=total/(4*M):
  print("Yes")
else:
  print("No")
  

### FIXED CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
total=0
for i in range(N):
  total+=A[i]
if A[M-1]>=total/(4*M):
  print("Yes")
else:
  print("No")
#include <iostream>
#include<string>
using namespace std;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    if(n*a < b) {
        cout << n*a;
    } else {
        cout << b;
    }
}

### FIXED CODE ###

n, a, b = [int(i) for i in input("").split(" ")]
if (n*a) < b:
  print(n*a)
else:
  print(b)
def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  N, M = map(int, raw_input().split())
  if N ==0 and M ==0: break
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,
  print

### FIXED CODE ###

while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print
import itertools
from bisect import bisect_left,bisect
import sys

n,K=map(int,input().split())
A=list(map(int,input().split()))

A_max=max(A)
lst=[[] for i in range(A_max+1)]
flag=[0]*(A_max+1)
for i in range(n):
    lst[A[i]].append(i)

flag=[0]*n
data=[]
i=0
while flag[i]==0:
    flag[i]=1
    a=A[i]
    b=bisect(lst[a],i)
    if b==len(lst[a]):
        data.append(i)
        i=lst[a][0]+1
    else:
        i=lst[a][b]+1
    if i==n:
        data.append(n)
        i=0

#大丈夫
if not data:
    print()
    sys.exit()
s=len(data)
zzz=data[(K-1)%s]
i=zzz
d=[]
while i<n:
    a=A[i]
    b=bisect(lst[a],i)
    if b<len(lst[a]):
        d.append([i,lst[a][b]])
        i=lst[a][b]+1
        continue
    else:
        i+=1


if d:
    ans=A[zzz:d[0][0]]
    for j in range(len(d)-1):
        ans=list(itertools.chain(ans,A[d[i][1]+1:d[i+1][0]]))
    ans=list(itertools.chain(ans,A[d[-1][1]+1:]))
    print(*ans)
else:
    print(*A[zzz:])

### FIXED CODE ###

import itertools
from bisect import bisect_left,bisect
import sys

n,K=map(int,input().split())
A=list(map(int,input().split()))

A_max=max(A)
lst=[[] for i in range(A_max+1)]
flag=[0]*(A_max+1)
for i in range(n):
    lst[A[i]].append(i)

flag=[0]*n
data=[]
i=0
while flag[i]==0:
    flag[i]=1
    a=A[i]
    b=bisect(lst[a],i)
    if b==len(lst[a]):
        data.append(i)
        i=lst[a][0]+1
    else:
        i=lst[a][b]+1
    if i==n:
        data.append(n)
        i=0

#大丈夫
if not data:
    print()
    sys.exit()
s=len(data)
zzz=data[(K-1)%s]
i=zzz
d=[]
while i<n:
    a=A[i]
    b=bisect(lst[a],i)
    if b<len(lst[a]):
        d.append([i,lst[a][b]])
        i=lst[a][b]+1
        continue
    else:
        i+=1


if d:
    ans=A[zzz:d[0][0]]
    for j in range(len(d)-1):
        ans=list(itertools.chain(ans,A[d[j][1]+1:d[j+1][0]]))
    ans=list(itertools.chain(ans,A[d[-1][1]+1:]))
    print(*ans)
else:
    print(*A[zzz:])
a, b = map(int, input().split())
cnt = 0

while tp < b:
    tp += (a-1)
    cnt += 1

print(cnt)

### FIXED CODE ###

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

t = 1
cnt = 0

while  t<b:
    t += (a-1)
    cnt += 1
print(cnt)
MOD = 10**9 + 7
N, M = map(int,input().split())
a = set(int(input()) for _ in range(M))
dp = [0] * N
if 1 not in a:
    dp[0] = 1
    if 2 not in a:
        dp[1] = 2
else:
    if 2 not in a:
        dp[1] = 1

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


### FIXED CODE ###

MOD = 10**9 + 7
N, M = map(int,input().split())
a = set(int(input()) for _ in range(M))
dp = [0] * (N+1)
dp[0] = 1

for i in range(1, N+1):
    if i not in a and i > 1:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
    elif i not in a and i == 1:
        dp[i] = dp[i-1]
print(dp[-1])
n=int(input())
s=list(str(n))
sn=0
for i range(len(s)):
    sn+=int(s[i])
if sn%n==0:
    print('Yes')
else:
    print('No')
            

### FIXED CODE ###

n=int(input())
s=list(str(n))
sn=0
for i in range(len(s)):
    sn+=int(s[i])
if n%sn==0:
    print('Yes')
else:
    print('No')
import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = [[-1] * (W + 1) for i in range(N + 1)]

def dfs(i, j):
    if memo[i][j] >= 0:
        ans = memo[i][j]
    elif i == N:
        ans = 0
    elif A[i][0] > j:
        ans = dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
    memo[i][j] = ans
    return ans
        
print(dfs(0, W))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)

N, W = map(int, input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
memo = {i : {} for i in range(N)}

def dfs(i, j):
    if i == N:
        return 0
    elif j in memo[i]:
        return memo[i][j]
    elif A[i][0] > j:
        ans = dfs(i + 1, j)
    else:
        ans  = max(dfs(i + 1, j), A[i][1] + dfs(i + 1, j - A[i][0]))
    memo[i][j] = ans
    return ans
        
print(dfs(0, W))
n,m,c=map(int, input().split())
B=list(map(int, input().split()))
g=0
for i in range(n):
  A=list(map(int, input().split()))
  for i in range(m):
    t+=A[i]*B[i]
  if t+c>0:
    g+=1
  t=0
print(g)

### FIXED CODE ###

n,m,c=map(int, input().split())
B=list(map(int, input().split()))
g=0
t=0
for i in range(n):
  A=list(map(int, input().split()))
  for i in range(m):
    t+=A[i]*B[i]
  if t+c>0:
    g+=1
  t=0
print(g)
# -*- coding: utf-8 -*-
x = int(input())

if x >= 30:
  print('Yes')
else
  print('No')

### FIXED CODE ###

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

if x >= 30:
  print('Yes')
else:
  print('No')
n, m = map(int, input().split())
a = list(map(int, input().split()))

def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n/=2
    return ret
flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        continue
    else:
        flag = False
        print(0)
        exit()

a = [a[i]//t for i in range(n)]

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

gcd_a = a[0]
for i in range(1,n):
    p = max(gcd_a, a[i])
    q = min(gcd_a, a[i])
    gcd_a = gcd_a*a[i]//gcd(p, q)

if flag:
    print(m//(2*gcd_a) + (m%(2*gcd_a)//gcd_a))

else:
    print(0)


### FIXED CODE ###

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

for i in range(n):
    a[i] = a[i]//2
    
# print(a)
def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n//=2
    return ret


flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        # print(calc(a[i]),calc(a[i+1]))
        continue
    else:
        flag = False
        break


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



if flag:
    lcm = 1
    for i in range(n):
        p = max(lcm, a[i])
        q = min(lcm, a[i])
        lcm = lcm*a[i]//gcd(p, q)
        # print(lcm)
    if (m//lcm)%2 == 0:
        print(int((m//lcm)//2))
    else:
        print(int((m//lcm+1)//2))

else:
    print(0)
def solve():
  L, R = map(int, input().split())
  ans = 2019
  for i in range(L, R):
    for j in range(i + 1, R + 1):
      v = i * j % 2019
      if v < ans: ans = v
      if ans == 0: return
  return ans

print(solve())


### FIXED CODE ###

def solve():
  N, A, B = map(int, input().split())
  return min(N * A, B)

print(solve())
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(1000):
  flag=True
  k=str(j)  
  if len(k)<max_s:
    pass
  else:
    if len(k)!=N:
      pass
    else:    
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        ans=j
        break
      
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())

if M==0:
  for j in range(1000):
    k=str(j)
    if len(k)==N:
      ans=j
      break
else:
  max_s=max(s)
  ans=-1
  for j in range(1000):
    flag=True
    k=str(j)
    if len(k)!=N:
      pass
    else:
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        ans=j
        break
      
print(ans)
import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

tmp = sys.maxsize

for i in range(K):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    if maxNum < 0:
        ans = abs(minNum)
    elif (minNum < 0) and (0 <= maxNum):
        if abs(minNum) <= abs(maxNum):
            ans = 2*abs(minNum) + maxNum
        else:
            ans = 2*maxNum + abs(minNum)
    elif 0 <= minNum:
        ans = maxNum
    tmp = min(tmp,ans)

print(tmp)

### FIXED CODE ###

import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

ans = sys.maxsize

for i in range(N-K+1):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    l = abs(minNum) + abs(minNum - maxNum)
    r = abs(maxNum) + abs(maxNum - minNum)
    ans = min(ans, min(l, r))

print(ans)
num = [2,3,5]
M = 10**6; S = [0]*(M+2); S[1] = 1; s = 0;
i = 0;
while(i<M+1):
    if S[i]==1:
        for j in xrange(3):
            S[min(M+1,num[j]*i)] = 1;
        s += 1
    S[i] = s
    i+=1
while 1:
    try:
        m,n = map(int, raw_input().split())
        print S[n]-S[m-1]
    except EOFError:
        break

### FIXED CODE ###

while 1:
    ipt = raw_input()
    if ipt=="0": break
    m,n = map(int, ipt.split())
    ans = 0
    for i in xrange(m,n+1):
        p = i
        while p>1:
            if p%2==0:
                p/=2
            elif p%3==0:
                p/=3
            elif p%5==0:
                p/=5
            else: break
        if p==1: ans+=1
    print ans
a = list(map(int, input()))
if a[0] == a[1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = list(map(int, input().split()))
if a[0] == a[1]:
  print("Yes")
else:
  print("No")