akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
const ll mod = 1000000007;

ll modpow(ll a, ll n)
{
  ll res=1;
  while (n>0) {
    if (n&1) res = res*a % mod;
    a = a*a % mod;
    n >>= 1;
  }
  return res;
}

// 逆元
ll modinv(ll a, ll m)
{
  ll b=m, x=1, y=0;
  while (b) {
    ll t = a/b;
    a -= t*b; swap(a, b);
    x -= t*y; swap(x, y);
  }
  x %= m;
  if (x<0) x += m;
  return x;
}

// 二項係数
ll choose(ll n, ll r, ll p)
{
  ll ret = 1;
  while(true) {
    if (r==0) break;
    ll N = n%p;
    ll R = r%p;
    if (N<R) return 0;
    for (ll i=0; i<R; i++) {
      ret = ret * (N-i) % p;
    }
    ll imul = 1;
    for (ll i=0; i<R; i++) {
      imul = imul * (i+1) % p;
    }
    ret = ret * modinv(imul, p) % p;
    n /= p;
    r /= p;
  }
  return ret;
}


int main()
{
  ll n; cin >> n;
  ll a; cin >> a;
  ll b; cin >> b;
  ll ans = (modpow(2, n) + mod - 1) % mod;
  ans = (ans + mod - choose(n, a, mod)) % mod;
  ans = (ans + mod - choose(n, b, mod)) % mod;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

using namespace std;

int main(){

	int N,table[200030],a,b,S,tmp;

	for(int i = 0; i < 200030; i++)table[i] = 0;

	scanf("%d",&N);

	for(int loop = 0; loop < N; loop++){
		scanf("%d %d",&a,&b);
		table[a+b]++;
	}

	for(int i = 0; i < 200030; i++){
		if(table[i] != 0){ //?????°???????§£??????
			tmp = table[i];
			table[i] = 0;
			S = 2;
			for(int k = 0; tmp != 0;k++,tmp /= S){
				if(tmp%S == 1){
					table[i+k]++;
				}
			}
		}
	}

	for(int i = 0; i < 200030; i++){
		if(table[i] != 0){
			printf("%d 0\n",i); //0??§????????????1??????2????????§???0
		}
	}

    return 0;
}

Measured memory_bytes: 3528
//kalyanchirla
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
#define int long long
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define csl ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007

int32_t main()
{ 
    csl;

    int d,t,s;
    cin >> d >> t >> s;
    float f = float(d)/float(s);
    if(f<=t)
    {
        cout << "Yes" << "\n";
    }
    else
    {
        cout << "No" << "\n";
    }
}

Measured memory_bytes: 3648
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

;; experiment
(defun %test (init-x init-y)
  (let* ((init-sum (+ init-x init-y))
         (dp (make-array (list (+ 1 init-sum) (+ 1 init-sum)) :element-type 'bit :initial-element 0)))
    (dotimes (sum (+ init-x init-y 1))
      (dotimes (x (+ sum 1))
        (let ((y (- sum x)))
          (if (loop for delta from 1 to (floor (max x y) 2)
                    thereis (or (and (<= (* delta 2) x)
                                     (zerop (aref dp (- x (* delta 2)) (+ y delta))))
                                (and (<= (* delta 2) y)
                                     (zerop (aref dp (+ x delta) (- y (* delta 2)))))))
              (setf (aref dp x y) 1)
              (setf (aref dp x y) 0)))))
    dp))

(defun main ()
  (write-line (if (<= (abs (- (read) (read))) 1)
                  "Brown"
                  "Alice")))

#-swank(main)


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    string S;
    cin >> S;
    ll n = S.size();
    map<ll, ll> resMap;
    const ll mod = 2019;
    REP(i, mod)
    {
        resMap[i] = 0;
    }
    resMap[0]++;

    ll res = 1;
    ll resPrev = 0;
    REP(i, n)
    {
        ll digitNow = S[n - 1 - i] - '0';
        ll resNow = (digitNow * res % mod + resPrev) % mod;
        resMap[resNow]++;
        res = (res * 10) % mod;
        resPrev = resNow;
    }

    ll ans = 0;
    REP(i, mod)
    {
        ll count = resMap[i];
        if (count >= 2)
        {
            ans += count * (count - 1) / 2;
        }
    }

    cout << ans << endl;
}


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

typedef long long ll;

int main()
{
    int n;
    vector<int> a;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);        
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int hugo = (i%2 == 0) ? 1: -1;
        ans += hugo * a[i];
    }
    cout << ans;
    for (int i = 1; i < n; i++)
    {
        ans = (2 * a[i - 1]) - ans;
        cout << " " <<ans;
    }
    cout << endl;
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n;cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll ans=0;
    ll tmp=0;

    for(int i=0;i<n;i++){
        tmp+=a[i];
        if(a[i]==0){
            ans += tmp/2;
            tmp = 0;
        }
    }
    ans += tmp/2;

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

const int m = 100;

int main(){
    int A, B;
    while(cin >> A >> B){
        vector<string> res(m, string(m, '.'));
        for(int i=0;i<m/2;i++){
            for(int j=0;j<m;j++) res[i][j] = '#';
        }
        int x = 0, y = 0;
        for(int i=0;i<A-1;i++){
            res[y][x] = '.';
            x += 2;
            if(x >= m){ x = 0; y += 2; }
        }
        x = 0, y = m-1;
        for(int i=0;i<B-1;i++){
            res[y][x] = '#';
            x += 2;
            if(x >= m){ x = 0; y -= 2; }
        }
        cout << m << " " << m << endl;
        for(auto& s : res) cout << s << endl;
    }
}

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
//------------------------------------------------------------------------------------------------------------------------------

int N;
int C;
vector<vector<P>> V(N);
void func(int par, int chi, int color) {
    if (par != -1){
        V[par][chi].second = color;
        V[chi][par].second = color;
    }
    int c = color;
    for (int i = 0; i < V[chi].size(); i++) {
        if(V[chi][i].first != par){
            c++;
            func(chi, V[chi][i].first, c % C);
        }
    }
    return;
}

int main(void) { 
    ll N, K;
    cin >> N >> K;
    ll x = N / K;
    ll y = 0;
    for(int i = 1; i <= N; i++) {
        if (i % K == K / 2) y++;
    }
    if (K % 2 == 0) {
        cout << x * x * x + y * y * y << endl;
    }
    else{
        cout << x * x * x << endl;
    }

}


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

int inc(int n, int max, int cnt) {
    if (n > max) {
        return 0;
    } else if (n == max) {
        return 1;
    } else {
        return inc(n + cnt + 1, max, cnt + 1);
    }
}

int soci(int n)
{
    int res = 0;
    for (int i = 1; i < n; ++i) {
        res += inc(i, n, i);
    }
    return res;
}

int main(int argc, char *argv[])
{
    int n;
    while (cin >> n, n) {
        cout << soci(n) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") 
#include <iostream>
#include <algorithm>
#include <vector>
#include <string> 
#include <array>
using std::cin; using std::cout;
using std::max; using std::min;
using std::vector; using std::string;
using ll=long long;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
template<class T, class U> bool ckmin(T &a, U b){return (a>b? a=b, true : false);}
template<class T, class U> bool ckmax(T &a, U b){return (a<b? a=b, true: false);}
int main(){
    ll r, d;
    cin>>r >> d;
    ll cur;
    cin>>cur;
    for(int i=1;i<=10;i++){
        cur = r*cur-d;
        cout<<cur<<"\n";
    }
    
}




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

int main()
{
  int64_t H, W, A, B;
  cin >> H >> W >> A >> B;
  for (int h = 0; h < H; h++)
  {
    for (int w = 0; w < W; w++)
    {
      if (h < B)
        cout << ((w < A) ? 0 : 1);
      else
        cout << ((w < A) ? 1 : 0);
    }
    cout << endl;
  }
}

Measured memory_bytes: 1280
roop_num = int(input())
values = [int(value) for value in input().split()]

exchange_num = 0

while roop_num:
  for i in range(1,roop_num):
    if values[i - 1] > values[i]:
      values[i - 1], values[i] = values[i], values[i - 1]
      exchange_num += 1
  roop_num -= 1

ans = map(lambda value:str(value), values)

print(' '.join(ans).strip())
print(exchange_num)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
typedef uint64_t ll;
using std::cout ;
using std::endl ;
using std::cin ;
using std::string ;
using std::vector ;
using std::set ;
using std::map ;
using std::pair ;
#define rep(i,n) for(int i=0, i##_end=(n); i<i##_end; i++)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
template<class T>bool updateMax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool updateMin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(c) c.begin(),c.end()
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

int main() {
    string S, T;
    cin >> S;
    cin >> T;
    int count = 0;
    rep(i,S.size()) {
        if(S[i] != T[i]) {
            count++;
        }
    }
    
    cout << count << endl;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

//
int main(void) {
    vector<int> a(5);
    rep(i,5) cin >> a.at(i);
    int k;
    cin >> k;
    int cnt=0;
    if(a.at(4)-a.at(0)>k){
        cnt=1;
    }
    if(cnt==0) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    sort(a.begin(),a.end());
    ll lb=0;
    ll ub=100000000000;
    while(ub-lb>1){
        ll mid=(lb+ub)/2;
        ll pat=0;
        for(ll i=0;i<n;i++){
            pat+=a.end()-lower_bound(a.begin(), a.end(), mid-a[i]);
        }
        if(pat<m){
            ub=mid;
        }else{
            lb=mid;
        }
    }
    vector<ll> b(n);
    b[0]=a[n-1];
    for(ll i=1;i<n;i++){
        b[i]=b[i-1]+a[n-1-i];
    }
    ll ans=0;
    ll count=0;
    for(ll i=0;i<n;i++){
        ll j=a.end()-upper_bound(a.begin(), a.end(), lb-a[i]);
        if(j>0){
            ans+=b[j-1]+a[i]*j;
            count+=j;
        }
        //cout<<j<<" "<<ans<<endl;
    }
    ans+=lb*(m-count);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1920
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia;
		int j=1;
		for(int i = 0;i<n;i++) {
			if(a[i]==j){j++;}
		}
		Console.WriteLine("{0}",j==1?-1:n-j+1);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 33116
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		List<String> input=new ArrayList<String>(Arrays.asList(new Scanner(System.in).nextLine().split(" ")));
		int result=Integer.valueOf(input.get(0))*Integer.valueOf(input.get(1));
		String msg=result%2==0?"Even":"Odd";
		System.out.println(msg);

	}
}


Measured memory_bytes: 23764
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int p=1e9+7;
const int N=10000;

int Pow(int a,int b){
	int res=1;
	for (;b;b>>=1,a=1ll*a*a%p) if (b&1) res=1ll*res*a%p;
	return res;
}

struct Edge{
	int y,nxt;
} E[N];
pii stk[N];
vector<pii> V[N];
int las[N],dfn[N],low[N],fac[N],inv[N],vis[N];
int n,m,k,tot,cnt,num,res,top;

void Link(int x,int y){
	E[cnt]=(Edge){y,las[x]};las[x]=cnt++;
	E[cnt]=(Edge){x,las[y]};las[y]=cnt++;
}
int C(int n,int m){
	return 1ll*fac[n]*inv[m]%p*inv[n-m]%p;
}
int calc(int n){
	int res=0;
	For(i,1,n+1) res=(res+Pow(k,__gcd(i,n)))%p;
	res=1ll*res*Pow(n,p-2)%p;
	return res;
}
void dfs(int x){
	dfn[x]=low[x]=++tot;
	for (int i=las[x],y;~i;i=E[i].nxt)
		if (!vis[i/2]){
			vis[i/2]=1;
			y=E[i].y;
			stk[++top]=mp(x,y);
			if (!dfn[y]){
				dfs(y);
				low[x]=min(low[x],low[y]);
				if (low[y]>=dfn[x]){
					num++;
					do{
						V[num].pb(stk[top--]);
					} while (stk[top+1]!=mp(x,y));
				}
			} else{
				low[x]=min(low[x],dfn[y]);
			}
		}
}

int main(){
	fac[0]=1;
	For(i,1,N) fac[i]=1ll*fac[i-1]*i%p;
	inv[N-1]=Pow(fac[N-1],p-2);
	for (int i=N-1;i;i--) inv[i-1]=1ll*inv[i]*i%p;
	memset(las,-1,sizeof(las));
	n=IN(),m=IN(),k=IN();
	For(i,0,m) Link(IN(),IN());
	For(i,1,n+1) if (!dfn[i]) dfs(i);
	res=1;
	For(i,1,num+1){
		if (V[i].size()==1){
			res=1ll*res*k%p;
		} else{
			set<int> S;
			for (pii w:V[i]){
				S.insert(w.fi);
				S.insert(w.se);
				//printf("(%d,%d)\n",w.fi,w.se);
			}
			//for (int i:S) printf("[%d]\n",i);
			if (int(S.size())==int(V[i].size())){
				res=1ll*res*calc(int(S.size()))%p;
			} else{
				res=1ll*res*C(int(V[i].size())+k-1,k-1)%p;
			}
		}
	}
	printf("%d\n",res);
}

Measured memory_bytes: 640
#include<stdio.h>
long long int fact[2000006];
long long int modpow(long long int a, long long int n, long long int p)
{
	if (n < 0)
		return 0;
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
int main()
{
	long long int r1, r2, c1, c2;
	scanf("%lld %lld %lld %lld", &r1, &c1, &r2, &c2);
	long long int p = 1000000007;
	long long int i;
	fact[0] = 1;
	for (i = 1; i < 2000006; i++)
		fact[i] = fact[i - 1] * i % p;
	long long int ans = 0;
	ans = (ans + fact[r2 + c2 + 2] * modpow(fact[r2 + 1], p - 2, p) % p * modpow(fact[c2 + 1], p - 2, p) % p) % p;
	ans = (ans + fact[r1 + c1] * modpow(fact[r1], p - 2, p) % p * modpow(fact[c1], p - 2, p) % p) % p;
	ans = (ans + p - fact[r1 + c2 + 1] * modpow(fact[r1], p - 2, p) % p * modpow(fact[c2 + 1], p - 2, p) % p) % p;
	ans = (ans + p - fact[r2 + c1 + 1] * modpow(fact[r2 + 1], p - 2, p) % p * modpow(fact[c1], p - 2, p) % p) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 15744
#include <bits/stdc++.h>
#pragma GCC optimize("O999")
//#define long long ll
const int INF=0x3f3f3f3f;
const int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	double ans=1.0*((n+1)/2);
	cout<<fixed<<setprecision(10)<<ans/n<<endl;
	return 0;
}

Measured memory_bytes: 256
l = [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]
K = int(input())
print(l[K-1])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std ;
int main () {
  
  int N ;
  cin >> N;
  double a[N] ;
  for(int i =0 ; i < N ;i++)
    cin >> a[i] ;
  sort(a,a+N) ;
  double curr= (a[0] + a[1])/2 ;
  for(int i = 2 ; i <  N; i++)
    curr = (curr + a[i])/2 ;
  cout<<curr<<endl;
 
  
  
  return 0 ;
  
} 

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main()
{
    int sum,i,n,a[110],m,p,x;

    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    cin>>m;
    for(int j=0;j<m;j++){
        sum =0;
        cin>>p>>x;

        for(i=0;i<n;i++){
            if(i==p-1){
                sum =sum + x;
            }
            else
            sum = sum + a[i];
        }
    cout<<sum<<endl;
    }


}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		int num = Integer.parseInt(a + b);
		String result = "No";
		for(int i = 1; i*i <= num; i++) {
			if(i * i == num) {
				result = "Yes";
			}
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 26900
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << " = "<< x << "\n";

const int mod = 1000000007;
signed main() {
//	freopen("in.txt", "r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int n; cin >> n;
	
	int a[n];
	
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	int ans = 0;
	int sum = 0;
	
	for(int i = 0; i < n; i++) {
		ans += (a[i] * sum) % mod;
		ans %= mod;
		sum += a[i];
		sum %= mod;
	}
	
	cout << ans;
}


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

int main() {
    int n; cin >> n;
    int F[50];
    F[0] = F[1] = 1;
    for (int i = 2; i <= n; i++) F[i] = F[i-1] + F[i-2];

    cout << F[n] << endl;

    return 0;
}



Measured memory_bytes: 3096
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

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

int cnt[1000001] = {};

int main()
{
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  for(auto& a: A)
  {
    std::cin >> a;
    cnt[a]++;
  }
  std::sort(A.begin(), A.end());
  auto it = std::unique(A.begin(), A.end());
  A.erase(it, A.end());
  std::vector<bool> ans(A.back() + 1, true);
  for(auto val: A)
  {
    if(ans[val])
    {
      for(int j = 2 * val; j < ans.size(); j += val)
      {
        ans[j] = false;
      }
    }
  }
  int num = 0;
  for(auto val: A)
  {
    if(ans[val] && cnt[val] == 1)
      ++num;
  }
  std::cout << num << std::endl;
  return 0;
}



Measured memory_bytes: 8016
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

x,y=map(int,input().split())
if (2*y-x)%3==0 and (2*x-y)%3==0 and  (2*y-x)/3>=0 and (2*x-y)/3>=0 :
    a=(2*y-x)//3
    b=(2*x-y)//3
    ans=cmb(a+b,a)
    print(ans%(10**9+7))
else:
    print('0')

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

int main()
{
    int n,m;
    int t1[110],t2[110];
    int p,x;

    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> t1[i];
        t2[i] = t1[i];
    }
    cin >> m;
    for(int i = 0;i < m;i++){
        cin >> p >> x;
        t2[p-1] = x;

        long long sum = 0;
        for(int j = 0;j < n;j++){
            sum += t2[j];
        }
        cout << sum << endl;
        
        for(int i = 0;i < n;i++){
            t2[i] = t1[i];
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define RFOR(i, a, b) for (int i = a; i > b; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define int long long

typedef long long ll;
typedef pair<int, int> Pair;

// const int kMaxN;

int A, B;
int ans = 0;

signed main() {
  cin >> A >> B;

  ans = (A-1)*(B-1);

  cout << ans << endl;
  return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s,r;
  cin >> s >> r;
  int ans = 0;
  rep(i,3){
    if(s[i] == r[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::iter::FromIterator;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn readc() -> char {
    let s: String = read();
    return s.chars().nth(0).unwrap();
}

fn read_vec<T: FromStr>(n: usize) -> Vec<T> {
    return (0..n).map(|_| read()).collect();
}

fn main() {
    let n: usize = read();

    let mut sum: usize = 0;
    for i in 1..n+1 {
        sum += i;
        if sum >= n {
            let diff = sum - n;
            for j in 1..i+1 {
                if j != diff {
                    println!("{}", j);
                }
            }
            break;
        }
    }
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x [] = new int [5];
		for(int i = 0; i < 5; i++) {
			x[i] = sc.nextInt();
			if(x[i] == 0) {
				System.out.println(i + 1);
				return;
			}
		}

	}

}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n, h, w;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << endl;
}

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

// ====================================================================
const int MOD = 1e9 + 7;
int add(int a, int b) {int ret = (a % MOD) + (b % MOD); if (ret >= MOD)ret -= MOD; return ret;}
int sub(int a, int b) {int ret = ((a % MOD) - (b % MOD)); if (ret < 0)ret += MOD; return ret;}
int mul(int a, int b) {return (1LL * ((a % MOD) * (b % MOD))) % MOD;}
int powmod(int a, int b) {int ret = 1; for (; b; a = mul(a, a), b >>= 1) {if (b & 1)ret = mul(ret, a);} return ret;}
int divide(int a, int b) {return mul(a, powmod(b, MOD - 2));}
// ====================================================================

const int N = 1001;

int n, m;
char a[N][N];
int dp[N][N];

signed main() {
    std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);

    std::cin >> n >> m;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            std::cin >> a[i][j];
        }
    }

    dp[0][1] = 1;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == '#') continue;
            dp[i][j] = add(dp[i][j], dp[i][j - 1]);
            dp[i][j] = add(dp[i][j], dp[i - 1][j]);
        }
    }

    std::cout << dp[n][m];

    return 0;
}



Measured memory_bytes: 8492
import java.util.Scanner;
public class Main {
	public static void main(String []args) {
		Scanner sc=new Scanner(System.in);
		int c=0;
		while(true) {
			int a=sc.nextInt();
			if(a==0) {
				break;
			}
			c+=1;
			System.out.println("Case "+c+": "+a);
		}
	}
}



Measured memory_bytes: 41532
//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

// Taken From Striver_79
// Never open a ranklist untill and unless you are done with solving problems, wastes 3/4 minuts 
// Donot treat CP as a placement thing, love it and enjoy it, you will succeed for sure. 


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define mod 1000000007
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll dx1[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll dy1[] = {0, 1, 1, 1, 0, -1, -1, -1};

ll dx2[] = {1, 0, -1, 0};
ll dy2[] = {0, 1, 0, -1};

ll mul(ll a, ll b, ll p = mod) {return ((a % p) * (b % p)) % p;}
ll add(ll a, ll b, ll p = mod) {return (a % p + b % p) % p;}
ll power(ll x,ll y,ll p = mod) 
{ 
    ll res = 1;
    x = x % p;
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p;
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p = mod)
{
    return power(n, p - 2, p);
}
ll ncrMod(ll n, ll r, ll p = mod)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    for (ll i = 1 ; i <= n; i++)
        fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) % p;
}
// a+b=xor(a,b)+2*(a&b)//

bool isPrime(ll n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}


void solve()
{
    ll n;
    cin>>n;
    
    cout<<(n>=30?"Yes":"No")<<endl;
}


int main()
{
	fio;
// 	#ifndef ONLINE_JUDGE
//     // for getting input from input.txt
//     freopen("input.txt", "r", stdin);
//     // for writing output to output.txt
//     freopen("output.txt", "w", stdout);
// 	#endif
 

	ll t=1;
// 	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<string>S(N);
  for(int i=0;i<N;i++){
    cin>>S.at(i);
    sort(S.at(i).begin(),S.at(i).end());
  }
  sort(S.begin(),S.end());
  vector<long long>A;
  long long count=1;
  for(int i=0;i<N-1;i++){
    if(S.at(i)==S.at(i+1)){
      count=count+1;
      if(i==N-2){
        A.push_back(count);
      }
    }
    else{
      A.push_back(count);
      count=1;
    }
  }
  long long sum=0;
  for(int i=0;i<A.size();i++){
    sum=sum+(A.at(i)*(A.at(i)-1))/2;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll N, A;
ll x[110];

int main() {
    cin >> N >> A;
    for (int i = 0; i < N; i++) cin >> x[i];
    
    ll dp[60][60][3000];
    memset(dp, 0, sizeof(dp));
    dp[0][0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int  k = 0; k < 3000; k++){
                if (dp[i][j][k] == 0) continue;
                dp[i+1][j][k] += dp[i][j][k];
                dp[i+1][j+1][k+x[i]] += dp[i][j][k];
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i < N+1; i++) {
        ans += dp[N][i][i*A];
    }

    cout << ans << endl;

    
    return 0;
}


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

namespace TYC
{
	typedef long long ll;
	const int N = 300000 + 5, mod = 1e9 + 7;

	int n, F[N][3][3];
	char S[N];

	void work()
	{
		scanf("%s", S);
		n = int(strlen(S));
		F[0][0][0] = 1;
		for (int i = 0; i < n; i++)
		{
			if (S[i] != '1')
			{
				for (int c0 = 0; c0 < 3; c0++)
					for (int c1 = 0; c1 < 3; c1++)
						(F[i + 1][c0 % 2 + 1][c1] += F[i][c0][c1]) %= mod;
			}
			if (S[i] != '0')
			{
				for (int c0 = 0; c0 < 3; c0++)
					for (int c1 = 0; c1 < 3; c1++)
					{
						if (c0)
							(F[i + 1][c0 - 1][c1] += F[i][c0][c1]) %= mod;
						else
							(F[i + 1][c0][min(2, c1 + 1)] += F[i][c0][c1]) %= mod;
					}
			}
		}
		int ans = 0;
		for (int c0 = 0; c0 < 3; c0++)
			for (int c1 = c0; c1 < 3; c1++)
				ans = (ans + F[n][c0][c1]) % mod;	
		printf("%d\n", ans);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define p_b push_back
#define pl pair<ll,ll>

ll MOD = 1000000007;
ll fact[2000005];
ll modexpo(ll a,ll b)
{
	if(b==0)
	{
		return 1;

	}
	if(b==1)
	{
		return a%MOD;
	}
	else
	{
		ll temp = modexpo(a,b/2);
		temp = temp*temp;
		temp%= MOD;
		if(b%2==1)
		{
			temp = (temp*a);
			temp %= MOD;
		}
		return temp;
	}
}

ll modinv(ll x)
{
	return modexpo(x,MOD - 2);
}
ll nCr(ll n,ll r)
{
	ll temp = fact[n] * (modinv (fact[r]));
	temp %= MOD;
	temp *= (modinv(fact[n-r]));
	temp %= MOD;
	return temp;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	t= 1;


	ll i;
	fact[0] = 1;
	for(i=1;i<2000005;i++)
	{
		fact[i] = i*(fact[i-1]);
		fact[i] %= MOD;

	}
	

	//cin >> t;
	while(t--)
	{
		ll x,y;
		cin >> x >> y;
		ll ways = 0;
		ll a;
		for(a=0;a<(max(x,y));a++)
		{
			ll b = x- (2*a);
			
			if(b<0)
			{

				continue;
			}

			if((2*b + a)!=y)
			{
				continue;
			}
			
			ways += nCr(a+b,b);
			
			ways %= MOD;
			

		}
		cout << ways << endl;
	}
	return 0;
}

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

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    cout << ((a<=9 && b<=9)?a*b:-1) << endl;
}


Measured memory_bytes: 896
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    k=input()
    d=int(input())
    n=len(k)
    dp=[[[0]*2 for _ in range(d)] for _ in range(n+1)]
    dp[0][0][0]=1
    for i in range(n):
        a=int(k[i])
        for j in range(d):
            for o in range(10):
                dp[i+1][(j+o)%d][1]+=dp[i][j][1]
                dp[i+1][(j+o)%d][1]%=MOD
                if(o<a):
                    dp[i+1][(j+o)%d][1]+=dp[i][j][0]
                    dp[i+1][(j+o)%d][1]%=MOD
                elif(o==a):
                    dp[i+1][(j+o)%d][0]+=dp[i][j][0]
                    dp[i+1][(j+o)%d][0]%=MOD
    print((dp[n][0][0]+dp[n][0][1]-1)%MOD)
resolve()


Measured memory_bytes: 129628
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vector<pii> AB(N);
    cin >> AB;
    sort(ALL(AB));
    int ans = 0;
    REP(i, N) {
        int a, b;
        tie(a, b) = AB[i];
        if (M > b) {
            M -= b;
            ans += a * b;
        } else {
            ans += a * M;
            break;
        }
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cassert>

#include <unordered_set>
#include <unordered_map>
#include <random>
#include <thread>
#include <chrono>

using namespace std;

#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x) 
#endif

typedef complex<double> point;

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it) {
        if(it != v.begin())
            os << ",";
        os << *it;
    }
    return os << "}";
}

using ll = int64_t;

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

    ll n, m, d;
    cin >> n >> m >> d;

    double k = 0.0;

    // mannka
    k += (n - 2*d) * (2.0 / n);
    // tiisai or dekai
    k += 2*d * (1.0 / n);

    if (d == 0)
        k = 1.0;

    double r = (k / n) * (m - 1);

    cout << fixed << setprecision(10);
    cout << r << endl;
    return 0;
}


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

int main(){

    int x, y;
    cin >> x >> y;

    if(x == 2){

        if(y == 2)cout << "Yes\n";
        else cout << "No\n";

    }else if(x == 4 || x == 6 || x == 9 || x == 11){

        if(y == 4 || y == 6 || y == 9 || y == 11)cout << "Yes\n";
        else cout << "No\n";

    }else{

        if(y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
        cout << "Yes\n";
        else cout << "No\n";

    }

    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	int maxlen = 0;
	int currlen = 0;
	for(char c : s) {
		if(c == 'A' || c == 'T' || c == 'C' || c == 'G') {
			currlen ++;
		} else currlen = 0;
		maxlen = currlen > maxlen ? currlen : maxlen;
	} cout << maxlen;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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 D = sc.nextInt();
	    
	    if (A+B == C+D) {
	    	System.out.println("Balanced");
	    } else if (A+B > C+D) {
	    	System.out.println("Left");
	    } else {
	    	System.out.println("Right");
	    }
	}    
}	

Measured memory_bytes: 21588
s = input()
t = input()
p = []
q = []
m = len(s)
n = len(t)
if m >= n:
    ans = "No"
else:
    ans = "Yes"
for i in range(m):
    p.append(s[i])
p.sort()
for j in range(n):
    q.append(t[j])
q.sort(reverse=True)
for k in range(min(m,n)):
    if ord(p[k]) < ord(q[k]):
        ans = "Yes"
        break
    elif ord(p[k]) > ord(q[k]):
        ans = "No"
        break
print(ans)


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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int count = 0;
	for (int i = 0; i < n - 2; i++)
	{
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			count++;
	}
	cout << count;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int a, b;
  cin>>a>>b;
	int c = a + b;
	int d = a - b;
	int e = a * b;
	cout << max(c, max(d, e));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//int find(int arr[][3],int n,int i,int j)
//{
//	if(i>=n)
//	  return 0;
//	int ans=INT_MIN; 
//	for(int k=j-1;k<=j+1;k++)
//	{
//		if(k>=0 && k<3 && k!=j)
//		{
//			ans=max(find(arr,n,i+1,k)+arr[i][j],ans);
//		}
//	}
//	return ans;
//}
int main()
{
	int n;
	cin>>n;
	int arr[n][3];
	for(int i=0;i<n;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		arr[i][0]=x;
		arr[i][1]=y;
		arr[i][2]=z;
	}
	int ans=INT_MIN;
//	for(int i=0;i<3;i++)
//	{
//		ans=max(find(arr,n,0,i),ans);
//	}
    int dp[n][3];
	for(int i=0;i<3;i++)
	{
		dp[0][i]=arr[0][i];
	}
	for(int i=1;i<n;i++)
	{
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+arr[i][1];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+arr[i][2];
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<"\n";
}

Measured memory_bytes: 5920
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		String T=stdIn.next();
		char a[]=new char[T.length()];
		for(int i=0;i<T.length();i++){
			a[i]=T.charAt(i);
		}
		for(int i=0;i<T.length();i++){
			if(a[i]=='?')
				a[i]='D';
			System.out.print(a[i]);
		}
		System.out.println();
	}
}


Measured memory_bytes: 58400
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>

constexpr long long int MOD = 1000000007L;

long long int right(const std::vector<int>& s_series, const std::vector<int>& t_series, const int si, const int ti, std::vector<std::vector<long long int>>& memo) {
	if (si >= s_series.size() || ti >= t_series.size()) {
		return 1;
	}
	else if (memo[si][ti] >= 0) {
		return memo[si][ti];
	}
	else {
		memo[si][ti] = right(s_series, t_series, si + 1, ti, memo);
		for (auto tn = ti; tn < t_series.size(); ++tn) {
			if (s_series[si] == t_series[tn]) {
				memo[si][ti] += right(s_series, t_series, si, tn + 1, memo);
				memo[si][ti] %= MOD;
				break;
			}
		}
		return memo[si][ti];
	}
}
int main() {
	int n, m; std::cin >> n >> m;
	std::vector<int> s_nums(n), t_nums(m);
	for (auto& s : s_nums) std::cin >> s;
	for (auto& t : t_nums) std::cin >> t;
	std::vector<std::vector<long long int>> memo(n, std::vector<long long int>(m, -1));
	std::cout << right(s_nums, t_nums, 0, 0, memo) << std::endl;
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const int INF=1e7;
const LL LINF= 1LL << 62;

vector<LL> vec[4];

int main(){
    int N;
    LL W;
    cin >> N >> W;
    LL w[N],v[N];
    LL mini=LINF;
    for(int i=0;i<N;i++){
        cin >> w[i] >> v[i];
        mini=min(mini,w[i]);
    }
    for(int i=0;i<N;i++) vec[w[i]-mini].push_back(v[i]);
    for(int i=0;i<4;i++) sort(vec[i].rbegin(),vec[i].rend());
    LL cum[4][N+1];
    memset(cum,0,sizeof(cum));
    for(int i=0;i<4;i++){
        for(int j=1;j<=vec[i].size();j++){
            cum[i][j]+=cum[i][j-1]+vec[i][j-1];
        }
    }
    LL ans=0;
    for(int i=0;i<=vec[0].size();i++){
        for(int j=0;j<=vec[1].size();j++){
            for(int m=0;m<=vec[2].size();m++){
                for(int n=0;n<=vec[3].size();n++){
                    if(j+m*2+n*3+(i+j+m+n)*mini<=W) ans=max(ans,cum[0][i]+cum[1][j]+cum[2][m]+cum[3][n]);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n, k;
  cin >> n >> k;
  vector<i64> v(n);
  for (i64 i = 0; i < n; i++)
    cin >> v[i];
  i64 ans = 0;
  for (i64 i = 0; i <= n; i++)
    for (i64 j = 0; j <= n - i; j++)
      if (i + j <= k)
      {
        priority_queue<i64, vector<i64>, greater<i64>> que;
        i64 sum = 0;
        for (i64 l = 0; l < i; l++)
        {
          que.push(v[l]);
          sum += v[l];
        }
        for (i64 l = 0; l < j; l++)
        {
          que.push(v[n - l - 1]);
          sum += v[n - l - 1];
        }
        for (i64 l = 0; l < k - i - j; l++)
          if (que.size() == 0)
            break;
          else if (que.top() < 0)
          {
            sum -= que.top();
            que.pop();
          }
        ans = max(ans, sum);
      }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256