akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;

constexpr int MAX_M = 50;
constexpr int MAX_LENGTH = 20;

int n, m;
string target;
vector<string> candidates[MAX_LENGTH + 1];
pair<int, string> words[MAX_M];
vector<char> assign(128, -1);

int cnt;

bool dfs(int idx = 0) {
	if(idx == m) {
		if(++cnt == 1) {
			for(auto &c : target) {
				if(c != ' ') c = assign[c];
			}
			return true;
		}
		else {
			return false;
		}
	}

	const auto &s = words[idx].second;

	for(const auto &t : candidates[s.size()]) {
		auto tmp(assign);

		for(int i = 0; i < static_cast<int>(s.size()); ++i) {
			if(!(tmp[s[i]] == t[i] || (tmp[s[i]] == -1 && tmp[t[i]] == -1))) {
				goto next;
			}

			tmp[s[i]] = t[i];
			tmp[t[i]] = s[i];
		}

		assign.swap(tmp);
		if(!dfs(idx + 1)) return false;
		assign = move(tmp);
		
	next:;
	}

	return true;
}

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

	while(cin >> n && n) {
		for_each(begin(candidates), end(candidates), [](vector<string> &v) { v.clear(); });

		for(int i = 0; i < n; ++i) {
			string in;
			cin >> in;

			const int len = in.size();
			candidates[len].emplace_back(move(in));
		}

		cin.ignore();
		getline(cin, target);
		target = target.substr(0, target.size() - 1);

		{
			string in;
			istringstream iss(target);

			for(m = 0; iss >> in; ++m) {
				words[m].second = in;
				in.erase(unique(in.begin(), in.end()), in.end());
				words[m].first = in.size();
			}
		}

		sort(words, words + m, greater<pair<int, string>>());

		cnt = 0;
		fill(begin(assign), end(assign), -1);
		dfs();

		cout << (cnt == 1 ? target : "-") << ".\n";
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1260
import sys

for line in sys.stdin:
    s = map(int, line.split(','))
    l = s[0:10]
    v1 = s[10]
    v2 = s[11]
    d = 1.0*sum(l)*v1/(v1+v2)
    t = 0
    for i in xrange(10):
        t += l[i]
        if t >= d:
            print i+1
            break

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

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;

    if(a <= 8 && b <= 8)
        cout << "Yay!\n";
    else
        cout << ":(\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int main(){

    int N;
    cin >> N;

    int sz = 1 << N;
    multiset<int> st;
    rep(i, sz){
        int s; cin >> s;
        st.insert(s);
    }

    auto erase = [&](int x){
        auto it = st.lower_bound(x);
        st.erase(it++, it);
    };

    vector<vector<int>> tree(N + 1);
    int biggest = *(--st.end());
    tree[0].push_back(biggest);
    erase(biggest);

    rep(i, N + 1)rep(j, i){
        for(int x : tree[j]){
            if(*st.begin() >= x){
                cout << "No\n";
                return 0;
            }
            int use = *(--st.lower_bound(x));
            tree[i].push_back(use);
            erase(use);
        }
    }

    cout << "Yes\n";
    return 0;

}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int n,l; cin>>n>>l;
  int sum=0;
  for (int i=0; i<n; i++) {
    sum += i+l;
  }
  int ms = inf;
  for (int i=0; i<n; i++) {
    if (abs(ms) > abs(i+l))
    ms = i+l;
  }
  cout << sum - ms << endl;
}

int main()
{
  solve();
  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n;
  cin >> n;
  multiset<int> st;
  rep(i,n){
    int x;cin >> x;
    if(st.empty()){
      st.insert(x);
      continue;
    }
    auto iter = st.lower_bound(x);
    if(iter == st.begin()){
      st.insert(x);
    }else{
      iter--;
      st.erase(iter);
      st.insert(x);
    }
  }
  cout << st.size() << endl;



  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll dp[10][1001000];
ll n, m;
ll hp[110];
vector<ll> mp[2];
vector<ll> d[2];

int main() {
	while (cin >> n&&n) {
		mp[0].clear();
		mp[1].clear();
		d[0].clear();
		d[1].clear();
		rep(i, n)cin >> hp[i];
		cin >> m;
		rep(i, m) {
			string s;
			ll mpp, dd;
			cin >> s >> mpp >> s >> dd;
			if (s == "All") {
				mp[0].push_back(mpp);
				d[0].push_back(dd);
			}
			else {
				mp[1].push_back(mpp);
				d[1].push_back(dd);
			}
		}
		rep(i, 1001000) {
			dp[0][i] = INF;
			dp[1][i] = INF;
		}
		dp[0][0] = 0;
		dp[1][0] = 0;
		rep(i, mp[0].size()) {
			rep(j, 1001000) {
				if (j + d[0][i] < 1001000) {
					dp[0][j + d[0][i]] = min(dp[0][j + d[0][i]], dp[0][j] + mp[0][i]);
				}
			}
		}
		rep(i, mp[1].size()) {
			rep(j, 1001000) {
				if (j + d[1][i] < 1001000) {
					dp[1][j + d[1][i]] = min(dp[1][j + d[1][i]], dp[1][j] + mp[1][i]);
				}
			}
		}
		rep(i, 2) {
			for (int j = 1000000; j >= 0; j--) {
				dp[i][j] = min(dp[i][j], dp[i][j + 1]);
			}
		}
		//rep(i, 2) {
		//	rep(j, 50) {
		//		if (dp[i][j] == INF)cout << -1 << " ";
		//		else cout << dp[i][j] << " ";
		//	}
		//	cout << endl;
		//}
		ll ans = INF;
		rep(i, 1001000) {
			ll sum = dp[0][i];
			rep(j, n) {
				if (hp[j] - i >= 0)sum += dp[1][hp[j] - i];
			}
			ans = min(ans, sum);
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 18856
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_065_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 i      PIC 9(6).

    01 N      PIC 9(6).
    01 a      PIC 9(6).

    01 now    PIC 9(6) VALUE 1.

    01 cnt    PIC S9(6) VALUE 0.

    01 ary1.
        03 ary11 OCCURS 100000.
            05 ary PIC 9(6) VALUE 0.

    01 flg1.
        03 flg11 OCCURS 100000.
            05 flg PIC 9(1) VALUE 0.

    01 flg2   PIC 9(1) VALUE 0.

    01 ZS     PIC -(7).
    01 DUMMY  PIC X(1).

    01 ans    PIC X(6).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        ACCEPT a
        MOVE a TO ary(i)
    END-PERFORM.

    MOVE 1 TO flg(1).

    PERFORM VARYING i FROM 1 BY 1 UNTIL flg(ary(now)) = 1
        ADD 1 TO cnt
        MOVE ary(now) TO now
        MOVE 1 TO flg(now)
        IF now = 2 THEN
            MOVE 1 TO flg2
            EXIT PERFORM
        END-IF
    END-PERFORM.

    IF flg2 = 0 THEN
        MOVE -1 TO cnt
    END-IF.

    move cnt TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 1656
//https://atcoder.jp/contests/abc139/tasks/abc139_c
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N; cin>>N;
    vector<ll> hn(N);
    for(auto&& h:hn){
        cin>>h;
    }
    ll ans=0;
    ll cnt=0;
    for(ll i=0;i<N-1;++i){
        if(hn[i]>=hn[i+1]){
            ++cnt;
        } else {
            cnt=0;
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const ll MOD = 1e9+7;

int main(){
  ll n,k,a[111111];
  cin>>n>>k;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  ll mi=11111111111;
  for(int i=0;i<n-k+1;i++){
    mi=min(mi,a[i+k-1]-a[i]);
  }
  cout<<mi<<endl;
  return 0;
}


Measured memory_bytes: 1024
#define INF 10000000000
#define MOD 1000000007

#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))


ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a < b) {
        return gcd(b, a);
    }
    ll r;
    while (r = a % b) {
        a = b;
        b = r;
    }
    return b;
}

#endif  // end of use_templates


int main()
{
    ll n;
    cin >> n;
    vector<ll> result(n + 1);
    for (ll x = 1; x * x <= n; ++x) {
        for (ll y = 1; y * y <= n; ++y) {
            for (ll z = 1; z * z <= n; ++z) {
                ll v = x * (x + y) + y * (y + z) + z * (z + x);
                if (v > n) {
                    break;
                }
                ++result[v];
            }
        }
    }
    rrepp(i, 1, n) {
        cout << result[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;

int main()
{
  int N;
  cin >> N;
  unordered_map<string, ll> hash;
  REP(i,N)
  {
    string s;
    cin >> s;
    sort(all(s));
    if (hash.count(s) == 0)
    {
      hash.insert(make_pair(s, 1));
    } else {
      hash[s] += 1;
    }
  }
  ll ans = 0;
  for (auto itr = hash.begin(); itr != hash.end(); itr++)
  {
    ll count = itr->second;
    // cout << itr->first << ":" << itr->second << endl;
    if (count > 1) {
      ll temp = count * (count-1) / 2;
      ans += temp;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 10660
#include<iostream>

using namespace std;

int main(){
	
	int num;
	int res = 0;
	cin >> num;
	int a[num];
	int b[num];
	int c[num-1];
	
	for(int i=0;i<num;i++){
		cin>> a[i];
	}
	for(int j=0;j<num;j++){
		cin>> b[j];
	}
	for(int k=0;k<num-1;k++){
		cin>> c[k];
	}
	
	
	for(int i=0;i<num;i++){
		res = res + b[a[i]-1];
		
			if(a[i] == (a[i+1] - 1)){
			res = res + c[a[i]-1]; 
		} 
		
	}
	
	
	
	cout << res;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int main(){
    int N; cin >> N;
    vector<string> s(N);
    for(size_t i = 0; i < N; i++)
    {
        cin >> s[i];
    }
    int M; cin >> M;
    vector<string> t(M);
    for(size_t i = 0; i < M; i++)
    {
        cin >> t[i];
    }
    map<string, int> points;
    for(int i = 0; i < N; ++i)
        points[s[i]]++;
    for(int i = 0; i < M; ++i)
        points[t[i]]--;
    int ret=0;
    for(auto point : points) {
        if (point.second > ret)
            ret = point.second;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;
typedef unsigned long long uLL;


int main(){
    int n;cin >> n;
    uLL x;cin >> x;
    vector<uLL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<uLL> cum(n+1,0);
    sort(ALL(a),greater<uLL>());
    for (int i = 0; i < n; i++) {
        cum[i+1]+=cum[i]+a[i];
    }
    uLL ans = ULONG_MAX;
    for (int k = 1; k <= n; k++) {
        uLL tmp = (n+k)*x;
        for (uLL i = 0; i*k <= n; i++) {
            if((i+1)*k>n){
                if(i==0) tmp += (cum[n] - cum[i*k])*5;
                else tmp += (cum[n] - cum[i*k])*(2*(i+1)+1);
                break;
            }
            else{
                if(i==0) tmp += (cum[(i+1)*k] - cum[i*k])*5;
                else tmp += (cum[(i+1)*k] - cum[i*k])*(2*(i+1)+1);
            }
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
//Generated at 2020-03-22 20:08:25 UTC+8
//Created by Alphagocc
#include <bits/stdc++.h>
using namespace std;
bool ok(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
        if (s[i] != s[s.size() - i - 1]) return 0;
    return 1;
}
int main()
{
    string s;
    cin >> s;
    cout << (ok(s) && ok(s.substr(0, (s.size() - 1) / 2))
                        && ok(s.substr((s.size() + 1) / 2))
                    ? "Yes"
                    : "No")
         << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main(){
    ll n,m,v,p;
    cin >> n >> m >> v >> p;
    vector<ll> score(n);
    for(ll i=0;i<n;i++){
        cin >> score[i];
    }
    
    sort(score.begin(),score.end(),greater<ll>());
    
    ll first;
    
    for(ll i=p-1;i<n-1;i++){
        if(score[i]!=score[i+1]){
            first=i;
            break;
        }
    }
    
    ll border=score[first];
    
    ll second=n;
    
    for(ll i=first+1;i<n;i++){
        if(border-m>score[i]){
            second=i;
            break;
        }
    }
    
    ll amari=(first-(p-2))*border;
    
    
    ll third=second;
    
    for(ll i=first+1;i<second;i++){
        ll aaa=score[i]+m;
        ll nokori=(p-1)*m+(n-i)*m+(aaa*((i-1)-(p-2))-amari);
        if(nokori<m*v){
            third=i;
            break;
        }
        amari+=score[i];
    }
    
    cout << third << endl;
    
    return 0;
}











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

signed main() {
  int H, W, Ch, Cw, Dh, Dw; cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
  vector<string> S(H);
  rep(h, H) cin >> S[h];
  
  vector<vector<int>> m(H, vector<int>(W, 100000000));
  rep(h, H) rep(w, W) if(S[h][w] == '#') m[h][w] = -100;
  m[Ch-1][Cw-1] = 0;
  
  queue<pair<int,int>> q;
  q.push(make_pair(Ch-1,Cw-1));
  //int n = 0;
  while(true) {
    set<pair<int,int>> qq;
    while(!q.empty()) {
      int ph = q.front().first, pw = q.front().second;
      q.pop();
      if(ph > 0 && S[ph-1][pw] == '.' && m[ph][pw] < m[ph-1][pw]) {
        m[ph-1][pw] = m[ph][pw];
        q.push(make_pair(ph-1,pw));
      }
      if(ph < H-1 && S[ph+1][pw] == '.' && m[ph][pw] < m[ph+1][pw]) {
        m[ph+1][pw] = m[ph][pw];
        q.push(make_pair(ph+1,pw));
      }
      if(pw > 0 && S[ph][pw-1] == '.' && m[ph][pw] < m[ph][pw-1]) {
        m[ph][pw-1] = m[ph][pw];
        q.push(make_pair(ph,pw-1));
      }
      if(pw < W-1 && S[ph][pw+1] == '.' && m[ph][pw] < m[ph][pw+1]) {
        m[ph][pw+1] = m[ph][pw];
        q.push(make_pair(ph,pw+1));
      }
      for(int i=ph-2; i<=ph+2; i++) {
        for(int j=pw-2; j<=pw+2; j++) {
          if(0<=i&&i<=H-1&&0<=j&&j<=W-1 && S[i][j]=='.' && m[i][j]>m[ph][pw]+1) {
            m[i][j] = m[ph][pw]+1;
            qq.insert(make_pair(i,j));
          }
        }
      }
      //n++;
    }
    
    for(auto p : qq) q.push(p);
    if(q.empty()) {
      //rep(i, H) {
     //   rep(j, W) cout << m[i][j];
      //  cout << endl;
     // }
      
      if(m[Dh-1][Dw-1] == 100000000) cout << -1 << endl;
      else cout << m[Dh-1][Dw-1] << endl;
      return 0;
    }
 
  }
    
  
}

Measured memory_bytes: 14168
import numpy as np

n, m = map(int, input().split())
data = []
for _ in range(n):
    d = []
    for s in input():
        if s == '#':
            d.append(1)
        else:
            d.append(0)
    data.append(d)
data = np.array(data)
col = np.sum(data, axis=1)
row = np.sum(data, axis=0)

for i in range(n):
    if col[i] == 0: continue
    for j in range(m):
        if row[j]==0: continue
        s = '#' if data[i][j] == 1 else '.'
        print(s, end='')
    print()

Measured memory_bytes: 13776
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
using namespace std;
int main() {
    int n,k;
    long long score = 1;
    cin >> n >> k;
    vector<int> a(n);
    for(auto&& _a : a) {
        cin >> _a;
    }
    for(int i = 0; i < n; i++) {
        if(i >= k) {
            if(a[i - k] < a[i]) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
    }
    
}

Measured memory_bytes: 4048
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string a[999];
bool cmp(const string&x,const string&y){
	return x+y<y+x;
}
int main(){
	int N,L;
	cin>>N>>L;
	for(int i=0; i<N; i++)
		cin>>a[i];
	sort(a,a+N,cmp);
	for(int i=0; i<N; i++)
		cout<<a[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n,h,w;
  cin>>n>>h>>w;
  cout << (n-h+1) * (n-w+1) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long ,long> ii; 	
typedef complex<long double> com;
 
const ll mod = 998244353;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector <ll> red(a);
	vector <ll> green(b);
	vector <ll> color(c);
	for (int z=0;z<a;z++){
		cin >> red[z];
	}
	for (int z=0;z<b;z++){
		cin >> green[z];
	}
	for (int z=0;z<c;z++){
		cin >> color[z];
	}
	sort(red.begin(),red.end());
	sort(green.begin(),green.end());
	sort(color.rbegin(),color.rend());
	ll ans = 0;
		ll i = a-x;
	ll j = b-y;
	for (int z=i;z<a;z++){
		ans += red[z];
	}
	for (int z=j;z<b;z++){
		ans += green[z];
	}
	red.push_back(LLONG_MAX);
	green.push_back(LLONG_MAX);
	for (int z=0;z<c;z++){
		if (red[i] <= green[j] && red[i] < color[z]){
			ans += color[z];
			ans -= red[i];
			i++;
		}
		else if (red[i] >= green[j] && green[j] < color[z]){
			ans += color[z];
			ans -= green[j];
			j++;
		}
	}	
	cout << ans << endl;
}


Measured memory_bytes: 3456
x1, y1, x2, y2 = list(map(int, input().split()))
a = x1 - x2
b = y1 - y2
c = x2 - x1
d = y2 - y1

print('{} {} {} {}'.format(x2 + b, y2 + c, x1 + b, y1 + c))


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int m1 = sc.nextInt();
        int d1 = sc.nextInt();
        int m2 = sc.nextInt();
        int d2 = sc.nextInt();
        if(m1 == m2){
            System.out.println("0");
        }else{
            System.out.println("1");
        }
    }
}


Measured memory_bytes: 35780
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll t;
    cin>>t;
    vector<int> v;
    while(t--){
    	ll a,b,c,d;
    	cin>>a>>b>>c>>d;
    	if(a<b||d<b){
    		v.pb(0);
    		continue;
    	}
    	ll g=__gcd(d,b);
    	if((c+g-a%g)/g*g+a%g<b){
    		v.pb(0);
    	}else{
    		v.pb(1);
    	}
    }
    for(auto& i:v)cout << ((i)?"Yes":"No") <<endl;
    return 0;
}


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


int main(){
    int N;
    vector<int> P(100010), index(100010);
    
    cin >> N;
    rep(i,N){ cin >> P[i]; P[i]--;}
    rep(i,N) index[P[i]] = i;
    
    Int ans = 0;
    set<int> checked;
    for(int i=N-1; i>=0; i--){
        int id = index[i];
        checked.insert(id);

        auto it1 = checked.find(id);
        int l1 = -1, l2 = -1; // l1: iの1個左, l2: iの2個左
        if(it1 != checked.begin()) l1 = *(--it1);
        if(it1 != checked.begin()) l2 = *(--it1);

        auto it2 = checked.find(id); it2++;
        int r1 = N, r2 = N; // r1: iの1個右, r2: iの2個右
        if(it2 != checked.end()) r1 = *(it2++);
        if(it2 != checked.end()) r2 = *(it2++);

        Int C = (r1-id)*(l1-l2) + (r2-r1)*(id-l1);
        ans += C*(i+1);
    }

    cout << ans << endl;
}

Measured memory_bytes: 5760
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
class Problem
{
    static void Main()
    {
        //--------------------------------input--------------------------------//

        var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );
        int a = v[0], b = v[1], t = v[2];

        //--------------------------------solve--------------------------------/

        int kq = 0;
        while(t -a>=0)
        {
            kq += b;
            t -= a;
        }
        Console.WriteLine( kq );
    }
    


}

Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(void){
       int a;
       int b;
       int c;
       cin>>a;
       cin>>b;
       cin>>c;
      if(a<b&&b<c){
          cout<<"Yes"<<endl;
      }
          else {
              cout<<"No"<<endl;
      }
 
}


Measured memory_bytes: 3096
n = int(input())
a_list = list(map(int, input().split()))

n_divided = 0

def list_contains_odd(list):
    r = False
    for idx in range(len(list)):
        if list[idx] % 2 != 0:
            r = True
    return r

while 1:
    if list_contains_odd(a_list):
        print(n_divided)
        exit()
    else: 
        a_list = [x/2 for x in a_list]
        n_divided += 1

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

//ただの辺
struct edge {
    using lint = long long int;
    int to;
    lint cost;
    //引数一つの時は距離1
    edge(int t, lint c = 1) : to(t), cost(c) {
    }
};

lint h, n;
vector<lint> a, b;

// dijkstra
// depend:edge
vector<long long int> dijkstra(vector<vector<edge>>& g, int start) {
    using lint = long long int;
    vector<lint> res(g.size(), LLONG_MAX);
    res[start] = 0;
    // first:距離、second:行き先
    priority_queue<pair<lint, lint>, vector<pair<lint, lint>>,
                   greater<pair<lint, lint>>>
        pq;
    pq.push({0, start});
    while (!pq.empty()) {
        lint dist = pq.top().first, now = pq.top().second;
        pq.pop();
        if (res[now] < dist) continue;
        for (int i = 0; i < (int)g[now].size(); i++) {
            edge e = g[now][i];
            if (res[e.to] > res[now] + e.cost) {
                res[e.to] = res[now] + e.cost;
                pq.push(make_pair(res[e.to], e.to));
            }
        }
    }
    return res;
}

int main() {
    cin >> h >> n;
    a.resize(n), b.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    vector<vector<edge>> g(h + 1);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < n; j++) {
            g[i].push_back(edge(min(i + a[j], h), b[j]));
        }
    }
    cout << dijkstra(g, 0)[h] << endl;
}

Measured memory_bytes: 169580
/*
Author: Rishabh Agarwal
Nationality: Indian
*/
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define MOD 1000000007
#define vpi vector<pair<int, int>>
#define ll long long int
#define inf 1000000000
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Cases int testCases; cin>>testCases; while(testCases--) 
#define MOD 1000000007
#define pb push_back
//---------------------------------------------------
int main() {
    // FIO
    double R; cin>>R;
    double d = 3.14159265358979;
    double c = 2*d*R;
    cout.precision(17);
    cout<<c<<endl;
}



Measured memory_bytes: 3788
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;

int main()
{
	int N;
	cin >> N;
	vector<ll> A(N), B(N);
	rep(i, N)cin >> A[i];
	rep(j, N)cin >> B[j];

	ll leave = 0;
	priority_queue<ll> pq;
	rep(i, N) {
		ll now = A[i] - B[i];
		if (now >= 0)pq.push(now);
		else leave -= now;
	}
	int res = N - pq.size();
	while (!pq.empty() && leave > 0) {
		ll now = pq.top(); pq.pop();
		leave -= now;
		res++;
	}
	cout << (leave > 0 ? -1 : res) << endl;
	return 0;
}


Measured memory_bytes: 2936
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

public class PriorityQueue<T> where T: IComparable
{
    private int _type = 0;
    private T[] _heap;
    private int _sz = 0;
    private int _count = 0;

    /// <summary>
    /// Priority queue
    /// </summary>
    /// <param name="type">0: asc, 1:desc</param>
    public PriorityQueue(int type = 0)
    {
	_heap = new T[128];
	_type = type;
    }

    private int Compare(T x, T y)
    {
	return _type == 0 ? x.CompareTo(y) : y.CompareTo(x);
    }

    public void Push(T x)
    {
	_count++;
	if (_count > _heap.Length)
	{
	    var newheap = new T[_heap.Length * 2];
	    for (int n = 0; n < _heap.Length; n++) newheap[n] = _heap[n];
	    _heap = newheap;
	}

	//node number
	var i = _sz++;

	while (i > 0)
	{
	    //parent node number
	    var p = (i - 1) / 2;
	    
	    if (Compare(_heap[p], x) <= 0) break;

	    _heap[i] = _heap[p];
	    i = p;
	}

	_heap[i] = x;
    }

    public T Pop()
    {
	_count--;

	T ret = _heap[0];
	T x = _heap[--_sz];

	int i = 0;
	while (i * 2 + 1 < _sz)
	{
	    //children
	    int a = i * 2 + 1;
	    int b = i * 2 + 2;

	    if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b;

	    if (Compare(_heap[a], x) >= 0) break;
	    
	    _heap[i] = _heap[a];
	    i = a;
	}

	_heap[i] = x;

	return ret;
    }

    public int Count(){ return _count; }
    public T Peek(){ return _heap[0]; }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int n = tmp[0], m = tmp[1];
	int[] a = ReadIntArray();
	long sum = 0;

	var pq = new PriorityQueue<int>(1);
	for (int i = 0; i < n; i++)
	{
	    pq.Push(a[i]);
	    sum += a[i];
	}

	for (int i = 0; i < m; i++)
	{
	    int x = pq.Pop();
	    pq.Push(x/2);
	    sum -= x;
	    sum += x/2;
	}

	WriteLine(sum);
    }
}


Measured memory_bytes: 28748
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Array as A
import Data.List (intercalate)

main :: IO ()
main = do
  n <- unsafeSignedDecimal <$> T.getLine :: IO Int
  as <- A.listArray (1, n) . map ((== 1) . unsafeSignedDecimal) . T.words <$> T.getLine :: IO (A.Array Int Bool)
  let
    as' = A.listArray (1, n) . map f $ [1..n]
    f i | i == n = as A.! n
        | otherwise = foldr (/=) (as A.! i) . map ((as' A.!) . (i *)) $ [2..(n `div` i)]
    bs = filter (as' A.!) $ [1..n]
    m = length bs
  print m
  putStrLn . intercalate " " . map show $ bs

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 37244
#include <iostream> 
#include <cstdlib>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++) 

int main() {
    int N, K;
    cin >> N >> K;
    
    int total = 0;
    for (int i = 0; i < N; i++) {
        int x_i;
        cin >> x_i;
        if (abs(x_i) >= abs(K-x_i)) {
            total += 2*abs(K-x_i);
        } else total += 2*abs(x_i);
    }

    cout << total << endl;
}



Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1, n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        count += 1
    elif p[i-1] > p[i] and p[i] > p[i+1]:
        count += 1
print(count)


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

int main(){
	int c[2],a;
	int n,m,taro[100],hana[100],sumt,sumh;
	while(cin >> n >> m,(n || m)){
		a=0;
		c[0]=10000;
		c[1]=10000;
		sumt=0;
		sumh=0;
		for(int i=0;i<n;i++){
			cin >>taro[i];
			sumt+=taro[i];
		}
		for(int i=0;i<m;i++){
			cin >> hana[i];
			sumh+=hana[i];
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if((sumt-taro[i]+hana[j]) == (sumh-hana[j]+taro[i])){
					if(c[0]+c[1]>taro[i]+hana[j]){
						c[0]=i;
						c[1]=j;
					}
				}
			}
		}
		if(c[0]!= 10000) cout << taro[c[0]] << " " << hana[c[1]] << endl;
		else cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){
  unsigned long long int n,tmp,three,five,fifteen;
  scanf("%llu",&n);
  
  tmp=(1+n)*n/2;
  three=n/3;
  five=n/5;
  fifteen=n/15;
  three=(1+three)*three/2*3;
  five=(1+five)*five/2*5;
  fifteen=(1+fifteen)*fifteen/2*15;
  printf("%llu",tmp-three-five+fifteen);
  return 0;
}

Measured memory_bytes: 1704
N,K = map(int, input().split())
 
MOD = 10 ** 9 + 7
 
ans = 0
for k in range(K, (N + 1) + 1):
    MIN = k * (k - 1) // 2
    MAX = (2 * N - k + 1) * k // 2
    num = MAX - MIN + 1
    ans = (ans + num) % MOD
 
print(ans)

Measured memory_bytes: 9196
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int A,B,C;
	cin>>A>>B>>C;
	if(A==B&&B!=C){
		cout<<"Yes"<<endl;
	}
	else if(B==C&&A!=C){
		cout<<"Yes"<<endl;
	}
	else if(A==C&&C!=B){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
a = list(input())
b = list(input())
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i])
    x.append(b[i])
if f:
    x.pop()
print("".join(x))

Measured memory_bytes: 9112
#include <iostream>

int main() {
  int X, Y;
  std::cin >> X >> Y;
  int ans = 0;
  if (X == 1) { ans += 300000; }
  else if (X == 2) { ans += 200000; }
  else if (X == 3) { ans += 100000; }
  if (Y == 1) { ans += 300000; }
  else if (Y == 2) { ans += 200000; }
  else if (Y == 3) { ans += 100000; }
  if (X == 1 && Y == 1) { ans += 400000; }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
 
int main(){
 
    int r,c,i,j;
    int a[101][101]={0};
 
    scanf("%d %d",&r,&c);
    for(i=0; i<r; i++){
        for(j=0; j<c; j++){
            scanf("%d",&a[i][j]);
             
        }
    }
 
    for(i=0; i<r; i++){
        for(j=0; j<c; j++){
            a[i][c] += a[i][j];
            a[r][j] += a[i][j];
        }
    }
    for(i=0; i<r; i++){
        a[r][c] += a[i][c];
    }
 
    for(i=0; i<r+1; i++){
        for(j=0; j<c+1; j++){
            if(j<c) printf("%d ",a[i][j]);
            else printf("%d\n",a[i][j]);
        }
    }
     
return 0;
}

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = (ll)998244353;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (a == 0) return 0; else if (b == 0) return 1; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

//与えられたF2上の行列をAとして、(1 << (M * N - rank(A) - 1)) * ((1 << rank(A)) - 1 )が答え.
const ll MAX_M = 300, MAX_N = 300;
ll N, M;
ll a[MAX_N][MAX_M];

ll rnk(){
   ll r = 0;
   ll i = 0, j = 0;
   while(i < N && j < M){
      //a[i][j] = 0のときは、k = i + 1, ..., N - 1 からa[k][j] != 0なるkを探してきて, i行目とk行目を入れ替える
      if(!a[i][j]){
         FOR(k, i + 1, N){
            if(a[k][j]){
               REP(l, M){
                  swap(a[i][l], a[k][l]);
               }
               break;
            }
         }
      }
      //入れ替えを行ってもa[i][j] = 0のとき（つまりj列目はすべて0のとき)はj列目をスキップ j+1列目にトライ
      if(!a[i][j]){j++; continue;}
      r++;
      //k = i+1,...,N-1行目についてi行目を引く
      FOR(k, i + 1, N){
         ll c = a[k][j];
         REP(l, M){
            a[k][l] += c * a[i][l];
            a[k][l] %= 2;
         }
      }
      i++; j++;
   }
   return r;
}

int main(){
   cin >> N >> M;
   REP(i, N) REP(j, M) cin >> a[i][j];
   ll r = rnk();
/*
   cout << endl;
   REP(i, N){
      REP(j, M){
         if(j) {cout << " ";}
         cout << a[i][j];
      }
      cout << endl;
   }
   cout << "rnk = " << r << endl;
*/
   cout << residue(pow(2ll, N + M - 1, MOD) - pow(2ll, N + M - 1 - r, MOD), MOD) << endl;

}


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

int sa(int n,int m){
    if(n-m>0)return n-m;
    else return m-n;
}
int main() {
	int num,ki,kih;
	int ax,ay,ah;
	bool ck=true;
	cin>>num;
	int x[num],y[num],h[num];
	for(int i=0;i<num;i++){
	    cin>>x[i]>>y[i]>>h[i];
	}
	for(int j=0;j<num;j++){
	   if(h[j]!=0){
	       ki=j;
	       break;
	   }
	}
	for(int x0=0;x0<=100;x0++){
	    for(int y0=0;y0<=100;y0++){
	        
	        ck=true;
	        for(int k=0;k<num;k++){
	            kih=h[ki]+sa(x[ki],x0)+sa(y[ki],y0)-sa(x[k],x0)-sa(y[k],y0);
	            if(kih==h[k]||(kih<0&&h[k]==0)){}
	            else ck=false;
	        }
	        if(ck){
	            ax=x0;
	            ay=y0;
	            ah=h[ki]+sa(x[ki],x0)+sa(y[ki],y0);
	            
	        }
	        
	    }
	}
	cout<<ax<<" "<<ay<<" "<<ah;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>
#include <stack>

using namespace std;
typedef long long ll;

int main() {
  string s;
  int x, y;
  cin >> s >> x >> y;
  vector<int> m;
  int n = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'T') {
      m.push_back(n);
      n = 0;
    } else {
      n++;
    }
  }
  if (n > 0) {
    m.push_back(n);
  }
  
  vector<int> mx, my;
  int f = m[0];
  for (int i = 1; i < m.size(); i++) {
    if (i % 2) my.push_back(m[i]);
    else mx.push_back(m[i]);
  }
  
  sort(mx.rbegin(), mx.rend());
  sort(my.rbegin(), my.rend());

  x -= f;
  
  for (auto it : mx) {
    x = abs(abs(x) - it);
  }
  for (auto it : my) {
    y = abs(abs(y) - it);
  }
  
  if (x != 0 || y != 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
object Main{
  def main(args:Array[String]) = {
    val list = scala.io.StdIn.readLine.split("").map(_.toString).toList;
    val sortedList = list.sorted

    val ans = sortedList.zip(sortedList.tail).map { n => n._1 == n._2}
    if(ans.find(n => n == true).isEmpty)
      println("yes")
    else
      println("no")
  }
}

Measured memory_bytes: 25516
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include<cstring>
#include<tuple>


#define rep(i,p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//AGC32 B

int main(void) {
	ll n;
	cin >> n;
	vector<vector<ll>> group = vector<vector<ll>>((n+1)/2,vector<ll>());
	ll lb = 1, ub = n % 2 == 0 ? n : n - 1;
	if (n % 2 == 1)group[(n + 1) / 2 - 1].push_back(n);
	rep(i, 0, n / 2) {
		group[i].push_back(lb);
		group[i].push_back(ub);
		lb++;
		ub--;
	}
	vector<string> ans = vector<string>();
	rep(i, 0, group.size()) {
		for (const auto& v1 : group[i]) {
			rep(j, i + 1, group.size()) {
				for (const auto& v2 : group[j]) {
					ans.push_back(to_string(v1) + " " + to_string(v2));
				}
			}
		}
	}
	cout << ans.size() << endl;
	rep(i, 0, ans.size()) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 512
#include <stdio.h>

int f(int a,int b){
  int r;
  while(b>0){
    r=a%b;
    a=b;
    b=r;
  }
  return a;
}

int main(){
  int G,N,A;
  scanf("%d\n",&N);
  int D[1000001];
  int PC[1000001];
  for(int i=1;i<=1000000;i++){
    D[i]=1;
    PC[i]=0;
  }
  int p=2,k=2;
  while(p<=1000000){
    if(D[p]==1){
      D[p]=2;
      k=1;
      while(p*k<=1000000){
        D[p*k]=p;
        k++;
      }
    }
    p++;
  }
  for(int i=1;i<=N;i++){
    scanf("%d",&A);
    if(i==1) G=A;
    else G=f(G,A);
    while(A>1){
      p=D[A];
      PC[p]++;
      while(A%p==0) A/=p;
    }
  }
  int c=1;
  for(int i=1;i<=1000000;i++){
    if(PC[i]>1) c=0;
  }
  if(c==1) printf("pairwise coprime\n");
  else if(G==1) printf("setwise coprime\n");
  else printf("not coprime\n");
  return 0;
}


Measured memory_bytes: 9472
import collections
import itertools

def main():
    dd = collections.defaultdict(int)
    n = int(input())
    dd = {"AC":0, "WA":0, "TLE":0, "RE":0}

    for i in range(n):
        s = input()
        dd[s]+=1
    for i in dd.keys():
        print(i, "x",dd[i])

if __name__ == '__main__':
    main()


Measured memory_bytes: 69836
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define len(s) s.length()
#define all(v) v.begin(),v.end()
const ll INF = INT_MAX;
const int N = 2e5 + 5;
const ll mod = 1000000007 ;
using namespace std;

int main() {



	ios_base::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);


	ll tc = 1;
	// cin >> tc;
	while (tc--) {

		ll n, m, l, r;
		ll i, j;
		ll x, y;

		ll k;
		cin >> n >> k;

		ll p[n];

		for (i = 0; i < n; i++) cin >> p[i];

		sort(p, p + n);

		ll ans = 0;

		for (i = 0; i < k; i++) ans += p[i];

		cout << ans << endl;



	}
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	long long g = gcd(a, b);
	return a / g * b;
}

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

	if (b > c) {
		cout << 0 << endl;
		return 0;
	}
	else if (a == 1 && b == c) {
		cout << 1 << endl;
		return 0;
	}
	else if (a == 1 && b != c) {
		cout << 0 << endl;
		return 0;
	}

	cout << (c - b)*(a - 2) + 1 << endl;

}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  
  for (int i = 0; i < H; i++) {
    cin >> S.at(i);
  }
  
  // '#'のある行と列をカウントする
  // xは縦方向のカウンタ，yは横方向のカウンタ
  // 0なら白，1なら黒
  string x = "", y = "";
  for (int i = 0; i < H; i++)
    x += '0';
  for (int i = 0; i < W; i++)
    y += '0';
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S.at(i).at(j) == '#') {
        x.at(i) = '1';
        y.at(j) = '1';
      }      
    }
  }
  
  for (int i = 0; i < H; i++) {
    // xが'0'の行は飛ばす
    if (x.at(i) == '0')
      continue;
    // yが'1'の時のみSを出力する
    else {
      for (int j = 0; j < W; j++) {
        if (y.at(j) == '1')
          cout << S.at(i).at(j);     
      }
      cout << endl;
    }
  }

}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int h,w,k;cin>>h>>w>>k;
  vector<vector<int>> c(h,vector<int>(w));
  int i,j,l,n,p;
  rep(i,h)rep(j,w)
  {
    char ch;cin>>ch;
    c[i][j]=(ch-'0');
  }
  int ans=0;
  rep(i,h)rep(j,w)
  {
    bool update=true;
    vector<vector<int>> m(h,vector<int>(w));
    m=c;
    m[i][j]=0;
    int score=0;
    int timev=1;
    while(update)
    {
      update=false;
      rep(n,w)
      {
        int to=h-1;
        for(l=h-1;l>=0;l--)
        {
          if(m[l][n]!=0)
          {
            swap(m[to][n],m[l][n]);
            to--;
          }
        }
      }
      int get=0;
      rep(l,h)
      {
        int from=0;
        int now=m[l][n];
        rep(n,w)
        {
          if(now!=m[l][n])
          {
            int dis=(n-1)-from+1;
            if(dis>=k)
            {
              for(p=from;p<n;p++)
              {
                get+=m[l][p];
                m[l][p]=0;
              }
            }
            from=n;
            now=m[l][n];
          }
        }
        int dis=(w-1)-from+1;
        if(dis>=k)
        {
          for(p=from;p<n;p++)
          {
            get+=m[l][p];
            m[l][p]=0;
          }
        }
      }
      if(get>0)update=true;
      else break;
      score+=timev*get;
      timev*=2;
    }
    ans=max(ans,score);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/25 11:03:26 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

#define MOD 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

using namespace std;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	int	x, y;
	cin >> x >> y;
	int	ans;
	if (x == y)
		ans = 0;
	else if (((x >= 0 && y >= 0) || (x < 0 && y <= 0)) && x < y)
		ans = y - x;
	else if (((x > 0 && y > 0) || (x < 0 && y < 0)) && x > y)
		ans = max(abs(x), abs(y)) - min(abs(x), abs(y)) + 2;
	else
		ans = max(abs(x), abs(y)) - min(abs(x), abs(y)) + 1;
	cout << ans << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    long int n,i, sum=0;
    scanf("%ld",&n);
    long int a[n];

    for(i=0;i<n;i++){
        a[i] = i+1;
        if(a[i]%3 == 0 || a[i]%5 ==0){
            a[i]=0;
        }
    }

    for(i=0;i<n;i++){
        sum += a[i];
    }

    printf("%ld",sum);

}

Measured memory_bytes: 9424