akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe


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

long double x,n,j=0,b=0,ans=0;
string s;
cin >> n;
rep(i,n){
    cin >> x >> s;
    if(s=="JPY"){
        j += x;
    }else
    {
        b += x;
    }
    
}
ans = j+b*380000.0;
cout << ans << endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int l[50];
	for(int i=0;i<n;i++)cin>>l[i];
	sort(l,l+n);
	int ans=0;
	for(int i=0;i<k;i++){
		int x=l[n-i-1];
		ans+=x;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int n;cin>>n;int a[100000], b[100000], c[100000], d[100000];int asum = 0, bsum = 0;
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rep(i,n){
    asum += a[i];bsum += b[i];
    c[i] = a[i] - b[i];
  }
  if(asum < bsum){
    cout << -1 << endl;
    return 0;
  }
  sort(c, c+n);
  rep(i,n)d[i] = c[i];
  int i = 0, bi = n-1;
  while(c[i] < 0){
    if(c[i] + c[bi] < 0){
      c[i] += c[bi];
      c[bi] = 0;
      bi--;
    }else{
      c[bi] += c[i];
      c[i] = 0;
      i++;
    }
  }

  int ans = 0;
  rep(i,n){
    if(c[i] != d[i])ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3328
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

signed main() {
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(a*n, b)<<endl;

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

Measured memory_bytes: 256
x = int(input())

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return table

table = sieve(10**5 + 100)

l = 0
r = len(table) - 1

while l <= r:
    m = (l + r) // 2
    if table[m] >= x:
        r = m - 1
    else:
        l = m + 1

print(table[l])


Measured memory_bytes: 4196
from itertools import permutations

N=int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

n = list(permutations(list(range(1, N+1))))
for i in range(len(n)):
    if  list(n[i]) == P:
        p = i+1
    if list(n[i]) == Q:
        q = i+1
print(abs(p-q))

Measured memory_bytes: 8052
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var d = int.Parse(line[0]);
        var t = int.Parse(line[1]);
        var s = int.Parse(line[2]);
        Console.WriteLine((d + s - 1) / s <= t ? "Yes" : "No");
    }
}


Measured memory_bytes: 27512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

long double a, b, x;

void input() {
    cin >> a >> b >> x;
}

long double f(long double a, long double b, long double theta) {
    if(theta > PI / 2.0 - EPS) {
        return 0.0;
    }
    long double ret;
    if(a * tan(theta) <= b) {
        ret = a * a * b - a * a * a * tan(theta) / 2.0;
    } else {
        ret = b * b / tan(theta) * a / 2.0;
    }
    return ret;
}

void solve() {
    input();
    long double ok = PI / 2.0;
    long double ng = 0.0;
    for(int _ = 1; _ <= 100000; _++) {
        long double mid = (ok + ng) / 2.0;
        if(f(a, b, mid) < x) ok = mid;
        else ng = mid;
    }
    cout << fixed << setprecision(10) << ok / PI * 180 << endl;
    return;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 4176
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
ll keta(ll num) {
	ll r = 0;
	while (num) {
		num /= 10;
		r++;
	}
	return r;
}
int main() {
	ll N, k, ans;
	scanf("%lld", &N);
	k = (ll)sqrt(N);
	ans = keta(N);
	rep(i, 2, k + 1) {
		if (N % i == 0) {
			ans = min(ans, keta(N / i));
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

ll fifth_pow(ll a){
    ll aa = a * a;
    return aa * aa * a;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;

    ll a[n];
    map<ll, ll> mp_pos, mp_neg;
    rep(i, n){
        cin >> a[i];
        mp_pos[i + 1 + a[i]]++;
        mp_neg[i + 1 - a[i]]++;
    }

    ll ans = 0;
    rep(i, n){
        ans += mp_neg[i + 1 + a[i]];
        ans += mp_pos[i + 1 - a[i]];
    }

    cout << ans / 2 << endl;

    return 0;
}

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

int cnt[100010];

int main()
{
    int x, y, z;
    int N;
    scanf("%d", &N);
    for(x=1; x<=100; ++x){
        for(y=1; y<=100; ++y){
            for(z=1; z<=100; ++z){
                ++cnt[x*x+y*y+z*z+x*y+y*z+z*x];
            }
        }
    }
    for(int i=1; i<=N; ++i) printf("%d\n", cnt[i]);
}

Measured memory_bytes: 3944
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<string>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){

	map<char,int> mapping;
	string w;
	cin>>w;
	bool kekka = true;	
	for(int i = 0; i < w.size(); i++){
		mapping[w[i]]++;
	}
	

	for(auto& s:mapping){
		if((s.second % 2) != 0){
			kekka = false;
		}
	}
	cout<< (kekka ? "Yes" : "No")<<endl;


	return 0;
}


Measured memory_bytes: 256
# include <iostream>

using namespace std;
  
int main() {
	int Ordinary_Train = 0;
	int Ordinary_Bus = 0;
	int Unlimited_Train = 0;
	int Unlimited_Bus = 0;
	cin >> Ordinary_Train >> Unlimited_Train >> Ordinary_Bus >> Unlimited_Bus;
	
	int min_Train = Ordinary_Train < Unlimited_Train ? Ordinary_Train : Unlimited_Train;
	int min_Bus = Ordinary_Bus < Unlimited_Bus ? Ordinary_Bus : Unlimited_Bus;
	cout << min_Train + min_Bus;
}// main

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define fastio                              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
#define read                                freopen("input.txt", "r", stdin);
#define write                               freopen("output.txt", "w", stdout);
#define nl                                  '\n'
#define LCM(a,b)                            (a / __gcd(a,b) ) *b
#define GCD(a,b)                            __gcd(a,b)
#define mem(v, val)                         memset(v, val, sizeof(v))
#define TC                                  int t; cin >> t; for(int tc = 1; tc <= t; tc++)
#define inp(x)                              for(auto& iinput:x) cin >> iinput
#define out(x)                              for(auto& ooutput:x) cout << ooutput << ' '

#define ll                                  long long
#define vi                                  vector<int>
#define pb                                  push_back
#define vpii                                vector<pair<int, int>>
#define mp                                  make_pair
#define ff                                  first
#define ss                                  second
#define all(v)                              v.begin(), v.end()
#define rsort(v)                            sort(v.rbegin(), v.rend())
#define debug(x)                            cerr << #x << " = " << x << nl

using namespace std;

const double pi = 2*acos(0.0);
const int MAX = 2e6 + 5, MOD = 1e9 + 7  , MAXLG = log2(MAX)+1;
const ll inf = 1e18 + 5;


void solve(){
    // time_t time = clock();

    int n; cin >> n;
    vi height(n+1, 0);
    for(int i = 1; i <= n; i++) cin >> height[i];
    vi ans(n+1, 0);
    ans[2] = abs(height[2] - height[1]);

    for(int i = 3; i <= n; i++)
        ans[i] = min(ans[i-2] + abs(height[i] - height[i-2]), ans[i-1] + abs(height[i] - height[i-1]));
    cout << ans[n];



    // printf("%.5fs\n", (double)(clock() - time)/CLOCKS_PER_SEC);

}


int main(){
    // read;
    fastio;
    solve();
       
}


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

using namespace std;

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < ll(b); i++)
#define FORD(i, a, b) for (ll i = b - 1; i >= ll(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    int N;
    cin >> N;
    vector<ll> v(N);
    REP(i, N)
    cin >> v[i];
    sort(ALL(v), greater<ll>());
    ll ans = v[0];
    queue<ll> q;
    q.push(v[1]);
    q.push(v[1]);
    FOR(i,2, N){
        ans+=q.front();
        q.pop();
        q.push(v[i]);
        q.push(v[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6424
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    int i,r,D,x,x_next;
    cin >> r >> D>> x; 
    for(i=1;i<=10;i++){
        x_next = r * x - D;
        cout << x_next << endl;
        x = x_next;
    }
    return 0;
}

Measured memory_bytes: 3576
let n, m, x, y = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let xs = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ys = Array.init m @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let xmax = max x @@ Array.fold_left max xs.(0) xs
let ymin = min y @@ Array.fold_left min ys.(0) ys
let _ = print_endline @@ if xmax < ymin then "No War" else "War"

Measured memory_bytes: 512
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                count += 1

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'

int main()
{
	fastio;
	#ifdef APNA_IO
		start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif

	ll n;cin>>n;
	string a,b,c;cin>>a>>b>>c;
	
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		set<char> s;
		s.insert(a[i]);
		s.insert(b[i]);
		s.insert(c[i]);
		if(s.size()==3)
			ans+=2;
		else if(s.size()==2)
			ans+=1;

	}

	cout<<ans;
	#ifdef APNA_IO
		end_routine();
    #endif
}

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

int main()
{
  int n, d;
  cin >> n >> d;
  vector<vector<int>> a(n, vector<int>(d));
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < d; j++)
    {
      cin >> a[i][j];
    }
  }
  
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      int tmp = 0;
      for (int k = 0; k < d; k++)
      {
        int diff = abs(a[i][k] - a[j][k]);
        tmp += diff * diff;
      }
      for (int k = 0; k <= tmp; k++)
      {
        if (k * k == tmp)
        {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll N, M, K;
  scanf("%lld %lld %lld", &N, &M, &K);

  vector<ll> list1(N + 1);
  list1[0] = 0;
  for (ll i = 1; i <= N; i++) {
    ll v;
    scanf("%lld", &v);

    v += list1[i - 1];

    list1[i] = v;
    // cout << v << endl;
  }

  vector<ll> list2(M + 1);
  list2[0] = 0;
  for (ll i = 1; i <= M; i++) {
    ll v;
    scanf("%lld", &v);
    v += list2[i - 1];

    list2[i] = v;
    // cout << v << endl;
  }

  ll n = 0;
  ll m = 0;

  for (ll i = 0; i <= M; i++) {
    if (K >= list2[i]) {
      m = i;
    } else {
      break;
    }
  }

  ll ans = n + m;

  // cout << "K:" << K << endl;
  // cout << "list1[1]:" << list1[1] << endl;

  for (int i = 1; i <= N; i++) {
    if (K >= list1[i]) {
      n = i;
    }

    ll rest = K - list1[n];

    for (;;) {
      if (rest >= list2[m]) {
        break;
      }
      if (m == 0) {
        break;
      }
      m--;
    }
    ans = max(ans, n + m);
  }

  cout << ans << endl;
}


Measured memory_bytes: 6424
import sys
N,Y=map(int,input().split())
n=0
for i in range(0,N+1):
    for j in range(0,N-i+1):
        k=N-i-j
        S=10000*i+5000*j+1000*k
        if (S==Y) and (k>=0):
            print(i,j,k,sep=" ")
            sys.exit()
        else:
            n=n+1
if n==(N+1)*(N+2)/2:
    print(-1,-1,-1,sep=" ")

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

int main() {
	int n,a[3000];
	long long int dp[3000][3000];
	scanf("%d",&n);
	for(int i=0;i<n;i+=1){
	    scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i+=1){
	    for(int j=0;j+i<n;j+=1){
	        if(i==0){
	            dp[j][i+j]=a[i];
	            continue;
	        }
	        if(i==1){
	            dp[j][j+i]=abs(a[j+i]-a[j]);
	            continue;
	        }
	        dp[j][i+j]=max(a[i+j]-dp[j][i+j-1],a[j]-dp[j+1][i+j]);
	    }
	}
	printf("%lld",dp[0][n-1]);
	return 0;
}


Measured memory_bytes: 70528
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    int ans = 0, x;
    rep(i,0,N){
        cin >> x;
        ans += x >= K;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#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 ;
#define ll long long
#define ld long double
#define pp pair<ll,pair<ll,ll> >
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define sz(a) int((a).size())
#define hell 1000000007
#define f first
#define s second
#define sll(x) scanf("%lld",&x)
#define si(x) scanf("%d",&x)
typedef tree<ll , null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update > ordered_set ;
ll t = 1 ;
ll powMod( ll base , ll expo )
{
    ll ans = 1 ;
    while( expo > 0 )
    {
        if( expo & 1 )
            ans = ( ans * base ) % hell ;
        expo>>=1;
        base = ( base * base )%hell;
    }
    return ans ;
}
ll findroot( ll x )
{
    ll lo = 1 , hi = hell , mid ;
    while( hi - lo > 1 )
    {
        mid = ( lo + hi ) / 2 ;
        if( mid*mid > x )
            hi = mid ;
        else
            lo = mid ;
    }
    return lo ;
}
ll calc( ll n )
{
    ll x = findroot( n ) , y ;
    y = n - x * x ;
    ll a1 , a2 , ans = 1 ;
    a1 = powMod( 3 , x ) ;
    a2 = powMod( a1 , x ) ;
    if( y < hell )
    {   
        ans = ( ans * a2 ) % hell ;
        ans = ( ans * powMod( 3 , y ) ) % hell ;
        return ans ;
    }
    else
    {
        ans = ( ans * a2 ) % hell ;
        ans = ( ans * calc(y) ) % hell ;
        return ans ;
    }
}
void solve() 
{ 
    ll a , b , k ;
    cin >> a >> b >> k ;
    cout << min( k , b / a ) ;
} 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //cin>>t;
    while(t--)
        solve() ;
    return 0 ;
}


Measured memory_bytes: 256
import math
import sys
input = sys.stdin.readline

N = int(input())
X = input()
mod = 998244353


def calc_div_odd(N):
    div_odd = []
    for i in range(1, math.floor(N ** (1/2)) + 1):
        if N % i == 0:
            if i % 2 == 1:
                div_odd.append(i)
            if N // i != i:
                if (N // i) % 2 == 1:
                    div_odd.append(N//i)
    return div_odd


def main():
    block_num_list = calc_div_odd(N)
    block_num_list.sort()
    ok_num = {x: 0 for x in block_num_list}
    use_num = {x: 0 for x in block_num_list}
    div_dict = {x: [] for x in block_num_list}
    for block_num in block_num_list:
        block_len = N // block_num
        X_ref = X[:block_len]
        ok_num[block_num] += int(X_ref, 2) % mod
        X_ref_inv = ''
        for i in range(block_len):
            x = '0' if X_ref[i] == '1' else '1'
            X_ref_inv += x
        Y = (X_ref + X_ref_inv) * (block_num // 2) + X_ref
        flg = 1
        for x, y in zip(X, Y):
            if x == '1' and y == '0':
                break
            elif x == '0' and y == '1':
                flg = 0
                break
        if flg:
            ok_num[block_num] += 1

        # if int(X, 2) >= int((X_ref + X_ref_inv) * (block_num // 2) + X_ref, 2):
            # ok_num[block_num] += 1

        div_d_list = calc_div_odd(block_num)
        for div_d in div_d_list:
            if div_d != block_num:
                div_dict[block_num].append(div_d)

    ans = 0
    for block_num in reversed(block_num_list):
        block_len = N // block_num
        div_list = div_dict[block_num]
        use_num[block_num] = (use_num[block_num] + ok_num[block_num]) % mod
        for div in div_list:
            use_num[div] = (use_num[div] - use_num[block_num]) % mod
        ans = (ans + ((block_len * 2) * use_num[block_num])) % mod

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4268
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	vector <pair <int, int> > vec;
	rep( i, 0, N ){
		int a, b;
		cin >> a >> b;
		vec.push_back( make_pair( b, a ));
	}
	sort_asc( vec );
	int time = 0;
	for(auto v:vec){
		time += v.second;
		if (time > v.first){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 2420
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      int touSa = b - a;
      int aTou = 0;
      for(int i = touSa - 1; i != 0; i--){
        aTou += i;
      }
      System.out.println(aTou - a);
      
	}
}


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

int main()
{
  int N, Y;
  cin >> N >> Y;
  
  int a, b;
  
  bool flag = true;
  for (int a = 0; a < N+1; a++) {
    for (int b = 0; b < N+1-a; b++) {
      if (10000 * a + 5000 * b + 1000 * (N-a-b) == Y) {
        cout << a << " " << b << " " << N-a-b << endl;
        return 0;
      }
    }
  }
  if (flag) cout << -1 << " " << -1 << " " << -1 << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  char C;
  cin >> C;
  C ++;
  cout << C << endl;
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  if(N<2 || N>50 || M<2 || M>50){
    return 0;
  }
  vector<int> path(N+1, 0);
  for(int i=1; i<=M; ++i){
    int a, b;
    cin >> a >> b;
    if(a<1 || a>N || b<1 || b>N || a==b){
      return 0;
    }
    path.at(a)++; path.at(b)++;
  }
  for(int i=1; i<=N; ++i){
    cout << path.at(i) << endl;
  }
}

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

void bruteforce(int N, int D, int *d, bool *ans) {
    int p[N+1];
    p[0] = D;
    for (int i = 0, pos = D; i < N; i++) {
        pos = min(pos, abs(pos - d[i]));
        p[i+1] = pos;
    }
    if (p[N] != 0) {
        fill(ans, ans+N, true);
        return;
    }
    fill(ans, ans+N, false);
    set<int> S;
    S.insert(0);
    for (int i = N-1; i >= 0; i--) {
        for (int x = p[i]; x > 0; x--)
            if (S.find(x) == S.end()) {
                ans[i] = true;
                break;
            }
        set<int> temp;
        for (int p = 0; p <= d[i]; p++)
            if (S.find(min(p, d[i] - p)) != S.end()) temp.insert(p);
        for (int x : S) temp.insert(x + d[i]);
        S.swap(temp);
        // cerr << "i = " << i << "; "; for (int x : S) cerr << x << " "; cerr << endl;
    }
}

int main() {
    int N, D; scanf("%d %d", &N, &D);
    int d[N]; for (int i = 0; i < N; i++) scanf(" %d", &d[i]);
    bool ans[N];
    int p[N+1], s[N+1];
    p[0] = D;
    for (int i = 0, pos = D; i < N; i++) {
        pos = min(pos, abs(pos - d[i]));
        p[i+1] = pos;
    }
    // for (int i = 0; i <= N; i++) cerr << p[i] << endl;
    if (p[N] == 0) {
        s[N] = 0;
        for (int i = N-1; i >= 0; i--) {
            ans[i] = p[i] > s[i+1];
            s[i] = max((d[i] + 1) / 2, d[i] - s[i+1]) - min(d[i] / 2, s[i+1]) <= 1 ? d[i] + s[i+1] : min(d[i] / 2, s[i+1]);
            // cerr << i << " " << s[i] << endl;
        }
    } else {
        fill(ans, ans+N, true);
    }

    // bool ans2[N];
    // bruteforce(N, D, d, ans2);
    // for (int i = 0; i < N; i++)
    //     if (ans[i] != ans2[i]) {
    //         cerr << "wrong answer on i = " << i << "; " << ans[i] << " != " << ans2[i] << endl;
    //     }

    int q; scanf(" %d", &q);
    while (q--) {
        int x; scanf(" %d", &x);
        puts(ans[x-1] ? "YES" : "NO");
    }
}


Measured memory_bytes: 9524
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    VL a(n);
    rep(i,n) cin >> a[i];

    ll ans = 0;
    ll d = 1;
    rep(i, 60){
        ll cnt0 = 0, cnt1 = 0;
        rep(j, n){
            if ((a[j]>>i) & 1) cnt1++;
            else cnt0++;
        }
        ll cnt = (cnt1 * cnt0) % mod;
        ans += (d * cnt) % mod;
        ans %= mod;
        d *= 2;
        d %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5564
#include<iostream>
#include<string>

using namespace std;

int main(void){
	int a,b,c;
	int K;
	long ans;
	cin >> a >> b >> c;
	cin >> K;
	if(a >= b && a >= c){
		ans = a;
		for(int i=0;i <K;i++){
			ans *= 2;
		}
		ans = ans + c + b;
	}else if(b >= a && b >= c){
		ans = b;
		for(int i=0;i <K;i++){
			ans *= 2;
		}
		ans = ans + a + c;
	}else{
		ans = c;
		for(int i=0;i <K;i++){
			ans *= 2;
		}
		ans = ans + a + b;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};



int main(){
    int N;cin >> N;
    vector<int> vec;
    int cnt = 0;
    for(int a = 0;a< N;a++){
        int b;cin >> b;
    //    vec.push_back(b);
        if(a+1 != b){
            cnt++;
        }
    }
    if(cnt == 2 || cnt == 0){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    minA = min(A)
    while any(a % minA for a in A):
        for i in range(N):
            if A[i] % minA:
                A[i] %= minA
        minA = min(A)
    print(minA)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62704
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF 10e10
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;

double dijkstra(long long S, long long G, long long N, vector<vector<double>> &edges){
    vector<double> shortest(N, INF);
    priority_queue<pair<double, double>, std::vector<pair<double, double>>, std::greater<pair<double, double>>> q;
    q.push(make_pair(0, S));
    while(!q.empty()){
        auto src = q.top().second, l0 = q.top().first;
        q.pop();
        if(l0 >= shortest[src])continue;
        shortest[src] = l0;
        if(src==G)break;
        for(auto dst=0ll; dst<N; dst++){
            auto l1 = edges[src][dst];
            if(l1 < INF && l0+l1 < shortest[dst]){
                q.push(make_pair(l0+l1, dst));
            }

        }
    }
    return shortest[G];
}

struct xyr{
    double x,y,r;
};

double dist(xyr p1, xyr p2){
    double d = sqrt(pow(p1.x-p2.x, 2)+pow(p1.y-p2.y, 2));
    return (d >= p1.r+p2.r ? d-(p1.r+p2.r) : 0.0);
}

void solve(long long x_s, long long y_s, long long x_t, long long y_t, long long N, std::vector<long long> x, std::vector<long long> y, std::vector<long long> r){
    vector<xyr> nodes(N+2);
    rep(i, N){
        nodes[i]={(double)x[i],(double)y[i],(double)r[i]};
    }
    nodes[N]={(double)x_s, (double)y_s, 0.0};
    nodes[N+1]={(double)x_t, (double)y_t, 0.0};
    vector<vector<double>> edges(N+2, vector<double>(N+2));
    rep(i,N+2){
        rep(j, N+2){
            if(i==j){
                edges[i][j] = INF;
            }else {
                edges[i][j] = dist(nodes[i], nodes[j]);
            }
        }
    }
    double ans =  dijkstra(N, N+1, N+2, edges);
    printf("%.10lf\n", ans);
}

int main(){
    long long x_s;
    scanf("%lld",&x_s);
    long long y_s;
    scanf("%lld",&y_s);
    long long x_t;
    scanf("%lld",&x_t);
    long long y_t;
    scanf("%lld",&y_t);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    std::vector<long long> r(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        scanf("%lld",&r[i]);
    }
    solve(x_s, y_s, x_t, y_t, N, std::move(x), std::move(y), std::move(r));
    return 0;
}


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

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

  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    lint ans = 0;
    vector<vector<int>> left(n), right(n);
    for (int i = 0; i < n; i++) {
      int k, l, r;
      cin >> k >> l >> r;
      k--;
      ans += min(l, r);
      if (l - r > 0) {
        left[k].push_back(l - r);
      } else if (l - r < 0 && k + 1 < n) {
        right[k + 1].push_back(r - l);
      }
    }
    auto Calc = [&](int piv) {
      lint res = 0;
      priority_queue<int> pq;
      for (int i = 0; i < n; i++) {
        for (auto j : right[i]) {
          pq.push(j);
        }
        if (piv <= i && !pq.empty()) {
          res += pq.top();
          pq.pop();
        }
      }
      while (!pq.empty()) pq.pop();
      for (int i = n - 1; i >= 0; i--) {
        for (auto j : left[i]) {
          pq.push(j);
        }
        if (i < piv && !pq.empty()) {
          res += pq.top();
          pq.pop();
        }
      }
      return res;
    };
    int lo = 0, hi = n;
    while (lo < hi) {
      int md = (lo + hi) / 2;
      if (Calc(md) > Calc(md + 1)) {
        hi = md;
      } else {
        lo = md + 1;
      }
    }
    cout << ans + Calc(lo) << "\n";
  }  
}


Measured memory_bytes: 17904
import scala.io.StdIn

object Main extends App {

  val Array(n, m) = StdIn.readLine().split(' ').map(_.toInt)
    
  val a = Array.fill(n,m)(0)
  
  (0 until n).foreach{ i =>
    a(i) = StdIn.readLine().split(' ').map(_.toInt)
  }

  val b = Array.fill(m)(0)
  (0 until m).foreach{ i =>
    b(i) = StdIn.readLine().toInt
  }

  val result = (0 until n).map { k =>
    (0 until m).foldLeft(0) { (acc, p) =>
       acc + a(k)(p)*b(p)
    }
  }
  
  println(result.mkString(f"%n"))
  
}


Measured memory_bytes: 47424
# frozen_string_literal: true

# Fenwick Tree
class FenwickTree
  def initialize(arg)
    case arg
    when Array
      @size = arg.size
      @data = Array.new(@size + 1) { 0 }
      arg.each.with_index(1) { |e, i| add(i, e) }
    when Integer
      @size = arg
      @data = Array.new(@size + 1) { 0 }
    else
      raise ArgumentError
    end
  end

  def add(i, x)
    while i <= @size
      @data[i] += x
      i += (i & -i)
    end
  end

  def sum(l, r)
    _sum(r) - _sum(l)
  end

  def _sum(i)
    res = 0
    while i > 0
      res += @data[i]
      i -= (i & -i)
    end
    res
  end
end

FeTree            = FenwickTree
BinaryIndexedTree = FenwickTree

n, q = gets.split.map { |e| e.to_i }
a    = gets.split.map { |e| e.to_i }
 
ft = FeTree.new(a)
 
q.times do
  t, u, v = gets.split.map { |e| e.to_i }
 
  if t == 0
    ft.add(u + 1, v)
  else
    puts ft.sum(u, v)
  end
end

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

int main() {
  int N, X;
  cin >> N >> X;//食べたリンゴはL+i-1が最も0と近いような番号i
  vector<int> L(N);
  rep(i, N) cin >> L[i];
  vector<int> D(N+1);
  D[0]=0;
  int sum = 1; 
  for(int i = 1; i < N+1; i++) {
    D[i] = D[i-1]+L[i-1];
    if (D[i] <= X) sum++;
    else {
      cout << sum << endl;
      return 0;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<algorithm>
#include<vector>
#include<cmath>
#define ll long long 
#define r(i,n) for(ll i=0;i<n;i++)
#define rp(i,a,b) for(ll i=a;i<b;i++)
#define ret return 
#define elif else if
#define p(x) cout<<x<<endl;
ll inf=100001;
using namespace std;
int main(){
	while(1){ll n,ans=0;;cin>>n;ll a[n],b[n];
	r(i,n){cin>>a[i];b[i]=a[i];a[i]=a[i]-i;}
	sort(a,a+n);
r(i,n){ans+=abs(a[i]-a[n/2]);}p(ans)ret 0;
	}
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int in(){int x; scanf("%d",&x); return x;}
static const int MAX = 100001;


int main(){
  int N = in(), A[MAX], b, x, y;
  long ans = 0;
  rep(i, N+1) A[i] = in();

  rep(i, N){
    b = in();
    x = min(A[i], b);
    b -= x;
    ans += x;
    y = min(A[i+1], b);
    A[i+1] -= y;
    ans += y;
  }

  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//cout<<fixed<<setprecision(15)<<

signed main(){
    int n,m; cin >> n >> m;
    vector<pair<int,bool>> p(n);
    rep(i,n){
        p[i].first=0;
        p[i].second=false;
    }
    int ac=0,pena=0;
    rep(i,m){
        int index; string ok;
        cin >> index >> ok;
        index--;
        if(p[index].second==true) continue;
        if(ok=="WA"){
            p[index].first++;
        }else{
            p[index].second=true;
            pena+=p[index].first;
            ac++;
        }
    }
    cout<<ac<<' '<<pena<<endl;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    if (c != a) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else if (a == c) {
    if (b != a) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else if (b == c) {
    if (a != b) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

using namespace std;

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

  string s;
  cin >> s;
  for (int l = s.size() - 1; 0 < l; --l) {
    if (l % 2)
      continue;
    bool success = true;
    for (int i = 0; i < l / 2; ++i) {
      if (s[i] != s[l/2+i]) {
        success = false;
      }
    }
    if (success) {
      cout << l << "\n";
      break;
    }
  }
}


Measured memory_bytes: 256
n,m=map(int,input().split())
lista = [int(i) for i in input().split()]


for i in range(len(lista)):
    lista[i]=lista[i]*-1

import heapq

heapq.heapify(lista)

for i in range(m):
        b=heapq.heappop(lista)
        b=b/2
        heapq.heappush(lista,b)
        
for i in range(n):
        lista[i]=int(lista[i]*-1)

ans=sum(lista)
print(ans)


Measured memory_bytes: 94360
import sys
MOD = 10 ** 9 + 7
sys.setrecursionlimit(MOD)


def comb(n, k):
    N, K = 1, 1
    for i in range(k):
        N = N * (n - i) % MOD
        K = K * (1 + i) % MOD
    return N * pow_mod(K, MOD - 2) % MOD


def pow_mod(a, b):
    if b == 0:
        return 1
    elif b % 2 == 0:
        d = pow_mod(a, b // 2)
        return d ** 2 % MOD
    else:
        return a * pow_mod(a, b - 1) % MOD


n, a, b = map(int, input().split())
ans = (MOD + pow_mod(2, n) - 1 - comb(n, a) - comb(n, b)) % MOD
print(ans)

Measured memory_bytes: 38548
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int main() {
   vector<char> a(6),b(6);
   for(int i=0;i<6;i++){
       cin >> a[i];
   }
   string ans="YES";
   for(int i=0;i<6;i++){
       if(a[i]!=a[5-i]) {
           ans = "NO";
           break;
       }
   }
   cout << ans << endl;
}


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

using namespace std;

int main()
{
	int n;
	int a, b, c;
	
	cin >> n;
	cin >> a >> b >> c;
	
	int topping[110];
	for (int i = 0; i < n; i++){
		cin >> topping[i];
	}
	
	sort(topping, topping + n);
	reverse(topping, topping + n);
	
	int cost = a;
	int calorie = c;
	for (int i = 0; i < n; i++){
		if (calorie / cost <= (calorie + topping[i]) / ((i + 1) * b + a)){
			calorie = calorie + topping[i];
			cost = (i + 1) * b + a;
		}
	}
	
	cout << calorie / cost << endl;
	return (0);
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll n,m;

bool f(ll x){
	bool B=1;
	for(int i=1;i<n;i++){
		if(!x) return 0;
		if(x%m==0) B=0;
		x-=(x+m-1)/m;
	}
	if(x) return 1;
	if(!B) return 0;
	return 1;
}

int main(){
	cin>>n>>m;
	ll l=-1,r=INF;
	while(r-l>1){
		ll x=(l+r)/2;
		if(f(x)) r=x;
		else l=x;
	}
	cout<<r<<endl;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define M 100005
#define rint register int
string A[M];
char S[15];
int n,Cnt;
LL Ans;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) {
		scanf("%s",S);
		A[i]=S;
		sort(A[i].begin(),A[i].end());
	}
	sort(A+1,A+1+n);
	for(int i=1; i<=n+1; ++i) {
//		cout<<A[i]<<endl;
		if(A[i]!=A[i-1])Ans+=1LL*(Cnt+1)*Cnt/2,Cnt=0;
		else ++Cnt;
	}
	printf("%lld",Ans);
}


Measured memory_bytes: 5760
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
const int maxn=3e5+50;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
int main()
{
    int K;
    cin>>K;
    if(K%2==0||K%5==0)return cout<<-1<<endl,0;
    if(K%7==0)K/=7;
    int a = 0;
    int b = K;
    int c = 0;
    while (b > 0)
    {
        b /= 10;
        a++;
        c = c * 10 + 1;
    }
    int d = c % K;
    while (d != 0)
    {
        d = (d * 10 + 1) % K;
        a++;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3596
n = gets.chomp!.to_i
s = gets.chomp!

chs = s.chars

# 左の黒の数
memo = []
memo[0] = 0

# 右の白の数
memo2 = []
memo2[n - 1] = 0 

(n - 1).times do |i|
  memo[i + 1] = memo[i] + ((chs[i] == "#") ? 1 : 0)
end

(n - 1).downto(1) do |i|
  memo2[i - 1] = memo2[i] + ((chs[i] == ".") ? 1 : 0)
end

puts n.times.map {|i|
  memo[i] + memo2[i]
}.min


Measured memory_bytes: 21764
import java.io.*;
import java.util.*;

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

public class Main {
  private static int solve(int n, int[] x, int[] y) {
    boolean[] possibleRed = new boolean[n + 1];
    int[] balls = new int[n + 1];
    
    possibleRed[1] = true;
    Arrays.fill(balls, 1);
    for (int i = 0; i < x.length; i++) {
      if (possibleRed[x[i]]) {
        possibleRed[y[i]] = true;
      }
      
      balls[x[i]]--;
      balls[y[i]]++;
      if (balls[x[i]] == 0) {
        possibleRed[x[i]] = false;
      }
    }
    
    int sum = 0;
    for (int i = 1; i <= n; i++) {
      if (possibleRed[i]) {
        sum++;
      }
    }
    return sum;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int m = reader.nextInt();
    int[] x = new int[m];
    int[] y = new int[m];
    for (int i = 0; i < m; i++) {
      x[i] = reader.nextInt();
      y[i] = reader.nextInt();
    }
    System.out.println(solve(n, x, y));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}



Measured memory_bytes: 46180