Harryxun/stf_run huggingface dataset:
n = int(input())

R = [list(map(int, input().split())) for i in range(N)]
B = [list(map(int, input().split())) for i in range(N)]
R.sort(key = lambda x:x[1], reverse = True)
B.sort()
ans = 0
check = []


for bx, by in B:
    for i in range(N):
        if bx > R[i][0] and by > R[i][1] and i not in check :
            ans += 1
            check.append(i)
            break
            #print('B', bx, by, 'R',R[i][0], R[i][1] )
print(ans)

### FIXED CODE ###

N = int(input())

R = [list(map(int, input().split())) for i in range(N)]
B = [list(map(int, input().split())) for i in range(N)]
R.sort(key = lambda x:x[1], reverse = True)
B.sort()
ans = 0
check = []


for bx, by in B:
    for i in range(N):
        if bx > R[i][0] and by > R[i][1] and i not in check :
            ans += 1
            check.append(i)
            break
            #print('B', bx, by, 'R',R[i][0], R[i][1] )
print(ans)
c_1 = input()
c_2 = input()
c_3 = input()
print(c_11[0] + c_22[1] + c_33[2])

### FIXED CODE ###

c_1 = input()
c_2 = input()
c_3 = input()
print(c_1[0] + c_2[1] + c_3[2])
import collections

n,m,k = map(int,raw_input().split(' '))

friendships = [map(int, raw_input().split(' ')) for _ in range(m)]
disses = [map(int, raw_input().split(' ')) for _ in range(k)]

parent = {i:i for i in range(1, n+1)}
sizes = {i:1 for i in range(1, n+1)}

hd = collections.Counter()

adj = collections.defaultdict(set)

def f(parent, a):
	if parent[a] != a: parent[a] = f(parent, parent[a])
	return parent[a]

for a,b in friendships:
	pa,pb = f(parent, a), f(parent, b)
	
	adj[a].add(b)
	adj[b].add(a)

	if pa != pb:
		parent[pb] = pa
		sizes[pa] += sizes[pb]

for c,d in disses:
	pa,pb = f(parent, c), f(parent, d)
	if pa == pb:
		hd[c] += 1
		hd[d] += 1

print ' '.join([str(sizes[f(parent,u)] - len(adj[u]) - hd[u] - 1)  for u in range(1, n+1)])

### FIXED CODE ###

import collections

n,m,k = map(int,raw_input().split(' '))

friendships = [map(int, raw_input().split(' ')) for _ in range(m)]
disses = [map(int, raw_input().split(' ')) for _ in range(k)]

parent = {i:i for i in range(0, n+1)}
sizes = {i:1 for i in range(0, n+1)}

hd = collections.Counter()

adj = collections.defaultdict(set)

def f(parent, u):
	if parent[u] != u: 
		parent[u] = f(parent, parent[u])
	return parent[u]

for a,b in friendships:
	if a == b: continue

	pa,pb = f(parent, a), f(parent, b)
	
	adj[a].add(b)
	adj[b].add(a)

	if pa != pb:
		if sizes[pa] >= sizes[pb]:
			parent[pb] = pa
			sizes[pa] += sizes[pb]
		else:
			parent[pa] = pb
			sizes[pb] += sizes[pa]

for c,d in disses:
	pc,pd = f(parent, c), f(parent, d)
	if (pc == pd):
		hd[c] += 1
		hd[d] += 1
"""
hd[u] = k
u has k disses in its connected component
"""

print ' '.join([str(sizes[f(parent,u)] - len(adj[u]) - hd[u] - 1)  for u in range(1, n+1)])
from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[]
for i in range(n):
  if h[i] >= h[h+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))

### FIXED CODE ###

from itertools import groupby
n=int(input())
h = list(map(int,input().split()))
p=[]
ans=[0]
for i in range(n-1):
  if h[i] >= h[i+1]:
    p.append(1)
  else:
    p.append(0)
for key, value in groupby(p):
  ans.append(sum(value))
print(max(ans))
input = []
array = []
input = [int(input()) for i in range(6)]
array = input[:5]
k = input[5] 
size = len(array)
for i in range(size):
  	if (i < 4):
      if (array[size - i] - array[0] > k):
        print(':(')
        break
    if (i < 3):
      if (array[size - i] - array[1] > k):
      	print(':(')
        break
    if (i < 2):
      if (array[size - i] - array[2] > k):
      	print(':(')
        break
	if (i < 1):
      if (array[size - i] - array[3] > k):
        print(':(')
        break
    if (i == 4):
      print('Yay')

### FIXED CODE ###

array1 = [int(input()) for i in range(6)]
array2 = array1[:5]
k = array1[5] 
 
for i in range(5):
  if (i < 4 and array2[4 - i] - array2[0] > k):
    print(':(')
    break
  if (i < 3 and array2[4 - i] - array2[1] > k):
    print(':(')
    break
  if (i < 2 and array2[4 - i] - array2[2] > k):
    print(':(')
    break
  if (i < 1 and array2[4 - i] - array2[3] > k):
    print(':(')
    break
  if (i == 4):
    print('Yay!')
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
# mem = list(mem)
mem2 = []
for x, y, c in z:
    mem2.append(a[x - 1] + b[y - 1] - c])
np.append(mem, mem2)


print(min(mem))
# print(mem)


### FIXED CODE ###

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
L = [[int(x) for x in input().split()] for _ in range(M)]

reg = min(a) + min(b)
for x, y, c in L:
    tmp = a[x-1] + b[y-1] - c
    reg = min(reg, tmp)
print(reg)
N, M = map(int, input().split())
A=[]
count=[1]*100000
ans=[]
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a, i])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    ans.append([A[i][2],str(number).zfill(12)])
    count[int(A[i][1])] +=1
ans.sort()

for i in range(M):
    print(ans[i][1])



### FIXED CODE ###

N, M = map(int, input().split())
A=[]
count=[1]*1000000
ans=[]
for i in range(M):
    a, b, = map(int, input().split())
    A.append([b, a, i])

A.sort()

for i in range(M):
    number=A[i][1]*1000000+count[int(A[i][1])]
    ans.append([A[i][2],str(number).zfill(12)])
    count[int(A[i][1])] +=1
ans.sort()

for i in range(M):
    print(ans[i][1])
N,L=map(int,input().split())
S=[input() for _ in range(N)]
arr=[]
for i in range(N):
	for j in range(N):
		for k in range(N):
			if i!=j and j!=k and i!=k:
				arr.append(S[i]+S[j]+S[k])
print(sorted(arr)[0])

### FIXED CODE ###

N,L=map(int,input().split())
print("".join(sorted([input() for _ in range(N)])))
a, b = map(int, input().split())

sa = b - a
east = (1 + sa) * sa / 2
snow = int(east - b)
print(snow)

### FIXED CODE ###

N = int(input())

if N <= 999:
	print('ABC')

if N > 999:
	print('ABD')
n = input()
kakeru = input().split()
kakekake = kakeru[0]
    if n > 1:
        for i in range(2,n+1):
            kakekake = kakekake * kakeru[i]
if kakekake > 10**18:
    print(-1)
print(kakekake)

### FIXED CODE ###

n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= a[i]
        if b > 10**18:
            print(-1)
            break
    if b <=10**18:
        print(b)
n = list(map(int, input().split()))
a = input().split()
b = 0
c = 0
while True:
    b = min(a) / 2
    if b <= 1:
        break
    c = c + 1
print(c)

### FIXED CODE ###

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

def count(A, n):
    for i in range(n):
        if (A[i] % 2 == 1) or (A[i] == 0):
            return False
        A[i] = A[i] // 2
    return True

while True:
    if count(A, n):
        s += 1
    else:
        break
    
print(s)
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
for j in range(len(a)-1):
    if(count => 2):
        print(l[0] * l[1])
    if(a[j] == a[j+1]):
        del l[0]
        l.append(a[j])
        j += 1
        count += 1

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
i = 0
while(i < len(a)-1):
    if(a[i] == a[i+1]):
        del l[0]
        l.append(a[i])
        i += 1
        c += 1
    if(c >= 2 or i == len(a)-2):
        i = len(a)-1
        print(l[0] * l[1])
    i += 1
import sys
input = sys.stding.readline

t = int(input())
po = []

for _ in range(t):
  x,y = list(map(int,input().split()))
  po.append((x,y))
  
po.sort()

dp = [-(10**99) for _ in range(t)]

for i in range(t):
  value = min(x+y, x-y)
  dp[i] = min(dp[i-1], value)
  
best = -9999999999999999999999999999

for i in range(1,t):
  dist = po[i][0] + po[i][1] - dp[i-1]
  best = max(best, dist)
  
print(best)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
t = int(input())
po = []
 
for _ in range(t):
  x,y = list(map(int,input().split()))
  po.append((x,y))
  
po.sort()
 
dp1 = [+(10**99) for _ in range(t)]
 
for i in range(t):
  x,y = po[i][0], po[i][1]
  value = x+y
  dp1[i] = min(dp1[i-1], value)
  
dp2 = [+(10**99) for _ in range(t)]
 
for i in range(t):
  x,y = po[i][0], po[i][1]
  value = x-y
  dp2[i] = min(dp2[i-1], value)
  
best = -9999999999999999999999999999
#print(dp)
 
for i in range(1,t):
  dist = po[i][0] + po[i][1] - dp1[i-1]
  best = max(best, dist)
  
  dist = po[i][0] - po[i][1] - dp2[i-1]
  best = max(best, dist)
  
print(best)
import numpy as np
import itertools

def get_nearest_val(l, n, side='left'):
    l = sorted(l)
    i = np.searchsorted(l, n, side=side)
    return l[i]

def comb(n, r):
    if n < 0 or r < 0 or n < r: return 0
    elif n == 0 or r == 0: return 1
    return comb(n-1, r-1) + comb(n-1, r)

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

max_n = max(A)

key_r = int((max_n + 1) / 2)

left_r = get_nearest_val(A, key_r, side='left')
right_r = get_nearest_val(A, key_r, side='right')

left_comb = comb(max_n, left_r)
right_comb = comb(max_n, right_r)

if left_comb >= right_comb:
    print(str(max_n) + ' ' + str(left_r))
else:
    print(str(max_n) + ' ' + str(right_r))

### FIXED CODE ###


import numpy as np
import math

def get_nearest_val(l, n):
    i = np.abs(np.asarray(l) - n).argmin()
    return l[i]

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

max_n = max(A)
A = sorted(A)
max_n = A[-1]
# A = A.pop
A.pop(-1)
key_r = (max_n + 1) / 2
# key_r = int((max_n + 1) / 2)
# print(key_r)

# left_r = get_nearest_val(A, key_r, side='left')
# # print(left_r)
# right_r = get_nearest_val(A, key_r, side='right')
# # print(right_r)

# left_comb = comb(max_n, left_r)
# # print(left_comb)
# right_comb = comb(max_n, right_r)
# # print(right_comb)

# if left_comb >= right_comb:
#     print(str(max_n) + ' ' + str(left_r))
# else:
#     print(str(max_n) + ' ' + str(right_r))

r = get_nearest_val(A, key_r)
# r = get_nearest_val(A[:len(A)-1], key_r)
print(str(max_n) + ' ' + str(r))
a,b,x = map(int, input().split())

left = 0
right = 10**9 + 1

while (right - left > 1):
  mid = (left + right ) // 2
  if (a*mid+b*len(str(mid))) > x:
    right = mid
  else:
    left = mid
print(left)


### FIXED CODE ###

s = input()
youbi = ['SUN','MON','TUE','WED','THU','FRI','SAT']
index = youbi.index(s)

day = 7 - index
if day == 0:
  print('7')
else:
  print(day)
n = int(raw_input())
t = map(int, raw_input().split())
s = sum(t)
m = int(raw_input())
for _ in range(m):
    p, x = map(int, raw_input().split())
    print s - t[p - 1] + x

### FIXED CODE ###

n = int(raw_input())
t = map(int, raw_input().split())
s = sum(t)
m = int(raw_input())
for _ in range(m):
    p, x = map(int, raw_input().split())
    print s - t[p - 1] + x
H,N = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]

DP = [0 for i in range(H+1)] #DP[h]=体力hのやつを倒す最小mp

min_mp = 10**9
for i in range(N):
    if min_mp > AB[i][1]:
        min_mp = AB[i][1]
        min_mp_i = i

for h in range(1,AB[min_mp_i][0]+1):
    DP[h] = min_mp

for h in range(AB[min_mp_i][0]+1,H+1):
    DP[h] = min((DP[h - a] + b) for a,b in AB )
    #最小消費mpの技で初期化しないとh - a >= 0を満たすaの存在が怪しい

print(DP[H])


### FIXED CODE ###

H,N = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(N)]

DP = [0 for i in range(H+1)] #DP[h]=体力hのやつを倒す最小mp

min_mp = 10**9
for i in range(N):
    if min_mp > AB[i][1]:
        min_mp = AB[i][1]
        min_mp_i = i

for h in range(1,min(AB[min_mp_i][0],H)+1):
    #最小消費mpの技でオーバーキルの場合にDP[h]がout of rangeになる
    DP[h] = min_mp

for h in range(AB[min_mp_i][0]+1,H+1):
    DP[h] = min((DP[h - a] + b) for a,b in AB )
    #最小消費mpの技で初期化しないとh - a >= 0を満たすaの存在が怪しい

print(DP[H])
N = int(input()) #1行目を取得する
a = list(map(int,input().split()))
 
num = 0
exist_odd = True
while exist_odd:
  num += 1
  for i in range(N):
    if a[i] % 2 == 0:
      a[i] = a[i] / 2
    else:
      exist_odd = False
else:
  print(num - 1)

### FIXED CODE ###

s = input()
a = [int(c) for c in s]
b = 0
for i in a:
  if i == 1:
    b += 1
 
print(b)
S = input()
Y = input()
if Y = S[:+1]:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")
a, b, c = map(int, input()split())

s = sorted.[a, b, c]

print(s)

### FIXED CODE ###

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

print(a + b + 10*c)
n = int(input())
p = 1
for i in range(n):
  p = p*2^i
ap = p/(1000000007)
print(ap)

### FIXED CODE ###

n = int(input())
import math
p = math.factorial(n)
ap = p%1000000007
print(ap)
S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        n = i +1
        break

if K < n:
    print(1)
else:
    print(int(S[n-1])

### FIXED CODE ###

S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        n = i +1
        break

if K < n:
    print(1)
else:
    print(int(S[n-1]))
str = input().split()
#print(str)
n = int(str[0])
k = int(str[1])
a = list(map(int, input().split()))
sum = 0
a.sort()
for i in range(k):a.pop()
#print(a)
for i in range(n-k):
    sum += a[i]
print(sum)


### FIXED CODE ###

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

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

sum = 0
a.sort()
#print(a)
for i in range(min(n,k)): a.pop()
#print(a)
for i in range(len(a)):
    sum += a[i]
print(sum)
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = deepcopy(p[:x]) + deepcopy(q[:y])
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(c):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = p[:x] + q[:y]
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(min(c, x + y)):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)
A,B = (int,map(input().split()))
print(A*B," ",2*(A+B))



### FIXED CODE ###

A,B = map(int,input().split())
print(A*B,2*(A+B))
N,M,V,P = map(int,input().split())
A = [int(i) for i in input().split()]

#A = [[int(i),x]for x,i in enumerate(input().split())]

maxA = max(A)
amount = A.count(maxA)
numorder = sorted(list(set(A)),reverse = True)
target = P - amount

con = 0

for i in range(N):
  x = A[i]
  x = x + M
  Y = [k for k in A if k < x]
  y = len(Y)

  if y > V - 1:
    if x >= numorder[target]:
      con += 1
  else:
    Z = [j for j in A if j >= x]
    z = len(Z)

    if V - y < z and target + 1 > z:
      con += 1

print(con)

### FIXED CODE ###

N,M,V,P = map(int,input().split())
A = sorted([int(i) for i in input().split()],reverse = True)

pps = 0
con = P

for i in range(P,N):
  #P以降でi番目に大きい数を加算
  pps += A[i - 1]

  #xの上限が順位に入らない
  if A[i] + M < A[P - 1]:
    break
  #点数をいくら振り分けてもいいスコアの数
  fv = min(P - 1 + N - i, V)
  #左辺第二項は、P以降とi以前の、点数の振り分け可能数に上限がある数
  #左辺は振り分けた後にA[i]がP入りを果たせる区間の総和の上限を示す
  #右辺第一項は、振り分け可能数に上限がある数の総和
  #右辺第二項は、振り分けないといけない数の残り
  #右辺は、点数を振り分けた後の値の区間の総和を示すため、
  #右辺が左辺を上回った場合、ループは終了となる
  if (A[i] + M) * (i - P + 1) < pps + M * (V - fv):
    break
  con += 1
  
print(con)
import math
def cal(n ,r):
    if n == r:
        return 1
    return math.factorial(n)/(math.factorial(r) * math.factorial(n-r))

def bin_search(in_list, val):
    cnt = len(in_list)
    mid = cnt/2 + cnt%2
    if cnt == 1:
        return in_list[0]
    if in_list[mid] > val:
        return bin_search(in_list[:mid], val)
    if in_list[mid] < val:
        return bin_search(in_list[mid:], val)
    if in_list[mid] == val:
        return val

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

m_combo = 0
ai = 0
aj = 0

for i in range(1,n):
    a = A[i]
    val = bin_search(A[:i], round(a/2))
    combo = cal(a, val)
    if combo > m_combo:
        m_combo = combo
        ai = a
        aj = val

print('{} {}'.format(ai, aj))


### FIXED CODE ###

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

ai = max(A)
A.remove(ai)

Asub = [abs(ai/2 -a) for a in A]
aj = A[Asub.index(min(Asub))]

print('{} {}'.format(ai, aj))
import numpy as np
a = int(input())
num = np.array(list(map(int,input().split())))
for i in range(1,a+1):
    print(len(num[num==i])

### FIXED CODE ###

import collections
a = int(input())
num = list(map(int,input().split()))
c = collections.Counter(num)
list(map(lambda x: print(c[x]), range(1,a+1)))
def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)

    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


N = int(input())
X = input()

X_int = int(X, 2)

for i in range(N):
    mask = ['0']*N
    mask[i] = '1'
    mask = int(''.join(mask), 2)
    Xi = X_int ^ mask
    
    n = Xi
    ans = 0
    while n > 0:
        ans += 1
        n %= popcount(n)
    print(ans)

### FIXED CODE ###

def popcount(n):
    return bin(n).count('1')


def main():
    N = int(input())
    X = input()

    X_int = int(X, 2)

    pcount_X = popcount(X_int)

    pcount_X_pls1 = pcount_X + 1
    pcount_X_mns1 = pcount_X - 1
    
    X_mod_pcount_X_pls1 = X_int % pcount_X_pls1
    if pcount_X_mns1 != 0:
        X_mod_pcount_X_mns1 = X_int % pcount_X_mns1

    for i,bit in enumerate(X):
        bit = int(bit)
        if bit == 0:
            n = (X_mod_pcount_X_pls1 + pow(2, N-i-1, pcount_X_pls1)) % pcount_X_pls1
        else:
            if pcount_X_mns1 == 0:
                print(0)
                continue
            n = (X_mod_pcount_X_mns1 - pow(2, N-i-1, pcount_X_mns1)) % pcount_X_mns1

        ans = 1
        while n > 0:
            ans += 1
            n %= popcount(n)
        print(ans)
        
main()
n = int(input())

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x-l, x+l]
r.sort()


while (1):
   ok = len(r)

   for i in range(0, len(r)):
      if (i==0):
         if (r[i][1] > r[i+1][0]):
            ok -= 1
            break
      elif (i==len(r)-1):
         if (r[i][0] > r[i-1][1]):
            ok -= 1
            break
      elif (r[i][0] > r[i-1][1] or r[i][1] > r[i+1][0]):
         ok -= 1
         break

   if (ok == len(r) or ok == 1):
      print(ok)
      exit()
   else:
      r.pop(i)


### FIXED CODE ###

n = int(input())

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x+l, x-l]
r.sort()

cur = -1000000000
ans = 0
for i in range(n):
   if (cur <= r[i][1]):
      ans += 1
      cur = r[i][0]

print(ans)
import fractions
a, b, c, d = map(int, input().split())
 
def wareruzu(x):
    if b < x:
        return 0
    if b == x:
        return 1
    start_a = a if a % x == 0 else a - (a % x) + x
    end_b = b - (b % x)
    m = end_b - start_a
    return int(m / x) + 1
 
all_n = b - a + 1
print(all_n - wareruzu(c) - wareruzu(d) + wareruzu((c*d) / fractions.gcd(c,d)))

### FIXED CODE ###

from operator import itemgetter
N = int(input())

lst =[]
for i in range(N):
    lst.append(list(map(int, input().split())))

lst.sort(key=itemgetter(1))

now = 0
flg = True
for item in lst:
    now += item[0]
    if now > item[1]:
        flg = False
        break

print('Yes' if flg else 'No')
from sys import exit
import math
from fractions import gcd

def lcm(x,y):
    return x*y/gcd(x,y)

N,M=map(int,input().split())
S=input()
T=input()
if S[0] != T[0]:
    print("-1")
    exit()
if N<M:
    N,M=M,N
    S,T=T,S
    

# N>M S>T
if(N%M==0):
    S2=""
    for i in range(N):
        if i%(N//M)==0 :
            S2+=S[i]
            
    if S2==T:
        print(N)
    else:
        print(-1)
    exit()

else:
    print(lcm(n,m))

### FIXED CODE ###

from sys import exit
import math
from fractions import gcd

def lcm(x,y):
    return x*y//gcd(x,y)

N,M=map(int,input().split())
S=input()
T=input()
if S[0] != T[0]:
    print("-1")
    exit()
if N==M:
    if S==T:
        print(N)

    else:
        print(-1)
    exit()
    
if N<M:
    N,M=M,N
    S,T=T,S
    

# N>M S>T
if(N%M==0):
    S2=""
    for i in range(N):
        if i%(N//M)==0 :
            S2+=S[i]
            
    if S2==T:
        print(N)
    else:
        print(-1)
    exit()

else:
    g=gcd(N,M)
    S2=""
    for i in range(N):
        if i%(N//g)==0 :
            S2+=S[i]
    T2=""
    for i in range(M):
        if i%(M//g)==0 :
            T2+=T[i]
    if S2==T2:
        print(lcm(N,M))
    else:
        print(-1)
n=input()
if n[0]=='7' or n[1]=='7' or n[2]=='7':
  print(Yes)
else:
   print('No')

### FIXED CODE ###

n=input()
if n[0]=='7' or n[1]=='7' or n[2]=='7':
  print('Yes')
else:
   print('No')
n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])

### FIXED CODE ###


n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
    exit()
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])
s= int(input())
w = int(input())
if w >= s:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

S,W = map(int, input().split())
print("unsafe" if W >= S else "safe")
n = int(input())
s = input()

start = s.find("#")

white_start = s[start:].find(".")
white_end = s[start:].rfind(".")

black = s[start:].count("#")
white = s[start:].count(".")

if start == -1 or end==-1:
    print(0)
else:
    for i in range(white_start+1, white_end+1):
        if s[i] == "#":
            print(min(black, white))
            break
        elif i==white_end:
            print(1)

### FIXED CODE ###

n = int(input())
s = input()
black = s[:0].count("#")
white = s[0:].count(".")
count = [black+white]    
    
for i in range(1, n+1):
    if s[i-1]== "#":
        black +=1
    else:
        white -=1
    count.append(white+black)
    
print(min(count))
import sys

a,b,c =sys.stdin.realine.split()
if b == "+":
    d = a+c
    print(d)
if b=="-":
    d = a-c
    print(d)
if b=="*":
    d = a*c
    print(d)
if b=="/":
    d=a//c
    print(d)

### FIXED CODE ###

import math
while True:
    a, op, b = map(str, input().split())
    a, b = int(a), int(b)
    if op=='+':
        print(math.floor(a+b))
    elif op=='-':
        print(math.floor(a-b))
    elif op=='*':
        print(math.floor(a*b))
    elif op=='/':
        print(math.floor(a/b))
    else:
        break