akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define RREP(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sz(x) ((int)(x).size())
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define fs first
#define sc second

#define MOD 1000000007
#define INF 1LL<<55

#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)

using namespace std;

using ll = long long;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pll = P<ll,ll>;
using Pdd = P<double,double>;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vii = V<pair<int, int>>;
using Vll = V<ll>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

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> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

// please declaration dx[8], dy[8]
#define DX {-1,0,1,0,-1,-1,1,1}
#define DY {0,-1,0,1,-1,1,1,-1}
#define DX2 {-1,0,1,0}
#define DY2 {0,-1,0,1}


ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}// 最大公約数
ll lcm(ll a,ll b){return a*b/gcd(a,b);}// 最大公倍数
int factorial(int n){if(n > 1)return n * factorial(n - 1);else return 1;} // 階乗
struct io{io(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}io;// io 高速化

signed main() {
  ll n;
  in(n);

	Vii v(n);
	rep(i, n){
		int t; cin>>t;
		v[i]={t,i+1};
	}

	sort(all(v));

	rep(i, n){
		cout<<v[i].second<<" ";
	}

  return 0;
}



Measured memory_bytes: 1664
n=int(input())
a=list(map(int,input().split()))
A=[]
for i in range(n):
    x=0
    for j in range(10**5):
        if a[i]%2==0:
            a[i]//=2
            x+=1
        if a[i]%2!=0:
            A.append(x)
            break
print(min(A))

Measured memory_bytes: 39024
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
l = sorted(l)
# print(l)
ans = 0
tl = []
for v in l:
    temp = v % 10
    while temp > 10:
        temp = v % 10
    if temp == 0:
        temp = 100
    tl.append(temp)
# print(tl)
tt = []
for i in range(5):
    tt.append([l[i], tl[i]])

# print(tt)
tt.sort(key=lambda x:x[0])
tt.sort(key=lambda x:x[1],reverse=True)

# print(tt)
a = tl.index(min(tl))
# print(a)
# print(l)
l = [x[0] for x in tt]
# print(l)
for i,v in enumerate(l):
    if i != len(l) - 1:
        temp = v % 10
        if temp != 0:
            temp = 10 - temp + v
        else:
            temp = v
        ans = ans + temp
    else:
        ans = ans + v
    # print(ans)

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long knapsack(long long val[],long long wt[], long long n, long long W)
{
	long long dp[n+1][W+1];
	for (long long i=0;i<=n;i++)
	{
		for (long long w=0;w<=W;w++)
		{
			if (i==0||w==0)
			dp[i][w]=0;
			else if (wt[i-1]> w )
			dp[i][w]=dp[i-1][w];
			else
			dp[i][w]=max(dp[i-1][w],val[i-1]+dp[i-1][w-wt[i-1]]);
		}
	}
	return dp[n][W];
}
int main()
{
	long long n,W,i,j,k;
	cin>>n>>W;
	long long val[n],wt[n];
	for (i=0;i<n;i++)
	cin>>wt[i]>>val[i];
	cout<<knapsack(val,wt,n,W)<<endl;
}

Measured memory_bytes: 79104
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int N, T;
    cin >> N >> T;
    vector<int> t(N);
    for(int i=0; i<N; i++) {
        cin >> t[i];
    }

    int64_t ans = T;
    for(int i=1; i<N; i++) {
        ans += min(T, t[i] - t[i-1]);
    }

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


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

#define pb push_back
#define mx 200005
#define MOD 1000000007
#define optimize                                                               \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);
#define inf 0x3f3f3f3f
#define READ freopen("in.txt", "r", stdin);
#define WRITE freopen("out.txt", "w", stdout);

int main(int argc, char *argv[]) {
  int N;
  double vals[55];
  cin >> N;

  for (int i = 0; i < N; ++i) {
    cin >> vals[i];
  }

  sort(vals, vals + N);

  double result = vals[0];
  for (size_t i = 1; i < N; ++i) {
    result = (result + vals[i]) / 2;
  }

  cout << result;

  return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,k,f[105],a,b,ans;
int main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	in(n);in(k);
	for(int i=1;i<=k;i++){
		in(a);
		for(int j=1;j<=a;j++){
			in(b);f[b]=1;
		}
	}
	for(int i=1;i<=n;i++)
	if(f[i]==0)ans++;
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


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

  ll N, K, X, Y;
  cin >> N >> K >> X >> Y;

  cout << min(N,K)*X+max(N-K,(ll)0)*Y << "\n";
  return 0;
}


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

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

	int a,b,c,d;
	cin >> a >> b >> c >> d;
	while (a > 0 && c > 0) {
		c -= b;
		if (c <= 0) break;
		a -= d;
		if (a <= 0) break;
	};
	cout << (a > 0 ? "Yes": "No");
}

Measured memory_bytes: 3652
#include "iostream"
#include "cstring"
#include "cstdio"
#include "vector"
#define PB push_back
#define MP make_pair
using namespace std;
double p, q;
const int N = 15;
double dp[N][1 << N];
int vis[N][1 << N];
double g[N][1 << N];
int v[1 << N];
double getdp(int x, int y);
double gao(int x)
{
	if(__builtin_popcount(x) == 0) return 1.0;
	int s = __builtin_ffs(x) - 1;
	return getdp(s, x ^ (1 << s));
}
double qpow(double x, int y)
{
	double ans = 1.0;
	while(y != 0){
		if(y & 1) ans = ans * x;
		x = x * x;
		y >>= 1;
	}
	return ans;
}
double getdp(int x, int state)
{
	if(vis[x][state]) return dp[x][state];
	vis[x][state] = 1;
	if(state == 0) return dp[x][state] = 1.0;
	int f = __builtin_ffs(state) - 1;
	int s = state ^ (1 << f);
	double sum = 0.0;
	for(int i = s; ; i = (i - 1) & s){
		int tmp = i ^ (1 << f);
		sum += getdp(x, tmp ^ state) * gao(tmp) * g[x][tmp] * qpow(q, v[state] - v[tmp] - v[state ^ tmp]);
		if(i == 0) break;
	}
	return dp[x][state] = sum;
}
vector<int> edge[N];

int main(void)
{
	int n, m, val;
	scanf("%d %d %d", &n, &m, &val);
	q = (double)val / 100.0;
	p = 1.0 - q;
	int x, y;
	for(int i = 1; i <= m; ++ i){
		scanf("%d %d", &x, &y);
		x --;
		y --;
		edge[x].PB(y);
		edge[y].PB(x);
	}
	for(int i = 1; i < (1 << n); ++ i){
		int k = __builtin_ffs(i) - 1;
		v[i] = v[i ^ (1 << k)];
		for(int j = 0; j < edge[k].size(); ++ j){
			int u = edge[k][j];
			if(i & (1 << u)){
				v[i] ++;
			}
		}
		for(int j = 0; j < n; ++ j){	
			if(i & (1 << j)) continue;
			int sum = 0;
			for(int k = 0; k < edge[j].size(); ++ k){
				int u = edge[j][k];
				if(i & (1 << u)){
					sum ++;
				}
			}
			g[j][i] = 1.0 - qpow(q, sum);
		}
	}
	printf("%.12f\n", gao((1 << n) - 1));
	return 0;
}

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

static const int MAX = 100;
static const long long INFTY = (1LL<<32);

int n;
long long d[MAX][MAX];

void floyd(){
    for ( int k = 0; k < n; k++){
        for ( int i = 0; i < n; i++){
            if ( d[i][k] == INFTY ) continue;
            for ( int j = 0; j < n; j++){
                if ( d[k][j] == INFTY ) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main(){
    int e, u, v, c;
    cin >> n >> e;
    
    for ( int i = 0; i < n; i++){
        for ( int j = 0; j < n; j++){
            d[i][j] = ( ( i == j ) ? 0 : INFTY );
        }
    }
    
    for (int i = 0; i < e; i++) {
        cin >> u >> v >> c;
        d[u][v] = c;
    }
    
    floyd();
    
    bool negative = false;
    for ( int i = 0; i < n; i++) if ( d[i][i] < 0) negative = true;
    
    if ( negative ){
        cout << "NEGATIVE CYCLE" << endl;
    }
    else{
        for ( int i = 0; i < n; i++){
            for ( int j = 0; j < n; j++){
                if ( j ) cout << " ";
                if ( d[i][j] == INFTY ) cout << "INF";
                else cout << d[i][j];
            }
            cout << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
	
int main(){
	ios::sync_with_stdio(0) ;
    cin.tie(0) ;
    cout.tie(0) ;	
    int a;
    cin>>a;
    int ans = a+(a*a)+(a*a*a);
    cout<<ans<<"\n";	
	return 0;
	}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
using PII = pair<ll, ll>;
#define FOR(i,a,n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i,n) FOR(i,0,n)
const ll INF = 1LL << 60;
template<typename T> void chmin(T &a, T b) { a = min(a, b); }



int main() {

	int H, W, N;
	cin >> H >> W >> N;
	vector<vector<int>>y(H, vector<int>(W));
	vector<vector<int>>x(H, vector<int>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> y[i][j] >> x[i][j];
		}
	}
	vector<int>sy(N);
	vector<int>sx(N);
	for (int i = 0; i < N; i++) {
		cin >> sy[i] >> sx[i];
	}
	vector<vector<vector<int>>>tapiY(H, vector<vector<int>>(W, vector<int>(20)));
	vector<vector<vector<int>>>tapiX(H, vector<vector<int>>(W, vector<int>(20)));
	for (int i = 0; i < 20; i++) {
		for (int j = 0; j < H; j++) {
			for (int k = 0; k < W; k++) {
				if (i) {
					int yy = tapiY[j][k][i - 1];
					int xx = tapiX[j][k][i - 1];
					tapiY[j][k][i] = tapiY[yy][xx][i - 1];
					tapiX[j][k][i] = tapiX[yy][xx][i - 1];
				}
				else {
					tapiY[j][k][i] = y[j][k];
					tapiX[j][k][i] = x[j][k];
				}
			}
		}
	}
	int ans = 0;
	vector<int>ny(N);
	vector<int>nx(N);
	for (int i = 19; i >= 0; i--) {
		set<pair<int, int>>st;
		for (int j = 0; j < N; j++) {
			ny[j] = tapiY[sy[j]][sx[j]][i];
			nx[j] = tapiX[sy[j]][sx[j]][i];
			st.insert({ ny[j],nx[j] });
		}
		if (st.size() == N) {
			sy = ny;
			sx = nx;
			ans += 1 << i;
		}
	}
	if (ans == (1 << 20) - 1) {
		cout << -1 << endl;
		return 0;
	}
	cout << ans + 1 << endl;
}



Measured memory_bytes: 79156
#include <stdio.h>

int main(void){
	int i,j;
	char buf[104];

	while(fgets(buf,104,stdin)){
		for(i=0;buf[i]!=0;i++){
			if(buf[i]=='@'){
				for(j=0;j<buf[i+1]-'0';j++){
					putchar(buf[i+2]);
				}
				i += 2;
			}
			else{
				putchar(buf[i]);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
	char c[26] = {};
	for (int i = 0; i < 26; i++)
		c[i] = 'a' + i;
	long n;
	cin >> n;
	string ans = "";
	do {
		n--;
		ans += c[n % 26];
		n /= 26;
	} while (n > 0);
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		char[][] A = new char[H][W];
		int[] hh = new int[H];
		int[] ww = new int[W];
		for( int i=0; i<H; i++ ){
			int a = 0;
			String S = sc.next();
			for( int k=0; k<W; k++ ){
				A[i][k] = S.charAt(k);
				if( A[i][k]=='#' ){
					a = 1;
				}
			}
			if( a==0 ){
				hh[i] = 1;
			}
		}
		for( int i=0; i<W; i++ ){
			int a = 0;
			for( int k=0; k<H; k++ ){
				if( A[k][i]=='#' ){
					a = 1;
				}
			}
			if( a==0 ){
				ww[i] = 1;
			}
		}
		for( int i=0; i<H; i++ ){
			String ans = "A";
			if( hh[i]==0 ){
				for( int k=0; k<W; k++ ){
					if( ww[k]==0 ){
						String ss = String.valueOf(A[i][k]);
						ans += ss;
					}
				}
				System.out.println(ans.substring(1));
			}
		}
	}
}


Measured memory_bytes: 30032
#include <bits/stdc++.h>
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod 1000000007
using namespace std;
vector<ll> prime,sfac;
vector<ll>ps;
void sieve(ll n)
{
	prime.assign(n+1,1);
	sfac.assign(n+1,1);    
    for (int p=2; p*p<=n; p++) 
    {         
        if (prime[p] == 1) 
        { 	sfac[p]=p;  			  
            for (int i=p*p; i<=n; i += p) 
              {  prime[i] = 0; sfac[i]=p;}
        } 
    } 
	for(ll i=2;i<=n;i++)
	{
		if(prime[i])
			ps.push_back(i);
	}
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll power(ll x, ll y) 
{ 
    ll res = 1;    
    while (y > 0) 
    { 
        ll k=y&1LL;
        if (k) 
            res = res*x;      
        y = y>>1LL;
        x = x*x;  
    } 
    return res; 
}
 
int isPrime(ll n) 
{ 
    if (n <= 1)  return 0; 
    if (n <= 3)  return 1; 
    if (n%2 == 0 || n%3 == 0) 
        return 0;   
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return 0;  
    return 1; 
} 
void debug(ll a[],ll n)
{
    for(int i=0;i<n;i++)
        cout<<a[i]<<" ";
    cout<<endl;
}
void input(ll a[],ll n)
{
    for(int i=0;i<n;i++)
        cin>>a[i];
}
int main()
{

        ll n;
        cin>>n;
        n%=1000;
        if(n!=0)
            n=1000-n;
        cout<<n<<endl;
    }    

 

Measured memory_bytes: 3672
//				.-/+oossssoo+/-.    										
//        `:+ssssssssssssssssss+:`          
//      -+ssssssssssssssssssyyssss+-        
//    .ossssssssssssssssssdMMMNysssso.      
//   /ssssssssssshdmmNNmmyNMMMMhssssss/     
//  +ssssssssshmydMMMMMMMNddddyssssssss+    
// /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/   	
//.ssssssssdMMMNhsssssssssshNMMMdssssssss.  
//+sssshhhyNMMNyssssssssssssyNMMMysssssss+  						
//ossyNMMMNyMMhsssssssssssssshmmmhssssssso  
//ossyNMMMNyMMhsssssssssssssshmmmhssssssso
//+sssshhhyNMMNyssssssssssssyNMMMysssssss+
//.ssssssssdMMMNhsssssssssshNMMMdssssssss.
// /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
//  +sssssssssdmydMMMMMMMMddddyssssssss+
//   /ssssssssssshdmNNNNmyNMMMMhssssss/
//    .ossssssssssssssssssdMMMNysssso.
//      -+sssssssssssssssssyyyssss+-
//        `:+ssssssssssssssssss+:`
//            .-/+oossssoo+/-.
//
//
//
//..............                                     
//            ..,;:ccc,.                             
//          ......''';lxO.                                                      
//           .';;;:::;,,.x,                          
//      ..'''.            0Xxoc:,.  ...              
//  ....                ,ONkc;,;cokOdc',.            
// .                   OMo           ':ddo.          
//                    dMc               :OO;         
//                    0M.                 .:o.       
//                    ;Wd
//                     ;XO,
//                       ,d0Odlc;,..
//                           ..',;:cdOOd::,.
//                                    .:d;.':;.
//                                       'd,  .'
//                                         ;l   ..
//                                          .o
//                                            c
//                                            .'
//                                             .

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

#define ll long long
#define vi vector<int>
#define pi pair<int, int>

//using namespace __gnu_pbds;
using namespace std;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

//int ans1[3][3], ans2[3][3], a, b, c , d;

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

	int a, b;
	cin >> a >> b;
	if(a != 1 && b != 1){
		cout << 1;
		return 0;
	}
	else if(a != 2 && b != 2){
		cout << 2;
	}
	else{
		cout << 3;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		//int count=0;
		//boolean sw=false;
		int answer=0;
		//String answer="NO";
		//List<Integer> hb=new ArrayList<Integer>();
		//int af=Integer.MAX_VALUE;
		int teihen=0;
		int takasa=0;
		int baburu[]=new int[3];
		//入力
		Scanner sc = new Scanner(System.in);
		for(int i=0;i<3;i++)
		{
			baburu[i]=sc.nextInt();
		}
		//int a=sc.nextInt();
		//String S=sc.next();
		//int [][] cost =new int[N-1][2];
		
		//処理
		for(int i=0;i<baburu.length-1;i++)
		{
			for(int j=baburu.length-1;j>i;j--)
			{
				if(baburu[j-1]>baburu[j])
				{
					int tmp=baburu[j-1];
					baburu[j-1]=baburu[j];
					baburu[j]=tmp;
				}
			}
		}
		//System.out.println(Arrays.toString(baburu));
		answer=(baburu[0]*baburu[1])/2;
		// 出力
		System.out.println(answer);
	}
}

Measured memory_bytes: 23636
#include<stdio.h>
#include<math.h>
#include<queue>
#include<stack>
#include<string.h>
#include<algorithm>
#include<cctype>
#include<vector>
#include<map>
#include<set>
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
ll pow_mod(ll a, ll b, ll p){//a的b次方求余p； p为mod； 
    ll ret = 1;
    while(b){
        if(b & 1) ret = (ret * a) % p;
        a = (a * a) % p;
        b >>= 1;
    }
    return ret;
}
ll ksm(ll a,ll b,ll p) {
    if(!b)return 1;
    ll ns=ksm(a,b>>1,p);
    ns=ns*ns%p;
    if(b&1)ns=ns*a%p;
    return ns;
}
ll solve(ll n,ll a,ll p){
	ll cou=1;
	for(ll i=n;i>=n-a+1;i--){
		cou=cou*i%p;
	}for(ll i=2;i<=a;i++){
		cou=cou*pow_mod(i,p-2,p)%p;
	}return cou;
}
int main()
{
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll cou=(ksm(2,n,mod)-1+mod)%mod;
	cou=(cou-solve(n,a,mod)+mod)%mod;
	cou=(cou-solve(n,b,mod)+mod)%mod;
	printf("%lld\n",cou);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll X;
        cin >> X;

        ll ans = 8;
        if (X <= 599) ans = 8;
        else if (X <= 799) ans = 7;
        else if (X <= 999) ans = 6;
        else if (X <= 1199) ans = 5;
        else if (X <= 1399) ans = 4;
        else if (X <= 1599) ans = 3;
        else if (X <= 1799) ans = 2;
        else ans = 1;
        cout << ans << endl;
}

Measured memory_bytes: 3616
n = gets.to_i
ans = []
div = 2
while n != 0
  if n % div != 0
    n -= n % div
    ans << 1
  else
    ans << 0
  end
  div *= 2
  if n % div != 0
    n += n % div
    ans << 1
  else
    ans << 0
  end
  div *= 2
end
ans = ans.reverse
ans.shift if ans[0] == 0
ans << 0 if ans.length == 0
ans.each do |x|
  print x
end
puts ""

Measured memory_bytes: 14388
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(void){
    int N, Abuf;
    long long K;
    cin >> N >> K;
    vector<int> A;
    for(int i=0; i<N; i++){
        cin >> Abuf;
        Abuf--;
        A.push_back(Abuf);
    }

    int twnCurrent = 0;
    vector<int> twnOrder;
    set<int> twnVisited;
    for(int i=0; i<N; i++){
        twnOrder.push_back(twnCurrent);
        twnVisited.insert(twnCurrent);
        twnCurrent = A[twnCurrent];
        if(twnVisited.find(twnCurrent) != twnVisited.end())break;
    }
    int twnLoopStart;
    for(int i=0; i<twnOrder.size(); i++){
        if(twnOrder[i] == twnCurrent){
            twnLoopStart = i;
            break;
        }
    }
    int LoopLength = twnOrder.size() - twnLoopStart;
    if(K < twnLoopStart){
        cout << twnOrder[K]+1 << endl;
    }else{
        cout << twnOrder[twnLoopStart + (K-twnLoopStart)%LoopLength]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 14016
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
typedef pair<int,int> pii;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

// graph //
int V,E,r,from,to,weight;
bool dp[50][50];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> V >> E;
    ll all = 1, even = 0, odd = 0;;
    REP(i,V){
        cin >> r;
        all *= 2;
        if(r%2) ++odd;
        else ++even;
    }
    if(odd){
        cout << all / 2 << endl;
    } else {
        if(E) cout << 0 << endl;
        else cout << all << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define INF 100

int N;
int H[16], W[16];
string C[4];

string color = "RGB";
int mask[16][16][16][16];
int Cmask[3];

void printState(int state)
{
	rep(y, 0, 4)
	{
		rep(x, 0, 4)
		{
			int m = (state >> (15 - (y * 4 + x))) & 1;
			cout << m;
		}
		cout << endl;
	}
}

int solve()
{
	queue<int> que;

	que.push(0);
	
	int dist[1 << 16];
	rep(i, 0, 1 << 16) dist[i] = INF;
	dist[0] = 0;

	while (!que.empty())
	{
		int state = que.front(); que.pop();

		if (state == (1 << 16) - 1) return dist[state];

		rep(i, 0, N) rep(j, 0, 3)
		{
			rep(ssy, -(H[i] - 1), 4) rep(ssx, -(W[i] - 1), 4)
			{
				int ttx = ssx + W[i] - 1;
				int tty = ssy + H[i] - 1;

				int sx = max(ssx, 0);
				int sy = max(ssy, 0);
				int tx = min(ttx, 3);
				int ty = min(tty, 3);

				//cout << "--------------" << endl;
				//printState(state);

				int m = (~mask[sx][sy][tx][ty]) & ((1 << 16) - 1);
				int nstate = state & m;
				int mm = Cmask[j] & mask[sx][sy][tx][ty];
				nstate = nstate | mm;

				if (dist[nstate] == INF)
				{
					dist[nstate] = dist[state] + 1;
					que.push(nstate);
				}

				//cout << endl;
				//printState(nstate);
			}
		}
	}

	return -1;
}

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

	while (cin >> N)
	{
		rep(i, 0, N) cin >> H[i] >> W[i];
		rep(i, 0, 4) cin >> C[i];

		rep(sx, 0, 4) rep(tx, sx, 4) rep(sy, 0, 4) rep(ty, sy, 4)
		{
			int m = 0;

			rep(y, 0, 4) rep(x, 0, 4)
			{
				if ((sx <= x && x <= tx) && (sy <= y && y <= ty))
					m = (m << 1) + 1;
				else
					m = (m << 1);
			}

			mask[sx][sy][tx][ty] = m;
		}

		rep(i, 0, 3)
		{
			int m = 0;
			rep(y, 0, 4) rep(x, 0, 4)
			{
				if (C[y][x] == color[i])
					m = (m << 1) + 1;
				else
					m = m << 1;
			}
			Cmask[i] = m;
		}

		cout << solve() << endl;
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (1 << n); i++){
    if (__builtin_popcount(i) != k){
      continue;
    }
    cout << i << ':';
    for (int j = 0; j < n; j++){
      if (i & (1 << j)){
        cout << ' ' << j;
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 3112
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;

const int inf = 0x3f3f3f3f;
typedef long long ll;
const double pi=4*atan(1.0);
int main()
{
	int n,m;
	cin>>n>>m;
	int sum=0;
	for(int i=0;i<m;i++){
		int tmp;
		cin>>tmp;
		sum+=tmp;
	}
	if(n-sum>=0){
		cout<<n-sum<<endl;
	}else{
		cout<<-1<<endl;
	}
 	return 0;
}



Measured memory_bytes: 3636
# tab = [0] * 10**5
import collections
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n = int(input())
info = []
ans = 0

for _ in range(n):
    s = ''.join(sorted(input()))
    # print(s)
    # if ''.join(s) in info:
    #     info[s] = 1
    # else:
    #     info[s] = 2
    info.append(s)

meta = collections.Counter(info)
# print(meta)
for nv in meta.values():
    # print(nv)
    if nv >= 2:
        ans += cmb(nv, 2)

print(ans)

Measured memory_bytes: 20032
#include<bits/stdc++.h>
#define f0(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<=n;i++)
#define f2(i,a,b) for(int i=a;i<=b;i++)
#define sp <<" "                // giving space
#define sp1 <<" "<<              // giving space between two elements
                 // new line
#define M 1000000007              // for mod
#define ll long long
#define ld long double
#define vii vector <pair<int,int>>
#define vll vector <pair<ll,ll>>
#define vi vector <int>
#define vl vector <ll>
#define pb(v,x) v.push_back(x)
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Sort(v) sort(v.begin(),v.end())
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#include <set>
#include <map>


int main(){
    string in;
    cin>>in;
    int n = in.length();
    string x="";
    f0(i,n)
    x.push_back('x');
    cout<<x;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    using namespace std;
    
    bool dotti;
    dotti = true;
    int x,y;
    cin >> x >> y;
    while(x != 0&&y != 0){
        if(dotti)x%=y;
        else y%=x;
        dotti = !dotti;
    }
    cout << x + y<< endl;
}

Measured memory_bytes: 3084
/*
 * InsertionSort.cpp
 *
 *  Created on: 2014/07/25
 *      Author: WanWan1985
 */
#include <iostream>
#include <vector>
using namespace std;
 
void sort(vector<int>& a_rvecIntValue);
 
int main(void) {
 
    int iNum = 0;
    cin >> iNum;
    vector<int> vecIntValue;
    while (iNum) {
        int iIntValue = 0;
        cin >> iIntValue;
        vecIntValue.push_back(iIntValue);
        iNum--;
    }
 
    sort(vecIntValue);
 
    return 0;
}
 
void sort(vector<int>& a_rvecIntValue) {
 
    for (unsigned int i = 0; i < a_rvecIntValue.size(); i++) {
 
        if (i != 0) {
 
            int iIntValue = a_rvecIntValue.at(i);
            int j = i - 1;
            while ((j >= 0) && (a_rvecIntValue.at(j) > iIntValue)) {
                a_rvecIntValue.at(j+1) = a_rvecIntValue.at(j);
                j--;
            }
            a_rvecIntValue.at(j+1) = iIntValue;
        }
 
        for (unsigned int k = 0; k < a_rvecIntValue.size(); k++) {
            cout << a_rvecIntValue.at(k);
            if (k != a_rvecIntValue.size() - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
int main() {
    string s,t;
    cin >> s >> t;
    t.erase(t.end()-1);
    if(s==t){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll h, w, v[110][110],ct=0;
int main(){
	int fl[26] = {};
	int n,ct=0;
	cin >> n;
	char s[100];
	rep(i, n) {
		cin >> s[i]; 
		if (fl[s[i] - 'A'] == 0) { fl[s[i] - 'A']++; ++ct; }
	}
	cout << (ct == 3 ? "Three" : "Four") << endl;
	return 0;
}

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

int main() {
 int N;
 cin >> N ;

  vector<int> vec(N);
 
  for(int i=0; i<N; i++){
  cin >> vec.at(i) ;
  }
  /* cout << vec.at(N-1) << endl; 
  */
  
  int k = vec.at(0);
  for(int i=0; i<N; i++){
  if(k == 2){
  cout << i+1 <<endl;
  break;
  }
  k = vec.at(k-1);
  }
  

  if (k != 2) {
    cout << -1 << endl;
  }

  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fs first
#define se second
#define M 1000000007
#define pii pair<long long,long long>
 
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
unordered_map<char,pii>dir;
ll D=1e9;
 
bool check(ll x,ll y,ll n,ll m){
	return (x>=0 && y>=0 && n>x && m>y);
}

int main()
{
	ios_base::sync_with_stdio(false);
	
	ll n;
	cin>>n;
	if(n>=400 && n<600)
		cout<<8;
	else if(n>=600 && n<800)
		cout<<7;
	else if(n>=800 && n<1000)
		cout<<6;
	else if(n>=1000 && n<1200)
		cout<<5;
	else if(n>=1200 && n<1400)
		cout<<4;
	else if(n>=1400 && n<1600)
		cout<<3;
	else if(n>=1600 && n<1800)
		cout<<2;
	else
		cout<<1;
	cout<<endl;

}



Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#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 svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.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<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

class UF {
private:
    int sz; vector<int> par,nrank;
public:
    UF(){}
    UF(int node_size){ sz = node_size; par.resize(sz),nrank.resize(sz); rep(i,sz){ par[i] = i; nrank[i] = 0; } }
    int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } }
    void unite(int x,int y)
    { x = find(x),y = find(y); if(x == y) return;
    	if(nrank[x] < nrank[y]){ par[x] = y; }else{ par[y] = x; if(nrank[x] == nrank[y]) nrank[x]++; } }
    bool same(int x,int y){ return find(x) == find(y); }
};

template<typename T> class Kruskal{
public:
	struct edge{
		int u,v;
		T cost;
		bool operator<(const edge& another) const {
			return cost < another.cost;
		}
	};
	vector<edge> es;
	vector<int> par,rrank;
	int V;
    Kruskal(int node_size){
        V = node_size;
		par.resize(node_size), rrank.resize(node_size);
	}
	void add_edge(int u,int v,T cost){
		es.push_back((edge){u,v,cost});
	}
	T make(){
		UF uf(V);
		T res = 0;
		int cnt = 0;
        sort(es.begin(),es.end());
		rep(i,es.size()){
			edge e = es[i];
			if(!uf.same(e.u,e.v)){
				uf.unite(e.u,e.v);
				res += e.cost;
				cnt++;
				if(cnt == V-1){
					break;
				}
			}
		}
		return res;
	}
};


int main()
{
    int n;
    cin >> n;
    Kruskal<int> kr(n);
    rep(i,n){
        rep(j,n){
            int a;
            cin >> a;
            if(i < j && a >= 0){
                kr.add_edge(i,j,a);
            }
        }
    }
    cout << kr.make() << "\n";
}

Measured memory_bytes: 3176
#include<stdio.h>
#include<string.h>

int main()
{
	int a,b,k;
	scanf("%d %d %d",&a,&b,&k);
	for(int i=1;i<=k;i++)
	{	
		if(i==1||i%2!=0)
		{	
			if(a%2==0)
			{	
				b+=a/2;
				a=a/2;
			}
			else
			{	
				b+=(a-1)/2;
				a=(a-1)/2;
			}
		}
		else
		{	
			if(b%2==0)
			{	
				a+=b/2;
				b=b/2;
			}
			else
			{	
				a+=(b-1)/2;
				b=(b-1)/2;
			}
		}
	}	
	printf("%d %d\n",a,b);
	return 0;
}




Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <vector>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

const int MAXN = 5005;

int n,tota,totb,ans;
int a[MAXN];
int b[MAXN];

string s,t;

int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> s >> t;
	for (int i = 0;i < n - 1;i++)
		if (s[i] == s[i + 1])
			a[++tota] = i + 1;
	for (int i = 0;i < n - 1;i++)
		if (t[i] == t[i + 1])
			b[++totb] = i + 1;
	if (tota > totb)
	{
		swap(tota,totb);
		swap(a,b);
	}
	ans = 1e9;
	for (int st = -tota;st <= totb + 2;st++)
	{
		if ((~st & 1) != (s[0] != t[0]))
			continue;
		int l = min(1,st),r = max(st + tota - 1,totb),res = 0;
		for (int i = l;i <= r;i++)
		{
			int A = 0,B = 0;
			if (i >= st && i <= st + tota - 1)
				A = a[i - st + 1];
			else if (i > st + tota - 1)
				A = n;
			if (i >= 1 && i <= totb)
				B = b[i];
			else if (i > totb)
				B = n;
			res += abs(A - B);
		}
		ans = min(ans,res);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
// Created by code_sm
//
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
int k,x;
  cin>>k>>x;
if(500*k>=x)
cout<<"Yes";
else
cout<<"No";	
}
int main()
{
//code
int t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}


Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')

def mcomb(n, k, mod):
    def mfac(l, r, mod):
        ans = l
        for i in reversed(range(r, l)):
            ans *= i
            ans %= mod
        return ans

    A = mfac(n, n-k+1, mod)
    B = mfac(k, 1, mod)
    # B = mpow(B,mod-2,mod)
    B = pow(B, mod-2, mod)
    return A * B % mod

def solve():
    N, blue = MI()
    MOD = 1000000007
    red = N - blue
    for i in range(1, blue+1):
        # ans = comb(red+1, i) * comb(blue-1, i-1)
        """
        両端を含む赤ボールの隙間 (red+1個) に青ボールグループ (i個) を入れる場合の数.
        red = 3 のとき、 挿入候補は | a | a | a | の4つ (red+1) となる.
        これに2つの青ボールグループを入れたい場合、 comb(red+1, i) 通りになる.
        """
        if red+1 < i:
            a = 0
        else:
            a = mcomb(red+1, i, MOD)

        """
        青ボール (blue個) をiグループに分割する場合の数.
        b = 4, のとき、分割候補は b | b | b | b　の3つ (blue-1個)となる.
        i = 3, つまり3分割したい場合はこの棒を2個選べば青ボールを3分割できる.
        つまり、この棒からi-1個選べばよいので、 comb(blue-1, i-1) 通りになる.
        """
        if i-1 == 0:
            b = 1
        else:
            b = mcomb(blue-1, i-1, MOD)
        print(a * b % MOD)


if __name__ == '__main__':
    solve()


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

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	if (a < 40) {
		a=40;
	}
	if (b < 40) {
		b = 40;
	}
	if (c < 40) {
		c = 40;
	}
	if (d < 40) {
		d = 40;
	}
	if (e < 40) {
		e = 40;
	}
	cout << (a + b + c + d + e) / 5 << endl;
	return 0;
}


Measured memory_bytes: 3088
#pragma region
#include <bits/stdc++.h>

#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

void solve() {
  int N;
  cin >> N;
  vector<vi32> A(N, vi32(N - 1));
  cin >> A;
  rep(i, N) rep(j, N - 1) {
    A[i][j]--;
  }
  vector<vi32> indices(N, vi32(N, -1));
  rep(i, N) rep(j, N - 1) {
    indices[i][A[i][j]] = j;
  }
  vector<vi32> dp(N, vi32(N + 1, -1));
  vector<vi32> lo(N, vi32(N + 1, 0));
  auto rec = [&](auto rec, int i, int j) -> int {
    if (j == 0) return 0;
    if (dp[i][j] != -1) return dp[i][j];
    if (lo[i][j]) return 1e9;
    lo[i][j] = 1;
    int ret = 0;
    amax(ret, rec(rec, i, j - 1));
    amax(ret, rec(rec, A[i][j - 1], indices[A[i][j - 1]][i]));
    return dp[i][j] = ret == 1e9 ? 1e9 : ret + 1;
  };
  int ans = 0;
  rep(i, N) amax(ans, rec(rec, i, N - 1));
  if (ans == 1e9) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 16384
#include <stdio.h>

int main(void)
{
  int a, b;
  scanf("%d %d", &a, &b);

  if(a, b >= -1000 && a, b <= 10000)
  {
    if(a == b)
    {
      printf("a == b\n");
    }
    if(a > b)
    {
      printf("a > b\n");
    }
    if(a < b)
    {
      printf("a < b\n");
    }
  }
}



Measured memory_bytes: 2068
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n, m = tin()
	dd = [set() for _ in range(n)]
	for _ in range(m):
		s, c = tin()
		dd[s-1].add(c)
	
	for s in dd:
		if len(s) > 1:
			return -1
	
	dd=[list(d) for d in dd]
	if n > 1 and 0 in dd[0]:
		return -1
		
	for i in range(n):
		if len(dd[i])==0:
			dd[i] = [1] if i == 0 and n > 1  else [0]
	ret = ''.join([str(d[0]) for d in dd])
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 9232
N=int(input())
D=sorted(dict([(i,int(input())) for i in range(N)]).items(),key=lambda x:x[1])
M=D[-1][1]
m=D[-2][1]
for i in range(N):
  if i==D[-1][0]:
    print(m)
  else:
    print(M)

Measured memory_bytes: 48540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int INF = 1e9+7;

int N,M;

int main(){
    cin>>N>>M;
    vector<vector<int>> G(N);
    
    for(int i=0; i<M; i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> q;
    q.push(0);
    vector<int> dis(N,INF);
    map<int,int> ans;
    dis[0] = 0;

    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(auto a : G[u]){
            if(dis[u] + 1 < dis[a]){
                dis[a] = dis[u]+1;
                ans[a] = u+1;
                q.push(a);
            }
        } 
    }

    bool flag = true;
    for(int i=0; i<N; i++) if(dis[i] == INF) flag = false;

    if(flag){
        cout<<"Yes"<<endl;
        for(int i=1; i<N; i++){
            cout<<ans[i]<<endl;
        }
    }

    else cout<<"No"<<endl;

    return 0;
}

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n;
    int a[n],b[n];
    rep(i,0,n-1) cin>>a[i];
    rep(i,0,n-1) cin>>b[i];
    vi v,v1; rep(i,0,n-1) v.pb(i+1);
    int t=1;
    do{
        int f1=1,f2=1;
        rep(i,0,n-1){
            if(a[i]!=v[i]) f1=0;
            if(b[i]!=v[i]) f2=0;
        }
        if(f1) v1.pb(t);
        if(f2) v1.pb(t);
        t++;
    }while(next_permutation(all(v)));
    cout<<abs(v1[0]-v1[1]);
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

char a;

struct fastio {
  fastio() {
    ios::sync_with_stdio(false);
    cout << setprecision(10) << fixed;
    cin.tie(0);
  }
};
fastio _fast_io;

int main() {
  cin >> a;
  if (a >= 'a' && a <= 'z')
    cout << 'a' << endl;
  else
    cout << 'A' << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
  int A, B;
  cin >> A >> B;
  if(A < 9 && B < 9){
    cout << "Yay!" << endl;
  }else{
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);++i)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	int H,W; cin>>H>>W;

	vector<string> A(H);
	rp(i,H) cin>>A[i];

	cout<<"#";rp(j,W) cout<<"#";puts("#");
	rp(i,H)cout<<"#"<<A[i]<<"#\n";
	cout<<"#";rp(j,W) cout<<"#";puts("#");

}


Measured memory_bytes: 256