akhauriyash/Code-Regression huggingface dataset:
import sys
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数求めたい
from math import ceil, floor, sqrt #小数点切り上げ、切り捨て、平方根求めたい
from copy import deepcopy #参照で影響されないコピーが作られる
from collections import Counter, deque #要素ごとの出現回数を数える。双方向アクセス可能データ型
import heapq
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
# template


n = int(input())
s = input()

if n >= 3200:
    print(s)
else:
    print('red')





Measured memory_bytes: 5048
import itertools

N, M, Q = map(int, input().split())
q = [list(map(int, input().split())) for _ in range(Q)]
a = [0] * N
max_score = 0
for v in itertools.combinations(range(N + M - 1), N):
    tmp_score = 0
    for n in range(N):
        a[n] = v[n] + 1 - n
    for query in q:
        if (a[query[1] - 1] - a[query[0] - 1]) == query[2]:
            tmp_score += query[3]
    if max_score < tmp_score:
        max_score = tmp_score
print(max_score)


Measured memory_bytes: 9072
# include <bits/stdc++.h>
using namespace std;
int a,b,c,d;
string s,cal,kcal;
char j,k,l;
int main(){
    cin>>s;
    for (int i = 0; i <(int) s.size(); ++i){
        if(s[i]!=',') cout<<s[i];
        else cout<<' ';
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
//keep coding
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define endl "\n"
#define f0(i,n) for(int i=0;i<n;i++) 
#define f1(i,n) for(int i=1;i<=n;i++)
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define debug(val) printf("check%d\n",val)
#define all(v) v.begin(),v.end()
#define pb push_back
#define MP make_pair
#define FF first
#define SS second
#define int long long
#define MOD 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
signed main()
{
   // OJ;
    FIO;
 string s = "";
  int n;
cin >> n;
while(n>0)
{
        n--;
s += (char)('a' + n%26);
n/=26;
}
reverse(s.begin(), s.end());
cout<<s<<endl;
   
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"

using namespace std;

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

const double EPS = 1e-14;

struct building {
	double l, r, h;
};

void solve() {
	double r;int N; cin >> r >> N;
	if (r==0&&N == 0)exit(0);
	vector<building>v;
	REP(i, N) {
		double L, R, H; cin >> L >> R >> H;
		v.push_back({ L,R,H });
	}
	double ok = 0, ng = 1000;
	REP(_, 50) {

		double mid = (ok + ng) / 2;
		/*cout << mid << endl;*/
		double d = 2 * r / 200000;
		REP(c, 200001) {
			double x = -r + d * c;
			//cout << "x:" << x << endl;
			if (r*r - x * x < 0 + EPS)continue;
			double y = sqrt(r*r - x * x)-r+mid;
			if (y < EPS)continue;
			//cout << "y:" << y << endl;
			bool good = false;

			REP(i, N) {
				if (v[i].l < x + EPS && x - EPS < v[i].r&&y - EPS < v[i].h) {
					good = true;
					break;
				}
			}
			if (!good) {
				ng = mid;
				goto END;
			}
		}
		ok = mid;
	END:;
	}
	printf("%.3lf\n",ok);
}

signed main() {
	while (true)solve();
}


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

int main()
{
    unsigned k;
    cin >> k;
    queue<ll> que;
    rep(i, 9) que.push(i + 1);
    vector<ll> ans;
    while (1)
    {
        ll a = que.front();
        que.pop();
        ans.emplace_back(a);
        if (ans.size() == k)
        {
            cout << a << endl;
            return 0;
        }
        ll f = a % 10;
        a *= 10;
        if (f != 0)
            que.push(a + f - 1);
        que.push(a + f);
        if (f != 9)
            que.push(a + f + 1);
    }
}

Measured memory_bytes: 5556
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2199&lang=jp
*/

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

const int INF = 1901001001;

int dp[20001][256];

void init(){
    rep(i,20001) rep(j,256) dp[i][j]=INF;
    
    dp[0][128]=0;
}

int main(){
    vector<int> ans;
    while(1){
        int n,m;
        cin >> n >> m;

        if(n==0) {
            break;
        }    

        vector<int> c(m);
        rep(i,m) cin>>c[i];
        vector<int> y(n);
        rep(i,n){
            cin >> y[i];
        }

        init();

        rep(i,n){
            vector<int> temp(256,INF);
            rep(j,256){
                rep(k,m){
                    int after = j+c[k];
                    if(after>255) after=255;
                    if(after<0) after=0;
                    
                    temp[after]=min(dp[i][j]+(y[i]-after)*(y[i]-after),temp[after]);
            }
        }
        rep(j,256) dp[i+1][j] = temp[j];
    }
    int res = INF;
    rep(i,256){
        res = min(dp[n][i],res);
    }
    //cout << "rep" << endl;
    ans.push_back(res);
}

    rep(i,ans.size()) cout << ans[i] << endl;
    
}


Measured memory_bytes: 23232
#include <bits/stdc++.h>
using namespace std;
int main()
{
    bool chk=true;
    int N;
    cin >> N;
    string A;
    cin >> A;    
    if(N%2==1)
    {
        OP:
        cout << "No" <<endl;
        return 0;
    }
    else
    {
        for(int i=0; i<N/2; i++)
        {
            if(!(A.at(i)==A.at(i+N/2)))
            {
                chk=false;
            }
        }
    }
    if(chk)
    {
        cout << "Yes" <<endl;
    }
    else
    {
        goto OP;
    }
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
vector<ll> v;

//二項係数の計算
const int MAX = 510000;
ll fac[MAX],finv[MAX],inv[MAX];

//テーブルの初期化
void COMinit(){
	fac[0] = fac[1] = 1;//階乗
	finv[0] = finv[1] = 1;//階乗の逆元
	inv[1] = 1;//逆元(1の逆元は1)
	for(int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;//累積積的な感じ
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;//inv[i] = iの逆元(mod mod)
		finv[i] = finv[i - 1] * inv[i] % mod;//階乗の逆元の計算
	}
}
ll COM(int n,int k){//二項係数の計算
	if(n < k){
		return 0;
	}
	if (n < 0 || k < 0){
		return 0;
	} 
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

map<ll,ll> prime_factor(ll n){
	map<ll,ll> res;
	for(ll i = 2; i * i  <= n; i++) {
		while(n % i == 0){
			res[i]++;
			n /= i;
		}
	}
	if (n != 1){
		res[n] = 1;
	}
    return res;
}

int main(){
	ll N,M;cin>>N>>M;
	ll a = 1;
	map<ll,ll> p = prime_factor(M);

	COMinit();
	ll ans = 1LL;
	for(auto i = p.begin(); i != p.end(); i++) {
		ans = (ans * COM(N- 1 + (i->sc),i->sc)) % mod;
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll k, n;
  cin >> k >> n;
  vector <ll> v(n);
  rep(i, n) cin >> v.at(i);
  ll tmp = v.at(0) + k - v.at(n-1);
  rep(i, n-1) {
    tmp = max(v.at(i+1)-v.at(i), tmp);
  }
  cout << k - tmp << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int R,C,Time=-1,Piv,tmpx,tmpy;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
char grid[1005][1005];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin>>R>>C;
	queue<pair<int,int> > bfs;
	for(int i=0;i<=R+1;++i){
		for(int j=0;j<=C+1;++j){
			if(i==0||i==R+1||j==0||j==C+1){
				grid[i][j]='X';
				continue;
			}
			cin>>grid[i][j];
			if(grid[i][j]=='#') bfs.push({i,j});
		}
	}
	while(!bfs.empty()){
		Piv=bfs.size();
		for(int i=0;i<Piv;++i){
			tmpx=bfs.front().first;
			tmpy=bfs.front().second;
			bfs.pop();
			for(int j=0;j<4;++j){
				if(grid[tmpx+dx[j]][tmpy+dy[j]]=='.'){
					grid[tmpx+dx[j]][tmpy+dy[j]]='#';
					bfs.push({tmpx+dx[j],tmpy+dy[j]});
				}
			}
		}
		Time++;
	}
	cout<<Time<<endl;
}

Measured memory_bytes: 9488
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 300005;
int cntE[MAX_N],cntW[MAX_N];

int main()
{
	int N;
	cin >> N;
	string S;
	cin >> S;
	int ans = N;
	rep(i,N)
	{
		if (S[i] == 'W') cntW[i+1]++;
		else cntE[i+1]++;
	}
	rep(i,N)
	{
		cntW[i+1] += cntW[i];
		cntE[i+1] += cntE[i];
	}
	rep(i,N)
	{
		ans = min(ans,cntW[i]+cntE[N]-cntE[i+1]);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> P(N);
    for(int i=0; i<N; i++) {
        int x; cin >> x; x--;
        P[x] = i; 
    }
    int len = 0;
    int right = 0;
    for(int left = 0; left < N; left++) {
        while(right+1 < N && P[right] < P[right+1]) right ++;
        len = max(len, right-left+1);
        if(left==right) right ++;
    }
    cout << N - len << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin >> s;

  if(s=="Sunny"){
    cout << "Cloudy";
  }else if(s=="Cloudy"){
    cout << "Rainy";
  }else{
    cout << "Sunny";
  }

  return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int flag = 0;
    if(S.length()%2 == 1) cout << "No" <<endl;
    else {
        flag = 0;
        for(int i = 0; i < S.length() - 1; i += 2){
            if(S[i] == 'h' && S[i + 1] == 'i') flag = 1;
            else {
                flag = 0;
                break;
            }
        }
        if(flag == 1) cout << "Yes" << endl;
        else cout << "No" << endl;
    
        return 0;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

int main(){

	int n;
	while(cin>>n&&n!=0){

	int a[101];
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}

	int cnt=0;
	for(int j = n-1; j >= 1; j--){
		for(int i = 0; i < j; i++){
			if(a[i]>a[i+1]){
				swap(a[i],a[i+1]);
				cnt++;
			}
		}
	}
	cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <math.h>

#define MAX 999999

int main() {
	int n;
	int i, j;
	double temp = 0;
	int count;
	char list[MAX] = {0};
	char list2[MAX];
	while(scanf("%d", &n) != EOF) {
		for(i = 1; i <= n; i++) {
			list2[i] = 1;
		}
		count = 0;
		temp = sqrt(n);
		for(i = 2; i <= temp; i++) {
			if(list2[i] == 0) continue;
			j = 1;
			while((i*j) <= n) {
				if(j == 1) list[i] = 1;
				list2[i*j] = 0;
				j++;
			}
		}
		for(i = 2; i <= n; i++) {
			if(list2[i] == 1) list[i] = 1;
			if(list[i] == 1) { 
				count++;
			}
		}
		printf("%d\n", count);
	}
	return 0;
}

Measured memory_bytes: 2556
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>
#include <string>

using namespace std;

int main() {
  string w;
  cin >> w;
  transform(w.begin(), w.end(), w.begin(), ::toupper);
  int n = 0;
  while (true) {
    string t;
    cin >> t;
    if (t == "END_OF_TEXT") {
      break;
    }
    transform(t.begin(), t.end(), t.begin(), ::toupper);
    if (t == w) {
      ++n;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string ans = "";
    while(n--){
        ans += (n%26 + 'a');
        n /= 26;
    }
    reverse(all(ans));
    cout << ans;
    return 0;
}
 

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

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
// Head

int n, m;

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

    cin >> n >> m;

    for (int i = 0; 1 + i < m - i; ++i) {
        cout << 1 + i << ' ' << m - i << '\n';
    }

    for (int i = 0; 1 + i < m + 1 - i; ++i) {
        cout << 1 + i + m << ' ' << m + 1 - i + m << '\n';
    }

    return 0;
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main(){
    int n;
    vector<int> a(8, 0);
    int a_free=0;
    int tmp_a;
    int ans_min=0;
    int ans_max;

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_a;
        tmp_a/=400;
        if(tmp_a>=8){
            a_free++;
        }else{
            a[tmp_a]++;
        }
    }
    for(int i=0; i<8; i++){
        if(a[i]!=0){
            ans_min++;
        }
    }

    ans_max=ans_min+a_free;

    if(ans_min==0 && a_free!=0){
        ans_min=1;
    }

    cout << ans_min << " " << ans_max << endl;

    return 0;
}


Measured memory_bytes: 256
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int n, k; string s; cin >> n >> k >> s;
  char previous = '1';
  vector<pair<int, int>> vec;
  int start = -1;
  REP(i, n){
    if(s[i] != previous){
      if(s[i] == '0') start = i;
      else {
        vec.pb(mkp(start, i-1));
      }
    }
    previous = s[i];
  }
  if(s[n-1] == '0') vec.pb(mkp(start, n-1));
  int ans = -1;
  REP(i, vec.size()){
    int end = min(i+k-1, (int)vec.size()-1);
    int a, b;
    if(i == 0) a = 0;
    else a = vec[i-1].second+1;
    if(end == vec.size()-1) b = n-1;
    else b = vec[end+1].first-1;
    ans = max(ans, b-a+1);
  }
  if(ans < 0) cout << n << endl;
  else cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1020
A = 0
B = 0
AB = 0
O = 0

while True:
    try:
        n, t = input().split(',')
        if t == 'A':
            A += 1
        elif t == 'B':
            B += 1
        elif t == 'AB':
            AB += 1
        else:
            O += 1

    except EOFError:
        break

print(A)
print(B)
print(AB)
print(O)


Measured memory_bytes: 5556
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

map<int,int> prime_factor(int n){
    map<int,int> res;
    for(int i=2;i*i<=n;i++){
	while(n%i==0){
	    res[i]++;
	    n/=i;
	}
    }
    if(n!=1) res[n]=1;
    return res;
}

const int mod=1e9+7;
const int sz=200005;

int fact[sz],inv[sz],ifact[sz];

void make(){
    fact[0]=fact[1]=inv[1]=ifact[0]=ifact[1]=1;
    for(int i=2;i<sz;i++){
	fact[i]=fact[i-1]*i%mod;
	inv[i]=inv[mod%i]*(mod-mod/i)%mod;
	ifact[i]=ifact[i-1]*inv[i]%mod;
    }
}

int comb(int n,int k){
    if(n<k) return 0;
    return fact[n]*ifact[k]%mod*ifact[n-k]%mod;
}

signed main()
{
    int N,M; cin>>N>>M;

    auto cnt=prime_factor(M);
    make();

    int ans=1;
    for(auto p:cnt){
	int K=p.second;
	ans*=comb(N+K-1,K);
	ans%=mod;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());

        int[][] tn = new int[N][3];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 3; j++) {
                tn[i][j] = Integer.parseInt(sc.next());
            }

        }

        int x = 0;
        int y = 0;
        int current = 0;
        boolean isRearch = false;
        for (int i = 0; i < N; i++) {
            int dx = Math.abs(tn[i][1] - x);
            int dy = Math.abs(tn[i][2] - y);
            int act = tn[i][0] - current;

            // 距離が行動数未満かどうか
            if (!(act == dx + dy)) {
                if (act % 2 == 0) {
                    // 偶数の場合、差は0だったら到達できる
                    if (dx + dy != 0) {
                        isRearch = false;
                        break;
                    }

                } else if (act % 2 == 1) {
                    // 奇数の場合、差が1だったら到達的できる
                    if (dx + dy != 1) {
                        isRearch = false;
                        break;
                    }
                } else {

                    // 偶数・奇数で条件を満たさないので到達できない
                    isRearch = false;
                    break;
                }
            }

            x = tn[i][1];
            y = tn[i][2];
            current = tn[i][0];
            isRearch = true;
        }

        System.out.println(isRearch ? "Yes" : "No");
    }

}


Measured memory_bytes: 64556
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	AtCoder::Num num = data->getNum();

	const int D = num[0], T = num[1], S = num[2];

	const int buf = T * S;

	if (D <= buf) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	


	delete(data);

	return 0;
}

Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		long  sum=0;
		int max = -1000000;
		int min = 1000000;
		
		try(Scanner sc = new Scanner (System.in)) {
			int n = sc.nextInt();

			for(int i=0;i<n;i++) {
				int x = sc.nextInt();
				if(x>max) max = x;
				if(x<min) min = x;
				sum+=x;
			}

			System.out.printf("%d %d %d\n",min,max,sum);
		}
	}
}
	


Measured memory_bytes: 41396
#include <cstdio>
#define mod 1000000007
long long pow(long long a,int n){
    long long base=a,ans=1;
    while(n){
        if(n&1) ans=ans*base%mod;
        base=base*base%mod,n>>=1;
    }
    return ans;
}
int main(){
    int n;scanf("%d",&n);
    printf("%lld\n",((pow(10,n)-pow(9,n)-pow(9,n)+pow(8,n))%mod+mod)%mod);
    return 0;
}

Measured memory_bytes: 1736
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

void solve() {
	double n;
	cin >> n;
	const double pi = 3.141592;
	cout << 2*pi*n;

}
int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solve();
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster ci
  int A, P; cin >> A >> P;
  cout << (3*A+P)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
//I read the news today, oh boy
//About a lucky man who made the grade
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ll((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
#define roF(i,a,b) for(ll i = ll(a); i >= ll(b); i--)
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll N=1e6;
const ll INF = 1e18;
int main(){
	fastio;
	string s; cin>>s;
	ll l=INF, r=-1;
	For(i,0,sz(s)){
		if(s[i]=='A') l=min(i,l);
		if(s[i]=='Z') r = i;
	}
	cout << r-l+1 << endl;
	return 0;
}



Measured memory_bytes: 720
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1130&lang=jp
 */


#include <iostream>
#include <limits>

constexpr size_t MAX_HEIGHT = 20;
const char START_TILE = '@';
const char PASSABLE_TILE = '.';
const char PROHIBITED_TILE = '#';
const char PASSED_TILE = 'P';

bool is_wall(std::string world[MAX_HEIGHT], size_t x, size_t y) {
	char tile = world[y][x];
	return tile == PROHIBITED_TILE || tile == PASSED_TILE;
}

bool valid(std::string world[MAX_HEIGHT], size_t width, size_t height, size_t x, size_t y) {
	return x < width && y < height // x and y is unsigned
		   && !is_wall(world, x, y);
}

int walk(std::string world[MAX_HEIGHT], size_t width, size_t height, size_t x, size_t y) {
	if (!valid(world, width, height, x, y)) {
		return 0; // ????????????????????\?????????????£?or??¢?´¢??????
	}
	int total = 1; // ????????????????????\?????????1?????¨??????????????????
	world[y][x] = PASSED_TILE; // ??????????????¨????????????????????¨?????????????????????????????????
	// ?????????????????§??????????????????valid???????????????walk????????§
	total += walk(world, width, height, x - 1, y);
	total += walk(world, width, height, x + 1, y);
	total += walk(world, width, height, x, y - 1);
	total += walk(world, width, height, x, y + 1);
	return total;
}

void process(size_t width, size_t height) {
	std::string world[MAX_HEIGHT];
	size_t x = std::numeric_limits<size_t>::max(), y = std::numeric_limits<size_t>::max();
	for (size_t i = 0; i < height; ++i) {
		std::cin >> world[i];
		size_t start_index = world[i].find(START_TILE);
		if (start_index != std::string::npos) {
			x = start_index;
			y = i;
		}
	}

	std::cout << walk(world, width, height, x, y) << std::endl;
}

int main() {
	size_t width, height;
	while (true) {
		std::cin >> width >> height;
		if (width == 0 || height == 0) {
			break;
		}
		else {
			process(width, height);
		}
	}
}

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

using namespace std;

const int Nmax = 105;

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

void min_to(int &x, int y)
{
    if(x > y) x = y;
}

int main()
{
//    freopen("input", "r", stdin);
    cin.sync_with_stdio(false); cin.tie(0);


    cin >> n >> m;
    int i, j;
    for(i=1; i<=n; ++i) cin >> (a[i]+1);

    memset(dp, 0x3f3f3f3f, sizeof(dp));
    dp[1][1] = (a[1][1] != '.');

    for(i=1; i<=n; ++i)
        for(j=1; j<=m; ++j)
        {
            min_to(dp[i+1][j], dp[i][j] + (a[i][j] == '.' && a[i+1][j] != '.'));
            min_to(dp[i][j+1], dp[i][j] + (a[i][j] == '.' && a[i][j+1] != '.'));
        }

    cout << dp[n][m] << '\n';

    return 0;
}


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

const int N=1e5+5;
int n,a,b,h[N];

bool chk(ll k){
	ll cnt=0;
	for(int i=0;i<n;++i)
		if(h[i]-k*b>0){
			ll x=h[i]-k*b;
			cnt+=x/(a-b)+(x%(a-b)!=0);
		}
	return cnt<=k;
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>a>>b;
	for(int i=0;i<n;++i) cin>>h[i];
	ll l=1,r=1e16;
	while(l<=r){
		int m=(l+r)>>1;
		if(chk(m)) r=m-1;
		else l=m+1;
	}
	cout<<l<<'\n';
}




Measured memory_bytes: 4024
#include <iostream>
#include<math.h>
#include<algorithm>
typedef long long int ll;
using namespace std;
ll m,n,p=1000000007;
ll kaijo(ll a,ll p);//a!%p
ll gyaku(ll a,ll p);
ll nCr(ll a,ll b,ll p);
int main(){
    ll ans=1;
    ll insuu[50][2];
    for(int i=0;i<50;i++){
        insuu[i][1]=0;
        insuu[i][0]=0;
    }
    int now=0;
    cin>>n>>m;
    repeat:
        for(int t=2;t<fminl(m,100000);t++){
            if(m%t==0){
                if(insuu[now][0]!=t){
                    if(insuu[0][0]==0){
                    insuu[0][0]=t;
                    insuu[0][1]++;
                    }
                    else{
                        now++;
                        insuu[now][0]=t;
                        insuu[now][1]++;
                    }
                }
                else{
                    insuu[now][1]++;
                }
                m=m/t;
                goto repeat;
            }
        }
    if(m>1){
    	if(insuu[now][0]==m){
    		insuu[now][1]++;
    	}
    	else{
        now++;
        insuu[now][0]=m;
        insuu[now][1]=1;
    	}
    }
 
    for(int i=0;i<now+1;i++){
      //cout<<insuu[i][0]<<" "<<insuu[i][1]<<endl;
        ans=(ans*nCr(n+insuu[i][1]-1,insuu[i][1],p))%p;
    }
    

    cout<<ans<<endl;
 
}
ll kaijo(ll a,ll p){
    ll k=1;
    for(int i=1;i<a+1;i++){
        k=(k*i)%p;
    }
 
    return k;
}
ll gyaku(ll a,ll p){
    //a^(p-2)を求めればよい
    int t[100];
     for(int i=0;i<100;i++){
        t[i]=0;
    }
    ll beki[100];
    ll k=p-2,ans=1;
    int i=0;
    while(k>0){
        t[i]=k%2;
        k=k/2;
        i++;
    }
    beki[0]=a;
    for(int i=0;i<99;i++){
        beki[i+1]=(beki[i]*beki[i])%p;
    }
    for(int i=0;i<100;i++){
        if(t[i]==1){
            ans=(ans*beki[i])%p;
            //cout<<beki[i+1]<<endl;
        }
    }
    return ans;
}
ll nCr(ll a,ll b,ll p){
    ll ans=kaijo(a,p);
    ans=(ans*gyaku(kaijo(b,p),p))%p;
    ans=(ans*gyaku(kaijo(a-b,p),p))%p;
    return ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
long long n, m, input[(1<<20)];
long long t[(1<<20)], ans[(1<<20)], d[(1<<20)];
priority_queue < pair< long long , long long > > q, nq;
vector < long long > a;
int main () {
    cin >> n >> m;

    a.push_back( n );
    for ( long long i = 1 ; i <= m ; i ++ ) {
        cin >> input[i];
        for ( ; a.size() && a.back() >= input[i] ; a.pop_back() ) {}
        a.push_back( input[i] );
    }

    t[ a.size()-1 ] = 1;

    for ( long long i = a.size()-1 ; i > 0 ; i -- ) {
        t[ i-1 ] = t[i]*( a[i]/a[i-1] );

        long long rem = a[i]%a[i-1];
        nq.push ( make_pair( rem, t[i] ) );

        for ( ; !q.empty() && q.top().first >= a[i-1] ; ) {
            long long x = q.top().first, ts = q.top().second;
            q.pop();
            t[i-1] += x/a[i-1]*ts;
            x %= a[i-1];
            nq.push( make_pair( x, ts ) );
        }

        for ( ; !nq.empty(); nq.pop() ){
            q.push( nq.top() );
        }
    }

    /*
    for ( long long i = 0 ; i < a.size() ; i ++ ) {
        cout << a[i] << " " ;
    }
    cout << "\n";

    cout << "====\n";
    cout << t[0] << "\n";
    */
    for ( ; !q.empty() ; q.pop() ) {
        d[0] += q.top().second ;
        d[ q.top().first ] -= q.top().second;
    //    cout << q.top().first << " " << q.top().second << "\n";
    }
    long long sum = 0;
    for ( long long i = 0 ; i < n; i ++ ) {
        sum += d[i];
        if ( i < a[0] ) {
            cout << sum+t[0] << " ";
        }else {
            cout << "0 ";
        }
    }
    cout << "\n";

    return 0;
}


Measured memory_bytes: 10608
#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int N; scanf("%d", &N);
	int i;
	long long s = 0;

	for(i = 0; i < N; i++) {
		int t; scanf("%d", &t);
		s += t;
	}

	printf("%d\n", s / N);
	return 0;
}

Measured memory_bytes: 0
N, K = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)

ans_i = 0
pre = arr[0, K].inject(:+)
arr3 = [] << pre
(N - K).times do |i|
  arr3 << arr3[-1] + arr[i + K] - arr[i]
end
ans_ii = arr3.index(arr3.max)
ans = 0
arr[ans_ii, K].each do |ar|
  ans += (ar * (ar + 1) / 2) / ar.to_f
end
puts ans

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

using namespace std;

struct Item {
    int value;
    int weight;
};

int main()
{
    int n, w;
    cin >> n >> w;
    vector<Item> items(n);
    for (int i = 0; i < n; ++i) {
        int v, w;
        cin >> v >> w;
        items[i] = { v, w };
    }
    vector<int> max_val_for_weight(w + 1);
    for (int weight = 1; weight <= w; ++weight) {
        int max_val = max_val_for_weight[weight-1];
        for (auto item : items) {
            if (item.weight > weight) continue;
            int val = item.value + max_val_for_weight[weight-item.weight];
            if (val > max_val) max_val = val;
        }
        max_val_for_weight[weight] = max_val;
    }
    cout << max_val_for_weight[w] << endl;
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    int cnt = 0;
    REP(i, m)
    {
        cin >> a[i];
        cnt += a[i];
    }
    if(cnt>n){
        cout << -1 << endl;
    }
    else{
        cout <<  n -cnt<< endl;
    }

    return 0;
}

Measured memory_bytes: 3704
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int a, b, c, d;
    cin>>a>>b>>c>>d, a--;

    int divc = b/c - a/c;
    int divd = b/d - a/d;
    int lcm = (c * d) / __gcd(c, d);
    int divcd = b/lcm - a/lcm;

    // cout<<divc<<' '<<divd<<endl;

    cout<<(b - a - divc - divd + divcd);
} 

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	if (a < b) {
		if (b < c) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  ll K, A, B, C, ans = 0;
  cin>>A>>B>>C>>K;
  if(A >= K) {
    ans += K;
  } else {
    ans += A;
    K -= A;
    if(B >= K) {

    } else {
      K -= B;
      ans -= min(C, K);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3136
// Template
#include "bits/stdc++.h"
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T>
inline bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T> 
inline bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}
struct IOSET {
    IOSET() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} ioset;

// Main
int main() {
    int d;
    cin >> d;
    vector<int> c(26);
    rep(i, 26) cin >> c[i];
    vector<vector<int>> s(d, vector<int>(26));
    rep(i, d) rep(j, 26) cin >> s[i][j];

    auto score = [&](vector<int> &t) -> int {
        int res = 0;
        vector<int> last(26, -1);
        rep(i, t.size()) {
            res += s[i][t[i]];
            last[t[i]] = i;
            rep(j, 26) res -= c[j] * (i - last[j]);
            cout << res << "\n";
        }
        return res;
    };

    vector<int> t_(d);
    rep(i, d) {
        cin >> t_[i];
        --t_[i];
    }
    score(t_);
}

Measured memory_bytes: 3716
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<unordered_map>
#include<map>
#include<set>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)
#define loopj(x,y) for(int j = x;j<(y);j++)


#define nl cout<<"\n";
#define ll long long int
using namespace std;
#define mod  1000000007

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int a[5];
	int ans;
	loopi(0, 5)
	{
		cin >> a[i];
		if (a[i] == 0)
			ans = i + 1;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,ans;
	cin>>a>>b>>c>>d;
	if(c>=a && c<=b)cout<<min(b,d)-c;
	else if(a>=c && a<=d)cout<<min(b,d)-a;
	else cout<<0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  long int n;
  int i;
  int flg = 0;
  int ans = 0;
  
  scanf("%ld", &n);
  
  long int d[n*2];
  
  for(i=0; i<(n*2); i++) {
    scanf("%ld", &d[i]);
  }

  for(i=0; i<(2*n); i=i+2){
    if(d[i]==d[i+1]) {
      ans = ans + 1;
    }
    if(ans==3) {
      flg = 1;
    }
    if(d[i]!=d[i+1]) {
      ans = 0;
    }
  }

  if(flg==1) {
    printf("Yes");
  } else {
    printf("No");
  }

  return 0;
}

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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;

int main(){
  int n;
  cin >> n;
  cout << dup(n, 2) - 1;
  
  return 0;
}


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

int main(void)
{
	int N, K;
	cin >> N >> K;

	vector<int> A(N);
	for(int i=0; i<N; i++)
		cin >> A[i];

	////int index = find(A.begin(), A.end(), 1) - A.begin();
	////int left = index;
	////int right = max(0, N - (index + 1));
	////int ret = (left + K-2)/(K-1) + (right + K-2)/(K-1);
	////if(K-1-left%(K-1) + K-1-right%(K-1) <= K-1)
	//	ret--;

	//cout << ret << endl;

	cout << (N-1 + K-2)/(K-1) << endl;

	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(){
  int R,G,B,N;
  int ans = 0;
  int r,g,b;
  scanf("%d %d %d %d",&R,&G,&B,&N);

  for(int i = 0; i <= N; i ++){
    for(int j = i; j <= N; j ++){
      r = i;
      g = j - i;
      b = N - j;
      if((r % R == 0) && (g % G == 0) && (b % B == 0)){
        ans ++;
      }
    }
  }

  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  set<ll>s;
  ll temp,tc,q,x;
  cin>>tc;
  while(tc--)
  {
    cin>>q;
    if(q==0)
    {
      cin>>temp;
      s.insert(temp);
      cout<<s.size()<<endl;
    }
    else if(q==1)
    {
      cin>>x;
      cout<<s.count(x)<<endl;
    }
    else
    {
      cin>>x;
      s.erase(x);
    }
  }
}



Measured memory_bytes: 12368
#include <iostream>
#include <cstdio>
#include <string>
#include <map>

using namespace std;

int main(){
	int n;
	int a[1000];
	cin >> n;

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

	int cost_now;
	int best_cost=10000000;

	for(int i=-100; i<=100; i++){
		cost_now=0;
		for(int j=0; j<n; j++){
			cost_now += ((i-a[j])*(i-a[j]));
		}
		best_cost = min(best_cost, cost_now);
	}

	cout << best_cost << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};
int n,m,x;
int a[13][13];
int cost[13];
ll ans = INT_MAX;

string convert(int n, int k) { // k= global n
    string r;
    int num = n;
    while(n!=0) {r=(n%2==0 ?"0":"1")+r; n/=2;}
    
    string y="";
    for(int i=0;i<k-r.length();i++) {
        y+="0";
    }
    r=y+r;
    return r;
}

bool isvalid(string s){
    bool flag =true;
    for(int j=0;j<m;j++) {
        ll sum = 0;
        for(int i=0;i<s.size();i++) {
            if(s[i]=='1'){
                sum+=a[i][j];
            }
        }
        if(sum<x){
            flag = false;
            return false;
        }
    }
    return true;
}

void solve() {
    
    cin >> n >> m >> x;
    
    for(int i=0;i<n;i++) {
        cin >> cost[i];
        for(int j=0;j<m;j++) {
            cin >> a[i][j];
        }
    }
    
    for(int i=0;i<pow(2,n);i++) {
        
        string s = convert(i,n);
        if(isvalid(s) == true) {
            ll sum = 0;
            for(int j=0;j<s.size();j++) {
                if(s[j]=='1') {
                    sum+=cost[j];
                }
            }
              ans = min(ans, sum);
        }
      
    }
    if(ans==INT_MAX)
        cout << "-1"<<nl;
    else
        cout << ans << nl;
    
    
}

signed main() {
    boost;
    solve();
}

Measured memory_bytes: 4056
n, a, b = 10, 2, 3

n, a, b = map(int,input().split())


def jiecheng(start, end):
    res = 1

    for i in range(start, end + 1):
        res = (res * i) % (10 ** 9 + 7)

    return res

def comb(n, a):
    X = jiecheng(n - a + 1, n) % (10**9  + 7)
    Y = jiecheng(1, a)

    S = X * pow(Y, 10 ** 9 + 5, 10 ** 9 + 7)
    return S


def calculate(n, a, b):
    s = pow(2, n, 10 ** 9 + 7) - 1
    s1 = comb(n, a)
    s2 = comb(n, b)
    res = s - s1 - s2
    res = res % (10**9 + 7)
    return res


result = calculate(n, a, b)
print(result)




Measured memory_bytes: 3064