akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define p(s) std::cout << s << endl;

int main()
{
    int n,d,x;cin >> n >> d >> x;
    for(int i=0;i<n;i++){
        int a;cin >>a;

        int j=0;
        while(a*j+1<=d){
            x++;
            j++;
        } 
    }
    p(x)
}

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

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

int main(){
  
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	
	int a;
	cin>>a;
	string s;
	cin>>s;

	if(a>=3200)cout<<s;
	else cout<<"red";

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))


def prime_factorize_n2(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a.count(2)


cnt = 0
for i in a:
    if i % 2 == 0:
        cnt += prime_factorize_n2(i)
print(cnt)


Measured memory_bytes: 4148
h,w,k = map(int,input().split())
choco = [list(map(int,list(input()))) for _ in range(h)]

white = [[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if i != 0:
            white[i][j] += white[i-1][j]
        if j != 0:
            white[i][j] += white[i][j-1]
        if i != 0 and j != 0:
            white[i][j] -= white[i-1][j-1]
        white[i][j] += choco[i][j]
ans = float('inf')
for i in range(2**(h-1)): #横に切る位置をbitでもつ
    temp = format(i,'b').count('1') # 横に何かいきるか
    hw = []#h == どこの下で切るか
    j = i
    cnt = 0
    while j >0:
        if j&1:
            hw.append(cnt)
        cnt += 1
        j = j >> 1
    hw.append(h-1)
    now = -1
    #if w == 1:
    flag = True
    for l in range(len(hw)):
        if l == 0:
            if white[hw[l]][0] > k:
                flag = False
                break
        else:
            if white[hw[l]][0] - white[hw[l-1]][0] > k:
                flag = False
                break
    if not flag:
        continue
    elif w == 1:
        ans = min(ans,temp)
        continue

    for j in range(w-1):
        flag = True
        if now == -1:
            for l in range(len(hw)):
                if l == 0:
                    if white[hw[l]][j+1] > k:
                        flag = False
                        break
                else:
                    if white[hw[l]][j+1] - white[hw[l-1]][j+1] > k:
                        flag = False
                        break
            if not flag:
                now = j
                temp += 1
        else:
            for l in range(len(hw)):
                if l == 0:
                    if white[hw[l]][j+1] - white[hw[l]][now] > k:
                        flag = False
                        break
                else:
                    if white[hw[l]][j+1] - white[hw[l]][now] - white[hw[l-1]][j+1] + white[hw[l-1]][now]> k:
                        flag = False
                        break
            if not flag:
                now = j
                temp += 1
    ans = min(ans,temp)
print(ans)


Measured memory_bytes: 3564
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var mod = 1e9+7;
function mul(){for(var a=arguments,r=a[0],i=a.length;--i;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i])%mod;return r;}
var fac=[],finv=[],invs=[],pow2=[];
function fset(n){
  fac.length=n+1,fac[0]=fac[1]=1;
  for(var i=2;i<=n;)fac[i]=mul(fac[i-1],i++);
  finv.length=n+1,finv[0]=finv[1]=1,finv[n]=inv(fac[n]);
  for(i=n;2<i;)finv[i-1]=mul(finv[i],i--);
  //invs.length=n+1,invs[0]=invs[1]=1;
  //for(i=2;i<=n;)invs[i]=mul(fac[i-1],finv[i++]);
  //pow2.length=n+1,pow2[0]=1;
  //for(i=1;i<=n;i++)pow2[i]=pow2[i-1]*2%mod;
}
function inv(b){for(var a=mod,u=0,v=1,t;b;v=t)t=a/b|0,a-=t*b,u-=t*v,t=a,a=b,b=t,t=u,u=v;u%=mod;return u<0?u+mod:u;}
function pow(a,n){for(var r=1;n;a=mul(a,a),n>>=1)if(n&1)r=mul(a,r);return r;}
function ncr(n,r){return mul(fac[n],finv[r],finv[n-r]);}
function npr(n,r){return mul(fac[n],finv[r]);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next(), k = next();
  fset(2*n);
  var ans = ncr(n+n-1,n);
  for(var i = k+1; i < n; i++){
    var t = n - i;
    ans -= mul(ncr(n-1,t-1),ncr(n,i));
  }
  ans %= mod;
  ans += mod;
  return ans % mod;
}

Measured memory_bytes: 25036
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  string s;cin>>s;
  int cnt=0;
  rep(i,s.size()){
    if(s[i]=='1')cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3592
import sys

sys.setrecursionlimit(200000)


class BIT(object):
    def __init__(self, n: int) -> None:
        self.n = n
        self.data = [0] * (n + 1)

    def get_sum(self, i: int) -> int:
        ret = 0
        while i > 0:
            ret += self.data[i]
            i -= (i & -i)
        return ret

    def add(self, i: int, w: int) -> None:
        if i == 0:
            return
        while i <= self.n:
            self.data[i] += w
            i += (i & -i)


def dfs(u: int, cnt: int) -> int:
    global left, right
    cnt += 1
    left[u] = cnt
    for c in tree[u]:
        cnt = dfs(c, cnt)
    cnt += 1
    right[u] = cnt
    return cnt


if __name__ == "__main__":
    n = int(input())
    left, right = [0] * n, [0] * n
    tree = []
    for _ in range(n):
        _, *children = map(lambda x: int(x), input().split())
        tree.append(set(children))

    bit = BIT(dfs(0, 1))

    q = int(input())
    for _ in range(q):
        query = list(map(lambda x: int(x), input().split()))
        if query[0]:
            print(bit.get_sum(right[query[1]] - 1))
        else:
            bit.add(left[query[1]], query[2])
            bit.add(right[query[1]], -query[2])



Measured memory_bytes: 143716
#!/usr/bin/env python3
import bisect
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(len(L)):
    for j in range(i+1, len(L)):
        b_i = bisect.bisect_left(L, L[i]+L[j]) # a+bより小さい数
        ans += b_i - (j+1)
print(ans)


Measured memory_bytes: 3316
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a;cin >> a;
  cout << ((((a[0]==a[3] && a[1]==a[2])||(a[0]==a[1] && a[2]==a[3])||(a[0]==a[2] && a[1]==a[3])) && !(a[0]==a[1] && a[1]==a[2] && a[2]==a[3])) ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int input_num, answer;

    scanf("%d", &input_num);

    if(input_num % 2 == 1){
        answer = input_num / 2;
    }else{
        answer = input_num / 2  - 1;
    }
   
    printf("%d\n", answer);
    
}

Measured memory_bytes: 128
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
	int N;
	cin>>N;
	int data[220][3],cnt[220]={},a;
	int ans[220+1];
	for(int i=0;i<N;i++){
		for(int j=0;j<3;j++){
			cin>>a;
			data[i][j]=a;
		}
	}
	for(int i=0;i<3;i++){
		for(int j=0;j<N;j++){
			for(int k=1;k<=N-j;k++){
				if(data[j][i]==data[j+k][i]){
					cnt[j]=8;
					data[j+k][i]=0;
				}
			}
			if(cnt[j]==8){
				data[j][i]=0;
				cnt[j]=0;
			}	
		}
	}
	for(int j=0;j<N;j++){
			cout<<data[j][0]+data[j][1]+data[j][2]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1164
//https://atcoder.jp/contests/dp/tasks/dp_w
#include <bits/stdc++.h>
#define ll long long
#define mid (l+r)/2
#define le node+node
#define ri node+node+1
using namespace std;
const ll inf=2e5+9,MX=1e18+9;
ll l[inf],r[inf],val[inf],n,m,dp[inf],ans,tree[inf<<2],lazy[inf<<2],vis[inf<<2];
vector<ll> add[inf],del[inf];

void lazyupdate(ll node,ll l,ll r){

    tree[node]+=lazy[node];

    if(l!=r)
        lazy[le]+=lazy[node],lazy[ri]+=lazy[node];

    lazy[node]=0;

}

void update(ll node,ll l,ll r,ll x,ll y,ll val){

    lazyupdate(node,l,r);

    if(l>r || r<x || l>y)
        return ;

    vis[node]=1;

    if(l>=x && r<=y){
        lazy[node]+=val;
        lazyupdate(node,l,r);
        return ;
    }

    update(le,l,mid,x,y,val);
    update(ri,mid+1,r,x,y,val);
    tree[node]=max( (vis[le]?tree[le]:-MX), (vis[ri]?tree[ri]:-MX));
}

ll query(ll node,ll l,ll r,ll x,ll y){

    lazyupdate(node,l,r);

    if(l>r || r<x || l>y )
        return -MX;

    if(l>=x && r<=y)
        return tree[node];

    ll ret= max(query(le,l,mid,x,y),query(ri,mid+1,r,x,y));
    tree[node]=max( (vis[le]?tree[le]:-MX), (vis[ri]?tree[ri]:-MX));
    return ret;
}

int main(){

    cin>>n>>m;
    for(ll i=1;i<=m;i++)
        cin>>l[i]>>r[i]>>val[i],add[l[i]].push_back(i),del[r[i]].push_back(i);

    for(ll i=1;i<=n;i++){

        for(auto o:add[i])
            update(1,0,n,0,l[o]-1,val[o]);

        dp[i]=query(1,0,n,0,i-1);

        ans=max(ans,dp[i]);

        update(1,0,n,i,i,dp[i]);

        for(auto o:del[i])
            update(1,0,n,0,l[o]-1,-val[o]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 47104
#include <stdio.h>


int main ()
{
    int w,h,x,y,r;
    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
    {
        if( (x+r<=w && x-r>=0) && (y+r<=h && y-r>=0) )
           printf("Yes\n");
        else
              printf("No\n");
    }
    return 0;
}





Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,max,tmp;
    tmp=-1;
    while (cin>>a>>b) {
        if (a==0&&b==0) {
            break;
        } else {
            max=a+b;
            for (int i=0;i<4;i++) {
                cin>>a>>b;
                if (max<a+b) {
                    max=a+b;
                    tmp=i;
                }
            }
            if (tmp==-1) {
                cout<<"A"<<" "<<max<<endl;
            } else if (tmp==0) {
                cout<<"B"<<" "<<max<<endl;
            } else if (tmp==1) {
                cout<<"C"<<" "<<max<<endl;
            } else if (tmp==2) {
                cout<<"D"<<" "<<max<<endl;
            } else if (tmp==3) {
                cout<<"E"<<" "<<max<<endl;
            }
            tmp=-1;
        }
    }
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;



int main(){
  ll N;
  cin>>N;
  ll Ans=0;
  rep(i, N){
    ll j=i+1;
    ll k;
    cin>>k;
    if((j*k)%2)Ans++;
  }
  cout<<Ans<<endl;
} 

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;

int main() {
	ll N;
	string S;
	cin >> N;
	cin >> S;
	ll hu = S[0] - 48;
	ll to = (S[2] - 48) * 10 + S[3] - 48;
	cout << N * hu + N * to / 100 << endl;
}

Measured memory_bytes: 3624
import sys

n,y = map(int, input().split())

for a in range(n+1):
	for b in range(n+1-a):
		c = n - a - b
		if (a * 10000 + b * 5000 + c * 1000 == y):
				print(str(a) + ' ' + str(b) + ' ' + str(c))
				sys.exit()
	
print('-1 -1 -1')
sys.exit()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A,B,C;
  	cin >> A >> B >> C;
  	bool ans = false;
  	for(int i =1;i <B;i++){
    	if(i*A%B == C)ans = true;
    }
  	if(ans)cout << "YES" << endl;
  	else cout << "NO" <<endl;
}

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

using namespace std;

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

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

ll N;
string s;

void solve() {
    cin >> N >> s;
    rep(mask,4) {
        int ani[N];
        ani[0] = mask & 1;
        ani[1] = (mask >> 1) & 1;
        REP(i,2,N) {
            if (s[i-1] == 'o') {
                ani[i] = (ani[i-1]) ? (!ani[i-2]) : (ani[i-2]);
            } else {
                ani[i] = (ani[i-1]) ? (ani[i-2]) : (!ani[i-2]);
            }
        }
        bool flag1 = 0, flag2 = 0;
        if (s[N-1] == 'o') {
            flag1 = ani[0] == (ani[N-1]) ? (!ani[N-2]) : (ani[N-2]);
        } else {
            flag1 = ani[0] == (ani[N-1]) ? (ani[N-2]) : (!ani[N-2]);
        }
        if (s[0] == 'o') {
            flag2 = ani[1] == (ani[0]) ? (!ani[N-1]) : (ani[N-1]);
        } else {
            flag2 = ani[1] == (ani[0]) ? (ani[N-1]) : (!ani[N-1]);
        }
        if (flag1 && flag2) {
            rep(i,N) cout << (ani[i] ? "W" : "S");
            cout << endl;
            return;
        }
    }
    cout << -1 << endl;
}

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


Measured memory_bytes: 976
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;



int main(){
  string  s, t, u;
  int a,b =0;
  cin >> s >> t >> a >> b >> u;
  if(s == u){
    a = a-1;
  }
  else{
    b = b-1;
  }
  cout << a << ' ' << b;




}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;
int n, k;
llong T[MAX];

int check(llong P){
    int i = 0;
    for(int j = 0; j < k; j++){
        llong s = 0;
        while(s + T[i] <= P){
            s += T[i];
            i++;
            if(i == n) return n;
        }
    }
    
    return i;
}

int solve(){
    llong left = 0;
    llong right = 100000 * 10000;
    llong mid;
    while(right - left > 1){
        mid = (left + right) / 2;
        int v = check(mid);
        if(v >= n) right = mid;
        else left = mid;
    }
    
    return right;
}

main(){
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> T[i];
    llong ans = solve();
    cout << ans << endl;
}


Measured memory_bytes: 3880
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A[10],a,b;
  for(int i=0;i<=8;i++){
    cin>>A[i];
  }
  a=A[0]+A[1]+A[2]+A[3];
  b=A[4]+A[5]+A[6]+A[7];
  if(a>=b)cout<<a<<endl;
  else cout<<b<<endl;

 return 0;
}

Measured memory_bytes: 3104
A = [list(map(int,input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for i in range(3):
    for j in range(3):
        for b in B:
            if A[i][j] == b:
                A[i][j] = 0
ans = 'No'
for i in range(3):
    if (A[i][0] + A[i][1] + A[i][2] == 0) or (A[0][i] + A[1][i] + A[2][i] == 0) or (A[0][0] + A[1][1] + A[2][2] == 0) or (A[0][2] + A[1][1] + A[2][0] == 0):
        ans = 'Yes'
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int i=0;
    while(i<=s.size()-1){
        if(s.substr(i,5)=="maerd")i+=5;
        else if(s.substr(i,7)=="remaerd")i+=7;
        else if(s.substr(i,5)=="esare")i+=5;
        else if(s.substr(i,6)=="resare")i+=6;
        else{
            cout<<"NO"<<endl;
            exit(0);
        }
    }
    cout<<"YES"<<endl;
}


Measured memory_bytes: 512
function main(input) {
  const lines = input.split('\n');
  lines.forEach(line => {
    if (line.length === 0) {
      return;
    }
    var flag = false;
    Array.prototype.forEach.call(line, (c, idx) => {
      if (idx === 0) {
        return;
      }
      if (c === line[idx - 1]) {
        flag = true;
        return;
      }
    });
    if (flag) {
      console.log('Bad');
    } else {
      console.log('Good');
    }
  });
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include<stdio.h>
int main() {
	int tak,aoki;
	int k;
	int num;
	scanf ("%d %d %d",&tak,&aoki,&num);
	for (k = 1;k <= num; k++ ) {
		if (k %2 == 1) {
	        if (tak %2 == 1 ) {
	     	    tak--;
		    }
		    aoki += tak/2;
		    tak = tak/2;
	    } else {
	        if (aoki %2 == 1) {
		        aoki--;
	        }  
	        tak += aoki/2;
	        aoki = aoki/2;
	    }
	}
	printf ("%d %d\n",tak,aoki);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int f(int a){
  int i;
  for(i=0;a;i++)a/=2;
  return i;
}
int main(){
  int n,i,a=0,d,b[50]={};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&d);
    a^=d;
    b[f(d^(d-1))-1]=1;
  }
  //printf("%d\n",a);
  //for(i=0;i<5;i++)printf("%d ",b[i]);printf("\n");
  d=0;
  for(i=32;i--;){
    if(b[i]&&(a&(1<<i))){
      d++;
      a^=(1<<(i+1))-1;
    }
  }
  printf("%d\n",a?-1:d);
  return 0;
}
    
		 


Measured memory_bytes: 256
=begin
－－－－－－－－－－－－－－
  n = 入力値
  A = n % i == 0 の時の i
  B = n % i == 0 の時の n / i の返り値
  max = AとBの桁数の大きい方
  ans = 最小桁数
－－－－－－－－－－－－－－
  1: 桁数をカウントするメソッド cnt_digits を作成
    1:num < 0 になるまでループ
      1.1: n / 10
      1.2: ループ回数をカウント
    2: ループ回数を返す
  2: n の桁数を ans に代入
  3: 1 ~ n をループ (i) (* n^10 のためループが間に合わない。そのため i*i が n を超えた時点で終了する)
    3.1: n % i == 0 場合
      3.1.1: B に n / i を代入
      3.1.2: A と B の桁数のうち大きい方を max に代入
      3.1.3: ans > max の場合、 ans に maxを代入
  4: ans を出力
=end

def cnt_digits(num)
  cnt = 0;
  while num > 0
    num /= 10;
    cnt += 1;
  end
  return cnt;
end

N = gets.to_i;
ans = cnt_digits(N);
i = 1;
a = 0;
b = 0;

while i*i <= N
  if N % i != 0
    i += 1;
    next
  end

  a = i;
  b = N / i;

  max = [cnt_digits(a), cnt_digits(b)].max;
  ans = max if ans > max;

  i += 1;
end
  
puts ans;


Measured memory_bytes: 1788
n = int(input())
ary = [int(input()) for _ in range(n)]

minv = min(ary[0], ary[1])
maxv = ary[1] - ary[0]
for i in range(2, n):
    maxv = max(maxv, ary[i] - minv)
    minv = min(minv, ary[i])

print(maxv)



Measured memory_bytes: 13592
#include<bits/stdc++.h>
using namespace std;
//Modulo Calculation
const int MOD = 998244353;
//ModInt
template <int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {
        if ((x = x_ % mod + mod) >= mod) x -= mod;
    }
    ModInt& operator+=(ModInt rhs) {
        if ((x += rhs.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(ModInt rhs) {
        if ((x -= rhs.x) < 0) x += mod;
        return *this;
    }
    ModInt& operator*=(ModInt rhs) {
        x = (unsigned long long)x * rhs.x % mod;
        return *this;
    }
    ModInt& operator/=(ModInt rhs) {
        x = (unsigned long long)x * rhs.inv().x % mod;
        return *this;
    }
  
    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    ModInt &operator++ () { *this += 1; return *this;}
    ModInt operator++ (int) { *this += 1; return *this - 1;}
    ModInt &operator-- () { *this -= 1; return *this;}
    ModInt operator-- (int) { *this -= 1; return *this + 1;}
    bool operator==(ModInt rhs) const { return x == rhs.x; }    
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    bool operator<=(ModInt rhs) const { return x <= rhs.x; }
    bool operator>=(ModInt rhs) const { return x >= rhs.x; }
    bool operator<(ModInt rhs) const { return x < rhs.x; }
    bool operator>(ModInt rhs) const { return x > rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }
  
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {
        s << a.x;
        return s;
    }
    friend istream& operator>>(istream& s, ModInt<mod>& a) {
        s >> a.x;
        return s;
    }
};
using mint = ModInt<MOD>;

//二項定理計算
const int MAX = 500000;
mint fac[MAX],finv[MAX],inv[MAX];
//テーブル作成
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*(mint)i;
        inv[i]=(mint)MOD-inv[MOD%i]*(mint)(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

//nCkを求める
mint COM(int n,int k){
    if(n < k or n < 0 or k < 0)return 0;
    return fac[n]*finv[k]*finv[n-k];
}

struct maketable{
    maketable(){COMinit();}
}maketable_;

mint res;
int main(){
    int n, k;
    cin >> n >> k;
    for(int r = n - 1; r < k; r++) res += COM(k - 1, r);
    cout << res << '\n';
}

Measured memory_bytes: 9492
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

    public void Proc()
    {
        int inputCount = int.Parse(Reader.ReadLine());
        int[] items = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        PriorityList listZ = new PriorityList();
        PriorityList listK = new PriorityList();

        for (int i = 0; i < inputCount; i++) {
            listZ.Push(items[i]);
            listK.Push(items[inputCount * 3 - i - 1]*-1);
        }

        long[] zenhan = new long[inputCount * 3];

		zenhan[inputCount-1] = listZ.GetTotal();
        for (int i = inputCount; i < inputCount * 2;i++) {
            listZ.Push(items[i]);
            listZ.Pop();
            zenhan[i] = listZ.GetTotal();
        }
        long max = long.MinValue;
        max = zenhan[inputCount * 2 - 1] + listK.GetTotal();

		for (int i = inputCount * 2 - 1; i >= inputCount; i--) {
            listK.Push(items[i]*-1);
            listK.Pop();
            max = Math.Max(max, zenhan[i-1] + listK.GetTotal());
        }
        Console.WriteLine(max);

    }


    private class PriorityList {
        public long GetTotal() {
            return this.Total;
        }
        private long Total = 0;
        private SortedDictionary<int, int> Items = new SortedDictionary<int, int>();
        public void Push(int num) {
            if(this.Items.ContainsKey(num)) {
                Items[num]++;
            } else {
                Items.Add(num, 1);
            }
            Total += num;
		}
        public int Pop() {
            int key = Items.First().Key;
            int num = key;
            Items[key]--;
            if(Items[key]<=0) {
                Items.Remove(key);
            }
            Total -= num;
            return num;
        }


    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


3
8 2 2 7 4 6 5 3 8


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}


Measured memory_bytes: 52136
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
    int n, len; cin >> n >> len;
    vector<string> in(n);
    for(auto & e : in) cin >> e;
    sort(_all(in));

    string res;
    for(auto & e : in) res += e;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if(a<b){
    	if(b<c){
    	printf("Yes\n");
    }
    else{
    	printf("No\n");
    }
    } else {
    	printf("No\n");
    }
	return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

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

    while (in.hasNext()) {
      long A = in.nextLong();
      long B = in.nextLong();
      long C = in.nextLong();
      long D = in.nextLong();
      long countDivideByC = count(A, B, C);
      long countDivideByD = count(A, B, D);
      long countDivideByLCM_CD = count (A, B, C * D / gcd(C, D));
      
      System.out.println(B - A + 1 - countDivideByC - countDivideByD + countDivideByLCM_CD);
    }
  }

  private static long count (long start, long end, long div) {
    return end / div - start / div + (start % div == 0 ? 1 : 0);
  }

  private static long gcd (long a, long b) {
    return b == 0 ? a : gcd(b, a % b);
  }
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int MOD = (int)1e9 + 7;
int mult(int x, int y)
{
    return ((ll)x * y) % MOD;
}
int bin_pow(int x, int p)
{
    if (p == 0) return 1;
    if (p == 2 || (p & 1)) return mult(x, bin_pow(x, p - 1));
    return bin_pow(bin_pow(x, 2), p / 2);
}
int rev(int x)
{
    return bin_pow(x, MOD - 2);
}

const int N = 200200;
vector<int> a[N];
int n, X, Y;
int f[N], rf[N];
int b[N];

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    f[0] = 1;
    for (int i = 1; i < N; i++)
        f[i] = mult(f[i - 1], i);
    rf[N - 1] = rev(f[N - 1]);
    for (int i = N - 1; i > 0; i--)
        rf[i - 1] = mult(rf[i], i);

    scanf("%d%d%d", &n, &X, &Y);
    for (int i = 0; i < n; i++)
    {
        int c, w;
        scanf("%d%d", &c, &w);
        c--;
        a[c].push_back(w);
    }
    for (int c = 0; c < n; c++)
        sort(a[c].begin(), a[c].end());
    int fst = -1, scnd = -1;
    for (int c = 0; c < n; c++)
    {
        if (a[c].empty()) continue;
        if (fst == -1)
            fst = c;
        else if (a[c][0] < a[fst][0])
        {
            scnd = fst;
            fst = c;
        }
        else if (scnd == -1 || a[c][0] < a[scnd][0])
            scnd = c;
    }
    for (int c = 0; c < N; c++)
    {
        if (a[c].empty()) continue;
        if (c == fst)
        {
            int p = upper_bound(a[c].begin(), a[c].end(), X - a[c][0]) - a[c].begin();
            if (p == 0) p = 1;
            if (scnd != -1)
                p = max(p, (int)(upper_bound(a[c].begin(), a[c].end(), Y - a[scnd][0]) - a[c].begin()));
            b[c] = p;
            continue;
        }
        b[c] = upper_bound(a[c].begin(), a[c].end(), Y - a[fst][0]) - a[c].begin();
        if (b[c] == 0) continue;
        b[c] = max(b[c], (int)(upper_bound(a[c].begin(), a[c].end(), X - a[c][0]) - a[c].begin()));
    }
    int sum = 0;
    int ans = 1;
    for (int c = 0; c < N; c++)
    {
        sum += b[c];
        ans = mult(ans, rf[b[c]]);
    }
    ans = mult(ans, f[sum]);
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 11648
import java.util.Scanner;

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

		// 入力値の取得
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		// 結果の出力
		boolean notFound = true;
		for (int i = 10; i < 1010; i++) {
			if (Math.floor(i * 0.08) == A) {
				if (Math.floor(i * 0.1) == B) {
					System.out.println(i);
					notFound = false;
					break;
				}
				else {
					continue;
				}
			}
			else {
				continue;
			}
		}
		
		if (notFound) {
			System.out.println(-1);
		}

		sc.close();
	}
}


Measured memory_bytes: 22996
#include "bits/stdc++.h"
using namespace std;

int main() {

	int n, m;
	cin >> n >> m;

	int k[50][50]{};
	int temp[50]{};

	for (int i = 0; i < n; i++)
	{
		cin >> temp[i];
		for (int j = 0; j < temp[i]; j++)
		{
			cin >> k[i][j];//好物
		}
	}

	int total = 0;
	for (int z = 1; z < m + 1; z++)//種類
	{
		int cnt = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < temp[i]; j++)
			{
				if (k[i][j] == z) cnt++;
			}
		}
		if (cnt == n) total++;
	}


	cout << total << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define ll long long
#define endl '\n'
#define vi vector<int>
#define rep(i, n) for (i = 0; i < n; i++)


 
int main()
{  ios_base::sync_with_stdio(false);cin.tie(NULL);
   #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
   #endif 
   
   char ch;
   cin>>ch;

   if(islower(ch))
   	cout<<'a';

   else
   	cout<<'A';


}   

Measured memory_bytes: 3604
A, B, C, K = map(int,input().split())
cnt = 0

if K > 0:
    if K >= A:
        cnt += A
        K = K - A
    else: # K < A
        cnt += K
        K = 0
if K > 0:
    if K >= B:
        K = K - B
    else: # K < B
        K = 0
if K > 0:
    if K >= C:
        cnt -= K
        K = K - C
    else: # K < C
        cnt -= K
        K = 0
print(cnt)

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

using namespace std;

int main()
{
    int N,R;
    cin >> N;
    cin >> R;
    if (N >= 10)
    {
        cout << R;
    }
    else
    {
        cout << R+(100*(10-N));
    }
    
    return 0;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

vector<pii> vpi(100005);
signed main()
{
  int n = in();
  rep(i, n){
    int tmp = in();
    vpi[i] = mp(tmp - 1, i);
  }
  int ans = 0;
  rep(i, n){
    if (vpi[i].fst == vpi[vpi[i].fst].sec and vpi[vpi[i].fst].fst == vpi[i].sec) ans++;
  }
  print(ans / 2);

  return (0);
}


Measured memory_bytes: 1152
N, M = map( int, input().split() )
A = list( map( int, input().split() ) )


# 桁数の一番大きいものが最大。そのあと数を大きい順に並べればいい
dp = [0] + [-float('inf')] * (N+1)       # dp[i]: i 本のマッチで条件を満たす整数の最大桁数
cost = [ 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]  # 各数字に必要なマッチ棒の数(逆順)

for num_match in range( 2, N+1 ):
    for Aj in A:
        if num_match >= cost[Aj]:
            dp[num_match] = max( dp[num_match], dp[num_match-cost[Aj]]+1 )


ans = ""
digit = dp[N]

A.sort( reverse=True )
while N > 0:
    for Ai in A:
        if N-cost[Ai] >=0 and dp[N-cost[Ai]] == digit-1:
            ans += str(Ai)
            N -= cost[Ai]
            digit -= 1
            break

print( ans )

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
	int ans = A + B;

	if (10 <= ans) cout << "error" << endl;
	else cout << ans << endl;

}







Measured memory_bytes: 256
n = int(input())
s = input()
dp = [0]*(n+1)

cnt = 0
for i in range(n):
    if s[i] == 'W':
        cnt += 1
    dp[i+1] += cnt

cnt = 0
for i in reversed(range(n)):
    if s[i] == 'E':
        cnt += 1
    dp[i] += cnt
print(min(dp))


Measured memory_bytes: 15264
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define vec vector
#define ref(a) &(a)

const int mod = 1e9 + 7;

typedef long long ll;

using namespace std;

const int MAX = 25;

struct Node {
  int p, l, r;
};

int n;
int root;
Node nds[MAX];

void pre(int p) {
  printf(" %d", p);
  if (nds[p].l != -1)
    pre(nds[p].l);
  if (nds[p].r != -1)
    pre(nds[p].r);
}

void in(int p) {
  if (nds[p].l != -1)
    in(nds[p].l);
  printf(" %d", p);
  if (nds[p].r != -1)
    in(nds[p].r);
}

void post(int p) {
  if (nds[p].l != -1)
    post(nds[p].l);
  if (nds[p].r != -1)
    post(nds[p].r);
  printf(" %d", p);
}

void solve() {
  cout << "Preorder" << endl;
  pre(root);
  cout << endl;
  cout << "Inorder" << endl;
  in(root);
  cout << endl;
  cout << "Postorder" << endl;
  post(root);
  cout << endl;
}

int main() {
  cin >> n;
  rep(i, n) nds[i].p = -1;
  rep(i, n) {
    int p, l, r;
    cin >> p >> l >> r;
    nds[p].l = l; nds[p].r = r;
    if (l != -1) nds[l].p = p;
    if (r != -1) nds[r].p = p;
  }
  rep(i, n) if (nds[i].p == -1) root = i;
  solve();
  return 0;
}


Measured memory_bytes: 3232
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;


int main() {

	ll N, K;
	cin >> N >> K;

	if (K % 2 == 1) { cout << (N / K)*(N / K)*(N / K); }

	else {
		ll m = K / 2;

		ll a = N / m / 2;
		ll b = (N / m + 1) / 2;

		cout << a * a*a + b * b*b;

	}



	
	system("PAUSE");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n,t;
	cin >> n >> t;
	ll ans = INF;
	rep(i,0,n){
		ll a,b;
		cin >> a >> b;
		if( b <= t ) ans = min( a , ans );
	}
	if( ans != INF )
		cout << ans << endl;
	else 
		cout << "TLE" << endl;
	ret 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int S, W;
    in(S); in(W);
    cout << ((W >= S)? "unsafe":"safe") << endl;

	return 0;
}


Measured memory_bytes: 3632
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i32>();
    let (n, k) = (line[0], line[1]);

    if n%k != 0{
        println!("1");
    }else{
        println!("0");
    }
}


Measured memory_bytes: 4352
def make_line(line_str):
    x1, y1, x2, y2 = map(int, line_str.split())
    return (x1 + 1j * y1, x2 + 1j * y2)


def cross_point(l1, l2):
    (p1, p2), (p3, p4) = l1, l2
    v34, v12, v23, v31 = p4 - p3, p2 - p1, p3 - p2, p1 - p3
    s1 = v34.real * v31.imag - v34.imag * v31.real
    s2 = v34.real * v23.imag - v34.imag * v23.real
    if s1 + s2 == 0:
        return None
    rt = s1 / (s1 + s2)
    cp = p1 + v12 * rt
    if abs(cp.real) >= 100 or abs(cp.imag) >= 100:
        return None
    cp *= 1e10
    return (int(cp.real), int(cp.imag))


while True:
    n = int(input())
    if not n: break
    lines = [make_line(input()) for _ in range(n)]

    num_crossed = 0
    for i, line in enumerate(lines):
        current_crossed = set(cross_point(line, l) for l in lines[:i])
        current_crossed.discard(None)
        num_crossed += len(current_crossed)

    print(1 + n + num_crossed)

Measured memory_bytes: 7736
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		double w = nd();
		double h = nd();
		double x = nd();
		double y = nd();
		double area = w * h / 2D;
		if(x == w / 2D && y == h / 2D) {
			System.out.println(area + " " + 1);
		} else {
			System.out.println(area + " " + 0);	
		}
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21460
#include<iostream>
#include<map>
using namespace std;
main(){
  int a,b=0,c=0,n,x=0,max=0;
  map< int,int >p;
  for(a=0;a++<100;p[a]=0);
  while(cin>>n){
    if(p[n]==0){
      if(b==0||b<n)b=n;
    }
    p[n]++;
  }
  for(a=0;a<b;a++){
    if(max<p[a]){
      max=p[a];
    }
  }
  for(a=0;a<b;a++){
    if(max==p[a]){
      cout<<a<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int a[200009];
int n;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int sum=1;
	int temp=a[0];
	for(int i=0;i<n-1;i++){
		if(temp>a[i+1]){
			sum++;
			temp=a[i+1];
		}
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ld n; cin >> n;
    cout << (n / 3) * (n / 3) * (n / 3) << "\n";
}

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>;

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N+1);
    vector<ll> B(M);
    rep(i, N) cin >> A[i];
    rep(i, M) cin >> B[i];
    A[A.size()-1] = 10000000000000000;

    ll sum = 0;
    rep(i, M) sum += B[i];
    int j = M;
    int ans = 0;
    rep(i, N+1){
        while (j > 0 && sum > K) sum -= B[--j];
        if(sum > K) break;
        ans = max(ans, i+j);
        sum += A[i];
    }
    cout << ans << endl;
    return 0;
}


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

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

	return 0;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int a, b;
	cin >> a >> b;
	cout << max(0LL, a - 2 * b);
}
	

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  cin>>N>>M;
  int ans;
  ans=M/N;
  while(ans>0){
  	if(M%ans==0){
      cout<<ans<<endl;
      break;
    }
    ans--;
  }
}

Measured memory_bytes: 256
#include<iostream>//AT2652
#include<cstdio>
#include<cstring>
#include<string>
#include<iomanip>
#include <algorithm>
#include<cmath>
#include<vector>
#include<set>
using namespace std;
int main()
{int x,y;cin>>x>>y;if(x%y)cout<<x;else cout<<"-1";return 0;}

Measured memory_bytes: 256
MOD=10**9+7
import math
def cal(x,y):
  return math.factorial(x+y)//math.factorial(x)//math.factorial(y)
N,K=map(int,input().split())
for i in range(1,K+1):
  if N-K<i-1:
    print(0)
  else:
    print(cal(K-i,i-1)*cal(N-K-i+1,i)%MOD)


Measured memory_bytes: 68056
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    string s;
    cin >> s;
    REP(i,3){
        if(s[i] == s[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;

}

Measured memory_bytes: 256