akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define int long long
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MAXIN(x) max_element(ALL(x)) - x.begin();
#define MIN(x) *min_element(ALL(x))
#define MININ(x) min_element(ALL(x)) - x.begin();
#define INF 1000000000000
#define MOD 100000070

#define MAXR 100000
#define PI 3.14159265358979323846

using namespace std;



signed main() {

    int n,d;
    cin >> n>> d;
    vector<int> x(n);
    vector<int> y(n) ;
    REP(i, n){
        cin >> x[i];
        cin >> y[i];
    }
    int ans = 0;

    REP(i,n){
        if( sqrt(x[i]*x[i]+y[i]*y[i]) <= d ){
            ans++ ;
        }
    }

    cout << ans <<endl ;


    return 0;
}

Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,a,b;
int main () {
	scanf("%lld%lld%lld",&n,&a,&b);
	if (!((a+b)&1)) {printf("%lld\n",abs(b-a)/2);}
	else {
		printf("%lld\n",min(min(a,b)+(max(a,b)-min(a,b)-1)/2,n-max(a,b)+1+(max(a,b)-min(a,b)-1)/2));
	}
	return 0;
}

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

struct Node {
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void preParse(Node *u) {
  if (u == NIL) {
    return;
  }
  cout << " " << u->key;
  preParse(u->left);
  preParse(u->right);
}

void inParse(Node *u) {
  if (u == NIL) {
    return;
  }
  inParse(u->left);
  cout << " " << u->key;
  inParse(u->right);
}

void insert(int k) {
  Node* y = NIL;
  Node* x = root;
  Node* z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->right = NIL;
  z->left = NIL;

  while(x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if (y == NIL) {
    root = z;
  } else {
    if ( z->key < y->key ) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

Node* find(Node *u, int k) {
  while (u != NIL && k != u->key) {
    if (k < u->key) {
      u = u->left;
    } else {
      u = u->right;
    }
  }
  return u;
}

Node * treeMinimum(Node *x) {
  while (x->left != NIL) {
    x = x->left;
  }
  return x;
}

Node * treeSuccessor(Node *x) {
  if (x->right != NIL) {
    return treeMinimum(x->right);
  }
  Node *y = x->parent;
  while( y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y;
  Node *x;
  if (z->left == NIL || z->right == NIL) {
    y = z;
    // cout << "[P1] delete: " << z->key << ", y: " << y->key << endl;

  } else {

    y = treeSuccessor(z);
    // cout << "[P2] delete: " << z->key << ", y: " << y->key << endl;
  }

  // yの子xを決める
  if (y->left != NIL) {
    // cout << "[p1]" << endl;
    x = y->left;
  } else {
    // cout << "[p2]" << endl;
    x = y->right;
  }
  // cout << "x->key: " << x->key << endl;

  if (x != NIL) {
    x->parent = y->parent;
  }

  if (y->parent == NIL) {
    root = x;
  } else {
    if (y == y->parent->left) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }
  if (y != z) {
    z->key = y->key;
  }
  free(y);
}

int main() {
  int m;
  cin >> m;
  string command;
  for (int i = 0; i < m; i ++) {
    int x;
    cin >> command;
    if (command == "insert") {
      cin >> x;
      insert(x);
    } else if (command == "find") {
      cin >> x;
      Node* t = find(root, x);
      if (t != NIL) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    } else if (command == "delete") {
      cin >> x;
      treeDelete(find(root, x));
    } else if (command == "print") {
      inParse(root);
      cout << endl;
      preParse(root);
      cout << endl;
    }
  }
}



Measured memory_bytes: 21848
#include <iostream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <vector>
#define rep for(int i = 0; i<n; i++)


using namespace std;

int main()
{
	int n, c = 0;
	vector<int> l, r;
	cin >> n;
	
	rep
	{
		l.push_back(1);
		r.push_back(1);
		cin >> l[i] >> r[i];
		c += r[i] - (l[i] - 1);
	}
	cout << c << endl;
	

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;


int main() {
   int n, t = 0;
    cin >> n;
    REP(i, n){
    	int x;
    	cin >> x;
    	if(x%2) t++;
    }
    if(t%2) cout <<"NO";
    else cout <<"YES";
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
mod_cnt = [0] * 2019
mod_cnt[0] = 1
power = 1
remain = 0
answer = 0
for i in range(len(S)-1, -1, -1):
    remain += int(S[i]) * power
    remain %= 2019
    power *= 10; power %= 2019
    answer += mod_cnt[remain]
    mod_cnt[remain] += 1

print(answer)


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

int main() {
    int n ;
    cin >> n;
    switch (n%10)
    {
    case 3:
        cout << "bon";
        break;
    case 0:
    case 1:
    case 6:
    case 8: 
        cout << "pon";
        break;      
    
    default:
        cout << "hon";
        break;
    }
     
    
}

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

int main(){
  int i, N, total=0;
  cin >> N;
  int l[N], r[N];
  for(i=0; i<N; i++){
    cin >> l[i] >> r[i];
    total += r[i]-l[i]+1;
  }

  cout << total << endl;

  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  int n,l;
  cin >> n >> l;
  vi data(n);
  rep(i,n) data[i] = l + i;
  int sample = 0;
  rep(i,n) sample += data[i];
  int ans;
  if(data[n-1] < 0) ans = data[n-1];
  else if(data[0] > 0) ans = data[0];
  else ans = 0;
  cout << sample - ans;
  hinata;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "cmath"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<int>a(N);
	vector<int>b(N);
	vector<int>c(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> c[i];
	}
	a.push_back(0);
	b.push_back(0);
	c.push_back(0);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	vector<long long int>sum_a(N + 1);
	vector<long long int>sum_b(N + 1);
	L = N;
	for (int i = N; i >= 1; i--) {
		while (b[i] < c[L]) {
			L--;
		}
		sum_b[i] = N - L;
	}
	for (int i = N - 1; i >= 1; i--) {
		sum_b[i] += sum_b[i + 1];
	}
	L = N;
	for (int i = N; i >= 1; i--) {
		while (a[i] < b[L]) {
			L--;
		}
		if (L + 1 <= N) {
			sum_a[i] = sum_b[L + 1];
		}
	}
	for (int i = 1; i <= N; i++) {
		M += sum_a[i];
	}
	cout << M << endl;
	return 0;
}


Measured memory_bytes: 3048
n=int(input())
ans=list(map(int,input().split()))
ans.sort()
cnt=n
numans=0
for i in range(cnt-2):
    for j in range(i+1,cnt-1):
        for k in range(j+1,cnt):
            if ans[i]+ans[j]>ans[k] and ans[i]+ans[k]>ans[j] and ans[j]+ans[k]>ans[i] and ans[i]!=ans[j] and ans[j]!=ans[k] and ans[k]!=ans[i]:
                numans+=1
print(numans)


Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  int bit[65]={0};
  int ans=0;
  rep(i,n){
    cin>>a[i];
    int nex=2;
    rep(j,62){
      if(a[i]%nex){
	a[i]-=a[i]%nex;
	bit[j]++;
      }
      nex*=2;
      if(a[i]==0) break;
    }
  }
  int nex=1;
  rep(i,65){
    int num=(bit[i]*(n-bit[i]))%MOD;
    ans+=(num*nex)%MOD;
    ans%=MOD;
    nex*=2;
    nex%=MOD;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <map>

using namespace std;

int main(){
    int d;
    map<int,string>m;
    m[25] = "Christmas";
    m[24] = "Christmas Eve";
    m[23] = "Christmas Eve Eve";
    m[22] = "Christmas Eve Eve Eve";

    cin >> d;

    cout << m[d] << endl;

    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n;
  cin >> n;

  int s = floor(sqrt(n));
  cout << s * s << endl;

  return 0;
}


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

#define for0(i, n) for (long long  i = 0; i < n; i++) 
#define for1(i, n) for (long long  i = 1; i <= n; i++) 
#define forc(i, l, r) for (long long  i = l; i <= r; ++i) 
#define forr0(i, n) for (long long  i = n - 1; i >= 0; i--) 
#define forr1(i, n) for (long long  i = n; i >= 1; i--) 

#define pb push_back
#define fi first
#define se second

#define all(x) (x).begin(), (x).end() 
#define rall(x) (x).rbegin, (x).rend() 

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef long long int lli;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

const ll N = 1e5 + 5;
const ll mod = 1e9 + 7;



int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    { 
        ll i,j,k,n,sum=0;
        cin>>n;
        ll a[n];
        ll dp[n];
        for0(i,n) cin>>a[i];
        dp[0]=0;
        dp[1]=abs(a[1]-a[0]);
        for(i=2;i<n;i++)
        {
            dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
        }
        cout<<dp[n-1]<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 5136
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll,ll> P;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
ll c,d,e,f,p,t,x,y,ans=0;


ll n,k,q;
vl a;

void input(void){
    cin>>n>>k>>q;
    inputv(a,q);    
}

ll solve(void){
    vl aa(n+1,k-q);
    rep(i,q){
        aa[a[i]]++;
    }

    rep(i,n){
        if(aa[i+1]>0){
            cout<<"Yes"<<endl;
        }
        else cout<<"No"<<endl;
    }
    return 0;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 2292
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{ 

    class Program
    {

        
        static void Main(string[] args)
        {

            string S = Console.ReadLine();
            string N = Console.ReadLine();

            if(N.Length <= 3 && int.Parse(N) <= 100 && int.Parse(S[0].ToString()) == 1)
            {
                for(int i = 0; i < int.Parse(N); i++)
                {
                    if(int.Parse(S[i].ToString()) != 1)
                    {
                        Console.WriteLine(S[i]);
                        return;
                    }
                    if(i == int.Parse(N) - 1)
                    {
                        Console.WriteLine("1");
                        return;
                    }
                }
            }
            else
            {
                for(int i = 0; i < S.Length; i++)
                {
                    if(int.Parse(S[i].ToString()) != 1)
                    {
                        Console.WriteLine(S[i]);
                        return;
                    }
                }
            }

        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>

int main(void){
	char fine[32]="CODEFESTIVAL2016",input[32];
	int i,res;
	res=0;
	
	scanf("%s%*c",input);
	for(i=0;i<16;i++){
		if(fine[i]!=input[i]) res++;
	}
	
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		int ans = 0;
		
		if(s.charAt(0) == 'R') {
			ans++;
			if(s.charAt(1) == 'R') {
				ans++;
				if(s.charAt(2) == 'R') {
					ans++;
				}
			}
		}else if(s.charAt(1) == 'R') {
			ans++;
			if(s.charAt(2) == 'R') {
				ans++;
			}
		}else if(s.charAt(2) == 'R'){
			ans++;
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 35716
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
int main() {
	int n, a[101][101], dp[2][101];
	cin >> n;
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++)cin >> a[i][j];
	}
	dp[0][0] = a[0][0];
	dp[1][0] = a[0][0] + a[1][0];
	for (int i = 1; i < n; i++)dp[0][i] = dp[0][i - 1] + a[0][i];
	for (int i = 1; i < n; i++) {
		dp[1][i] = max(dp[0][i] + a[1][i], dp[1][i - 1] + a[1][i]);
	}
	cout << dp[1][n - 1] << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#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>;

vector<int> to[200005];
vector<int> ans;

void dfs(int no, int fr){
  for(int t : to[no]){
    if(t == fr) continue;
    ans[t] += ans[no];
    dfs(t, no);
  }
}

int main(){
  int N, Q;
  cin >> N >> Q;
  rep(i, N - 1){
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(N);
  rep(i, Q){
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0, -1);
  rep(i, N){
    cout << ans[i] << endl;
  }
}


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

typedef long long   ll;
typedef long double ld;

using namespace std;
const ld pi=2*acos(0.0);
ll mod = 998244353;

int main() {
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
 // ios::sync_with_stdio(0);
 // cin.tie(0);
    int n,k;
    int a[5]={0,0,0,0};
    int t =3, ok = 0;
    while(t --)
     cin >> n>>k, a[k] ++ , a[n] ++, ok =ok || n == k;
    sort(a+1, a + 5);
//    cerr << a[1] << a[2] << a[3] << a[4];
    cout << ( !ok && a[1] == 1 && a[2] == 1 && a[3] == 2 && a[4] == 2? "YES" : "NO");
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;

#define MAXNUM 100000000
int main(){
    int  h,w,ch,cw,dh,dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    ch+=1;cw+=1;dh+=1;dw+=1;
    char s[h+4][w+4];
    int dist[h+4][w+4];
    int xvect[4]={1,0,0,-1},yvect[4]={0,1,-1,0};

    REP(i,h+4)REP(j,w+4){
        s[i][j]='#';
        dist[i][j]=MAXNUM;
    }
    REP(i,h)REP(j,w)cin >> s[i+2][j+2];
    if(s[ch][cw]=='#'){
        cout << -1 << endl;
        return 0;
    }
    
    //dist[ch][cw]=0;
    deque<pair<pair<int,int>,int>>que;
    que.push_front(make_pair(make_pair(cw,ch),0));
    while(!que.empty()){
        pair<pair<int,int>,int> now = que.front();
        que.pop_front();
        int x=now.first.first,y=now.first.second,warp_count=now.second;
        dist[y][x]=warp_count;
        REP(i,4){
            int newx = x+xvect[i],newy = y+yvect[i];
            if(s[newy][newx]=='.' and dist[newy][newx] > warp_count){
                que.push_front(make_pair(make_pair(newx,newy),warp_count));
            }
        }
        REP(i,5){
            REP(j,5){
                int diffx = x+j-2,diffy = y+i-2;
                if(s[diffy][diffx]=='.' and dist[diffy][diffx] > warp_count+1){
                    que.push_back(make_pair(make_pair(diffx,diffy),warp_count+1));
                }
            }
        }
        if(dist[dh][dw]!=MAXNUM)break;
    }
    /*REP(i,h){
        REP(j,w){
            cout << dist[i+2][j+2] << " ";
        }
        cout << endl;
    }*/
    if(dist[dh][dw]==MAXNUM){
        cout << -1 << endl;
        return 0;
    }
    cout << dist[dh][dw] << endl;
    return 0;
}

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

int main()
{
int A,B,C,a,b,x,y;
cin>>A>>B>>C>>a>>b;

if(A>B){
         if(C>B)x=B;
         if(C<B)x=C;
}
else {
      if(C>A)x=A;
      if(C<A)x=C;
}

if(a>b) y=b;
else y=a;

cout<<x+y-50<<'\n';                               

return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
 
int main(){
    double n, k;
    cin >> n >> k;
    int pnt;
    double p_win, p_win_sum = 0;
    rep(i,n){
        p_win = 1;
        pnt = i+1;
        if(i>k-2){
            p_win_sum += p_win;
            continue;
        }
        do{
            pnt*= 2;
            p_win *= 0.5;
        }while(pnt <= k-1);
        p_win_sum += p_win;
    }
    p_win_sum /= n;
    cout << fixed;
    cout << setprecision(10) << p_win_sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using namespace std;


int main()
{
    ll k,a,b;
    cin >> k >> a >> b;
    if(b <= a + 2 || k <= a){
        cout << k + 1 << endl;
    }else{
        ll num = b;
        k -= (a+1);
        num += (b-a) * (k/2);
        if(k%2==1){
            num++;
        }
        cout << num << endl;
    }
}

Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define inf int(1e9)
#define half_inf int(1e5)
#define ll_inf ll(1e9)*ll(1e9)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int mod = 1000000007;

int main() {
    ll n, h, w;
    cin >> n >> h >> w;
    ll a[n], b[n];
    rep(i, n) cin >> a[i] >> b[i];
    ll ans = 0;
    rep(i, n) {
        if (a[i] >= h && b[i] >= w)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

x = c - a
y = d - b

print(c - y, end=' ')
print(d + x, end=' ')
print(a - y, end=' ')
print(b + x)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll p;

ll hpow(ll x,ll y){
    ll ans=1;
    ll i=x;
    if(y==0)return 1;
    while(y>0){
        if(y%2==1){
            ans=(ans*i)%p;
        }
        i=(i*i)%p;
        y=y/2;
        
    }
    return ans;
}

int main(){
    ll n;cin>>n>>p;
    string s;cin>>s;
    if(p==2){
        ll ans=0;
        rep(i,0,n-1){
            if((s[i]-'0')%2==0){
                ans+=(i+1);
            }
        }
        cout<<ans<<endl;
        return 0;
    }else if(p==5){
        ll ans=0;
        rep(i,0,n-1){
            if((s[i]-'0')%5==0){
                ans+=(i+1);
            }
        }
        cout<<ans<<endl;
        return 0;
    }
    ll r[n+1];
    r[n]=0;
    ll c[p];
    rep(i,0,p-1)c[i]=0;
    c[0]++;
    for(ll i=n-1;i>=0;i--){
        r[i]=(r[i+1]+(ll)(s[i]-'0')*hpow(10,n-1-i))%p;
        c[r[i]]++;
    }
    ll ans=0;
    rep(i,0,p-1){
        //cout<<c[i]<<endl;
        ans+=c[i]*(c[i]-1)/2;
    }
    cout<<ans<<endl;
    
    return 0;
}




Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define rep1(i,N) for(int i=1;i<=(int)N;i++)
#define pb push_back
#define all(c) c.begin(),c.end()
#define show(x) cout<<#x<<" "<<x<<endl
using namespace std;
int ins[100000];
bool is[200001];
int main(){
	int N,M;
	cin>>N>>M;
	rep(i,M) cin>>ins[i];
	reverse(ins,ins+M);
	vector<int> ans;
	rep(i,M){
		int x=ins[i];
		if(is[x]) continue;
		is[x]=1;
		ans.pb(x);
	}
	rep1(i,N) if(!is[i]) ans.pb(i);
	rep(i,N) cout<<ans[i]<<endl;
}

Measured memory_bytes: 4524
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.Int (Int64)
import Data.List
import Control.Monad
import Control.Monad.ST
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import Data.Bifunctor (first)
import Data.Bits

type Mat = V.Vector (U.Vector Int64)
type BitSet = Int

{-
scoreOne :: Int -> Mat -> BitSet -> Int64
scoreOne !n !mat !set = go 0 [i | i <- [0..n-1], testBit set i]
  where
    go !acc [] = acc
    go !acc (x:xs) = let !r = mat V.! x
                     in go (acc + sum [r U.! y | y <- xs]) xs
-}

-- sort (bitSubsets x) == sort (map (foldl' (.|.) (bit x0)) $ sequence [[0,bit i] | i <- [0..n-1], testBit set i])
bitSubsets :: Int -> [Int]
bitSubsets 0 = [0]
bitSubsets set = let !i = countTrailingZeros set
                     set' = clearBit set i
                     ss = bitSubsets set'
                 in map (.|. bit i) ss ++ ss

main = do
  n <- readLn
  mat <- V.replicateM n $ do
    U.unfoldrN n (readInt64 . BS.dropWhile isSpace) <$> BS.getLine
  let -- scoreOneV == U.generate (2^n) (scoreOne n mat)
      scoreOneV :: U.Vector Int64
      scoreOneV = U.create $ do
        vec <- UM.replicate (2^n) minBound
        UM.write vec 0 0
        let go !set = do
              v <- UM.read vec set
              if v == minBound
                then do let !i = countTrailingZeros set
                        let !set' = clearBit set i
                        v0 <- go set'
                        let !v = v0 + sum [(mat V.! i) U.! j | j <- [i+1..n-1], testBit set' j]
                        UM.write vec set v
                        return v
                else return v
        mapM_ go [1..2^n-1]
        return vec
  let result :: Int64
      result = runST $ do
        vec <- UM.replicate (2^n) minBound
        UM.write vec 0 0
        forM_ [0..n-1] $ \i -> do
          UM.write vec (bit i) 0
        let go !set = do
              v <- UM.read vec set
              if v == minBound
                then do let v0 = scoreOneV U.! set
                        let !i0 = countTrailingZeros set
                        v <- foldM (\ !x a -> max x <$> a) v0
                             [ (scoreOneV U.! set' +) <$> go (set `xor` set')
                             | set'' <- bitSubsets (clearBit set i0)
                             , let set' = set'' .|. bit i0
                             , set' /= set
                             ]
                        UM.write vec set v
                        return v
                else return v
        go (2^n-1)
  print result

readInt64 :: BS.ByteString -> Maybe (Int64, BS.ByteString)
readInt64 s = first fromIntegral <$> BS.readInt s


Measured memory_bytes: 5116
import sys
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():
    R = int(input())
    print(R * 2 * 3.141592)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66844
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
const int N=202202;
int a[N];
ll sum[N];
int n,m;
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; i++)
		scanf("%d",&a[i]),sum[a[i]]++;
	ll ans=0;
	for (int i=1; i<=n; i++)
		ans=ans+sum[i]*(sum[i]-1)/2;
	for (int i=1; i<=n; i++){
		if (sum[a[i]]<=1){
			printf("%lld\n",ans);
			continue;	
		}
		ans=ans-sum[a[i]]*(sum[a[i]]-1)/2;	
		printf("%lld\n",ans+(sum[a[i]]-1)*(sum[a[i]]-2)/2);
		ans=ans+sum[a[i]]*(sum[a[i]]-1)/2;			
	}
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
  string s;
  int k,n;
  cin>>n>>k>>s;
  if (s[k-1]=='A')
    s[k-1]='a';
  else if (s[k-1]=='B')
    s[k-1]='b';
  else
    s[k-1]='c';
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
// compile in C++11. use -std=c++11.
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>

// these require C++11
#include <unordered_set>
#include <unordered_map>
#include <random>

using namespace std;

#define int long long

#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x) << " "

#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x) 
#endif

// typedef complex<double> point;
// template<typename T,std::size_t N>
// struct _v_traits {using type = std::vector<typename _v_traits<T,N-1>::type>;};
// template<typename T>
// struct _v_traits<T,1> {using type = std::vector<T>;};
// template<typename T,std::size_t N=1>
// using vec = typename _v_traits<T,N>::type;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

int dfs(int upper,int want,int rest,int greater_than,vector<vector<vector<int>>>& memo){
    if(memo[want][rest][greater_than] != -1){
        return memo[want][rest][greater_than];
    }
    if(rest == 1){
        return greater_than <= want and want <= upper;
    }
    int ret = 0;
    for(int i=greater_than;i<=min(upper,want);i++){
        ret += dfs(upper,want-i,rest-1,i+1,memo);
    }
    return memo[want][rest][greater_than] = ret;
}

int solve(int n,int k,int s){
    vector<vector<vector<int> > > memo(s+1,vector<vector<int> >(k+1,vector<int>(n+2,-1)));
    return dfs(n,s,k,1,memo);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(true){
        int n,k,s;
        cin >> n >> k >> s;
        if(n == 0 and k == 0 and s == 0) return 0;
        cout << solve(n,k,s) << endl;
    }
    return 0;
}

Measured memory_bytes: 1388
# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())
A = list(map(int, input().split()))

fact = [1]
for i in range(1, N + 10):
    fact.append(fact[-1] * i % MOD)


def rev(x):
    return pow(x, MOD - 2, MOD)


def cmb(i, k):
    if i < k:
        return 0
    return fact[i] * rev(fact[k]) * rev(fact[i - k]) % MOD


A.sort()
if N == 2:
    print(A[1], A[0])
    exit()

mv = A[-1]
vm = mv // 2
bli = bisect_left(A, vm)
if bli == N - 1:
    print(mv, A[bli - 1])
elif bli == 0:
    print(mv, A[bli])
else:
    if vm - A[bli - 1] < A[bli] - vm:
        print(mv, A[bli - 1])
    else:
        print(mv, A[bli])



Measured memory_bytes: 94412
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
 int a[33]={1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  int k;
  cin>>k;
  cout<<a[k-1]<<endl;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i=0; i<N; i++) {
    cin >> a[i];
  }

  // v(i,j) = cost of merging i..j, inclusive
  // s(i,j) = sum i..j of a
  vector< vector<long long> > v(N);
  vector< vector<long long> > s(N);
  for (int i=0; i<N; i++) {
    v[i].resize(N, 0);
    s[i].resize(N, 0);
  }

  for (int i=0; i<N; i++) {
    for (int j=i; j<N; j++) {
      if (i == j) {
        s[i][j] = a[i];
      } else {
        s[i][j] = s[i][j-1] + a[j];
      }
    }
  }

  /*
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      cout << s[i][j] << "\t";
    }
    cout << "\n";
  }
  cout << "\n";
  */

  for (int d=1; d<N; d++) {
    for (int i=0; i+d<N; i++) {
      int j = i + d;
      long long best = v[i][i] + v[i+1][j];
      for (int k=i+1; k<j; k++) {
        //cout << i << " " << j << " " << k << "\n";
        best = min(best, v[i][k] + v[k+1][j]);
      }
      v[i][j] = best + s[i][j];
    }
  }

  /*
  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      cout << v[i][j] << "\t";
    }
    cout << "\n";
  }
  */

  cout << v[0][N-1] << "\n";
  return 0;
}


Measured memory_bytes: 2816
w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
m=[[0 for i in range(w)]for i in range(h)]
for x,y,a in xya:
    if a==1:
        for i in range(h):
            for j in range(x):
                m[i][j]=1
    elif a==2:
        for i in range(h):
            for j in range(x,w):
                m[i][j]=1
    elif a==3:
        for i in range(y):
            for j in range(w):
                m[i][j]=1
    else:
        for i in range(y,h):
            for j in range(w):
                m[i][j]=1
ans=0
for i in m:
    ans+=i.count(0)
print(ans)

Measured memory_bytes: 3064
def dfs(n, m, s):
    if n == N:
        return 1 if s == S else 0
    ans = 0
    for i in range(m, 10):
        ans += dfs(n + 1, i + 1, s + i)
    return ans;

while True:
    N, S = map(int, raw_input().split())
    if not N:
        break
    print dfs(0, 0, 0)

Measured memory_bytes: 4204
#include <cstdio>

char S[101010];

int main()
{
    scanf("%s", S);
    
    bool app[26];
    for (int i = 0; i < 26; ++i) {
        app[i] = false;
    }
    for (int i = 0; S[i] != '\0'; ++i) {
        app[S[i] - 'a'] = true;
    }
    for (int i = 0; i < 26; ++i) {
        if (!app[i]) {
            printf("%c\n", (char)(i + 'a'));
            return 0;
        }
    }
    puts("None");
    return 0;
}

Measured memory_bytes: 256
// ------------------------------------
// Date:2018/ 3/ 1
// Problem:ABC 055 SccPuzzle c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

static const int MOD = 1000000007;

int main()
{
  // S1個とc2個で、Sがなくなるまで作る
  // C4個で可能な限り作る
  // N:S / M:c
  ll N, M;
  cin >> N >> M;
  ll ans = 0;
  if (M - N*2 >= 0) {
    ans = N;
    M -= N * 2;
    ans += M/4;
  } else {
    ans = M / 2;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;

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

    int flag=0;
    int l=s.length();
    for(int i=0;i<l;i++)
    {
        if(s[i]!=t[i])
            flag++;
    } 
    cout<<flag;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<pair<P, P>> items(N);
    rep(i, N) cin >> items[i].first.first >> items[i].first.second >> items[i].second.first >> items[i].second.second;
    vector<vector<ll>> imos(1010, vector<ll>(1010, 0));
    rep(i, N) {
        ll x1 = items[i].first.first;
        ll y1 = items[i].first.second;
        ll x2 = items[i].second.first;
        ll y2 = items[i].second.second;
        imos[x1][y1] ++;
        imos[x1][y2] --;
        imos[x2][y1] --;
        imos[x2][y2] ++;
    }
    rep(i, 1005) {
        rep(j, 1005) {
            imos[i][j + 1] += imos[i][j];
        }
    }
    rep(j, 1005) {
        rep(i, 1005) {
            imos[i + 1][j] += imos[i][j];
        }
    }
    ll ans = 0;
    rep(j, 1005) {
        rep(i, 1005) {
            ans = max(ans, imos[i][j]);
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



Measured memory_bytes: 13892
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> h(n);
  rep(i,n){
      cin >> h[i];
  }
  ll ans = 0;
  ll tmp = 0;
  ll now = h[0];
  FOR(i,1,n){
      if(now>=h[i]){
          tmp++;
      }else{
          ans = max(ans,tmp);
          tmp = 0;
      }
      now = h[i];
  }
  ans = max(ans,tmp);
  cout << ans << endl;
}

Measured memory_bytes: 1024
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from collections import Counter
import sys
def main(N, A, Q, BC):
    C = Counter(A)
    s = sum(A)
    for b, c in BC:
        bc = C[b]
        bs = b * bc
        cs = c * bc
        s += cs - bs
        C[b] = 0
        C[c] += bc
        print(s)

if __name__ == '__main__':
    input = sys.stdin.readline
    N = int(input())
    *A, = map(int, input().split())
    Q = int(input())
    BC = [tuple(map(int, input().split())) for _ in range(Q)]
    main(N, A, Q, BC)


Measured memory_bytes: 103644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();
		int a = 0;
		for (int i=0;i<n;i++) {
			if (s.charAt(i)=='R') {
				a++;
			} else {
				a--;
			}
		}
		if(a>0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

long long fact[1000005];

const long long MOD = 1e9+7;

long long powmod(long long a, long long b){
    if(b == 0){
        return 1%MOD;
    }else if(b == 1){
        return a%MOD;
    }else if(b%2 == 0){
        long long temp = powmod(a, b/2);
        return (temp*temp)%MOD;
    }else{
        long long temp = powmod(a, b/2);
        return (((temp*temp)%MOD)*a)%MOD;
    }
}

int main(){
    int X, Y;
    scanf("%d%d", &X, &Y);

    if((X+Y)%3 != 0){
        printf("0");
        return 0;
    }

    int n = (X+Y)/3;
    int r = Y-n;
    if(r < 0 || r > n){
        printf("0");
        return 0;
    }

    fact[0] = 1;
    for(int i = 1; i <= n; i ++){
        fact[i] = (fact[i-1]*i) % MOD;
    }

    long long ans = fact[n];
    long long div = (fact[n-r]*fact[r])%MOD;
    printf("%lld", ans*powmod(div, MOD-2)%MOD);

    return 0;
}


Measured memory_bytes: 6400
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 800000
#define MO 924844033
#define G 5
using namespace std;
typedef long long LL;
struct node
{
	int to;
	node *nxt;
}edges[MAXN*2+5];
node *ncnt=&edges[0],*Adj[MAXN+5];
int n;
LL siz[MAXN+5],fact[MAXN+5],inv[MAXN+5],f[MAXN+5];
LL a[MAXN+5],b[MAXN+5],c[MAXN+5],ans[MAXN+5];
LL PowMod(LL a,LL b)
{
	LL ret=1LL;
	while(b)
	{
		if(b&1)
			ret=1LL*ret*a%MO;
		a=1LL*a*a%MO;
		b>>=1;
	}
	return ret;
}
void prepare()
{
	fact[0]=1LL;
	for(int i=1;i<=MAXN;i++)
		fact[i]=1LL*fact[i-1]*i%MO;
	inv[MAXN]=PowMod(fact[MAXN],MO-2);
	for(int i=MAXN-1;i>=0;i--)
		inv[i]=1LL*inv[i+1]*(1LL*i+1LL)%MO;
}
void AddEdge(int u,int v)
{
	node *p=++ncnt;
	p->to=v;
	p->nxt=Adj[u];
	Adj[u]=p;
	
	node *q=++ncnt;
	q->to=u;
	q->nxt=Adj[v];
	Adj[v]=q;
}
void DFS(int u,int fa)
{
	siz[u]=1;
	for(node *p=Adj[u];p!=NULL;p=p->nxt)
	{
		int v=p->to;
		if(v==fa)
			continue;
		DFS(v,u);
		siz[u]+=siz[v];
	}
}
void NTT(LL P[],int N,int oper)
{
	for(int i=1,j=0;i<N-1;i++)
	{
		for(LL s=N;j^=s>>=1,~j&s;);
		if(i<j)
			swap(P[i],P[j]);
	}
	for(int d=0;(1<<d)<N;d++)
	{
		LL unit_p0;
		LL m=(1<<d),m2=m*2;
		unit_p0=PowMod(G,(MO-1)/m2);
		if(oper==-1)
			unit_p0=PowMod(unit_p0,MO-2);
		for(int i=0;i<N;i+=m2)
		{
			LL unit=1;
			for(int j=0;j<m;j++)
			{
				LL &P1=P[i+j+m],&P2=P[i+j];
				LL t=1LL*unit*P1%MO;
				P1=(1LL*P2-1LL*t+1LL*MO)%MO;
				P2=(1LL*P2+1LL*t)%MO;
				unit=1LL*unit*unit_p0%MO;
			}
		}
	}
	if(oper==-1)
	{
		LL Inv=PowMod(N,MO-2);
		for(int i=0;i<=N;i++)
			P[i]=1LL*P[i]*Inv%MO;
	}
}
int main()
{
//	freopen("calculate.in","r",stdin);
//	freopen("calculate.out","w",stdout);
	prepare();
	scanf("%d",&n);
	int u,v;
	for(int i=1;i<n;i++)
	{
		scanf("%d %d",&u,&v);
		AddEdge(u,v);
	}
	DFS(1,-1);
	for(int i=1;i<=n;i++)
	{
		f[siz[i]]--;
		f[n-siz[i]]--;
	}
	f[n]=n;
	int len=1;
	for(;len<=n*2;len*=2);
	for(int i=0;i<=n;i++)
		a[i]=1LL*f[i]*fact[i]%MO;
	for(int i=0;i<=n;i++)
		b[i]=inv[n-i];
	NTT(a,len,1);
	NTT(b,len,1);
	for(int i=0;i<=len;i++)
		c[i]=1LL*a[i]*b[i]%MO;
	NTT(c,len,-1);
	for(int i=1;i<=n;i++)
		ans[i]=(1LL*inv[i]*c[i+n]%MO+MO)%MO;
	for(int i=1;i<=n;i++)
		printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 60800
#include <cstdio>
#include <cstring>

#include <algorithm>

using namespace std;

typedef long long i64;

#define MOD 998244353
#define NMAX 5000

static i64 fac[NMAX + 10], fi[NMAX + 10], pw[NMAX + 10];

inline i64 inv(i64 x) {
    return x == 1 ? 1 : MOD - MOD / x * inv(MOD % x) % MOD;
}

inline i64 c(int n, int m) {
    if (n < 0 || m < 0 || n < m) return 0;
    return fac[n] * fi[m] % MOD * fi[n - m] % MOD;
}

inline i64 f(int n, int K, int p) {
    if (n == 0) return 1;
    i64 ret = 0;
    for (int k = 0; k <= p; k++)
        ret = (ret + c(p, k) * pw[k] % MOD * c(n + K - 2 * p - 1, n - k)) % MOD;
    return ret;
}

int main() {
    pw[0] = fac[0] = 1;
    for (int i = 1; i <= NMAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        pw[i] = (pw[i - 1] << 1) % MOD;
    }
    fi[NMAX] = inv(fac[NMAX]);
    for (int i = NMAX - 1; i >= 0; i--) fi[i] = fi[i + 1] * (i + 1) % MOD;

    int n, K;
    scanf("%d%d", &K, &n);
    for (int t = 2; t <= 2 * K; t++)
        printf("%lld\n", t & 1 ? f(n, K, t / 2 - max(0, t - K - 1)) :
                         (f(n, K - 1, t / 2 - 1 - max(0, t - K - 1)) +
                         f(n - 1, K - 1, t / 2 - 1 - max(0, t - K - 1))) % MOD);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,k;
  int d;	//365
  int c[26];
  int score[9490];
  int t[365] = {0};
  int day1[26] = {0};
  double x = 0.36787944117;
  int tmp1=-999999,tmp2=-999999;
  int tmpi = 0;
  
  scanf("%d",&d);
  for(i=0;i<26;i++){
      scanf("%d ",&c[i]);
  }
  for(i=0;i<d*26;i++){
      scanf("%d ",&score[i]);
  }
  //st
  
  for(i=0;i<26;i++){
    if(c[i]>tmp1){
     tmp1 = c[i];
    }
    tmpi = i;
  }
  tmp1 = -999999;/*
  for(i=0;i<d;i++){
    for(j=0;j<26;j++){
      if(score[i*26+j]-c[j]*(1+day1[j])>tmp1){
       	t[i] = j;
      }
    }
  }
  */
  //en
  for(i=0;i<d;i++){
      printf("%d\n",(tmpi+i)%26+1);
  }
 return 0; 
}





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

const int N = 524288, mod = 924844033;
typedef long long LL;

int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}
void reduce(int &x) { x += x >> 31 & mod; }

int lim, s, wn[N], w[N], rev[N];
void fftinit(int len) {
	wn[0] = lim = 1, s = -1; while (lim < len) lim <<= 1, ++s;
	for (int i = 0; i < lim; ++i) rev[i] = rev[i >> 1] >> 1 | (i & 1) << s;
	const int g = pow(5, (mod - 1) / lim);
	for (int i = 1; i < lim; ++i) wn[i] = (LL) wn[i - 1] * g % mod;
}
void fft(int *A, int typ) {
	for (int i = 0; i < lim; ++i) if (i < rev[i]) std::swap(A[i], A[rev[i]]);
	for (int i = 1; i < lim; i <<= 1) {
		for (int j = 0, t = lim / i / 2; j < i; ++j) w[j] = wn[j * t];
		for (int j = 0; j < lim; j += i << 1)
			for (int k = 0; k < i; ++k) {
				const int x = A[k + j], y = (LL) A[k + j + i] * w[k] % mod;
				reduce(A[k + j] += y - mod), reduce(A[k + j + i] = x - y);
			}
	}
	if (!typ) {
		std::reverse(A + 1, A + lim);
		const int il = pow(lim, mod - 2);
		for (int i = 0; i < lim; ++i) A[i] = (LL) A[i] * il % mod;
	}
}

int factor[N], ifactor[N], A[N], B[N];
int n, head[N], tot;
struct edge { int to, nxt; } e[N << 1];
void link(int x, int y) {
	e[++tot] = (edge) { y, head[x] }, head[x] = tot;
	e[++tot] = (edge) { x, head[y] }, head[y] = tot;
}
int dfs(int x, int f = 0) {
	int size = 1;
	for (int i = head[x]; i; i = e[i].nxt) if (e[i].to != f) {
		int t = dfs(e[i].to, x); size += t;
		++A[t], ++A[n - t];
	}
	return size;
}
int x, y;
int C(int x, int y) { return x < y ? 0 : (LL) factor[x] * ifactor[y] % mod * ifactor[x - y] % mod; }
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	for (int i = 1; i < n; ++i)
		std::cin >> x >> y, link(x, y);
	dfs(1), factor[0] = 1;
	for (int i = 1; i <= n; ++i)
		factor[i] = (LL) factor[i - 1] * i % mod;
	ifactor[n] = pow(factor[n], mod - 2);
	for (int i = n; i; --i)
		ifactor[i - 1] = (LL) ifactor[i] * i % mod;
	for (int i = 1; i <= n; ++i)
		A[i] = (LL) A[i] * factor[i] % mod;
	for (int i = 0; i <= n; ++i) B[i] = ifactor[i];
	std::reverse(A + 1, A + n + 1);
	fftinit(n + n + 1), fft(A, 1), fft(B, 1);
	for (int i = 0; i < lim; ++i) A[i] = (LL) A[i] * B[i] % mod;
	fft(A, 0);
	std::reverse(A + 1, A + n + 1);
	for (int i = 1; i <= n; ++i)
		reduce(A[i] = ((LL) n * C(n, i) - (LL) A[i] * ifactor[i]) % mod);
	for (int i = 1; i <= n; ++i)
		std::cout << A[i] << '\n';
	return 0;
}

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

const int N = 500010;

int len, sum;
char s[N];

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> s, len = std::strlen(s);
	for (int i = 0; i < len; ++i) (s[i] -= '0') *= 9;
	std::reverse(s, s + len);
	for (int i = 0; i < len; ++i) s[i + 1] += s[i] / 10, s[i] %= 10;
	if (s[len]) ++len;
	for (int i = 0; i < len; ++i) sum += s[i];
	for (int k = 0; ; ) {
		sum += 10 - s[0], k += 10 - s[0], s[0] = 10;
		for (int i = 0; i < len; ++i) if (s[i] == 10) ++s[i + 1], s[i] = 0, sum -= 9; else break;
		if (s[len]) ++len;
		if (sum <= k) return std::cout << (k + 8) / 9 << '\n', 0;
	}
	return 0;
}

Measured memory_bytes: 768
r,c=map(int,input().split())
co=[[] for i in range(r+1)]

for i in range(r):
    co[i]=list(map(int,input().split()))

for i in range(r):
    csum=0
    for j in range(c):
        csum+=co[i][j]
    co[i].append(csum)
    

for i in range(c+1):
    rsum=0
    for j in range(r):
        rsum+=co[j][i]
    co[r].append(rsum)

for i in range(r+1):
    print(*co[i])


Measured memory_bytes: 6232
#include<stdio.h>
int main(void){
    int a,b,c,d,sum=0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a>b){
        sum+=b;
    }else{
        sum+=a;
    }
    if(c>d){
        sum+=d;
    }else{
        sum+=c;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>


using namespace std;

int main(void){
	int n;

	cin >> n;


	vector<int> a(n), b(n), c(n);

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

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());


	vector<int> ap(n, 0), bp(n, 0);

	for (int i = 0; i < n; i++){
		int l = 0, r = n - 1;
		while (l < r){
			int mid = (r + l)/2;
			if (b[mid] > a[i]){
				if (mid == 0){
					ap[i] = 0;
					break;
				}
				if (b[mid - 1] <= a[i]){
					ap[i] = mid;
					break;
				}
				else {
					r = mid;
				}
			}
			else {
				if (mid == n - 1){
					ap[i] = n;
					break;
				}
				if (b[mid + 1] <= a[i]){
					l = mid + 1;
				}
				else {
					ap[i] = mid + 1;
					break;
				}
			}
		}
		if (r == l){
			if (b[r] > a[i])
				ap[i] = r;
			else
				ap[i] = n;				
		}

		l = 0, r = n - 1;
		while (l < r){
			int mid = (r + l)/2;
			if (c[mid] > b[i]){
				if (mid == 0){
					bp[i] = 0;
					break;
				}
				if (c[mid - 1] <= b[i]){
					bp[i] = mid;
					break;
				}
				else {
					r = mid;
				}
			}
			else {
				if (mid == n - 1){
					bp[i] = n;
					break;
				}
				if (c[mid + 1] <= b[i]){
					l = mid + 1;
				}
				else {
					bp[i] = mid + 1;
					break;
				}
			}
		}
		if (r == l){
			if (c[r] > b[i])
				bp[i] = r;
			else
				bp[i] = n;				
		}
	}


	vector<unsigned long long> bpp(n, 0);
	bpp[n-1] = n - bp[n-1];
	for (int i = n - 2; i >= 0; i--){
		bpp[i] = bpp[i+1] + (n - bp[i]);
	}


	unsigned long long num = 0;

	for (int i = 0; i < n; i++){
		if (ap[i] != n)
			num += bpp[ap[i]];
	}

	cout << num << endl;

	return 0;
}

Measured memory_bytes: 2944