Harryxun/stf_run huggingface dataset:
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())

for i in range(n):
  suma=sum(a)
  maxb=max(b)
  if suma<=mxb:
    index=b.index(maxb)
    del a[index]
    del b[index]
  else:
    print('No')
    exit()
print('Yes')


### FIXED CODE ###

n = int(input())
tasks = [list(map(int, input().split())) for i in range(n)]
tasks.sort(key=lambda x: x[1])

time = 0
for task in tasks:
    time += task[0]
    if time > task[1]:
        print("No")
        exit()
print("Yes")
def kakaka():
    a = list(map(int, input().split()))
    b = map(int, input().split())
    c = int(input())

def start_process():
    return
def main():
    all_num, inst_num = map(int, input().split())
    data = list(input())

    data_la = []
    ans_0, ans_1 = 0, 0
    for i in range(all_num):
        if data[i] == '1':
            ans_1 += 1
            if ans_0 > 0:
                data_la.append(ans_0)
                ans_0 = 0
        else:
            ans_0 += 1
            if ans_1 > 0:
                data_la.append(ans_1)
                ans_1 = 0
    if ans_1 > 0:
        data_la.append(ans_1)
    elif ans_0 > 0:
        data_la.append(ans_0)

    ans = 0
    ans_data = 0
    count_0 = 0
    if data[0] == '0':
        flg = 0
    else:
        flg= 1

    if len(data_la) <= 2:
        print(sum(data_la))
    else:
        pre_data1, pre_data2 = data_la[0], data_la[1]
        pre_data1_ind, pre_data2_ind = 0, 1
        # print(data_la)
        for i in range(len(data_la)):
            if i % 2 == flg:
                count_0 += 1
            if count_0 == inst_num + 1:
                ans = ans - pre_data1 - pre_data2
                pre_data1_ind += 2
                pre_data2_ind += 2
                pre_data1, pre_data2 = data_la[pre_data1_ind], data_la[pre_data2_ind]
                count_0 -= 1
            ans += data_la[i]
            # print(ans)
            if ans_data < ans:
                ans_data = ans






        print(ans_data)






if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    all_num, inst_num = map(int, input().split())
    data = list(input())

    data_la = []
    ans_0, ans_1 = 0, 0
    for i in range(all_num):
        if data[i] == '1':
            ans_1 += 1
            if ans_0 > 0:
                data_la.append(ans_0)
                ans_0 = 0
        else:
            ans_0 += 1
            if ans_1 > 0:
                data_la.append(ans_1)
                ans_1 = 0
    if ans_1 > 0:
        data_la.append(ans_1)
    elif ans_0 > 0:
        data_la.append(ans_0)

    ans = 0
    ans_data = 0
    count_0 = 0

    if data[0] == '0':
        data_la.insert(0, 0)

    # print(data_la)

    if len(data_la) <= 2:
        ans_data = sum(data_la)
    else:
        pre_data1_ind, pre_data2_ind = 0, 1
        pre_data1, pre_data2 = data_la[pre_data1_ind], data_la[pre_data2_ind]

        for i in range(len(data_la)):
            if i % 2 == 1:
                count_0 += 1

            if count_0 == inst_num + 1:
                ans = ans - pre_data1 - pre_data2
                pre_data1_ind += 2
                pre_data2_ind += 2
                if pre_data1_ind >= len(data_la):
                    pre_data1 = 0
                else:
                    pre_data1 = data_la[pre_data1_ind]
                if pre_data2_ind >= len(data_la):
                    pre_data2 = 0
                else:
                    pre_data2 = data_la[pre_data2_ind]
                count_0 -= 1

            ans += data_la[i]
            if ans_data < ans:
                ans_data = ans

    print(ans_data)


if __name__ == '__main__':
    main()
N,Q = map(int,input().split())
S = list(input())
LR = [tuple(map(int,input().split())) for _ in range(Q)]

C = [0 for _ in range(N+1)]
#C[i]:i文字目までで"AC"が出てくる回数
for i in range(N):
    if S[i] == "A" and S[i+1] == "C":
        C[i+2] += 1

for i in range(N):
    C[i+1] += C[i]

for l,r in LR:
    print(C[r]-C[l])


### FIXED CODE ###

N,Q = map(int,input().split())
S = list(input())
S = ["_"]+S
LR = [tuple(map(int,input().split())) for _ in range(Q)]

C = [0 for _ in range(N+1)]
#C[i]:i文字目までで"AC"が出てくる回数
for i in range(1,N):
    if S[i] == "A" and S[i+1] == "C":
        C[i+1] += 1

for i in range(N):
    C[i+1] += C[i]


for l,r in LR:
    print(C[r]-C[l])
import math

n = int(input())
a = list(map(int, input().split()))
a.append("#")
start = 0
end = 0

ans = 0

while a[start] != "#" :
  if a[start] != a[end]:
    x = end - start
    if x % 2 == 0:
      ans += x // 2
    else:
      ans += math.floor(x / 2)
  
    start = end

  else:
    end += 1


print(ans)

  else:
    end += 1


print(ans)

### FIXED CODE ###

import math

n = int(input())
a = list(map(int, input().split()))
a.append("#")
start = 0
end = 0

ans = 0

while a[start] != "#" :
  if a[start] != a[end]:
    x = end - start
    if x % 2 == 0:
      ans += x // 2
    else:
      ans += math.floor(x / 2)
  
    start = end

  else:
    end += 1


print(ans)
def solve():
  n = int(input())
  s = input()

  ans = 10**15
  a = s.count(".")
  b = s.count("#")
  sharp = []
  dot = []
  tp = 1
  if a == n:
    print("0")
  else:
    for i in range(n-1):

        if s[i] == s[i+1]:
           tp += 1
               
        if s[i] != s[i+1] or i+1 ==n-1:
            if s[i]==".":
                dot.append(tp)
                sharp.append(0)
            else:
                dot.append(0)
                sharp.append(tp)
            tp = 1
    e = len(sharp)
    ans = min(b-sharp[-1],a-dot[0])
    
    for i in range(e):
      do = dot[i]
      sh = sharp[i]
      a += do
      b += sh
      ans = min(ans,min(b-sharp[-1],a-dot[0]))
      
        
    print(ans)
solve()

### FIXED CODE ###

def solve():
  n = int(input())
  s = input()
  
  leftblack = 0
  leftwhite = 0
  rightblack = s.count('#')
  rightwhite = s.count(".")
  
  ans = leftblack+rightwhite
  
  for i in range(n):
    if s[i] == "#":
      leftblack += 1
      rightblack -= 1
    else:
      leftwhite += 1
      rightwhite -= 1
    ans = min(ans,leftblack+rightwhite)
  
  print(ans)
solve()
s = input()
s = list(s)

a = 0
if s[-2] == 'h' and s[-1] == 'i':
  a += 1
  
if len(s) == 2:
  if s[0] == 'h' and s[1] == 'i':
    a += 1
elif len(s) > 2:
  for i in range(len(s)-2):
    if s[i] == 'h':
      if s[i+1] == 'i' and s[i+2] != 'i':
        a += 1
        break
    
if a >= 1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
hi = [s[i:i+2] for i in range(0, len(s), 2)]

a = 0
for i in range(len(hi)):
  if hi[i] != 'hi':
    a += 1
    break
    
if a == 1:
  print('No')
else:
  print('Yes')
#B
count = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab=0
    for j in range(n):
        ab = a[j] * b[j]
    if -c<ab:
        count += 1
print(count)

### FIXED CODE ###

#B
count = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab=0
    for j in range(m):
        ab += a[j] * b[j]
    if -c<ab:
        count += 1
print(count)
def max_minus_min(areas):
    # print("areas", areas)
    return max(areas) - min(areas)
 
def solve2(h, w):
    area1 = h * (w // 2)
    area2 = h * w - area1
    return [area1, area2]
 
def solve(h, w):
    w_div_3 = w // 3;
    ans = 1e9
    for w2 in range(w_div_3, w_div_3 + 2):
        area1 = w2 * h
        ans = min(ans, max_minus_min([area1, *solve2(h, w - w2)]))
        ans = min(ans, max_minus_min([area1, *solve2(w - w2, h)]))
    return ans
 
H, W = map(int, input().split())
print(min(solve(H,W), solve(W,H)))


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# import array
# from bisect import *
# from collections import *
# import fractions
# import heapq 
# from itertools import *
# import math
# import re
# import string

def max_minus_min(areas):
    # print("areas", areas)
    return max(areas) - min(areas)

def solve2(h, w):
    area1 = h * (w // 2)
    area2 = h * w - area1
    return [area1, area2]

def solve(h, w):
    w_div_3 = w // 3;
    ans = 1e9
    for w2 in range(w_div_3, w_div_3 + 2):
        area1 = w2 * h
        ans = min(ans, max_minus_min([area1] + solve2(h, w - w2)))
        ans = min(ans, max_minus_min([area1] + solve2(w - w2, h)))
    return ans

H, W = map(int, raw_input().split())
print(min(solve(H,W), solve(W,H)))
def gcd(a,b):
  r = a%b
  while(r==0):
    a=b
    b=r
    r=a%b
  return b
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = gcd(max(ans,num),min(ans,num))
print(ans)

### FIXED CODE ###

def gcd(a,b):
  a = int(a)
  b = int(b)
  r = (int)(a%b)
  while(r!=0):
    a=(int)(b)
    b=(int)(r)
    r=(int)(a%b)
  return b
def lcm(a,b):
    return int((a*b)//gcd(a,b))
n = int(input())
ans = int(input())
for i in range(n-1):
  num = int(input())
  ans = lcm(max(ans,num),min(ans,num))
print(int(ans))
from sys import stdin
a = stdin.readline().rstrip()
w=int(a)
j=1
sumvalue=0
maxvalue=0
while j<=w:
    a = stdin.readline().rstrip()
    sumvalue+=int(a)
    maxvalue=max(maxvalue,int(a))
print(sumvalue-int(maxvalue/2))

### FIXED CODE ###

from sys import stdin
a = stdin.readline()
w=int(a)
j=1
sumvalue=0
maxvalue=0
w2=[]
while j<=w:
    z = stdin.readline().rstrip('\n')
    sumvalue+=int(z)
    maxvalue=max(maxvalue,int(z))
    j+=1
print(sumvalue-int(maxvalue/2))
N = input()
if(N%2=0):
    print('0.5000000000')
else:
    print((N/2)+1/N)

### FIXED CODE ###

N = int(input())
if N%2==0:
    print((N/2)/N)
else:
    print(((N//2)+1)/N)
input_list = map(int, input().split())
even_list = input_list
even_list_len = list_len
count = 0
 
while:
  even_list = filter(lambda num: num % 2 , input_list)
  even_list_len = len(even_list)
  if list_len != even_list_len:
    break
  even_list = map(lambda num: num / 2, even_list)
  count += 1
    
print(count)

### FIXED CODE ###

input_list_len = int(input())
input_list = map(int, input().split())
even_list = input_list
even_list_len = input_list_len
count = 0

while True:
    even_list = list(filter(lambda num: num % 2 == 0, even_list))
    even_list_len = len(even_list)
    if input_list_len != even_list_len:
        break
    even_list = map(lambda num: num / 2, even_list)
    count += 1

print(count)
N = int(input())

t = [[0] * 10 for _ in range(10)]
for i in range(1, N + 1):
    s = str(i)
    t[int(s[0])][int(s[-1])] += 1

result = 0
for i in range(1, 10):
    for j in range(1, 10):
        result += t[i][j] * t[j][i]
print(result)

### FIXED CODE ###

from itertools import accumulate
n, k = map(int, input().split())
s = [i for i in input()]
zero_one = [0]
if s[0] == "0":
    zero_one.append(0)
s_ = s[0]
cnt = 0
for i in range(n):
    if s_ == s[i]:
        cnt += 1
    else:
        zero_one.append(cnt)
        cnt = 1
        s_ = s[i]
zero_one.append(cnt)
if s[-1] == "0":
    zero_one.append(0)
ans = 0
l = len(zero_one)
zero_one = list(accumulate(zero_one))
for i in range(0, l, 2):
    ans = max(ans, zero_one[min(l-1, i+2*k+1)] - zero_one[i])
print(ans)
import math
from functools import reduce
def gcd_list(numbers):
  return reduce(math.gcd, numbers)
n=int(input())
l=list(map(int,input().split()))
print(gcd_list(l))

### FIXED CODE ###

def gcd(a, b):
  while b != 0:
    a, b = b, a % b
  return a
n=int(input())
l=list(map(int,input().split()))
ans=l[0]
l.remove(ans)
for i in l:
  ans=gcd(ans,i)
print(ans)
x = input()
print (x ** 3)

### FIXED CODE ###

x = int(input())
print (x ** 3)
N, K = map(int, input().split())
p = list(map(int, input().split()))
fac = [0] * 1010
fac[0] = 1
if (N >= 1):
    for i in range(1, 1010): fac[i] = i + 1 + fac[i - 1]
# 期待値
#print(p, fac[:max(p)])
exp = [0] * 1010
for i in range(N):
    exp[i] = fac[p[i] - 1] / p[i]
#print(exp)

Ans = 0
ans = [0] * N
ans[0] = sum(exp[:K])
for i in range(1, N - K + 1):
    if(i + K == N + 1): break
    ans[i] = ans[i - 1] - exp[i - 1] + exp[i + K - 1]
    #print(ans[i])
    #print(exp[i: i + K])
print(max(ans))


### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
fac = [0] * 735477
fac[0] = 1
if (N >= 1):
    for i in range(1, 1010): fac[i] = i + 1 + fac[i - 1]
# 期待値
#print(p, fac[:max(p)])
exp = [0] * 735477
for i in range(N):
    exp[i] = fac[p[i] - 1] / p[i]
# print(exp)

Ans = 0
ans = [0] * 735477
ans[0] = sum(exp[:K])
for i in range(1, N - K + 1):
    if(i + K == N + 1): break
    ans[i] = ans[i - 1] - exp[i - 1] + exp[i + K - 1]
    # print(ans[i])
    #print(exp[i: i + K])
print(max(ans))
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N= I()
xy = [IL() for i in range(N)]

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  data = []
  cnt = 0
  for i in itertools.combinations(xy,2):
    rex,rey = i[0]
    x,y = i[1]
    data.append(str(x-rex)+str(y-rey))
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])

print(N-cnt)

### FIXED CODE ###

import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
xy = [IL() for i in range(N)]

if N == 1 or N == 2:
  print(1)
else:
  data = []
  cnt = 0
  for i in itertools.combinations(xy,2):
    rex,rey = i[0]
    x,y = i[1]
    if rex > x:
      rex,rey,x,y = x,y,rex,rey
    if rex == x:
      if rey > y:
        rex,rey,x,y = x,y,rex,rey
    data.append(str(x-rex)+str(y-rey))
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])
  
  print(N-cnt)
n,m,x=map(int,input().split())
from itertools import combinations
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
l1=[]
for i in range(m):
    l1.append(i)
l2=[]
for i in range(1,m+1):
    lx=[0]*i
    a=0
    for lx in combinations(l1,i):
        ly=[0]*m
        for p in range(1,m+1):
            for k in lx:
                ly[p-1]+=l[k][p]
        for k in lx:
            a+=l[k][0]
        for j in ly:
            if j<x:
                a=0
                break
        if a!=0:
            l2.append(a)
print(min(l2))
                
                
                
        
    
            
        
    


### FIXED CODE ###

n,m,x=map(int,input().split())
from itertools import combinations
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
l1=[]
for i in range(n):
    l1.append(i)
l2=[]
for i in range(1,n+1):
    lx=[0]*i
    lyy=[0]*m
    for lx in combinations(l1,i):
        ly=lyy.copy()
        a=0
        for p in range(1,m+1):
            for k in lx:
                ly[p-1]+=l[k][p]
        for k in lx:
            a+=l[k][0]
        for j in ly:
            if j<x:
                a=0
                break
        if a!=0:
            l2.append(a)
if len(l2)!=0:
    print(min(l2))
else:
    print(-1)
import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n
X = int(x, 2)

if (z == x):
  u = n - 1
  d = n - 1
elif (o == x):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def solve(i, count):
  if (i <= 2 * 10**5 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


def solve2(i, div):
  if (i <= 2 * 10**5):
    return ans[i]
  else:
    return ans[i % div] + 1


ans = [0] * (2 * 10 ** 5 + 4)
_u = (2 * 10 ** 5) // u
U = X % u + (u * _u) + u
if(d != 0):
  _d = (2 * 10 ** 5) // d
  D = X % d + (d * _d) * 2 + d * 2
Us = [0] * (2 * 10 ** 5)
Ds = [0] * (2 * 10 ** 5)
for i in range(1, 2 * 10 ** 5 + 4):
  ans[i] = solve(i, 0)
  
Us[0] = 1 % u
if(d != 0):
  Ds[0] = 1 % d
for i in range(1, 2 * 10 ** 5):
  Us[i] = (Us[i - 1] * 2) % u
  if(d != 0):
    Ds[i] = (Ds[i-1] * 2) % d

for i in range(n):
  if(x[i] == '0'):
    print(solve2(U + Us[n-i-1], u))
  else:
    if (d == 0):
      print(0)
    else:
      print(solve2(D - Ds[n-i-1], d))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n
X = int(x, 2)

if (n == 1 and x == '1'):
  print(0)
  exit()

if (z == x):
  u = n - 1
  d = n - 1
elif (o == x):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def solve(i, count):
  if (i <= 2 * 10**5 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


def solve2(i, div):
  if (i <= 2 * 10**5):
    return ans[i]
  else:
    return ans[i % div] + 1


ans = [0] * (2 * 10 ** 5 + 4)
_u = (2 * 10 ** 5) // u
U = X % u + (u * _u) + u
if(d != 0):
  _d = (2 * 10 ** 5) // d
  D = X % d + (d * _d) * 2 + d * 2
Us = [0] * (2 * 10 ** 5)
Ds = [0] * (2 * 10 ** 5)
for i in range(1, 2 * 10 ** 5 + 4):
  ans[i] = solve(i, 0)
Us[0] = 1 % u
if(d != 0):
  Ds[0] = 1 % d
for i in range(1, 2 * 10 ** 5):
  Us[i] = (Us[i - 1] * 2) % u
  if(d != 0):
    Ds[i] = (Ds[i-1] * 2) % d

for i in range(n):
  if(x[i] == '0'):
    print(solve2(U + Us[n-i-1], u))
  else:
    if (d == 0):
      print(0)
    else:
      print(solve2(D - Ds[n-i-1], d))
num = int(input())
nums = list(map(int,input().split()))
ans = 1
for i in range(num):
    if nums[i] == 0:
        ans = 0
if ans != 0:
    for j in nums:
        ans *= nums[j]
        if len(str(ans)) > 18:
            ans = -1
            break
print(ans)


### FIXED CODE ###

n = int(input())
a = [int(_) for _ in input().split()]
a.sort()
ans = 1
for i in a:
    if i == 0:
        ans = 0
        break
    ans *= i
    if ans > 10**18:
        ans = -1
        break
 
print(ans)
print(int(__file__[-6:-5])/2)

### FIXED CODE ###

_=int(input());c=0
for i in 'i¥½ÃÉ':
  if (_ < ord(i)):
    print(c)
    break
  c+=1
import math

a=int(input())

sum=0

for i in range(n):
	ok=0
	n=int(input())
	if n==2 or n==3:
		sum+=1
	if n>3:
		for j in range(2,int(math.sqrt(n))+1):
			
			if n%j==0:
				ok=1
		if ok==1:
			sum+=1
			
print(sum)


### FIXED CODE ###


import math

n=int(input())

sum=0

for i in range(n):
	b=1
	n=int(input())
	for j in range(2,int(math.sqrt(n))+1):
		if n%j==0:
			b=0
			break
	sum+=b
			
print(sum)
a,b = map(int, input().split())
sum=0
for i in range(2):
	if a>b:
		sum+=a
		a--
	else:
		sum+=b
		b--
print(sum)


### FIXED CODE ###

a,b = map(int, input().split())
sum=0
for i in range(2):
	if a>b:
		sum+=a
		a-=1
	else:
		sum+=b
		b-=1
print(sum)
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) == 0.0:
                print "YES"
            else:
                print "NO"
        else:
            print "NO"
    except:
        break

### FIXED CODE ###

while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if abs((yB-yA)*(yD-yC) + (xB-xA)*(xD-xC)) < 1.e-10:
                print "YES"
        else:
            print "NO"
    except:
        break
import math
from collections import Counter

MOD = 10**9 + 7
N = int(input())

I = []
zz = 0
sz = 0
tz = 0
for _ in range(N):
    a,b = map(int, input().split())

    # (a, b) = (0, 0)
    if a == 0 and b == 0:
        zero += 1
        continue
    # (a, b) = (0, #)
    if a == 0:
        sz += 1
        continue
    # (a, b) = (#, 0)
    if b == 0:
        tz += 1
        continue

    gcd = math.gcd(a, b)
    if b < 0:
        a *= -1
        b *= -1
    I.append((a//gcd,b//gcd))

S = []
T = []
C = Counter(I)
for a, b in C.keys():
    if a > 0:
        S.append(C[(a,b)])
        T.append(C[(-b,a)])
    else:
        if C[(b,-a)] == 0:
            S.append(0)
            T.append(C[(a,b)])

ans = 1
ans *= 2**sz + 2**tz - 1
for i in range(len(S)):
    ans *= 2**S[i] + 2**T[i] - 1
ans += zz  # (0, 0)
ans -= 1
print(ans)

### FIXED CODE ###

import math
from collections import Counter

MOD = 10**9 + 7
N = int(input())

I = []
zz = 0
sz = 0
tz = 0
for _ in range(N):
    a,b = map(int, input().split())

    # (a, b) = (0, 0)
    if a == 0 and b == 0:
        zz += 1
        continue
    # (a, b) = (0, #)
    if a == 0:
        sz += 1
        continue
    # (a, b) = (#, 0)
    if b == 0:
        tz += 1
        continue

    gcd = math.gcd(a, b)
    if b < 0:
        a *= -1
        b *= -1
    I.append((a//gcd,b//gcd))

S = []
T = []
C = Counter(I)
for a, b in C.keys():
    if a > 0:
        S.append(C[(a,b)])
        T.append(C[(-b,a)])
    else:
        if C[(b,-a)] == 0:
            S.append(0)
            T.append(C[(a,b)])

ans = 1
ans *= 2**sz + 2**tz - 1
ans %= MOD
for i in range(len(S)):
    ans *= 2**S[i] + 2**T[i] - 1
    ans %= MOD
ans += zz  # (0, 0)
ans -= 1
print(ans % MOD)
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if w >= v:
    print('No')
else:
    kyori = abs(a-b)
    time = kyori - (v-w)
    if t >= kyori/time:
        print('YES')
    else:
        print('No')

### FIXED CODE ###

a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())
 
 
if (abs(a-b) <= (v- w)*t):
    print('YES')
else:
    print('NO')
S = list(input())
L = len(S)
K = int(input())
idx = 0
while K > 0:
    # aまでの必要な回数
    if S[idx] == "a" and idx < L-1:
        idx += 1
        continue
    k = 123 - ord(S[idx])
    if k > K:
        if idx < L-1:
            # aまで操作できないのに、操作すると辞書順でより後ろの文字列になってしまうので、次の文字へ
            idx += 1
        else:
            # 一番後ろの場合
            t = chr(ord(S[idx])+(K%26))
            S[idx] = t
            K = 0
    else:
        K -= k
        S[idx] = "a"
        idx += 1

print("".join(S))


### FIXED CODE ###

S = list(input())
L = len(S)
K = int(input())
idx = 0
while K > 0:
    # aまでの必要な回数
    if S[idx] == "a" and idx < L-1:
        idx += 1
        continue
        
    k = 123 - ord(S[idx])
    if k > K:
        if idx < L-1:
            # aまで操作できないのに、操作すると辞書順でより後ろの文字列になってしまうので、次の文字へ
            idx += 1
        else:
            # 一番後ろの場合
            t = chr(ord(S[idx])+(K%26))
            S[idx] = t
            K = 0
    else:
        K -= k
        S[idx] = "a"
        if idx < L-1:
            idx += 1

print("".join(S))
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'No'
word = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if d[i] = 0:
    continue
  for w in words():
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'Yes'
      break
print(judge)

### FIXED CODE ###

s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if dp[i] == 0:
    continue
  for w in words:
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d
        
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)