akhauriyash/Code-Regression huggingface dataset:
// Contest: AtCoder Beginner Contest 150 (https://atcoder.jp/contests/abc150)
// Problem: C: Count Order (https://atcoder.jp/contests/abc150/tasks/abc150_c)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

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

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

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

    int n; cin >> n;
    vi p(n), q(n), a(n);
    trav(pi, p) cin >> pi;
    trav(qi, q) cin >> qi;
    rep(i, n) a[i] = i+1;

    int i = 0, x, y;
    do {
        if (a == p) x = i;
        if (a == q) y = i;
        ++i;
    } while (next_permutation(all(a)));
    cout << abs(x-y) << '\n';

    return 0;
}


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

int main(){
	string n;cin>>n;
	vector<int> a(n.size() + 1,0);
	vector<int> b(n.size() + 1,0);
	int ans = 0;
	int tmp = 0;
	for(int i = 0; i <n.size(); i++) {
		a[i] = n[n.size() - i - 1] - '0';
	}
	for(int i = 0; i <= n.size(); i++) {
		if(a[i] >= 5){
			if ((a[i] == 5 && a[i + 1] >= 5) || a[i] >= 6){
				ans+= 10 - a[i];
				a[i + 1]++;
			}
			else{
				ans += a[i];
			}
		}
		else{
			ans += a[i]; 
		}
	}
	cout << ans << endl;
	return 0;
}

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

N = int(input())
A = list(map(int, input().split()))
L = [0]
for i in range(N):
    L.append(L[i]+A[i])
TotalLen = L[-1]
Center = TotalLen/2

temp = TotalLen
left = 0
right = 0
for i in range(N + 1):
    if abs(L[i] - Center) < temp:
        temp = abs(L[i] - Center)
        left = L[i]
        right = TotalLen - left
print(abs(left - right))


Measured memory_bytes: 30936
/* constant */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

#define MAX_C	(4)
#define MAX_N	(24)

/* typedef */

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

struct disk_t {
  int x, y, r, c;
};

/* global variables */

static char dists[1 << MAX_N];

/* subroutines */

bool overwrap(disk_t &dsk0, disk_t &dsk1) {
  int dx = dsk1.x - dsk0.x;
  int dy = dsk1.y - dsk0.y;
  int rr = dsk0.r + dsk1.r;
  return (dx * dx + dy * dy < rr * rr);
}

/* main */

int main() {
  int n;
  
  for (;;) {
    cin >> n;
    if (n == 0) break;

    disk_t dsks[MAX_N];
    vi clrs[MAX_C];
    int ovs[MAX_N] = {};
  
    for (int i = 0; i < n; i++) {
      cin >> dsks[i].x >> dsks[i].y >> dsks[i].r >> dsks[i].c;
      dsks[i].c--;
      clrs[dsks[i].c].push_back(i);

      for (int j = 0; j < i; j++)
	if (overwrap(dsks[j], dsks[i]))
	  ovs[i] |= (1 << j);
    }

    queue<int> q;

    char max_cnt = 0;
    int st = (1 << n) - 1;
    fill(dists, dists + (1 << n), -1);
    dists[st] = 0;
    q.push(st);

    while (! q.empty()) {
      int ubits = q.front();
      q.pop();
      
      char ud = dists[ubits];
      if (max_cnt < ud) max_cnt = ud;

      char nvd = ud + 2;
    
      for (int c = 0; c < MAX_C; c++) {
	vi &ids = clrs[c];
	int len = ids.size();

	for (int cid0 = 0; cid0 < len; cid0++) {
	  int id0 = ids[cid0];
	  int bit0 = (1 << id0);
	  if ((ubits & bit0) == 0 || (ubits & ovs[id0]) != 0) continue;

	  for (int cid1 = cid0 + 1; cid1 < len; cid1++) {
	    int id1 = ids[cid1];
	    int bit1 = (1 << id1);
	    if ((ubits & bit1) == 0 || (ubits & ovs[id1]) != 0) continue;

	    int vbits = ubits & ~(bit0 | bit1);
	    if (dists[vbits] < 0) {
	      dists[vbits] = nvd;
	      q.push(vbits);
	    }
	  }
	}
      }
    }

    cout << (int)max_cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 19008
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ss second
#define ff first
vector<ll> adj[100001];ll visited[100001];

int main() 
{
    ll n,i,j,k,x,y,w,flag=0,m;
    cin>>n>>m;
    char a[n][m];ll dp[n][m];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            cin>>a[i][j];
            if( a[i][j]=='#')
            dp[i][j]=0;
            else if(i==0 && j==0)
            dp[i][j]=1;
            else if(i==0)
            dp[i][j]=dp[i][j-1];
            else if(j==0)
            dp[i][j]=dp[i-1][j];
            else
            dp[i][j]=(dp[i-1][j]%(1000000007)+dp[i][j-1]%(1000000007))%(1000000007);
        }
    }
    cout<<dp[n-1][m-1];
    return 0;
}


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

using namespace std;

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

  return 0;
}


Measured memory_bytes: 256
L = list(input().split())
stack = []
ope = ['+','-','*']
for i in range(len(L)):
    if L[i] not in ope:
        stack.append(L[i])
    else:
        a = stack.pop()
        b = stack.pop()
        k = b+L[i]+a
        stack.append(str(eval(k)))
print(stack[0])    


Measured memory_bytes: 5572
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n,d,x;
    cin>>n>>d>>x;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        x+=(d-1)/a+1;
    }
    cout<<x<<endl;
}

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

using namespace std;

int main() {
	int a, b, c;
	string s;

	cin >> s;
	if (s == "Sunny") {
		cout << "Cloudy";
	}
	else if (s == "Cloudy") {
		cout << "Rainy";
	}
	else if (s == "Rainy") {
		cout << "Sunny";
	}





}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,k,q,i,x;
    scanf("%d%d%d",&n,&k,&q);
    int a[n];
    for(i=0;i<n;i++) a[i]=k-q;
    for(i=0;i<q;i++){
        scanf("%d",&x);
        a[x-1]++;
    }
    for(i=0;i<n;i++){
        if(a[i]>0) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  vector<vector<int>> v(n+1);
  for(int i=0;i<m;i++)
  {
    int a,b;
    cin>>a>>b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  queue<int> q,w;
  for(int i=0;i<v[1].size();i++)
  {
    q.push(v[1][i]);
    w.push(1);
  }
  vector<int> d(n+1,-1),na(n+1,0);
  na[1]=1;
  while(!q.empty())
  {
    int z=q.front(),s=w.front();
    q.pop();w.pop();
    if(na[z]==0)
    {
      d[z]=s;
      na[z]=1;
      for(int i=0;i<v[z].size();i++)
      {
        q.push(v[z][i]);
        w.push(z);
      }
    }
  }
  int cnt=0;
  for(int i=2;i<=n;i++)
  {
    if(d[i]==-1)
      cnt++;
  }
  if(cnt)
    cout<<"No"<<endl;
  else
  {
    cout<<"Yes"<<endl;
    for(int i=2;i<=n;i++)
      cout<<d[i]<<endl;
  }
}

Measured memory_bytes: 12628
import qualified Data.ByteString.Char8 as C
import qualified Data.IntMap.Strict as M
import Data.List

main = C.interact $ C.pack . show . sol . get

get = unfoldr (C.readInt . C.dropWhile (<'0'))

sol (n:xs) = f M.empty M.empty xs
  where
  f sa sb [] = g sb - g sa + 1
  f sa sb (a:b:xs) = f (M.insertWith (+) a 1 sa) (M.insertWith (+) b 1 sb) xs
  g
    | odd n     = head . drop h . concatMap (uncurry (flip replicate)) . M.toAscList
    | otherwise = sum . take 2 . drop (h-1) . concatMap (uncurry (flip replicate)) . M.toAscList
  h = n `div` 2

Measured memory_bytes: 71104
#include <stdio.h>
int main(void){
    // Your code here!
    int h,w,i,j;
    while(scanf("%d %d\n", &h, &w)!= EOF){
        if(h == 0 && w == 0){
            break;
        }
        for(i=0;i<h;i++){
            for(j=0; j<w;j++){
                if(i >= 1 && j>= 1 && i < h-1 && j <w-1){
                    printf(".");
                }else{
                        printf("#");
                }
            }
            printf("\n");
        }
        printf("\n");
        }
    return 0;
}



Measured memory_bytes: 2064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

//#include "All.h"

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

int main() {
    string S;
    cin >> S;

    cout << Yes(S[2] == S[3] && S[4] == S[5]) << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string s1,s2;
    cin >> s1 >> s2;
    if(s1 > s2) cout << '>' << endl;
    else if(s1 < s2) cout << '<' << endl;
    else cout << '=' << endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
bad = N if N % 2 else N + 1
ans = []
for i in range(1, N):
    for j in range(i + 1, N + 1):
        if i + j == bad:
            continue
        ans.append((i, j))
print(len(ans))

for x, y in ans:
    print(x, y)


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

using namespace std;
const long mod = 1000000007;
typedef long long lint;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(N) for(int i = 0; i < (int)(N); i++)
#define all(x) (x).begin(),(x).end()
#define length(x) ((int)(x).size())
#define prln(s) cout<<s<<endl;

#define str(s) string s;cin>>s;
#define int1(x) int x;cin>>x;
#define int2(x,y) int x,y;cin>>x>>y;


int  main() {
  int2(n,k);
  vector<lint> h(n);
  repi(n){
    cin>>h[i];
  }
  lint mx=10000000000;
  sort(all(h));
  repi(n-k+1){
    lint sa=-h[i]+h[i+k-1];
    mx=min(mx,sa);
  }
  prln(mx);
}


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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    string ans = "";
    /*start*/
    string s;
    cin >> s;
    bool f = true;
    bool CF = false;
    //c(s.size());
    rep(i, s.size())
    {
        //c(s[i]);
        if (i != 0)
        {
            //c(s[i]);
            if (s[i] < 97 && s[i] != 'C')
            {
                f = false;
                break;
            }
            else if (i > 1 && i != s.size() - 1 && s[i] == 'C')
            {
                // c("CF");
                if (!CF)
                {
                    CF = true;
                }
                else
                {
                    f = false;
                    break;
                }
            }
            else if (i == 1 && s[i] == 'C')
            {
                f = false;
                break;
            }
        }
    }

    if (s[0] != 'A' || !CF)
        f = false;
    if (f)
        ans = "AC";
    else
        ans = "WA";
    c(ans);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

int main() { cin.tie(0); ios::sync_with_stdio(false);
    int N = in, K = in; K = min( K, N-1 );
    vector<int> H(N); rep( i, N ) H[i] = in;

    vector<int> dp(N); dp[0] = 0;
    for( int i=1; i<K; i++ ) {
        dp[i] = INT_MAX;
        for( int j=0; j<i; j++ ) {
            dp[i] = min( dp[i], dp[j] + abs(H[i] - H[j]) );
        }
    }

    for( int i=K; i<N; i++ ) {
        dp[i] = INT_MAX;
        for( int j=i-K; j<i; j++ ) {
            dp[i] = min( dp[i], dp[j] + abs(H[i] - H[j]) );
        }
    }

    cout << dp[N-1] << "\n";
}


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

#define INX(x) (cin >> x)
#define INXV(vec, cnt) for(ll i; i < cnt; i++) INX(vec[i])
#define OUTX(x) (cout << x << endl)
#define OUTXV(vec) for(ll i; i < (ll)vec.size(); i++) OUTX(vec[i])

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>


int main()
{
    vector<ll> x(5);
    ll result;
    for (ll i = 0; i < 5; i++)
    {
        INX(x[i]);

        if(x[i] == 0)
        {
            result = i+1;
        }
    }
    OUTX(result);
    


    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;;


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

    while (1) {
        int n,w,d;
        cin >> n >> w >> d;
        if (n==0 && w==0 && d==0) break;
        vector<pair<int,P>> v;
        v.push_back({w*d,{w,d}});
        vector<int> p(n),s(n);
        rep(i,n) cin >> p[i] >> s[i];
        rep(i,n) {
            pair<int,P> now=v[p[i]-1];
            v.erase(v.begin()+p[i]-1);
            int ww=now.second.first,dd=now.second.second;
            s[i]=s[i]%(2*(ww+dd));
            // cout << s[i] << endl;
            if (s[i]>ww+dd) {
                if (s[i]<2*ww+dd) s[i]=ww-(s[i]-(ww+dd));
                else s[i]=ww+dd-(s[i]-(2*ww+dd));
            }
            // cout << s[i] << " w=" << ww << " d=" << dd << endl;
            if (s[i]<ww) {
                int fi=s[i],se=ww-s[i];
                if (fi>se) swap(fi,se);
                // cout << fi << ' ' << se << endl;
                v.push_back({fi*dd,{fi,dd}});
                v.push_back({se*dd,{se,dd}});
            } else {
                int fi=s[i]-ww,se=dd-(s[i]-ww);
                if (fi>se) swap(fi,se);
                v.push_back({ww*fi,{ww,fi}});
                v.push_back({ww*se,{ww,se}}); 
                // cout << fi << ' ' << se << endl;
            }
        }
        sort(v.begin(),v.end());
        rep(i,n+1) {
            cout << v[i].first;
            if (i<n) cout << ' ';
            else cout << endl;
        }
    } 
    

    return 0;
}


Measured memory_bytes: 3172
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
bool visited[55], v[55][55], used[55][55];
int n, m;
void dfs(int e)
{
	if (visited[e]) return;
	visited[e] = 1;
	for(int i = 1; i <= 50; i++)
		if (v[e][i]) dfs(i);
}
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int cnt = 0, ans = 0;
	cin>>n>>m;
	for(int i = 1; i <= m; i++)
	{
		int a, b;
		cin>>a>>b;
		v[a][b] = v[b][a] = 1;
	}
	for(int i = 1; i <= n; i++)
		if (!visited[i]) dfs(i), cnt++;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= 50; j++)
		{
			if (!v[i][j] || used[i][j]) continue;
			used[i][j] = used[j][i] = 1;
			int Cnt = 0;
			for(int k = 1; k <= 50; k++) visited[k] = 0;
			v[i][j] = v[j][i] = 0;
			for(int k = 1; k <= n; k++)
				if (!visited[k]) dfs(k), Cnt++;
			if (Cnt > cnt) ans++;
			v[i][j] = v[j][i] = 1;
		}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define s second
#define f first
#define mod 1000000007
#define inf 1000000000000000000

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x){
    return power(x,mod-2,mod)%mod;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    char c;
    cin>>c;
   // cout<<int(c-'a');
    cout<<char('a'+int(c-'a')+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	VE a(n), b(n); rep(i, n)cin >> a[i] >> b[i];
	vector<P>tmp;
	rep(i, n)tmp.push_back(make_pair(a[i], b[i]));
	sort(ALL(tmp));
	int now = 0;
	rep(i, n) {
		now += tmp[i].second;
		if (now >= k) {
			cout << tmp[i].first << endl; return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N;
    cin >> N;
    
    if(N>=1000){
        cout << "ABD" << endl;
    }else{
    
        cout << "ABC" << endl;
    }
return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

#define MAX_NUM 2000

typedef struct {
    int x;
    int y;
} Vector2;

int calcurateS(Vector2 *v1, Vector2 *v2) {
    return (v1->y + v2->y)* (v1->x - v2->x);
}
float absolute(float a){
    if( a < 0) a *= -1;
    return a;
}

int main() {
    int vertNum;
    int area[MAX_NUM];
    int index = 0;
    int i = 0;
    Vector2 vertex[MAX_NUM];

    while (1) {
        scanf("%d", &vertNum);
        if (vertNum == 0) break;

        for (i = 0; i < vertNum; i++) {
            scanf("%d %d", &(vertex + i)->x, &(vertex + i)->y);
        }

        for (i = 0; i < vertNum; i++) {
            if (i == vertNum - 1) {
                *(area + index) += calcurateS((vertex + i), vertex);
                continue;
            }
            *(area + index) += calcurateS((vertex + i), (vertex + i + 1));
        }

        index++;
    }

    for (i = 0; i < index; i++) {
        printf("%d %.1f\n", i + 1, absolute(*(area + i) / 2.0));
    }

    return 0;
}


Measured memory_bytes: 1984
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double a,b;
  cin >> a >> b;
  double c;
  string ans="No";
  if(b==100 && a==100){
    cout << ans << endl;
    return 0;}
  else if(b==100){c=1000*a+b;}
  else if(b>=10){
    c=100*a+b;}
  else{
    c=10*a+b;}
  if(sqrt(c)*sqrt(c)==c){ans="Yes";}
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 505
#define MAXM 200005
#define MAXQ 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dp[MAXN][MAXN],cnt[MAXN][MAXN];
int n,m,q;
int main()
{
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=m;i++)
    {
        int l,r;
        scanf("%d%d",&l,&r);
        cnt[l][r]++;
    }
    for(int i=1;i<=n;i++) dp[i][i]=cnt[i][i];
    for(int len=2;len<=n;len++)
    {
        for(int i=1;i+len-1<=n;i++)
        {
            int j=i+len-1;
            dp[i][j]=cnt[i][j]+dp[i][j-1]+dp[i+1][j]-dp[i+1][j-1];
        }
    }
    for(int i=1;i<=q;i++)
    {
        int l,r;
        scanf("%d%d",&l,&r);
        printf("%d\n",dp[l][r]);
    }
    return 0;
}


Measured memory_bytes: 5784
import bisect
a, b, q = map(int, input().split())
s = [int(input()) for _i in range(a)]
t = [int(input()) for _i in range(b)]
s.append(float('inf'))
s.insert(0, -float('inf'))
t.append(float('inf'))
t.insert(0, -float('inf'))
x = [int(input()) for _i in range(q)]

for i in x:
    n = bisect.bisect_right(s, i)
    m = bisect.bisect_right(t, i)
    e = abs(max([s[n], t[m]])-i)
    f = abs(i-min(s[n-1], t[m-1]))
    g = min([abs(i-s[n]), abs(i-t[m-1])])+abs(s[n]-t[m-1])
    h = min([abs(i-s[n-1]), abs(i-t[m])])+abs(s[n-1]-t[m])
    print(min([e, f, g, h]))

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

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

  int cnt = 0;
  char tmp;
  for(char c : s){
    if(tmp != c){
      cnt++;
      tmp = c;
    }
  }

  cout << cnt << endl;

}


Measured memory_bytes: 512
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int d,n;
	cin>>d>>n;
	cout<<(n+(n==100?1:0))*((int)pow(100,d))<<endl;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;
typedef long long ll;
ll n,m;
int main()
{
    while(~scanf("%lld%lld",&n,&m))
    {
        ll sum=0;
        for(ll i=m+1;i<=n;i++)
        {
          ll x=(n)/i,y=(n)%i;
          sum+=(x*(i-m)+(y>=m?y-m+1:0));

        }
        printf("%lld\n",sum-(m==0?n:0));
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    ll n,q;cin>>n>>q;
    vector<pair<ll,pair<ll,ll>>> vec;
    rep(i,n){
        ll s,t,x;cin>>s>>t>>x;
        vec.push_back({x,{s-x,t-x-1}});
    }
    sort(vec.begin(),vec.end());
    vl ans(q);
    set<l_l> s;
    rep(i,q){
        ll d;cin>>d;
        s.insert({d,i});
        ans[i]=-1;
    }
    rep(i,(int)vec.size()){
        ll L=vec[i].se.fi;
        ll R=vec[i].se.se;
        auto it=s.lower_bound({L,-1});
        while(s.size()&&it!=s.end()&&(*it).fi<=R){
            ans[(*it).se]=vec[i].fi;
            s.erase(it++);
        }
    }
    rep(i,q)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 21996
N,K = map(int,input().split())
d = [None]*K
A = [None]*K
Sunuke  = [0]*N
for i in range(K):
    d[i] = int(input())
    A[i] =list(map(int,input().split()))

for i in range(K):
    for j in range(d[i]):
        Sunuke[A[i][j]-1]+=1

ans = 0
for i in range(len(Sunuke)):
    if Sunuke[i] == 0:
        ans+=1

print(ans)


Measured memory_bytes: 9284
#include <cstdio>
#define MOD 998244353
typedef long long ll;
inline ll quick_pow(ll a, int n)
{
	ll res = 1;
	while (n)
	{
		if (n & 1)
			res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
const int mx = 1e6;
ll fact[1000005], inv[1000005], sig[1000005], val1[1000005], val2[1000005];
inline ll C(int n, int m)
{
	if (m < 0 || n < m)
		return 0;
	return fact[n] * inv[m] % MOD * inv[n - m] % MOD;
}
int main()
{
	// freopen("AGC019-F.in", "r", stdin);
	fact[0] = inv[0] = sig[0] = 1;
	for (int i = 1; i <= mx; i++)
		fact[i] = fact[i - 1] * i % MOD;
	inv[mx] = quick_pow(fact[mx], MOD - 2);
	for (int i = mx; i; i--)
	{
		inv[i - 1] = inv[i] * i % MOD;
		sig[i] = fact[i - 1] * inv[i] % MOD;
	}
	int n, m;
	scanf("%d%d", &n, &m);
	int rem = n;
	for (int i = n + m - 1; i && rem; i--)
	{
		if (rem > i - rem + 1)
		{
			rem--;
			if (rem != n - 1)
				val1[i] = (val1[i + 1] + C(n + m - i - 2, n - (rem + 1)) * C(i, rem)) % MOD;
			else
				val1[i] = C(i, rem);
		}
		else if (rem != n)
			val1[i] = (val1[i + 1] - C(n + m - i - 2, n - (rem + 1)) * C(i, rem - 1)) % MOD;
	}
	rem = m;
	for (int i = n + m - 1; i && rem; i--)
	{
		if (rem > i - rem + 1)
		{
			rem--;
			if (rem != m - 1)
				val2[i] = (val2[i + 1] + C(n + m - i - 2, m - (rem + 1)) * C(i, rem)) % MOD;
			else
				val2[i] = C(i, rem);
		}
		else if (rem != m)
			val2[i] = (val2[i + 1] - C(n + m - i - 2, m - (rem + 1)) * C(i, rem - 1)) % MOD;
	}
	ll cur = C(n + m, m) * (n > m ? n : m) % MOD, ans = cur * sig[n + m] % MOD;
	for (int i = n + m - 1; i; i--)
	{
		(cur -= val1[i] + val2[i]) %= MOD;
		(ans += cur * sig[i]) %= MOD;
	}
	printf("%lld\n", (ans + MOD) * quick_pow(C(n + m, m), MOD - 2) % MOD);
	return 0;
}


Measured memory_bytes: 39296
#include <iostream>

using namespace std;


int buble_sort(int *seq, int length) {
  int temp, count = 0;
  for (int i = 0; i < length; i ++) {
    for (int j = length - 1; j > i; j --) {
      if (seq[j] < seq[j-1]) {
        temp = seq[j];
        seq[j] = seq[j - 1];
        seq[j - 1] = temp;
        count ++;
      }
    }
  }
  return count;
}


int main(){
  int N, count;
  int seq[100];
  cin >> N;
  for (int i = 0; i < N; i ++)
    cin >> seq[i];
  count = buble_sort(seq, N);
  for (int k = 0; k < N; k ++)
    cout << seq[k] << ((k == N-1) ? "" : " ");
  cout << endl;
  cout << count << endl;
}



Measured memory_bytes: 3088
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x,t,sum=-1;
  cin>>n>>m>>x;
  vector<vector<int>> a(n,vector<int>(m));
  vector<int> c(n);
  vector<int> d(n+1,0);
  vector<int> b(m,0);
  t=pow(2,n);
  for(int i=0;i<n;i++){
    cin>>c.at(i);
    for(int j=0;j<m;j++){
      cin>>a.at(i).at(j);
    }
  }
  for(int q=1;q<t;q++){
    int w=q;
    int sumi=0;
    for(int l=0;l<m;l++){
      b.at(l)=0;
    }
    for(int i=n;i>=0;i--){
      d.at(i)=w/pow(2,i);
      w-=d.at(i)*pow(2,i);
    }
    for(int i=0;i<n;i++){
      if(d.at(i)==1){
        sumi+=c.at(i);
        for(int j=0;j<m;j++){
          b.at(j)+=a.at(i).at(j);
        }
      }
    }
    int s=1;
    for(int i=0;i<m;i++){
      if(b.at(i)<x)
        s=0;

    }
    if(s==1){
    (sum==-1?sum=sumi:sum=min(sum,sumi));}
    
  }
  cout<<sum;
}

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

int height(int h1,int h2)
{
    //cout<<"h1-"<<h1<<" h2-"<<h2<<" height-"<<abs(h1-h2)<<endl;
    return abs(h1-h2);
}

int frogjumps(int n,int k,int *a)
{
    if(n==2)
        return height(a[0],a[1]);
    int dp[n];
    //cout<<"initial dp ";
    for(int i=0;i<n-1;i++)
    {
        dp[i]=INT_MAX;
        //cout<<dp[i]<<" ";
    }
    dp[n-1]=0;
    //cout<<dp[n-1]<<endl;
    for(int i=n-1;i>0;i--)
    {
        for(int j=1;j<=k;j++)
        {
            if(i-j>=0)
                dp[i-j]=min(dp[i-j],(dp[i]+height(a[i],a[i-j])));
        }
        // if(i-1>=0)
        // {
        //     dp[i-1]=min(dp[i-1],(dp[i]+height(a[i],a[i-1])));
        //     //cout<<"if "<<a[i-1]<<" to "<<a[i]<<" = "<<dp[i-1]<<endl;
        // }
        // if((i-2)>=0)
        // {
        //     dp[i-2]=min(dp[i-2],(dp[i]+height(a[i],a[i-2])));
        //     //cout<<"if "<<a[i-2]<<" to "<<a[i]<<" = "<<dp[i-2]<<endl;
        // }
    }
    // for(int i=0;i<n;i++)
    //     cout<<dp[i]<<" ";
    // cout<<endl;
    return dp[0];
}

int main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    // for(int i=0;i<n;i++)
    //     cout<<a[i]<<" ";
    // cout<<endl;
    cout<<frogjumps(n,k,a)<<endl;
    
}


Measured memory_bytes: 4364
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll n;
ll f[26];
int main(){FAST;
cin>>n;
ll ans = 0;
for(ll i=1;i<=n;i++){
	string x;cin>>x;
	f[x[0]-'A']++;
}
string M = "ACHMR";
for(ll i=0;i<5;i++){
	for(ll j=i+1;j<5;j++){
		for(ll k=j+1;k<5;k++){
			ll ways = f[M[i]-'A']*f[M[j]-'A']*f[M[k]-'A'];
			// cout<<M[i]<<' '<<M[j]<<' '<<M[k]<<' '<<ways<<'\n';
			ans+=ways;
		}
	}
}
cout<<ans;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
const int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i < (n); i++)
using namespace std;
int get_gcd(int a, int b) {
  while(1) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    a %= b;
  }
}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

main () {
  int n;
  scanf("%d", &n);

  vector<int> a(n);
  rep(i,n) scanf("%d", &a[i]);

  printf("%d\n", accumulate(a.begin(), a.end(), -n));

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  long long N, D;
  cin >> N; cin >> D;
  int count = 0;
  for (int i = 0; i < N; i++){
    long long x, y;
    cin >> x; cin >> y;
    if (x * x + y * y <= D * D) count++;
  }
  cout << count;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>

typedef unsigned long long ull;
typedef long long ll;

ll DENOM = 1000000000LL + 7LL;
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3168
#include<stdio.h>

int main(void){
	int A,B,K,i=0;
	scanf("%d %d %d",&A,&B,&K);
	
	while(1){
		if(A%2==1) A-=1;
		B+=A/2;
		A/=2;
		i++;
		if(i==K) break;
		
		if(B%2==1) B-=1;
		A+=B/2;
		B/=2;
		i++;
		if(i==K) break;
	}
	printf("%d %d",A,B);
}

Measured memory_bytes: 128
<?php
fscanf(STDIN, "%s", $s);
fscanf(STDIN, "%s", $t);

if (strlen($s) <= 10) {
  if ($s == substr($t, 0, strlen($s))) {
    if (strlen($t) == strlen($s) + 1) {
      echo 'Yes';exit;
    }
  }
}

echo 'No';


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

int n;
long k;
long a[200000];
long b[200000];

bool ok(long v) {
  long sum = 0;
  for (int i = 0; i < n; ++i) {
    long na = v / b[i];
    sum += max(0l, a[i] - na);
  }
  return sum <= k;
}

int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  sort(a, a + n);
  sort(b, b + n, greater<long>());
  
  long lo = -1;
  long hi = 1e14;
  while (hi - lo > 1) {
    long mid = (lo + hi) / 2;
    if (ok(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << hi << endl;
}

Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }


void _solve_() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = 0;
	ans = max({ a*d, a*c, b*c, b*d });
	cout << ans << endl;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t = 1, tt = 0;
	//cin >> t;
	while (tt++ != t) {
		_solve_();
	}


	return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			double x = sc.nextDouble();
			System.out.println(x<=48?"light fly":
				x<=51?"fly":
				x<=54?"bantam":
				x<=57?"feather":
				x<=60?"light":
				x<=64?"light welter":
				x<=69?"welter":
				x<=75?"light middle":
				x<=81?"middle":
				x<=91?"light heavy":"heavy");
		}
	}
}

Measured memory_bytes: 27640
n = int(input())
a = list(map(int, input().split()))
c = [0, 0, 0]
MOD = 10 ** 9 + 7
ans = 1
for i, ai in enumerate(a):
    flag = False
    x = 0
    for j, cj in enumerate(c):
        if cj == ai:
            x += 1
            if not flag:
                flag = True
                c[j] += 1
    ans *= x
    ans %= MOD
print(ans)


Measured memory_bytes: 14396
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> x;

  vi a(121);
  REP(i,121){
    a[i]=i*i*i*i*i;
    if (i!=0){
      if (a[i]-a[i-1]>1000000000){
        break;
      }
    }
  }


  REP(i,121){
    REP(j,121){
      if (a[i]-a[j]==x){
        n=i;k=j;
        break;
      }
      
      if (a[i]+a[j]==x){
        n=i;k=-j;
        break;
      }
      
      if (-a[i]+a[j]==x){
        n=-i;k=-j;
        break;
      }
      
      if (-a[i]-a[j]==x){
        n=-i;k=j;
        break;
      }

    }
  }

  cout<<n<<" "<<k<<endl;
  return 0;
}

Measured memory_bytes: 3600
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string x;
    cin>>x;
    if(x[0]=='7' || x[1] == '7' || x[2] == '7') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 3652
#include <iostream>

int main(int argc, char const* argv[])
{
	int num;
	long max = -10000000, min = 10000000, sum = 0;
	int input;

	std::cin >> num;

	for (size_t i = 0; i < num; i++)
	{
		std::cin >> input;
		if( max < input)
			max = input;

		if (min > input)
			min = input;

		sum += input;
	}

	std::cout << min << " " << max << " " << sum << std::endl;

	return 0;
}

Measured memory_bytes: 1168
n = int(input())
ls_h = list(map(int, input().split()))

hmax = 0

for i in range(n):
	if ls_h[i] <= hmax - 2:
		print('No')
		break
	elif ls_h[i] > hmax:
		hmax = ls_h[i]
		if i == n - 1:
			print('Yes')
	elif i == n - 1:
		print('Yes')

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

int main() {
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];

    sort(v.begin(), v.end());
    cout << v[0] << " " << v[1] << " " << v[2] << endl;

    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

const int MOD = 1e9+7;
struct mint { // auto MOD int
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}  //コンストラクタ
  mint operator-() const { return mint(-x);} //符号変換
  //算術演算子
  mint operator+(const mint &a) const { return mint(*this) += a; }
  mint operator-(const mint &a) const { return mint(*this) -= a; }
  mint operator*(const mint &a) const { return mint(*this) *= a; }
  mint operator/(const mint &a) const { return mint(*this) /= a; }
  mint pow(ll n) const {  //繰り返し累乗
    if (!n) return 1;
    mint a = pow(n>>1);
    a *= a;
    if (n&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD-2); } // for prime mod
  //代入演算子
  mint& operator+=(const mint a){ if((x+=a.x) >= MOD) x-=MOD;  return *this; }
  mint& operator-=(const mint a){ if((x+=MOD-a.x) >= MOD) x-=MOD;  return *this; }
  mint& operator*=(const mint a){ (x *= a.x) %= MOD;  return *this; }
  mint& operator/=(const mint a){ return (*this) *= a.inv(); }
  //出力
  friend ostream& operator<<(ostream &stout, const mint &tmp){ stout << tmp.x; return stout; }
};

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  mint ans = 0;
  ans += mint(10).pow(n);
  ans -= mint(9).pow(n);
  ans -= mint(9).pow(n);
  ans += mint(8).pow(n);
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
constexpr int N_MAX = 12;
constexpr int FULL = (1ull<<N_MAX) -1;
constexpr int M_MAX = 1001;
int N, M;

vi A;
vi B;
vi C;

int main(int argc, char** argv) {
  cin >> N >> M;
  A.resize(M);
  B.resize(M);
  C.resize(M);

  vll dp(nbit(N), LINF);
  dp[0] = 0;

  // key
  REP(i, M) {
    cin >> A[i] >> B[i];

    ull x = 0;
    REP(j, B[i]) {
      int c;
      cin >> c;
      c--; // 0-indexed
      x |= nbit(c);
    }
    C[i] = x;
  }

//cerr << "full " << full << endl;

  REP(i, M) {
//cerr << "i " << i << ", full " << dp[i][full] << endl;

    for (ull j=0; j<(1ull<<N); j++) {
      ull nextJ = j | C[i];
      chmin(dp[nextJ], dp[j] + A[i]);
    }
  }

  int full = nbit(N)-1;
  if (dp[full] == LINF) {
    cout << -1 << endl;
  } else {
    cout << dp[full] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  string s, ans;
  cin >> s;
  int a;
  a = s.size();
  for(int i = 0;i < a;i++){
    for(int j = 0;j < a;j++){
      if(i != j){
    if(s.at(i) == s.at(j)){
      ans = "no";
      break;
    }
   }
       }
    if(ans == "no"){
      break;
    }
     }
  if(ans != "no"){
    ans = "yes";
  }
  cout << ans;
    }

Measured memory_bytes: 3620
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    if(n== 25)
        printf("Christmas\n");
    else if(n == 24)
        printf("Christmas Eve\n");
    else if(n == 23)
        printf("Christmas Eve Eve\n");
    else
        printf("Christmas Eve Eve Eve\n");
}


Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	for {
		c -= b
		if c <= 0 {
			fmt.Println("Yes")
			return
		}
		a -= d
		if a <= 0 {
			fmt.Println("No")
			return
		}
	}
}


Measured memory_bytes: 1752
#include <cstdio>

int n;
long long a[100000], b[100000];

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

	long long sum=0;
	for(int i=n-1; i>=0; i--){
		a[i]+=sum;
		long long rem=a[i]%b[i];
        if(rem!=0) sum+=b[i]-rem;
	}
	printf("%lld", sum);
    return 0;
}


Measured memory_bytes: 1664
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,a,b,i;
	long long sum=0;
	scanf("%d",&n);
	b=0;
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(b>a){
			sum+=b-a;
		}
		else{
			b=a;
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 1704