Harryxun/stf_run huggingface dataset:
import collections


def main():
    X = int(input())
    A, B = 0, 0
    for i in range(-120, 120):
        if A == 0 and B == 0:
            for j in range(-120, 120):
                if i ** 5 - j ** 5 = X:
                    A, B = i, j
                    break
        else:
            break

    print("{} {}".format(A, B))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import collections


def main():
    X = int(input())
    A, B = 0, 0
    for i in range(-120, 120):
        if A == 0 and B == 0:
            for j in range(-120, 120):
                if i ** 5 - j ** 5 == X:
                    A, B = i, j
                    break
        else:
            break

    print("{} {}".format(A, B))


if __name__ == "__main__":
    main()
def main():
    while 1:
        n = input()
        if n == 0:
            break

        sum_a = 0
        sum_b = 0
        
        for i in range(n):
            a,b = map(int, raw_input().split())

            if a > b:
                sum_a = sum_a + a + b
            elif a < b:
                sum_b = sum_b + a + b
            elif a == b:
                sum_a = sum_a + a
                sum_b = sum_b + b

        print("%s %s" %(sum_a,sum_b))
                
if __name__ == "__main__":
    main()



### FIXED CODE ###

while 1:
    n = int(input())
    if n == 0:
        break
    
    sum_a = 0
    sum_b = 0
    
    for i in range(n):
        a,b = map(int, input().split())
        
        if a > b:
            sum_a = sum_a + a + b
        elif a < b:
            sum_b = sum_b + a + b
        elif a == b:
            sum_a = sum_a + a
            sum_b = sum_b + b

    print(sum_a,sum_b)
n = int(input())
s = input()
if (s[:int(2/n)] == s[int(2/n):n] :
    print("Yes")
else
    print("No")

### FIXED CODE ###

n = int(input())
s = input()
if s[:int(n/2)] == s[int(n/2):n] :
    print("Yes")
else:
    print("No")
import sys
sys.setrecursionlimit(10**6)

n = int(input())
x = input()
xi = int('0b' + x, 2)
xc = x.count("1")

xip = xi % (xc+1)
xim = xi % (xc-1)

def f(u):
  if u==0: return 0
  m = u % bin(u).count("1")
  return 1 + f(m)

for i in range(n):
  if x[i] == "0":
    # y = xip + (pow(2, n-i-1, )%(xc+1))
    y = xip + pow(2, n-i-1, xc+1)
    y = y % (xc+1)
  elif xc == 1:
    print(0)
    continue
  else:
    # y = xim - (pow(2, n-i-1)%(xc-1))
    y = xim - pow(2, n-i-1, xc-1)
    y = y % (xc-1)

  print(f(y)+1)


### FIXED CODE ###

N = int(input())
X = input()
val = int(X,2)
C = X.count("1")

if C==1:
  for i in range(N):
    if X[i]=='1':
      print(0)
    elif i==N-1:
      print(2)
    else:
      print(1)
  exit()

# xをpopcountで割ったあまりに置き換える
def f(x):
  if x==0: return 0
  return 1 + f(x % bin(x).count("1"))

# 初回のpopcountでの割り方は、(C+1) or (C-1)
Y = val%(C+1)
if C-1 != 0:
  Z = val%(C-1)
else:
  Z = 0

for i in range(N):
  if X[i] == "1":
    if Z - 1 == 0:
      print(0)
      continue
    k = (Z - pow(2,N-i-1,C-1)) % (C-1)
  else:
    k = (Y + pow(2,N-i-1,C+1)) % (C+1)
  print(f(k)+1)
# ????????????????????°??????
import sys

def is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
    d1x = x2 - x1
    d1y = y2 - y1
    d2x = x4 - x3
    d2y = y4 - y3

    if d1x != 0 and d2x != 0:
        a1 = d1y / d1x
        a2 = d2y / d2y
        return a1 == a2

    if d1x == 0 and d2x == 0:
        return True

    return False

def main():
    n = int(sys.stdin.readline().strip())

    for _ in range(n):
        data = sys.stdin.readline().strip().split(' ')
        x1 = float(data[0])
        y1 = float(data[1])
        x2 = float(data[2])
        y2 = float(data[3])
        x3 = float(data[4])
        y3 = float(data[5])
        x4 = float(data[6])
        y4 = float(data[7])

        if is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
            print('YES')
        else:
            print('NO')
            
if __name__ == '__main__':
    main()

### FIXED CODE ###

# ????????????????????°??????
import sys
from decimal import Decimal

def is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
    d1x = x2 - x1
    d1y = y2 - y1
    d2x = x4 - x3
    d2y = y4 - y3

    return d1x * d2y == d1y * d2x

def main():
    n = int(sys.stdin.readline().strip())

    for _ in range(n):
        data = sys.stdin.readline().strip().split(' ')
        x1 = Decimal(data[0])
        y1 = Decimal(data[1])
        x2 = Decimal(data[2])
        y2 = Decimal(data[3])
        x3 = Decimal(data[4])
        y3 = Decimal(data[5])
        x4 = Decimal(data[6])
        y4 = Decimal(data[7])

        if is_parallel(x1, y1, x2, y2, x3, y3, x4, y4):
            print('YES')
        else:
            print('NO')
            
if __name__ == '__main__':
    main()
s=inp()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)

### FIXED CODE ###

s=input()
#s = ("4 2 9")
#print(s) 
s = s.split(" ")


densya = int(s[0])*int(s[1])
taxi   = int( s[2] )

if ( densya < taxi):
    print(densya)
else:
    print(taxi)
def factorial(n):
    res = 1
    for i in range(1, n+1):
        res *= i
    return res

n = int(input())
s = []
for i in range(n):
    s.append(list(str(input())))

for i in s:
    i.sort()

s.sort()
s.append('a')

tmp = 'a'
total = 0
cnt = 1
for i in s:
    if i == tmp:
        cnt += 1
    elif cnt >= 2:
        total += factorial(cnt)*factorial(cnt-2)/2
        cnt = 1
    tmp = i

print(int(total))

### FIXED CODE ###

n = int(input())
ss = ["".join(sorted(list(input()))) for _ in range(n)]
ss.sort()

ans = 0
cnt = 0
tmp = ss.pop(0)
for s in ss:
    if tmp == s:
        cnt+=1
    elif cnt > 0:
        tmp = s
        ans+=((cnt+1) * cnt // 2)
        cnt = 0
    else:
        tmp = s
        cnt = 0
print(ans + ((cnt+1) * cnt // 2))
# coding: utf-8
 
As = list(input().rstrip().split(" "))
N = int(As[0])
A = int(As[1])
B = int(As[2])
 S  = input()
cnt = 1
 
for i in range(N):
    if S[i] == "c":
        print("No")
 
    elif S[i] == "a":
        if cnt < A+B:
            print("Yes")
            cnt +=1
        else:
            print("No")
 
    elif S[i] == "b":
        if cnt < B:
            print("Yes")
            cnt +=1
        else:
            print("No") 

### FIXED CODE ###

N, A, B = map(int, input().split())
S = input()
count = 0
count2 = 0


for i in range(N):
    if S[i] == "c":
        print("No")
    elif S[i] == "a":
        
        if count < A+B:
            print("Yes")
            count += 1
        else:
            print("No")
    elif S[i] == "b":
        
        if count < A+B and count2 < B:
            print("Yes")
            count += 1
            count2 += 1
        else:
            print("No")
if __name__ == '__main__':
    import math
    t = int(raw_input())
    print(t * math.pi)

### FIXED CODE ###

import math
t = int(input())
print(t * math.pi * 2)
# ABC133E - Virus Tree 2
from collections import deque


def dfs() -> int:
    cand, ret, MOD = K - 1, K, 10 ** 9 + 7
    queue, seen = deque([1]), [0] * (N + 1)
    seen[1] = 1
    while queue:
        v = queue.popleft()
        for u in G[v]:
            if not seen[u]:
                seen[u] = 1
                ret = (ret * cand) % MOD
                cand -= 1
                queue.append(u)
        cand = K - 2
    return ret


def main():
    N, K, *AB = map(int, open(0).read().split())
    G = [[] for _ in range(N + 1)]
    for v, u in zip(*[iter(AB)] * 2):
        G[v].append(u), G[u].append(v)
    ans = dfs()
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC133E - Virus Tree 2
from collections import deque


def main():
    N, K, *AB = map(int, open(0).read().split())
    MOD = 10 ** 9 + 7
    G = [[] for _ in range(N + 1)]
    for v, u in zip(*[iter(AB)] * 2):
        G[v].append(u), G[u].append(v)
    queue = deque([1])
    seen = [0] * (N + 1)
    seen[1] = 1
    ans, cand = K, K - 1
    while queue:
        v = queue.popleft()
        for u in G[v]:
            if not seen[u]:
                seen[u] = 1
                ans = (ans * cand) % MOD
                cand -= 1
                queue.append(u)
        cand = K - 2
    print(ans)


if __name__ == "__main__":
    main()
n,d = map(int,input().split())
x = d*2 + 1
print((n+d*2)//(x)

### FIXED CODE ###

n,d = map(int,input().split())
x = d*2 + 1
print((n+d*2)//x)
a, b, n = map(int, input().split())
val = max(0, (a*n)//b - a*(n//b), (a*m)//b - a*(m//b), (n//b)*b-1)
print(val)

### FIXED CODE ###

a, b, n = map(int, input().split())
val = (a*n)//b - a*(n//b)
m = max(0,(n//b)*b-1)
val = max(val, (a*m)//b - a*(m//b))
print(val)
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y)


### FIXED CODE ###

import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))
L = [int(input()) for i in range(5)]
a =[]
ans = sum(L)
for i in range(5):
    if L[i]%10>0:
        a.append(10-L[i]%10)
#print(a)
print(sum(L)+sum(a)-max(a))

### FIXED CODE ###

L = [int(input()) for i in range(5)]
a =[0]*5
ans = sum(L)
for i in range(5):
    if L[i]%10>0:
        a.append(10-L[i]%10)
#print(a)
print(sum(L)+sum(a)-max(a))
import sys
n = int(input())
pt, px, py = 0, 0, 0
for _ in range(n):
    t, x, y = map(int,input().split())
    dt = abs(t-pt)
    dx = abs(x-px)
    dy = abs(y-py)
    if dt<dx+dy or dt%2!=(dx+dy)%2:
        print('No')
        sys.exit()    
    pt,px,py = t,x,y
print('Yes'

### FIXED CODE ###

import sys
n = int(input())
pt, px, py = 0, 0, 0
for _ in range(n):
    t, x, y = map(int,input().split())
    dt = abs(t-pt)
    dx = abs(x-px)
    dy = abs(y-py)
    if dt<dx+dy or dt%2!=(dx+dy)%2:
        print('No')
        sys.exit()    
    pt,px,py = t,x,y
print('Yes')
num, num_of_coordinates = map(int, input().split(" "))
coordinates = list(map(int, input().split(" ")))
total = 0
abs_distance = []
coordinates.sort()
for i in range(0, len(coordinates)-1):
  dist = abs(coordinates[i] - coordinates[i+1])
  total += dist
  abs_distance.append(dist)  

#でかいやつ順に並べる
abs_distance.sort()
abs_distance.reverse()
for i in range(num-1):
  total -= abs_distance[i]

print(total)

### FIXED CODE ###

num, num_of_coordinates = map(int, input().split(" "))
if num >= num_of_coordinates:
  print ("0")
else:
  coordinates = list(map(int, input().split(" ")))
  total = 0
  abs_distance = []
  coordinates.sort()
  for i in range(0, len(coordinates)-1):
    dist = abs(coordinates[i] - coordinates[i+1])
    total += dist
    abs_distance.append(dist)  

  #でかいやつ順に並べる
  abs_distance.sort()
  abs_distance.reverse()
  for i in range(num-1):
    total -= abs_distance[i]

  print(total)
a = input().split()

N = int(a[1])
A = int(a[2])
B = int(a[3])

if A * N  >= B * N:
  print B * N
else:
  print A * N


### FIXED CODE ###

a = input().split()
 
N = int(a[0])
A = int(a[1])
B = int(a[2])
 
if A * N  >= B:
  print (B)
else:
  print (A * N)
N=int(input())
XY=[[[]] for n in range(N)]
for n in range(1,N+1):
  a=int(input())
  XY[n]=[list(map(int, input().split())) for _ in range(a)]

maxH=0
for mask_i in range(1<<N):
  
  H=[0]*(N+1)
  for n in range(N):
    if mask_i>>n&1:
      H[n+1]=1
  #print(H[1:])
  
  for n in range(1,N+1):
    ok=True
    if H[n]==1:
      for x,y in XY[n]:
        if H[x]!=y:
          ok=False
          break
  if ok:
    maxH=max(maxH,sum(H))

print(maxH)


### FIXED CODE ###

N=int(input())
XY=[[[]] for n in range(N+1)]
for n in range(1,N+1):
  a=int(input())
  XY[n]=[list(map(int, input().split())) for _ in range(a)]

maxH=0
for mask_i in range(1<<N):
  
  H=[0]*(N+1)
  for n in range(N):
    if mask_i>>n&1:
      H[n+1]=1
  #print(H[1:])
  
  ok=True
  for n in range(1,N+1):
    if H[n]==1:
      for x,y in XY[n]:
        if H[x]!=y:
          ok=False
          break
  if ok:
    maxH=max(maxH,sum(H))

print(maxH)
x = [int(i) for i in input().split()]
n = x[0]
x.pop(0)

print(x)

M = max(x)
m = min(x)
s = sum(x)

print(m,M,s)

### FIXED CODE ###

input()
x = [int(i) for i in input().split()]

M = max(x)
m = min(x)
s = sum(x)

print("{0} {1} {2}".format(m,M,s))
N, Q = map(int, input().split())
S = input().rstrip('\n')
count = [0]*(N+1)

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'C':
        count[i+1] = 1

#累積和
for i in range(1, N+1):
    count[i] += count[i-1]

for _ in range(Q):
    l, r = map(int, input().split())
    print(count[r-1] - count[l-1])




### FIXED CODE ###


N, Q = map(int, input().split())
S = input().rstrip('\n')
count = [0]*(N+2)

for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        count[i+1] = 1

#累積和
for i in range(1, N+1):
    count[i] += count[i-1]

for _ in range(Q):
    l, r = map(int, input().split())
    print(count[r-1] - count[l-1])
a, b = int(raw_input().split())

if a > b:
    print 'a > b'
elif a < b:
    print 'a < b'
else:
    print 'a == b'

### FIXED CODE ###

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

if a == b:
  print 'a == b'
elif a < b:
  print 'a < b'
else:
  print 'a > b'
n = int(input())
ans = (n * (n + 1) // 2) - n
#ans = int(a)
print(ans)

### FIXED CODE ###

s = input()
t = input()

count = 0
for i in range(len(s)):
    if s[i] == t[i]:
        count += 1
        
print(count)
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

P = []
M = []
zero = 0
for a in A:
    if a > 0:
        P.append(a)
    elif a < 0:
        M.append(a)
    else:
        zero += 1

if len(P) + len(M) < K:
    print(0)
    exit()

P.sort(reverse=True)
M.sort()

if len(P) + zero == N:
    ans = 1
    for k in range(K):
        ans *= P[k]
        ans %= MOD
    print(ans)
    exit()

if len(M) + zero == N:
    ans = 1
    if K % 2 == 0:
        for k in range(K):
            ans *= M[k]
            ans %= MOD
        print(ans)
    else:
        if zero > 0:
            print(0)
        else:
            for k in range(len(M) - 1, len(M) - 1 - K, -1):
                ans *= M[k]
                ans %= MOD
            print(ans)
    exit()


cur_p = 0
cur_m = 0
ans = 1
for k in range(K):
    if cur_p == len(P):
        ans *= M[cur_m]
        cur_m += 1
    elif cur_m == len(M):
        ans *= P[cur_p]
        cur_p += 1
    else:
        if P[cur_p] < abs(M[cur_m]):
            ans *= M[cur_m]
            cur_m += 1
        else:
            ans *= P[cur_p]
            cur_p += 1
    ans %= MOD

if cur_m % 2 == 0:
    print(ans)
else:
    if cur_p == len(P):
        ans *= M[cur_m]
        ans *= pow(P[cur_p - 1], MOD - 2, MOD)
        ans %= MOD
    elif cur_m == len(M):
        ans *= P[cur_p]
        ans *= pow(P[cur_m - 1], MOD - 2, MOD)
        ans %= MOD
    else:
        m1 = M[cur_m - 1]
        p1 = P[cur_p]
        m2 = M[cur_m]
        p2 = P[cur_p - 1]
        if p1 / m1 > m2 / p2:
            ans *= p1
            ans *= pow(m1, MOD - 2, MOD)
            ans %= MOD
        else:
            ans *= m2
            ans *= pow(p2, MOD - 2, MOD)
            ans %= MOD
    print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7


P = []
M = []
zero = 0
for a in A:
    if a >= 0:
        P.append(a)
    elif a < 0:
        M.append(a)

ans = 1
if K == N:
    for a in A:
        ans *= a
        ans %= MOD
    print(ans)
    exit()

ans = 1
if len(P) == 0 and K % 2 == 1:
    M.sort(reverse=True)
    for k in range(K):
        ans *= M[k]
        ans %= MOD
    print(ans)
    exit()

P.sort(reverse=True)
M.sort()
S = 1
LP = len(P)
LM = len(M)
cur_p = 0
cur_m = 0
cnt = 0
ans = 1
while cnt < K:
    if K - cnt == 1 or LM - cur_m <= 1:
        flag = 'p'
    elif LP - cur_p == 1:
        if (K - cnt) % 2 == 1:
            flag = 'p'
        else:
            flag = 'm'
    elif LP - cur_p == 0:
        flag = 'm'
    else:
        p1 = P[cur_p]
        p2 = P[cur_p + 1]
        m1 = M[cur_m]
        m2 = M[cur_m + 1]
        if p1 * p2 >= m1 * m2:
            flag = 'p'
        else:
            flag = 'm'
    
    if flag == 'p':
        ans *= P[cur_p]
        ans %= MOD
        cur_p += 1
        cnt += 1
    else:
        ans *= M[cur_m] * M[cur_m + 1]
        ans %= MOD
        cur_m += 2
        cnt += 2

print(ans)
import sys

N = int(input())
A = [int(x) for x in input().split(" ")]
product = 1
for a in A:
    product = product * a
if product > 10 ** 18:
    print(-1)
    sys.exit(1)

print(product)


### FIXED CODE ###

import sys

N = int(input())
A = [int(x) for x in input().split(" ")]
if 0 in set(A):
    print(0)
    sys.exit(0)

product = 1
for a in A:
    product = product * a
    if product > 10 ** 18:
        print(-1)
        sys.exit(0)


print(product)
N,M=map(int,input().split())
a = input()
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 0
t = N-1
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  elif j == "L" and i == a[s]:
    s+=1
  elif j == "R" and i == a[s]:
    s-=1
  elif j == "L" and i == a[t]:
    t+=1
    c-=1
  if s+c==N and N!=0:break
if N>1:print(N-s-c)
else: 
  if s+c>1:print(1)
  else:print(0)

### FIXED CODE ###

N,M=map(int,input().split())
a = "a"+input()+"q"
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 1
t = N
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  if j == "L" and i == a[s]:
    s+=1
  if j == "R" and i == a[s-1] and s!= 1:
    s-=1
  if j == "L" and i == a[t+1] and t!= N:
    t+=1
    c-=1
  if s+c-1==N and N!=0:break
if N>1:print(N-s-c-1+2)
else: 
  if s+c+1>1:print(1)
  else:print(0)
#include<iostream>
#include<string>
using namespace std;

int main(){
    int i;
    string s;
    cin >> i;
    cin >> s;
    if(i < 32000){
        cout << "red" << endl;
    }
    else{
        cout << s << endl;
    }
}

### FIXED CODE ###

a = int(input())
s = input()

if a < 3200:
  print("red")
else:
  print(s)
S = input()
T = ''

def Tcmp(T, moji):
	
	T += moji
	
	if (S == T):
		return 1
	if len(T) > len(S):
		return 0
	
	if (moji == "dream"):
		return max(Tcmp(T,""),Tcmp(T,"er"))
	elif(moji == "eras"):
		return max(Tcmp(T,"e"),Tcmp(T,"er"))
	else:
		return max(Tcmp(T,"dream"),Tcmp(T,"eras"))

if(Tcmp(T,"")):
	print("YES")
else:
	print("NO")

### FIXED CODE ###

#ABC 049 C
S = input()
T = ''
S = S[::-1]
words = ["dream","dreamer","erase","eraser"]
rev_words = [w[::-1] for w in words]

flag = False
i=0
while(1):
	for w in rev_words:
		s = S[i:i+len(w)]
		if s == w:
			flag = True
			T += w
			i += len(w)
			break
	if T == S:
		ans = "YES"
		break
	if flag == False:
		ans = 'NO'
		break
	flag = False

print(ans)
N,H=map(int,input().split())
iAB=[]
a_max=(0,0,0)
for i in range(N):
    a,b=map(int,input().split())
    iAB.append((i,a,b))
    if a_max[1]<a or (a_max[1]==a and a_max[2]>b):
        a_max=(i,a,b)

#最大ダメージの刀以外を振る意味はない
#振った場合の最大ダメージを超えるダメージを投げて出せる刀はどんどん投げる
#最大ダメージの刀を投げて1撃で倒せる状態なら投げる

#投げダメージの降順でソート
iAB.sort(key=lambda x:x[2], reverse=True)

ans=0 #攻撃回数
throw_idx=0 if a_max[0]!=iAB[0][0] else 1 #投げチェックindex

#倒すまでループ
#print(a_max,throw_idx)###########
while H>0:
    if a_max[2]>=H:
        #最大ダメージの刀を投げて1撃で倒せる状態なら投げて終わり
        #print("{0}を最後に投げてHPは{1}になった".format(a_max,H-a_max[2]))
        ans+=1
        break
    if throw_idx<N and iAB[throw_idx][2]>a_max[1]:
        #最大じゃない刀を投げる
        H-=iAB[throw_idx][2]
        #print("{0}を投げてHPは{1}になった".format(iAB[throw_idx],H))
        throw_idx+=1
        throw_idx+=1 if iAB[throw_idx][0]==a_max[0] else 0
        ans+=1
        continue
    #もう投げられるものがない
    #振りまくる(投げ分のHPは残す)
    furi=(H-a_max[2])//a_max[1] +(1 if (H-a_max[2])%a_max[1] else 0)
    #print("{0}を{1}回振ってHPは{2}になった".format(a_max,furi,furi*a_max[1]))
    ans+=furi
    H-=furi*a_max[1]
    if a_max[1]>=H:
        #1回振って倒せるなら振って終わり
        #print("{0}を最後に1回振ってHPは{1}になった".format(a_max,H-a_max[1]))
        ans+=1
        break

print(ans)

### FIXED CODE ###

N,H=map(int,input().split())
iAB=[]
a_max=(0,0,0)
for i in range(N):
    a,b=map(int,input().split())
    iAB.append((i,a,b))
    if a_max[1]<a or (a_max[1]==a and a_max[2]>b):
        a_max=(i,a,b)

#最大ダメージの刀以外を振る意味はない
#振った場合の最大ダメージを超えるダメージを投げて出せる刀はどんどん投げる
#最大ダメージの刀を投げて1撃で倒せる状態なら投げる

#投げダメージの降順でソート
iAB.sort(key=lambda x:x[2], reverse=True)

ans=0 #攻撃回数
throw_idx=0 if a_max[0]!=iAB[0][0] else 1 #投げチェックindex

#倒すまでループ
#print(a_max,throw_idx)###########
while H>0:
    if a_max[2]>=H:
        #最大ダメージの刀を投げて1撃で倒せる状態なら投げて終わり
        #print("{0}を最後に投げてHPは{1}になった".format(a_max,H-a_max[2]))
        ans+=1
        break
    if throw_idx<N and iAB[throw_idx][2]>a_max[1]:
        #最大じゃない刀を投げる
        H-=iAB[throw_idx][2]
        #print("{0}を投げてHPは{1}になった".format(iAB[throw_idx],H))
        throw_idx+=1
        throw_idx+=1 if throw_idx<N and iAB[throw_idx][0]==a_max[0] else 0
        ans+=1
        continue
    #もう投げられるものがない
    #振りまくる(投げ分のHPは残す)
    furi=(H-a_max[2])//a_max[1] +(1 if (H-a_max[2])%a_max[1] else 0)
    #print("{0}を{1}回振ってHPは{2}になった".format(a_max,furi,furi*a_max[1]))
    ans+=furi
    H-=furi*a_max[1]
    if a_max[1]>=H:
        #1回振って倒せるなら振って終わり
        #print("{0}を最後に1回振ってHPは{1}になった".format(a_max,H-a_max[1]))
        ans+=1
        break

print(ans)
import math
from functools import reduce


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

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

l = lcm(a)
answer = 0
for aa in a:
    answer += l // aa
    answer = answer % (10 ** 9 + 7)

print(answer)


### FIXED CODE ###

# import math
# import fractions

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

mod = 10 ** 9 + 7


def prime_factorize(n):
    a = {}
    while n % 2 == 0:
        if 2 not in a:
          a[2] = 0
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f not in a:
              a[f] = 0
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
      if n not in a:
        a[n] = 0
      a[n] += 1
    return a


# 最小公倍数を素因数分解した形で持つ
l = prime_factorize(a[0])
# print(l)
# xs = {}
# xs[a[0]] = prime_factorize(a[0])
for i in range(1, n):
  ps = prime_factorize(a[i])
  # print(ps)
  # xs[a[i]] = ps
  for k, v in ps.items():
    if k in l:
      l[k] = max(v, l[k])
    else:
      l[k] = v

# print(l)
# print(xs)

L = 1
for k, v in l.items():
  L = L * pow(k, v, mod) % mod

answer = 0
for x in a:
  answer = (answer + L * pow(x, mod - 2, mod)) % mod
print(answer)
import sys
from collections import defaultdict as dd
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = dd(int)
a = [tuple(map(int, input().split())) for _ in range(N)]
for x, y in a:
  g = gcd(abs(x), abs(y))
  d[(x // g, y // g)] += 1
res = 1
u = 0
itr = list(d.keys())
#print(itr)
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t == 0: u += d[(x, y)]
for x, y in itr:
  t = d[(y, -x)] + d[(-y, x)]
  if t:
    v = 0
    v += pow(2, d[(x, y)], mod) - 1
    v %= mod
    v += pow(2, t, mod) - 1
    v %= mod
    v += 1
    v %= mod
    res *= v
    res %= mod
    #print(res, v)
  d[(x, y)] = 0
print(res * pow(2, u, mod) - 1 % mod)

### FIXED CODE ###

import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for x, y in a:
  if (x, y) == (0, 0):
    z += 1
    continue
  if y < 0:
    x *= -1
    y *= -1
  if x == 0:
    x = 0
    y = 1
  elif y == 0:
    x = 1
    y = 0
  g = gcd(x, y)
  x //= g
  y //= g
  d[(x, y)] += 1

res = 1
itr = list(d.keys())
#print(itr, d)
for x, y in itr:
  t = 0
  if x <= 0 and (d[(y, -x)] > 0): continue
  if (x, y) == (1, 0):
    t = d[(0, 1)]
  else:
    t = d[(-y, x)]
  v = 0
  v += pow(2, d[(x, y)], mod) - 1
  v %= mod
  v += pow(2, t, mod) - 1
  v %= mod
  v += 1
  v %= mod
  res *= v
  res %= mod
  #print(res, d, d[(x, y)], t)
#print(itr, u, res, z)
print((res - 1 + z) % mod)
N, M = map(int, input())
print(N*(N-1)//2+M*(M-1)//2)


### FIXED CODE ###

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