akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,k,park[15][2],time[200],head,last,eee,lot,tim,ttt;
int n,m;

int main(){
	while(scanf("%d %d",&m,&n)*m*n){
		head=1;last=0;eee=0;
		while(eee<n){
			if(ttt%10==0 && last<n){
				last++;
				scanf("%d",&time[last]);
			}

			ttt++;
			time[0]=999;

			for(i=0;i<m;i++){
				time[park[i][0]]--;
				time[park[i][1]]--;
			}

			for(i=0;i<m;i++){
				if(time[park[i][0]]<1){
					printf("%d",park[i][0]);
					eee++;
					if(eee<n)printf(" "); else printf("\n"); 
					park[i][0]=park[i][1];
					park[i][1]=0;
					i--;
				}
			}

			while(head<=last){
				lot=-1;tim=999999999;
				for(i=0;i<m;i++){
					if(park[i][1]>0)continue;
					if(park[i][0]==0){lot=i;break;}
					else if(time[head]<=time[park[i][0]]){
						if(tim>(time[park[i][0]]-time[head])){
							tim=(time[park[i][0]]-time[head]);
							lot=i;
						}
					}
					else if(tim>(time[head]-time[park[i][0]])*1000){
						tim=(time[head]-time[park[i][0]])*1000;
						lot=i;
					}
				}
				if(lot>-1){
					if(park[lot][0]>0)park[lot][1]=park[lot][0];
					park[lot][0]=head;
					head++;
				}
				else break;
			}
		}
	}
	return 0;
}

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

using namespace std;

static const int kModulo = 1000 * 1000 * 1000 + 7;

template<class T, class Number>
T pow(T value, Number exp) {
    if (exp == 1)
        return std::move(value);
    if (exp % 2)
        return pow(value, exp - 1) * value;
    T half = pow(value, exp / 2);
    return half * half;
}

class Matrix {
  public:
    Matrix(int rows, int cols):
        m_data(rows, vector<int>(cols, 0)) {}

    int rows() const {
        return m_data.size();
    }

    int cols() const {
        return m_data[0].size();
    }

    vector<int>& operator[](int index) {
        return m_data[index];
    }

    Matrix operator*(const Matrix& that) const {
        Matrix result(rows(), that.cols());
        for (int i = 0; i < rows(); ++i)
            for (int j = 0; j < cols(); ++j)
                for (int k = 0; k < that.cols(); ++k)
                    result[i][k] = (result[i][k] + 1LL * m_data[i][j] * that.m_data[j][k]) % kModulo;
        return result;
    }

  private:
    vector< vector<int> > m_data;
};

int main() {
    ios::sync_with_stdio(false);

    int N; int64_t K; cin >> N >> K;
    Matrix M(N, N);

    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            cin >> M[i][j];

    auto paths = pow(M, K);
    int answer = 0;
    for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j)
            answer = (answer + paths[i][j]) % kModulo;
    cout << answer << "\n";
}


Measured memory_bytes: 1664
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] P = new int[N];
		for (int i = 0; i < N; i++) {
			P[i] = sc.nextInt();
		}
		sc.close();

		int min = 1_000_000_000;
		int ans = 0;
		for (int i = 0; i < N; i++) {
			min = Math.min(P[i], min);
			if (min >= P[i]) {
				ans++;
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 78704
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0;

int main (){
    ll n;   cin >> n;
    vector<int>a(n);
    rep(i,n)    cin >> a.at(i);

    if(n == 1){
        cout << "Yes" << endl;
        return 0;
    }

    for(int i=n-1;i>0;i--){
        if(a.at(i) >= a.at(i-1))continue;
         if(a.at(i) == a.at(i-1)-1 && i-1>=0){
            a.at(i-1)--;
        }else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S;
const ll MOD = (1e+9) + 7;
const ll INF = 1000;//1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N;
    vec a(N);
    rep(i,N) cin>>a[i];
    ll ans = 0, temp = 0, pm = 1;
    temp = a[0];
    //初めが正のパターン
    if(temp <= 0) {
        ans += 1 - temp;
        temp = 1;
    }
    reps(i,1,N){
        pm *= -1;
        temp += a[i];
        //cout<<i<<' '<<pm<<' '<<temp<<endl;
        if((pm == 1) && (temp <= 0)){
            ans += 1 - temp;
            temp = 1;
        }else if((pm == -1) && (temp >= 0)){
            ans += 1 + temp;
            temp = -1;
        }
        //cout<<i<<' '<<ans<<endl;
    }
    ll ans2 = 0;
    temp = a[0];
    //初めが負のパターン
    if(temp >= 0){
        ans2 += 1 + temp;
        temp = -1;
    }
    pm = -1;
    reps(i,1,N){
        pm *= -1;
        temp += a[i];
        if((pm == 1) && (temp <= 0)){
            ans2 += 1 - temp;
            temp = 1;
        }else if((pm == -1) && (temp >= 0)){
            ans2 += 1 + temp;
            temp = -1;
        }
    }
    cout<<min(ans,ans2)<<endl;
    //cout<<ans<<' '<<ans2<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
ll a, b, c, n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t;
vll dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};
string alphabet = "abcdefghijklmnopqrstuvwxyz";

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n){
        map<char, ll> dic[n];
        rep(i, n){
            cin >> s;
            each(c, s){
                dic[i][c]++;
            }
        }
        each(c, alphabet){
            cnt = INF;
            rep(i, n){
                mins(cnt, dic[i][c]);
            }
            rep(i, cnt){
                out(c);
            }
        }
        indent();
    }
}


Measured memory_bytes: 384
n = int(input())
ab = []
for i in range(n):
	a, b = map(int, input().split())
	ab.append((a, b))

ans = 0
for i in range(n)[::-1]:
	a, b = ab[i][0]+ans, ab[i][1]
	if a%b != 0:
		ans += ((a//b + 1)*b - a)

print(ans)


Measured memory_bytes: 16676
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    for(auto& x: a) cin >> x;

    bool dp[K+1];
    dp[0] = false;
    for(int i=1; i<=K; i++){
        dp[i] = false;
        for(int j=0; j<N; j++){
            if(i<a[j]) continue;
            dp[i] |= !dp[i-a[j]];
        }
    }

    if(dp[K]) cout << "First\n";
    else cout << "Second\n";
}

Measured memory_bytes: 384
N = int(input())
#N = 20

ret = [0 for i in range(N)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            a = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if a <= N:
                ret[a-1] += 1

for i in ret:
    print(i)


Measured memory_bytes: 9200
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc075_a.cpp
 * time   : Wed Apr 29 15:52:58 2020
 * quest  : A - One out of Three
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a ^ b ^ c) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in();
    vector<int> a(N);
    REP(i,N)a[i] = in();
    vector<ll> sum(N+1);
    sum[0] = 0;
    REP(i,N)sum[i+1] = sum[i] + a[i];
    ll answer = 1000000000000;
    REP(i,N-1){
        if(answer > abs(sum[N] - 2 * sum[i+1])){
            answer = abs(sum[N] - 2 * sum[i+1]);
        }
    }
    cout << answer << "\n";
}

Measured memory_bytes: 2560
#define fast ios::sync_with_stdio(false); cin.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll MOD;
const int sz = 2e5;
void mult(ll &a, ll b) {
	a = ((a % MOD) * (b % MOD)) % MOD;
}
void add(ll &a, ll b) {
	a = ((a % MOD) + (b % MOD)) % MOD;
}
ll n, x, found[sz], dp[sz];

int main() {
	fast;
	cin >> n >> x >> MOD;
	ll crsm = 0;
	foru(i, 0, n) {
		if (found[x]) {
			ll len = (ll)i - found[x], fit = (n - i) / len, segSum = dp[i - 1] - (found[x] ? dp[found[x] - 1] : 0);
			crsm += fit * segSum;
			ll rem = (n - i) % len;
			if (rem) {
				if (found[x]) {
					crsm += dp[found[x] + rem - 1] - dp[found[x] - 1];
				}
				else {
					crsm += dp[found[x]+rem - 1];
				}
			}
			break;
		}
		found[x] = i;
		crsm += x;
		dp[i] = crsm;
		mult(x, x);
	}
	cout << crsm << endl;
	return 0;
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    string s, t;
    cin >> s >> t;
    li res = INF;
    rep(i, sz(s) - sz(t) + 1) {
        string ss = s.substr(i, sz(t));
        li tres = 0;
        rep(j, sz(t)) {
            if (ss[j] != t[j])tres++;
        }
        res = min(res, tres);
    }
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define PI 3.14159265358979

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

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int bcnt[30][4];

int main(void){
	int n,i,j,k;
	ll a[225816],b[225816],*l,*r,m,ans=0ll,tmp;
	bool d[33];
	fill(d,d+33,false);
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
	}
	for(i=0; i<n; ++i){
		cin >> b[i];
	}
	for(k=30; k>=0; --k){
		tmp = 0ll;
		m = (1ll<<k);
		for(i=0; i<n; ++i){
			a[i] %= (m*2);
			b[i] %= (m*2);
		}
		sort(b,b+n);
		for(i=0; i<n; ++i){
			l = lower_bound(b,b+n,m-a[i]);
			r = lower_bound(b,b+n,2*m-a[i]);
			tmp += (ll)(r-l);
			l = lower_bound(b,b+n,3*m-a[i]);
			r = lower_bound(b,b+n,4*m-a[i]);
			tmp += (ll)(r-l);
		}
		if(tmp%2){
			d[k] = true;
		}
	}
	for(i=0; i<30; ++i){
		if(d[i]){
			ans += (1ll<<i);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3584
def main():
    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n

        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]

        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)

            if x == y:
                return

            if self.parents[x] > self.parents[y]:
                x, y = y, x

            self.parents[x] += self.parents[y]
            self.parents[y] = x

        def size(self, x):
            return -self.parents[self.find(x)]

        def same(self, x, y):
            return self.find(x) == self.find(y)

        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]

        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]

        def group_count(self):
            return len(self.roots())

        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}

    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    n,m,k = map(int,input().split())
    uff = UnionFind(n)
    fr = [0]*n

    for i in range(m):
        a,b = map(int,input().split())
        uff.union(a-1,b-1)
        fr[a-1]+=1
        fr[b-1]+=1


    ans = [uff.size(i) -fr[i]-1 for i in range(n)]

    for i in range(k):
        c,d = map(int,input().split())
        if uff.same(c-1,d-1):
            ans[c-1] -=1
            ans[d-1] -=1
    print(*ans)
if __name__=="__main__":
    main()


Measured memory_bytes: 80360
#include<bits/stdc++.h>
using namespace std;
int main(){
  long ans=0;
  int n;cin >> n;
  vector<long> p(n+1,-1);
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    p[a]=i;
  }
  set<long> st;
  st.insert(-1);
  st.insert(-2);
  st.insert(n);
  st.insert(n+1);
  for(int i=n;i>0;i--){
    auto right1 = st.lower_bound(p[i]);
    auto right2 = right1;
    right2++;
    auto left1 = right1;
    left1--;
    auto left2 = left1;
    left2--;
    if(*right2<n+1){
      ans += (*right2 - *right1) * (p[i] - *left1) * i;
    }
    if(*left2>-2){
      ans += (*left1 - *left2) * (*right1 - p[i]) * i;
    }
    st.insert(p[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5760
const main = (arg) => {
  const lines = arg.trim().split('\n');
  const S = lines[0].split('');
  let ans = 0;
  S.forEach((c) => {
    ans += c === '+' ? 1 : -1;
  });
  console.log(ans);
};
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29620
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M, K; cin >> N >> M >> K;
    rep(i, N+1) rep(j, M+1){
        ll now = i*M + j*N - 2*i*j;
        if(now == K){
            cout << "Yes" << endstr; return 0;
        }
    }
    cout << "No" << endstr;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, A, B;

int main(void) {
  cin >> N >> A >> B;
  cout << min(A * N, B) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define A 0
#define B 1
int main(void){
	int i,a,b;
	int mode;
	char str[210];
	char ans[105];
	while(scanf("%s",str) != EOF){
		mode = A;
		for(i = 0; str[i] != 0; i++){
			if(str[i] < '1' || '6' < str[i]){
				mode = B;
				break;
			}
			if(mode == A){
				a = str[i] - '0';
				mode = B;
			}else{
				if(str[i] == '6'){
					break;
				}
				b = str[i] - '0';
				switch(a){
					case 1:
						ans[i/2] = 'a' + b - 1;
						break;
					case 2:
						ans[i/2] = 'f' + b - 1;
						break;
					case 3:
						ans[i/2] = 'k' + b - 1;
						break;
					case 4:
						ans[i/2] = 'p' + b - 1;
						break;
					case 5:
						ans[i/2] = 'u' + b - 1;
						break;
					case 6:
						ans[i/2] = b == 1 ? 'z' :
							b == 2 ? '.' :
							b == 3 ? '?' :
							b == 4 ? '!' :
							' ';
						break;
				}
				mode = A;
			}
			
		}
		ans[i/2] = 0;
		if(mode == B){
			puts("NA");
		}else{
			puts(ans);
		}
	}
	return 0;
}

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

using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);

void solve(long long N, long long A, long long B)
{
  lli tmp = (N / (A + B)) * A;
  tmp += min(N % (A + B), A);
  cout << tmp << endl;
}

int main()
{
  long long N;
  scanf("%lld", &N);
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  solve(N, A, B);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int A,B,C;
  cin >> A >> B >> C;
  int D;
  D = B/A;
  if (C > D) {
    cout << D << endl;
  }
  else if (C <= D){
    cout << C << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    
    ll L,R,d;
    cin >> L >> R >> d;
    ll Ans = (R/d);
    Ans-=(L-1)/d;
    cout << Ans << endl;
    
    return 0;
}



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

int main(){
  int N;
  cin >> N;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    A[i]=a;
    B[i]=a;
  }
  sort(B.begin(),B.end());
  
  for(int i=0;i<N;i++){
    if(A[i]==B[N-1]){
      cout << B[N-2] << endl;
    }
    else{
      cout << B[N-1] << endl;
    }
  }
}

Measured memory_bytes: 3200
def upper_bound(arr, v)
  l = -1
  r = arr.size
  while l + 1 < r
    m = (l + r) / 2
    if arr[m] <= v then l = m
    else r = m
    end
  end
  r
end

EPS = 1e-9
n, m, l = gets.split.map(&:to_i)
p, t, v = n.times.map{ gets.split.map(&:to_i) }.transpose
@combination = (0..m).map{ [0] * (m + 1) }
(0..m).each{ |i| @combination[i][0] = @combination[i][i] = 1 }
(2..m).each do |i|
  (1..m).each do |j|
    @combination[i][j] = @combination[i-1][j] + @combination[i-1][j-1]
  end
end

time_set = n.times.map{ [0] * (m + 1) }
prob_set = n.times.map{ [0] * (m + 1) }
n.times do |i|
  s = v[i] == 0 ? Float::INFINITY : l / v[i].to_f
  (m + 1).times do |j|
    time_set[i][j] = s + t[i] * j
    prob_set[i][j] = (p[i] / 100.0) ** j * (1 - p[i] / 100.0) ** (m - j) * @combination[m][j]
  end
end

prob_sum = prob_set.map{ |ps| ps.reverse.each_with_object([0]){ |p, arr| arr << arr[-1] + p }[1..-1].reverse }

n.times do |i|
  ret = 0
  (m + 1).times do |j|
    prob = prob_set[i][j]
    n.times do |k|
      next if i == k
      idx = upper_bound(time_set[k], time_set[i][j] + EPS)
      if idx == m + 1
        prob = 0
        break
      end
      prob *= prob_sum[k][idx]
    end
    ret += prob
  end
  puts '%.8f' % ret
end

Measured memory_bytes: 9304
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		System.out.println(c - Math.min(a - b, c));
	}
}


Measured memory_bytes: 22868
#include<stdio.h>

#define MAX 100000

int main() {
  int n,i,z,A[MAX];

  scanf("%d",&n);
  for(i = 0 ; i < n ; i++) {
    scanf("%d",&A[i]);
  }

  z = partition(A,n,0,n-1);
  
  for(i = 0 ; i < n ; i++) {
    if(i)
      printf(" ");
    if(i == z)
      printf("[");
    printf("%d",A[i]);
    if(i == z)
      printf("]");
  }
  printf("\n");
  return 0;
}

int partition(int A[], int n, int p, int r) {
  int x,i,j,tmp;

  x = A[r];
  i = p-1;

  for(j = p ; j <= r-1 ; j++) {
    if(A[j] <= x) {
      i++;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }

  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5+7;
int a[MAX];
int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int cnt=0;
    for(int i=1;i<=n;i++)
        a[i]=k;
    for(int i=1;i<=q;i++){
        cin>>k;
        a[k]++;
    }
    for(int i=1;i<=n;i++){
        if(a[i]<=q) puts("No");
        else puts("Yes");
    }
    return 0;
}

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

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

Node* root;
Node* NIL;

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

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

	z = new Node;
	z->key = key;
	z->left = NIL;
	z->right = NIL;

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

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

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

int main()
{
	int m;
	cin >> m;
	for (int i = 0; i < m; ++i)
	{
		string command;
		cin >> command;
		if (command == "insert")
		{
			int key;
			cin >> key;
			insert(key);
		}
		else if (command == "print")
		{
			inOrder(root);
			cout << endl;
			preOrder(root);
			cout << endl;
		}
		else if (command == "find")
		{
			int key;
			cin >> key;
			Node* t = find(root, key);
			if (t != NIL)
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 21768
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

class Vec;
Vec operator/(const Vec& v, const double& divisor);
Vec operator*(const double& scale, const Vec& v);

class Vec {
  using F = double;
  vector<F> container;

 public:
  Vec(size_t size) : container(size) {}
  Vec(initializer_list<F> elements)
      : container(elements.begin(), elements.end()) {}
  size_t dim() const { return container.size(); }
  F& operator[](const size_t size) { return container.at(size); }
  const F& operator[](const size_t size) const { return container.at(size); }
  Vec operator+(const Vec& other) const {
    Vec ret(*this);
    for (size_t i = 0; i < dim(); i++) ret[i] += other[i];
    return ret;
  }
  Vec operator-(const Vec& other) const { return (*this) + (-other); }
  Vec operator-() const { return -1.0 * (*this); }
  F inner(const Vec& other) const {
    F acc = 0;
    for (size_t i = 0; i < dim(); i++) {
      acc += (*this)[i] * other[i];
    }
    return acc;
  }
  F norm() const { return sqrt(inner(*this)); }
  Vec unit() const { return (*this) / this->norm(); }
  F ccw(const Vec& other) const {
    return (*this)[0] * other[1] - other[0] * (*this)[1];
  }
  Vec normal() const { return Vec({-(*this)[1], (*this)[0]}); }
};
Vec operator/(const Vec& v, const double& divisor) { return 1.0 / divisor * v; }
Vec operator*(const double& scale, const Vec& v) {
  Vec ret(v);
  for (size_t i = 0; i < ret.dim(); i++) ret[i] *= scale;
  return ret;
}

class Polygon {
  const vector<Vec>& vert;

 public:
  Polygon(const vector<Vec>& vert) : vert(vert) {}
  double area() const {
    const size_t n = vert.size();
    double acc = 0;
    for (size_t i = 0; i < n; i++) {
      acc += vert[i].ccw(vert[(i + 1) % n]);
    }
    return acc / 2.0;
  }
  bool isConvex(double eps) const {
    const size_t n = vert.size();
    for (size_t i = 0; i < n; i++) {
      const Vec a = vert[(i + 1) % n] - vert[i],
                b = vert[(i + 2) % n] - vert[i];
      const double c = a.ccw(b);
      if (c < -eps) {
        return false;
      }
    }
    return true;
  }
};

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

  vector<Vec> v;
  rep(i, n) {
    double x, y;
    cin >> x >> y;
    v.push_back(Vec({x, y}));
  }

  const double EPS = 1e-9;
  cout << (Polygon(v).isConvex(EPS) ? 1 : 0) << endl;
  return 0;
}



Measured memory_bytes: 3292
#include <bits/stdc++.h>
#define mid (tl+tr)/2
#define mod 1000000007
#define fain(arr) for(ll i=0;i<n;i++)cin>>arr[i];
#define faio(arr) for(ll i=0;i<n;i++)cout<<arr[i]<<" ";
#define all(x) x.begin(),x.end()
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bugv(n1) if(DEBUG)cout<<#n1<<" is "<<n1<<'\n';
#define FILE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ll long long 
#define pii pair<ll,ll>
#define pll pair<long long ,long long >
#define pi acos(-1)
#define sz(x) ((ll)x.size())
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define DEBUG true
using namespace std;


void DFS(ll*distance,ll cur,ll parent,vector<pll>*adj)
{
   for(auto x:adj[cur])
   {
       if(x.first==parent)continue;

       distance[x.first] = distance[cur] + x.second;

       DFS(distance,x.first,cur,adj);
   }
}



int main() {
  // FILE;
  SPEED;
  
  ll n;
  cin>>n;

  vector<pii> adj[n+1];

  for(ll i=0;i<n-1;i++)
  {
     ll x,y,w;

     cin>>x>>y>>w;

     adj[x].push_back({y,w});
     adj[y].push_back({x,w});
  } 

  ll dist[n+1];

    dist[1]=0;

  DFS(dist,1,1,adj);

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

    cout<<dist[i]%2<<endl;

  }

  // cout<<endl;



}

Measured memory_bytes: 11648
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    REP(i, n) {
        long long int aa, bb;
        cin >> aa >> bb;
        a[i].first  = aa + bb;
        a[i].second = bb;
    }
    sort(a.rbegin(), a.rend());
    long long int ans = 0;
    REP(i, n) {
        if (i % 2 == 0) {
            ans += a[i].first;
        }
        ans -= a[i].second;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
int n,m; cin >> n >> m;
 //何回目ですべて正解するかの期待値は
 //sum_n=1^\infty n*(2^m-1)^(n-1)/2^(m*n)であたえられるが、
 //計算するとこの和は2^m で与えられる。
 ll A=pow(2,m);
 ll ans=A*(1900*m+100*(n-m));
 cout << ans << endl;

}


Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    N = int(input())
    A = sorted([int(_) for _ in input().split()])

    print(abs(A[-1] - A[0]))

main()


Measured memory_bytes: 5180
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    int k;
    cin >> k;
    queue<ll> q;
    rep(i, 1, 10) q.push(i);
    rep(i, 0, k-1) {
        ll x = q.front();
        q.pop();
        if (x % 10 != 0)
            q.push(10*x + x%10 - 1);
        q.push(10*x + x%10);
        if (x % 10 != 9)
            q.push(10*x + x%10 + 1);
    }
    cout << q.front() << endl;
    return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

//cout << (c)?"Yay!":":(" << endl;

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{

  int a,b;
  cin>>a>>b;
  if(b==1) cout<<0<<endl;
  else{
      cout<<a-b<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
from bisect import bisect_right

def main():
    N, M, K = map(int, readline().rstrip().split())
    A = list(map(int, readline().rstrip().split()))
    B = list(map(int, readline().rstrip().split()))

    a_acc, b_acc = A[:], B[:]
    for i in range(1, N):
        a_acc[i] += a_acc[i-1]
    
    for i in range(1, M):
        b_acc[i] += b_acc[i-1]
    
    res = 0
    for i, a in enumerate(a_acc):
        if a > K:
            break
        left = K - a
        j = bisect_right(b_acc, left)
        res = max(res, i + 1 + j)
    
    res = max(res, bisect_right(b_acc, K))  # Aを1冊も読まない場合
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 48696
h,w=map(int,input().split())
n=int(input())
a=list(map(int , input().split()))
ans=[[0]*w for _ in range(h)]
f=1
k=0
for i in range(h):
    for j in range(w):
        if f==1:
            if a[k]<=0:
                k+=1
            ans[i][j]=k+1
            a[k]-=1
        else:
            if a[k]<=0:
                k+=1
            ans[i][w-1-j]=k+1
            a[k]-=1
        if j==w-1:
            f=f*(-1)
for i in range(h):
  print(*ans[i])

Measured memory_bytes: 42608
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def ng():
        print("No")
        exit()

    n,a,b,c=MI()
    ss=[SI() for _ in range(n)]
    ans=[]
    for i in range(n):
        s=ss[i]
        if s=="AB":
            if (a,b)==(0,0):ng()
            elif (a,b)==(0,1):
                ans.append("A")
                a,b=a+1,b-1
            elif (a,b)==(1,0):
                ans.append("B")
                a,b=a-1,b+1
            elif (a,b,c)==(1,1,0):
                if i==n-1:
                    ans.append("A")
                else:
                    if ss[i+1]=="AC":
                        ans.append("A")
                        a,b=a+1,b-1
                    else:
                        ans.append("B")
                        a, b = a - 1, b + 1
            else:
                if a<b:
                    ans.append("A")
                    a, b = a + 1, b - 1
                else:
                    ans.append("B")
                    a, b = a - 1, b + 1
        elif s=="BC":
            if (b,c)==(0,0):ng()
            elif (b,c)==(0,1):
                ans.append("B")
                b,c=b+1,c-1
            elif (b,c)==(1,0):
                ans.append("C")
                b,c=b-1,c+1
            elif (a,b,c)==(0,1,1):
                if i==n-1:
                    ans.append("B")
                else:
                    if ss[i+1]=="AC":
                        ans.append("C")
                        b, c = b - 1, c + 1
                    else:
                        ans.append("B")
                        b, c = b + 1, c - 1
            else:
                if c<b:
                    ans.append("C")
                    b, c = b - 1, c + 1
                else:
                    ans.append("B")
                    b, c = b + 1, c - 1
        else:
            if (a,c)==(0,0):ng()
            elif (a,c)==(0,1):
                ans.append("A")
                a,c=a+1,c-1
            elif (a,c)==(1,0):
                ans.append("C")
                a,c=a-1,c+1
            elif (a,b,c)==(1,0,1):
                if i==n-1:
                    ans.append("A")
                else:
                    if ss[i+1]=="AB":
                        ans.append("A")
                        a, c = a + 1, c - 1
                    else:
                        ans.append("C")
                        a, c = a - 1, c + 1
            else:
                if a<c:
                    ans.append("A")
                    a, c = a + 1, c - 1
                else:
                    ans.append("C")
                    a, c = a - 1, c + 1
    print("Yes")
    for s in ans:
        print(s)

main()

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

int main() {
	int n,m;
	long int sum=0;
	std::cin >> n>>m;
	int arr[m];
	for(int i=0;i<m;i++)
	{
	    std::cin >> arr[i];
	    sum+=arr[i];
	}
	if(n>=sum)
	{
	    std::cout << (n-sum) << std::endl;
	}
	else
	{
	    std::cout <<-1<< std::endl;
	}
	
	return 0;
}

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

using namespace std;

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

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

ll I, O, T, J, L, S, Z;

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

  ll ans1 = 0ll;
  ll ans2 = 0ll;
  cin >> I >> O >> T >> J >> L >> S >> Z;

  {
    ans1 += I / 2 * 2;
    ans1 += J / 2 * 2;
    ans1 += L / 2 * 2;
    ans1 += O;
  }

  if (I > 0 && J > 0 && L > 0) {
    ans2 += 3;
    I--; J--; L--;
    ans2 += I / 2 * 2;
    ans2 += J / 2 * 2;
    ans2 += L / 2 * 2;
    ans2 += O;
  }
  
  {
    // debug(ans1);
    // debug(ans2);
    cout << max(ans1, ans2) << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <cmath>
#include <functional>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
const int M = 1e9 + 7;
const int N = 5e6 + 100;
const int MAX = 1e9 + 1;
//int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};

ll a[50];
int main() {
    int i, j;
    ll k;
    cin >> k;
    ll t = k / 50LL;
    for (i = 0; i < 50; ++i)
        a[i] = 49LL + 51LL * t - k;
    for (i = 0; i < (int)(k % 50LL); ++i)
        a[i] += 51LL;
    cout << 50 << endl;
    for (i = 0; i < 50; ++i)
        cout << a[i] << ' ';
    cout << endl;
    return 0;
}


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

void Main()
{
    ll n,m;
    cin>>n>>m;
    ll s;
    if(n>1&&m>1)s=m+m+n+n-4;
    else if(m==1&&n==1)s=0;
    else s=2;
    cout<<n*m-s;
}
int main()
{
Main();
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N, M, m;
	
	cin>>N>>M;
	
	
	for(int i = 0, j = (M+1)/2*2-1; j > 0; i++, j-=2){
		cout<<i+1<<" "<<i+j+1<<endl;
	}
	
	for(int i = (M+1)/2*2, j = M/2*2; j > 0; i++, j -= 2){
		cout<<i+1<<" "<<i+j+1<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc163/abc163_c.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<int> c(N - 1);
  rep(i, N - 1) { cin >> c[i]; }

  map<int, int> m;
  rep(i, N - 1) { m[c[i]]++; }

  repi(i, 1, N + 1) { cout << m[i] << endl; }
}

Measured memory_bytes: 13556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,ans,a[25];
int main(){
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> a[i];
	for(int i=1;i<n-1;i++)
		if((a[i]>a[i-1] and a[i]<a[i+1])or(a[i]<a[i-1] and a[i]>a[i+1]))
			ans++;
	cout << ans;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

type ab struct {
	a int
	b int
}
type abArray []ab

type UnionFind struct {
	par []int
}

func newUnionFind(N int) *UnionFind {
	u := new(UnionFind)
	u.par = make([]int, N)
	for i := range u.par {
		u.par[i] = -1
	}
	return u
}

func (u UnionFind) root(x int) int {
	if u.par[x] < 0 {
		return x
	}
	u.par[x] = u.root(u.par[x])
	return u.par[x]
}

func (u UnionFind) unite(x, y int) {
	xr := u.root(x)
	yr := u.root(y)
	if xr == yr {
		return
	}
	u.par[yr] = xr
}

func (u UnionFind) same(x, y int) bool {
	return u.root(x) == u.root(y)
}

func (a abArray) Len() int { return len(a) }
func (a abArray) Less(i, j int) bool {
	if a[i].b == a[j].b {
		return a[i].a > a[j].a
	}
	return a[i].b > a[j].b
}
func (a abArray) Swap(i, j int) { a[i], a[j] = a[j], a[i] }

func main() {
	var (
		n, m int
	)
	fmt.Scan(&n, &m)
	as := make(abArray, n)
	ts := make([]bool, m)
	u := newUnionFind(m)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i].a)
		fmt.Scan(&as[i].b)
	}
	sort.Sort(as)
	ret := int64(0)
	for i := 0; i < n; i++ {
		a := as[i].a - 1
		if a >= m {
			continue
		}
		if ts[a] {
			a = u.root(a) + 1
		}
		if a >= m {
			continue
		}
		ts[a] = true
		if a < m-1 && ts[a+1] {
			u.unite(a+1, a)
		}
		if a > 0 && ts[a-1] {
			u.unite(a, a-1)
		}
		ret += int64(as[i].b)
	}
	fmt.Println(ret)
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define  nl "\n"
#define forn(i, n) for (int i = 0; i < int(n); i++)
typedef long long ll ;

using namespace std ;

int main() {
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    
    int n ;
    cin >> n ;
    ll arr[n] ;
    forn(i,n) {
        cin >> arr[i] ;
    }
    ll dp[n] ;
    dp[0] = 0 ;
    dp[1] = abs(arr[1]-arr[0]) ;

    for(int i=2;i<n;i++) {
        dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2])) ;
    }
    cout << dp[n-1] << nl ;
}

Measured memory_bytes: 5224
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cout<<#x<<" "<<x<<"\n";
#define lli long long int
long long int mod= 1000000007,modd=998244353;
int32_t main()
{
   ios_base::sync_with_stdio(0);
   cin.tie(0);  cout.tie(0);
   lli n,i,x=0;
   cin>>n;
   lli a[n+5];
   lli b[n+5];
   for(i=0;i<n;i++)
   {
      cin>>a[i];
      x=x^a[i];
   }
   for(i=0;i<n;i++)
   {
      b[i]=x^a[i];
   }
   for(i=0;i<n;i++)
   {
     cout<<b[i]<<" ";
   }
   cout<<"\n";
   return 0;
}//main


Measured memory_bytes: 6768
function main(lines) {
    const input = lines.split('\n')
    const S = input[0]
    const T = input[1].split('')
    const beforeT = T.slice(0,T.length-1).join('')

    if(S.length + 1 === T.length && S === beforeT){
        console.log('Yes')
    } else {
        console.log('No')
    }
}

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



Measured memory_bytes: 29628
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, l;
    cin >> n >> l;

    string s[n];
    string tmp;

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

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (s[i] > s[j])
            {
                tmp = s[i];
                s[i] = s[j];
                s[j] = tmp;
            }
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << s[i];
    }

    cout << endl;;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	for(int i=0;i<n;i++){
	    array[i] = in.nextInt();
	}

	for(int i=n-1;i>=0;i--){
	    System.out.print(array[i]);
	    if(i!=0)System.out.print(" ");
	}
	System.out.println();
    }
}

	



Measured memory_bytes: 26184
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793




int main(){
    ll xx,k,d;
    cin >> xx >> k >> d;
    ll x=abs(xx);
    ll ans;
    if(x>d){
        if((x/d)>=k){
          ans=x-d*k;
        }
        else{
          ll n=k-(x/d);
          ll m=x/d;
          if(n%2==0)ans=x-m*d;
          else if(n%2==1)ans=abs(d+m*d-x);
        }
    }
    else if(x==d){
        if(k%2==0)ans=x;
        else if(k%2==1)ans=0;
    }
    else{
      if(k%2==0)ans=x;
      else if(k%2==1)ans=abs(d-x);
    }
    cout << ans << endl;
}



    
   


Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include <vector>

using namespace std;
using ll = long long;

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

#define MOD ((ll)1000000007)


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

	ll N, Y;
	cin >> N >> Y;
	bool ok = false;
	for (ll i = 0; i <= N; i++)
	{
		for (ll j = 0; j <= N - i; j++)
		{
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y)
			{
				ok = true;
				cout << i << " " << j << " " << (N - i - j) << endl;
				break;
			}
		}

		if (ok)
		{
			break;
		}
	}

	if (!ok)
	{
		cout << "-1 -1 -1" << endl;
	}

	return 0;
}


Measured memory_bytes: 256