Harryxun/stf_run huggingface dataset:
import sys

A = sys.argv[1]
B = sys.argv[2]

if A <= 5:
  print(0)
elif A <= 12:
  print(int(B/2))
else:
  print(B)
  

### FIXED CODE ###

import sys
inp = list(map(int,input().split()))
A, B = inp[0], inp[1]
if A <= 5:
  print(0)
elif A <= 12:
  print(int(B/2))
else:
  print(B)
a, b = [int(i) in input().split(" ")]
c = a / b
print(int(a/b), a%b, "{0:.5f}".format(c))

### FIXED CODE ###

a, b = [int(i) for i in input().split(" ")]
num1 = a // b
num2 = a % b
num3 = "{:.8f}".format(a / b)

print(num1, num2, num3)
print(a)
print(b)

answer = a * b

print(answer)

### FIXED CODE ###

a, b = map(int, input().split())
 
answer = a * b
 
print(answer)
def d(n):
  while n%2 == 0:
    n /= 2
    ans += 1
  return ans

n = int(input())
a = map(int,input().split())
t = min(list(map(d,a)))

print(t)
    


### FIXED CODE ###

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

K = 0
while all(a%2 == 0 for a in A):
  A = [a/2 for a in A]
  K += 1
  
print(K)
def binaryinsertion(A,x):
    left=0;right=len(A)-1;centre = len(A)//2
    while(True):
        if(right - left < 2):
            if(x[0]<A[left][0]):A.insert(left,x)
            else :
                if(x[0]<A[right][0]):A.insert(right,x)
                else:A.insert(right+1,x)
            break
        else:
            if(x[0] < A[centre][0]) :
                right = centre
            elif(A[centre][0] < x[0]) :
                left = centre
            else : 
                A.insert(centre,x)
                break
            centre = left + (right-left+1)//2

[N,L] = [int(x) for x in input().split()]
A = [[int(x),int(i)] for i,x in enumerate(input().split())]
sweep = A[:L]
sweep = sorted(sweep)
ans = [str(sweep[0][0])]
for i in range(L,N) :
    sweep.remove(A[i-L])
    binaryinsertion(sweep,A[i])
    ans.append(str(sweep[0][0]))
print(" ".join(ans))

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
import math
A, B, X = map(int, input().split())
h = X / (A*A)
r = 0
deg = 0
if (2 * X) - (B * A * A) > 0:
  r = math.atan(2 * (B-H) / A)
elif (2 * X) - (B * A * A) == 0:
  r = math.atan(B / A)
else:
  h = (2 * X) / (A * B)
  r = math.atan(B / h)
deg = math.degrees(r)
print(deg)

### FIXED CODE ###

import math
A, B, X = map(int, input().split())
h = X / (A*A)
r = 0
deg = 0
if (2 * X) - (B * A * A) > 0:
  r = math.atan(2 * (B-h) / A)
elif (2 * X) - (B * A * A) == 0:
  r = math.atan(B / A)
else:
  h = (2 * X) / (A * B)
  r = math.atan(B / h)
deg = math.degrees(r)
print(deg)
n = int(input())
h = list(map(int,input().split(' ')))

dp = {}
myinf = int(1e9)

def frog1(i):
    if i>=n:
        return 0
    if i in dp:
        return dp[i]
    
    a = frog1(i+1)
    b = frog1(i+2)
    h1 = 0 if i+1>n-1 else h[i+1]
    h2 = 0 if i+2>n-1 else h[i+2]
    a = a + abs(h[i]-h1)
    b = b + abs(h[i]-h2)
    dp[i] = min(a,b)
    return dp[i]
print(frog1(0)-h[len(h)-1])


### FIXED CODE ###

import math
n = int(input())
h = list(map(int,input().split(' ')))
'''
n-=1
inf = int(1e9+5)

dp = {}
def frog1(i):
    if i==n:
        return 0
    if i in dp:
        return dp[i]
    
    a = 0
    b = 0
    if i+1>n:
        a = inf
    else:
        a = frog1(i+1)+abs(h[i]-h[i+1])

    if i+2>n:
        b = inf
    else:
        b = frog1(i+2)+abs(h[i]-h[i+2])
    dp[i] = min(a,b)
    return dp[i]
'''
def solve(n,h):
    dp = [0]*n
    for i in reversed(range(0,n-1)):
        if i==n-1:
            dp[i] = 0
        else:
            if i==n-2:
                dp[i] = abs(h[n-1]-h[n-2])
                continue
            a = 0
            b = 0
            if i+1<=n-1:
                a = dp[i+1]+abs(h[i]-h[i+1])
            if i+2<=n-1:
                b = dp[i+2]+abs(h[i]-h[i+2])  
            dp[i] = min(a,b)
    return dp[0]
print(solve(n,h))
N = input() 
heights = input()

N = int(N)
heights = map(int, heights.split(' '))

def solve_problem(N, heights):
    memory = {}

    def minimum_cost(N, heights):
        mem_key = str(N) + str(heights)
        if mem_key in memory: return memory[mem_key]
        if N == 1:
            return 0
        elif N == 2:
            return abs(heights[0] - heights[1])

        jump_one_cost = abs(heights[0] - heights[1]) + minimum_cost(N-1, heights[1:])
        jump_two_cost = abs(heights[0] - heights[2]) + minimum_cost(N-2, heights[2:])

        best_cost = min(jump_one_cost, jump_two_cost)
        memory[mem_key] = best_cost
        return best_cost
    
    return minimum_cost(N, heights)

print(solve_problem(test3_N, test3_heights))


### FIXED CODE ###

N = input() 
heights = input()

N = int(N)
heights = list(map(int, heights.split(' ')))

def solve_problem_dp(N, heights):
    if N == 1:
        return 0
    elif N == 2:
        return abs(heights[0] - heights[1])
    costs = [0] * len(heights)
    costs[1] = abs(heights[0] - heights[1])

    for i in range(2, len(heights)):
        cost_jump1 = abs(heights[i] - heights[i-1]) + costs[i-1]
        cost_jump2 = abs(heights[i] - heights[i-2]) + costs[i-2] 
        best_cost = min(cost_jump1, cost_jump2)
        costs[i] = best_cost
    
    return costs[-1]


print(solve_problem_dp(N, heights))
if __name__ == '__main__':
    from collections import Counter
    from scipy.mist import comb

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = [V[0:A]]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max <= a:
            max_list.append(V[0:i])
            max = a
    print("{:.6f}".format(max))
    
    ans = 0
    for x in max_list:
        ans_sub = 1
        try:
            x = Counter(x).most_common()
        except TypeError:
            ans += ans_sub
            continue
        for i in range(len(x)):
            ans_sub *= comb(V.count(x[i][0]),x[i][1])
        ans += ans_sub
    print(int(ans))


### FIXED CODE ###

def comb(n, k):
    return factorial(n) // (factorial(k) * factorial(n-k))
  
if __name__ == '__main__':
    from collections import Counter
    from math import factorial

    N,A,B = [int(i) for i in input().split()]
    V = [int(i) for i in input().split()]

    V.sort(reverse = True)
    max_list = [V[0:A]]
    max = sum(V[0:A]) / A

    for i in range(A+1,B+1):
        a = sum(V[0:i]) / i
        if max <= a:
            max_list.append(V[0:i])
            max = a
    print("{:.6f}".format(max))

    ans = 0
    for x in max_list:
        ans_sub = 1
        try:
            x = Counter(x).most_common()
        except TypeError:
            ans += ans_sub
            continue
        for i in range(len(x)):
            ans_sub *= comb(V.count(x[i][0]),x[i][1])
        ans += ans_sub
    print(int(ans))
import decimal
a,b = input().split()
a = decimal(a)
b = decimal(b)
print(int(a*b))

### FIXED CODE ###

from decimal import Decimal
a,b = map(Decimal,input().split())

print(int(a*b))
s=input()
print(s[0]+str(len(s-2))+s[len(s-1)])

### FIXED CODE ###

s=input()
print(s[0]+str(len(s)-2)+s[len(s)-1])
# -*- coding: utf-8 -*-

s = input()
h = s/3600
s = s%3600
m = s/60
s = s%60
print h +":"+ m +":"+ s

### FIXED CODE ###

# -*- coding: utf-8 -*-

s = input()
h = s/3600
s = s%3600
m = s/60
s = s%60
print str(h) +":"+ str(m) +":"+ str(s)
import itertools
import operator
MOD = 10**9 + 7

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
A_r = list(reversed(A))
factorial = [1] + list(itertools.accumulate(range(1, N + 1), operator.mul))  # factorial[n] = n!

ans = 0
for i, j in zip(A, A_r):
    if N < K:
        break
    C = (factorial[N - 1] / factorial[K - 1]) / factorial[N - K]
    ans += (j - i) * C
    ans %= MOD
    N -= 1
ans = int(ans % MOD)
print(ans)


### FIXED CODE ###

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort()
MOD = 10 ** 9 + 7


def combination(mod=MOD):
    fact = [1] * (N + 1)
    inv_fact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % mod
    inv_fact[N] = r = pow(fact[N], mod - 2, mod)
    for i in range(N, 0, -1):
        inv_fact[i - 1] = r = r * i % mod

    def _wrapper(n, k):
        nonlocal fact, inv_fact, mod
        if n == 0 or k == 0:
            return 1
        return fact[n] * inv_fact[k] * inv_fact[n - k] % mod

    return _wrapper


def main():
    if K == 1:
        print(0)
        exit()
    comb = combination()
    sum_max = 0
    sum_min = 0
    for i, A_i in enumerate(A):
        if i >= K - 1:
            sum_max += comb(i, K - 1) * A_i % MOD
        if N - i >= K:
            sum_min += comb(N - i - 1, K - 1) * A_i % MOD
    ans = (sum_max - sum_min) % MOD
    print(ans)


if __name__ == '__main__':
    main()
import math

n,k = list(map(int,input().split()))

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

middle = math.ceil(max(a) / 2)
oldMiddle = 0
h = middle // 2
rightMin = max(a)

while h > 0:
    cut = 0
    for i in range(n):
        cut += math.ceil(a[i] / middle) - 1
    h = math.ceil(abs(middle - oldMiddle) / 2)
    if middle == oldMiddle:
        break
    oldMiddle = middle
    if cut <= k:
        if (middle - h == rightMin):
            break
        middle -= h
    else:
        rightMin = middle
        middle += h

print(middle)

### FIXED CODE ###

import math

n,k = list(map(int,input().split()))

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

middle = math.ceil(max(a) / 2)
oldMiddle = 0
h = middle // 2
rightMin = max(a)

while h > 0:
    cut = 0
    if middle == 0:
        middle = 1
        break
    for i in range(n):
        cut += math.ceil(a[i] / middle) - 1
    h = math.ceil(abs(middle - oldMiddle) / 2)
    oldMiddle = middle
    if cut <= k:
        if (middle - h == rightMin):
            break
        middle -= h
    else:
        rightMin = middle
        middle += h

print(middle)
N = int(input())
S = input()

result = S.count('.')
r = result
def dfs(i):
    global result
    global r
    if i == N:
        return float('inf')
    if S[i] == '#':
        r += 1
    else:
        r -= 1
    result = min(result,r)
    return min(result,dfs(i+1))

print(dfs(0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N = int(input())
S = input()

result = S.count('.')
r = result
def dfs(i):
    global result
    global r
    if i == N:
        return float('inf')
    if S[i] == '#':
        r += 1
    else:
        r -= 1
    result = min(result,r)
    return min(result,dfs(i+1))

print(dfs(0))
n=int(input())
s=input()
lst=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','X','Y','Z']
S=list(s)
for i in range(len(s)):
  idx=lst.index(S[i])
  S[i]=lst[(idx+n)%len(lst)]
t=''.join(S)
print(t)
  


### FIXED CODE ###

n=int(input())
s=input()
lst=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
S=list(s)
for i in range(len(S)):
  idx=lst.index(S[i])
  S[i]=lst[(idx+n)%(len(lst))]
t=''.join(S)
print(t)
import sys
import math
N = input()
AList = list(map(int, input().split()))
listnum = 1000000000

low = -1000000000
high = 1000000000

mode = 1
a1 = 0
a2 = 0
while(True):
    p1 = math.floor((abs(low) + abs(high))/3) + low
    p2 = high - math.floor((abs(low) + abs(high))/3) 

    for j in range(1,int(N)+1):
        a1 += abs(AList[j-1] -(p1 + j))
    for j in range(1,int(N)+1):
        a2 += abs(AList[j-1] -(p2 + j))

    if a1 == a2 or abs(a1-a2) == 1:
        print(min(a1,a2))
        sys.exit()
    elif a1 < a2:
        high = p2
    else:
        low = p1        
    a1 = 0
    a2 = 0

### FIXED CODE ###

A = int(input())

if A % 2 == 0:
    print(A)
else:
    print(A*2)
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
tmp = 1000000000
for i in range(M):
    c = int(input())
    sum1 = a[i]+b[i]-c
    ans = min(tmp,sum1)
print(ans)

### FIXED CODE ###

A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
ans = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    tmp = a[x-1]+b[y-1]-c
    ans = min(tmp,ans)
print(ans)
A,B=map(int,input().split())

K=(B-A)/2

if (B-A) % 2 == 0;
	print(K)
else;
	print("IMPOSSIBLE")

### FIXED CODE ###

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

K=abs(A+B)/2

if abs(A+B) % 2 == 0:
  print(int(K))
else:
  print("IMPOSSIBLE")
N, L = map(int, input().split())

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

ans_index = -1
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        ans_index = i
        break

if ans_index == -1:
    print('Impossible')
    exit()
print('Possible')

ans_index += 1
for i in range(1, ans_index):
    print(i)
for i in range(N-1, n, -1):
    print(i)

print(ans_index)


### FIXED CODE ###

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

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

ans_index = -1
for i in range(N-1):
    if A[i] + A[i+1] >= L:
        ans_index = i
        break

if ans_index == -1:
    print('Impossible')
    exit()
print('Possible')

ans_index += 1
for i in range(1, ans_index):
    print(i)
for i in range(N-1, ans_index, -1):
    print(i)

print(ans_index)
a = input()
b = input()
mean = (a + b) / 2
print(math.ceil(mean))

### FIXED CODE ###

import math
 
a, b = map(float, input().split())

mean = (a + b) / 2
print(math.ceil(mean))
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k=map(int, input().split())
for i in range(1,k+1):
  print(comb(n-k+1,i)*comb(k-1,i-1)%(10**9+7))

### FIXED CODE ###

import math
def comb(n, r):
  if n-r>=0:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  else:
    return 0

n,k=map(int, input().split())
for i in range(1,k+1):
  print(comb(n-k+1,i)*comb(k-1,i-1)%(10**9+7))
def isPrime(x):
	for i in range(2,min(x,236)):
		if x%i == 0:
			return False
	return True
n,a,p = int(input()),[],2
while n > 0:
	if isPrime(p):
		a.append(str(p))
		n -= 1
	p += 5
print(" ".join(a))


### FIXED CODE ###

a,b = map(int,input().split())
print(a-1 if a > b else a)
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j])
print(ans)    
print(max(ans2)-1)

### FIXED CODE ###

s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n-1):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
if s[n-1] in at:
    ans.append(n)
else:
    ans.append(n-1)

m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)

#print(ans)
#print(ans2)

if len(ans)==1:
    print(n)
elif len(ans2)==0:
    print(0)
else:
    print(max(ans2))
class SegTreeMin:
    """
    以下のクエリを処理する
    1.update:  i番目の値をxに更新する
    2.get_min: 区間[l, r)の最小値を得る
    """

    def __init__(self, n, INF):
        """
        :param n: 要素数
        :param INF: 初期値（入りうる要素より十分に大きな数）
        """
        n2 = 1 << (n - 1).bit_length()
        self.offset = n2
        self.tree = [INF] * (n2 << 1)
        self.INF = INF

    def update(self, i, x):
        """
        i番目の値をxに更新
        :param i: index(0-indexed)
        :param x: update value
        """
        i += self.offset
        self.tree[i] = x
        while i > 1:
            y = self.tree[i ^ 1]
            if y <= x:
                break
            i >>= 1
            self.tree[i] = x

    def get_min(self, a, b):
        """
        [a, b)の最小値を得る
        :param a: index(0-indexed)
        :param b: index(0-indexed)
        """
        result = self.INF

        l = a + self.offset
        r = b + self.offset
        while l < r:
            if r & 1:
                result = min(result, self.tree[r - 1])
            if l & 1:
                result = min(result, self.tree[l])
                l += 1
            l >>= 1
            r >>= 1

        return result


def solve(n, m, s):
    INF = 10 ** 18
    sgt = SegTreeMin(n + 1, (INF,))
    sgt.update(0, (0, 0))
    for i in range(1, n + 1):
        if s[i] == '1':
            continue
        r = i
        l = max(0, i - m)
        prev = sgt.get_min(l, r)
        if prev[0] == INF:
            return (-1,)
        dice = i - prev[-1]
        curr = (prev[0] + 1, *prev[1:-1], dice, i)
        sgt.update(i, curr)
    return sgt.get_min(n, n + 1)[1:-1]


n, m = map(int, input().split())
s = input()
print(*solve(n, m, s))


### FIXED CODE ###

from heapq import heappop, heappush


def solve(n, m, s):
    curr = n
    l = max(0, n - m)
    r = n
    ans = []
    while r > 0:
        for i, c in enumerate(s[l:r], start=l):
            if c == '0':
                dice = curr - i
                ans.append(dice)
                curr = i
                l = max(0, i - m)
                r = i
                break
        else:
            return (-1,)

    return reversed(ans)


n, m = map(int, input().split())
s = input()
print(*solve(n, m, s))
import math
N = int(input())
A = sorted(list(map(int, input().split())))
if N == 2:
    print(max(A))
    exit()
result = []
num = 0
for a in A[1:]:
    if a % A[0] != 0:
        num += 1
        if num == 2:
            break
else:
    result.append(A[0])
for n in range(2, int(math.sqrt(A[0])) + 1):
    if A[0] % n != 0:
        continue
    num = 0
    for a in A[1:]:
        if a % n != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(n)
    num = 0
    x = A[0] // n
    for a in A[1:]:
        if a % x != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(x)
num = 0
for a in A[0:1] + A[2:]:
    if a % A[1] != 0:
        num += 1
        if num == 2:
            break
else:
    result.append(A[1])
for n in range(2, int(math.sqrt(A[1])) + 1):
    if A[1] % n != 0:
        continue
    num = 0
    for a in A[0:1] + A[2:]:
        if a % n != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(n)
    num = 0
    x = A[1] // n
    for a in A[0:1] + A[2:]:
        if a % x != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(x)
print(max(result))


### FIXED CODE ###

import math
N = int(input())
A = sorted(list(map(int, input().split())))
if N == 2:
    print(max(A))
    exit()
result = []
num = 0
for a in A[1:]:
    if a % A[0] != 0:
        num += 1
        if num == 2:
            break
else:
    result.append(A[0])
for n in range(2, int(math.sqrt(A[0])) + 1):
    if A[0] % n != 0:
        continue
    num = 0
    x = A[0] // n
    for a in A[1:]:
        if a % x != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(x)
    num = 0
    for a in A[1:]:
        if a % n != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(n)
num = 0
B = A[0:1] + A[2:]
for a in B:
    if a % A[1] != 0:
        num += 1
        if num == 2:
            break
else:
    result.append(A[1])
for n in range(2, int(math.sqrt(A[1])) + 1):
    if A[1] % n != 0:
        continue
    num = 0
    x = A[1] // n
    for a in B:
        if a % x != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(x)
    num = 0
    for a in B:
        if a % n != 0:
            num += 1
            if num == 2:
                break
    else:
        result.append(n)
if len(result) != 0:
    print(max(result))
else:
    print(1)
import math
A, B = map(int, input().split())
print(int(A*B/math.gcd(A,B)))



### FIXED CODE ###

from fractions import gcd
A, B = map(int, input().split())
print(int(A*B//gcd(A,B)))
a = input().split()
if(a[0] * a[1] % 2 == 0):
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a = input().split()
if(int(a[0]) * int(a[1]) % 2 == 0):
  print('Even')
else:
  print('Odd')
A = int(input())
total = 0L
for x in range(A+1):
  if x%5!=0 and x%3!=0:
    total += x
print(x)

### FIXED CODE ###

A = int(input())
total = 0
for x in range(A+1):
  if x%5!=0 and x%3!=0:
    total += x
print(total)
N = input(input())
k = 1
while k*k<=N: k+=1
print((k-1)*(k-1))

### FIXED CODE ###

N = int(input())
k = 1
while k*k<=N: k+=1
print((k-1)*(k-1))
import sys

n = int(input())
As = list(map(int, input().split()))

ans = 1
for i in range(n):
  ans = ans*As[i]
  	if ans > 10**18:
      print(-1)
      sys.exit()

print(ans)

### FIXED CODE ###

import sys

n = int(input())
As = list(map(int, input().split()))

Flag = True
ans = 1

if (0 in As):
  print(0)
  sys.exit()


for i in range(n):
  ans = ans * As[i]
  if (ans > 10**18):
    if (Flag):
      print(-1)
      Flag = False
      sys.exit()
  
if (Flag):
  print(ans)
n,m = map(int,input().split())
x = [0]*n
y = [0]*n
mx = [0]*m
my = [0]*m
for i in range(n):
    x[i],y[i] = map(int,input().split())
for j in range(m):
    mx[j],my[j] = map(int,input().split())
#print(x)
#print(y)
#print(mx)
#print(my)
ans = [0]*n
#print(ans)
for k in range(n):
    dis = 1000000000
    cnt = 1
    for l in range(n):
        if abs(x[k]-mx[l])+abs(y[k]-my[l]) < dis:
            dis = abs(x[k]-mx[l])+abs(y[k]-my[l])
            cnt = l+1
    ans[k] = cnt
for h in ans:
    print(h)

### FIXED CODE ###

n,m = map(int,input().split())
student = []
Coodinate = []
for i in range(n):
    student.append(list(map(int,input().split())))
for j in range(m):
    Coodinate.append(list(map(int,input().split())))
ans = []
#print(student)
#print(Coodinate)
for k in student:
    manhattan = 100000000000
    number = 0
    for u in range(m):
        manhattann = abs(k[0]-Coodinate[u][0])+abs(k[1]-Coodinate[u][1])
        if manhattann < manhattan:
            manhattan = manhattann
            number = u+1
    ans.append(number)
for y in ans:
    print(y)
from math import *
lcm = lambda x, y: x * y // gcd(x, y)
def solve():
    a, b, c, d = map(int, input().split())
    C = len(range(ceil(a / c) * c, b + 1, c))
    D = len(range(ceil(a / d) * d, b + 1, d))
    cd = lcm(c, d)
    CD = len(range(ceil(a / cd) * cd, b + 1, cd))
    print(b - a + 1 - (C + D - CD))
solve()


### FIXED CODE ###

from fractions import gcd
from math import ceil
lcm = lambda x, y: x * y // gcd(x, y)
def solve():
    a, b, c, d = map(int, input().split())
    if c == 1 or d == 1:
        return 0
    def f(x):
        return len(range(ceil(a / x) * x, b + 1, x))
    C = f(c)
    if c == d:
        return b - a + 1 - C
    D = f(d)
    cd = lcm(c, d)
    CD = f(cd)
    return b - a + 1 - (C + D - CD)
print(solve())