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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<int, int> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x;
  cin >> n >> x;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  ll res = 0;
  if(v[0] > x){
    res += v[0] - x;
    v[0] = x;
    res += v[1];
    v[1] = 0;
  }

  for (int i = 1; i < n; i++) {
    if(v[i-1] + v[i] > x){
      res += v[i] - (x - v[i-1]);
      v[i] = x - v[i-1];
    }
  }

  cout << res << endl;
}


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

#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i<=y;i--)
#define all(x) x.begin(),x.end()
using namespace std;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int sosu[101] ={};
    rep(i,1,n+1){
        int tmp = i;
        rep(j,2,sqrt(n)+2){
            while(tmp%j == 0){
                tmp /= j;
                sosu[j]++;
            }
        }
        if(tmp > 1) sosu[tmp]++;
    }
    //74 or 2*2*4 or 14*4 or 24*3
    int ok74 = 0;
    int ok2 = 0;
    int ok4 =0;
    int ok14 = 0;
    int ok24 = 0;

    rep(i,2,101){
        if(sosu[i]>=74) ok74++;
        if(sosu[i]>=24) ok24++;
        if(sosu[i]>=14) ok14++;
        if(sosu[i]>=4) ok4++;
        if(sosu[i]>=2) ok2++;
    }
    int ans = 0;
    ans = ok74 + ok24 * (ok2-1) + ok14 * (ok4-1) + (ok4*(ok4-1)/2) * (ok2-2);
    cout << ans << endl;
}

Measured memory_bytes: 256
/* 

И пусть меня погубит, то к чему я
Бегу, не жалея ног.
И если мне суждено сгореть на восходе,
Я буду идти вперёд.

*/

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()

using namespace std;

const bool dbg_flg = 0;
#define debug(x) if (dbg_flg) cerr << #x << ' ' << x << '\n'
#define debug_pair(x) if (dbg_flg) cerr << #x << ' ' << x.F << ' ' << x.S << '\n' 

const int inf = 1e9 + 7;
const int MAXN = 1e5 + 5;

int ct[10];

void solve() {
	int a, b, c;

	cin >> a >> b >> c;

	ct[a]++;
	ct[b]++;
	ct[c]++;

	for (int i = 1; i <= 9; i++) {
		if (ct[i] == 2) {
			cout << "Yes";
			return;
		}
	}

	cout << "No";
}

int main() {
	
	//~ freopen(".in", "r", stdin);
	//~ freopen(".out", "w", stdout);
	
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
int main() {
    int N,A;
    cin >> N >> A;
	cout << ceil(double(N+A)/2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
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(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N; cin >> N;
    ll luca[90];
    luca[0] = 2, luca[1] = 1;
    rep(i, 2, 87){
        luca[i] = luca[i-1] + luca[i-2];
    }
    cout << luca[N] << endl;

    return 0;
}

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

int main(void)
{
  char A[200];
  int h,i,j,m,n;
  char t;

  scanf("%s",A);
  n=strlen(A);
  while (A[0]!='-'){
    scanf("%d",&m);
    for (i=0;i<m;i++){
      scanf("%d",&h);
      while(h-->0){
        t=A[0];
        for (j=1;j<n;j++){
          A[j-1]=A[j];
        }
        A[n-1]=t;
      }
    }

    for (i=0;i<n;i++)
      printf("%c",A[i]);
    printf("\n");
    scanf("%s",A);
    n=strlen(A);
  }

  return 0;
}


Measured memory_bytes: 2100
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
#include <chrono>
#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

set<int> st;
#define endl '\n'

void hora(int tc) {
	int n, m;
	cin>>n>>m;
	int lhs = 1, rhs = n;
	if(n % 2 == 0) st.insert(n / 2);
	for(int i = 1;i <= m;i++) {
		while((st.find(rhs - lhs) != st.end() || st.find(lhs + n - rhs) != st.end()) && lhs < rhs) rhs--;
		if(lhs == rhs) while(1);
		cout<<lhs<<" "<<rhs<<endl;
		st.insert(rhs - lhs);
		st.insert(lhs + n - rhs);
		lhs++, rhs--;
	}
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 11972
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int p,q,r;
int solve(){
  string s;cin>>s;
  int bc=0;
  int res=0;
  rep(i, sz(s)){
    if (s[i]=='B') bc++;
    else {
      res += bc;
    }
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 720
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, d, a = map(int, input().split())
    XH = sorted([list(map(int, input().split())) for _ in range(n)])

    res = 0
    tt_dmg = 0
    que = deque()
    for x, h in XH:
        while que and que[0][1] < x:
            dmg, rng = que.popleft()
            tt_dmg -= dmg

        if tt_dmg < h:
            h -= tt_dmg
            cnt = (h + a - 1) // a
            res += cnt
            dmg = cnt * a
            tt_dmg += dmg
            que.append((dmg, x + d * 2))

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 60640
/*
ID: zhaowei10
TASK:
LANG: C++
*/
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define mp make_pair
#define eb emplace_back
#define pb push_back
#define MOD 1000000007
#define NDIG(x) floor(log10(x)) + 1
#define FOR(i, j, k, l) for (s32 i = j; i < k; i += l)
#define RFOR(i, j, k, l) for (s32 i = j; i >= k; i -= l)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(x) x.begin(), x.end()
#define MEAN(a, b) min(a, b) + (abs(b - a) >> 1)
#define FASTIO()    \
  cin.tie(nullptr); \
  ios::sync_with_stdio(false);

typedef long long ll;
typedef int64_t s64;
typedef uint64_t u64;
typedef int32_t s32;
typedef uint32_t u32;
typedef float f32;
typedef double f64;
typedef long double f80;
typedef pair<s32, s32> II;
typedef pair<s64, s64> LL;
typedef vector<s32> VI;
typedef vector<II> VII;
typedef vector<char> VC;
typedef vector<VII> VVII;
typedef priority_queue<s32> PQI;
typedef priority_queue<s32, VI, greater<s32>> PQIA;
typedef priority_queue<s64> PQL;
typedef priority_queue<II> PQII;
typedef priority_queue<II, VII, greater<II>> PQIIA;
typedef priority_queue<LL> PQLL;
typedef unordered_set<s32> USI;
typedef unordered_set<s64> USL;
typedef set<II> SII;
typedef multiset<s32> MSI;

int main() {
  FASTIO();

  string s;
  cin >> s;

  bool seen_a = 0;
  bool seen_b = 0;
  for (char c : s) {
    if (c == 'A') {
      seen_a = 1;
    } else {
      seen_b = 1;
    }

    if (seen_a && seen_b) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 256
P = 2019
S = input()
N = len(S)
res = 0
 
if P in [2,5]:
    for i in range(N):
        if int(S[i])% P == 0:
            res += i+1
else:
    dic = {0:1}
    t1 = 0
    t2 = 1
    for i in range(N):
        t2 = (10*t2) % P
        t1 = (int(S[N-1-i])*t2 + t1) % P
        if t1 in dic:
            res += dic[t1]
            dic[t1] += 1
        else:
            dic[t1] = 1
 
print(res)

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define For(i, a, n) for(int i = a; i < (n); i++)
#define out(n) cout << (n) << endl;
#define vut(v) rep(i, v.size()) out(v[i]);

int main() {
  int a, b, c, ans = 0;
  cin >> a >> b >> c;

  if(a % 2 == 0 && b % 2 == 0 && c % 2 == 0 && a == b && a == c) {
    out(-1);
    return 0;
  }

  while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    ans++;

    int aa = b / 2 + c / 2, bb = a / 2 + c / 2;

    c = a / 2 + b / 2;
    a = aa;
    b = bb;
  }

  out(ans)
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);


int main()
{
	int n;
	cin >> n;
	vi h(n+10,INF);
	for(int i = 1; i <= n; i++) cin >> h[i];
	vi dp(100010,INF);
	dp[1] = 0;
	for(int i = 1; i < n; i++){
		dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
		dp[i+2] = min(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
	}
	cout << dp[n] << endl;

	return 0;
}

Measured memory_bytes: 1024
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()

p = list(map(int, input().split()))
count = 0
res = 0
while True:
    before = X - count
    after = X + count
    if before not in p:
        res = before
        break
    elif after not in p:
        res = after
        break
    count += 1
print(res)


Measured memory_bytes: 9120
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;

ll mod_pow(ll x, ll e, ll M) {
  ll v = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) {
      v = v * x % M;
    }
    x = x * x % M;
  }
  return v;
}

ll inverse(ll x, ll M) { return mod_pow(x, M - 2, M); }

int main() {
  int N;
  string S;
  while (cin >> N >> S) {
    ll base = 9973ll;
    vector<ll> mods = {ll(1e9 + 7), ll(1e9 + 9)};
    vector<vector<ll>> pows(mods.size(), vector<ll>(2 * N + 1));
    for (int i = 0; i < mods.size(); i++) {
      for (int e = -N; e <= N; e++) {
        ll p = mod_pow(base, (ll)abs(-e), mods[i]);
        if (e < 0) {
          p = inverse(p, mods[i]);
        }
        pows[i][e + N] = p;
      }
    }
    vector<int> P(N + 1, 0);
    vector<vector<ll>> H(N + 1, vector<ll>(mods.size(), 0));
    for (int i = 0; i < N; i++) {
      P[i + 1] = P[i];
      H[i + 1] = H[i];
      if (S[i] == '<') --P[i + 1];
      if (S[i] == '>') ++P[i + 1];
      if (S[i] == '+') {
        for (int j = 0; j < mods.size(); j++)
          H[i + 1][j] = (H[i + 1][j] + pows[j][P[i + 1] + N]) % mods[j];
      }
      if (S[i] == '-') {
        for (int j = 0; j < mods.size(); j++)
          H[i + 1][j] =
              (H[i + 1][j] - pows[j][P[i + 1] + N] + mods[j]) % mods[j];
      }
    }
    vector<ll> A = H[N];
    map<vector<ll>, int> mp;
    ll res = 0;
    for (int i = N - 1; i >= 0; i--) {
      ++mp[H[i + 1]];
      vector<ll> Q(mods.size(), 0);
      for (int j = 0; j < mods.size(); j++)
        Q[j] = ((A[j] * pows[j][P[i] + N] % mods[j]) + H[i][j]) % mods[j];
      res += mp[Q];
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 77632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    map<string, int> mp1, mp2;
    int n;
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;
        mp1[s]++;
    }
    int m;
    cin >> m;
    rep(i, m) {
        string s;
        cin >> s;
        mp2[s]++;
    }
    int ans = 0;
    for(auto s : mp1) {
        chmax(ans, mp1[s.first] - mp2[s.first]);
    }
    cout << ans << endl;
}

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

int main(){
    int a,b,c;
    cin >> a >> b>>c;
    if(a == b && b == c){
        cout << "1" << endl;
    }else if(a == b){
        cout << "2" << endl;
    }else if(b == c){
        cout << "2" << endl;
    }else if(c == a){
        cout << "2" << endl;
    }else{
        cout << "3" << endl;
    }

}

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

#define REP(i,n) for(i=0;i<n;i++)
#define ll long long
#define PI M_PI

int main(void){
    int i, ctr= 0;
    int N, K; scanf("%d""%d",&N,&K);
    int h[N];
    REP(i,N) scanf("%d",&h[i]);
    
    REP(i,N){
        if(h[i] >= K) ctr++;
    }
    printf("%d",ctr);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


int main()
{
    int n,x,t;
    cin >> n >> x >> t;
    cout << (n+x-1)/x*t << endl;
    return 0;
}

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

int main(){
    int N,M,X,Y;
    cin>>N>>M>>X>>Y;
    int x[N],y[M];
    for(int i=0;i<N;i++){
        cin>>x[i];
    }
    for(int i=0;i<M;i++){
        cin>>y[i];
    }
    int tr;
    for(int i=0;i<N-1;i++){
        if(x[i]>x[i+1]){
            tr=x[i];
            x[i]=x[i+1];
            x[i+1]=tr;
        }
    }
    for(int i=0;i<M-1;i++){
        if(y[i]<y[i+1]){
            tr=y[i];
            y[i]=y[i+1];
            y[i+1]=tr;
        }
    }
    if(max(X,x[N-1])<min(Y,y[M-1])) cout<<"No War"<<endl;
    else cout<<"War"<<endl;
}

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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    int n = s.size();
    string old,now;
    rep(i,s.size()){
        now += s[i];
        if(old == now)continue;
        old = now;
        now = "";
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
	string s;
	int sum = 0, len;

	cin >> s;
	len = s.size();

	for (int i = 0; i < len; i++){
		if (s[i] == '+')
			sum++;
		else
			sum--;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	int N,M,R;

	cin >> N >> M>> R;
  
  vector<int> ho = {N,M,R};
  sort(ho.begin(), ho.end());

	cout << ho[0] + ho[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> mx(n + 1);
    ll x = 0;
    rep(i, n){
        if(s[i] == 'I') x++;
        if(s[i] == 'D') x--;
        mx[i + 1] = max(mx[i], x);
    }
    sort(all(mx), greater<ll>());
    cout << mx[0];
    cout << endl;
    return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}

int main(){
    int n;
    cin >> n;
    string s;
    cin >>s;
    vector<int>e(n+1,0),w(n+1,0);
    for(int i=1;i<=n;i++){
        if(s.at(i-1)=='W')e.at(i)++;
        e.at(i)+=e.at(i-1);
    }
    reverse(s.begin(),s.end());
    for(int i=1;i<=n;i++){
        if(s.at(i-1)=='E')w.at(i)++;
        w.at(i)+=w.at(i-1);
    }
    reverse(w.begin(),w.end());
    ll ans = 10e14;
    for(int i=0;i<=n;i++){
        ll che = w.at(i)+e.at(i);
        ans = min(che,ans);
    }   
    cout << ans << endl;
}



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

int X,Y,n,m;
int A[105],B[105];

int main(){
    cin >> n >> m >> X >> Y;

    for(int i=0;i<n;i++)
        cin >> A[i];
    for(int j=0;j<m;j++)
        cin >> B[j];

    sort(A,A+n);
    sort(B,B+m);

    for(int z=X+1;z<=Y;z++){
        if(A[n-1]<z && B[0]>=z){
            cout << "No War\n";
            return 0;
        }
    }

    cout << "War\n";

    return 0;
}


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

import sys


BOARD_SIZE_W = 8
BOARD_SIZE_H = 8


def set_queen(board, queen_point):
    """
    クイーンを指定座標に配置した後、残りの配置可能な位置の配列を返す
    """
    return filter(create_queen_filter(queen_point), board)


def create_queen_filter(queen_point):
    """
    指定位置にクイーンを配置したことにより、対象座標へ配置不可能にならないかを確認する関数を返す
    """

    def queen_filter(new_point):
        return new_point[1] != queen_point[1] and \
            new_point[0] != queen_point[0] and \
            new_point[0] != new_point[1] + queen_point[0] - queen_point[1] and \
            new_point[0] != -new_point[1] + queen_point[0] + queen_point[1]
    return queen_filter


def get_board_string(queen_points):
    """
    クイーンの位置座標の配列を指定出力形式に変換する
    """
    queen_points_set = set(list(map(lambda point: "{}:{}".format(point[1], point[0]), queen_points)))
    board_string_lines = []
    for y in range(BOARD_SIZE_H):
        line = ""
        for x in range(BOARD_SIZE_W):
            if "{}:{}".format(x, y) in queen_points_set:
                line += "Q"
            else:
                line += "."
        board_string_lines.append(line)
    return "\n".join(board_string_lines)


def get_all_queen_points(board, queen_points):
    if len(queen_points) >= 8:
        return queen_points
    elif not board:
        return []
    for empty_point in board:
        new_queen_points = [empty_point]
        new_queen_points.extend(queen_points)
        new_queen_points = get_all_queen_points(list(set_queen(board, empty_point)), new_queen_points)
        if new_queen_points:
            return get_all_queen_points(list(set_queen(board, empty_point)), new_queen_points)


def main():
    inputStr = sys.stdin.read()
    lines = inputStr.split("\n")
    lines = list(filter(lambda line: line, lines))
    if len(lines) <= 1:
        lines = []
    else:
        lines = lines[1:]
    queen_points = list(map(lambda line: list(map(int, line.split(" "))), lines))
    board = [[i % BOARD_SIZE_W, i // BOARD_SIZE_H] for i in range(BOARD_SIZE_H * BOARD_SIZE_W)]
    for queen_point in queen_points:
        board = list(set_queen(board, queen_point))
    sys.stdout.write(get_board_string(get_all_queen_points(board, queen_points)) + "\n")


if __name__ == '__main__':
    main()



Measured memory_bytes: 5636
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    for i in range(n-1,0,-2):
        print(a[i],end=" ")
    for i in range(0,n,2):
        print(a[i],end=" ")
else:
    for i in range(n-1,-1,-2):
        print(a[i],end=" ")
    for i in range(1,n,2):
        print(a[i],end=" ")

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

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

	string S; cin >> S;
	int N = S.size();

	int blocks = 0;
	int hi = 0;
	F0R(i, N) {
		while (hi < i || (hi < N && S[hi] == S[i])) ++hi;
		++blocks;
		i = hi - 1;
	}
	print(blocks - 1);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b,c,ans=0;
	cin>>a>>b>>c;
	if(a==b&&b==c&&a%2==0&&b%2==0&&c%2==0) puts("-1");
	else{
		while(a%2==0&&b%2==0&&c%2==0){
			ans++;
			int x=a,y=b,z=c;
			a=(y+z)/2;
			b=(x+z)/2;
			c=(x+y)/2;
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

int main()
{
    vector<int> v;
    int num;
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        int n;
        cin >> n;
        v.push_back(n);
    }

    sort(v.begin(), v.end());

    cout << v.back() - v.front() << endl;

    return 0;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main(){
    for(int n; (n = readln.chomp.to!int) != 0;){
        string[] words;
        foreach(i; 0..n)
            words ~= readln.chomp.split;
            
        words.sort;
        auto wc = group(words);  //単語の数をそれぞれカウントしてさらにソート
        auto c = readln[0];     //一文字取る(immutable(char))
        
        auto wcf = wc.filter!(a => a[0][0] == c).array;
        sort!"a[1] == b[1] ? a[0] < b[0] : a[1] > b[1]"(wcf);
        
        string output = wcf.map!"a[0]".take(5).array.join(" ");
        
        writeln(output.empty ? "NA" : output);
    }
}

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

int swap(int *a, int *b)
{
	int tmp = *a;
	*a = *b;
	*b = tmp;

	return (0);
}

int main(void)
{
	int a, b, c;
	int i, n;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d %d %d", &a, &b, &c);
		if (a > b) swap(&a, &b);
		if (b > c) swap(&b, &c);
		if (a * a + b * b == c * c) puts("YES");
		else puts("NO");
	}
	return (0);
}

Measured memory_bytes: 580
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    };

    if let Some(_) = a.iter().find(|&&x| x == 0) {
        println!("{}", 0);
    } else {
        let ans = a.iter().fold(1u64, |acc, &x| acc.saturating_mul(x));
        if ans > 10u64.pow(18) {
            println!("{}", -1);
        } else {
            println!("{}", ans)
        }
    }
}


Measured memory_bytes: 4488
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let mut n = io.read::<i128>();
    let mut ans = Vec::new();
    while n > 0 {
        n -= 1;
        ans.push(n % 26);
        n /= 26;
    }
    ans.reverse();
    for &c in ans.iter() {
        io.write((c as u8 + b'a') as char);
    }
    io.writeln("");
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 2152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;
int main()
{
	int n;
	cin >> n;
	vector<int> b(n), a(n);
	rep(i, n) cin >> b[i];
	bool ok = false;
	int c = 0;
	reverse(b.begin(), b.end());
	rep(i, n) {
		ok = false;
		auto itr = b.begin();
		int c = b.size();
		while (itr != b.end()) {
			if (c == *itr) {
				a[i] = *itr;
				itr = b.erase(itr);
				ok = true;
				break;
			}
			else itr++;
			c--;
		}
		if (!ok) {
			cout << "-1" << endl;
			return 0;
		}
	}
	reverse(a.begin(), a.end());
	rep(i, n) {
		cout << a[i] << endl;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"math"
)

var (
	finv, inv, fac [MAX]int
)

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

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

const (
	MOD = 1000000007
	MAX = 510000
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

type P struct {
	B, C int
}

type PS []*P

func (p PS) Len() int           { return len(p) }
func (p PS) Less(i, j int) bool { return p[i].C > p[j].C }
func (pq PS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func main() {
	var N, K int
	fmt.Scanf("%d %d\n", &N, &K)

	ans := 0.0
	for i := 1; i <= N; i++ {
		cnt := 0
		point := i
		for point < K {
			point = 2 * point
			cnt++
		}
		ans += math.Pow(0.5, float64(cnt))
	}
	fmt.Println(1 / float64(N) * ans)
}

type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 12416
n = int(input())
a = list(map(int, input().split()))
p = []
c = []
    

a_max = a.pop(a.index(max(a)))
a_min = a.pop(a.index(min(a)))
for v in a:
    if v >= 0:
        p.append(v)
    else:
        c.append(v)
        
s = a_min
if n == 2:
    print(a_max - a_min)
    print(a_max, a_min)
    
else:
    t = [a_min]
    if p != []:
        for v in p:
            s -= v
            t.append(s)
    ans = a_max - s
    t.append(ans)
    if c != []:
        for v in c:
            ans -= v
            t.append(ans)
    print(ans)
    tmp = len(p)
    if p != []:
        for i in range(0, tmp):
            print(t[i], p[i])
    print(a_max, t[tmp])
    if c != []:
        for i in range(0, len(c)):
            print(t[tmp+i+1], c[i])

Measured memory_bytes: 14060
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
ans = 10 ** 9


def bamboo(i, a, b, c):
    if i == N:
        if a * b * c == 0:
            return 10 ** 12
        return abs(A - a) + abs(B - b) + abs(C - c)
    ans = bamboo(i + 1, a, b, c)
    ans = min(ans, bamboo(i + 1, a + l[i], b, c) + (10 if a else 0))
    ans = min(ans, bamboo(i + 1, a, b + l[i], c) + (10 if b else 0))
    ans = min(ans, bamboo(i + 1, a, b, c + l[i]) + (10 if c else 0))
    return ans


print(bamboo(0, 0, 0, 0))

Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
    if (a.substring(0,1).equals(a.substring(1,2)) || a.substring(0,1).equals(a.substring(2)) || a.substring(1,2).equals(a.substring(2))) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }
  }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const long long mod = 1000000007;
struct mint {
  long long x;
  mint(ll x = 0):x(x%mod) {}
  mint& operator+=(const mint a) {
    (x += a.x) %= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    (x += mod-a.x) %= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint ret(*this);
    return ret += a;
  }
  mint operator-(const mint a) const {
    mint ret(*this);
    return ret -= a;
  }
  mint operator*(const mint a) const {
    mint ret(*this);
    return ret *= a;
  }
  mint pow(ll t) const {
    if(t==0) return mint(1);
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }
  
  //for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint ret(*this);
    return ret /= a;
  }
};
ostream &operator<<(ostream& os, const mint& x) {
  os << x.x;
  return os;
}
class modutils {
  vector<mint> fact, invfact;
public:
  modutils(int n = 2000005):fact(n+1),invfact(n+1) {
    fact[0] = 1;
    for(int i=1; i<=n; i++) fact[i] = fact[i-1] * i;
    invfact[n] = fact[n].inv();
    for(int i=n; i>=1; i--) invfact[i-1] = invfact[i] * i;
  }
  mint pow(mint x, ll n) {
    return x.pow(n);
  }
  mint comb(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[k] * invfact[n-k];
  }
  mint perm(ll n, ll k) {
    if(n<0 || k<0 || n<k) return 0;
    return fact[n] * invfact[n-k];
  }
  mint fac(ll n) {
    return fact[n];
  }
};
modutils mutil;

mint f(int r, int c){
  mint ret(0);

  REP(i,1,r+2){
    ret += mutil.comb(i+c,c);
  }

  return ret;
}


int main(){
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  cout << f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1) << endl;
  
  return 0;
}



Measured memory_bytes: 34212
<?php

ini_set('error_reporting', E_ALL & ~E_NOTICE);

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%d %d %d", $N, $A, $B);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d", $h[$i]);
}
rsort($h);
$total = array_sum($h);
$mmax = ceil($h[0] / $B);
$mmin = ceil($total / ($A + $B * ($N - 1)));
if (DEBUG) echo "mmin:{$mmin} mmax:{$mmax}\n";
$mmin--;
// exit;

$ans[$mmax] = true;
$ans[$mmin] = false;

// for ($i = $mmin; $i <= $mmax; $i++) {
//     printf("%d %s\n", $i, getEnable($i));
// }

while (true) {
    $mid = ceil(($mmin + $mmax) / 2);
    $result = getEnable($mid);
    if (DEBUG) printf("%d %d %d %s\n", $mid, $mmin, $mmax, $result);
    $ans[$mid] = $result;
    if ($result === false) {
        if ($ans[$mid+1] === true) {
            exit(($mid + 1) . "\n");
        }
        $mmin = $mid;
    } else {
        if ($ans[$mid-1] === false) {
            exit($mid . "\n");
        }
        $mmax = $mid;
    }
    foreach ($ans as $key => $val) {
        if (DEBUG) echo "RRR {$key} {$val}\n";
    }
    // sleep(1);
}

function getEnable($x) {
    global $N, $A, $B, $h;

    $xx = $x;
    $base = $B * $x;

    for ($i = 0; $i < $N; $i++) {
        if ($base >= $h[$i]) {
            return true;
        }
        $rest = $h[$i] - $base;
        $need = ceil($rest / ($A - $B));
        $x -= $need;
        if ($x < 0) {
            return false;
        }
    }

    return true;
}

Measured memory_bytes: 12792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d=0,r;
    cin>>a>>b>>c;
    r=min(a,b);
    b=max(a,b);
    for(;r<=b;r++)
        d+=(c%r==0)?1:0;
    cout<<d<<endl;
    return 0;
}



Measured memory_bytes: 3120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var N = ReadInt();
            var r = ReadIntArray().Distinct().Count();
            if (N == r)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

Measured memory_bytes: 40372
N = int(input())
num = 0
for i in range(1,N+1):
    if i // 10 < 1:
        num += 1
    elif i//100 < 1:
        continue
    elif i//1000 < 1:
        num += 1
    elif i//10000 < 1:
        continue
    elif i//100000 < 1:
        num += 1
    else:
        continue
print(num)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	char c; cin >> c;
	if(c=='a' or c=='e' or c=='i' or  c=='o' or c=='u') cout << "vowel" << endl; 
	else cout << "consonant" << endl;
}


Measured memory_bytes: 256