Harryxun/stf_run huggingface dataset:
import math
from itertools import combinations

def leave_one_out(array):
  max_gcd = 0
  for i in range(len(array)):
    if i == 0:
      gcd = array[1]
      k = 2
    elif i == 1:
      gcd = array[0]
      k = 2
    else:
      gcd = array[0]
      k = 1
    for j in range(k, len(array)):
      if i == j:
        continue
      gcd = math.gcd(array[j], gcd)
    max_gcd = max(gcd, max_gcd)
  return max_gcd

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

def main():
  N = int(input().strip())
  A = list(map(int, input().strip().split()))
  #N = int(1e3)
  #A = [int(1e9)] * N
  divs_dict = dict()
  
  print(leave_one_out(A))
  """
  for a in A:
    divs = make_divisors(a)
    for d in divs:
      if d in divs_dict.keys():
        divs_dict[d] += 1
      else:
        divs_dict[d] = 1
  
  result_divs = []
  for k in divs_dict.keys():
    if divs_dict[k] >= N-1:
      result_divs.append(k)
  print(sorted(result_divs)[-1])
  """

if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import math
from fractions import gcd
import operator
from functools import reduce
from itertools import accumulate

def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def prime_factorization_preprocess(n):
    """
    エラトステネスの篩を用いて、sqrt(n)以下の素数を列挙する
    """
    m = math.floor(math.sqrt(n)) + 1
    primes = []
    is_prime = [True for i in range(m)]
    for i in range(2, m):
        if is_prime[i]:
            primes.append(i)
            for j in range(i+i, m, i):
                is_prime[j] = False
    return primes


def prime_factorization(x, primes):
    """
    試し割り法により、数値の素因数分解を求める
    """
    factors = defaultdict(int)
    for p in primes:
        if x % p == 0:
            n = 0
            while x % p == 0:
                x //= p
                n += 1
            factors[p] = n
    return factors


def solve(N, A, AMAX = 10**9, INF=10**9):
    sl = list(accumulate(A, gcd))
    sr = list(reversed(list(accumulate(reversed(A), gcd))))
    max_gcd = sl[-1]
    for i in range(N):
        # gcdの単位元は0
        v = 0
        if i > 0:
            v = gcd(v, sl[i-1])
        if i < N-1:
            v = gcd(v, sr[i+1])
        max_gcd = max(max_gcd, v)
    return max_gcd


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))
i = 0 #????????????

while True:
	n = map(int,input())
	if n == 0:
		break
	i += 1#?????????????????????
	
	print('Case {} : {}'.format(i,n))

### FIXED CODE ###


i = 0 #????????????

while True:
	n = input()
	if n == '0':
		break
	i += 1#?????????????????????
	print('Case {}: {}'.format(i,n))
n = int(raw_input())

        ls = map(int,raw_input().split())
        mi = min(ls)
        ma = max(ls)
        su = sum(ls)
        print "%d %d %d" % (mi,ma,su)

### FIXED CODE ###

n = int(raw_input())

ls = map(int,raw_input().split())
mi = min(ls)
ma = max(ls)
su = sum(ls)
print "%d %d %d" % (mi,ma,su)
import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 or num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import math

def inputlist(): return [int(i) for i in input().split()]

def kumiawase(num):
    r = 2
    if num != 1 and num != 0:
        return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))
    else:
        return 0

def main():
    N, M = inputlist()
    print(kumiawase(N) + kumiawase(M))

if __name__ == '__main__':
    main()
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  *p = x, y
else:
  print("Yes")

### FIXED CODE ###

import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  p = x, y
else:
  print("Yes")
a=list(input())
b=list(input())
print(len(list(set(a)a&set(b))))


### FIXED CODE ###

a=list(input())
b=list(input())
c=0
for i in range(3):
  if a[i]==b[i]:
    c+=1
print(c)
import math
import fractions
a,b=map(int,input().split())
#mn=math.ceil(max(b/0.1,a/0.08))
mn=fractions.ceil(max(b/0.1,a/0.08))

mx=min((b+1)/0.1,(a+1)/0.08)
if mn<=mx:
    print(int(mn))
else:
    print(-1)

### FIXED CODE ###

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

mn=max(b*10,a*12.5)
if mn==a*12.5 and a%2==1:
    mn=int(mn)+1
mx=min((b+1)/0.1,(a+1)/0.08)
if mn<mx:
    print(int(mn))
else:
    print(-1)
a = int(raw_input())
b = int(raw_input())

s = a * b
s2 = 2 * (a + b)
print (s, s2)

### FIXED CODE ###

import sys

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

print (a * b, (a + b) * 2)
k = int(input())
#a = map(int,input().split())
#a_L = list(map(int,input().split()))
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k])

### FIXED CODE ###

k = int(input())
#a = map(int,input().split())
#a_L = list(map(int,input().split()))
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
import math
a = int(input())
print(2**math.floor(mat

### FIXED CODE ###

import math
a = int(input())
print(2**math.floor(math.log(a,2)))
n = int(input())
lis = []
for i in range(n):
    lis.append(int(input()))

print(lcm(lis))

### FIXED CODE ###

import numpy as np
n = int(input())
lis = []
for i in range(n):
    lis.append(int(input()))
print(np.lcm.reduce(lis))
from numpy import cumsum
N, K = map(int, input().split())
S = input()
*S, = map(int, list(S))
zeros = [0]
ones = [0]
if S[0] == 0:
    ones.append(0)
cnt = 1
now = S[0]
for i in range(1, N):
    if now == S[i]:
        cnt += 1
    else:
        if now == 0:
            zeros.append(cnt)
        else:
            ones.append(cnt)
        cnt = 1
        now = S[i]
if now == 0:
    zeros.append(cnt)
else:
    ones.append(cnt)
if S[-1] == 0:
    ones.append(0)

c_zero = cumsum(zeros)
c_one = cumsum(ones)
# print(zeros)
# print(c_zero)
# print(c_one)
if len(zeros) <= K:
    print(len(S))
else:
    ans = 0
    for i in range(0, len(zeros) - K):
        #print(i, K)
        #print(c_zero[i+K]-c_zero[i], c_one[i+K+1]-c_one[i])
        aaa = c_zero[i+K]-c_zero[i] + c_one[i+K+1]-c_one[i]
        #aaa = sum(zeros[i:i + K]) + sum(ones[i:i + K])+ones[i+K]
        # if (S[-1] != 0 and i == saigo)or (S[0] != 0 and i == 0):
        #aaa += ones[i+K]
        ans = max(aaa, ans)
    print(ans)


### FIXED CODE ###

from numpy import cumsum
N, K = map(int, input().split())
S = input()
*S, = map(int, list(S))
zeros = [0]
ones = [0]
if S[0] == 0:
    ones.append(0)
cnt = 1
now = S[0]
for i in range(1, N):
    if now == S[i]:
        cnt += 1
    else:
        if now == 0:
            zeros.append(cnt)
        else:
            ones.append(cnt)
        cnt = 1
        now = S[i]
if now == 0:
    zeros.append(cnt)
else:
    ones.append(cnt)
if S[-1] == 0:
    ones.append(0)

c_zero = cumsum(zeros)
c_one = cumsum(ones)
# print(zeros)
# print(c_zero)
# print(c_one)
if len(zeros) <= K:
    print(len(S))
else:
    ans = 0
    for i in range(0, len(zeros) - K):
        #print(i, K)
        #print(c_zero[i+K]-c_zero[i], c_one[i+K+1]-c_one[i])
        aaa = c_zero[i+K]-c_zero[i] + c_one[i+K+1]-c_one[i]
        #aaa = sum(zeros[i:i + K]) + sum(ones[i:i + K])+ones[i+K]
        # if (S[-1] != 0 and i == saigo)or (S[0] != 0 and i == 0):
        #aaa += ones[i+K]
        ans = max(aaa, ans)
    print(ans)
import sys
from collections import deque, Counter

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N, K, L = map(int, input().split())
    Adj_r = [[] for i in range(N)]
    Adj_t = [[] for i in range(N)]

    for i in range(K):
        p, q = map(int, input().split())
        p, q = p-1, q-1
        Adj_r[p].append(q)
        Adj_r[q].append(p)

    for i in range(L):
        r, s = map(int, input().split())
        r, s = r-1, s-1
        Adj_t[r].append(s)
        Adj_t[s].append(r)

    col = 0
    cols_r = [None] * N
    cols_t = [None] * N

    for u in range(N):
        if cols_r[u] is None:
            bfs_color(N, Adj_r, cols_r, u, col)
            col += 1
        if cols_t[u] is None:
            bfs_color(N, Adj_t, cols_t, u, col)
            col += 1

    # debug(cols_r, locals())
    # debug(cols_t, locals())

    cnt = Counter((cols_r[u], cols_t[u]) for u in range(N))

    ans = [cnt[cols_r[u], cols_t[u]] for u in range(N)]

    print(*ans)


def bfs_color(N, Adj, v_cols, u, col):
    v_cols[u] = col
    nxts = deque([u])

    while nxts:
        v = nxts.popleft()

        for w in Adj[v]:
            if v_cols[w] is None:
                v_cols[w] = col
                nxts.append(w)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    c = input()
    boin = {'a', 'e', 'i', 'o', 'u'}

    if c in boin:
        ans = 'vowel'
    else:
        ans = 'consonant'

    print(ans)


if __name__ == '__main__':
    solve()
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

a,b = input().split()
b = int(b.replace(".",""))
a = int(a)
print((a*b)//100)


### FIXED CODE ###

import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

n = int(ipt())
a = [int(i) for i in ipt().split()]
if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    if 10**18/ans < i:
        print(-1)
        exit()
    ans *= i
if ans > 10**18:
    print(-1)
else:
    print(ans)
li6 = [6 ** i for i in range(7)]
li9 = [9 ** i for i in range(6)]

def s69(n):
    if n < 6:
        return n
    else:
        s6 = li6[bi.bisect(li6, n) - 1]
        s9 = li9[bi.bisect(li9, n) - 1]
        return min(n // s6 + s69(n % s6), 1 + s69(n - s9))


print(s69(int(input())))



### FIXED CODE ###

import bisect as bi

li6 = [6 ** i for i in range(7)]
li9 = [9 ** i for i in range(6)]

def s69(n):
    if n < 6:
        return n
    else:
        s6 = li6[bi.bisect(li6, n) - 1]
        s9 = li9[bi.bisect(li9, n) - 1]
        return min(n // s6 + s69(n % s6), 1 + s69(n - s9))


print(s69(int(input())))
K=input()
if K % 2 ==0:
  print(int(K*K/2/2))
else:
  print(int((K+1)*(K-1)/2/2))

### FIXED CODE ###

K=int(input())
if K % 2 ==0:
  print(int(K*K/4))
else:
  print(int((K+1)*(K-1)/4))
N, M = [int(_) for _ in input().split()]
bridge = [[int(_) for _ in input().split()] for _ in range(M)]

bridge.reverse()
bridge = bridge[:-1]

inconvenience = N * (N - 1) // 2
inconvenience_history = [inconvenience]


class UnionFind:
    def __init__(self, N):
        self.par = [i for i in range(N + 1)]
        self._number = [1] * (N + 1)

    def root(self, i):
        if self.par[i] == i:
            return i
        self.par[i] = self.root(self.par[i])
        return self.par[i]

    def number(self, i):
        return self._number[self.root(i)]

    def union(self, i, j):
        _root_i = self.root(i)
        _root_j = self.root(j)
        if _root_i == _root_j:
            return
        else:
			self.par[_root_j] = _root_i
            self._number[_root_i] += self._number[_root_j]


islands = UnionFind(N)

for A_i, B_i in bridge:

    root_A = islands.root(A_i)
    root_B = islands.root(B_i)

    if root_A == root_B:
        inconvenience_history.append(inconvenience)
        continue
    else:
        improvement = islands.number(A_i) * islands.number(B_i)
        islands.union(A_i, B_i)

        inconvenience -= improvement
        if inconvenience == 0:
            inconvenience_history += [0] * (M - len(inconvenience_history))
            break
        inconvenience_history.append(inconvenience)

print(*inconvenience_history[::-1], sep='\n')


### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
bridge = [[int(_) for _ in input().split()] for _ in range(M)]

bridge.reverse()
bridge = bridge[:-1]

inconvenience = N * (N - 1) // 2
inconvenience_history = [inconvenience]


class UnionFind:
    def __init__(self, N):
        self.par = [i for i in range(N + 1)]
        self.rank = [0] * (N + 1)
        self._number = [1] * (N + 1)

    def root(self, i):
        if self.par[i] == i:
            return i
        self.par[i] = self.root(self.par[i])
        return self.par[i]

    def tree_rank(self, i):
        return self.rank[self.root(i)]

    def number(self, i):
        return self._number[self.root(i)]

    def union(self, i, j):
        _root_i = self.root(i)
        _root_j = self.root(j)
        if _root_i == _root_j:
            return
        else:
            if self.tree_rank(i) < self.tree_rank(j):
                self.par[_root_i] = _root_j
                self._number[_root_j] += self._number[_root_i]
            else:
                self.par[_root_j] = _root_i
                self._number[_root_i] += self._number[_root_j]
                if self.tree_rank(i) == self.tree_rank(j):
                    self.rank[_root_i] += 1


islands = UnionFind(N)

for A_i, B_i in bridge:

    root_A = islands.root(A_i)
    root_B = islands.root(B_i)

    if root_A == root_B:
        inconvenience_history.append(inconvenience)
        continue
    else:
        improvement = islands.number(A_i) * islands.number(B_i)
        islands.union(A_i, B_i)

        inconvenience -= improvement
        if inconvenience == 0:
            inconvenience_history += [0] * (M - len(inconvenience_history))
            break
        inconvenience_history.append(inconvenience)

print(*inconvenience_history[::-1], sep='\n')
from collections import defaultdict
import re
from itertools import product

atcg = ['A', 'T', 'C', 'G']
num = int(input())

def validate(tpl):
    string = tpl[0] + tpl[1] + tpl[2] + tpl[3]
    for pat in [r'A.GC', r'AG.C', 'ACG', 'AGC', 'GAC']:
         if re.search(pat, string):
                return False
    return True

def transition(dic):
    new_dic = defaultdict(int)
    for k, v in dic.items():
        for c in atcg:
            tpl = *k[1:], c
            if validate(tpl):
                new_dic[tpl] += v
    return new_dic

it = product(atcg, atcg, atcg, atcg)
dic = {}
for s in it:
    if validate(s):
        dic[s] = 1

if num == 3:
    print(61)
elif num == 4:
    print(230)
else:
    for n in range(num - 4):
        dic = transition(dic)
    print(sum(dic.values()) % 1000000007)

### FIXED CODE ###

from collections import defaultdict
import re
from itertools import product

atcg = ['A', 'T', 'C', 'G']
num = int(input())

def validate(tpl):
    string = tpl[0] + tpl[1] + tpl[2] + tpl[3]
    for pat in [r'A.GC', r'AG.C', 'ACG', 'AGC', 'GAC']:
         if re.search(pat, string):
                return False
    return True

def transition(dic):
    new_dic = defaultdict(int)
    for k, v in dic.items():
        for c in atcg:
            tpl = k[1], k[2], k[3], c
            if validate(tpl):
                new_dic[tpl] += v
    return new_dic

it = product(atcg, atcg, atcg, atcg)
dic = {}
for s in it:
    if validate(s):
        dic[s] = 1

if num == 3:
    print(61)
elif num == 4:
    print(230)
else:
    for n in range(num - 4):
        dic = transition(dic)
    print(sum(dic.values()) % 1000000007)
N, K = [int(c) for c in input().split()]
S = [int(c) for c in input()]

longest=0

for bgn_flip in range(len(S)):

    S_copy=S[:]
    zero=False
    icluster=-1
    for i,s in enumerate(S):
        if s==0 and zero==False:
            zero=True
            icluster+=1
        if s==1:
            zero=False

		if s==0 and icluster>=bgn_flip and icluster < bgn_flip+K:
       		S_copy[i]=1

    seq=0
    for sc in S_copy:
        if sc==1:
          seq+=1
        if sc==0:
          seq=0
        if seq>longest:
          longest=seq

print(longest)

### FIXED CODE ###

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

n = 1
c = []
if S[0]=='0': c.append(0)
for i in range(1,N):
    if S[i]!=S[i-1]:
        c.append(n)
        n=1
    else:
        n+=1
c.append(n)
if S[-1]=='0': c.append(0)

t = sum(c[:2*K+1])
m = t
for i in range(2*K+1, len(c), 2):
    t += c[i] + c[i+1] - c[i-(2*K+1)] - c[i+1-(2*K+1)]
    m = max(m,t)

print(m)
def run(x, n, num_array):
    '''
    '''
    if len(num_array) == 0:
        print(x)
        return
    
    i = 1
    while True:
        if x - i not in num_array:
            print(x - i)
            return
        if x + i not in num_array:
            print(x + i)
            return
        i += 1
        

if __name__ == '__main__':
    x, n = list(map(int, input().split()))
    num_array = list(map(int, input().split()))
    run(x, n, num_array)

### FIXED CODE ###

def run(x):
    '''
    '''
    for i,v in enumerate(x):
        if v == 0:
            print(i+1)


if __name__ == '__main__':
    x = list(map(int, input().split()))
    run(x)
n = int(input())
s=[]
for i in range(n):
    s.append(int(input()))

if sum(s) % 10 != 0:
    print(sum(s))
else:
    print(sum(s)-min(filter(lambda x:x%10>0,s)))



### FIXED CODE ###

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

s.sort(key=lambda x:x%10)

if sum(s) % 10 != 0:
    print(sum(s))
elif s[-1] % 10>0:
    print(sum(s)-min(filter(lambda x:x%10>0,s)))
else:
    print(0)
def resolve():
    N=int(input())
    print(f(N))

memo = [-1]*110000

def f(n):
    if n==0: return 0
    
    global memo
    if memo[n]!=-1:
        return memo[n]
    
    minc=n
    minc=min(minc,f(n-1)+1)
    i=1
    while 6**i<=n:
        j=6**i
        minc=min(minc,f(n-j)+1)
        i+=1
    
    i=1
    while 9**i<=n:
        j=9**i
        minc=min(minc,f(n-j)+1)
        i+=1

    memo[n]=minc
    return minc

resolve()

### FIXED CODE ###

def resolve():
    N=int(input())
    mini=10**10
    for i in range(N+1):
        j=N-i
        mini=min(mini,f(i,6)+f(j,9))
    print(mini)


def f(n,m):#nをm進数にしたときの桁和
    i=0
    while n>0:
        i=i+n%m
        n=n//m
    return(i)
resolve()
a,b,n=map(int,input().split())
'''
lst=[]
for i in range(n+1):
    now=int(a*i/b)-a*int(i/b)
    lst.append(now)
print(max(lst))
'''
lst=[]
if n>=b:
    ans=int(a*(n-1)/b)-a*int((n-1)/b)
    ans2=int(a*n/b)-a*int(n/b)

    print(max(ans,ans2,max(lst)))

else:
    ans=int(a*(n)/b)-a*int((n)/b)
    print(max(ans,0))


### FIXED CODE ###

a,b,n=map(int,input().split())
def ans(x):
    return int(a*x/b)
print(ans(min(n,b-1)))
def check_a(numbers):
    if numbers.count(5) == 2 and numbers.count(7) == 1:
        return 'YES'
    else:
        return 'NO'


def main():
    numbers = list(map(int, input()))
    print(check_a(numbers=numbers))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def check_a(numbers):
    if numbers.count(5) == 2 and numbers.count(7) == 1:
        return 'YES'
    else:
        return 'NO'


def main():
    numbers = list(map(int, input().split()))
    print(check_a(numbers=numbers))


if __name__ == '__main__':
    main()
n = int(input())
num_l=sorted(map(int,input().split()),reverse=True)
s=sorted(set(num_l),reverse=True)
res=[]
for i in num_l:
    if len(res) == 2:
        print(res[0]*res[1])
        break
    if d[i] >= 2:
        d[i]-=2
        res.append(i)
    else:
        pass
else:print(0)

### FIXED CODE ###

from collections import Counter
n = int(input())
num_l = sorted(map(int, input().split()),reverse=True)
s = sorted(set(num_l), reverse=True)
d = Counter(num_l) # {i:num_l.count(i) for i in s}
res = []
it = 0
lim=len(s)
# c = max()
for i in range(n):
    if d[s[it]] >= 2:
        d[s[it]]-=2
        res.append(s[it])
    else:
        it+=1#pass
        
    if len(res) == 2:
        print(res[0] * res[1])
        break
    if lim==it:
        print(0)
A,B,C = map(int,input().split( ))
k = int(input())


lis = [A,B,C]
max_num = max(A,B,C)

lis.remove(max_num)

rui = 2 ** k

nibai = max_num * rui


a = lis[0]
b = lis[1]
print(a + b + nibai)


### FIXED CODE ###

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

if a < b:
    print(a)

elif a > b:
    a = a - 1
    print(a)

elif a == b:
    print(a)
from functools import reduce
import math
n, x = list(map(int, input().split()))
x_li = list(map(int, input().split()))
x_li.append(x)
x_li.sort()
d = []
for i in range(n):
    d.append(x_li[i + 1] - x_li[i])


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


if len(d) > 1:
    print(gcd_list(d))
else:
    print(d[0])


### FIXED CODE ###

from functools import reduce
import fractions
n, x = list(map(int, input().split()))
x_li = list(map(int, input().split()))
x_li.append(x)
x_li.sort()
d = []
for i in range(n):
    d.append(x_li[i + 1] - x_li[i])


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


if len(d) > 1:
    print(gcd_list(d))
else:
    print(d[0])
N,A,B = map(int,input().split())

r = ''
for i in range(10**100):
    r += "b"* A
    if len(r) >= N:
        break
    r += "r"* B
    if len(r) >= N:
        break
print(r[:N].count('b'))

### FIXED CODE ###

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

s = 0
s = int(N / (A+B))*A
if N % (A+B) > A:
    s += A
else:
    s += N % (A+B)
print(s)
n,k = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]

dif = lambda x,y: abs(x-y)

dp = [0,dif(arr[0],arr[1])]

for i in range(2,n):
    minCost = 10000
    H = arr[i]
    for j in range(i-k,i):
        cost = dp[j]+dif(arr[j],H)
        if cost<minCost:
            minCost = cost
    dp.append(minCost)

print(dp[-1])


### FIXED CODE ###

ni,ki = [int(i) for i in input().split()]
arri = [int(i) for i in input().split()]
    
def getRes(arr,n,k):
    dp = [0]*n
    for i in range(1,n):
        H = arr[i]
        dp[i] = min([dp[j]+abs(arr[j]-H) for j in range(max(0,i-k),i)])
    return dp[-1]

print(getRes(arri,ni,ki))
# Your code here!
import numpy as np
N, M = (int(i) for i in input().split()) 
e = np.array([[int(i) for i in input().split()] for i in range(N)])
# print(M)
# print(e)

e = e[np.argsort(e[:, 0])]
# print(e)
# arr_index = np.argsort(arr_key)
# return arr[arr_index]
# print(e.sort())
# e = np.sort(e, axis=1)
# print(e)
aaa = np.cumsum(e, axis=0)
# print(aaa)/
# print((aaa[:,1] < M))
# print(np.sum((e[:, 1] * e[:, 0])[aaa[:,1] < M]))
asf = np.sum((e[:, 1] * e[:, 0])[aaa[:,1] < M])
# print(aaa[:,1] )
# print([aaa[:,1] < M])
# print(((aaa[:, 1] * e[:, 0])[aaa[:,1] < M]))
# print(e[:, 0])
# print(aaa[:, 1])
# print(aaa)
# print([aaa[:,1] < M])
# print((e[:, 1] * e[:, 0])[aaa[:,1] <= M])
honsuu = aaa[:,1][aaa[:,1] <= M][-1]
# print(M-honsuu)
nedan = e[:,0][aaa[:,1] > M][0]
# print( e[:,0][aaa[:,1] < M])
# print(aaa[:,1])
# print(e[:,0][aaa[:,1] >= M])
# # print(nedan = e[:,1][aaa[:,1] > M][-1])
# # print(e)
# print((M-honsuu))
# print(nedan)
print(nedan*(M-honsuu)+asf)
# print(asf)

### FIXED CODE ###

# coding: utf-8
# Your code here!

N, M = (int(i) for i in input().split()) 
AB=[list(map(int,input().split())) for _ in range(N)]
# print(AB)
AB.sort()
# print(AB)

money = 0
for a, b in AB:

    # print(M) 
    if M==0:
        break
    elif b < M:
        # print(a*xb)
        money += a*b
        M -= b
    elif b >= M:
        # print(M)
        money += M*a
        M = 0
    # print(M, money)
print(money)