akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n; std::cin >> n;
  std::vector<unsigned> a(n);
  std::for_each(a.begin(), a.end(), [](auto& x){std::cin >> x;});
  auto check = [&] (size_t k) {
    assert(k >= 0);
    std::map<size_t, unsigned, std::greater<size_t>> map;
    for (size_t i = 1; i < n; i++) {
      if (a.at(i - 1) < a.at(i)) continue;
      if (k == 1) return false;
      auto crr = a.at(i);
      while (!map.empty() && map.begin()->first >= crr) map.erase(map.begin());
      bool flag = false;
      for (int i = crr - 1; i >= 0; i--) {
        if (!map.count(i) || map.at(i) < k - 1) {
          map[i]++;
          auto it = map.lower_bound(i);
          map.erase(map.begin(), it);
          flag = true;
          break;
        }
      }
      if (!flag) return false;
    }
    return true;
  };
  int ok = n, ng = 0, md;
  while (abs(ok - ng) > 1) {
    md = (ok + ng) >> 1;
    if (check(md)) ok = md;
    else ng = md;
  }
  std::cout << ok << std::endl;
  return 0;
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();

        string answer = (a * b) % 2 == 1 ? "Yes" : "No";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n,k;
vll ans;
lli t;

void output(){
  cout << ans[0];
  for(lli i = 1;i < ans.size();i++){
    cout << " " << ans[i];
  }
  cout << endl;
  exit(0);
}

int main(){
  cin >> k >> n;
  if(k%2 == 0){
    ans = vll(n,k);
    ans[0] = k/2;
    output();
  }
  ans = vll(n,(k+1)/2);
  t = n-1;
  while(t > 0){
    if(ans.back() == 1) ans.pop_back();
    else {
      ans.back()--;
      while(ans.size() < n) ans.push_back(k);
    }
    t -= 2;
  }
  output();


}


Measured memory_bytes: 4608
/*
* Welcome to my code!
*---------------------------------------------*
* author : lynmisakura(twitter : @andoreiji11)
*/

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define repn for(int i = 0;i < n;i++)
#define ain(a) for(auto& i : a)cin >> i;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define cont continue

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pi = pair<int,int>;
using vpi = vector<pi>;
using pl = pair<ll,ll>;
using vpl = vector<pl>;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
template<class T> void print(std::vector<T> a){ int sz = a.size();
for(int i=0;i<a.size();i++)cout << a[i] << (i < sz-1 ? ' ' : '\n'); }
void ioboost(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}
///////////////////////////////////////////////////////////

// [lb,ub)の範囲の個数を数える
template<class T> int get_range_cnt(vector<T>& a,T lb,T ub){
  int n = a.size();

  int r = n - (int)(a.end() - (lower_bound(all(a),ub)));
  int l = n - (int)(a.end() - (lower_bound(all(a),lb)));

  return r - l;
}

int main(void){
  ioboost();

  int n;cin >> n;
  vl a(n),b(n);
  rep(i,n)cin >> a[i];
  rep(i,n)cin >> b[i];

  ll ans = 0;

  for(int k = 0;k <= 29;k++){
    vl na(n),nb(n);
    rep(i,n)na[i] = a[i] % (1LL << (k+1));
    rep(i,n)nb[i] = b[i] % (1LL << (k+1));

    sort(all(na));
    sort(all(nb));

    ll res = 0; // how many pairs satifsied?

    rep(i,n){
      res += get_range_cnt(nb,(1LL<<k) - na[i],(1<<(k+1)) - na[i]);
      res += get_range_cnt(nb,(1LL<<(k+1))+(1LL<<k) - na[i],(1LL<<(k+2)) - na[i]);
    }

    res %= 2;
    ans += (1LL << k) * res;

  }

  cout << ans << '\n';
}

Measured memory_bytes: 8596
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;
 
ll MOD(ll val, ll m) {
    ll res = val % m;
    if (res < 0) res += m;
    return res;
}
 
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
 
ll nCr(ll n, ll r){
    ll ans=1;
    REP(i, 0, r){
        ans=(ans*(n-i))%mod;
        ans=(ans*modpow(i+1, mod-2))%mod;
    }
    return ans;
}
 
int main() {
    ll n, a, b;
    cin>>n>>a>>b;
 
    if(n==2){
        cout<<0<<endl;
        return 0;
    }
 
    ll ans=modpow(2, n)-1;
    ans=MOD((ans%mod) - (nCr(n, a)%mod), mod);
    ans=MOD((ans%mod) - (nCr(n, b)%mod), mod);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
mod = 10**9 + 7

n,k = map(int,input().split())
tot = []
cur = 0
for i in range(n+1):
    cur += i
    tot.append(cur)

cnt = 0
for i in range(k, n+2):
    if n > i:
        max_ = tot[n] - tot[n - i]
    else:
        max_ = tot[n]
    min_ = tot[i - 1]
    cnt += max_ - min_ + 1
    cnt %= mod
print(cnt)

Measured memory_bytes: 19308
#include<cstdio>

typedef long long int lli;

int main(void) {
    int n;
    lli a[50];

    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%lld", &a[i]);

    lli e=60 * (10000000000000000LL);
    lli b=-1;

    while(e-b > 1) {
        lli m = (e+b)/2;

        lli res=0;
        for(int i=0; i<n; i++) {
            lli now = a[i] + m;
            res += (now-(n-1) + n) / (n+1);
        }

        if(res <= m)
            e = m;
        else
            b = m;
    }

    lli k;
    for(k=e-1000; k<e+1000; k++) {
        lli m = k;
        lli res = 0;
        for(int i=0; i<n; i++) {
            lli now = a[i] + m;
            res += (now-(n-1) + n) / (n+1);
        }
        if(res <= m)
            break;
    }

    printf("%lld\n", k);

    return 0;
}


Measured memory_bytes: 128
a, b, c = map(int,input().split(" "))

count_5 = 0
count_7 = 0

#aについて
if a == 5:
	count_5 += 1
elif a == 7:
	count_7 += 1

#bについて
if b == 5:
	count_5 += 1
elif b == 7:
	count_7 += 1

#cについて
if c == 5:
	count_5 += 1
elif c == 7:
	count_7 += 1

if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO")
  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    //素でABを持っている
    //Bで始まっている
    //Aで終わっている
    //Aで終わっているかつBで始まっているをカウント
    INT(n);
    vector<string> vec(n);
    ll ans=0,aend=0,bbegin=0,ab=0;
    rep(i,n){
        in(vec[i]);
        rep(j,vec[i].length()-1){
            ans+=(ll)(vec[i][j]=='A'&&vec[i][j+1]=='B');
        }
        aend+=(vec[i][vec[i].length()-1]=='A');
        bbegin+=(vec[i][0]=='B');
        ab+=((vec[i][vec[i].length()-1]=='A')&&(vec[i][0]=='B'));
    }
    aend-=ab;
    bbegin-=ab;
    if(ab>=1){
        ans+=ab-1;
        if(aend>=1){
            ans++;
            aend--;
        }
        if(bbegin>=1){
            ans++;
            bbegin--;
        }
    }
    ans+=min(aend,bbegin);
    out(ans);
}

Measured memory_bytes: 3900
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

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


Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int x[n+1];
    int y[n+1];
    int t[n+1];
    for (int i=1; i<=n; ++i){
        cin >> t[i] >> x[i] >> y[i];
    }
    int t_diff;
    int d;
    string ans = "Yes";
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i=1; i<=n; ++i){
        t_diff = (t[i] - t[i-1]);
        d = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]);
        if(d <= t_diff && abs(t_diff - d) % 2 == 0){
            continue;
        }
        else {
            ans = "No";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int n, k;scanf("%d%d", &n, &k);
	double p = 0;
	for( int i = 1 ; i <= n ; ++i ) {
		if( i >= k ) { p += 1.0/n; continue; }
		int h = 0, f = i;
		while( f < k ) f *= 2, ++h;
		p += 1.0/(n*(1ll<<h));
	}
	printf("%.9lf\n", p );
	return 0;
}


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

const ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    int X;
    cin >> X;
    
    int happy = 0;
    happy += (X / 500) * 1000;
    X %= 500;
    happy += (X / 5) * 5;

    cout << happy << endl;

    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc152/tasks/abc152_f

#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMPULL(a, n) REP(_i, n) printf("%llu%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

//------------------------------------------------------------------------------
const int V_MAX = 50;

struct edge { int id, to; };
vector<edge> G[V_MAX];
int dest;

void add_edge(int i, int u, int v) {
  G[u].push_back({i, v});
  G[v].push_back({i, u});
}

ll dfs(int p, int v, ll s) {
  if (v == dest) return s;
  for (edge e : G[v]) {
    if (e.to == p) continue;
    ll ret = dfs(v, e.to, s | 1ULL << e.id);
    if (ret != 0) return ret;
  }
  return 0;
}

const int N_MAX = 50;
const int M_MAX = 20;
const int S_MAX = 1 << M_MAX;

int N;
// int a[N_MAX-1];
// int b[N_MAX-1];
int M;
int u[M_MAX];
int v[M_MAX];

ll S;
ll ps[M_MAX];

void solve() {
  REP(i, M) {
    dest = v[i];
    ps[i] = dfs(-1, u[i], 0);
  }

  // DUMPULL(ps, M);

  ll ans = 0;
  S = 1 << M;
  REP(s, S) {
    int cs = __builtin_popcountll(s);
    ll f = 0;
    REP(i, M) if (s >> i & 1ULL) f |= ps[i];
    int cf = (N - 1) - __builtin_popcountll(f);
    if (cs % 2 > 0) {
      ans -= 1ULL << cf;
    } else {
      ans += 1ULL << cf;
    }
  }

  printf("%llu\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N - 1) {
    int a, b;
    scanf("%d%d", &a, &b);
    add_edge(i, a - 1, b - 1);
  }
  scanf("%d", &M);
  REP(i, M) {
    scanf("%d%d", u + i, v + i);
    u[i]--; v[i]--;
  }
}

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


Measured memory_bytes: 256
//Merge Sort
#include <iostream>
#include <climits>

using namespace std;

int cnt = 0;

void merge(int A[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    int L[n1 + 1], R[n2 + 1];
    for(int i=0; i<n1; i++) L[i] = A[left+i];
    for(int i=0; i<n2; i++) R[i] = A[mid+i];
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;
    int l = 0, r = 0;
    for(int i=0; i<n1+n2; i++) {
        if(L[l] <= R[r]) A[left+i] = L[l++];
        else A[left+i] = R[r++];
        cnt++;
    }
}

void mergeSort(int A[], int left, int right) {
    if(right - left <= 1) return;
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
}

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

    mergeSort(A, 0, n);

    for(int i=0; i<n-1; i++) cout << A[i] << " ";
    cout << A[n-1] << endl;
    cout << cnt << endl;
}



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

int main(){
   int a, b,c,d[1010],f;
  double e;
  cin >> a;
  cin >>b>>c;
  
  for(int i=0;i<a;i++)
    cin>>d[i];
  
    e = 1000;
    f = 0  ;
   for(int i=0;i<a;i++){
     if(e > abs((b-d[i]*0.006)-c)){
       e = abs((b-d[i]*0.006)-c);
       f = i+1;
     }
   }
  cout << f << endl;
}
    


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

lst = []
for i in range(M):
    a = list(map(int, input().split()))
    lst += [a[::-1]]

lst.sort()

count = 0
position = 0

for i in range(M):
    if position <= lst[i][1]:
        count += 1
        position = lst[i][0]
        
print(count)

Measured memory_bytes: 20556
n,k=gets.split.map &:to_i
a=$<.map{|e|e.split.map &:to_i}.sort_by{|e|-e[1]}
s=r=f=0
c=[0]*-~n
f=0
l=[]
i=k-1
a.each{|m,v|
	if l.size>=k
		next if c[m]>0
		i=i.downto(0).find{|j|c[l[j][0]]>1}
		break if !i
		s-=l[i][1]
		c[l[i][0]]-=1
		l.delete_at(i)
	end
	s+=v
	f+=1 if c[m]==0
	c[m]+=1
	l<< [m,v]
	r=[r,s+f**2].max
}
p r

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

int main() {
    int a,b,c,tmp;
    cin >> a >> b >> c;
    if ( a > b ) {
    	tmp = a;
    	a = b;
    	b = tmp;
    } 
    if ( b > c ) {
    	tmp = b;
    	b = c; 
    	c = tmp;
    }
    if ( a > b ) {
    	tmp = a;
    	a = b;
    	b = tmp;
    }
    cout << a << " " << b << " " << c << endl;
	return 0;
}


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

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
// clang-format on

int X, A, B;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> X >> A >> B;

  if (B <= A) {
    cout << "delicious" << endl;
  }
  else if (B <= X + A) {
    cout << "safe" << endl;
  }
  else {
    cout << "dangerous" << endl;
  }

  return 0;
}


Measured memory_bytes: 888
#include <stdio.h>

void swap(int &a,int &b)
{
	int t = a;
	a = b;
	b = t;
}

int a[100];
int main()
{
	int n,count = 0;
	scanf("%d",&n);
	for(int i = 0;i < n;i++)
		scanf("%d",&a[i]);
		
	for(int i = 0;i < n - 1;i++)
	{
		int k = i;
		for(int j = i + 1;j < n;j++)
		{
			if(a[k] > a[j])
				k = j;
		}
		if(k != i)
		{
			swap(a[k],a[i]);
			count++;
		}
	}
	for(int j = 0;j < n;j++)
	{
		if(j == n - 1)
			printf("%d\n",a[j]);
		else
			printf("%d ",a[j]);
	}
	printf("%d\n",count);
	return 0;
}



Measured memory_bytes: 2756
#include<stdio.h>
#include<iostream>

using namespace std;


int main(void){
    int a , b;
    cin >> a >> b;
    int c = a * b;

    if (c%2 == 0){
        cout << "Even" <<endl;
    }
    else{
        cout << "Odd" << endl;
    }


    return(0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >>n>>k;
vector<int> x(n);
for(int i=0;i<n;i++){
cin >> x.at(i);
}
int output =0;
for(int i=0;i<n;i++){
int a=x.at(i);
int b=abs(x.at(i)-k);
if(a>b){
output += 2 * b;
}else{
output += 2 * a;
}

}
cout << output <<endl;
  
  
}

Measured memory_bytes: 3532
program barricade
  implicit none
  integer :: n, a, b, t, m = 0, i
  read(*,*) n, a, b
  do i = 1, n
    read(*,*) t
    if (t < a .or. b <= t) m = m+1
  end do
  write(*,'(i0)') m
end program barricade

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,ans=0;
bool flag;
string s,t;
void Main(){    
    cin>>s>>t;
    n=s.size();
    flag=true;
    map<char,char> stot,ttos;
    For(i,0,n){
        if(!stot.count(s.at(i))){
            stot[s.at(i)]=t.at(i);
        }
        else if(stot.at(s.at(i))==t.at(i)){
        }
        else {
            flag=false;
            break;
        }
        if(!ttos.count(t.at(i))){
            ttos[t.at(i)]=s.at(i);
        }
        else if(ttos.at(t.at(i))==s.at(i)){
        }
        else {
            flag=false;
            break;
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h,w,m,mx{},my{};
    cin>>h>>w>>m;
    set<pair<int,int>> st;
    vector<int> H(h),W(w);
    {
        int x,y;
        fr(i,m){
            cin>>x>>y;--x,--y;
            st.emplace(x,y);
            chmax(mx,++H[x]);
            chmax(my,++W[y]);
        }
    }
    vector<int> X,Y;
    fr(i,h) if(H[i]==mx) X.push_back(i);
    fr(i,w) if(W[i]==my) Y.push_back(i);
    for(auto&i:X) for(auto&j:Y) if(st.find(make_pair(i,j))==st.end()){
        cout<<mx+my<<'\n';
        return 0;
    }
    cout<<mx+my-1<<'\n';
}

Measured memory_bytes: 23812
#include<queue>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};
// 構造体
struct P{
  int ty;
  int tx;
  int ky;
  int kx;
  int c;
  P(int ty,int tx,int ky,int kx,int c):ty(ty),tx(tx),ky(ky),kx(kx),c(c){}
};
int bfs(int ty,int tx,int ky,int kx);
int g[51][51];
int d[51][51][51][51]; // フラグ
int x,y;
int main(){
  int tx,ty;
  int kx,ky;
  while(1){
    cin >> x >> y;
    if(!x && !y)break;
    cin >> tx >> ty;
  cin >> kx >> ky;
  for(int i=0;i<y;i++){
    for(int j=0;j<x;j++){
      cin >> g[i][j];
    }
  }
  int ret = bfs( ty - 1 , tx - 1 , ky - 1 , kx - 1 );
  if(ret != -1){
    cout << ret << endl;
  }else {
    cout << "NA" << endl;
  }
    memset( d , 0 , sizeof(d) );
  }
}
int bfs(int ty,int tx,int ky,int kx){
  queue<P> que;
  que.push(P(ty,tx,ky,kx,0));
  d[ty][tx][ky][kx] = 1;
  
  while(!que.empty()){
    P p = que.front();que.pop();
    // 終了判定
    if(p.c >= 100)return -1;
    if(p.ty == p.ky && p.tx == p.kx)return p.c;
     for(int i=0;i<4;i++){
      int tty = p.ty + dy[i];
      int ttx = p.tx + dx[i];
      int kky = p.ky + (dy[i] * -1); // 　↓
      int kkx = p.kx + (dx[i] * -1); // 逆方向
       // いけない時
       if(tty<0 || tty>=y || ttx<0 || ttx>=x || g[tty][ttx] == 1){
         tty = p.ty;
         ttx = p.tx;
       }
       if(kky<0 || kky>=y || kkx<0 || kkx>=x || g[kky][kkx] == 1){
         kky = p.ky;
         kkx = p.kx;
       }

       if(d[tty][ttx][kky][kkx] == 0){
         que.push(P(tty,ttx,kky,kkx,p.c+1));
         d[tty][ttx][kky][kkx] = 1;
       }
     }
  }
  return -1;
}

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

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

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n;
    ll k;
    cin >> n >> k;
    map<int, ll> mp;

    roop(i, n){
        int a, b;
        cin >> a >> b;
        mp[a] += b;
    }

    ll tmp = k;
    for(auto a: mp){
        tmp -= a.second;
        if(tmp <= 0){
            cout << a.first << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		double [] B = new double[N];
		double S =0;
		for(int i=0; i<N; i++) {
			A[i]=sc.nextInt();
		}
		for(int i=0; i<N; i++) {
          	B[i]=1.0/A[i];
			S=S+B[i];
		}
		System.out.println(1.0/S);
	}
}



Measured memory_bytes: 21716
#!/usr/bin/env pypy3
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    f=[1]*N#根が白
    g=[1]*N
    
    adj=[[]for _ in range(N)]
    for i in range(N-1):
        x,y=MI()
        x-=1
        y-=1
        adj[x].append(y)
        adj[y].append(x)
        
    Ld=[[]for _ in range(N)]#深さ別
    Lp=[0]*N
    Md=0#最深部
    
    import queue
    
    q=queue.Queue()
    q.put((0,-1,0))#v,p,d
    
    while not q.empty():
        v,p,d=q.get()
        Ld[d].append(v)
        Lp[v]=p
        Md=max(d,Md)
        for i in range(len(adj[v])):
            nv=adj[v][i]
            if nv!=p:
                q.put((nv,v,d+1))
                

        
    for i in range(Md-1,-1,-1):
        for j in range(len(Ld[i])):
            v=Ld[i][j]
            tempf=1
            tempg=1
            for k in range(len(adj[v])):
                pv=adj[v][k]
                if pv!=Lp[v]:
                    tempf*=(f[pv]+g[pv])
                    tempg*=f[pv]
                    tempf%=mod
                    tempg%=mod
                
            f[v]=tempf
            g[v]=tempg
            
    print((f[0]+g[0])%mod)

                
    

main()


Measured memory_bytes: 92828
implicit none
integer:: n, i, j, a, b, ans, t
integer,allocatable,dimension(:):: p
character(10) :: s

read(5,*) s
ans = 10000

!空白を除いた文字列の長さ分だけループする
do j=1, len_trim(s) - 2
    read (s(j:j+2),*) i
    ans = min(ans, abs(753 - i))  
enddo

write(6, *) ans

!read(5,*) n, a, b
!allocate(p(n))
!read(5,*) (p(i),i=1,n)


end

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<=n;i++)
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;


/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;    
    }
    return sum;
}
/// 最大公約数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
string S;
cin >> S;
if(S == "A")cout << "T" << endl;
else if(S == "T")cout <<"A" << endl;
else if(S=="C") cout <<"G" << endl;
else cout << "C" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		for (int i = 0; i < 3; i++) {
			if (s.charAt(i) == t.charAt(i)) count++;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    int min = 10000000;
    for (int i = 0;i < N;i++){
        cin >> a[i];
    }
    for(int i = 1;i <= 100;i++){
        int S = 0;
        for(int j = 0; j < N;j++){
            S += (i - a[j]) * (i - a[j]);
        }
        min = std::min(S,min);
    }
    cout << min << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


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

int a[MX];
int dp[MX][2];

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

    int n;
    cin >> n;
    int s = 0;
    a[0] = 0;
    fi(1, n + 1) {
        cin >> a[i];
        if (a[i] <= 2) continue;
        if (a[i] % 2) {
            s += a[i] / 2;
            a[i] = 1;
        } else {
            s += a[i] / 2 - 1;
            a[i] = 2;
        }
    }
    fi(0, n + 1) fj(0, 2) dp[i][j] = -BIG;
    dp[0][0] = 0;
    fi(1, n + 1) {
        int w = max(dp[i - 1][0], dp[i - 1][1]);
        if (a[i] == 0)
            dp[i][0] = w;
        else if (a[i] == 1) {
            dp[i][0] = max(1 + dp[i - 1][1], dp[i - 1][0]);
            dp[i][1] = w;
        } else if (a[i] == 2) {
            dp[i][0] = 1 + w;
            dp[i][1] = max(1 + dp[i - 1][1], dp[i - 1][0]);
        } else {
            assert(false);
        }
    } 

    cout << s + max(dp[n][0], dp[n][1]) << '\n';
}

Measured memory_bytes: 5964
import sys
input = sys.stdin.readline

h, w, m = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]
CC = [[] for i in range(h)]
for i in range(m):
    CC[C[i][0]-1].append(C[i][1]-1)

for i in range(h):
    CC[i].sort()

A = [0] * h
B = [0] * w
for i in range(m):
    A[C[i][0]-1] += 1
    B[C[i][1]-1] += 1

# ans = 0
# for i in range(m):
#     ans = max(ans, A[C[i][0]-1] + B[C[i][1]-1] - 1)

D = [[A[i], i] for i in range(h)]
E = [[B[i], i] for i in range(w)]
D.sort(reverse=True)
E.sort(reverse=True)

# print(D,E)

from bisect import bisect
if not ([D[0][1]+1, E[0][1]+1] in C):
    # print("r1")
    ans = D[0][0] + E[0][0]
else:
    ans = 0
    aa = D[0][0] + E[0][0]
    co = 0
    F = []

    for i in range(h):
        for j in range(w):
            if D[i][0] + E[j][0] == aa:
                F.append([D[i][1], E[j][1]])
                co += 1
            else:
                break
        if co > m:
            break
    if co > m:
        # print("r2")
        ans = D[0][0] + E[0][0]
    else:
        ha = 0
        # print(F)
        # print(CC)
        for i in range(len(F)):
            ind = bisect(CC[F[i][0]], F[i][1])
            if ind==0 or (ind >= 1 and CC[F[i][0]][ind-1] != F[i][1]):
                # print(CC[ind-1], F[i][1])
                ha = 1
                break
        if ha == 1:
            # print("r3")
            ans = D[0][0] + E[0][0]
        else:
            # print("m1")
            ans = D[0][0] + E[0][0] - 1
print(ans)



Measured memory_bytes: 233692
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if (a+b == 5)
    cout << 1 << endl;
  else if (a + b == 4)
    cout << 2 << endl;
  else
    cout << 3 << endl;
}


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

using namespace std;

int main()
{
    string s; cin>>s;
    int x = 0, y = 0;
    int n = s.length();
    
    if (s[2] == s[3] && s[4] == s[5])
        cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int x,m,y;
    cin>>x>>m;
    priority_queue<ll>q;
    for (int i=0;i<x;i++){
        cin>>y;
        q.push(-y);
    }
    pair<int,int>p[m];
    for (int i=0;i<m;i++){
        cin>>p[i].second>>p[i].first;
    }
    sort(p,p+m);
    reverse(p,p+m);
    int c=0;
    while (c<m){
        if (-p[c].first>=q.top())
            break;
        for (int i=0;i<p[c].second;i++){
            if (-p[c].first>=q.top())
            break;
            q.pop();
            q.push(-p[c].first);
        }
        c++;
    }
    ll ans=0;
    while (q.size())
        ans-=q.top(),q.pop();
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1908
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC103D
void swap(int *a, int *b) {
  int temp=*a;
  *a=*b, *b=temp;
}
//二つの配列を連動させてソート
void QuickSort(int A[], int B[], int left, int right) { //クイックソート//
  int Left=left, Right=right, pivot=A[(left+right)/2];
  while(1){ // ソーティング
    while(A[Left]<pivot)
      Left++; // 基準より小さい値を左から見つけていく
    while(pivot<A[Right])
      Right--; // 基準より大きい値を右から見つけていく
    if(Left>=Right) break; // 見つかった値の順序が逆になったら終了
    swap(&A[Left], &A[Right]), swap(&B[Left], &B[Right]); // 値を交換
    Left++, Right--; // 次の値に移動
  }
  if(left<Left-1) QuickSort(A, B, left, Left-1); //左群を対象として再帰
  if(Right+1<right) QuickSort(A, B, Right+1, right); //右群を対象として再帰
}

int main(void) {
  int n, m, k=0, i, cou=0, tmp;
  scanf(" %d %d", &n, &m);
  int a[m], b[m], apos[m], bpos[m], flg[m];
  for(i=0; i<m; i++){
    scanf(" %d %d", &a[i], &b[i]);
    apos[i]=i, bpos[i]=i, flg[i]=0;
  }

  QuickSort(a, apos, 0, m-1);
  QuickSort(b, bpos, 0, m-1);

  for(i=0; i<m; i++){
    if(flg[bpos[i]]==0&&b[i]>a[k]){
      while(b[i]>a[k]&&m>k)
        flg[apos[k++ ]]=1;
      cou++;
    }
    if(k>=m) break;
  }
  printf("%d", cou);
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll N,K;
  cin >> N >> K;
  ll ans = 0;
  if(K%2==0){
    ans += pow((N+K/2)/K,3);
    ans += pow(N/K,3);
  }else{
    ans += pow(N/K,3);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3532
#include<bits/stdc++.h>
#define MAXN 10000

using namespace std;
typedef long long ll;

int main()
{
	//freopen("t.txt","r",stdin);
	
	long long a,b; cin>>a>>b;
	if ((a+b)%2==1){
		cout<<"IMPOSSIBLE";
	}
	else{
		cout<<(a+b)/2;
	}
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n;
    cin >>n;
    vector<string> s(n);
    rep(i,n) cin >>s[i];

    int ct[50][26]={};
    rep(i,n)
    {
        rep(j,s[i].size()) ct[i][s[i][j]-'a']++;
    }

    int m[26];
    fill(m,m+26,12345);
    rep(i,n)rep(j,26) m[j]=min(m[j],ct[i][j]);

    string ans="";
    rep(i,26) ans += string(m[i],'a'+i);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
let arr: [(Int, String, Int)] = (1...Int(readLine()!)!).map{
  let input = readLine()!.characters.split(" ").map{String($0)}
  return ($0, input[0], Int(input[1])!)
}
for element in arr.sort({$0.1==$1.1 ? $0.2>$1.2 : $0.1<$1.1}) {
  print(element.0)
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define forn(i, n) for (long long i = 0; i < (long long)(n); ++i)
#define for1(i, n) for (long long i = 1; i <= (long long)(n); ++i)
#define fore(i, l, r) for (long long i = (long long)(l); i <= (long long)(r); ++i)
#define fordn(i, n) for (long long i = (long long)(n) - 1; i >= 0; --i)
#define ford1(i, n) for (long long i = (long long)(n); i >= 1; --i)
#define all(x) (x).begin(), (x).end()
#define PI 3.141592653589793
using namespace std;
using ll = long long;
using ld = long double;


int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    int i = n%10;
    if(i == 2 ||
        i == 4 ||
        i == 5 ||
        i == 7 ||
        i == 9 ){
        cout << "hon" << endl;
    }else if(i == 0 ||
                i == 1 ||
                i == 6 ||
                i == 8 ){
        cout << "pon" << endl;
    }else{
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3664
#include<stdio.h>

int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a < b&&b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2104
n = int(input())
t = [0]
x = []
y = []
for _ in [0]*n:
    _t, _x, _y = map(int, input().split())
    t += [_t]
    x += [_x]
    y += [_y]
nx = ny = 0
for i in range(n):
    nt = t[i+1] - t[i]
    d = abs(x[i]-nx) + abs(y[i]-ny)
    if not (nt%2 == d%2 and nt>=d):
        print('No')
        break
    nx = x[i]
    ny = y[i]
else:
    print('Yes')

Measured memory_bytes: 12496
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <chrono>
#include<assert.h>
#define MAX 1000001
#define pii pair<int, int>
#define F first
#define S second
#define MIN3(a, b, c) (a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c))
#define endl "\n"
#define int long long
#define forn(i, n) for (long long i = 0; i < long long(n); ++i)
#define IOS                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
using namespace std;
inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin()); }
int32_t main()
{
    auto start = chrono::high_resolution_clock::now();
    IOS
    int n,k;
    cin>>n>>k;
    vector<int> v(n),dp(n,0);
    for(int i=0;i<n;i++)
    cin>>v[i];
    dp[0] = 0;
    for(int i=1;i<n;i++){
        int mn = (int)INFINITY;
        for(int j=1;j<=k && i-j>=0;j++)
            {
                assert(i-j>=0);
                mn = min(mn,dp[i-j] + abs(v[i-j] - v[i]));
            }
            dp[i] = mn;
    }
cout<<dp[n-1];
    auto end = chrono::high_resolution_clock::now();
    double time_taken = chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    //cout << fixed << time_taken;
    return 0;
}

Measured memory_bytes: 1792
// PANASONIC2020 - C - Sqrt Inequality

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

typedef long long ll;

int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	
	ll d=c-a-b;
	if(d>0&&d*d>4*a*b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
using namespace std;
int main()
{
    string s;
    cin>>s;
    map<char,int>mp;
    for(int i=0;i<s.length();i++)
    {
        mp[s[i]]++;
    }
    for(auto itr = mp.begin();itr!=mp.end();itr++)
    {
        //cout<<itr->second<<endl;
        if(itr->second%2==1)
        {
            cout<<"No"<<"\n";
            return 0;
        }
    }
    cout<<"Yes"<<"\n";
    return 0;
}


Measured memory_bytes: 256
//
// Created by chuan on 2020-04-10.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <vector>

using ll = long long;
using namespace std;
int main() {

    ll N; cin>>N;

    ll res{};

    ll s = (N+1)*N/2;
    for (ll i = 3; i <= N; i+=3) {
        s -= i;
    }
    for (ll i = 5; i <= N; i+=5) {
        s -= i;
    }

    for (ll i = 15; i <= N; i+=15) {
        s += i;
    }
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
 
int main() {
    int n;
    int k;
    int h;
    cin>>n;
    cin>>k;
    int cnt=0;
    REP(i,n){
        cin>>h;
        if(h>=k)cnt++;
    }
    cout<<cnt<<endl;
}


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

using namespace std;

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

constexpr char newl = '\n';
constexpr int INF = 1e9;
constexpr int dh[] = {1, -1, 0, 0};
constexpr int dw[] = {0, 0, 1, -1};

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

    int H, W;
    cin >> H >> W;

    int sh, sw, gh, gw;
    cin >> sh >> sw >> gh >> gw;
    --sh; --sw; --gh; --gw;

    vector<string> v(H);
    for (int i = 0; i < H; i++) {
        cin >> v[i];
    }

    vector< vector<int> > dis(H, vector<int>(W, INF));
    deque<P> dq({{sh, sw}});
    dis[sh][sw] = 0;
    while (!dq.empty()) {
        P cur = dq.front();
        dq.pop_front();
        int ch = cur.first, cw = cur.second;
        for (int i = 0; i < 4; i++) {
            int nh = ch + dh[i], nw = cw + dw[i];
            if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if (v[nh][nw] == '#') continue;
            if (dis[nh][nw] <= dis[ch][cw]) continue;

            dis[nh][nw] = dis[ch][cw];
            dq.emplace_front(nh, nw);
        }

        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                if (i == 0 && j == 0) continue;
                int nh = ch + i, nw = cw + j;
                if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
                if (v[nh][nw] == '#') continue;
                if (dis[nh][nw] <= dis[ch][cw] + 1) continue;

                dis[nh][nw] = dis[ch][cw] + 1;
                dq.emplace_back(nh, nw);
            }
        }
    }
    cout << (dis[gh][gw] >= INF ? -1 : dis[gh][gw]) << newl;

    return 0;
}

Measured memory_bytes: 8680
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int n = sc.nextInt();
			int k = sc.nextInt();
			if (n == 0 && k == 0) break;
			int s[] = new int[k];
			for (int i = 0; i < k; i++)
			{
				s[i] = sc.nextInt();
			}
			boolean result = true;
			for (int i = 0; i < n; i++)
			{
				for (int j = 0; j < k; j++)
				{
					s[j] -= sc.nextInt();
					if (s[j] < 0)
					{
						result = false;
					}
				}
			}
			if (result)
			{
				System.out.println("Yes");
			}
			else
			{
				System.out.println("No");
			}
		}
	}
}

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

int main() {
  string s;
  cin >> s;
  char agct[] = {'A', 'G', 'C', 'T'};
  int result = 0;
  int i, j, k;
  for (i = 0; i < s.length(); i++) {
    int count = 0;
    bool braek_flag = false;
    for (j = i; j < s.length(); j++) {
      for (k = 0; k < 4; k++) {
        if (s.at(j) == agct[k]) {
          count++;
          break;
        }
        if (k == 3) {
          braek_flag = true;
        }
      }
      if (braek_flag) {
        break;
      }
    }
    result = max(result, count);
  }
  cout << result << endl;
  return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> p(n);
  
  if(k > q) {
    rep(i, n) {
      p[i] = 0; 
    }
  }
  else {
    rep(i, q) {
      int a;
      cin >> a;
      --a;
      ++p[a];
    }
  }
  rep(i, n) {
    if(p[i] >= q-k+1) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  return 0;
}
    

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

int main(){
    int n; cin >> n;
    int p[1000];
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    int a = 0;
    for(int i=0;i<n-2;i++){
        if(p[i+1] > p[i] & p[i+1] < p[i+2] || p[i+1] < p[i] & p[i+1] > p[i+2]) a += 1;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    unsigned int x;
    std::cin >> x;

    // Constraints-Checker
    if (x < 1 || x > 3000) {
        std::cout << "InputError" << std::endl;
        return -1;
    }

    if (x < 1200) std::cout << "ABC" << std::endl;
    else          std::cout << "ARC" << std::endl;

    return 0;
}

Measured memory_bytes: 256
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
M種類のうちの1個飲める
"""
#solution:
#潜 影 蛇 手 ! !
N=int(input())
T=list(pin())#問題iを解くのに本来必要な時間
M=int(input())
Drinks=([tuple(pin()) for _ in range(M)])
p=[0]*N
for i in range (M):
    j=sum(T)
    print(j-T[Drinks[i][0]-1]+Drinks[i][1])

#print(["No","Yes"][(b[3]-b[0]-b[2]-(b[1]%2)+1>=0)

Measured memory_bytes: 3064