akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  string S;
  cin>>S;
  ll N = S.size();
  reverse(S.begin(),S.end());
  vector<vector<ll>> dp(N,vector<ll>(13,0));
  ll cnt = 1;
  for(ll i = 0; i < N; i++){
    if(i==0){
      if(S[i]=='?') {
        for(ll j = 0; j < 10LL;j++) dp[i][j]++;
      }
      else {
        ll t = S[i]-'0';
        dp[i][t]++;
      }
    }
    else{
      if(S[i]=='?'){
        for(ll j = 0; j < 10LL; j++){
          for(ll k = 0; k < 13LL; k++){
            dp[i][(k+cnt*j)%13]=(dp[i][(k+cnt*j)%13]+dp[i-1][k])%mod;
          }
        }
      }
      else{
        ll t = S[i]-'0';
        for(ll j = 0; j < 13; j++){
          dp[i][(j+t*cnt)%13]=(dp[i][(j+t*cnt)%13]+dp[i-1][j])%mod;
        }
      }
    }
    cnt = (cnt*10LL)%13LL;
  }
  cout<<dp[N-1][5]<<endl;
}

Measured memory_bytes: 13696
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define watch(x) cout<<(#x)<<" is "<<x<<endl;
#define ll long long int
#define pb push_back
#define in insert
#define mp make_pair
#define F first
#define S second
#define N 1000000
#define MOD 1000000007
#define PI acos(-1)
int main()
{
	IOS
	ll k,x;
	cin>>k>>x;
	if(500*k>=x)
	cout<<"Yes\n";
	else
	cout<<"No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define rep(i, r) for(int i = 0; i < r; i++)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define pb push_back

int main()
{
    fastIO
    ll k, a, b;
    cin >> k >> a >> b;

    ll num1 = a / k;
    ll num2 = b / k;

    if(a % k == 0 || b % k == 0)
    {
        cout << "OK" << endl;
    }
    else{
        ll num = (num1 + 1) * k;
        if(num >= a && num <= b)
            cout << "OK" << endl;
        else
            cout << "NG" << endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
long long int jrr[100000];
long long int jump(long long int i,long long int n,long long int arr[],long long int k)
{
	if(i>n-1)
	return 999999999999999;
    if(i==n-1)
       return 0;
	else if(jrr[i]!=-1)
	return jrr[i];
	else
    {   // cout<<arr[i]<<" i"<<endl;
    long long int o=99999999999999,j;
    for(j=i+1;j<=i+k;j++)
   {  o= min(o,jump(j,n,arr,k)+abs(arr[j]-arr[i]));
   	// if(j<n)
		// {	//	dp[i]=min(dp[i],abs(arr[i]-arr[i+j])+dp[i+j]);)
  //  	o=abs(arr[j]-arr[i])+jump(j,n,arr,k);
  //  	if(o<min)
  //  	min=o;
		// }
    }
    //cout<<o<<"r";
    jrr[i]=o;
    return jrr[i];
    }
	
}

int main() {
	// your code goes here
	long long int n,k;
	cin>>n>>k;
	long long int arr[n];
	for(int i=0;i<n;i++)
	cin>>arr[i];
	memset(jrr,-1,sizeof(jrr));

	cout<<jump(0,n,arr,k);
	return 0;
}


Measured memory_bytes: 9600
//  A.cpp
//  Created on 2018-09-23 09:29

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <queue>
#include <vector>
#define f(i,st,ed) for(int i=st;i<=ed;i++)
#define fd(i,st,ed) for(int i=st;i>=ed;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
using namespace std;
inline int read(){char ch=getchar();int ret=0,f=1;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')ret=ret*10+ch-'0',ch=getchar();return ret*f;}

const int mx=205;
int n,a[mx],ans;

int main(){
	//freopen("A.in","r",stdin);
	//freopen("A.out","w",stdout);
	n=read()*2;f(i,1,n) a[i]=read();
	sort(a+1,a+1+n);
	f(i,1,n){
		ans+=a[i];
		i++;
	}
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

int w = -1;
int h = -1;

void checkMines(string mineField[50]);
int main()
{
		string input[50];
		cin >> h;
		cin >> w;
		for (int i = 0; i < h; i++)
		{
			cin >> input[i];
		}

		checkMines(input);
	return 0;
}

void checkMines(string mineField[50]) {
	string answer[50];
	for (int i = 0; i < h; i++)
	{
		answer[i] = mineField[i];
	}

	for (int currRow = 0; currRow < h; currRow++)
	{
		for (int currCol = 0; currCol < w; currCol++)
		{
			int mineCount = 0;

			//cout << "\nChecking " << currRow << ", " << currCol << endl;

			if (mineField[currRow][currCol] != '#')
			{
				int checkRow = currRow - 1;
				int checkCol = currCol - 1;

				for (int i = 0; i < 3; i++)
				{
					for (int j = 0; j < 3; j++) 
					{
						
						if (checkCol > -1 && checkCol < w && checkRow > -1 && checkRow < h) 
						{
							//cout << "\nMine search for " << checkRow << ", " << checkCol << endl;
							if (mineField[checkRow][checkCol] == '#')
							{
								mineCount++;
								//cout << "Found mine at: " << checkRow <<  ", " << checkCol << endl;
							}
						}
						checkCol++;
					}
					//cout << "\nNEXT ROW\n";
					checkCol = currCol - 1;
					checkRow++;
				}
				char digit = mineCount + 48;
				//cout << "\nAdding Answer to " << currRow << ", " << currCol << " with value of: " << digit << endl;
				answer[currRow][currCol] = digit;
			}
			else {
				//cout << "\nAdding Answer to " << currRow << ", " << currCol << " with value of: " << "#" << endl;
				answer[currRow][currCol] = '#';
			}
			
		}
	}
	for (int i = 0; i < h; i++)
	{
		cout << answer[i] << "\n";
	}
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n,a,b;
vector<pair<ll,pair<ll,ll> > > v;
ll ans1,ans2;
int main()
{
	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>a>>b;
		v.pb(mp(a+b,mp(a,b)));
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for (int i=0;i<n;i++)
		if (i%2==0) ans1+=v[i].second.first;
		else ans2+=v[i].second.second;
	cout<<ans1-ans2;
	return 0;
}

Measured memory_bytes: 4980
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def mfact():
    f = [1]
    for i in range(1, 200007):
        f.append(f[-1] * i % MOD)
    return f

def inv(x):
    res = 1
    k = MOD - 2
    y = x
    while (k):
        if(k % 2 == 1):
            res = (res * y) % MOD
        y = (y ** 2) % MOD
        k = k // 2
    return res

def comb(n, k, f):
    a = f[n]
    b = f[n-k]
    c = f[k]
    bc = (b * c) % MOD
    return (a * inv(bc)) % MOD

def solve(N: int, M: int, K: int):
    ans = 0
    for i in range(N):
        for j in range(M):
            a = j * (j+1) // 2
            b = (M-1-j) * (M-1-j+1) // 2
            ans += (a+b) * i + M * (i*(i+1)//2) + a
            ans %= MOD
    f = mfact()
    ans *= comb(N*M-2, K-2, f)
    ans %= MOD
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, M, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 11056
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

int main() {
  int a, b;
  cin >> a >> b;
  if((a*b)%2==1){
    cout << "Odd" << endl;
  }else{
    cout << "Even" << 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 trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod=1000000007;
//head

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}


Measured memory_bytes: 3656
// Created by arjun_singh12 (Arjun Singh) on [12-05-2020 03:23:44]
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define M 1000000007
#define INF LLONG_MAX
#define vll vector<ll>
#define vpl vector<pair<ll,ll>>
#define vvl vector<vector<ll>>
#define pb push_back
#define pll pair<ll,ll>
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define repr(i,n,a) for(ll i=n;i>=a;i--)
#define endl "\n"
#define db(x); cout<<"Debug: "<<#x<<" = "<<x<<endl;
#define dbv(v); cout<<"Debug: Vector "<<#v<<" = "; for(ll i=0;i<sz(v);i++) cout<<v[i]<<" "; cout<<endl;
using namespace std;

ll dp[100005][3];
ll solve(vector<vector<ll>> &v,ll n,ll prev)
{
	if(n==sz(v))
		return 0;
	if(dp[n][prev]!=-1 and prev!=-1) return dp[n][prev];
	ll ans=0;
	if(prev==0)
	{
		ll c1=v[n][1]+solve(v,n+1,1);
		ll c2=v[n][2]+solve(v,n+1,2);
		return dp[n][prev]=ans+max(c1,c2);
	}
	if(prev==1)
	{
		ll c1=v[n][0]+solve(v,n+1,0);
		ll c2=v[n][2]+solve(v,n+1,2);
		return dp[n][prev]=ans+max(c1,c2);
	}
	if(prev==2)
	{
		ll c1=v[n][1]+solve(v,n+1,1);
		ll c2=v[n][0]+solve(v,n+1,0);
		return dp[n][prev]=ans+max(c1,c2);
	}
	else
	{
		ll c0=v[n][0]+solve(v,n+1,0);
		ll c1=v[n][1]+solve(v,n+1,1);
		ll c2=v[n][2]+solve(v,n+1,2);
		return dp[n][prev]=ans+max({c0,c1,c2});
	}
}
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	ll test=1;
	// cin>>test;
	while(test--)
	{
	    ll n; cin>>n;
	    vector<vector<ll>> v(n,vector<ll>(3));
	    rep(i,0,n)
	    {
	    	cin>>v[i][0]>>v[i][1]>>v[i][2];
	    }
	    memset(dp,-1,sizeof(dp));
	    cout<<solve(v,0,-1)<<endl;
	}
}


Measured memory_bytes: 15872
#include<string>
#include <iostream>
#include<math.h>

using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))


int N, K;
int a[105][105];
string s;
int d[100000 + 1];

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

    int sum=0,mymax=0,x=0;
    while(x<=N-1) {
        sum = 0;
        for (int i = 0; i < N; i++) {
            if(i<x) sum += a[0][i];
            else if(i==x){
                sum += a[0][i] + a[1][i];
            }else{
                sum += a[1][i];
            }
        }
        mymax = max(mymax,sum);
        x++;
    }
    cout << mymax<< endl;
    return 0;
}




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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

  ll N, W;

  cin >> N >> W;

  vl w(N, 0);
  vl v(N, 0);

  FOR(i, 0, N){
    cin >> w[i] >> v[i];
  }

  vl dp(100001, oo);

  dp[0] = 0;

  FOR(i, 0, N){
    vl newDp(100001, oo);
    FOR(j, 0, 100001){
      newDp[j] = min(newDp[j], dp[j]);
      if(j >= v[i]){
        newDp[j] = min(newDp[j], dp[j-v[i]]+w[i]);
      }
    }

    FOR(j, 0, 100001){
      dp[j] = min(newDp[j], dp[j]);
    }

  }
  ll maximum = 0;
  FOR(j, 0, 100001){
    if(dp[j] <= W) maximum = j;
  }


  cout << maximum << endl;

}


Measured memory_bytes: 1904
use std::collections::HashMap;

use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let mp = min_primes(n);
    let mut result = 0;
    for c in 1..n {
        let ab = n - c;
        let primes = factorization_with_min_primes(ab, &mp);
        let num_of_divisor = primes.values().fold(1, |sum, &x| sum * (x + 1));
        result += num_of_divisor - (ab == 1) as usize;
    }
    println!("{}", result);
}

/// O(n log(log(n))) # calculate vec, which vec[i] mean min(factorization(n))
fn min_primes(size: usize) -> Vec<usize> {
    let mut sieve: Vec<_> = (0..=size).collect();
    for i in 2.. {
        if i * i > size {
            break;
        }
        for j in 2..=(size / i) {
            if sieve[i * j] == i * j {
                sieve[i * j] = i;
            }
        }
    }
    sieve
}

/// O(log(n)) # calculate prime factorization of n, with min_primes
fn factorization_with_min_primes(n: usize, min_primes: &[usize]) -> HashMap<usize, usize> {
    if n <= 1 {
        return vec![(n, 1)].into_iter().collect();
    }
    let (mut divided, mut facts) = (n, HashMap::new());
    while divided > 1 {
        *facts.entry(min_primes[divided]).or_insert(0) += 1;
        divided /= min_primes[divided];
    }
    facts
}


Measured memory_bytes: 9624
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>

using namespace std;

typedef long long ll;

int N;
vector<ll> A, B;
vector<pair<ll, ll>> PBA;
map<ll, ll> MA, MB;

bool visited[100000 + 10];

int main() {
	cin >> N;
	A.resize(N), B.resize(N), PBA.resize(N);
	for (int i = 0; i < N; i++)cin >> A[i], PBA[i].second = A[i];
	for (int i = 0; i < N; i++)cin >> B[i], PBA[i].first = B[i];

	vector<ll> cpyA = A, cpyB = B;
	sort(A.begin(), A.end()), sort(B.begin(), B.end());
	sort(PBA.begin(), PBA.end());

	for (int i = 0; i < N; i++) {
		if (B[i] < A[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	bool f = false;
	for (int i = 0; i < N; i++) {
		if (i > 1 && B[i - 1] >= A[i]) {
			f = true;
		}
	}
	if (f) {
		cout << "Yes" << endl;
		return 0;
	}

	for (int i = 0; i < N; i++) {
		MA[A[i]] = i;
		MB[B[i]] = i;
	}
	for (int i = 0; i < N; i++) {
		A[i] = MA[A[i]];
		B[i] = MB[B[i]];
	}
	for (int i = 0; i < N; i++) {
		PBA[i].first = MB[PBA[i].first];
		PBA[i].second = MA[PBA[i].second];
	}

	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (visited[i])continue;
		int start = PBA[i].second;
		do {
			visited[start] = true;
			start = PBA[start].second;
			cnt++;
		} while (start != PBA[i].second);
		cnt--;
	}
	if (cnt <= N - 2) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 17536
N, Q = gets.chomp.split(" ").map(&:to_i)
S = gets.chomp
LR = []
Q.times{
  LR << gets.chomp.split(" ").map(&:to_i)
}

AC = Array.new(N, 0)
wk = 0
(1...N).each{|i|
  wk += 1 if S[i] == 'C' && S[i-1] == 'A'
  AC[i] = wk
}

LR.each{|l, r|
  puts AC[r-1] - AC[l-1]
}


Measured memory_bytes: 11132
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main() {
	int n, m; cin >> n >> m;
	int x = 0, y = 1000000;
	rep(i, m) {
		int l, r; cin >> l >> r;
		x = max(x, l);
		y = min(y, r);
	}

	if (x <= y) {
		cout << y - x + 1 << endl;
	}
	else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
// 2017/07/26 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	bool A[101], B[101], C[101];
	for(int i=1; i<=N; i++){
		A[i] = B[i] = C[i] = false;
	}

	int X;
	cin >> X;
	for(int i=0; i<X; i++){
		int a;
		cin >> a;

		A[a] = true;
	}

	int Y;
	cin >> Y;
	for(int i=0; i<Y; i++){
		int b;
		cin >> b;

		B[b] = true;
	}

	int Z;
	cin >> Z;
	for(int i=0; i<Z; i++){
		int c;
		cin >> c;

		C[c] = true;
	}

	int cnt = 0;

	for(int i=1; i<=N; i++){
		if((!A[i] || B[i]) && C[i]){
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int v;//vは頂点
vector<vector<ll> > graph(300,vector<ll>(300));//最大値をいれる
void warshall_floyd(){
    for(int i = 0;i < v;i++){//経由する頂点
        for(int j = 0;j < v;j++){//始点
            for(int k = 0;k < v;k++){//終点
                if(graph[j][i] != pow(10,15) && graph[i][k] != pow(10,15))graph[j][k] = min(graph[j][k],graph[j][i] + graph[i][k]);
            }
        }
    }
}
int main(){
    ll e = 0;
    ll l = 0;
     cin >> v >> e >> l;
    //最大の値に初期化-pathがない
    for(int i = 0;i < v;i++){
        for(int j = 0;j < v;j++){
            graph[i][j] = pow(10,15);
        }
    }
    //移動しなくて良い場合
    for(int i = 0;i < v;i++){
        graph[i][i] = 0;
    }
    //入力
    for(int i = 0;i < e;i++){
        ll a,b,c;
        cin >> a >> b >> c;//頂点の番号を-1するかしないか注意
        a--,b--;
        graph[a][b] = c;
        graph[b][a] = c;
    }
    //ワーシャルフロイド
    warshall_floyd();
    //cout << graph[0][2] << endl;
    vector<vector<ll>> memo(v,vector<ll>(v));
    for(int i = 0;i < v;i++){
        for(int j = 0;j < v;j++){
            memo[i][j] = pow(10,15);
        }
    }
    for(int i = 0;i < v;i++){
      for(int j = 0;j < v;j++){
        if(graph[i][j] <= l)memo[i][j] = 1;
        //cout << memo[i][j] << " ";
      }
      //cout << endl;
    }
    for(int i = 0;i < v;i++){
        memo[i][i] = 0;
    }
    //引き継ぎ
    for(int i = 0;i < v;i++){
      for(int j = 0;j < v;j++){
        graph[i][j] = memo[i][j];
        //cout << graph[i][j] << " ";
      }
      //cout << endl;
    }
    //再度ワーシャルフロイド
    warshall_floyd();
    ll q = 0;
    cin >> q;
    for(int i = 0;i < q;i++){
      ll f,t;
      cin >> f >> t;
      f--,t--;
      //cout << graph[f][t] << endl;
      if(graph[f][t] >= pow(10,15))cout << -1 << endl;
      else{
        cout << graph[f][t] - 1 << endl;
        /*ll res = 0;
        res = graph[f][t] / l;
        if(graph[f][t] % l != 0)res++;
        res--;
        cout << res << endl;*/
      }
    }
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};



int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll w,h,x,y;cin >> w >> h >> x >> y;
	double ans=(double)w*h/2;
	int k=0;
	if(w%2==0 && h%2==0){
		if(w/2==x && h/2==y) k=1;
	}
	cout << ans << " " << k << endl;
}


Measured memory_bytes: 256
public class Main {
	public static void main(String args[]){
		int i = 1;
		int j = 1;
		
		for(;i<10;i++){
			for(;j<10;j++){
				System.out.println(i + "x" + j + "=" + (i*j));
			}
			j=1;
		}
	}
}

Measured memory_bytes: 24348
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
  int n;
  ll sum = 0;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  rep(i,n) sum += a[i];
  cout << a[0] << " " << a[n-1] << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3208
import sys, math
from functools import lru_cache
import datetime
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    A, B, K = mi()
    for i in range(K):
        if i%2 == 0:
            if A%2:
                A -= 1
            B += A//2
            A -= A//2
        else:
            if B%2:
                B -= 1
            A += B//2
            B -= B//2

    print(A, B)



if __name__ == '__main__':
    main()

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

using namespace std;
using Graph = vector<vector<int>>;

int main(void)
{
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    Graph G(N);

    for(int i = 0;i < N; i++) {
        cin >> H[i];
    }
    int a, b;
    for (int i = 0;i < M; i ++) {
        cin >> a >> b;
        a--;
        b--;
        if (find(G[a].begin(),G[a].end(),b) == G[a].end() && find(G[b].begin(),G[b].end(),a) == G[b].end()){
            G[a].push_back(b);
            G[b].push_back(a);
        }
    }
    /*
    for(int i = 0;i<(int)G.size();i++){
        for(int j =0;j < (int)G[i].size();j++) {
            cout << G[i][j]+1 << " ";
        }
        cout << endl;
    }
    */
    int result = 0;
    int flag = true;
    for(int i = 0;i<(int)G.size();i++){
        for(int j =0;j < (int)G[i].size();j++) {
            //cout << "i:" << i << "G[i][j]:" << G[i][j] << endl;
            if (H[i] >  H[G[i][j]]) {
                
            }
            else {
                flag = false;
            }
        }
        if(flag == true){
            result++;
        }
        flag = true;
    }
    cout << result << endl;
    return 0;

}

Measured memory_bytes: 8784
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        try {
            int N = Integer.parseInt(br.readLine());
 
            int x;
 
            for(int i = 1; i <= N; i++)
            {
                if(i%3 == 0){
                    System.out.printf(" %d",i);
                }else{
                    x = i;
                    do{
                        if(x%10 == 3){
                            System.out.printf(" %d",i);
                            break;
                        }
                        x /=10;
                    }while(x != 0);
                }
            }
            System.out.printf("\n");
 
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int INF=1001001001;

struct edge{
    int to,cap,rev;
    edge(int a,int b,int c):to(a),cap(b),rev(c){}
};

int N,E,Q;

const int MAX_V=600;
vector<edge>G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
    G[from].pb(edge(to,cap,G[to].size()));
    G[to].pb(edge(from,cap,G[from].size()-1));
}

int dfs(int v,int t,int f){
    if(v==t)return f;
    used[v]=true;
    for(int i=0;i<G[v].size();i++){
        edge &e=G[v][i];
        if(used[e.to]||e.cap==0)continue;
        int d=dfs(e.to,t,min(f,e.cap));
        if(d==0)continue;
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
    }
    return 0;
}

int max_flow(int s,int t,int lim){
    int f=0;
    while(lim){
        memset(used,0,sizeof(used));
        int ff=dfs(s,t,lim);
        if(ff==0)return f;
        f+=ff;
        lim-=ff;
    }
    return f;
}


int f;
void q1(int a,int b){
    add_edge(a,b,1);
    f+=max_flow(0,N-1,INF);
}

void q2(int a,int b){
    bool f1=false,f2=false;

    for(auto &e:G[a]){
        if(e.to!=b||e.cap==0)continue;
        if(e.cap==2)f2=true;
        e.cap=0;
    }
    for(auto &e:G[b]){
        if(e.to!=a||e.cap==0)continue;
        if(e.cap==2)f1=true;
        e.cap=0;
    }
    if(!f1&&!f2)return;

    if(f2)swap(a,b);


    int tmp=max_flow(a,b,1);

    if(tmp)return;

    add_edge(0,N-1,1);
    tmp=max_flow(a,b,1);
    assert(tmp);
    G[0].pop_back();
    G[N-1].pop_back();
    f--;

    f+=max_flow(0,N-1,INF);
}

signed main(){

    cin>>N>>E>>Q;
    rep(i,E){
        int a,b;
        cin>>a>>b;
        a--;b--;
        add_edge(a,b,1);
    }

    f=max_flow(0,N-1,INF);


    while(Q--){
        int t,a,b;
        cin>>t>>a>>b;
        a--;b--;
        if(t==1){
            q1(a,b);
        }
        else{
            q2(a,b);
        }
        /*
        cout<<f<<"-------------"<<endl;
        for(int i=0;i<N;i++){
            for(auto &e:G[i]){
                cout<<i+1<<" "<<e.to+1<<" "<<e.cap<<endl;
            }
        }*/
        printf("%lld\n",f);

    }
    return 0;
}

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

typedef long long ll;
const ll INF = 1e17;




int main() {
	
	ll N;
	cin >> N;

	cout << N * (N - 1) / 2;


	system("PAUSE");
}


Measured memory_bytes: 504
import numpy as np
import sys
read = sys.stdin.read

if sys.argv[-1] == 'ONLINE_JUDGE':
	from numba.pycc import CC
	cc = CC('unko')

	@cc.export('solve', '(i4[:],)')
	def solve(stdin):
		h, w, m = stdin[:3]

		row = np.zeros(h, np.int32)
		col = np.zeros(w, np.int32)
		for i in range(3, m * 2 + 3, 2):
			y, x = stdin[i: i + 2] - 1
			row[y] += 1
			col[x] += 1

		max_cnt_y = max(row)
		max_cnt_x = max(col)
		max_pair = np.sum(row == max_cnt_y) * np.sum(col == max_cnt_x)
		for i in range(3, m * 2 + 3, 2):
			y, x = stdin[i: i + 2] - 1
			if row[y] == max_cnt_y and col[x] == max_cnt_x:
				max_pair -= 1

		return max_cnt_y + max_cnt_x - (max_pair == 0)
	
	cc.compile()
	exit()

from unko import solve
print(solve(np.fromstring(read(), dtype=np.int32, sep=' ')))

Measured memory_bytes: 34652
a = []
a.append([int(i) for i in input().split()])
a.append([int(i) for i in input().split()])
a.append([int(i) for i in input().split()])
    
tf = [[False for i in range(3)] for j in range(3)]
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                tf[j][k] = True

bingo = 0
for i in range(3):
    if tf[i] == [True, True, True]:
        bingo += 1

for i in range(3):
    if tf[0][i] == True and tf[1][i] == True and tf[2][i] == True:
        bingo += 1

if tf[0][0] == True and tf[1][1] == True and tf[2][2] == True:
    bingo += 1
    
if tf[0][2] == True and tf[1][1] == True and tf[2][0] == True:
    bingo += 1

if bingo:
    print('Yes')
else:
    print('No')

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

int main(){
  string s,t;
  cin >>s>>t;
  bool ans=false;
  for(int i=0;i<s.size();i++){
    if(s==t){
      ans=true;
      break;
    }
    //s.back()はsの一番後ろを表す。substr(開始位置(添字),取り出す長さ)
    s=s.back()+s.substr(0,s.size()-1);
  }
  if(ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
ks= list(map(int, input().split())) 
 
count = 0
 
x = 0
y = 0
z = 0
 
for targetX in range(ks[0]+1):
    
    
    if targetX <= ks[0] and ks[1]-(targetX+ks[0]+ks[0]) <= 0:
    
        for targetY in range(ks[0]+1):
            
            z = ks[1] - (targetX + targetY)
            
            if 0 <= z and z <= ks[0]:
                count += 1
                
        
        
        
 
print(count)

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

using namespace std;

#define bug(x) cerr << #x << " = " << x << '\n'
#define ll     long long
#define x      first
#define y      second
#define eb     emplace_back
#define maxn
#define mod    1000000007

int main() {
        #ifndef ONLINE_JUDGE
            //freopen(".inp","r",stdin);
        #endif // ONLINE_JUDGE

//        ios_base::sync_with_stdio(0);
//        cin.tie(0); cout.tie(0);

        string s;
        cin >> s;

        int sum = 0;
        for(int i = 0; s[i]; ++ i)
            sum = (sum + s[i] - '0') % 9;
        cout << ((sum) ? "No" : "Yes");
}





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


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b=s.nextInt();
        if(a<=b){
            while(b--!=0) System.out.print(a);
        }
        else {
            while(a--!=0) System.out.print(b);
        }
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}

Measured memory_bytes: 25308
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 100; j++){
            if(4*i+7*j == n){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 3616
#define _GLIBCXX_DEBUG
#include"bits/stdc++.h"

using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back

template <class Container, class Exp> int countif_all(Container c, Exp exp) { return count_if(ALL(c), exp); }
template <class Container, class Exp> void tf_all(Container &c, Exp exp) { transform(ALL(c), c.begin(), exp); }

//pair
#define fir first
#define sec second

//types
#define ll long long
#define vec vector
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T>
T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()
template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T = int>
void print(vec<T> v){ for (T item: v) { cout << item << " "; } cout << endl; }

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"Yes":"N1010o"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__
#define next next__
#define prev prev__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//variables
int n;
string s,str;
vec<int> nums;

void Main() {
    //code here
    n = gi;
    nums = gim(n);
    int count = 0;
    while (countif_all(nums, isOdd) == 0 ) {
        tf_all(nums, lamb(i/2));
        count += 1;
    }
    print(count);
}

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

Measured memory_bytes: 256
N = int(input())
P = list(map(int,input().split()))

from collections import Counter
ctr = Counter()
seq = 0
for i,p in enumerate(P):
    if i+1==p:
        seq += 1
    else:
        ctr[seq] += 1
        seq = 0
ctr[seq] += 1
ans = 0
for k,v in ctr.items():
    ans += (k+1)//2 * v
print(ans)

Measured memory_bytes: 14008
# -*- coding: utf-8 -*-

import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for k in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353

class SegTree:
    """
    セグメント木
    1.update:  i番目の値をxに更新する
    2.query: 区間[l, r)の値を得る
    """

    def __init__(self, n, func, intv, A=[]):
        """
        :param n: 要素数(0-indexed)
        :param func: 値の操作に使う関数(min, max, add, gcdなど)
        :param intv: 要素の初期値(単位元)
        :param A: 初期化に使うリスト(オプション)
        """
        self.n = n
        self.func = func
        self.intv = intv
        # nより大きい2の冪数
        n2 = 1
        while n2 < n:
            n2 <<= 1
        self.n2 = n2
        self.tree = [self.intv] * (n2 << 1)
        # 初期化の値が決まっている場合
        if A:
            # 1段目(最下段)の初期化
            for i in range(n):
                self.tree[n2+i] = A[i]
            # 2段目以降の初期化
            for i in range(n2-1, -1, -1):
                self.tree[i] = self.func(self.tree[i*2], self.tree[i*2+1])

    def update(self, i, x):
        """
        i番目の値をxに更新
        :param i: index(0-indexed)
        :param x: update value
        """
        i += self.n2
        self.tree[i] = x
        while i > 0:
            i >>= 1
            self.tree[i] = self.func(self.tree[i*2], self.tree[i*2+1])

    def query(self, a, b):
        """
        [a, b)の値を得る
        :param a: index(0-indexed)
        :param b: index(0-indexed)
        """
        l = a + self.n2
        r = b + self.n2
        s = self.intv
        while l < r:
            if r & 1:
                r -= 1
                s = self.func(s, self.tree[r])
            if l & 1:
                s = self.func(s, self.tree[l])
                l += 1
            l >>= 1
            r >>= 1
        return s

    def get(self, i):
        """ 一点取得 """
        return self.tree[i+self.n2]

    def all(self):
        """ 全区間[0, n)の取得 """
        return self.tree[1]

N, M = MAP()
LRC = []
for i in range(M):
    l, r, c = MAP()
    l -= 1
    r -= 1
    LRC.append((l, r, c))

LRC.sort()
st = SegTree(N, min, INF)
st.update(0, 0)
for l, r, c in LRC:
    mn = st.query(l, r)
    if mn+c < st.get(r):
        st.update(r, mn+c)

ans = st.get(N-1)
if ans != INF:
    print(st.get(N-1))
else:
    print(-1)


Measured memory_bytes: 78940
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::string s;
    std::cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) {
        if ((i % 2 && s[i] == 'R') || (i % 2 == 0 && s[i] == 'L')) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;

    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    d = defaultdict(int)
    for aa in a:
        d[aa] += 1

    ans = 0
    for dd in d:
        if dd < d[dd]:
            ans += d[dd] - dd
        elif dd > d[dd]:
            ans += d[dd]

    print(ans)


Measured memory_bytes: 18676
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<usize>();
    let mut c=0;
    for _ in 0..n{
        let a=read::<usize>();
        c+=a%2;
    }
    println!("{}",if c%2==1{"NO"}else{"YES"})
}


Measured memory_bytes: 4476
#include<iostream>
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;

int main(){
	string s,t,u;
	cin>>s;
	s.erase(s.size()-2,s.size());
	while(s.size()>=2){
		int x=s.size()/2;
		t=s.substr(0,x);
		u=s.substr(x);
		if(t==u)break;
		s.erase(s.size()-2,2);
	}
	cout<<s.size()<<endl;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

//===

// const ll mod = static_cast<int>(1e9 + 7);


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

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

	int num_cond = 1;
	for (int i = 0; i < N; ++i) {
		num_cond *= 4;
	}

	int ans = 2002002002;

	for (int i = 0; i < num_cond; ++i) {
		int i_tmp = i;
		int mp = -30;
		int a = 0, b = 0, c = 0;
		for (int j = 0; j < N; ++j) {
			int r = i_tmp % 4;
			if (r == 1) {
				a += l[j];
				mp += 10;
			}
			else if (r == 2) {
				b += l[j];
				mp += 10;
			}
			else if (r == 3) {
				c += l[j];
				mp += 10;
			}
			i_tmp /= 4;
		}
		mp += abs(a - A) + abs(b - B) + abs(c - C);
		if (a != 0 && b != 0 && c != 0) {
			ans = min(ans, mp);
		}
	}

	cout << ans << endl;
 }

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>


int main()
{
	char a[11], b[11], c[11];
	int i, l1=0, l2=0, l3=0;
	scanf("%s%s%s", a, b, c);
	i=0;
	l1=strlen(a);
	l2=strlen(b);
	l3=strlen(c);
	
	if(a[l1-1]==b[0] && b[l2-1]== c[0]) printf("YES\n");
	else printf("NO\n");
	
	
	return 0;
}
	

	
			
	
	
	
	
	
	

Measured memory_bytes: 128
N, Ma, Mb = map(int,input().split())
a=[0]*N
b=[0]*N
c=[0]*N
for i in range(N):
    a[i], b[i], c[i] = map(int,input().split())

dp = [[[4001 for i in range(411)] for j in range(411)] for l in range(N+1)]

dp[0][0][0] = 0

for i in range(1,N+1):
    for j in range(400):
        for k in range(400):
            if dp[i-1][j][k] == 4001:
                continue
            dp[i][j+a[i-1]][k+b[i-1]] = min(dp[i-1][j][k] + c[i-1],dp[i-1][j+a[i-1]][k+b[i-1]])
            dp[i][j][k] = min(dp[i - 1][j][k], dp[i][j][k])
s = min(400//Ma,400//Mb)

min = 4001
for i in range(1,s+1):
    x = dp[N][i*Ma][i*Mb]
    if x>0 and min > x:
        min = x

if min != 4001:
    print(min)
else:
    print(-1)


Measured memory_bytes: 68892
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
       mut A: i32,
       mut B:i32 ,
        mut C: i32,
        K: i32,
    }

    let mut cnt = 0;
    // A < B < Cにしたい
    while !(A < B) {
        B *= 2;
        cnt += 1;
    }

    while !(B < C) {
        C *= 2;
        cnt += 1;
    }

    if cnt <= K {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll a[3];
    rep(0,i,3)cin>>a[i];
    if((a[0]==a[1] && a[1]!=a[2]) ||(a[0]==a[2] &&a[1]!=a[2])||(a[0]!=a[1]&&a[1]==a[2])){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}



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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/06/16  Problem: ABC 130 F / Link: http://abc130.contest.atcoder.jp/tasks/abc130_f  ----- */


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

	LL N; cin >> N;
	using tp = tuple<LL, LL, char>;
	vector<tp>p(N);
	FOR(i, 0, N) {
		LL x, y; cin >> x >> y;
		char d; cin >> d;
		p[i] = tp(x, y, d);
	}

	auto f = [&](double t) {
		double xmn = LINF, xmx = -LINF;
		double ymn = LINF, ymx = -LINF;
		FOR(i, 0, N) {
			LL x, y;
			char d;
			tie(x, y, d) = p[i];
			if (d == 'L' || d == 'R') {
				double dx;
				if (d == 'L')dx = x - t;
				else dx = x + t;
				ymn = min(ymn, (double)y);
				ymx = max(ymx, (double)y);
				xmn = min(xmn, dx);
				xmx = max(xmx, dx);
			}
			else {
				double dy;
				if (d == 'D')dy = y - t;
				else dy = y + t;
				xmn = min(xmn, (double)x);
				xmx = max(xmx, (double)x);
				ymn = min(ymn, dy);
				ymx = max(ymx, dy);

			}
		}
		return (xmx-xmn)*(ymx-ymn);

	};
	double L = 0, R = 1e9;
	FOR(i, 0, 200) {
		double mid1 = (2 * L + R) / 3;
		double mid2 = (L + 2 * R) / 3;
		double s1 = f(mid1);
		double s2 = f(mid2);
		if (s1 < s2) {
			R = mid2;
		}
		else {
			L = mid1;
		}
	}
	cout << fixed << setprecision(10) << f(L) << endl;

	//using tp = tuple<LL, bool>;
	//vector<tp>yoko, tate;
	//LL Wmn = LINF, Wmx = -LINF;
	//LL Hmn = LINF, Hmx = -LINF;
	//FOR(i, 0, N) {
	//	LL x, y; cin >> x >> y;
	//	char d; cin >> d;
	//	if (d == 'R' || d == 'L') {
	//		Hmn = min(Hmn, y);
	//		Hmx = max(Hmx, y);
	//		yoko.push_back(tp(x, d == 'R'));
	//	}
	//	else {
	//		Wmn = min(Wmn, x);
	//		Wmx = max(Wmx, x);
	//		tate.push_back(tp(y, d == 'U'));
	//	}
	//}

	//auto f = [](const vector<tp>&a, LL mn, LL mx) {
	//	// [mn,mx]に入ればOK
	//	for (auto it : a) {
	//		LL p; bool up;
	//		tie(p, up) = it;
	//		if (up) {
	//			if (mx < p)mx = p;
	//		}
	//		else {
	//			if (p < mn)mn = p;
	//		}
	//	}
	//	return mx - mn;
	//};
	//LL ans = f(yoko, Wmn, Wmx)*f(tate, Hmn, Hmx);


	//cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 2560
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break

    count = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i + k + j == x:
                    count += 1
    print(count)



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

int main() {
  string s, t;
  int ans = 1;
  cin >> s >> t;
  
  for(int i = 0; i < s.size(); i++){
	  if(s.at(i) != t.at(i)){
		  ans = 0;
		  break;
	  }
  }
  if(ans == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
  int N;
  cin >> N;
  int h[105];
  rep(i, N) cin >> h[i];
  int ans = h[0];
  rep(i, N - 1) if (h[i + 1] - h[i] > 0)
      ans += h[i + 1] - h[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N, K = list(map(int, input().split()))
prob = 0
for n in range(1, N+1):
  #print(n)
  #print("hogehoge")
  if(K <= n):
   prob = prob + 1
   continue
  else:
   #print(bin(n))
   #print(bin(K))
   len_bin_n = len(str(bin(n)))
   len_bin_k = len(str(bin(K)))
   min_rest_number_of_front = len_bin_k - len_bin_n
   if(K <= n * pow(2, min_rest_number_of_front)):
    prob = prob + 1/pow(2,min_rest_number_of_front)
    #print(1/pow(2,min_rest_number_of_front))
   else:
    prob = prob + 1/pow(2,min_rest_number_of_front+1)
    #print(1/pow(2,min_rest_number_of_front+1))
 
result = (1/N) * prob
print(result)

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

using namespace std ;

const int MAX = 1e6 + 10 ;

int arr[MAX] , Plus[MAX] , Minus[MAX] ;
int n ;

bool cmp(int &i , int &j)
{
	if(Minus[i] == 0 && Minus[j] == 0)
		return Plus[i] > Plus[j] ;
	else if(Minus[i] == 0 || Minus[j] == 0)
		return Minus[i] < Minus[j] ;
	else
	{
		if(Plus[i] - Minus[i] > 0 && Plus[j] - Minus[j] > 0)
			return Minus[i] < Minus[j] ;
		else if(Plus[i] - Minus[i] > 0 || Plus[j] - Minus[j] > 0)
			return Plus[i] - Minus[i] > Plus[j] - Minus[j] ;
		else
		{
			if(Plus[i] > 0 && Plus[j] > 0)
				return Plus[i] - Minus[i] > Plus[j] - Minus[j] ;
			else if(Plus[i] > 0 || Plus[j] > 0)
				return Plus[i] > Plus[j] ;
			else
				Minus[i] < Minus[j] ;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	string s ;
	vector<int>perm ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>s ;
		int cnt = 0 ;
		for(auto &c : s)
		{
			if(c == '(')
				cnt++ ;
			else
			{
				if(cnt == 0)
					Minus[i]++ ;
				cnt-- ;
				cnt = max(cnt , 0) ;
			}
		}
		Plus[i] = cnt ;
		perm.push_back(i) ;
	}
	sort(perm.begin() , perm.end() , cmp) ;
	int cnt = 0 ;
	for(auto &i : perm)
	{
		cnt -= Minus[i] ;
		if(cnt < 0)
			return cout<<"No\n" , 0 ;
		cnt += Plus[i] ;
	}
	if(cnt == 0)
		cout<<"Yes\n" ;
	else
		cout<<"No\n" ;
	return 0 ;
}		

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

int main(void){
    int n,l,i,j,pietaste = 0,absmin = 100000,ate;
    scanf("%d%d",&n,&l);
    for(i=1;i<=n;i++){
        pietaste += l+i-1;
        if(abs(l + i -1) < absmin){
            absmin = abs(l+i-1);
            ate =l+i-1;
        }
    }

    printf("%d",pietaste - ate);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arrS = new int[n];
		int[] arrT = new int[n];
		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int i = 0; i < n; i++) {
		    arrS[i] = sc.nextInt();
		    map.put(arrS[i], null);
		    arrT[i] = sc.nextInt();
		    map.put(arrT[i], null);
		}
		int idx = 1;
		for (int x : map.keySet()) {
		    map.put(x, idx);
		    idx++;
		}
		int[] imos = new int[idx + 1];
		for (int i = 0; i < n; i++) {
		    imos[map.get(arrS[i])]++;
		    imos[map.get(arrT[i]) + 1]--;
		}
		int max = 0;
		for (int i = 1; i < idx; i++) {
		    imos[i] += imos[i - 1];
		    max = Math.max(max, imos[i]);
		}
		System.out.println(max);
	}
}



Measured memory_bytes: 115200