akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL111
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<int> a(n);
		REP(i, n) cin >> a[i];
		map<int, int> cnt;
		REP(i, n) {
			cnt[a[i]]++;
		}
		auto ite = cnt.end();
		ite--;
		if(ite -> S == 1) {
			int ma = ite -> F;
			ite--;
			DEBUG(ma);
			DEBUG(ite -> F);
			REP(i, n) {
				if(a[i] == ma) {
					cout << ite -> F << endl;
				} else {
					cout << ma << endl;
				}
			}
		} else {

			DEBUG(1);
			REP(i, n) {
				cout << ite -> F << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 7936
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  t,i,j,k,l,n,m;
    cin>>n>>m;
    ll a[n],x,y;
    memset(a,0,sizeof(a));
    while(m--)
    {
        cin>>x>>y;
        a[x-1]++;
        a[y-1]++;
    }
    for(i=0;i<n;i++)
    cout<<a[i]<<endl;

    return 0;
}





Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

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

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(l,r)     ((l)+((r)-(l))/2) 

#define fo(i,a,b)    for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***




void solve()
{
    int n;   
    rd(n);
    cout<<int(pow(n,3))<<endl;
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

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

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 4012
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;

int main()
{
	int x;
	cin >> x;
	if (x < 1200) cout << "ABC" << endl;
	else cout << "ARC" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

int main(){
    int n,a,b,c,d; cin >> n >> a >> b >> c >> d;
    a--; b--; c--; d--;
    // string s; cin >> s;
    char s[n];
    for(int i = 0; i < n; i++) cin >> s[i];
    int ma = INT_MIN, w =0;
    for(int i = a; i < c-1; i++){
        if(s[i] == s[i+1] && s[i] == '#'){
            cout << "No" << endl; return 0;
            // 飛べないとこが二つ続く
        }
    }
    for(int i = b; i < d-1; i++){
        if(s[i] == s[i+1] && s[i] == '#'){
            cout << "No" << endl; return 0;
            // 飛べないとこが二つ続く
        }
    }
    if(c > d){
        for(int i = b; i <= d; i++){
            // cout << s[i-1] << " " << s[i] << " " <<s[i+1] << endl;
            if(s[i-1] == s[i] && s[i] == s[i+1] && s[i] == '.'){
                cout << "Yes" << endl; return 0;
            }
        }
        cout << "No" << endl; 
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

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

#define llint long long int

using namespace std;

int main(){
    int H1, M1, H2, M2, K;

    cin >> H1 >> M1 >> H2 >> M2 >> K;

    cout << (H2 - H1) * 60 + (M2 - M1) - K << endl;
}

Measured memory_bytes: 3636
public class Main {
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				sb.delete(0, sb.length());
				System.out.println(sb.append(i+1).append('x').append(j+1).append('=').append((i+1)*(j+1)));
			}
		}
	}
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
vvi c(10,vi(10,1e9));
void warshall(){
	rep(i,10){
		rep(j,10){
			rep(k,10){
				c[j][k]=min(c[j][k],c[j][i]+c[i][k]);
			}
		}
	}
}

int main(){
	int n,m;cin>>n>>m;
	rep(i,10){
		rep(j,10){
			cin>>c[i][j];
		}
	}
	ll ans=0;
    warshall();
    vvi a(n,vi(m));
	rep(i,n){
		rep(j,m){
			cin>>a[i][j];
			if(a[i][j]!=-1){
				ans+=c[a[i][j]][1];
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;

class Dice {
public:
	vector<int>D;

	vector<int>North() {
		vector<int>E = D;
		E[0] = D[3]; E[1] = D[2]; E[2] = D[0]; E[3] = D[1]; E[4] = D[4]; E[5] = D[5];
		return E;
	}
	vector<int>South() {
		vector<int>E = D;
		E[0] = D[2]; E[1] = D[3]; E[2] = D[1]; E[3] = D[0]; E[4] = D[4]; E[5] = D[5];
		return E;
	}
	vector<int>West() {
		vector<int>E = D;
		E[0] = D[4]; E[1] = D[5]; E[2] = D[2]; E[3] = D[3]; E[4] = D[1]; E[5] = D[0];
		return E;
	}
	vector<int>East() {
		vector<int>E = D;
		E[0] = D[5]; E[1] = D[4]; E[2] = D[2]; E[3] = D[3]; E[4] = D[0]; E[5] = D[1];
		return E;
	}
};

int H, W, dp[39][39][7][216]; string S[39], T;
queue<tuple<int, int, int, int>>Q;

void refresh(int a1, int a2, int a3, int a4, int a5) {
	if (dp[a1][a2][a3][a4] > a5) {
		dp[a1][a2][a3][a4] = a5;
		if (a3 != 6) Q.push(make_tuple(a1, a2, a3, a4));
	}
}

int solve() {
	for (int i = 0; i < 39; i++) { for (int j = 0; j < 39; j++) { for (int k = 0; k < 7; k++) { for (int l = 0; l < 216; l++) dp[i][j][k][l] = (1 << 30); } } }
	int sx = 0, sy = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '#') { sx = i; sy = j; S[i][j] = 'w'; }
			string CL = "rcgmby";
			for (int k = 0; k < 6; k++) {
				if (S[i][j] == CL[k]) S[i][j] = '0' + k;
			}
		}
	}
	dp[sx][sy][0][0 * 36 + 2 * 6 + 4 * 1] = 0; Q.push(make_tuple(sx, sy, 0, 0 * 36 + 2 * 6 + 4 * 1));
	while (!Q.empty()) {
		int cx = get<0>(Q.front()), cy = get<1>(Q.front()), mask = get<2>(Q.front()), state = get<3>(Q.front()); Q.pop();
		int p1 = state / 36, p2 = (state / 6) % 6, p3 = state % 6;
		Dice X;
		X.D = vector<int>{ p1,p1 ^ 1,p2,p2 ^ 1,p3,p3 ^ 1 };
		int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
		for (int i = 0; i < 4; i++) {
			int fx = cx + dx[i], fy = cy + dy[i];
			if (fx < 0 || fy < 0 || fx >= H || fy >= W || S[fx][fy] == 'k') continue;
			int id = 6; if (S[fx][fy] != 'w') { id = S[fx][fy] - '0'; }
			if (id <= 5 && (T[mask] - '0') != id) continue;

			Dice Y = X;
			if (i == 0) Y.D = Y.North();
			if (i == 1) Y.D = Y.East();
			if (i == 2) Y.D = Y.South();
			if (i == 3) Y.D = Y.West();
			if (id <= 5 && Y.D[0] != id) continue;
			int add = 1; if (id == 6)add = 0;
			refresh(fx, fy, mask + add, Y.D[0] * 36 + Y.D[2] * 6 + Y.D[4] * 1, dp[cx][cy][mask][state] + 1);
		}
	}
	int minx = (1 << 30);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			for (int k = 0; k < 216; k++) minx = min(minx, dp[i][j][6][k]);
		}
	}
	return minx;
}

int main() {
	while (true) {
		cin >> W >> H; if (H == 0 && W == 0) break;
		for (int i = 0; i < 39; i++)S[i] = "";
		for (int i = 0; i < H; i++)cin >> S[i];
		cin >> T;
		for (int i = 0; i < T.size(); i++) {
			string CL = "rcgmby";
			for (int k = 0; k < 6; k++) {
				if (T[i] == CL[k]) T[i] = '0' + k;
			}
		}
		int ans = solve();
		if (ans == (1 << 30)) cout << "unreachable" << endl;
		else cout << ans << endl;
	}
	return 0;
}


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

typedef long long ll;
#define mod 1000000007

int main() 
{
    int n;
    cin>>n;
    if(n==1)
    {
        cout<<1<<endl;
    }
    else
    {
        double a=n/2.0;
        cout<<ceil(a)<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
 
int main()
{
    int n,d1,d2,j=0;
    cin>>n;
    for (int i=0;i<n;i++){
        cin>>d1;
        cin>>d2;
        if (d1==d2){
            j++;
        }else if(d1!=d2 && j<3){
            j=0;
        }
    }
    if (j>2){
        cout<<"Yes";
    }else {
        cout<<"No";
    }
}


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

int main(){
    string str, com, p;
    int q, a, b;
    
    cin >> str >> q;
    for ( int t = 0; t < q; t++ ){
        cin >> com >> a >> b;
        if ( com == "print"){
            cout << str.substr(a, b-a+1) << endl;
        } else if ( com == "reverse"){
            string tmp = str.substr(a, b-a+1);
            int n = tmp.size();
            for ( int i = 0; i < n; i++ ) str[i+a] = tmp[n-i-1];
        } else if ( com == "replace"){
            cin >> p;
            str = str.replace(a, b-a+1, p);
        }
    }

    return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef map<int, int> MI;
typedef set<int> SI;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COUT(x) cout << (x) << endl

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 main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m; cin >> n >> m;
    ll ans = 0;
    ans = min(n, m / 2);
    if(n < m / 2) {
        m -= ans * 2;
        ans += m / 4;
    }
    COUT(ans);
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[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;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long 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;
}

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

	COMinit();

	int N, K;
	cin >> N >> K;
	rep(i, 1, K + 1)
	{
		cout << (COM(N - K + 1, i)*COM(K - 1, i - 1)) % MOD << endl;
	}

	return 0;
}

Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-10;

int main(){
	string s;
	cin>>s;

	map<char, int> mp;
	char c = s[0];
	mp[s[0]]++;
	for(int i = 1; i < s.size(); i++){
		if(s[i]!=c){
			c = s[i];
			mp[s[i]]++;
		}
	}
	char ans = 'o';
	bool f = false;
	if(s[0]=='o' && s[s.size()-1]=='o') f = true;
	if(f){
		if(mp['o'] <= mp['x']) ans = 'x';
	}
	else{
		if(mp['o'] < mp['x']) ans = 'x';
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1180
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int x = Integer.parseInt(br.readLine());
        
        long max = 0;
        long y = 0;
        for (int i = 1; i <= x; i++) {
            for (int j = 2; j <= 1000; j++) {
                y = (long)Math.pow(i, j);
                if (y <= x && y > max) max = y;
            }
        }
        
        System.out.println(max);
    }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    int x, y, z; cin >> x >> y >> z;

    cout << z << " " << x << " " << y << endl;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll a;
double b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> a >> b;
  b = b * 1000.0 / 10.0;
  cout << (a * (ll)b) / 100 << endl;
}


Measured memory_bytes: 3736
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N; cin >> N;
	priority_queue<double, vector<double>, greater<double>> Q;
	for (int i = 0; i < N; i++) {
		double tmp; cin >> tmp;
		Q.push(tmp);
	}

	for (int i = 0; i < N - 1; i++) {
		double tmp1, tmp2;
		tmp1 = Q.top(); Q.pop();
		tmp2 = Q.top(); Q.pop();
		Q.push((tmp1 + tmp2) / 2);
	}

	cout << Q.top() << endl;

	return 0;
}

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

fn main() {
    let (n, a, b): (i64, i64, i64) = (read(), read(), read());
    if a > b || (a != b && n == 1) {
        println!("{}", 0);
    } else {
        let min = a * (n - 1) + b;
        let max = b * (n - 1) + a;
        println!("{}", max - min + 1);
    }
}

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


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

const int Maxn = 100005;

int A, B, M;
int a[Maxn], b[Maxn];

int main()
{
    scanf("%d %d %d", &A, &B, &M);
    int mna = Maxn, mnb = Maxn;
    for (int i = 0; i < A; i++) {
        scanf("%d", &a[i]);
        mna = min(mna, a[i]);
    }
    for (int i = 0; i < B; i++) {
        scanf("%d", &b[i]);
        mnb = min(mnb, b[i]);
    }
    int res = mna + mnb;
    for (int i = 0; i < M; i++) {
        int x, y, c; scanf("%d %d %d", &x, &y, &c); x--; y--;
        res = min(res, a[x] + b[y] - c);
    }
    printf("%d\n", res);
    return 0;
}


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

int main() {
  vector<int> vec(9);
  int n;
  for(int i;i<9;i++){
    cin>>vec.at(i);
  }
  cin>>n;
  vector<int> b(n);
  for(int i;i<n;i++){
    cin>>b.at(i);
  }
  bool ans=false;
  
  for(int i=0;i<9;i++){
    for(int j=0;j<n;j++){
      if(vec.at(i)==b.at(j)){
        vec.at(i)=0;
      }
    }
  }
  
  if(vec.at(0)==0&&vec.at(1)==0&&vec.at(2)==0){
    ans=true;
  }
  if(vec.at(3)==0&&vec.at(4)==0&&vec.at(5)==0){
    ans=true;
  }
  if(vec.at(6)==0&&vec.at(7)==0&&vec.at(8)==0){
    ans=true;
  }
  if(vec.at(0)==0&&vec.at(3)==0&&vec.at(6)==0){
    ans=true;
  }
  if(vec.at(1)==0&&vec.at(4)==0&&vec.at(7)==0){
    ans=true;
  }
  if(vec.at(2)==0&&vec.at(5)==0&&vec.at(8)==0){
    ans=true;
  }
  if(vec.at(0)==0&&vec.at(4)==0&&vec.at(8)==0){
    ans=true;
  }
  if(vec.at(2)==0&&vec.at(4)==0&&vec.at(6)==0){
    ans=true;
  }
  
  if(ans){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}

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

string s;

bool check(int x) {
    int a[3] = {x/100, (x%100)/10, x%10};

    int cnt = 0;
    for (char c: s) {
        int d = c - '0';
        if (d == a[cnt])    cnt++;
        if (cnt == 3)   return true;
    }
    return false;
}

int main() {
    int n;
    cin>>n>>s;

    int ans = 0;
    for (int i=0; i<1000; i++)  ans += check(i);

    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static long mod = 1000000007;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		String s = sc.next();
		StringBuilder sb = new StringBuilder(s);

		int c = 0;
		int oc = 0;
		int mode = 0;



		for(int i = 0;i < sb.length();i++){
//			System.out.println("i " + i + " mode "+ mode);			

			if(mode == 0){							//modeの確定
				if(sb.charAt(i) == ')'){
					mode = 1;
				}else{
					mode = 2;
				}
			}


			if(mode == 1){					
				if(sb.charAt(i) == ')'){
					c++;

				}else{
					for(int j = 0;j < c;j++){
						sb.insert(0,"(");
					}
					i += c-1;
					mode = 0;
					c= 0;

				}

			}else if(mode == 2){
				if(sb.charAt(i) == '('){
					oc++;
				}else{
					oc--;
				}

				if(oc == 0){
					mode = 0;
				}
			}


			//			System.out.println(" mode "+ mode);			
			//			System.out.println();			
		}



		if(c>0){							//"("が多い時後ろに")"をつける
			for(int i = 0;i < c;i++){
				sb.insert(0,"(");
			}
		}

		if(oc>0){							//"("が多い時後ろに")"をつける
			for(int i = 0;i < oc;i++){
				sb.append(")");
			}
		}
		String ans = new String(sb);

		System.out.println(ans);







	}
	static int lowerbond(int k, int[] data){		//kより小さい最小の値をdataの中から探し、返す二分探索
		int min = -1;
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return data[max];
	}


	static long cal(int n){
		long x = (long)n;
		for(int i = n-1;i > 0;i--){
			//	System.out.println(i);
			x *= i;
			x %= mod;
		}
		return x;
	}

}




Measured memory_bytes: 22612
#include <iostream>
#include <cmath>
//#define ll long long
using namespace std;
int a[1001];
int main()
{
	long long n;
	cin >> n;
	long long a = sqrt(n);
	long long tmp1, tmp2;
	for (int i = a;i >= 1;i--)
	{
		if (n % i == 0)
		{
			tmp1 = i;
			tmp2 = n / i;
			break;
		}
	}
	cout << (tmp1 + tmp2 - 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int dp[105][105],n,a,b;
int rec(int p,int q){
	if(dp[p][q] != -1) return dp[p][q];
	if(1 <= p-1 && q != p-1 && rec(q,p-1) == 0) return dp[p][q] = 1;
	if(n >= p+1 && q != p+1 && rec(q,p+1) == 0) return dp[p][q] = 1;
	return dp[p][q] = 0;
}
int main(){
	cin >> n >> a >> b;
	memset(dp,-1,sizeof(dp));
	cout << ((b-a)%2 == 0?"Alice":"Borys") << endl;
}

Measured memory_bytes: 256
list = []
for i in range(6):
    list.append(int(input()))

x = list[:5]
k = list[5]
err = False

for i, x1 in enumerate(x):
    for j, x2 in enumerate(x[i+1:]):
        if abs(x1-x2)>k:
            err = True

if err:
    print(":(")
else:
    print("Yay!")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<ll,ll>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) puts("error")
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):0;}

    const int INF=0x3f3f3f3f;
    const int MOD=924844033;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    inline void add(int &x,const int y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}
        return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=2e3+10;

    ll fac[N];
    int g[N],f[2][N][2][2];
    void main()
    {
        fac[0]=1;for(int i=1;i<N;i++) fac[i]=fac[i-1]*i%MOD;

        int n=qread(),k=qread();g[0]=1;
        for(int st=1;st<=k;st++)
        {
            int ln=(n-st)/k+1;memset(f[0],0,sizeof f[0]);f[0][0][0][0]=1;
            for(int i=1,w=1;i<=ln;i++,w^=1)
            {
                memset(f[w],0,sizeof f[w]);
                for(int cnt=i;cnt>=0;cnt--) for(int a=0;a<=1;a++)
                {
                    add(f[w][cnt][a][0],mm(f[w^1][cnt][0][a]+f[w^1][cnt][1][a]));
                    if(cnt and i>1) add(f[w][cnt][a][0],f[w^1][cnt-1][0][a]);
                    if(cnt and i<ln) add(f[w][cnt][a][1],mm(f[w^1][cnt-1][0][a]+f[w^1][cnt-1][1][a]));
                }
            }
            for(int i=n;i>=0;i--) if(g[i]) for(int cnt=1;cnt<=ln;cnt++)
                g[i+cnt]=(g[i+cnt]+1ll*g[i]*mm(f[ln&1][cnt][0][0]+f[ln&1][cnt][1][0]))%MOD;
        }
        ll ans=0;for(int i=0;i<=n;i++) ans=(ans+ll(i&1?MOD-1:1)*g[i]%MOD*fac[n-i])%MOD;write(ans);
    }//(ans+MOD)%MOD
};
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 384
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int n = sc.nextInt();
		String s = sc.next();

		int r=0;
		int b=0;
		for(int i=0;i<n;i++) {
			char c = s.charAt(i);

			if(c=='R') {
				r++;
			}else {
				b++;
			}

		}
		if(r>b) {
			out.println("Yes");
		}else {
			out.println("No");

		}

		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}


Measured memory_bytes: 25300
#include <cstdio>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int joi[3][1000][1000];

int main(){
  const char *s = "JOI";
  const int h = getInt();
  const int w = getInt();
  const int m = getInt();

  REP(i,h){
    char g[1010];
    scanf("%s", g);

    REP(j,w){
      REP(k,3) if(g[j] == s[k])
        joi[k][i][j]++;
    }
  }

  REP(k,3) REP(i,h) REP(j,w){
    if(i != 0) joi[k][i][j] += joi[k][i - 1][j];
    if(j != 0) joi[k][i][j] += joi[k][i][j - 1];
    if(i != 0 && j != 0)
      joi[k][i][j] -= joi[k][i - 1][j - 1];
  }

  REP(i,m){
    const int y1 = getInt() - 1;
    const int x1 = getInt() - 1;
    const int y2 = getInt() - 1;
    const int x2 = getInt() - 1;

    REP(k,3){
      int ans = joi[k][y2][x2];
      if(x1 != 0) ans -= joi[k][y2][x1 - 1];
      if(y1 != 0) ans -= joi[k][y1 - 1][x2];
      if(x1 != 0 && y1 != 0)
        ans += joi[k][y1 - 1][x1 - 1];
      printf("%d%c", ans, k == 2 ? '\n' : ' ');
    }
  }

  return 0;
}

Measured memory_bytes: 0
//https://atcoder.jp/contests/agc026/submissions/2848703
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

bool solve(){
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if(d < b) return false;
    if(a < b) return false;
    ++c;
    if(c >= b) return true;
    d %= b;
    ll g = gcd(d, b);
    a %= b;
    a += (b - a - 1) / g * g;
    if(c <= a && a < b) return false;
    return true;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    rep(_,t){
        cout << (solve() ? "Yes" : "No") << endl;
    }
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0;i < N;i++)
int main()
{
  int N, M;
  int order[105];
  int point[105] = {0};
  int data;
  cin >> N >> M;
  Rep(i,M) {
    cin >> order[i]; order[i]--;
  }
  Rep(i,M) {
    Rep(j,N) {
      cin >> data; data--;
      if(data == order[i])point[j]++;
      else point[order[i]]++;
    }
  }
  Rep(i,N) cout << point[i] << endl;
  return 0;
}

Measured memory_bytes: 3032
s = input()

if s[0] == '0' or s[-2] == '0' or s[-1] == '1':  # 's' should be like "1xx...x0"
    print(-1)
elif s[:-1] != s[-2::-1]:
    print(-1)
else:
    half = len(s) // 2
    one_indices = [i+1 for i in range(1, half) if s[i] == '1'] # not including 0 or larger than n//2

    parents = [0] * (len(s) + 1)
    parent_index = 1
    for index in one_indices:
        for i in range(parent_index, index):
            parents[i] = index
        parent_index = index

    root = parent_index + 1
    parents[parent_index] = root
    for index in range(root + 1, len(s) + 1):
        parents[index] = root

    for node, parent in enumerate(parents):
        if parent == 0: # This means node is 0 or the root of the tree.
            continue
        print(node, parent)


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

int main(){
    int a,b;
    cin >> a >> b;
    
    if (a < b) cout << "a < b" << endl;
    if (a > b) cout <<"a > b"<<endl;
    if (a == b) cout <<"a == b" <<endl;
    return 0;
}


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

vector< pair < int, int > > nodes;
vector< bool > isChild;

void preorder(int id) {
  if (id != -1) {
    cout << ' ' << id;
    preorder(nodes[id].first);
    preorder(nodes[id].second);
  }
  return;
}

void inorder(int id) {
  static int total = 0;
  if (id != -1) {
    inorder(nodes[id].first);
    cout << ' ' << id;
    inorder(nodes[id].second);
  }
  return;
}

void postorder(int id) {
  static int total = 0;
  if (id != -1) {
    postorder(nodes[id].first);
    postorder(nodes[id].second);
    cout << ' ' << id;
  }
  return;
}

int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  int n, root;
  cin >> n;
  nodes = vector< pair < int, int > > (n, pair< int, int > (-1, -1));
  isChild = vector< bool > (n, false);
  for (int i = 0; i < n; i++) {
    int id, left, right;
    cin >> id >> left >> right;
    if (left != -1) {
      nodes[id].first = left;
      isChild[left] = true;
    }
    if (right != -1) {
      nodes[id].second = right;
      isChild[right] = true;
    }
  }
  for (int i = 0; i < n; i++) {
    if (!isChild[i]) {
      root = i;
      break;
    }
  }
  cout << "Preorder" << endl;
  preorder(root);
  cout << endl;
  cout << "Inorder" << endl;
  inorder(root);
  cout << endl;
  cout << "Postorder" << endl;
  postorder(root);
  cout << endl;
  return 0;
}



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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  ll n, a, b, ans = 0;
  cin >> n >> a >> b;
  ll c[100001];

  rep(i, 0, n) cin >> c[i];

  rep(i, 1, n) {
    if((c[i] - c[i - 1]) * a > b) ans += b;
    else ans += (c[i] - c[i - 1]) * a;
  }

  cout << ans << endl;
}


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

int main() {
	int n, x, i, j, k, count;
	while (1) {
		cin >> n >> x;
		if (n == 0 && x == 0)break;
		count = 0;
		for (i = 1; i <= n; i++) {
			for (j = i + 1; j <= n; j++) {
				for (k = j + 1; k <= n; k++) {
					if (i + j + k == x)count++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
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; }
int Inf = (1<<30);
ll inf = (1LL<<60);
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	bool dp[110000] = {};
	dp[0] = true;
	for (int i = 0; i <= n; i++) {
		if (dp[i]) {
			dp[i + 100]++;
			dp[i + 101]++;
			dp[i + 102]++;
			dp[i + 103]++;
			dp[i + 104]++;
			dp[i + 105]++;
		}
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 384
from collections import deque
n,m = map(int,input().split())
path = [set() for _ in range(n)]
to = [0]*n
dp = [0]*n
for _ in range(m):
    x,y = map(int,input().split())
    path[x-1].add(y-1)
    to[y-1] += 1

que = deque()
for i in range(n):
    if to[i] == 0:
        que.append(i)
ans = 0
while que:
    p = que.popleft()
    for i in path[p]:
        to[i] -= 1
        if to[i] == 0:
            que.append(i)
        dp[i] = max(dp[i], dp[p] + 1)
        ans = max(ans, dp[i])
print(ans)


Measured memory_bytes: 34320
#include<iostream>
#include<cstdio>
#define MN 530000
#define mod 924844033
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,head[MN+5],cnt=0,s[MN+5],size[MN+5],p[MN+5],inv[MN+5],B[MN+5],A[MN+5],w[2][MN+5],N,Inv;
struct edge{int to,next;}e[MN*2+5];
inline void ins(int f,int t)
{
	e[++cnt]=(edge){t,head[f]};head[f]=cnt;
	e[++cnt]=(edge){f,head[t]};head[t]=cnt;
}
inline int pow(int x,int k)
{
	int sum=1;
	for(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;
	return sum;	
}
void Pre(int x,int fa)
{
	size[x]=1;
	for(int i=head[x];i;i=e[i].next) if(e[i].to!=fa)
		Pre(e[i].to,x),++s[size[e[i].to]],size[x]+=size[e[i].to];
	if(size[x]<n) ++s[n-size[x]];
}
void FFT(int*x,int r)
{
	for(int i=0,j=0;i<N;++i)
	{
		if(i>j) swap(x[i],x[j]);
		for(int k=N>>1;(j^=k)<k;k>>=1);	
	}
	for(int i=2;i<=N;i<<=1)for(int j=0;j<N;j+=i)for(int k=0;k<i>>1;++k)
	{
		int t=1LL*x[j+k+(i>>1)]*w[r][N/i*k]%mod;
		x[j+k+(i>>1)]=(x[j+k]-t+mod)%mod;
		x[j+k]=(x[j+k]+t)%mod;	
	}
	if(r)for(int i=0;i<N;++i)x[i]=1LL*x[i]*Inv%mod;
}
inline int C(int n,int m){return 1LL*p[n]*inv[m]%mod*inv[n-m]%mod;}
int main()
{
	n=read();p[0]=p[1]=inv[0]=inv[1]=1;
	for(int i=1;i<n;++i) ins(read(),read());
	Pre(1,0);
	for(int i=2;i<=n;++i) p[i]=1LL*p[i-1]*i%mod,inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
	for(int i=2;i<=n;++i) inv[i]=1LL*inv[i-1]*inv[i]%mod;
	for(N=1;N<=n;N<<=1);N<<=1;int g=pow(5,(mod-1)/N);Inv=pow(N,mod-2);
	for(int i=0,j=1;i<=N;++i,j=1LL*j*g%mod) w[0][i]=w[1][N-i]=j;
	for(int i=0;i<=n;++i) B[i]=inv[i],A[n-i]=1LL*s[i]*p[i]%mod;
	FFT(A,0);FFT(B,0);
	for(int i=0;i<N;++i) A[i]=1LL*A[i]*B[i]%mod;
	FFT(A,1);
	printf("%d\n",n);
	for(int i=2;i<=n;++i) printf("%d\n",((1LL*C(n,i)*n-1LL*A[n-i]*inv[i])%mod+mod)%mod);
	return 0;
}



Measured memory_bytes: 32640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  string s;
  cin >> n >> s;
  bool ans = true;
  int x = n/2;
  
  if (n % 2 == 1){
    ans = false;
  }
  else{
    for (int i = 0;i < x;i++){
      if (s[i] != s[x + i]){
        ans = false;
      }
    }
  }
  
  if (ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;

int main(){
    cin >> n;
    vector<int> a(n*3);
    vector<ll> fsum(n+1,0);
    vector<ll> ssum(n+1,0);
    priority_queue<int,vector<int>,greater<int>> fpq;
    priority_queue<int> spq;
    REP(i,n*3){
        cin >> a[i];
    }
    REP(i,n){
        fpq.push(a[i]);
        fsum[0] += a[i];
    }
    REP(i,n){
        fpq.push(a[i+n]);
        fsum[i+1]=fsum[i]+a[i+n];
        fsum[i+1]-=fpq.top();
        fpq.pop();
    }
    
    REP(i,n){
        spq.push(a[n*3-1-i]);
        ssum[n] += a[n*3-1-i];
    }
    REP(i,n){
        spq.push(a[n*2-1-i]);
        ssum[n-1-i]=ssum[n-i]+a[n*2-1-i];
        ssum[n-1-i]-=spq.top();
        spq.pop();
    }
    ll res = LLONG_MIN;
    REP(i,n+1){
        res = max(res,fsum[i]-ssum[i]);
    }
    put(res);
    return 0;
}




Measured memory_bytes: 4088
<?php

$n = trim(fgets(STDIN));
$p_array = explode(' ', trim(fgets(STDIN)));
$q_array = explode(' ', trim(fgets(STDIN)));

$p_ord = get_ord($p_array, $n);
$q_ord = get_ord($q_array, $n);

print(abs($p_ord - $q_ord));

function get_ord($array, $n)
{
// pの順番
    $ord = 1;
    $ends = [];
    for ($i = 0; $i < $n; $i++) {
        $num = $array[$i];
        for ($k = 1; $k <= $n; $k++) {
            if (in_array($k, $ends)) {
                continue;
            }

            if ($num <= $k) {
                break;
            }

            $tmp = $n - $i - 1;
            $mul = 1;
            for ($l = 1; $l <= $tmp; $l++) {
                $mul *= $l;
            }
            $ord += $mul;
        }
        $ends[] = $num;
    }
    return $ord;
}

Measured memory_bytes: 4604
n, m = map(int, input().split())
s = [list(map(int, input().split()))[1::] for i in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(1 << n):
    light = 0
    for j in range(m):
        cnt = 0
        for k in range(n):
            if i >> k & 1 and (k + 1) in s[j]:
                cnt += 1
        if cnt % 2 == p[j]:
            light += 1
    if light == m:
        ans += 1

print(ans)
            

Measured memory_bytes: 73840
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

const int N = 222222;
int a[N], s[N], t[N];
int n, k;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    rep(i, 1, n) {
        cin >> a[i];
        s[i] = s[i - 1] + a[i];
        t[i] = ((s[i] - i) % k + k) % k;
    }
    map<int, int> cnt;
    int ans = 0;
    cnt[0]++;
    rep(i, 1, n) {
        if(i - k >= 0) {
            cnt[t[i - k]]--;
        }
        ans += cnt[t[i]];
        cnt[t[i]]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 17664
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    robots = []
    for i in range(N):
        x, l = map(int, input().split())
        robots.append((x-l, x+l))
    robots = sorted(robots, key=lambda x: x[1])
    
    pre = -int(1e10)
    ans = 0
    for s, e in robots:
        if s >= pre:
            ans += 1
            pre = e
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 19024
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <stdexcept>
#include <vector>
using namespace std;


#define abs(N) ((N>0)?N:-1*N)
#define lt(A,B) ((A>B)?B:A)
#define gt(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)
#define ll long long int

bool check(int * w, int n, int k, int P){
	int cur_k=1,cur_sum=0;
	for (int j = 0; j < n; ++j) {
		if(cur_sum + w[j] <= P){
			cur_sum += w[j];
		}else{
			if(cur_k == k) return false;
			cur_k++;
			cur_sum = 0;
			cur_sum += w[j];
		}
	}
	return true;
}

int BinarySearch(int * w, int n, int k, int init_l, int init_r){
//	println("=============================");
	int l=init_l,r=init_r,c;
	bool res_l,res_r,res_c;
	res_l = check(w,n,k,l);
	res_r = check(w,n,k,r);
	if(res_l) return l;
	while(true){
		c = (l+r)/2;
		res_c = check(w,n,k,c);
//		printf("res[%d]=%d,res[%d]=%d,res[%d]=%d\n",l,res_l,c,res_c,r,res_r);
		if(res_c){
			r = c;
		}else{
			l = c;
		}
		if(r-1 == l){return r;}
	}

	return -1;
}


int main(){
	int n,k;
	scanf("%d %d",&n,&k);

	int max_w = -1,sum_w = 0;
	int w[n];
	for (int i = 0; i < n; ++i) {
		scanf("%d",&w[i]);
		max_w = gt(max_w,w[i]);
		sum_w += w[i];
	}
	int ret = BinarySearch(w,n,k,max_w,sum_w);
	println(ret);
//	for (int P = max_w; P <= sum_w; ++P) {
//		if(check(w,n,k,P)){
//			println(P);
//			return 0;
//		}
//	}
	return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
long long xi, yi, x2, y2, N, x, y;
vector<pair<int, int> > A;
int dp[1<<20];
 
const long double pi = 3.141592653589793;
 
bool inside() {
    if(x < min(xi, x2)) return false;
    if(x > max(xi, x2)) return false;
    if(y < min(yi, y2)) return false;
    if(y > max(yi, y2)) return false;
    return true;
}
 
bool f_type = false;
 
int LIS() {
    if((int)A.size() == 0)
        return 0;
 
    dp[0] = A[0].second;
    int C = 1;
 
    for(int i = 1;i < (int)A.size();i++) {
        if(A[i].second > dp[C-1]) {
            dp[C++] = A[i].second;
            continue;
        }
 
        dp[lower_bound(dp, dp+C, A[i].second)-dp] = A[i].second;
    }
 
    return C;
}
 
int main() {
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
 
    cin>>xi>>yi>>x2>>y2;
    cin>>N;
    for(int i = 0;i < N;i++) {
        cin>>x>>y;
        if(inside()) {
            A.push_back(make_pair(x, y));
        }
    }
 
    if((xi < x2 and yi < y2) or (xi > x2 and yi > y2))
        f_type = true;
 
 
    if(f_type) sort(A.begin(), A.end());
    else sort(A.begin(), A.end(), greater<pair<int, int> >());
 
    int length = LIS(), tlength;
 
    cout << fixed << setprecision(15);
 
    long long tans = (abs(xi-x2)+abs(yi-y2))*100;
 
//    if(f_type) tlength = abs(yi-y2)+1;
//    else tlength = abs(xi-x2)+1;

    tlength = min(abs(xi-x2)+1, abs(yi-y2)+1);
 
    if(xi == x2) tlength = 1;
    if(yi == y2) tlength = 1;
 
    if(length == tlength) {
        cout << tans + (10*pi-20) + (5*pi-20)*(length-1) << endl;
    } else {
        cout << tans + (5*pi-20)*(length) << endl;
    }
 
    return 0;
}

Measured memory_bytes: 2672
#include <iostream>
#include <fstream>
#include <random>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;



int main() {

    //freopen("../input.txt", "r", stdin);

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

    string s;
    cin >> s;

    if (s == "AAA" || s == "BBB") {
        cout << "No";
    } else {
        cout << "Yes";
    }

    return 0;
}

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

const int N=100005;
int n;
long long dp[N],ans;
struct node{int w,s;long long v;}a[N];

bool cmp(node x,node y){return x.w+x.s<y.w+y.s;}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%lld",&a[i].w,&a[i].s,&a[i].v);
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		for(int j=a[i].s;j>=0;j--)
		{
			dp[j+a[i].w]=max(dp[j+a[i].w],dp[j]+a[i].v);
			ans=max(ans,dp[j+a[i].w]);
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 384