akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    vector<vector<int>> bingo(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)
            cin >> bingo[i][j];
    }

    int n;
    cin >> n;
    
    vector<int> b(n);
    for(auto &x:b)cin >> x;

    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(b[i]==bingo[j][k]){
                    bingo[j][k]=-1;
                    break;
                }
            }
        }
    }

    int ans=0;
    for(int i=0;i<3;i++){
        if(bingo[i][0]==bingo[i][1] && bingo[i][1]==bingo[i][2])ans++;
        if(bingo[0][i]==bingo[1][i] && bingo[1][i]==bingo[2][i])ans++;        
    }
    if(bingo[0][0]==bingo[1][1] && bingo[1][1]==bingo[2][2])ans++;
    if(bingo[0][2]==bingo[1][1] && bingo[1][1]==bingo[2][0])ans++;

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3612
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
vector<ll> a,b;
int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    FAST
    cin>>n>>m>>k;
    a.pb(0);
    for(i=1;i<=n;i++)
    {
        cin>>x;
        a.pb(a[i-1]+x);
    }
    b.pb(0);
    for(i=1;i<=m;i++)
    {
        cin>>x;
        b.pb(b[i-1]+x);
    }
    ll ans  =0;
    for(i=0;i<=n;i++)
    {
        if(a[i]>k)
            break;
        x = k-a[i];
        y = upper_bound(b.begin(),b.end(),x)-b.begin();

        ans  =max(ans,y+i-1);
    }
    cout<<ans<<endl;


    return 0;
}



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

using namespace std;

template <long long Mod> struct ModInt { /* {{{ */
  long long v;
  constexpr ModInt(const long long x = 0) {
    v = x % Mod;
    if (v < 0) {
      v += Mod;
    }
  }
  constexpr ModInt operator+(const ModInt rhs) const {
    return ModInt(*this) += rhs;
  }
  constexpr ModInt operator-(const ModInt rhs) const {
    return ModInt(*this) -= rhs;
  }
  constexpr ModInt operator*(const ModInt rhs) const {
    return ModInt(*this) *= rhs;
  }
  constexpr ModInt operator/(const ModInt rhs) const {
    return ModInt(*this) /= rhs;
  }
  const ModInt &operator+=(const ModInt rhs) {
    v += rhs.v;
    if (v >= Mod) {
      v -= Mod;
    }
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt rhs) {
    if (v < rhs.v) {
      v += Mod;
    }
    v -= rhs.v;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt rhs) {
    v = v * rhs.v % Mod;
    return *this;
  }
  constexpr ModInt &operator/=(ModInt rhs) {
    long long exp = Mod - 2;
    while (exp) {
      if (exp & 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp >>= 1;
    }
    return *this;
  }
  friend ostream &operator<<(ostream &s, ModInt<Mod> m) {
    s << m.v;
    return s;
  }
  friend istream &operator>>(istream &s, ModInt<Mod> m) {
    s >> m.v;
    return s;
  }
}; /* }}} */

const int mod = 1e9 + 7;
using modint = ModInt<mod>;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> A(H);
  for (auto &a : A) {
    cin >> a;
  }
  vector<vector<modint>> dp(H + 5, vector<modint>(W + 5));
  dp[0][0] += 1;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i < H - 1 and A[i + 1][j] == '.') {
        dp[i + 1][j] += dp[i][j];
      }
      if (j < W - 1 and A[i][j + 1] == '.') {
        dp[i][j + 1] += dp[i][j];
      }
    }
  }
  cout << dp[H - 1][W - 1] << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 9216
x,y=map(x->parse(Int,x),split(readline()))
ans=0
if x==0
	if y>0
		ans=y
	else
		ans=1-y
	end
elseif y==0
	if x<0
		ans=-x
	else
		ans=x+1
	end
elseif x>0
	if y>0
		if x<y
			ans=y-x
		else
			ans=2+x-y
		end
	else
		ans=1+abs(x+y)
	end
else
	if y<0
		if x<y
			ans=y-x
		else
			ans=2+x-y
		end
	else
		ans=1+abs(x+y)
	end
end
println(ans)


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

A.sort()
B = A[1:N-1]
amax=A[-1]
amin=A[0]

"""
a       p1
a-p1    p2
a-p1-p2 p3
として、
b a-sum(p)
で符号を入れ替え、
b-a+sum(p)    n1
b-a+sum(p)-n1 n2
とすると
b-a+sum(pos)-sum(neg)を実現できる。
bは全体で最大（Negの場合も）
aは全体で最小（Posの場合も）を選べばよい
"""
ANS = []
ind = N-2
wk = amin
while A[ind] >= 0 and ind >= 1:
  ANS.append((wk, A[ind]))
  wk -= A[ind]
  ind -= 1

ANS.append((amax, wk))
wk = amax - wk
while ind >= 1:
  ANS.append((wk, A[ind]))
  wk -= A[ind]
  ind -= 1

print(wk)
for a,b in ANS:
  print(a,b)
    

Measured memory_bytes: 24652
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll a,b,k; cin >> a >> b >> k;
  REP(i,k){
    ll t;
    if(i%2==0){
      t = a/2;
      a -= t + a%2;
      b += t;
    }else{
      t = b/2;
      a += t;
      b -= t + b%2;
    }
  }
  cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
vector<int> ans;
int main(){
        int n,k,s;
        while(~getIII(n,k,s)){
                ans.clear();
                F(i,0,k) ans.pb(s);
                F(i,k,n) ans.pb((s+1)%1000000000+1);
/*              int cnt=0;
                F(i,0,n) F(j,i,n){
                        int sum=0;
                        FE(l,i,j) sum+=ans[l];
                        if(sum==s) cnt++;
                }*/
                F(i,0,n){
                        printf("%d ",ans[i]);
                        if(ans[i]<1){
                                while(1){
                                        //TLE
                                }
                        }
                        if(ans[i]>1000000000) assert(0);
                }
                puts("");
                //printf("%d %s\n",cnt,cnt==k?"YES":"NO");
        }
}

Measured memory_bytes: 1784
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    
    cout << a[n-1] - a[0] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll dp[5555],c[5555];
int p[5555];
bool visited[5555];

int main(void){
	int n,i,j,k,x,y,z;
	ll ans = -INFLL;
	std::cin >> n >> x;
	for(i=0; i<n; ++i){
		std::cin >> p[i]; --p[i];
	}
	for(i=0; i<n; ++i){
		std::cin >> c[i];
	}
	for(i=0; i<n; ++i){
		std::fill(visited,visited+n,false);
		std::fill(dp,dp+n,0ll);
		j = i; k = 0ll; dp[0] = 0ll;
		while(!visited[p[j]]){
			visited[p[j]] = true;
			dp[k+1] = dp[k] + c[p[j]];
			j = p[j];
			++k;
		}
		for(j=1; j<=std::min(n,x); ++j){
			y = j/k; z = j%k;
			ans = std::max(ans,dp[k]*y+dp[z]);
		}
		for(j=x-n; j<=x; ++j){
			if(j<=0){
				continue;
			}
			y = j/k; z = j%k;
			ans = std::max(ans,dp[k]*y+dp[z]);
		}
	}
	std::cout << ans << std::endl;
	return 0;
}


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


int main() {
		int x,a,b;
  		cin>>x>>a>>b;
  
  		if(b<=a){
        	cout<<"delicious"<<endl;
        }else if(a<b && b<=a+x){
        	cout<<"safe"<<endl;
        }else{
        	cout<<"dangerous"<<endl;
        }
}

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

using namespace std;

#define int          long long
#define fast()        ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)       v.begin() , v.end()
#define ff           first
#define ss           second
#define out(x)       cerr << #x << " is : " << x << endl
#define endl         "\n"
#define mem(f , v)      memset(f , v , sizeof f)

const int N = 1e6 + 10;

void up()
{
    int n;
    cin >> n;
    int f[N] , a[n];
    mem(f , 0);
    for(int i = 0 ; i < n ; i++)
    {
        cin >> a[i];
        f[a[i]]++;
    }
    bool cond = false;
    int cnt = 0;
    for(int i = 0 ; i < n ; i++)
    {
        f[a[i]]--;
        cond = true;
        for(int j = 1 ; j * j <= a[i]; j++)
        {
            if(a[i] % j == 0)
            {
                if(f[j] or f[a[i] / j])
                {
                    cond = false;
                    break;
                }
            }
        }
        f[a[i]]++;
        if(cond)
            cnt++;
    }

    cout << cnt << endl;
    return;
}


int32_t main()
{
    fast();
    up();
    return 0;
}



Measured memory_bytes: 12984
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        int m = int.Parse(Console.ReadLine());
        var dc = Enumerable.Repeat(0, m).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
        var a = dc.Sum(x => x[0] * x[1]);
        var res = dc.Sum(x => x[1])/*桁数*/;
        res += (a - 1) / 9;
        Console.WriteLine(res - 1);
    }
}


Measured memory_bytes: 34064
#include <iostream>

int main() {
    int N, M;
    std::cin >> N >> M;

    int res = 0;
    for (int i = 0; i < M; i++) {
        int A;
        std::cin >> A;
        res += A;
    }

    std::cout << std::max(-1, N - res) << "\n";
}

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

int main() {
  int k, t;
  cin >> k >> t;
  int a[t], total = 0;
  for (int i = 0; i < t; i++) {
    cin >> a[i];
    total += a[i];
  }
  int max_a = a[max_element(a, a + t) - a];
  cout << max(max_a * 2 - total - 1, 0) << endl;
  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>;

int main(){
	int n,m;
	cin >> n >> m;
	vector<int> ac(n), pena(n);
	rep(i,m){
		int p;
		string s;
		cin >> p >> s;
		p--;
		if(ac[p]) continue;
		if(s == "AC") {
			ac[p] = 1;
		}
		else pena[p]++;
	}
	int acwa = 0;
	int penawa =0;
	rep(i,n){
		if(ac[i] == 1) acwa++;
		if(ac[i]) penawa += pena[i];
	}
	cout << acwa << " " << penawa << endl;
}

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

#define int long long

#define F first
#define S second
#define all(x) (x).begin(), (x).end()

using namespace std;

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

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

    int d, t, s;
    cin >> d >> t >> s;
    cout << (d <= t*s ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int  &i : v) cin >> i;
    int T;
    cin >> T;
    while (T--) {
        int a, b, c;
        cin >> a >> b >> c;
        auto it = v.begin();
        rotate(it + a, it + b, it + c);
    }
    for (int i = 0; i < n; i++) {
        cout << v[i];
        if (i!=n-1)cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3152
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))

//遅延seg木
typedef struct tapuru{ll atai,tien;}T;
int segNUM;
T seg[1<<18],*segN;
//まずsegNUM(2べき)を指定
void seguse(int n){if(n==(n&-n)){segNUM=n;segN=seg+segNUM-1;}}
void subup(int a,int b,int k,int l,int r,ll x){
	//seg[k]に[l,r)が対応する
	//disjointな時は何もしない
	if(r<=a||b<=l)return;
	
	//完全に含むときはtienを更新する
	if(a<=l&&r<=b){
		seg[k].tien+=x*(r-l);
		return;
	}
	//左右を更新する
	subup(a,b,k*2+1,l,(l+r)/2,x);//left
	subup(a,b,k*2+2,(l+r)/2,r,x);//right
}
//[a,b)にxを加算
void segupdate(int a,int b,ll x){subup(a,b,0,0,segNUM,x);}
ll subv(int i,int k,int l,int r){
	//seg[k]に[l,r)が対応する
	//最後まで来たら帰る
	if(r-l==1)return seg[k].atai+seg[k].tien;
	
	//そうでないならtienを更新してから潜る
	seg[2*k+2].tien+=seg[k].tien/2;
	seg[2*k+1].tien+=seg[k].tien/2;
	seg[k].tien=0;
	ll m=(l+r)/2;
	if(i<m)subv(i,2*k+1,l,m);
	else subv(i,2*k+2,m,r);
}
//index iの値を取ってくる
ll segvalue(int i){return subv(i,0,0,segNUM);}


typedef struct interval{ll l,r;}I;
int hikaku(const void*p,const void*q){
	I pp=*(I*)p,qq=*(I*)q;
	ll pplen=pp.r-pp.l,qqlen=qq.r-qq.l;
	return pplen<qqlen?-1:pplen>qqlen?1:0;
}

I kukan[300010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);

	rep(i,0,n){
		int l,r;
		scanf("%d%d",&l,&r);
		kukan[i].l=l;
		kukan[i].r=r+1;
	}
	qsort(kukan,n,sizeof(I),hikaku);
	

	seguse(1<<17);
	ll icnt=0;//seg木に投げた区間の個数
	rep(k,1,m+1){
		while(icnt<n&&kukan[icnt].r-kukan[icnt].l<k){
			//長さk未満の区間をseg木に追加
			segupdate(kukan[icnt].l,kukan[icnt].r,1);
			icnt++;
		}
		ll ans=n-icnt;
		//(n-icnt)個の区間は、長さがk以上なので必ず回収できる
		//残りのicnt個の区間は、長さがk未満なので高々1度しか訪問しないため、各駅をチェックすれば良い
		repp(x,k,m+1,k)ans+=segvalue(x);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 11004
using System;

namespace Dice
{
    class Program
    {
        private static bool Eql(string[] x, string[] y)
        {
            bool g = true;
            for (int o = 0; o < x.Length; o++)
              if (x[o] != y[o]) g = false;
            return g;
        }

        private static string Check(string[] x, string[] y)
        {
            if (Eql(x, y)) return "Yes";
            for (int p = 0; p < 2; p++)
            {
                for(int q = 0; q < 4; q++)
                {
                    var a = x[0]; var b = x[1]; var c = x[2];
                    var d = x[3]; var e = x[4]; var f = x[5];
                    x = p == 0 ? new string[] { e, a, c, d, f, b } :
                                 new string[] { d, b, a, f, e, c };
                    if (Eql(x, y)) return "Yes";
                    var h = x;
                    for(int r = 0; r < 4; r++)
                    {
                        var i = h[0]; var j = h[1]; var k = h[2];
                        var l = h[3]; var m = h[4]; var n = h[5];
                        h = new string[] { i, k, m, j, l, n };
                        if (Eql(h, y)) return "Yes";
                    }
                }
            }
            return "No";
        }

        static void Main()
        {
            var s = Console.ReadLine().Split(' ');
            var t = Console.ReadLine().Split(' ');
            Console.WriteLine(Check(s, t));
        }
    }
}

Measured memory_bytes: 8964
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int A,B,M; cin >> A>>B>>M;
    VL a(A),b(B);
    REP(i,A) cin >> a[i];

    REP(i,B) cin >> b[i];
    LL ans = *min_element(a.begin(),a.end()) + *min_element(b.begin(),b.end());

    REP(i,M){
        int x,y,c; cin >> x >> y >> c;
        x--; y--;
        chmin(ans,a[x]+b[y]-c);
    }
    cout << ans << endl;

}


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

int main(){
    int n;
    cin >> n;
    vector<int> ans(4);
    string s;
    for(int i=0; i<n; i++){
        cin >> s;
        if(s == "AC"){
            ans[0]++;
        }
        else if(s == "WA"){
            ans[1]++;
        }
        else if(s == "TLE"){
            ans[2]++;
        }
        else if(s == "RE"){
            ans[3]++;
        }
    }
    cout << "AC x "  << ans[0] << endl;
    cout << "WA x "  << ans[1] << endl;
    cout << "TLE x "  << ans[2] << endl;
    cout << "RE x "  << ans[3] << endl;
}

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

int64_t f(int64_t a, int64_t b) {
    if(a == b) {
        return a;
    }

    if(a > b) {
        std::swap(a, b);
    }

    if(b % a != 0) {
        return 2 * a * (b / a) + f(a, b % a);
    }
    else {
        return 2 * a * (b / a - 1) + a;
    }
}

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

    int64_t n, x;
    std::cin >> n >> x;

    std::cout << n + f(x, n - x) << '\n';
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
    }
    else if(a>b){
        cout<<"a > b"<<endl;
    }
    else{
        cout<<"a == b"<<endl;
    }
    
}


Measured memory_bytes: 3072
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

vector<pair<lint, int>> Pfact(lint num) {
	vector<pair<lint, int>> res;
	for (lint i = 2; i * i <= num; i++) {
		int cnt = 0;
		while (num % i == 0) {
			cnt++;
			num /= i;
		}
		if (cnt) res.emplace_back(i, cnt);
	}
	if (num != 1) res.emplace_back(make_pair(num, 1));
	return res;
}

class Combi {
private:
	vector<lint> fac, inv, finv;

	void init(int N) {
		fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;

		for (int i = 2; i < N; i++) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

public:
	Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }

	lint Cmod(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}

	lint Pmod(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * finv[n - k] % MOD;
	}
};

int main() {

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

	int N, M;
	cin >> N >> M;

	auto pfM = Pfact(M);
	
	Combi C(100030); // 30 > log2(10^9)
	lint ans = 1;
	for (const auto &elem : pfM) {

		ans *= C.Cmod(N - 1 + elem.second, N - 1);
		ans = ans >= MOD ? ans % MOD : ans;

	}

	cout << ans << "\n";

	return 0;
}

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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int &i:v) cin>>i;
  list<int> l;
  int k=0;
  for(auto i:v)
  {
    if(!k)
      l.push_back(i);
    else
      l.push_front(i);
    k^=1;
  }
  if(!k)
    for(auto i:l) cout<<i<<" ";
  else
    for(auto i=l.rbegin();i!=l.rend();i++) cout<<*i<<" ";
  
  return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > dp;
vector<int> r_sum;
int n;
const int INF = 1<<29;
int cost(int a,int b){
  int res = 0;
  int c = 0;
  while(a != 0 || b != 0){

    int ai = a%10;
    int bi = b%10;

    res += ai*bi;
    if(ai+bi+c >= 10){
      res++;
      c=1;
    }
    else {
      c = 0;
    }
    a/=10;
    b/=10;
  }
  return res;
}
void search(int range){
  if(range == n+1)return ;
  for(int i = 0;i+range <= n;i++){
    for(int j = i+1;j < i+range;j++){
      int a = r_sum[j] - r_sum[i];
      int b = r_sum[i+range] - r_sum[j];
      dp[i][i+range] = min(cost(a,b)+dp[i][j]+dp[j][i+range],dp[i][i+range]);
    }
  }
  search(range+1);
}
int main(){

  cin >> n;
  dp = vector<vector<int> >(n+1,vector<int>(n+1,INF));
  
  r_sum = vector<int>(n+1,0);
  for(int i = 1;i <= n;i++){
    int tmp;
    cin >> tmp;
    r_sum[i] = tmp;
  }
  for(int i = 0;i < n;i++)r_sum[i+1]+=r_sum[i];
  
  for(int i = 0;i < n;i++){
    dp[i][i+1] = 0; 
  }
  search(2);
  cout << dp[0][n] << endl;
  return 0;
}

Measured memory_bytes: 1800
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const ll INF = 1e18+1;

int L;

//Lを二進分解したら?
// <=1e6なので20桁以下になる

//Nを20個
//各桁1なら1とそこをつなぐ
//2から20までは2本の辺で分岐してつなぐ-> パスの数 2^iになる


//被りの数がビットの立った数Bとして


int main() {
    cin >> L;

    vector<int> table(30); table[0] = 1;
    for (int i = 0; i < 20; i++) table[i+1] = table[i] * 2;

    int r = 0; int tmp = 1;
    while (2 * tmp <= L) {
        r++;
        tmp *= 2;
    }
    int N = r+1;
    
    vector<int> u, v, d;
    int cnt = 0;

    for (int i = 0; i < N-1; i++) {
        u.push_back(i); u.push_back(i);
        v.push_back(i+1); v.push_back(i+1);
        d.push_back(0); d.push_back(table[i]);
        cnt += 2;
    }


    for (int t = N-1; t > 0; t--) {
        if (L - table[t-1] >= table[r]) {
            u.push_back(t-1);
            v.push_back(N-1);
            d.push_back(L-table[t-1]);
            cnt++;
            L -= table[t-1];
        }
    }


    cout << N << " " << cnt << endl;
    for (int i = 0; i < cnt; i++) {
        cout << u[i]+1 << " " << v[i]+1 << " " << d[i] << endl;
    }





}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, K;
	cin >> N >> K;
	vector<ll> x(N), y(N);
	REP(i, N) cin >> x[i] >> y[i];

	ll res = LLONG_MAX;
	REP(i, N){
		REP(j, N){
			REP(k, N){
				REP(l, N){
					ll x1 = x[i];
					ll x2 = x[j];
					ll y1 = y[k];
					ll y2 = y[l];
					if(x1>=x2) continue;
					if(y1>=y2) continue;
					ll tmp = 0;
					REP(m, N){
						if(x1<=x[m] && x[m]<=x2 && y1<=y[m] && y[m]<=y2) tmp++;
					}
					if(tmp>=K) res = min(res, (x2-x1)*(y2-y1));
				}
			}
		}
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>

using namespace std;
#define int long long

signed main(){
    int N,a,ans=-1;;cin>>N;
    map<int,int> mp;
    for(int i=0;i<N;++i) cin>>a,++mp[a];
    for(int i=1;i<100000;++i) ans = max(ans,mp[i-1]+mp[i]+mp[i+1]);
    cout<<ans<<endl;
}

Measured memory_bytes: 6528
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int n; cin >> n;
    vector<ll> place(n+1); //各番号の位置を示す
    fo(i, 1, n+1){
        int a; cin >> a; place[a] = i; //数aはi番目に出現する
    }

    set<int> st{0, n+1};
    ll ans = 0;
    for(int i=n; i>0; i--){
        auto iter = st.lower_bound(place[i]);
        ll r1 = *iter, r2 = *(++iter); --iter;
        ll l1 = *(--iter), l2 = *(--iter);
        //cout << l2 << " " << l1 << " " << r1 << " " << r2 << ln;
        if(r1 != n+1) ans += i * (place[i]-l1) * (r2-r1);
        if(l1 != 0) ans += i * (l1-l2) * (r1-place[i]);
        //cout << "ans:" << ans << ln;
        st.insert(place[i]);
    }
    cout << ans << ln;
}

    

Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

double dist(int x1, int y1, int x2, int y2) {
    //cout << x1 << " " << y1 << " " << x2 << " " << y2 << endl;
    int dx = x1 - x2;
    int dy = y1 - y2;
    return sqrt(dx * dx + dy * dy);
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int x[10], y[10];
    rep(i, n) cin >> x[i] >> y[i];
    vector<int> order(n);
    double ans = 0.0;
    rep(i, n) order[i] = i;
    int cnt = 0;
    do {
        rep(i, n - 1) {
            double d = dist(x[order[i]], y[order[i]], x[order[i + 1]], y[order[i + 1]]);
            ans += d;
        }
        cnt++;
        //cout << ans << " " << cnt << endl;
    }while(next_permutation(order.begin(), order.end()));
    cout << fixed << setprecision(12) << ans / cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define mex 1000005
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
		
int main(){
	fast
	int n,x,y;
	cin>>n>>x>>y;
	
	int a[mex];
	int b[mex];
	memset(b,0,sizeof(b));
	memset(a,0,sizeof(a));
	for(int i=n-1;i>=1;i--){
		if(i>=y){
			for(int j=n;j>i;j--)
			 a[abs(j-i)]+=1;
		}	
		else if(i<x){
			for(int j=x;j>i;j--)
			 a[abs(j-i)]+=1;
			for(int j=0;j<n;j++)
			 a[j+abs(x-i)]+=b[j];
		}
		else if(i==x){
			for(int j=n;j>x;j--){
				int y1=max(0,min(j-x,1+abs(j-y)));
				b[y1]+=1;
				a[y1]+=1;
			}
		}
		else{
			for(int j=n;j>i;j--){
				int y1=max(min(j-i,abs(x-i)+1+abs(j-y)),0);
				a[y1]+=1;
			}
		}
	}
	for(int i=1;i<n;i++)
	 cout<<a[i]<<endl;
			  	
	return 0;		    
}



Measured memory_bytes: 8064
L, R, d = map(int, input().split())

if L%d == 0 and R%d != 0:
  ans = (R-L)//d
elif L%d ==0:
  ans = (R-L)//d + 1
else:
  a0 = L - L%d + d
  ans = (R - a0)//d + 1
print(ans)

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

int main(){
    int ha,ma,hb,mb,k;
    cin>>ha>>ma>>hb>>mb>>k;
    int ans=60*(hb-ha)+(mb-ma)-k;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
class Main {
    public void kami() {
                Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		while(x != 0 || y != 0){
			if(x > y){
				System.out.println(y + " " + x);
				
			}else{
				System.out.println(x + " " + y);
			}
			x = sc.nextInt();
			y = sc.nextInt();
		}

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

}

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

int main(void){
  int n , d, cnt=0;
  scanf("%d %d",&n,&d);
  float x[n][d];
  float dis2;
  for(int i=0;i<n;i++){
   for(int j=0;j<d;j++){
     scanf("%f",&x[i][j]);
   }
  }

  for(int i=0;i<n;i++){
   for(int j=i+1;j<n;j++){
     dis2 = 0;
     for(int k = 0;k<d;k++){
     	dis2 = dis2 + pow((x[i][k] -x[j][k]),2);
     }
     if(sqrt(dis2) -(int)sqrt(dis2) ==0)cnt++;
   }
  }
  printf("%d",cnt);
}



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

using namespace std; 

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    string s;
    cin >> s;
    long long ans = 0, cnt = 0;
    for(int i = 0; i < s.length() - 1; i++) {
        if(s[i] == 'B' and s[i + 1] == 'C') {
            ans += cnt;
            i++;
        }
        else if(s[i] == 'A') cnt++;
        else cnt = 0;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 720
<?php
fscanf(STDIN, "%s", $S);
fscanf(STDIN, "%s", $T);
$arrS = str_split($S);
$arrT = str_split($T);
$ans = 0;
foreach ($arrS as $k => $v) {
    $ans += $arrS[$k] === $arrT[$k];
}
echo $ans;


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

int main(){
    int N;
    cin >> N;
    int count =0;
    map<string ,int> p;
    for(int i=0;i<N;i++){
        string r;
        cin >> r;
        if(auto iter = p.find(r); iter != end(p) ){
            continue;
        }else{
            count++;
            p[r]=1;
        }
    }
    cout << count <<endl;
    return 0;
}

Measured memory_bytes: 19268
fun main(args: Array<String>) {
    val (H,W) = readLine()!!.split(" ").map {it.toInt()}
    val listString = mutableListOf<String>()
    for(i in 0 until H) listString.add(readLine().toString())
    val buffer = StringBuilder()

    repeat(W+2) { 
        buffer.append("#")
     }
     println(buffer.toString())
    listString.forEach{ string ->
        println("#${string}#")
    }
    repeat(W+2) { 
        print("#")
     }
}

Measured memory_bytes: 37736
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long 
#define f(j) for(ll i=0;i<j;i++)
#define pb(i) push_back(i)
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;    
typedef vector<vector<long long> > matrix; 
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	// faster
	int n;
	cin>>n;
	int a[n],dp[n]={0};
	f(n)	cin>>a[i];
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++)
		dp[i] = min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
	cout<<dp[n-1]<<"\n";	
return 0;	
}

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

const int MAX = 510000;
const int MOD = 998244353;

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

void init_ncr() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll ncr(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res % mod;
}
int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  init_ncr();
  ll n,m,k;cin>>n>>m>>k;

  ll ans=0;
  for(ll i=0;i<=k;i++){
    ll t = m; t %= MOD;
    t *= modpow(m - 1ll, n - 1ll - i, MOD); t %= MOD;
    t *= ncr(n - 1ll, i); t %= MOD;
    ans += t; ans %= MOD;
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 15608
def renketu(base,a,b):
    if base == 1:
        b.reverse()
    max_ = max(a[-1],b[0])
    a.pop(-1)
    b[0] = max_
    a.extend(b)
    return a,b
    
s = [*input()]
if len(s) == 1:
    print(1)
    exit()
hugo = ["<", ">"]
a = [0]
b = []
base = -1
for i in range(len(s) - 1):
    if base == -1: #一番最初
        base = hugo.index(s[i])
        b = [0,1]
    elif base != hugo.index(s[i]): #符号が切り替わった時
        #前グループの処理
        a,b = renketu(base,a,b)
        #新しい処理
        b = [0,1]
        base = hugo.index(s[i])
    else: #同じ符号が続いてる時
        b.append(b[-1] + 1) 
if hugo.index(s[-1]) == base: #一番ラストの符号
    b.append(b[-1] + 1)
    a,b = renketu(base,a,b)
else:
    #前グループの処理
    a,b = renketu(base,a,b)
    #今回の処理
    if hugo.index(s[-1]) == 1:
        b = [1,0]
    else:
        b = [0,1]
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)
    
print(sum(a))
    

Measured memory_bytes: 37012
/*
                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {   if(n % 2 ==1)
        result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
return result % M;
}      
bool isPrime(int n) 
{ 
if (n <= 1) 
    return false; 
if (n <= 3) 
    return true; 
if (n % 2 == 0 || n % 3 == 0) 
    return false; 
for (int i = 5; i * i <= n; i = i + 6) 
    if (n % i == 0 || n % (i + 2) == 0) 
        return false; 
return true; 
} 
signed main()
{   jaldi
    int n,k;
    cin>>n>>k;
    int a[n],i,sum=0;
    for(i=0;i<n;i++)
    cin>>a[i];
    sort(a,a+n);
    int x=0,y=1e18;
    for(i=0;i<=n-k;i++)
    {   x=a[i+k-1]-a[i];   
        y=min(x,y);
    }
    cout<<y;
}   

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

int main(){
    using namespace std;
    long double pi = boost::math::constants::pi<long double>();
    unsigned long N, L;
    cin >> N >> L;
    vector<unsigned long> T(N);
    copy_n(istream_iterator<unsigned long>(cin), N, T.begin());
    long double x{0}, y{0};
    for(long i = 1; i < N; ++i){
        for(long j = 0; j < i; ++j){
            auto c = T[i] + T[j];
            long t = N + 2 * (j - i);
            x += t * cos(pi * c / L);
            y += t * sin(pi * c / L);
        }
    }
    unsigned long t = N * (N - 1) * (N - 2) / 6;
    x /= t;
    y /= t;
    cout << setprecision(15) << fixed << endl;
    cout << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC130C solver = new ABC130C();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC130C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int W = in.Int();
            int H = in.Int();
            int x = in.Int();
            int y = in.Int();


            StringBuilder sb = new StringBuilder();
            sb.append((long) W * H / 2.0).append(' ');
            if (x == W / 2.0 && y == H / 2.0) {
                sb.append(1);
            } else {
                sb.append(0);
            }
            out.println(sb.toString());
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23252
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		System.out.println((s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) ? "Bad" : "Good");
	}
}

Measured memory_bytes: 22612
using System;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int N = Convert.ToInt32(input[0]);
            int M = Convert.ToInt32(input[1]);
            int result = (1900 * M + 100 * (N - M)) * Convert.ToInt32(Math.Pow(2, M));

            Console.WriteLine(result);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();

		if (T.matches(S + "[a-z]")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 38624
N = gets.to_i
J = N.times.map{gets.split.map(&:to_i)}

J.sort_by!{|a| a[1]}

now = 0

J.each do |j|
    now += j[0]

    if now > j[1]
        puts "No"
        exit
    end
end

puts "Yes"

Measured memory_bytes: 22520
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define ld double
#define ll long long
#define pii pair <int, int>
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, n) for (int i = 0; i < (int)(n); ++ i)

#define PI acos(-1)
#define MOD 1000000007
#define MUL 19260817
#define EPS 1e-10
#define INF 1e9
#define LINF 1e18

template <typename T> inline void chkmin(T &x, T y) {if (y < x) x = y;}
template <typename T> inline void chkmax(T &x, T y) {if (y > x) x = y;}
template <typename T> inline T add(T x, T y) {return (x + y) % MOD;}
template <typename T> inline T mul(T x, T y) {return 1LL * x * y % MOD;}
template <typename T> inline T qp(T x, T n) {
	T ans = 1;
	do {if (n & 1) ans = mul(ans, x); x = mul(x, x);} while (n >>= 1);
	return ans;
}

#ifndef DEBUG
const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() (++ pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)
#endif

inline ll read() {
	ll x = 0; int f = 1, c = getchar();
	for (;!isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x<<3) + (x<<1) + (c^48);
	return x * f;
}

int n;
char s[100005];
int tms[26];

int main() {
	scanf("%d%s", &n, s);
	rep(i, n) tms[s[i] - 'a'] ++;
	int ans = 1;
	rep(i, 26) ans = mul(ans, tms[i] + 1);
	printf("%d\n", add(ans, MOD - 1));
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,n,m) for(int i=m;i>=n;i--)
#define rrep(i,m,n) for(register int i=m;i<=n;i++)
#define rper(i,n,m) for(register int i=m;i>=n;i--)
const int N = 3e3 + 10;
const ll mod = 1e9 + 7;

signed main(){
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   string s;
   cin>>s;
   ll num=0;
   for(auto i:s){
       num+=i-'0';
   }
   if(num%9==0)cout<<"Yes";
   else cout<<"No";
   return 0;
}

Measured memory_bytes: 3724
n = gets.to_i
for i in 1..n
x1,y1,x2,y2,x3,y3 = gets.split.map(&:to_f)
a = Math.sqrt((x1-x2)**2 +(y1-y2)**2)
b = Math.sqrt((x2-x3)**2 +(y2-y3)**2)
c = Math.sqrt((x3-x1)**2 +(y3-y1)**2)
ar = Math.acos((b**2+c**2-a**2)/(2*b*c))
r = 0.5*(a/Math.sin(ar))
x = 0.5*((x1**2 + y1**2)*(y2-y3) + (x2**2 + y2**2)*(y3-y1) + (x3**2 + y3**2)*(y1-y2) )  / (x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)) 
y = 0.5*((x1**2 + y1**2)*(x2-x3) + (x2**2 + y2**2)*(x3-x1) + (x3**2 + y3**2)*(x1-x2)  ) / (y1*(x2-x3) + y2*(x3-x1) + y3*(x1-x2))
printf("%.3f %.3f %.3f\n",x,y,r)
end

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define allsort(v) sort(v.begin(),v.end())
const ll mod = 1e9 + 7;
const int inf = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0)cout << "Zero" << endl;
	else if (a < 0 && b < 0 && (b - a) % 2 == 0)cout << "Negative" << endl;
	else cout << "Positive" << endl;
	return 0;
}

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

int main() {
  
  int a,b;
  cin >> a >> b;
  
  if ( ( a * b ) % 2 == 0 ){
    cout << "Even" << endl;
  }else{
    cout << "Odd" << endl;
  }
  
  
}



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

long long n, t;
vector<vector<long long>> sum;

long long solve();

int main() {
  cin >> n;
  sum.assign(1010, vector<long long>(1010, 0));
  for(int i = 0; i < n; ++i) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    ++sum[a][b];
    --sum[a][d];
    --sum[c][b];
    ++sum[c][d];
  }
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 1;
  for(int i = 0; i < 1001; ++i)
    for(int j = 1; j < 1001; ++j)
      sum[i][j] += sum[i][j - 1];
  for(int i = 0; i < 1001; ++i)
    for(int j = 1; j < 1001; ++j)
      sum[j][i] += sum[j - 1][i];
  for(int i = 0; i < 1001; ++i)
    for(int j = 0; j < 1001; ++j) ans = max(ans, sum[i][j]);
  return ans;
}


Measured memory_bytes: 10792
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

map<ll, ll> res;
void prime_factors(ll n) {
  for(ll i = 2; i*i <= n; ++i) {
    while(n % i == 0) {
      res[i]++; // 素数i^{res[i]}
      n /= i;
    }
  }
  if(n!=1) res[n]++;
}

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


void Main(){

  ll A,B; cin>>A>>B;


  ll kou=GCD(A,B);

  prime_factors(kou);

  cout<<  1+res.size() <<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int A, B;
  cin >> A >> B;
  if(A == B) cout << "Draw" << endl;
  else if(A == 1) cout << "Alice" << endl;
  else if(B == 1) cout << "Bob" << endl;
  else if(A > B) cout << "Alice" << endl;
  else cout << "Bob" << endl;
  return 0;
}



Measured memory_bytes: 256