akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

const int N = 200010;
int a[N], b[N];

void solve1(int n) {
	int lt = 1, rt = 2000000000, mid, l = 1000000000, r = 0;
	while (lt <= rt) {
		mid = (0LL + lt + rt) >> 1;
		int tot1 = 0, tot2 = 0;
		for (int i = 1; i <= n; i++) {
			if (b[i] >= mid) tot1++;
			if (a[i] <= mid) tot2++;
		}

		if (tot1 >= (n + 1) / 2 && tot2 >= (n + 1) / 2) {
			l = mid;
			rt = mid - 1;
		} else if (tot1 >= (n + 1) / 2) lt = mid + 1;
		else rt = mid - 1;
	}
	lt = 1, rt = 1000000000;
	while (lt <= rt) {
		mid = (lt + rt) >> 1;
		int tot1 = 0, tot2 = 0;
		for (int i = 1; i <= n; i++) {
			if (b[i] >= mid) tot1++;
			if (a[i] <= mid) tot2++;
		}

		if (tot1 >= (n + 1) / 2 && tot2 >= (n + 1) / 2) {
			r = mid;
			lt = mid + 1;
		} else if (tot1 >= (n + 1) / 2) lt = mid + 1;
		else rt = mid - 1;
	}
	printf("%d\n", r - l + 1);
}

void solve2(int n) {
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	int l = a[n / 2] + a[n / 2 + 1];
	int r = b[n / 2] + b[n / 2 + 1];
	cout << r - l + 1 << endl;
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &a[i], &b[i]);
	if (n & 1) solve1(n);
	else solve2(n);
	return 0;
}


Measured memory_bytes: 4796
#include <bits/stdc++.h>
 
using namespace std;
 
bool isACGT(char a) {
  return a == 'A' || a == 'C' || a == 'G' || a == 'T';
}
 
int main() {
  string S;
  
  cin >> S;
  
  int ans = -1;
  int left = 0;
  for (int i = 0; i < S.length(); i++) {
    if (!isACGT(S[i])) {
      left = i + 1;
    }
    
    ans = max(ans, i - left + 1);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
x,n=map(int,input().split())
lis=[]
if n==0:
    print(x)
else:
    y=sorted(int(_) for _ in input().split())
    for i in range(n):
        a=y[i]-x
        lis.append(a)
    L=l=0
    while l in lis:
        l-=1
    while L in lis:
        L+=1
    print(x+L if abs(L)<abs(l)  else x+l)

Measured memory_bytes: 9200
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 1e5 + 10;
typedef long long LL;
LL a[maxn], b[maxn];

int main(void)
{
    LL N;
    scanf("%lld", &N);
    LL sum = 0;
    for(int i = 1; i <= N; i++) scanf("%lld", a + i), sum = sum + a[i];
    LL div = (1 + N) * (LL) N / 2;
    if(sum % div) {puts("NO"); return 0;}
    LL rd = sum / div;
    for(int i = 1; i < N; i++) b[i] = a[i+1] - a[i];
    b[N] = a[1] - a[N];
    LL ok = 1, cnt = 0;
    for(int i = 1; i <= N; i++)
    {
        b[i] -= rd;
        if(b[i] > 0 || b[i] % N) {ok = 0; break;}
        cnt -= b[i] / N;
    }
    if(cnt != rd) ok = 0;
    puts(ok ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

LL n;
LL a[100005];
LL k;
LL numbits[70];
int main(){
	cin >> n >> k;
	FOR(i,0,n) cin >> a[i];
	FOR(i,0,n){
		for (LL j = 0, nx = a[i]; nx > 0; j++, nx>>=1){
			if (nx & 1) numbits[j]++;
		}
	}
//	for (int i = 0; i < 64; i++) cout << numbits[i] << " \n"[i==63];
	LL ans = 0LL;
	for (int i = 63; i >= 0; --i){
		LL now = 1LL << i;
		if (now > k){
			ans += now * numbits[i];
		} else {
			LL m1 = now * numbits[i];
			LL m2 = now * (n - numbits[i]);
			if (m1 >= m2){
				ans += m1;
			} else {
				ans += m2;
				k -= now;
			}
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int xymin = Math.min(x,y);
        long ans = xymin * Math.min(a+b,c*2);
        x -= xymin;
        y -= xymin;
        if(x == 0){
            ans += y*Math.min(b,c*2);
        }else{
            ans += x*Math.min(a,c*2);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
import numpy as np
a, b, x = map(int, input().split())
if x <= a**2*b/2:
    print(np.rad2deg(np.arctan(b/(2*x/a/b))))
else:
    y = b - x/(a**2)
    print(np.rad2deg(np.arctan(2*y/a)))

Measured memory_bytes: 12392
#include <iostream>
using namespace std;

int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    if(S[K-1] == 'A'){
        S[K-1] = 'a';
    }
    else if(S[K-1] =='B'){
        S[K-1] = 'b';
    }
    else if(S[K-1] =='C'){
        S[K-1] = 'c';
    }
    cout << S <<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?c=getchar():0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;}
template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;}
const int N=100010;
namespace T{
	const int E=N<<1;
	int to[E],bro[E],head[N],e=0;
	inline void init(){
		memset(head,-1,sizeof(head));
	}
	inline void ae(int u,int v){
		to[e]=v,bro[e]=head[u],head[u]=e++;
	}
	inline void add(int u,int v){
		ae(u,v),ae(v,u);
	}
	int dfs(int x,int fa){
		int f=0;
		for(int i=head[x],v;~i;i=bro[i]){
			if((v=to[i])!=fa){
				f^=dfs(v,x)+1;
			}
		}
		return f;
	}
}
inline int Main(){
	int n=ni;
	T::init();
	for(int i=1;i<n;T::add(ni,ni),i++);
	return T::dfs(1,0);
}
int main(){
	puts(Main()?"Alice":"Bob");
	return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> ar(n);
    rep(i,n){
        cin >> ar[i];
    }
    queue<int> q;
    queue<int> ans;
    priority_queue<int> p;
    int fr;
    rep(j,n){
        q.push(ar[j]);
    }
    rep(k,n){
        rep(l,k+1){
            fr = q.front();
            p.push(-fr);
            q.pop();
        }
        while (!p.empty()){
            fr = p.top();
            ans.push(-fr);
            p.pop();
        }
        while (!q.empty()){
            ans.push(q.front());
            q.pop();
        }
        rep(a,n-1){
            cout << ans.front() << " ";
            q.push(ans.front());
            ans.pop();
        }
        cout << ans.front() << endl;
        q.push(ans.front());
        ans.pop();
    }
}


Measured memory_bytes: 3132
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7

if n==k:
  ans=1
  for q in a:
    ans*=q
    ans%=mod
  print(ans)
  exit()
  
if all(q>=0 for q in a):
  ans=1
  a.sort()
  for _ in range(k):
    ans*=a.pop()
    ans%=mod
  print(ans)
  exit()

if all(q<0 for q in a):
  ans=1
  a.sort()
  if k%2==0:
    for i in range(k):
      ans*=a[i]
      ans%=mod
  else:
    for _ in range(k):
      ans*=a.pop()
      ans%=mod
  print(ans)
  exit()
  
pos=[]
neg=[]
for q in a:
  if q>=0:
    pos.append(q)
  else:
    neg.append(q)

pos.sort()
neg.sort()
neg=neg[::-1]

kk=k
if kk%2==1:
  ans=pos.pop()%mod
  kk=kk-1
else:
  ans=1

while kk>0:
  if len(pos)<2:
    ans=ans*neg.pop()%mod*neg.pop()%mod
    kk-=2
  elif len(neg)<2:
    ans=ans*pos.pop()%mod*pos.pop()%mod
    kk-=2
  else:
    if pos[-1]*pos[-2]>=neg[-1]*neg[-2]:
      ans=ans*pos.pop()%mod*pos.pop()%mod
      kk-=2
    else:
      ans=ans*neg.pop()%mod*neg.pop()%mod
      kk-=2
      
print(ans)


Measured memory_bytes: 110000
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    sx, sy, tx, ty = ns()

    ans = []

    ans.extend(["U"] * (ty - sy))
    ans.extend((["R"] * (tx - sx)))
    ans.extend(["D"] * ((ty - sy)))
    ans.extend((["L"] * (tx - sx)))

    ans.extend(["L"])

    ans.extend(["U"] * (ty - sy + 1))
    ans.extend((["R"] * (tx - sx + 1)))

    ans.extend(["DR"])

    ans.extend(["D"] * ((ty - sy + 1)))
    ans.extend((["L"] * (tx - sx + 1)))

    ans.extend(["U"])

    print(*ans, sep="")


if __name__ == '__main__':
    main()


Measured memory_bytes: 15004
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double n=sc.nextInt(),m=sc.nextInt(),sum=0;
    int[] a=new int[(int)n];
    for(int i=0;i<n;i++) {
    	a[i]=sc.nextInt();
    	sum+=a[i];
    }
    double f=sum/(4*m);
    int count=0;
    for(int i=0;i<n;i++) {
    	if(a[i]>=f) {
    		count++;
    	}
    }
    if(count>=m) {
    	System.out.println("Yes");
    }else {
    	System.out.println("No");
    }
  }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
int main()
{ int a,b,c,d,k,t;
while(~scanf("%d %d %d %d",&a,&b,&c,&d))
{
    if(a<b)
        t=a;
    else
        t=b;
    if(c<d)
        k=c;
    else
        k=d;
    printf("%d\n",t+k);
}
return 0;

}


Measured memory_bytes: 128
from itertools import combinations
D, G = map(int, input().split())
pc = [[i] + list(map(int, input().split())) for i in range(1,D+1)]
pc2 = [i[1] for i in pc]
res = float("inf")
for n in range(0,D+1):
    for _ in combinations(pc,n):
        memo = pc2[::]
        tmp = 0
        count = 0
        for i,p,c in _:
            tmp += p*100*i + c
            count += p
            memo[i-1] = 0
        if tmp>=G:
            res = min(res,count)
        else:
            for k in range(D-1,-1,-1):
                if (G - (tmp + (k+1)*100*memo[k])) < 0:
                    count += (G-tmp)// ((k+1)*100) 
                    count += 1 if (G-tmp)% ((k+1)*100) !=0 else 0
                    res = min(res,count)
                else:
                    tmp += (k+1)*100*memo[k]
                    count += memo[k]

print(res)


Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	long long int a, b, x;
	scanf("%lld %lld %lld", &a, &b, &x);
	long long int r = b/x - (a-1)/x;
	if(a == 0 && x != 1){
		r++;
	}
	printf("%lld", r);
	return 0;
}

Measured memory_bytes: 128
//XOR_IS_FRUSTRATED

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;


#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define rep(a,x,b) for(a=x;a<b;a++)
#define repv(a,it) for(auto it=a.begin();it!=a.end();it++)
#define repr(a,x,b) for(a=x;a>=b;a--)
#define pb 
#define mm(a,x) memset(a,x,sizeof(a))
#define all(v) (v).begin(), (v).end()
#define pll pair<ll, ll>
#define mp map<pair<ll,ll>,ll>
#define ret(a) return a
#define br break
#define con continue

ll mod=pow(10,9)+7;
ll n,m,a[1000005],i,j,t,k;
ll prime[1000005]={0};
vector<ll>vprime;
ll max3(ll a, ll b, ll c)
{
        ret(max(a,max(b,c)));
}
ll min3(ll a, ll b, ll c)
{
        ret(min(a,min(b,c)));
}
ll inv(ll x1,ll y1)
{
        if(y1==0)
                ret(1);
        ll temp=inv(x1,y1/2);
        temp=(temp*temp)%mod;
        if(y1%2)
                temp=(temp*x1)%mod;
        ret(temp);        
}
ll inv1(ll a1,ll m1)
{
        ll m0=m1,x0=0,y0=1;
        if(m1==1)
                ret(0);
        while(a1>1)
        {
                ll q=a1/m1;
                ll temp=m1;
                m1=a1%m1;
                a1=temp;
                temp=y0;
                y0=x0-q*y0;
                x0=temp;
        }
        x0=(x0+m0)%m0;
        ret(x0);
}

void sieve()
{
        rep(i,2,1000)
        {
                if(prime[i]==0)
                {
                        
                        for(j=i*i;j<=1000000;j+=i)
                                prime[j]=1;
                }
        }
        rep(i,2,1000001)
        {
                if(prime[i]==0)
                    vprime.push_back(i);
        }
}

int main()
{
        
        fastio;
        cin>>n;
        n=pow(n,3);
        cout<<(n);
        
        
        
        
        
        
        ret(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,g=0;cin>>n;
 double d;cin>>d;
  for(int i=0;i<n;i++)
  { long long int a,b;cin>>a>>b;
    long long int p=(a*a)+(b*b);
    if(sqrt(p)<=d)
       g++;
  }
  cout<<g;
  return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;

int main(){
//srandom((unsigned long)time(NULL));

int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
int cnt=0;
for(int i=0;i<n;i++){
    int minj = i;
    for(int j=i;j<n;j++){
        if(a[j] < a[minj]){
            minj=j;
            
        }
    }
    if(i!=minj){
            cnt++;
            int tmp=a[i];
            a[i]=a[minj];
            a[minj]=tmp;
    }
    
}
for(int i=0;i<n-1;i++){
    cout<<a[i]<<" ";
}
cout<<a[n-1]<<endl;
cout<<cnt<<endl;

return 0;
}




Measured memory_bytes: 3104
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<int> as(N);
  F0R(i, N) {
    cin >> as[i];
  }
  sort(rng(as));

  bitset<1000001> sv(false);

  int prev = -1;
  int result = 0;
  F0R(i, N) {
    if (as[i] == prev) {
      result--;
      prev = -1;
      continue;
    }

    if (sv.test(as[i])) {
      // result += 0;
    }
    else {
      result++;
      prev = as[i];

      for (int n = as[i]; n <= 1000000; n += as[i]) {
        sv.set(n);
      }
    }
  }

  cout << result;
}
#endif


Measured memory_bytes: 4256
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define fi first
#define se second
#define db double
#define ld long db
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}

signed main()
{
	string s,t;cin>>s>>t;cout<<t<<s;
	return 0; 
}

Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int a[SIZE], b[SIZE], c[SIZE];
    for( int i = 0; i < n; ++i ) cin >> a[i];
    for( int i = 0; i < n; ++i ) cin >> b[i];
    for( int i = 0; i < n; ++i ) cin >> c[i];

    sort( a, a + n );
    sort( c, c + n );

    LL res = 0;
    for( int i = 0; i < n; ++i ) {
        LL a_pos = lower_bound( a, a + n, b[i] ) - a;
        LL b_pos = n - ( upper_bound( c, c + n, b[i] ) - c );

        res += a_pos * b_pos;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define endl '\n'
#define INF (1 << 21)
const int MOD = 1000000007;
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int q;
  int c, a, n;
  int ans;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    ans = 0;
    cin >> c >> a >> n;
    while(c > 0 && a > 0 && n > 0){
      ans ++;
      c--; a--; n--;
    }
    
    while(c >= 2 && a > 0){
      ans ++;
      c -= 2; a--;
    }
    
    while(c >= 3){
      ans ++;
      c -= 3;
    }
    cout << ans << endl;
  }
  
  return 0;
}




Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;
ll a[MAX_N];

ll solve(int N, int sign) {
  ll ans = 0;
  ll S = 0;
  REP(i, N) {
    S += a[i];
    if (sign == 1 && S <= 0) {
      ll d = 1 - S;
      ans += abs(d);
      S += d;
    }
    if (sign == -1 && S >= 0) {
      ll d = S - (-1);
      ans += abs(d);
      S -= d;
    }
    sign *= -1;
  }
  return ans;
}

int main2() {
  int N = nextInt();
  REP(i, N) a[i] = nextInt();

  ll ans1 = solve(N, +1);
  ll ans2 = solve(N, -1);
  
  cout << min(ans1, ans2) << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N;
  cin >> N;
  ll p[N];
  rep(i,N) cin >> p[i];
  sort(p,p+N);
  ll ans;
  rep(i,N-1) ans += p[i];
  ans +=p[N-1]/2;
  cout << ans << endl;

  return 0;
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    int n,d,x,a[110],sum=0;
    cin>>n>>d>>x;
    REP(i,n)cin>>a[i];
    REP(i,n)sum+=(d-1)/a[i]+1;
    cout<<sum+x<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

#include <bits/stdc++.h>
using namespace std;

template<typename T>
void cmpmax(T& reference, T value) {
	reference = max(reference, value);
}

template<typename T>
void cmpmin(T& reference, T value) {
	reference = min(reference, value);
}

const ll mod = 1000000007;

static const ll INF = 1e15;

int main() {
	int n;
	cin >> n;
	vector<vector<bool>> match(n, vector<bool>(n));
	rep(i, n) {
		rep(j, n) {
			int a;
			cin >> a;
			match[i][j] = a;
		}
	}
	//dp[i]...女性のマッチング状態iに対する組み合わせの回数
	//__builtin_popcountllがマッチング数
	vector<ll> dp(1LL << n, 0);
	dp[0] = 1;
	rep(state, 1LL << n) {
		ll c = dp[state];
		if (c == 0) continue;
		ll p = __builtin_popcountll(state);
		//今p人がマッチングしているため、つぎにチェックするのはp人目の男性
		if (p == n) continue;
		for (int k = 0; k < n; k++) {
			//すでにマッチングしている
			if (state & (1LL << k)) continue;
			ll nstate = state | (1LL << k);
			if (match[p][k]) {
				dp[nstate] += dp[state];
				dp[nstate] %= mod;
			}
		}
	}
	cout << dp[(1LL << n) - 1] << endl;
	return 0;
}
	


Measured memory_bytes: 16640
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 10000005
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>
const ll N = 10000000;

ll M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;


ll fact[MAX_INT];
ll invfact[MAX_INT];

ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}

ll modPow(ll a, ll b, ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

ll modInv(ll x) {
	return modPow(x, MOD - 2, MOD);
}

void precompute() {
	fact[0] = 1;
	fei(i, 1, N, 1) {
		fact[i] = modMul(fact[i - 1], i);
	}
	invfact[N] = modInv(fact[N]);
	for(int i = N - 1; i >= 0; i--) {
		invfact[i] = modMul(invfact[i + 1], i + 1);
	}
}

ll ncr(ll n, ll r) {
	if(n < r) {
		return 0;
	}
	ll ans = fact[n];
	ans = modMul(ans, invfact[r]);
	ans = modMul(ans, invfact[n - r]);
	return ans;
} 


int main() {
	go;
    cin >> M;
    cin >> S;
    ll sz = S.size();
    ll ans = 1;
    ll finalAns = 0;
    precompute();
    // cout << ncr(4, 2);
    fel(i, 0, M, 1) {
    	ans = 1;
    	ll val = ncr(M - i + sz - 1, sz - 1);
    	// trace3(i, M - i, val);
    	ans = modMul(ans, modMul(modPow(26ll, i, MOD), modPow(25ll, M - i, MOD)));
    	ans = modMul(ans, ncr(M - i + sz - 1, sz - 1));
    	finalAns = modSum(finalAns, ans);
    }
    cout << finalAns << "\n";
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 160528
/*  ex6_2
    Rikuta  */

#include <stdio.h>
#include <string.h>
#define LIM 101
int main(void){
    char word[LIM];
    fgets(word,LIM,stdin);
    for (int i = 0; i < LIM; i++)
    {
        if (word[i]=='\n')
        {
            word[i]='\0';
        }
        
    }
    
    printf("%c%d%c\n",word[0],(int)strlen(word)-2,word[strlen(word)-1]);
    return 0;
}

Measured memory_bytes: 128
a=int(input())
b=[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]
c=b[a-1]
print(c)


Measured memory_bytes: 2940
import heapq
n,m = map(int,input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a,-1*(-tmp_min//2))
print(-sum(a))

Measured memory_bytes: 14180
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	string s;
	cin >> s;
	int ans = 0;
	for(char c : s){
		ans += (c-'0');
		ans %= 9;
	}
	if(ans == 0)cout << "Yes";
	else cout << "No";
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
const int N=2e6+5;
int n,m,K,i,j,l,lst,tim;
vector<int>a[N];
char s[N],t[N];
set<int>S;
inline void out(char*s){
	for(i=N-1;!s[i];--i);reverse(s+1,s+i+1);for(;i;s[i--]+=48);puts(s+1);
}
inline void ins(int i){
	auto it=S.lower_bound(i);
	if(it!=S.end() && *it-i<=K-tim)a[*it-i+tim].push_back(*it);else a[K].push_back(i+K-tim);
	s[i]=t[i]=0;
}
int main(){
	scanf("%d%d%d%s%s",&n,&m,&K,s+1,t+1);
	reverse(s+1,s+n+1);reverse(t+1,t+m+1);
	for(i=1;i<=n;++i)s[i]-=48;for(i=1;i<=m;++i)t[i]-=48;
	for(i=1;i<=max(n,m);++i)if(s[i]!=t[i])S.insert(i);
	for(i=max(n,m);i;--i)if(s[i] && t[i])ins(i);
	for(tim=1;tim<=K;++tim){
		vector<int>tmp;
		for(int j:a[tim]){
			int jws=1,jwt=1,k=j;
			for(;(jws && s[k]) || (jwt && t[k]);++k){
				jws+=s[k];s[k]=jws&1;jws>>=1;
				jwt+=t[k];t[k]=jwt&1;jwt>>=1;
				if(s[k]==t[k])S.erase(k);
				if(s[k] && t[k])tmp.push_back(k);
			}
			if(s[k]!=t[k])S.erase(k);
			s[k]+=jws;t[k]+=jwt;if(s[k]!=t[k])S.insert(k);else if(s[k])tmp.push_back(k);
		}
		if(tim<K)for(int x:tmp)ins(x);
	}
	out(s);out(t);
	return 0;
}

Measured memory_bytes: 96088
#include <bits/stdc++.h>
using namespace std;

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main(void){
    int r;
    cin >> r;
    cout << (3*r*r) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int swap_and_add(int *taro,int n,int *hanako,int m,int a,int b);

int main(void){

  int n,m;
  int i,j;
  while(1){
    int taro_cards[101]={0};
    int hanako_cards[101]={0};
    int min_sum;
    int taro_change;
    int hanako_change;
    int check; 
    char counter=0;

    scanf("%d%d",&m,&n);
    if(m==0 && n==0){break;}

    for(i=0;i<m;i++){
      scanf("%d",&taro_cards[i]);
    }

    for(i=0;i<n;i++){
      scanf("%d",&hanako_cards[i]);
    }

    for(i=0;i<m;i++){
      for(j=0;j<n;j++){
	check=swap_and_add(taro_cards,m,hanako_cards,n,i,j);

	if(check!=0 && counter==0){
	  taro_change=taro_cards[i];
	  hanako_change=hanako_cards[j];
	  min_sum=check;
	  counter++;
	}
	else if(check!=0 &&counter!=0){
	  if(min_sum >check){
	    taro_change=taro_cards[i];
	    hanako_change=hanako_cards[j];
	    min_sum=check;
	  }
	}
      }
    }

    if(counter==0){printf("-1\n");}
    else if(counter!=0){ printf("%d %d\n",taro_change,hanako_change);}
  }
  return 0;
}

int swap_and_add(int *taro,int m,int *hanako,int n,int i,int j){
  int temp;
  int k;
  int taro_sum=0;
  int hanako_sum=0;
  int taro_cpy[101]={0};
  int hanako_cpy[101]={0};

  for(k=0;k<m;k++){
    taro_cpy[k]=taro[k];
  }

  for(k=0;k<n;k++){
    hanako_cpy[k]=hanako[k];
  }

  temp=taro_cpy[i];
  taro_cpy[i]=hanako_cpy[j];
  hanako_cpy[j]=temp;

  for(k=0;k<m;k++){
    taro_sum+=taro_cpy[k];
  }

  for(k=0;k<n;k++){
    hanako_sum+=hanako_cpy[k];
  }

  if(taro_sum==hanako_sum){
    return taro_sum;
  }

  else{
    return 0;
  }

}

Measured memory_bytes: 612
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = input()
    if len(n) == 1:
        print(n)
        exit()
    allnine = True
    for i in range(1,len(n)):
        if n[i] == '9':
            pass
        else:
            allnine = False
    if n[0] == '9' and allnine:
        print(9 * len(n))
        exit()
    if n[0] == '1' and allnine:
        print(1 + (len(n)-1) * 9)
        exit()
    if n[0] != '1' and allnine:
        print(int(n[0]) + (len(n)-1) * 9)
        exit()
    print(int(n[0]) + (len(n)-1) * 9 - 1)

if __name__ == '__main__':
  main()


Measured memory_bytes: 5404
n = int(input())
book = []
for i in range(n):
    s, p = input().split()
    p = int(p)
    book.append([i+1, s, p])

book.sort(key=lambda x:x[2], reverse=True)
book.sort(key=lambda x:x[1])
for i in range(n):
    print(book[i][0])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x << endl
#define De(...)
using namespace std; 

int _; 

int n,ans[10050];
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		ans[i]=0;
	for(int x=1;x*x <= n;x++)
		for(int y=1;y*x <= n;y++)
			for(int z=1;z*x+y*x <= n;z++)
				if(x*x+y*y+z*z+x*y+x*z+y*z <= n) 
					ans[x*x+y*y+z*z+x*y+x*z+y*z]++;
	for(int i=0;i<n;i++)
		printf("%d\n",ans[i+1]);
	return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
//#define int long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
#define endl '\n'
#define fori(s,n) for(int i=s;i<n;i++) 
#define forj(s,n) for(int j=s;j<n;j++) 
#define vii vector<int>
#define pii pair<int,int>
int n;
vector<vii> v;
int maxi = 0;
int dp[100005][3];
int solve(int x, int y) {//{0,0} intially
	
	if (x == n) {
		return 0;
	}
	int& ret = dp[x][y];
	if (ret != -1) return ret;
	if (y != 0 || x == 0)
		ret = max(ret, v[x][0] + solve(x + 1, 0));
	if (y != 1 || x == 0)
		ret = max(ret, v[x][1] + solve(x + 1, 1));
	if (y != 2 || x == 0)
		ret = max(ret, v[x][2] + solve(x + 1, 2));
	return ret;
}
signed main()
{
	fast;
    memset(dp, -1, sizeof(dp));
	cin >> n;
	v = vector<vii>(n, vii(3));
	fori(0, n)
		forj(0, 3)
		cin >> v[i][j];
	cout << solve(0, 0) << endl;
}

Measured memory_bytes: 17716
main :: IO ()
main = do
   s <- getLine
   print $ solve s

solve :: String -> Int
solve = inner 0 0
  where
    inner x _       []  = x
    inner x 0 ('p' : s) = inner (x - 1) 1 s
    inner x p ('p' : s) = inner x (p - 1) s
    inner x 0 ('g' : s) = inner x 1 s
    inner x p ('g' : s) = inner (x + 1) (p - 1) s


Measured memory_bytes: 4988
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, X;
  cin >> N >> X;
  vector<int> B(N+1, 0);
  int p;
  for (int i=1; i<N+1; i++) {
    cin >> p;
    B[i]=B[i-1]+p;
  }
  
  int C=0;
  for (int i=0; i<N+1; i++) {
    if (B[i]>X) {break;}
    C++;
  }
  cout << C << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

int main() {
    long long n, k, ret = 0;
    std::cin >> n >> k;

    if (k == 0) {
        std::cout << n * n << std::endl;
        return 0;
    }

    for (auto a = k + 1; a <= n; a++) {
        ret += n / a * (a - k) + std::max(0ll, (n % a) - k + 1);
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 256
//
// Created on 2018-12-08.
//
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<(n);++i)
#define RFOR(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }

#define PB push_back
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vs> vvs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);


    int N, H, W;
    cin >> N >> H >> W;

    cout << (N-H+1)*(N-W+1) << '\n';

    return 0;

}

Measured memory_bytes: 256
// ABC167C
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
const int INF=1001001001;
int a[12][12];
int main() {
	int n,m,x;

	cin>>n>>m>>x;
	vector<int> c(n);
	rep(i,n){
		cin >> c[i];
		rep(j,m) cin >> a[i][j];
	}
	int ans=INF;
	rep(s,1<<n){
		int cost=0;
		vector<int> d(m);
		rep(i,n){
			if (s>>i&1){
				cost+=c[i];
				rep(j,m) d[j] += a[i][j];
			}
		}
		bool ok=true;
		rep(j,m) if(d[j]<x) ok=false;
		if (ok) ans=min(ans,cost);
	}
	if (ans==INF) cout << -1 <<endl;
	else cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 3628
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 5121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ

pair<int,int>p[110000];
int rm[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		int s,t;scanf("%d%d",&s,&t);
		p[i]=make_pair(s,t);
	}
	std::sort(p,p+a);
	int ret=0;
	int R=mod;
	int rv=mod;
	for(int i=a-1;i>=0;i--){
		rm[i]=rv;
		rv=min(rv,p[i].second);
	}
	for(int i=0;i<a-1;i++){
		int R1=p[i].second;
		int R2=rm[i];
		ret=max(ret,max(0,min(R,R1)-p[i].first+1)+max(0,R2-p[a-1].first+1));
		ret=max(ret,max(0,R1-p[i].first+1)+max(0,min(R,R2)-p[a-1].first+1));
		
		R=min(R,p[i].second);
		
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1280
fun main(args: Array<String>) {
    var (a, aa) = getLongs()
    var (b, bb) = getLongs()
    val t = getLong()

    if (b < a) {
        val temp = a
        a = b
        b = temp
    }

    if (a >= b || a + t * aa >= b + t * bb)  {
        println("YES")
    } else {
        println("NO")
    }
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }

Measured memory_bytes: 36320
n,m=map(int,input().split())
a=[]
ans=0
for i in range(n):
    a.append(list(map(int,input().split())))
a=sorted(a)
for i in range(n):
    m=m-a[i][1]
    if(m<=0):
        ans+=a[i][0]*(a[i][1]+m)
        break
    else:
        ans+=a[i][1]*a[i][0]
print(ans)

Measured memory_bytes: 28652
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main(){
  int n,m;
  cin>>n>>m;
  vector<vector<int>> jobs(m);
  rep(i,n){
    int a,b;
    cin>>a>>b;
    if(a>m) continue;
    jobs[m-a].push_back(b);
  }
  priority_queue<int> q;
  ll ans=0;
  for(int i=m-1;i>=0;--i){
    for(int b : jobs[i]){
      q.push(b);
    }
        if(!q.empty()){
          ans += q.top();
          q.pop();
        }
        }
        cout<<ans<<endl;
        }




Measured memory_bytes: 5632
sx, sy, tx, ty = map(int, input().split())

distx = tx - sx
disty = ty - sy

for k in range(2):
    if k:
        distx += 1
        disty += 1
        print('D',end='')
    for i in range(distx):
        print('R',end='')
    for i in range(disty):
        print('U',end='')
    if k:
        print('L',end='')
        print('U',end='')
    for i in range(distx):
        print('L',end='')
    for i in range(disty):
        print('D',end='')
    if k:
        print('R')

Measured memory_bytes: 4468
#include<iostream>
#include<map>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// mint
template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};
int64_t const MOD = 1e9+7;
typedef mod_int<MOD> mint;

int64_t gcd(int64_t a, int64_t b) {
  int64_t r = a%b;
  while(r){ a=b; b=r; r=a%b; }
  return b;
}

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  int z = 0;
  std::map<std::pair<int64_t,int64_t>,int> m1, m2;
  for(int i = 0; i < N; ++i) {
    int64_t A, B; std::cin >> A >> B;
    if(A == 0) {
      if(B == 0) ++z;
      else ++m1[std::make_pair(0,1)];
    } else {
      if(B == 0) ++m2[std::make_pair(0,1)];
      else {
        int64_t l = gcd(A, B); A/=l; B/=l;
        if(A < 0) { A=-A; B=-B; }
        if(B > 0) ++m1[std::make_pair(A, B)];
        else ++m2[std::make_pair(-B, A)];
      }
    }
  }
  int f = 0;
  for(auto const& p :m1) if(m2.count(p.first) < 1) f += p.second;
  for(auto const& p :m2) if(m1.count(p.first) < 1) f += p.second;
  mint ans = mint(2).pow(f);
  for(auto const& p :m1) if(m2.count(p.first)) {
    ans *= mint(2).pow(p.second) + mint(2).pow(m2[p.first]) - 1;
  }
  ans += z-1;
  fin(ans.v_);
  return 0;
}



Measured memory_bytes: 16064
#include <bits/stdc++.h>
using namespace std;

long long N;
long long A[200010];
long long Narr[200010];
int main ()
{
    cin >> N;
    memset(Narr, 0,sizeof(Narr));
    for(int i = 1; i <= N; i++) 
    {
        cin >> A[i];
        Narr[A[i]]++;
    }

    long long N2 = 0;
    for(int j = 1; j <= N; j++)
    {
        N2 += (Narr[j] * (Narr[j] - 1)) / 2;
    }

    for(int k = 1; k <= N; k++)
    {
        long long res;
        res = N2 - (Narr[A[k]] - 1);

        cout << res << endl;
    }

}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
const int INF = (int)2e9 + 1;
const long long LINF = (long long)9e18 + 1;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, T;
  vector<vector<int>> dp(3005, vector<int>(3005));

  cin >> N >> T;
  vector<pair<int, int>> cooking;

  for (int i = 0; i < N; i++) {
    int A, B;
    cin >> A >> B;
    cooking.push_back(make_pair(A, B));
  }
  cooking.push_back(make_pair(0, 0));

  sort(cooking.begin(), cooking.end());

  int ans = 0;
  dp[0][0] = 0;

  for (int i = 1; i <= N; i++) {
    for (int j = 0; j < T; j++) {
      dp[i][j] = dp[i - 1][j];
      ans = max(ans, cooking[i].second + dp[i - 1][j]);
      if (j - cooking[i].first >= 0) {
        dp[i][j] =
            max(dp[i][j], dp[i - 1][j - cooking[i].first] + cooking[i].second);
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 37760
s = []
s.append(list(input()))
s.append(list(input()))
s.append(list(input()))

a = ['A', 'B', 'C']
n = s[0].pop(0)
while True:
  i = 0
  if n == 'a':
    i = 0
  elif n == 'b':
    i = 1
  elif n == 'c':
    i = 2
  if len(s[i]) == 0:
    print(a[i].upper())
    exit()
  else:
    n = s[i].pop(0)
    


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
#define mod 1'000'000'007
typedef long long ll;
 
 
void solve(){
	int n ;
	int m ;
	std::cin>> n>>m;
	std::cout<<n*m<<endl;
	
}
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	ll t = 1;
	//cin >> t;
	while (t--)
		solve();
	return 0;
}
 
 
 
 
//                     __  __           _            _    ____                     _
//                    |  \/  | __ _ ___| | _____  __| |  / ___|__ _ _ __ _ __ ___ | |_
//                    | |\/| |/ _` / __| |/ / _ \/ _` | | |   / _` | '__| '__/ _ \| __|
//                    | |  | | (_| \__ \   <  __/ (_| | | |__| (_| | |  | | | (_) | |_
//                    |_|  |_|\__,_|___/_|\_\___|\__,_|  \____\__,_|_|  |_|  \___/ \__|
//    d

Measured memory_bytes: 3584
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll xx=0,yy=0,h,w,n,z=0,min=100000000000,k,ans=0;
    string s1,s2,s3;
    cin >> w >> h >> n;
    VI x(n);
    VI y(n);
    VI a(n);
    rep(i,n){
        cin >> x[i] >> y[i] >> a[i];
    }
    rep(i,n){
        if(a[i]==1){
            if(x[i] > xx){
                xx = x[i];
            }
        }
        else if (a[i]==2){
            if(w > x[i]){
                w = x[i];
            }
        }
        else if (a[i]==3){
            if(y[i] > yy){
                yy = y[i];
            }
        }
        else {
            if(h > y[i]){
                h = y[i];
            }
        }
    }
    if(w<xx||h<=yy) cout << 0 <<endl; 
    else cout << abs(h-yy)*abs(w-xx) <<endl; 
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f,N=1e6;
int n,m,cnt;
char ch[N];
queue<int>q;
int du[N],a[N],fir[N],to[N],nxt[N],p[N],l[N],r[N];
long long ans;
inline void add(int u,int v)
{
	to[++cnt]=v,nxt[cnt]=fir[u],fir[u]=cnt;du[v]++;
}
int mian()
{
	
}
int cmp(int x,int y)
{
	if((x==m))return 1;if(y==m)return 0;
	return l[x]<l[y];
}
int px[N],pn[N],sx[N],sn[N];
int main()
{
	scanf("%d",&n);r[0]=1e9+2;
	for(int i=1;i<=n;i++)
	{scanf("%d%d",&l[i],&r[i]);if(r[i]<r[m])m=i;p[i]=i;}
	sort(p+1,p+n+1,cmp);pn[0]=1e9+2;//cout<<m<<endl;
	//for(int i=1;i<=n;i++)cout<<p[i]<<endl;
	for(int i=1;i<=n;i++)px[i]=max(px[i-1],l[p[i]]),pn[i]=min(pn[i-1],r[p[i]]);sn[n+1]=1e9+2;
	for(int i=n;i;i--)sx[i]=max(sx[i+1],l[p[i]]),sn[i]=min(sn[i+1],r[p[i]]);
	for(int i=1;i<n;i++)
	{
		int L=max(0,pn[i]-px[i]+1),R=max(0,sn[i+1]-sx[i+1]+1);
		ans=max(ans,(long long)L+R);
	}
	for(int i=2;i<n;i++)
	{
		int L=max(0,min(pn[i-1],sn[i+1])-max(px[i-1],sx[i+1])+1),R=max(0,r[p[i]]-l[p[i]]+1);
		ans=max(ans,(long long)L+R);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 19072
MOD = 1_000_000_007
io = STDIN
H,W,K=io.gets.split.map(&:to_i)
# 0   1   2   3   縦棒番号に該当 W==4
#   0   1   2  　　横棒位置
# | - | - | - |
#  0   --- o
#  1   --1 o
#  2   -1- o
#  3   -11 x
#  4   1-- o
#  5   1-1 o
#  6   11- x
#  7   111 x
#
# 0   1   2      縦棒番号に該当 W==3
#   0   1     　　横棒位置
# | - | - |
#  0   -- o
#  1   -1 o
#  2   1- o
#  3   11 x
#
require 'set'
DP=Array.new(H+1){Array.new(W,0)}
def cal_masks
  masks=Set.new
  (2**(W-1)).times do |mask|
   next if (0...(W-1)).each_cons(2).map do |a,b|
     # p [a,b,mask[a] & mask[b]]
     mask[a] & mask[b]
   end.any?{|b|b==1}
   # p (0...(W-1)).map{|m|mask[m]}.join(",")
   masks << mask
  end
  masks
end
def countup(h,mask)
  (0...W).each do |w|
    if mask[w]==1
      DP[h+1][w]+=DP[h][w+1]
      DP[h+1][w]%=MOD
    else
      if mask[w-1]==1
        DP[h+1][w]+=DP[h][w-1]
        DP[h+1][w]%=MOD
      else
        DP[h+1][w]+=DP[h][w]
        DP[h+1][w]%=MOD
      end
    end
    # p [" DP",mask,w,mask[w],DP]
  end
  # exit
end
DP[0][0]=1
masks=cal_masks
# masks  #w=3:[0, 1, 2]
         #w=4[0, 1, 2, 4, 5]
H.times do |h|
  masks.each do |mask|
    if W==1
      DP[h+1][0]+=DP[h][0]
      DP[h+1][0]%=MOD
    else
      countup(h,mask)
    end
  end
end
require 'pp'
p DP[H][K.pred]


Measured memory_bytes: 2556
#include <stdio.h>

#define INF 1000000
#define NIL -1
#define BLACK 1
#define WHITE 0
void prim(int);
int A[101][101],d[101],pi[101],color[101];

int main(){

  int i,j,n,sum=0;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&A[i][j]);
    }
  }

  prim(n);

  for(i=0;i<n;i++){
 
      sum+=d[i];
  }

  printf("%d\n",sum);

  return 0;
      
}

void prim(int n){

  int u,i,v,mincost;

  for(u=0;u<n;u++){
    d[u]=INF;
    pi[u]=NIL;
    color[u]=WHITE;
  }
  d[0]=0;
  while(1){
    mincost=INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    if(mincost==INF) break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && A[u][v]<d[v] && A[u][v]!=-1){
	pi[v]=u;
	d[v]=A[u][v];
      }
    }
  }
  
}

Measured memory_bytes: 640