akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <sstream>
#include <numeric>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

// namespace
using namespace std;
namespace mp = boost::multiprecision;

// types
using pii = pair<int, int>;
using ll = long long int;
using ld = long double;
using mpi = mp::cpp_int;
using mpf = mp::number<mp::cpp_dec_float<1024>>;

// consts
int MOD = 1000000007;  // https://qiita.com/drken/items/3b4fdf0a78e7a138cd9a


int main() {
    ld r;
    cin >> r;
    std::cout << std::setprecision(10);
    cout << 2 * r * M_PI << endl;
    return 0;
}


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

int main(){
    ll n, q, temp1, temp2, fi=0, sum =0;
    bool flag;
    cin >> n;
    vector<ll> bcn(100001,0);
    for(ll i=0;i<n;i++){
        cin >> temp1;
        bcn.at(temp1)++;
    }
    for(ll i=0;i<bcn.size();i++) sum += i*bcn.at(i);
    cin >> q;
    for(ll i=0;i<q;i++){
        cin >> temp1 >>temp2;
        if(bcn.at(temp1)!=0){
            ll deltaD = (temp2-temp1)*(bcn.at(temp1));
            bcn.at(temp2) += bcn.at(temp1);
            bcn.at(temp1) = 0;
            sum += deltaD;
        }
        //for(auto i=0;i<5;i++) cout << bcn.at(i) << ", ";
        cout << sum << endl;
    }
    
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main() {
    ll n;
    cin >>n;
    vector<ll> memo(100003,0);
    vector<ll> a(n);
    ll ans=0;
    rep(i,n) {
        cin>>a[i];
        memo[a[i]]++;memo[a[i]+1]++;memo[a[i]+2]++;
    }rep(i,100003) {
        ans =max(ans,memo[i]);
    }
    cout <<ans<<endl;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	priority_queue<long long> num;

	for(int i=0;i<n;i++){
		long long ho;
		cin>>ho;
		num.push(ho);
	}

	vector<long long> v1;
	vector<long long> v2;

	bool high=true;

	for(int i=0;i<n;i++){
		long long minu=1;
		if(high==false) minu=-1;

		if(i==0 || i==n-1){
			v1.push_back(minu);
			v2.push_back(minu*-1);
		}else{
			v1.push_back(minu*2);
			v2.push_back(minu*2*-1);
		}cerr<<v1.at(i)<<" "<<v2.at(i)<<endl;

		high=!high;
	}

	sort(v1.begin(),v1.end(),greater<long long>());
	sort(v2.begin(),v2.end(),greater<long long>());

	long long ans1=0;
	long long ans2=0;

	for(int i=0;i<n;i++){
		ans1+=v1.at(i)*num.top();
		ans2+=v2.at(i)*num.top();
		num.pop();
	}

	cout<<max(ans1,ans2)<<endl;

	return 0;
}


Measured memory_bytes: 3444
#include <stdio.h>
int main()
{
    int a[100], b;
    scanf("%d", &b);
    for (int i = 0; i < b; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = b - 1; i >= 0; i--)
    {
        if (i != 0)
        {
            printf("%d ", a[i]);
        }
        else if (i == 0)
        {
            printf("%d", a[i]);
        }
    }
    printf("\n");

    return 0;
}



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

int main(){
    int A, B, C;
    cin >> A >> B >> C;

    if(A + B == C || A + C == B || B + C == A){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using namespace std;

#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define fi(i,x,n) for(i=x;i<n;++i)
#define f(n) for(int i=0;i<n;++i)
#define fr(i,x,n) for(i=x;i>=n;--i)
#define endl '\n'

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int r[110],c[110];

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x,y;
    cin>>x>>y;
    char g[110][110];
    int i,j;
    fi(i,1,x+1){
        fi(j,1,y+1)
            cin>>g[i][j];
    }
    fi(i,1,x+1){
        fi(j,1,y+1){
            if(g[i][j]=='#'){
                r[i]=1;
                break;
            }
        }
    }
    fi(i,1,y+1){
        fi(j,1,x+1){
            if(g[j][i]=='#'){
                c[i]=1;
                break;
            }
        }
    }

    fi(i,1,x+1){
        bool bad=false;
        fi(j,1,y+1){
            if(!r[i]){
             bad=true;
                break;
            }
            if(!c[j]) continue;
            cout<<g[i][j];
        }
        if(!bad)
            cout<<endl;
    }

    return 0;
}



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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) begin(v), end(v)

using int64 = long long;
const int INF = 1 << 30;
const int mod = 1e9 + 7;


int main()
{
  int N, C[500], S[500], F[500];

  cin >> N;
  rep(i, N - 1) {
    cin >> C[i] >> S[i] >> F[i];
  }
  rep(i, N) {
    int cur = 0;
    for(int j = i; j < N - 1; j++) {
      cur = max(cur, S[j]);
      cur = (cur + F[j] - 1) / F[j] * F[j] + C[j];
    }
    cout << cur << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<long,long> P;
int main(){
  long H,W;cin>>H>>W;
  set<P> S,T;
  for(long i=0;i<W;i++){S.insert(P(i,0));T.insert(P(0,i));}
  for(long k=0;k<H;k++){
    long a,b;cin>>a>>b;a--;
    long y=LONG_MAX;
    for(auto itr=S.lower_bound(P(a,-1));itr!=S.end()&&(itr->first)<b;){
      P x=*itr;
      y=min(y, x.second+b-x.first);
      T.erase(P(x.second,x.first));
      itr=S.erase(itr);
    }// ゴール: 移動回数 i,jとして, b, j+b-i, このうち, 最も移動回数が少ないものだけ残す
    if(y!=LONG_MAX&&b<W){S.insert(P(b,y)); T.insert(P(y,b));}
    cout<<(T.size()?(T.begin()->first)+k+1:-1)<<endl;
  }
}

/*

S: ゴール, 何回の移動でいけるか
T: 何回の移動でいけるか, ゴール

T.begin()を持って来ればいける
Sで更新を素早くみる





*/

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

using namespace std;

int main(){
string S;
    cin >> S;
    int n = 0, w = 0, s = 0, e = 0;
    for (int i = 0; i < (int)S.size(); ++i) {
        if (S[i] == 'N')
            n++;
        if (S[i] == 'S')
            s++;
        if (S[i] == 'W')
            w++;
        if (S[i] == 'E')
            e++;
    }
    if (n != s && min(n, s) == 0) {
        cout << "No"
             << "\n";
    } else if (w != e && min(w, e) == 0) {
        cout << "No"
             << "\n";
    } else {
        cout << "Yes"
             << "\n";
    }
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
int main(){
  string s;
  cin>>s;
  int n=s.length();
  rep(i,n){
    if(i%2==0)cout<<s[i];
  }
  cout<<endl;
}

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

int main() {
  long double N;
  cin >> N;
  std::cout << std::fixed;
  std::cout << std::setprecision(10);
  if (int(N) % 2==0) {
      cout << 0.5;
  }
  else {
      cout << (ceil(N/2)/N);
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  long long int a,b,k;
  scanf("%lld %lld %lld",&a,&b,&k);
  if(a>=k){
    a=a-k;
  }
  else if(a+b>k){
    b=b-(k-a);
    a=0;}
  else{
    a=0;
    b=0;
    }
  printf("%lld %lld\n",a,b);
  return 0;
}

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

int BinarySearch(int *,int);

int n;

int main()
{
  int q,C;
  int *S;
  int *T;
  int i;

  // printf("n\n");
    scanf("%d",&n);
  S = (int *)malloc( n * sizeof(int));
  // printf("S\n");
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  // printf("q\n");
  scanf("%d",&q);
  T = (int *)malloc( q * sizeof(int));
  // printf("T\n");
  for(i=0;i<q;i++){
    //printf("i=%d\n",i);
    scanf("%d",&T[i]);
  }

  for(i=0;i<q;i++){
    C += BinarySearch(S,T[i]);
  }

  printf("%d\n",C);
  
  free(S);
  free(T);

  return 0;
}

int BinarySearch(int *S,int key)
{
  int left=0,right=n,mid;

  while(left < right){
    mid = (left + right)/2;
    if(S[mid] == key){
      return 1;
    }
    else if(key < S[mid]){
      right = mid;
    }
    else {
      left = mid + 1;
    }
  }

  return 0;
}
	
  
  



Measured memory_bytes: 2052
use proconio::input;

fn main() {
    input! {
        n: usize,
        p: usize,
        aa: [usize; n],
    }

    let odd_count = aa.into_iter().filter(|&x| x % 2 == 1).count();
    dbg!(odd_count);

    let ans = if odd_count == 0 {
        if p == 0 {
            2_u64.pow(n as u32)
        } else {
            0
        }
    } else {
        2_u64.pow(n as u32 - 1)
    };
    println!("{}", ans);
}


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

using namespace std;

int main() {
	string S;
	cin >> S;
	for (int i = (S.size() - 1) / 2; i >= 0; i--) {
		if (S.substr(0, i) == S.substr(i, i)) {
			cout << i * 2 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll a, b, c, x, y;

    cin >> a >> b >> c;

    x = c-a-b;
    y = x*x;

    if(x>0 && y>4*a*b) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(void){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a(m);
  for(int i=0;i<m;++i){
    cin >> a[i].second >> a[i].first;
  }
  sort(a.begin(), a.end());
  int prev = -1, cnt=0;
  for(int i=0;i<m;++i){
    if(prev < a[i].second){
      ++cnt;
      prev = a[i].first-1;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L;
ll MOD = 1000000007; ll ans = 0; ll ans2 = 0; ll INF = 9999999999999;
vll flag, color; vll path; vl A, T; vll D;
vector<string> S;
//***********//
void bfs(ll h, ll w) {
	queue<pll> Q;
	Q.push(make_pair(h, w));
	flag[h][w] = 1;
	pll u;
	while (!Q.empty()) {
		u = Q.front();
		ans = max(ans, D[u.first][u.second]);
		Q.pop();
		ll p = u.first-1, q = u.second;
		if (u.first != 0) {
			if (S[p][q] == '.' && flag[p][q] == 0) {
				Q.push(make_pair(p,q));
				flag[p][q] = 1;
				D[p][q] = D[u.first][u.second] + 1;
			}
		}
		p = u.first+1, q = u.second;
		if (u.first != H-1) {
			if (S[p][q] == '.' && flag[p][q] == 0) {
				Q.push(make_pair(p, q));
				flag[p][q] = 1;
				D[p][q] = D[u.first][u.second] + 1;
			}
		}
		p = u.first, q = u.second-1;
		if (u.second != 0) {
			if (S[p][q] == '.' && flag[p][q] == 0) {
				Q.push(make_pair(p, q));
				flag[p][q] = 1;
				D[p][q] = D[u.first][u.second] + 1;
			}
		}
		p = u.first, q = u.second+1;
		if (u.second != W-1) {
			if (S[p][q] == '.' && flag[p][q] == 0) {
				Q.push(make_pair(p, q));
				flag[p][q] = 1;
				D[p][q] = D[u.first][u.second] + 1;
			}
		}
		

	}
}
int main() {
	cin >> H >> W;
	flag.resize(H);
	D.resize(H);
	for (i = 0; i < H; i++) {
		flag[i].resize(W);
		D[i].resize(W);
	}

	for (i = 0; i < H; i++) {

		string s;
		cin >> s;
		S.push_back(s);
	}
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			if (S[i][j] == '.') {
				for (k = 0; k < H; k++) {
					for (l = 0; l < W; l++) {
						flag[k][l] = 0;
						D[k][l] = 0;
					}
				}
				bfs(i, j);
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
#define init(c) memset(c,0,sizeof c)
typedef long long ll;
const int N=20000005;
int n,k,x,t,a,b,m;
string s;
vector<int>v;
int main(){

	cin >> n >> m;
	int sum=0;
	for(int i =0;i<n;i++){
		cin >> x;
		v.push_back(x);
		sum+=x;
	}
	double c = 1/(4.0*m)*sum;
	for(int i =0;i<n;i++){
		if(v[i]>=c){
			m--;
		}
	}
	if(m>0){
		cout << "No";
	}else{
		cout << "Yes";
	}
	return 0;
}

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

int n,k,c;
char s[200005];
vector<int> l,r;

int main(){

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

    cin>>n>>k>>c;
    cin>>s+1;
    for(int i=1,p=-1919810,cnt=0;cnt<k;i++){
        if(i>p+c&&s[i]=='o'){
            l.push_back(i);
            cnt++;
            p=i;
        }
    }
    for(int i=n,p=1919810,cnt=0;cnt<k;i--){
        if(i<p-c&&s[i]=='o'){
            r.push_back(i);
            cnt++;
            p=i;
        }
    }
    reverse(r.begin(),r.end());
    for(int i=0;i<k;i++)if(l[i]==r[i])cout<<l[i]<<endl;

    return 0;
}

Measured memory_bytes: 3444
import java.util.Scanner;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayList<Integer> num = new ArrayList<Integer>();
		for (int i = 0; i < N; i++) {
			int a = sc.nextInt();
			num.add(a);
		}
		int cnt = 0;
		while (true) {
			boolean x = false;
			for (int i = 0; i < N; i++) {
				if (num.get(i) % 2 == 0) {
					int a = num.get(i) / 2;
					num.remove(i);
					num.add(i, a);
				} else {
					x = true;
					break;
				}
			}
			if (x == true) {
				break;
			}
			cnt++;
		}
		System.out.println(cnt);
		sc.close();
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5, mod = 1e9 + 7;

int a[maxn];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    ll ans = 0;
    for (int i = 1; i < n; ++i){
        int l = 0, r = n - 1;
        ll sum = 0;
        while (1){
            l += i, r -= i;
            if (l==r||l-i==r||r<=i) break;
            sum += a[l] + a[r];
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N,K,n,ans = 0;
  cin >> N >> K;
  for (int a = 1; a <= N; a++) {
    if (a >= K) {
      ans += 1/N;
    } else{
      n = ceil(log2(K / a));
      ans += 1 / (N * pow(2,n));
    }
  }
  printf("%.11lf", ans);
}

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

int main()
{
  int X,r;
  cin >> X;
  if(X<=599) r=8;
  else if(X<=799) r=7;
  else if(X<=999) r=6;
  else if(X<=1199) r=5;
  else if(X<=1399) r=4;
  else if(X<=1599) r=3;
  else if(X<=1799) r=2;
  else r=1;
  cout << r << endl;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
const bool debug = 0;
//---------------------------//

int N;
int a[112345], cnt[112345];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", a + i);
	
	REP(i, N) cnt[a[i]]++;
	
	int ans = 0;
	REP(i, 112344) {
		int c = 0;
		if (i > 0) c += cnt[i - 1];
		c += cnt[i];
		c += cnt[i + 1];
		
		chmax(ans, c);
	}
	cout << ans << endl;
	return 0;
}

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

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

  int count = 0;
  while(true){
    bool flag = false;
    for (int i=0; i<N; i++){
      if (A[i] % 2 == 0){
        A[i] /= 2;
      } else{
        flag = true;
      }
    }
    if (flag){
      break;
    }
    count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){};
    mint operator-() const{
        return mint(-x);
    }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    } 
    mint& operator-=(const mint a){
        if((x+= mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const{
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const{
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const{
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const{
        if(!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if(1&t) a *= *this;
        return a;
    }

    mint inv() const{
        return pow(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const{
        mint res(*this);
        return res /= a;
    }
};

struct combination{
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i=1; i<=n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i=n; i>=1; i--) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k){
        if(k<0 || k>n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

int main(){
    int x, y;
    cin >> x >> y;
    int n = (x+y);
    if(n % 3 != 0){
        cout << 0 << endl;
        return 0;
    }
    n /= 3;
    x -= n;
    y -= n;
    if(x<0 || y<0){
        cout << 0 << endl;
        return 0;
    }

    combination c(n);
    cout << c(n, x).x << endl;

    return 0;
}

Measured memory_bytes: 10624
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
signed main(){
    int n,h,ans=0,tmp=0,bef=0;
    cin>>n;
    while(cin>>h){
        if(bef<h){
            ans=max(ans,tmp);
            tmp=0;
        }else
            tmp++;
        bef=h;
    }
    cout<<max(ans,tmp)<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int N,M,C;
  cin>>N>>M>>C;
  int B[M];
  int count=0;
  for (int i=0; i<M; i++)
    cin>>B[i];
  for (int i=0; i<N; i++){
    int sum=0;
    for(int j=0; j<M; j++){
      int a;
      cin>>a;
      sum+=a*B[j];}
  if((sum+C)>0)
    count++;
    }
  cout<<count<<endl;
}

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

// constexpr long MOD = 998244353;
constexpr long MOD = 1000000007;
vector<long> fact, inv;

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return res;
}

long com(long n, long r) {
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

void init(int n) {
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 0; i < n; i++) {
    fact.push_back(fact.at(i) * (i + 1) % MOD);
    inv.push_back(mpow(fact.at(i + 1), MOD - 2));
  }
}

long qcom(long n, long r) {
  if (n - r < 0) return 0;
  return fact.at(n) * inv.at(r) % MOD * inv.at(n - r) % MOD;
}

int main() {
  init(100000);
  int N, K;
  cin >> N >> K;
  for (int i = 1; i <= K; i++) {
    cout << qcom(K - 1, i - 1) * qcom(N - K + 1, i) % MOD << "\n";
  }
}

Measured memory_bytes: 2036
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())
ch -= 1
cw -= 1
dh -= 1
dw -= 1
rows,cols = h,w

OK = "."
NG = "#"

from collections import defaultdict, deque

ns = defaultdict(set)
ss = [None] * rows
for i in range(rows):
    s = input()
    ss[i] = s
n = rows * cols
start = ch*w+cw
goal = dh*w+dw
seen = [None]*n
seen[start] = 0

q = deque([(0, start)]) # ワープ回数, 現在位置, 最後の道の位置
# dx = [0,1,0,-1]
# dy = [1,0,-1,0]
dx = []
dy = []
vvs = []
for i in range(-2,3):
    for j in range(-2,3):
        if not (i==j==0):
            dx.append(i)
            dy.append(j)
            if abs(i)+abs(j)>1:
                vvs.append(1)
            else:
                vvs.append(0)
while q:
    pnum,pu = q.popleft()
    ux,uy = divmod(pu,w)
    # print(pnum,divmod(pu,w))
    if pu==goal:
        break
    for xx,yy,vv in zip(dx,dy,vvs):
#         x = ux+xx
#         y = uy+yy
        x,y = ux+xx, uy+yy
        u = x*w + y
        num = pnum+vv
        if x<0 or y<0 or x>=h or y>=w or ss[x][y]=="#":
            continue
#         print(x,y)
        if seen[u] is None or seen[u]>num:
            seen[u] = num
            if vv==0:
                q.appendleft((num, u))
            else:
                q.append((num,u))
val = seen[goal]
if val is None:
    print(-1)
else:
    print(val)

Measured memory_bytes: 104504
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
n = int(input())
l = make_divisors(n)
ans = 0
for i in range(1, len(l)):
    cnt = 0
    while n % l[i] == 0:
        cnt += 1
        n //= l[i]
    i = 1
    while True:
        if cnt - i >= 0:
            ans += 1
            cnt -= i
            i += 1
        else:
            break
print(ans)

Measured memory_bytes: 9228
#include <stdio.h>

int map[10][10];
int count, p, n;

void tansaku(int,int);

main(){
  int i, j, c;

  for(c=0;;c++){
    scanf("%d", &n);
    if(n==0) break;

    count=p=0;
    tansaku(0,0);

    printf("Case %d:\n", c+1);

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	printf("%3d", map[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}

void tansaku(int y,int x){
  int i, j;

  count++;
  map[y][x]=count;
  if(x==n-1 && y==n-1) return;

  if(x==0 && y==0) p=0;
  else if(x==n-1 && p==3) p=2;
  else if(y==n-1 && p==1) p=0;
  else if(x==n-1 && p==2) p=1;
  else if(y==n-1 && p==0) p=3;
  else if(y==0 &&p==0) p=1;
  else if(x==0 && p==1) p=2;
  else if(x==0 && p==2) p=3;
  else if(y==0 && p==3) p=0;

  if(p==0) tansaku(y,x+1);
  else if(p==1) tansaku(y+1,x-1);
  else if(p==2) tansaku(y+1,x);
  else if(p==3) tansaku(y-1,x+1);

}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
public class Main{
   public static void main(String[] main) throws Exception{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringTokenizer st = new StringTokenizer(br.readLine());
      PrintWriter out = new PrintWriter(System.out);
      int n = Integer.parseInt(st.nextToken());
      st = new StringTokenizer(br.readLine());
      int[] a = new int[n];
      int xor = 0;
      for(int i = 0; i < n; i++) {
    	  a[i] = Integer.parseInt(st.nextToken());
    	  xor = xor ^ a[i];
      }
      StringJoiner sj = new StringJoiner(" ");
      for(int i = 0; i < n; i++)
    	  sj.add(Integer.toString(a[i] ^ xor));
      out.println(sj);
      out.close();
   }
}

Measured memory_bytes: 66896
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <string>
#include <tuple>
#include <vector>
#include <set>
#include <map>
#include <iterator>
#include <random>
#include <cmath>

using namespace std;
using lint = long long int;
static const lint MOD = 1e9 + 7;

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

	int count = 0;

	for (int i = 0, j = s.length() - 1; i < s.length() * 0.5; i++, j--) {
		if (s[i] != s[j])
			count++;
	}
	cout << count;

	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<pair<ll, ll> > prime_factorize(ll N) {
  vector<pair<ll, ll> > res;
  for (ll a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    long long ex = 0; // 指数

    // 割れる限り割り続ける
    while (N % a == 0) {
      ++ex;
      N /= a;
    }

    // その結果を push
    res.push_back({a, ex});
  }

  // 最後に残った数について
  if (N != 1) res.push_back({N, 1});
  return res;
}

void Main()
{
  ll n; cin >> n;
  vector<pair<ll, ll>> pairs = prime_factorize(n);
  ll ans = 0;
  for (pair<ll, ll> p : pairs) {
    //cout << p.first << "," <<  p.second << endl;
    ll cnt = p.second;
    ll i = 1;
    while (cnt - i >= 0) {
      cnt -= i;
      i++;
    }
    ans += i-1;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 3624
import sys
import os


def calc(n):
    return 100 * (10 - n)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, R = map(int, sys.stdin.readline().split())

    if 10 > N:
        print(calc(N) + R)
    else:
        print(R)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
class Program
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        string a, b, c;
        a = str[0].ToUpper();
        b = str[1].ToUpper();
        c = str[2].ToUpper();
        Console.WriteLine("{0}{1}{2}", a[0], b[0], c[0]);
    }
}

Measured memory_bytes: 13140
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    num = int(input())
    h = list(map(int, input().split()))
    ans = 0

    m=0
    for i in range(0,num):
        for j in range(m,num):
            if j == num-1:
                ans += h[j]
                flag = True
                break
            if h[j] > h[j+1]:
                ans += h[j] - h[j+1]
                m = j
        if flag:
            break
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 68832
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string S;
  cin >> S;
  int lw = 0,re = 0;
  int ans = INTINF;
  FOR(i,0,n){
      if (S[i]=='E')re++;
  }
  REP(i,n){
      if (S[i] == 'E'){
          re--;
      }
      ans = min(ans,lw + re);
      if (S[i] == 'W'){
          lw++;
      }
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  vector<ll> a(N);
  cin >> a;
  int p = 0, q = 0, r = 0;
  for (int i = 0; i < N; i++) {
    if (a[i] % 4 == 0)
      p++;
    else if (a[i] % 2 == 0)
      q++;
    else
      r++;
  }
  if (q == 0) {
    if (r <= p + 1)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } else {
    if (r <= p)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

const int MAX_N = 100000;
int n, l;
int a[MAX_N];

int main(){
  cin >> n >> l;
  REP(i, n) cin >> a[i];

  int x = n;
  REP(i, n - 1) {
    if(a[i] + a[i + 1] >= l) {
      x = i;
      break;
    }
  }

  if(x == n) {
    cout << "Impossible" << endl;
  } else {
    cout << "Possible" << endl;
    REP(i, x) cout << i + 1 << " " << endl;
    REP(i, n - 1 - x) cout << n - 1 - i << " " << endl;
  }

  return 0;
}


Measured memory_bytes: 1280
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

T RD(T = long)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto cnt = new long[](10^^5);
	foreach (token; RDR.split)
	{
		auto i = token.to!long - 1;
		++cnt[i];
	}
	cnt[] -= 1;
	cnt.sort!"a > b"();

	long ans;
	long last;
	foreach (e; cnt)
	{
		if (e <= 0) break;
		ans += min(e, last);
		last = abs(e - last);
	}
	ans += last / 2 + last % 2;

	writeln(N - ans * 2);
	stdout.flush();
}

Measured memory_bytes: 4548
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Gather the Maps!
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			BitSet[] day = new BitSet[31];
			Map<Integer, Set<Integer>> scd = new HashMap<>();

			for (int i = 0; i < day.length; i++) {
				day[i] = new BitSet(n);
			}

			for (int i = 0; i < n; i++) {

				StringTokenizer st = new StringTokenizer(br.readLine());

				int f = parseInt(st.nextToken());
				int[] fs = new int[f];

				for (int j = 0; j < f; j++) {
					int d = parseInt(st.nextToken());
					day[d].set(i);
					fs[j] = d;
				}
				//
				Arrays.sort(fs);
				for (int j = 0; j < fs.length - 1; j++) {
					scd.putIfAbsent(fs[j], new HashSet<>());
					for (int k = j + 1; k < fs.length; k++) {
						scd.get(fs[j]).add(fs[k]);
					}
				}
			}

			//solve
			int ans = -1;
			for (int i = 1; i <= 30; i++) {
				if (day[i].cardinality() == n) {
					ans = i;
					break;
				}
				if (!scd.containsKey(i)) {
					continue;
				}
				for (int j : scd.get(i)) {
					day[j].or(day[i]);
				}
			}
			System.out.println(ans);

		} //end while
	} //end main
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<vector<int32>> adj(n);
  REP(i,n-1){
    int32 a,b;
    cin >> a >> b;
    a--;b--;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  vector<vector<int32>> dist(2, vector<int32>(n,INF));
  dist[0][0] = 0;
  dist[1][n-1] = 0;
  queue<int32> que;
  que.push(0);
  REP(i,2){
    while(!que.empty()){
      int32 x = que.front();que.pop();
      for(int32 y : adj[x]){
        if(dist[i][y] != INF)continue;
        dist[i][y] = dist[i][x] + 1;
        que.push(y);
      }
    }
    que.push(n-1);
  }
  int32 cnt = 0;
  REP(i,n){
    if(dist[0][i] <= dist[1][i])cnt++;
  }
  // ANS(cnt);
  cout << ((cnt * 2 > n)?"Fennec\n":"Snuke\n");
  return 0;
}

Measured memory_bytes: 8448
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N,X,Y,Z,S;
bool nxt[1<<16][11];
ll dp[41][1<<16];

ll dfs(int now,int state){
    if(dp[now][state]>=0) return dp[now][state];
    if(now==N) return 1;
    
    ll res=0;
    rep1(i,10)if(nxt[state][i]){
        res+=dfs(now+1,((state<<i)+(1<<(i-1)))%(1<<S));
        res%=MOD;
    }
    return dp[now][state]=res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N>>X>>Y>>Z;
    S=X+Y+Z-1;
    
    rep(mask,1<<S){
        V b;
        int st=0;
        rep(i,S){
            if((mask>>i)&1){
                b.push_back(i-st+1);
                st=i+1;
            }
        }
        
        int B=b.size();
        rep1(i,10){
            bool ok=true;
            int x=0,y=0,z=i;
            int bidx=0;
            while(bidx<B && z<Z) z+=b[bidx++];
            while(bidx<B && y<Y) y+=b[bidx++];
            while(bidx<B && x<X) x+=b[bidx++];
            if(x==X && y==Y && z==Z) ok=false;
            
            nxt[mask][i]=ok;
        }
    }
    
    ll p10=1;
    rep(i,N) p10=(p10*10)%MOD;
    mem(dp,-1);
    ll r=dfs(0,0);
    ll ans=(p10-r+MOD)%MOD;
    cout1(ans)
}

Measured memory_bytes: 22016
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map { it.toInt() }.reversed()
    val q = readLine()!!.split(" ").map { it.toInt() }.reversed()
    val pn = calc(p)
    val qn = calc(q)
//    println(pn)
//    println(qn)
    println(Math.abs(pn - qn))

}

private fun calc(list: List<Int>): Long {
    var n = 0L
    val que = ArrayDeque(list)
    while (que.isNotEmpty()) {
        val i = que.removeLast()
        val size = que.filter { it < i }.size
        val f = size * factorial(que.size)
        // println("$i $que ($size * ${factorial(que.size)})=$f")
        n += f
    }
    return n + 1
}

private fun factorial(n: Int): Long {
    var sum = 1L
    for (i in (1..n)) {
        sum *= i
    }
    return sum
}


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

int main(){
  double w,h,x,y; cin>>w>>h>>x>>y;
  
  cout<<fixed<<setprecision(3);  
  if(x==w/2&&y==h/2){
    cout<<h*x<<' '<<1<<endl;
  }else{
    cout<<h*w/2<<' '<<0<<endl;
  }
}


Measured memory_bytes: 384
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;

int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };


int main(void) {

	long long int n;
	string s;

	cin >> n;

	FOR(i, 0, 100) {
		if (n%(long long int)pow(2, i+1) != 0) {
			s.push_back('1');
			if (i % 2 == 0) {
				n -= pow(2, i);
			}
			else {
				n += pow(2, i);
			}
			if (n == 0) {
				break;
			}
		}
		else {
			s.push_back('0');
			if (n == 0) {
				break;
			}
		}
	}

	RFOR(i, s.size() - 1, 0) {
		cout << s[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N, M, K; cin >> N >> M >> K; 
	long long A[100010] = {}; 
	for(int i = 1; i <= N; i++) cin >> A[i]; 
	long long dp[305][100005] = {};
	for(int i = 1; i <= K; i++){
		deque<int> deq; 
		deq.push_back(0); 
		for(int j = 1; j <= N; j++){
			if(j >= i) dp[i][j] = dp[i-1][deq.front()] + A[j] * i; 
			if(deq.front() == j - M) deq.pop_front(); 
			while(deq.size() && dp[i-1][deq.back()] <= dp[i-1][j]){
				deq.pop_back(); 
			}
			deq.push_back(j); 
		}
	}
	long long ans = 0; 
	for(int i = K; i <= N; i++) ans = max(ans, dp[K][i]); 
	cout << ans << "\n"; 
}

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

#define DEBUG(x) 			   cout << '>' << #x << ':' << x << endl;
#define D(x)        		   cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define DD(x,y)     		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << '\n'
#define DDD(x,y,z)  		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << '\n'
#define DBG         		   cerr << __LINE__ << ": Hi" << '\n'
#define fresh                  {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
#define read                   freopen("in.txt","rt",stdin)
#define write                  freopen("out.txt","wt",stdout)
#define PI                     3.1415926535897932384626433832795
#define mems(ds_name,val)      memset(ds_name,val,sizeof(ds_name))

int main()
{
//    read;
//    write;
    fresh;

    int n;int i;
    cin>>n>>i;
    i--;
    cout<<n-i<<endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

long atack(long hitPoint){
    long atackNum = 0;
    if(hitPoint > 1){
        atackNum = 2 * atack(hitPoint / 2) + 1;
    }else{
        atackNum++;
    }
    return atackNum;
}

int main(){
    long H, atackNum = 0;
    cin >> H;
    atackNum = atack(H);
    cout << atackNum << endl;
}


Measured memory_bytes: 256
#![allow(unused)]

use cmp::Ordering::{Equal, Greater, Less};
use collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};
use io::{Read, Write};
use std::{cmp, collections, fmt, io, iter, ops, str};

#[cfg(feature = "debug")]
macro_rules! debug {
    ($fmt: expr) => { eprintln!($fmt) };
    ($fmt: expr, $($args: tt)*) => { eprintln!($fmt, $($args)*) };
}

#[cfg(not(feature = "debug"))]
macro_rules! debug {
    ($fmt:expr) => {};
    ($fmt:expr, $($args:tt)*) => {};
}

macro_rules! vmax {
    ($x: expr, $y: expr) => { cmp::max($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::max($x, vmax!($($args),*)) };
}

macro_rules! vmin {
    ($x: expr, $y: expr) => { cmp::min($x, $y) };
    ($x: expr, $($args: expr),*) => { cmp::min($x, vmin!($($args),*)) };
}

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_owned()
}

fn read_word() -> String {
    const CAPACITY: usize = 16;

    let mut stdin = io::stdin();
    let mut byte: [u8; 1] = [0];

    loop {
        let mut buf = Vec::with_capacity(CAPACITY);

        loop {
            let res = stdin.read(&mut byte);

            if res.unwrap_or(0) == 0 || byte[0] <= b' ' {
                break;
            } else {
                buf.push(byte[0]);
            }
        }

        if buf.len() > 0 {
            return String::from_utf8(buf).unwrap();
        }
    }
}

fn parse_line<T: str::FromStr>() -> T {
    read_line().parse().ok().unwrap()
}

fn parse_word<T: str::FromStr>() -> T {
    read_word().parse().ok().unwrap()
}

fn parse_vec<T: str::FromStr>() -> Vec<T> {
    read_line()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn flush() {
    io::stdout().flush();
}

fn main() {
    let c1 = read_line();
    let c2 = read_line();
    let c3 = read_line();

    println!(
        "{}{}{}",
        c1.chars().nth(0).unwrap(),
        c2.chars().nth(1).unwrap(),
        c3.chars().nth(2).unwrap()
    );
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test() {
        //
    }
}


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

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int M=scan.nextInt();
		int A[]=new int[M];
		for(int i=0;i<M;i++) {
			A[i]=scan.nextInt();
		}
		int day=0;
		for(int i=0;i<M;i++) {
			day+=A[i];
		}
		if(N-day<0) {
			System.out.println("-1");
		}
		else {
			System.out.println(N-day);
		}

	}

}

Measured memory_bytes: 46416
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int res=0;
    int obj=1;
    for(int i=0;i<n;i++){
        if(obj==a[i]){
            res++;
            obj++;
        }
    }
    if(res==0){
        cout<<-1<<endl;
    }else{
        cout<<n-res<<endl;
    }
    
    return 0;
}

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

typedef pair <int, int> pii;

int n, m, f[3005][3005];
pii g[3005][3005];
char a[3005], b[3005];

string Ans;

int main() {
	scanf("%s%s", a, b);
	n = strlen(a);
	m = strlen(b);
	for (int i = 0; i < n; ++ i)
		for (int j = 0; j < m; ++ j) g[i][j] = pii(-1, -1);
	for (int i = 0; i < n; ++ i)
		for (int j = 0; j < m; ++ j) {
			if (a[i] == b[j]) {
				if (i >= 1 && j >= 1) {
					f[i][j] = f[i - 1][j - 1] + 1;
					g[i][j] = pii(i, j);
				} else {
					f[i][j] = 1;
					g[i][j] = pii(i, j);
				}
			}
			if (i >= 1) {
				if (f[i - 1][j] >= f[i][j]) {
					f[i][j] = f[i - 1][j];
					g[i][j] = g[i - 1][j]; 
				}
			}
			if (j >= 1) {
				if (f[i][j - 1] >= f[i][j]) {
					f[i][j] = f[i][j - 1];
					g[i][j] = g[i][j - 1];
				}
			}
		}
	pii now = g[n - 1][m - 1];
	while (now.first != -1) {
		Ans.push_back(a[now.first]);
		if (now.first == 0 || now.second == 0) break;
		now = g[now.first - 1][now.second - 1];
	}
	reverse(Ans.begin(), Ans.end());
	printf("%s\n", Ans.c_str());
	return 0;
}


Measured memory_bytes: 105984
#include <bits/stdc++.h>
#define inf 0x6fffffff
using namespace std;
const int N=5e6+10;
typedef long long ll;
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 main()
{
    int n=read(),l=read();
    int mn=inf,now;
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        int x=i+l-1;
        mn=min(abs(x),mn);
        if(abs(mn)==abs(x))now=x;
        sum+=x;
    }
    sum-=now;
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256