akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    string s[n];
    cin(i,s);
    intl cnt[5];
    m0(cnt);
    rep(i,n){
        if(s[i][0] == 'M')cnt[0]++;
        if(s[i][0] == 'A')cnt[1]++;
        if(s[i][0] == 'R')cnt[2]++;
        if(s[i][0] == 'C')cnt[3]++;
        if(s[i][0] == 'H')cnt[4]++;
    }
    intl ans = 0;
    rep(i,5){
        repi(j,i + 1,5){
            repi(k,j + 1,5){
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6144
void main(){
	long n = _scan!long();
	long[] a = _scanln!long();
	a.sort!("a < b");
	bool[] dp = new bool [ a[$-1] + 1 ]; // a[]のmax分要素を確保 
	fill(dp, true);
	long[long] dic; // 同じものが存在するか
	// エラトステネスの篩の適用
	foreach(i,elm; a){
		if(dp[elm] == false)continue;
		if(dic.get(elm, 0) != 0){
			dic[elm]++;
			continue;
		}
		dic[elm]++;
		for(long j=2; elm*j < dp.length; j++){	
			dp[elm*j] = false;	
		}
	}

	// 解のカウント
	long cnt = 0;
	foreach(elm; a){
		if(dp[elm]==true && dic[elm]==1)cnt++;
	}
	cnt.writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 20012
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout<<endl;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << " ";
    err(++it, args...);
}
#else
#define HERE
#define debug(args...)
#endif
const ll mod = 1e9+7 ;
const int N = (1<<17);
typedef pair<int,int> pii;


vector<vector<int> >adj;
vector<int>vis;

void dfs(int s,int &koto)
{
    vis[s]= true;
    koto++;
    for(int i:adj[s])
    {
        if(!vis[i])
        {
            dfs(i,koto);
        }
    }

}



void TEST_CASES(int cas)
{
    int n,m;
    scanf("%d %d",&n,&m);
    adj.resize(n);
    vis.resize(n);
    for(int i=0;i<m;i++)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        u--;
        v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    int ans =0;
    for(int i=0;i<n;i++)
    {
        if(!vis[i])
        {
            int sz =0;
            dfs(i,sz);
            ans = max(ans ,sz);
        }
    }
    printf("%d\n",ans);
}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}



Measured memory_bytes: 21136
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int n;
  int cnt = 0;
  cin >> n;
  for(int i = 0; i < 4; i++){
    int work = (n % 10);
    if(work == 2) cnt++;
    n /= 10;
  }
  cout << cnt << endl;
  return 0;
}


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

int main(void){

    long q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;
    long a[4] = { q * 8, h * 4, s * 2, d };
    long p[4] = { q * 4, h * 4, s * 4, d * 4 };
    int lit[4] = { 1, 2, 4, 8 };


    for (int i = 0; i < 4; i++){
        for (int j = 0; j < 3; j++){

            if (a[j] >= a[j + 1]){
                if (a[j] == a[j + 1]){
                    if (lit[j + 1] < lit[j]) continue;
                }
                swap(a[j], a[j + 1]);  swap(p[j], p[j + 1]);   swap(lit[j], lit[j + 1]);
            }
        }
    }

    long ans = 0;
    long  rest = 4 * n;

    for (int i = 0; i < 4; i++){
        if (rest < lit[i]) continue;

        ans += p[i] * (rest / lit[i]);
        rest %= lit[i];

    }

    cout << ans / 4 << endl;

}


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

using ll = long long;

int main(void)
{
    ll n;
    cin >> n;
    vector<pair<ll,ll>> f;
    for(ll i=2;i*i<=n;i++)
    {
        ll count=0;
        while(n%i==0)
        {
            n/=i;
            count++;
//            cout << n << endl;
        }
        f.emplace_back(i,count);
    }
    if(n!=1)
    {
        f.emplace_back(n,1);
    }
    int ans=0;
    for(auto p: f)
    {
        int i=1;
        while(p.second-i>=0)
        {
            p.second-=i;
            i++;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 19700
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
int a[100000];
int main() {
	int N, x;
	cin >> N >> x;
	for (int i = 0; i < N; i++) cin >> a[i];
	ll ans = 0;
	for (int i = 0; i + 1 < N; i++) {
		int s = a[i] + a[i + 1];
		if (s > x) {
			ans += s - x;
			a[i + 1] -= min(a[i + 1], s - x);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;

// cost, to
typedef pair<int, int> P;

int V, E, st;

void BellmanFord(vector<P> G[], ll dist[], int st){
    rep(i, V) dist[i]=INT64_MAX;
    dist[st] = 0;
    bool update=true;

    while(update){
        update = false;
        rep(i, V){
            if(dist[i]==INT64_MAX) continue;
            for(auto e: G[i]){
                if(dist[e.second] > dist[i]+e.first){
                    dist[e.second] = dist[i] + e.first;
                    update = true;
                }
            }
        }
    }

    return;
}

void dijkstra(vector<P> G[], bool vis[], ll dist[], int st)
{
    priority_queue<P, vector<P>, greater<P>> min_heap;
    min_heap.push({0, st});
    rep(i, V) vis[i] = false;
    rep(i, V) dist[i] = INT64_MAX;
    dist[st] = 0;

    int frm, d;
    while(!min_heap.empty()){
        tie(d, frm) = min_heap.top(); min_heap.pop();
        if(vis[frm]) continue;

        // printf("node=%d\n", frm);
        vis[frm] = true;
        dist[frm] = d;

        for(P e: G[frm]){
            if(dist[e.second] > d+e.first)
                min_heap.push({d+e.first, e.second});
                // printf("(%d, %d) pushed\n", d+e.first, e.second);
        }
    }
}

int main()
{
    cin >> V >> E >> st;
    ll dist[V];
    bool vis[V];
    P edge;
    vector<P> G[V];

    int frm, to, cst;
    rep(i, E){
        scanf("%d %d %d", &frm, &to, &cst);
        G[frm].push_back({cst, to});
    }

    // dijkstra(G, vis, dist, st);
    BellmanFord(G, dist, st);

    rep(i, V){
		if(dist[i] == INT64_MAX)
			printf("INF\n");
		else
			printf("%lld\n", dist[i]);
	}
}


Measured memory_bytes: 12676
row_1_ary = STDIN.gets.split.map(&:to_i)
row_2_ary = STDIN.gets.split.map(&:to_i)
row_3_ary = STDIN.gets.split.map(&:to_i)

all_ary = [row_1_ary,row_2_ary,row_3_ary]

bol = true

0.upto(1){|i|
    0.upto(1){|j|
        if all_ary[i][j] - all_ary[i][j+1] != all_ary[i+1][j] - all_ary[i+1][j+1]
           bol = false
        end
    }
}
puts bol == true ? 'Yes' : 'No'

Measured memory_bytes: 1788
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc  = new Scanner (System.in);
        String s = sc.nextLine();
        boolean res = true;
        int i = 0;
        if(s.charAt(0)==s.charAt(1) && s.charAt(2)==s.charAt(0) && s.charAt(2)==s.charAt(3)){
            res = false;
        }
        else{
        if(s.charAt(i)==s.charAt(i+1)||s.charAt(i)==s.charAt(i+2)||s.charAt(i)==s.charAt(i+3)){
            if(s.charAt(i+1)==s.charAt(i+2)||s.charAt(i+1)==s.charAt(i+3)){
                
            }
            else{
                if(s.charAt(i+2)==s.charAt(i+3)){

                }
                else    
                    res = false;
            }

                
                
        }
        else{
            res = false;
        }
    }
           
        if(res == true)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 35748
N = int(input())
h = list(map(int, input().split()))
max_h = max(h)

ans = 0
for c_h in range(0, max_h):
    continueing = False
    for h_i in h:
        if not continueing and h_i > c_h:
            ans += 1
            continueing = True
        elif h_i <= c_h:
            continueing = False

print(ans) 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
 
  set<int> x;
  x.insert(a);
  x.insert(b);
  x.insert(c);
  
  cout << x.size() << endl;
}

Measured memory_bytes: 256
import numpy as np

n, m = map(int, input().split())
S = []
for _ in range(m):
    *a, = map(int, input().split())
    l = a[1:]
    S.append(l)
*p, = map(int, input().split())

ans = 0
for i in range(2**n):
    tmp = np.array([i >> j & 1 for j in range(n)])
    if p == [sum(tmp[np.array(s)-1]) % 2 for s in S]:
        ans += 1
print(ans)


Measured memory_bytes: 12504
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

LL dp[1000005][2] = {{0}};

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

    string s;
    cin>>s;
    reverse(ALL(s));
    LL n = SZ(s);

    // 28
    // 28 30 100 108
    // 98
    // 98 100 108
    dp[0][1] = 10000;
    REP(i,n){
        LL x = s[i] - '0';
        if(x == 9){
            dp[i+1][0] = dp[i][0] + x;
            dp[i+1][1] = min(dp[i][0] + (10 - x) + 1, dp[i][1]);
        }
        else{
            dp[i+1][0] = min(dp[i][0] + x, dp[i][1] + x);
            dp[i+1][1] = min(dp[i][0] + (10 - x) + 1, dp[i][1] + (10 - x - 1));
        }
    }
    PUTS(min(dp[n][0], dp[n][1]));
}

Measured memory_bytes: 17052
#include<bits/stdc++.h>
using namespace std;
int main(){
      // #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
	int a,b,c=0,d=0;
  	string s;
  	cin>>a>>b;
  	cin>>s;
    // cout<<s.at(a);
  if(s.at(a) == '-'){
    	c++;
    }
    for (int i = 0; i < s.length(); ++i)
    {
      if(!(s.at(i) >='0' && s.at(i) <= '9')){
        d++;
      }
    }
	if(c == 1 && d ==1){ cout<<"Yes"<<"\n"; }
  else { cout<<"No"<<"\n"; }
	return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<deque>
#include<string>
#define mst(a,b) memset(a,b,sizeof(a))
#define lowbit(x) (x&(-x))
#define lson        (rt<<1)
#define rson        (rt<<1|1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int maxn = 2e5+50;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
int dis[maxn];
bool vis[maxn];
deque<int>qu;

int main() {
#ifdef local
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
//freopen("G.IN","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int k;cin>>k;
    mst(dis,0x3f);
    qu.push_back(1);dis[1]=1;
    for(;!qu.empty();){
        int a=qu.front();qu.pop_front();
        if(vis[a])continue;
        int g=(a*10)%k;
        if(!vis[g] and dis[a]<dis[g]){
            dis[g]=dis[a];
            qu.push_front(g);
        }
        g=(a+1)%k;
        if(!vis[g] and dis[a]+1<dis[g]){
            dis[g]=dis[a]+1;
            qu.push_back(g);
        }
    }
    cout<<dis[0];
    return 0;
}


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

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


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


const int MAX_N = 212345;
int P[MAX_N];
int L[MAX_N];


int main2() {
  CLR(L, 0);
  int N = nextInt();
  REP(i, N) P[i] = nextInt();

  for (int i = 0; i < N; i++) {
    L[ P[i] ] = L[ P[i]-1 ] + 1;
  }
  int ans = N - *max_element(L + 1, L + N + 1);
  cout << ans << endl;
  return 0;
}

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using LL  = long long;
using VI  = vector<LL>;
using VVI = vector<VI>;
using VB  = vector<bool>;
using VS  = vector<string>;
using PII = pair<LL, LL>;
using VP  = vector<PII>;
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first < y.first;});
#define FRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.first > y.first;});
#define SSORT(c)     stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second < y.second;});
#define SRSORT(c)    stable_sort(ALL(c), [] (auto& x, auto& y) {return x.second > y.second;});
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x) {cout << #x << " = " << (x) << endl;}


int main() {
    LL N, X;
    cin >> N >> X;
    //VI L(N);
    LL ans = 1;
    LL D = 0;
    REP(i, N) {
        LL L;
        cin >> L;
        D += L;
        if (D <= X) ans++;
        else break;
    }
    cout << ans << endl;
    
	
    return 0;
}


Measured memory_bytes: 256
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let N = readInt()!
var ans = 1
for i in 1...31622 {
    let square = i * i
    if square > N {
        break
    } else {
        ans = square
    }
}
print(ans)


Measured memory_bytes: 7008
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
#define PP 1000000007
using namespace std;

ll N, M;
queue<ll> Q;
vector<vector<ll>> G;
vector<ll> seen;

void bfs(){
 
    if(!Q.empty()){
 
        ll x = Q.front(), L = G[x].size();
 
        Q.pop();
 
        rep(i, 0, L){
 
            if(seen[G[x][i]] != -1)continue;
 
            Q.push(G[x][i]);seen[G[x][i]] = seen[x] + 1;
 
        }
 
        bfs();
 
    }
}

int main(){
cin >> N >> M;
G.resize(N + 1);seen.resize(N + 1);
seen[1] = 0;

rep(i, 2, N + 1)seen[i] = -1;

rep(i, 0, M){

  ll a, b;cin >> a >> b;

  G[a].push_back(b);G[b].push_back(a);

}

Q.push(1);

bfs();
  
cout << "Yes" << endl;

rep(i, 2, N + 1){

  ll L = G[i].size();

  rep(j, 0, L){

    if(seen[G[i][j]] == seen[i] - 1){cout << G[i][j] << endl;break;}

  }

}
  
}

Measured memory_bytes: 12852
n, a, b = map(int, raw_input().split())
V = sorted(map(int, raw_input().split()))
C = {}
for v in V:
    C[v] = C.get(v, 0) + 1

memo = {}
def comb(n, k):
    if n == k or k == 0:
        return 1
    if (n, k) in memo:
        return memo[n, k]
    res = memo[n, k] = comb(n-1, k) + comb(n-1, k-1)
    return res

su = 0.
count = 0

cur = 0
tmp = 0.
for k in sorted(C.keys(), reverse=True):
    if cur >= b:
        break
    if cur+C[k] < a:
        cur += C[k]
        tmp += C[k]*k
    else:
        for c in xrange(max(a, cur+1), min(b, cur+C[k])+1):
            tmp_ = tmp + k*(c-cur)
            if su*c < tmp_:
                su = tmp_/c
                count = comb(C[k], c-cur)
            elif su*c == tmp_:
                count += comb(C[k], c-cur)
        cur += C[k]
        tmp += C[k]*k
print "%.6f" % su
print count


Measured memory_bytes: 2820
n,m = [int(x) for x in input().split()]
py = []
for i in range(m):
    p,y = [int(x) for x in input().split()]
    py.append([p,y,i+1])

def zero(num):
    return str(num).zfill(6)


if m == 1:
    print(zero(py[0][0])+zero(1))
else:
    year_py = sorted(py, key=lambda x: x[1])
    dic = {str(x): 0 for x in range(1,n+1)}

    for i in range(m):
        dic[str(year_py[i][0])] += 1
        year_py[i].append(dic[str(year_py[i][0])])
    yb_py = sorted(year_py, key=lambda x: x[2])

    for i in range(m):
        print(zero(yb_py[i][0]) + zero(yb_py[i][3]))

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int sum=0;
  for(int i=a;i<=b;i++){
    if(c%i==0)sum++;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3116
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    int n,m,x,y;
    cin >> n >> m >> x >> y;
    int xmax=x,ymin=y,temp;
    for(int i=0; i<n; i++){
        cin >> temp;
        xmax=max(xmax,temp);
    }
    for(int i=0; i<m; i++){
        cin >> temp;
        ymin=min(ymin,temp);
    }
    if(xmax<ymin){
        cout << "No ";
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
rock, scissors, paper = gets.split.map(&:to_i)
t = gets.chomp.chars

res = 0
hands = Array.new(n ,'')

t.each_with_index do |c, current|
  case c
  when 'r'
    if hands[current - k] != 'p'
      hands[current] = 'p'
      res += paper
    end
  when 's'
    if hands[current - k] != 'r'
      hands[current] = 'r'
      res += rock
    end
  when 'p'
    if hands[current - k] != 's'
      hands[current] = 's'
      res += scissors
    end
  end
end

puts res

Measured memory_bytes: 14332
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;
int a[55], b[55];

int main(){
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    bool ok = true;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
        ok &= (a[i] == i);
    }
    for(int i = 1; i <= n && !ok; ++i){
        for(int j = i+1; j <= n && !ok; ++j){
            for(int k = 1; k <= n; ++k){
                b[k] = a[k];
            }
            swap(b[i], b[j]);
            bool f = true;
            for(int k = 1; k <= n; ++k){
                f &= (b[k] == k);
            }
            ok = f;
        }
    }
    cout << (ok ? "YES" : "NO") << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <stack>

#define MAX_V 55

using namespace std;

bool dfs(int n, int u, int v, vector<int> *graph) {
  bool is_visited[MAX_V];
  for (int i = 0; i < MAX_V; i++) {
    is_visited[i] = false;
  }

  stack<int> st;

  is_visited[0] = true;
  st.push(0);
 
  while (!st.empty()) {
    int cur = st.top(); st.pop();
    
    for (int i = 0; i < graph[cur].size(); i++) {
      int next_v = graph[cur][i];

      // 辺を使わない処理
      if (cur == u && next_v == v) { continue; }
      if (cur == v && next_v == u) { continue; }

      if ( is_visited[next_v] == false ) {
        is_visited[next_v] = true;
        st.push(next_v);
      }
    }
  }

  for (int i = 0; i < n; i++) {
    if ( is_visited[i] == false ) {
      return false;
    }
  }
  return true;
}

int main() {
  int n, m;
  int aa[MAX_V], bb[MAX_V];
  vector<int> graph[MAX_V];

  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--; b--;

    aa[i] = a; bb[i] = b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  int ans = 0;
  for (int i = 0; i < m; i++) {
    int u = aa[i], v = bb[i];
    if ( dfs(n, u, v, graph) == false ) {
      ans++;
    }
  }

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

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		sc.close();
		System.out.println(B/A>=C?C:B/A);
	}

}

Measured memory_bytes: 35820
n = int(input())
s = input()

output = 0
for i, pivot in enumerate(s):
    x = s[:i]
    y = s[i:]
    dic = {}
    out = 0
    for c in x:
        if not c in dic:
            dic[c] = 1
    for c in y:
        if c in dic:
            out += 1
            del dic[c]
    if out > output:
        output = out

print (output)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define INF (1LL << 60)
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;
	cin >> a >> b;
	if(a == b){
		cout << "1\n";
		return 0;
	}
	ll ans = 0;
	vector<pll> vec;
	rrep(i,60){
		if(!((a >> i) & 1LL) && ((b >> i) & 1LL)){
			ans += (1LL << i) - a;
			vec.pb(pll((1LL << i)+a,(1LL << (i+1))));
			ll nb = b-(1LL << i);
			if(nb == 0){
				vec.pb(pll(b,b+1));
				break;
			}
			rrep(j,i){
				if((nb >> j) & 1){
					vec.pb(pll((1LL << i),(1LL << i)+(1LL << (j+1))));
					break;
				}
			}
			break;
		}
		if((a >> i)&1){
			a -= (1LL << i);
			b -= (1LL << i);
		}
	}
	if(vec[1].se <= vec[0].fi){
		cout << ans + vec[0].se - vec[0].fi + vec[1].se - vec[1].fi << "\n";
	}else if(vec[1].se <= vec[0].se){
		cout << ans + vec[0].se - vec[1].fi << "\n";
	}else{
		cout << ans + vec[1].se - vec[1].fi << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <queue>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

typedef pair<double,int> PDI;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

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

const int MAXN = 1005;

LL x[MAXN], y[MAXN], r[MAXN], visited[MAXN];

double d[MAXN];

int n;

priority_queue<PDI> dijk;

double c2c(int i, int j) {
    LL dx = x[i] - x[j];
    LL dy = y[i] - y[j];
    return sqrt(dx * dx + dy * dy);
}

LL xfin, yfin;

int main() {
    GLL(x[0]); GLL(y[0]);
    GLL(xfin); GLL(yfin);

    GI(n);

    r[0] = r[n+1] = 0;

    FOR1(i, n) {
        GLL(x[i]);
        GLL(y[i]);
        GLL(r[i]);
    }

    x[n+1] = xfin;
    y[n+1] = yfin;

    memset(visited, 0, sizeof visited);

    dijk.push(MP(0.0, 0));

    while (dijk.size() > 0) {
        PDI t = dijk.top(); dijk.pop();

        int u = t.SS; if (visited[u]) continue;

        d[u] = -t.FF;
        visited[u] = 1;

//        DEBUG(u);
//        DEBUG(d[u]);

        FOR1(v, n+1) {
            if (!visited[v]) {
                dijk.push(MP(t.FF - max(0.0, c2c(u, v) - r[u] - r[v]), v));
            }
        }
    }

    cout << setprecision(12) << d[n+1] << "\n";

    return 0;
}


Measured memory_bytes: 8684
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define max(a,b) ((a)<(b)?(b):(a))
#define swap(a,b) a^=b^=a^=b 
#define lb(x) ((x)&(-(x)))
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 200010
using namespace std;
typedef long long ll;
int n,a[N],head[N],nxt[N],to[N],cnt,d1[N],d2[N];
inline void add(int a,int b){to[++cnt]=b,nxt[cnt]=head[a],head[a]=cnt;}
inline void dfs(int x,int p,int* d){
	for(int i=head[x];i;i=nxt[i])if(to[i]^p)d[to[i]]=d[x]+1,dfs(to[i],x,d);
}
int main(){
	cin>>n;
	for(int i=1,a,b;i<n;i++)scanf("%d%d",&a,&b),add(a,b),add(b,a);
	dfs(1,0,d1),dfs(n,0,d2);
	int c1=0,c2=0;
	for(int i=1;i<=n;i++)if(d1[i]<=d2[i])c1++;else c2++;
	puts(c1>c2?"Fennec":"Snuke");
	return 0;
}

Measured memory_bytes: 6016
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(A);
    READV(B);
    READV(T);
    cout<<(T/A)*B<<endl;

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


  
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string S;
  cin>>S;
  set<char> s;
  for(auto c:S){
    s.insert(c);
  }
  cout<<(s.size()>=2?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 256
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: u32) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

struct UnionFind {
    size: Vec<usize>,
    parent: Vec<Option<usize>>,
}

impl UnionFind {
    fn new(n: usize) -> UnionFind {
        UnionFind {
            size: vec![0; n],
            parent: vec![None; n],
        }
    }

    fn get_parent(&mut self, x: usize) -> usize {
        match self.parent[x] {
            None => x,
            Some(y) => self.get_parent(y),
        }
    }

    fn unite(&mut self, x: usize, y: usize) {
        let xp = self.get_parent(x);
        let yp = self.get_parent(y);

        if xp != yp {
            if self.size[xp] < self.size[yp] {
                self.parent[xp] = Some(yp);
            } else {
                self.parent[yp] = Some(xp);
            }
        }
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.get_parent(x) == self.get_parent(y)
    }
}

fn main() {
    let nq: Vec<usize> = read_vec();
    let n = nq[0];
    let q = nq[1];

    let coms: Vec<Vec<usize>> = read_vec2(q as u32);

    let mut uf = UnionFind::new(n);

    for cv in coms {
        if cv[0] == 0 {
            uf.unite(cv[1], cv[2]);
        } else {
            if uf.same(cv[1], cv[2]) {
                println!("1");
            } else {
                println!("0");
            }
        }
    }
}



Measured memory_bytes: 11176
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int N, Y;
    cin >> N >> Y;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N; j++)
        {
            if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y && N - i - j >= 0)
            {
                cout << i << " " << j << " " << N - i - j << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    string w; cin >> w;
    multiset<char> s;
    rfor(c, w) s.insert(c);
    bool p = true;
    rfor(c, s) {
        if(s.count(c) % 2) {
            print("No");
            return 0;
        }
    }
    print("Yes");

    return 0;
}



Measured memory_bytes: 256
import sys

N, T = map(int, sys.stdin.readline().strip().split())
A = list(map(int, sys.stdin.readline().strip().split()))

# 利益の最大額
max_profit = 0
max_count = 0
# その時点での最小金額
tmp_min = float("inf")
# 売買金額のカウント
count = {}

for i in range(N-1):
    if A[i] not in count:
        count[A[i]] = 0
    count[A[i]] += 1

    if tmp_min > A[i]:
        tmp_min = A[i]

    profit = A[i+1] - tmp_min
    if max_profit < profit:
        max_profit = profit
        max_count = 1
    elif max_profit == profit:
        max_count += 1

    # print("max_profit", max_profit, "tmp_min", tmp_min)

print(max_count)

Measured memory_bytes: 64504
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

const i64 mod = 1e9 + 7;
i64 ipow(i64 a, i64 b) {
    i64 x = a, y = 1;
    for (; b > 0; b >>= 1) {
        if (b & 1) (y *= x) %= mod;
        (x *= x) %= mod;
    }
    return y;
}
i64 inv(i64 x) {
    return ipow(x, mod - 2);
}
i64 comb(i64 n, i64 k) {
    i64 a = 1, b = 1;
    for (i64 i = 0; i < k; ++i) {
        (a *= n - i) %= mod;
        (b *= i + 1) %= mod;
    }
    return a * inv(b) % mod;
}
int main() {
    i64 n, a, b;
    cin >> n >> a >> b;
    i64 ans = ipow(2, n) - 1 - comb(n, a) - comb(n, b);
    (ans += 10 * mod) %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<string.h>
#define M 1046570
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
  if(ch=='A')return 1;
  else if(ch=='C')return 2;
  else if(ch=='G')return 3;
  else if(ch=='T')return 4;
  else return 0;
}
long long getKey(char str[]){
  long long sum= 0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p *(getChar(str[i]));
    p*=5;
  }
  return sum;
}
int h1(int key){
  return key%M;
}
int h2(int key){
  return 1+(key%(M-1));
}
int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
  else if(strlen(H[h])==0)return 0;
}
return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}
int main(){
  char str[L],com[9];
  int i,n,h;
  for(i=0;i<M;i++)
    H[i][0]='\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%s %s",com,str);
      if(com[0]=='i'){
	insert(str);
      }
      else{
	if(find(str)){
	  printf("yes\n");
	}else{
	  printf("no\n");
	}
      }
    }
    return 0;
  }

Measured memory_bytes: 14916
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long INF = 1LL<<60;
const int MAX = 210;

int N, M, R;
long long dist[MAX][MAX];

int main() {
    cin >> N >> M >> R;
    vector<int> vr;
    for (int i = 0; i < R; ++i) {  int r; cin >> r; --r; vr.push_back(r); }
    
    // Floyd-Warshall の初期化: dist[i][i] = 0 に注意
    for (int i = 0; i < 210; ++i) {
        for (int j = 0; j < 210; ++j) dist[i][j] = INF;
        dist[i][i] = 0;
    }
    
    // 入力と Floyd-Warshall
    for (int i = 0; i < M; ++i) {
        int a, b, c; cin >> a >> b >> c; --a, --b;
        dist[a][b] = c;
        dist[b][a] = c;
    }
    for (int k = 0; k < N; ++k)
        for (int i = 0; i < N; ++i)
            for (int j = 0; j < N; ++j)
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

    // R! 通りの探索
    long long res = INF;
    sort(vr.begin(), vr.end());
    do {
        long long tmp = 0;
        for (int i = 1; i < vr.size(); ++i) tmp += dist[vr[i]][vr[i-1]];
        res = min(res, tmp);
    } while (next_permutation(vr.begin(), vr.end()));

    cout << res << endl;
}

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

int main(){
  string S;
  cin >> S;
  string vc="ACGT";
  int n=0;
  bool flag=false;
  priority_queue <int> pq;
  for(int i=0;i<S.size();i++){
    for(int j=0;j<vc.size();j++){
      if(S.at(i)==vc.at(j)){
        n++;
        flag=true;
        break;
      }
    }
    if(!flag){
      pq.push(n);
      n=0;
    }
    flag=false;
  }
  pq.push(n);
  cout << pq.top() << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	int a[100000];
	int b[100000];
	int c, d;
	int k;
	int n, m;
	int s, t;
	int x, y, z;


	scanf("%d %d %d", &x,&y,&z);

	c = 10 * y + z;
	if (c % 4 == 0) printf("YES\n");
	else printf("NO\n");

	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();
    }

    private static class Solver {
        private int n;
        private double[][][] dp;

        private void calc(int i, int j, int k) {
            if (dp[i][j][k] >= 0) return;
            if (i > 0 && dp[i-1][j][k] == -1) calc(i - 1, j, k);
            if (j > 0 && dp[i+1][j-1][k] == -1) calc(i+1, j - 1, k);
            if (k > 0 && dp[i][j+1][k-1] == -1) calc(i, j+1, k - 1);
            dp[i][j][k] = 0;
            if (i > 0) dp[i][j][k] += i * dp[i-1][j][k] / (i + j + k);
            if (j > 0) dp[i][j][k] += j * dp[i+1][j-1][k] / (i + j + k);
            if (k > 0) dp[i][j][k] += k * dp[i][j+1][k-1] / (i + j + k);
            dp[i][j][k] += (double) n / (i + j + k);
        }

        private void solve(InputReader inp, PrintWriter out) {
            n = inp.nextInt();
            dp = new double[n+1][n+1][n+1];
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n; j++) {
                    for (int k = 0; k <= n; k++) {
                        dp[i][j][k] = -1;
                    }
                }
            }
            dp[0][0][0] = 0;
            int[] cnt = new int[4];
            for (int i = 0; i < n; i++) cnt[inp.nextInt()]++;
            calc(cnt[1], cnt[2], cnt[3]);
            out.println(dp[cnt[1]][cnt[2]][cnt[3]]);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}




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

int main() {
	int n,m;
	cin >> n >> m;
	vector<pair<int,P>> city(m); // (year, (idx, pref))
	rep(i,m) {
		cin >> city[i].second.second >> city[i].first;
		city[i].second.first = i;
	}
	sort(city.begin(), city.end());

	vector<int> num(n+1,0);
	vector<P> ans(m);
	rep(i,m) {
		int idx = city[i].second.first;
		int y = city[i].first;
		int p = city[i].second.second;
		num[p]++;
		ans[idx].second = num[p];
		ans[idx].first = p;
		//printf("%d,%d,%d\n", idx, y, p);
	}
	rep(i,m) printf("%06d%06d\n", ans[i].first, ans[i].second);

	return 0;
}


Measured memory_bytes: 3840