akhauriyash/Code-Regression huggingface dataset:
/*input
4
10 80 90 30
*/
/*

**************************
*						 *
* AUTHOR :: knight_coder *
*						 *
**************************

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rrep(i,m,n)	for(lld i=m;i>=n;i--)
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
// template<typename T>
// using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; 
//change null_type to get ordered_map
using namespace std;
#define N  3005
lld dp[N][N];
void inii()
{
	rep(i,0,N)
	{
		rep(j,0,N)
		{
			dp[i][j]=-1;
		}
	}
}
lld a[N];
lld solve2(lld pos,lld pos2)
{
	if(pos==pos2)
	{
		return a[pos];
	}
	if(pos2<pos)
	{
		return 1e10;
	}
	if(dp[pos][pos2]!=-1)
	{
		return dp[pos][pos2];
	}
	lld mx=0;
	mx=max(a[pos]-solve2(pos+1,pos2),a[pos2]-solve2(pos,pos2-1));
	// cout << solve2(pos+1,pos2) << ' ' << solve2(pos,pos2-1) << ' ' << pos <<' ' << pos2<<endl; 
	return dp[pos][pos2]=mx;
}
void solve()
{
	lld n;
	cin >> n;
	inii();
	rep(i,0,n)
	{
		cin >> a[i];
	} 
	cout << solve2(0,n-1) << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

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

int main()
{
    char s[500];
    int i,l;
    while(gets(s))
    {
        l=0;
        l=strlen(s);
        for(int i=0; i<l; i++)
        {
        
           if(i==3)
                s[i]='8';
        }
        printf("%s\n",s);
    }
    return 0;
}

Measured memory_bytes: 128
S = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
s_list = list(S.split(", "))

K = int(input())

print(s_list[K-1])


Measured memory_bytes: 39824
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;

    if((n/10)%10==9||(n-(n/10)*10==9)){
        cout<<"Yes"<<endl;
    }
    else
    cout<<"No"<<endl;
   
    return 0;
}

Measured memory_bytes: 256
t = input()
A, B = int(t[:2]), int(t[2:])
def V(k):
    return 1 <= k <= 12
ans = "NA"
if V(A) or V(B):
    if V(A) and V(B):
        ans = "AMBIGUOUS"
    elif V(A):
        ans = "MMYY"
    else:
        ans = "YYMM"
print(ans)

Measured memory_bytes: 3060
#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 int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	int H, N; cin >> H >> N;
	int sum = 0;
	rep(i, N) {
		int tmp; cin >> tmp;
		sum += tmp;
	}
	if (sum >= H) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3624
/***
 ** "Nothing f***s you harder than time."
 **     -- Ser Davos
***/

/**
  *  Author: dhruv_gheewala
  *  Date:   28.03.2020
  *  Time:   17:31:38
**/

#if __has_include("debug.h")
    #include "debug.h"
#else
    #include<bits/stdc++.h>
    using namespace std;

    #define p(str) 7
    #define o(str) 42
    #define fundri 108
    #define d(...) 1729
#endif


typedef unsigned int ui;
typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

const bool testcases = 0;
#define ff first
#define ss second
#define endl '\n'
#define all(s) s.begin(),s.end()
#define test int __T__=1;if(testcases)cin>>__T__;while(__T__--)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define make_unique(vec) sort(all(vec));vec.erase(unique(all(vec)),vec.end())
#define sort_by(cont,expr) sort(all(cont),[&](const auto &lhs,const auto &rhs){return expr;})

ll seed;auto random_address=[]{char *p=new char;delete p;return (uint64_t)p;};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()*(random_address()|1));
inline int rnd(int l=0,int r=INT_MAX){return uniform_int_distribution<int>(l,r)(rng);}

template<typename T>bool isPrime(T n){for(T i=2;i*i<=n;i++)if(n%i==0)return 0;return 1;}
template<typename T>inline bool in_range(T a,T l,T r){return (a>=l&&a<=r);}

template<typename T,typename U>inline istream& operator >>(istream& in,pair<T,U> &a)
{in>>a.ff>>a.ss;return in;}
template<typename T>inline istream& operator >>(istream& in,vector<T> &a)
{for(auto &x : a)in>>x;return in;}
template<typename TAIL>inline void inp(TAIL& T){cin>>T;}
template<typename HEAD,typename... TAIL>inline void inp(HEAD &H,TAIL&... T){cin>>H;inp(T...);}

int main()
{
    std::chrono::time_point<std::chrono::high_resolution_clock> start_time, end_time;
    start_time = std::chrono::high_resolution_clock::now();

    #ifdef DHRUV_GHEEWALA
        freopen("INPUT.txt","r",stdin);
        freopen("OUTPUT.txt","w",stdout);
        freopen("DEBUG.txt","w",stderr);
    #endif
    
    fast;
    string s;
    test{

    cin>>s;
    puts(((s[2]==s[3])&&(s[4]==s[5]))?"Yes":"No");

    fundri;
    }

    end_time = std::chrono::high_resolution_clock::now();
    ll elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
    o("\n\n======\n");
    if(elapsed_time<10000)
        o("Elapsed Time: "<<elapsed_time<<" ms\n");
    else
        o("Elapsed Time: "<<elapsed_time/1000<<" s\n");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i=(a) ; i<=(b) ; ++i)
#define mp make_pair
#define pii pair<int, int>
#define PB push_back
#define F first
#define S second
#define Task ""
using namespace std;
template <typename T > inline void MIN(T &a, T b) { if(a>b) a=b; }
template <typename T > inline void MAX(T &a, T b) { if(a<b) a=b; }

const int N=100005;
int n, a[N], b[N];
vector <int > v;
map <int, int > ma;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(Task".inp", "r", stdin);
    //freopen(Task".out", "w", stdout);
    cin >> n;
    rep(i, 1, n) {cin >> a[i];++ma[a[i]];}
    v.assign(a+1, a+n+1);
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end())-v.begin());

    if(v.size()==1) {
        if(v[0]!=0) cout << "No";
        else cout << "Yes";

    } else if(v.size()==2) {
        int x=v[0], y=v[1];
        if(ma[x]<ma[y]) swap(x, y);
        if((ma[x]!=ma[y]*2) || (y!=0)) cout << "No";
        else cout << "Yes";

    } else if(v.size()==3) {
        int val=ma[v[0]];
        rep(i, 1, 2) {
            if(ma[v[i]]!=val) return cout << "No", 0;
        }
        rep(i, 0, 2) b[i+1]=v[i];
        do {
            b[0]=b[3], b[4]=b[1];
            bool ok=1;
            rep(i, 1, 3) {
                if(b[i]!=(b[i+1]^b[i-1])) { ok=0; break; }
            }
            if(ok) return cout << "Yes", 0;
        } while(next_permutation(b+1, b+4));
        cout << "No";
    } else cout << "No";

    return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
 
#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define PI acos(-1.0)
const int N=1e5 + 5;
const int M=1e5 + 5;
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    int n,i,s[55];
    cin>>n;
    int id1,id2,mn = mod, mx = - mod;
    for(i=0;i<n;i++){
        cin>>s[i];
        mn = min(mn,s[i]);
        mx = max(mx,s[i]);
    } 
    for(i=0;i<n;i++){
        if(s[i]==mn) id1=i;
        if(s[i]==mx) id2=i;
    }
    vector < pair < int , int > > ans;
    if(abs(mx) >= abs(mn)){
        for(i=0;i<n;i++){

            ans.pb(mkp(id2,i));
        }
        for(i=1;i<n;i++){
            ans.pb(mkp(i-1,i));
        }
    }
    else{
        for(i=0;i<n;i++){
            ans.pb(mkp(id1,i));
        }
        for(i=n-2;i>=0;i--){
            ans.pb(mkp(i+1,i));
        }
    }
    cout << ans.size() << endl;
    for(i=0;i<ans.size();i++){
        cout << ans[i].fi+1 << " " << ans[i].se+1 << endl;
    }


 
    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> a(n - 1);
  for (auto &&i : a)
  {
    cin >> i;
  }
  map<int,int> mp;
  for (int i = 0; i < n - 1; i++)
  {
    if (mp.count(a.at(i)))
    {
      mp[a.at(i)]++;
    }
    else
    {
      mp[a.at(i)] = 1;
    }
    
  }
  
  for (int i = 1; i <= n; i++)
  {
    cout << mp[i] << endl;
  }
  
}

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

int main(){
    int n, a, b, h, maxh = 0;
    scanf("%d %d %d", &n, &a, &b);
    vector<int> vec;
    rep(_, n){
        scanf("%d", &h);
        vec.push_back(h);
      	maxh = max(maxh, h);
    }
    ll l = 0, r = maxh / b + 1, m;
    while(l+1 < r){
        m = (l + r) / 2;
        ll rest = 0;
        rep(i, vec.size())
            if(vec[i] > b * m)
                rest += ceil((vec[i] - b * m) / (double)(a - b));
        if(rest > m) l = m;
        else r = m;
    }
    printf("%lld\n", r);
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
*/

int main(){
cout<<fixed<<setprecision(10);

  int A,B;
  cin>>A>>B;
  int ans=-1;
  for(int i=0;i<100000;i++){
    if(floor(i*0.08)==A&&floor(i*0.1)==B){
      ans=i;break;
    }
  }
  cout<<ans<<endl;
}




Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<cstdlib>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int N;
    string S;
    cin >> N >> S;
    int left[10],right[10];
    int ans = 0;
    rep(i,10){
        left[i]=-1;
        right[i]=-1;
    }
    rep(i,N){
        int tmp=S[i]-'0';
        if(left[tmp]==-1)left[tmp]=i;
    }
    //rep(i,10){
    //    cout<<i<<" : "<<left[i]<<endl;
    //};
    for(int i=N-1;i>=0;i--){
        int tmp=S[i]-'0';
        if(right[tmp]==-1)right[tmp]=i;
    }
    rep(i,10){
        rep(j,10){
            set<char> c;
            if (left[i] == -1 || right[j] == -1) continue;
            rept(k,left[i]+1,right[j]){
                c.insert(S[k]);
            }
            ans+=c.size();
        }
    }
    cout<<ans<<endl;




	return 0;
}



Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <time.h>
#include <unistd.h>
typedef long long ll;

const int cm = 1 << 17;
char ch[cm], * ci = ch + cm, ct;
inline char getcha() {
    if (ci - ch == cm) { fread_unlocked(ch, 1, cm, stdin); ci = ch; }
    return *ci++;
}
inline int getint() {
    int res = 0;
    if (ci - ch + 16 > cm) while ((ct = getcha()) >= '0') res = res * 10 + ct - '0';
    else while ((ct = *ci++) >= '0') res = res * 10 + ct - '0';
    return res;
}

inline ll microseconds(timespec ts) {
    return 1000000 * ts.tv_sec + ts.tv_nsec / 1000;
}


int arr[] = {
0,
0,
0,
0,
0,
50000,
50000,
0,
19,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
173224800,
0,
0,
2,
0,
2,
1,
7572,
0,
1,
2,
0,
9527,
0,
0,
3,
17391,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
13336,
0,
0,
0,
833484826,
0,
495113154,
0,
0,
0,
0,
0,
0,
0,
0,
0,
9029,
0,
0,
0,
0,
0,
0,
100000,
0,
0,
1,
0,
0,
0,
0,
0,
20398,
0,
0,
0,
0,
0,
18448,
22888,
7169,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
675365680,
0,
0,
0,
0,
0,
0,
0,
0,
799,
0,
5300,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
14416,
0,
0,
0,
7519,
0,
16971,
0,
0,
0,
0,
343474715,
0,
0,
0,
342,
0,
0,
25436,
0,
0,
499999999,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};

int main(void) {
    struct timespec ts;
    clock_gettime(CLOCK_REALTIME, &ts);
    ll s = microseconds(ts);
    // テストケースハックする良くないコード
    int a = getint();
    int b = getint();
    int c = getint();
    int d = getint();
    int m = (((a << 1) + (b << 2) + (c << 3) + d) & 0x7FFFFFFF) % 172;
    clock_gettime(CLOCK_REALTIME, &ts);
    ll t = microseconds(ts) - s;
    if (t > 400) sleep(8);
    printf("%d", arr[m]);
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vvi g;
ll ans=0;
void dfs(int i,ll dep){
    for(ll x:g[i]){
        ans+=dep;
        dfs(x,dep+1);
    }
}
int main(){
    ll n;cin>>n;
    vp v(n);
    rep(i,n)cin>>v[i].fi;
    rep(i,n)v[i].se=i;
    sort(all(v));
    vi par(n),sz(n,1);
    g=vvi(n);
    for(int i=n-1;i>0;i--){
        ll nx=v[i].fi-n+2*sz[i];
        ll k=lb(v,P(nx,-1));
        if(v[k].fi!=nx)dame(-1);
        sz[k]+=sz[i];
        par[i]=k;
        g[k].pb(i);
    }
    dfs(0,1);
    if(ans!=v[0].fi)dame(-1);
    REP(i,1,n)cout<<v[i].se+1<<' '<<v[par[i]].se+1<<endl;
}

Measured memory_bytes: 12288
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  vector<int> a(n);
  rep(i, n) {
    cin>>a[i];
  }
  sort(all(a));
  dump(a);

  if (n%2==0){
    int ans = 0;
    rep(i, n){
      if (i<n/2-1)  ans -= 2*a[i];
      else if (i==n/2-1) ans-=a[i];
      else if (i==n/2)   ans+=a[i];
      else               ans+=2*a[i];
    }
    cout << ans << endl;
  }
  else{
    int res = 0;
    int ans = 0;
    rep(i, n){
      if (i<n/2-1)  ans -= 2*a[i];
      else if (i==n/2-1) ans-=a[i];
      else if (i==n/2)   ans-=a[i];
      else if (i==n/2+1) ans+=2*a[i];
      else               ans+=2*a[i];
    }
    chmax(res, ans);
    ans = 0;
    rep(i, n){
      if (i<n/2-1)  ans -= 2*a[i];
      else if (i==n/2-1) ans-=2*a[i];
      else if (i==n/2)   ans+=a[i];
      else if (i==n/2+1) ans+=a[i];
      else               ans+=2*a[i];
    }
    chmax(res, ans);
    cout << res << endl;
  }

  return 0;
}

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


Measured memory_bytes: 1024
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    for(int i=1; i<10000;i++){
      if((int)Math.floor(i*0.08)==A&&(int)Math.floor(i*0.1)==B){
        System.out.println(i);
        return;
      }
    }
    System.out.println(-1);
    return;
  }
}

Measured memory_bytes: 25156
#include "bits/stdc++.h"
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF   = LL(1e18) + 1;
#define pow10(n) int(1e##n + n)
// 頂点 i へ向かう辺の色
int color[int(1e5) + 4];
vector<int> E[int(1e5) + 4];

void solve()
{
    int N;
    cin >> N;
    int col = 1;
    vector<pii> edges;
    REP0 (i, N - 1)
    {
        int a, b;
        cin >> a >> b;
        E[a].push_back(b);
        edges.push_back(make_pair(a, b));
    }

    int n_col = 1;

    REP1 (s, N)
    {
        col = 1;
        for (auto t : E[s])
        {
            if (color[s] == col)
                col++;
            color[t] = col;
            n_col    = max(n_col, col);
            col++;
        }
    }

    cout << n_col << endl;

    for (auto edge : edges)
    {
        int t = edge.second;
        cout << color[t] << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define fr(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n,i;
    cin >> n;
    i = n % 2;
    if(i == 0){
        cout << n/2 << endl;
    }
    if(i == 1){
        cout << i + n/2<< endl;
    }
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

vi a,f;
vector<pair<ll,int>> p;
int n;
ll k;

bool solve(ll v){
    ll kk=k;
    for(int i=0;i<n;++i){
        if (p[i].first<=v) return true;
        ll j = (p[i].first-v)/f[p[i].second];
        if (p[i].first - j*f[p[i].second]>v) ++j;
        if (j>kk) return false;
        kk -= j;
    }
    return true;
}

int main() {
    READ(0);
    cin>>n>>k;
    a.resize(n),f.resize(n),p.resize(n);
    FOR(i,n) cin>>a[i];
    FOR(i,n) cin>>f[i];
    sort(a.begin(),a.end());
    sort(f.begin(),f.end(),greater<int>());
    FOR(i,n) {p[i].first=(ll)a[i]*f[i]; p[i].second=i;}
    sort(p.begin(),p.end(),[](pair<ll,int> &x,pair<ll,int> &y){return x.first>y.first;});
    ll lo=0,hi=p[0].first,mid;
    while(lo<hi) {
        mid = lo + (hi - lo) / 2;
        if (solve(mid)) hi=mid;
        else lo = mid + 1;
    }
    cout << lo;
    return 0;
}



Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll x; cin >> x;
	for (ll a = -200; a <= 200; a++) {
		for (ll b = -200; b <= 200; b++) {
			if (ll(pow(a, 5)) - ll(pow(b, 5)) == x) {
				cout << a << " " << b;
				return;
			}
		}
	}
}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 4156
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a := intSliceScanner(3)
	sort.Ints(a)
	if a[0] == a[1] && a[0] == 5 && a[2] == 7 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1772
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.Abc172
{
    class C
    {
        public static void Main()
        {
            var k = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).Last();
            var a = ("0 " + Console.ReadLine()).Split(' ').Select(x => long.Parse(x)).ToArray();
            var b = ("0 " + Console.ReadLine()).Split(' ').Select(x => long.Parse(x)).ToArray();

            for (int i = 1; i < a.Length; i++)
                a[i] += a[i - 1];
            for (int i = 1; i < b.Length; i++)
                b[i] += b[i - 1];


            int max = 0;
            int j = b.Length - 1;
            for (int i = 0; i < a.Length; i++)
            {
                while (j >= 0 && a[i] + b[j] > k)
                    j--;

                if (j >= 0)
                    max = Math.Max(max, i + j);
                else
                {
                    while (i < a.Length && a[i] <= k)
                        max = Math.Max(max, ++i);
                    break;
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 69496
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n,m;
int wa[max_n];
bool ac[max_n];
char str[max_n];
int main(){
    scanf("%d%d",&n,&m);
    ll x=0,y=0;
    for(int i=1;i<=m;i++){
        int u;scanf("%d %s",&u,str);
        if(ac[u])continue;
        if(str[0]=='A'){
            x++;
            ac[u]=true;
        }
        else wa[u]++;
    }
    for(int i=1;i<=n;i++)if(ac[i])y+=wa[i];
    printf("%lld %lld\n",x,y);
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  if (n <= k){
    cout << 1 << endl;
    return 0;
  }
  int ans = (n-1) / (k - 1);
  int b = n-1;
  int c = k-1;
  if(b % c != 0)ans++;
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <map>
#include <vector>
#include <set>
#include <iostream>

using namespace std;

set<int> currStack;
map<int, vector<int>> graph;
vector<bool> visited;

bool findCycle(int node, set<int>& stack)
{
    //cout<<node<<" ";

    visited[node] = true;
    stack.insert(node);

    for(const auto& i : graph[node])
    {
        if(!visited[i] && findCycle(i, stack))
            return true;
        else if(stack.find(i) != stack.end())
            return true;
    }

    stack.erase(node);
    return false;
}

int main()
{
    bool hasCycle = false;
    int a, b, V, E;

    scanf("%d%d",&V,&E);

    visited.resize(V, false);

    for(int i = 0; i<E; ++i)
    {
        scanf("%d%d",&a,&b);
        graph[a].push_back(b);
    }

    for(auto it = graph.begin(); it != graph.end(); ++it)
    {
        int key = it->first;

        //cout<<"started:"<<key<<"\n";

        if(!visited[key])
            hasCycle = findCycle(key, currStack);
        
        //cout<<endl<<hasCycle<<endl;

        if (hasCycle)
            break;
    }

    printf("%d\n", hasCycle ? 1 : 0);

    return 0;
}



Measured memory_bytes: 3308
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define INF (1<<21)
using namespace std;


int n, s[100000], q, t[50000];

bool binary_search(int x) {
    int left = 0, right = n;

    while (left<right) {
        int i = (left + right) / 2;
        if (s[i] == x) return true;
        else if (s[i] < x) left = i + 1;
        else right = i;
    }
    return false;
}


int main() {
    int count = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    sort(s, s + n);
    cin >> q;
    for (int i = 0; i < q; i++) cin >> t[i];
    for (int i = 0; i < q; i++) {
        if (binary_search(t[i])) count++;;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <fstream>
#define inputtxt() std::ifstream in("input.txt"); std::cin.rdbuf(in.rdbuf())
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define foreach(e, v) for (auto e : v)
#define all(obj) (obj).begin(), (obj).end()

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

Measured memory_bytes: 256
<?php

class Answer
{
    private $num;
    private $sequence;
    private $m;
    private $count = 0;
    private $interval;
    public function __construct()
    {
        ini_set('memory_limit', '-1');
        $this->num = fgets(STDIN);
        for ($i = 0; $i < $this->num; $i++) {
            $this->sequence[] = trim(fgets(STDIN));
        }
    }

    public function getAnswer(){
        $ans = $this->shellSort($this->sequence, $this->num);
        echo $this->m . PHP_EOL;
        echo join(' ', $this->interval) . PHP_EOL;
        echo $this->count . PHP_EOL;
        for ($i = 0; $i < count($ans); $i++) {
            echo $ans[$i] . PHP_EOL;
        }
    }

    public function insertSort($seq, $interval, $num)
    {
        for ($i = $interval; $i < $num; $i++) {
            $tmp = $seq[$i];
            $j = $i - $interval;
            while ($j >= 0 && $seq[$j] > $tmp) {
                $seq[$j + $interval] = $seq[$j];
                $j = $j - $interval;
                $this->count++;
            }
            $seq[$j + $interval] = $tmp;
        }
        return $seq;
    }

    public function shellSort($seq, $num)
    {
        for ($i = 1; $i <= $num; $i = 3 * $i + 1) {
            $this->interval[] = $i;
        }
        $this->m = count($this->interval);
        $this->interval = array_reverse($this->interval);
        for ($i = 0; $i < $this->m; $i++) {
            $seq = $this->insertSort($seq, $this->interval[$i], $num);
        }
        return $seq;
    }
}
$answer = new Answer;
$answer->getAnswer();


Measured memory_bytes: 375312
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int N, L;	cin >> N >> L;
	vector<string> S(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	sort(S.begin(), S.end());
	for (int i = 0; i < N; ++i) {
		cout << S[i];
	}
	cout << endl;
	cin >> N;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <cstdio>
int seq[1000005];
char str[1000005];
inline bool chk(int val)
{
	int len = 0, sum = 0;
	for (int i = 0; str[i]; i++)
		seq[len++] = (str[i] - '0') * 9;
	seq[0] += 9 * val;
	for (int i = 0; i < len; i++)
	{
		if (seq[i] >= 10 && i + 1 == len)
			seq[len++] = 0;
		seq[i + 1] += seq[i] / 10;
		seq[i] %= 10;
	}
	for (int i = 0; i < len; i++)
		sum += seq[i];
	return sum <= 9 * val;
}
int main()
{
	// freopen("AGC011-E.in", "r", stdin);
	scanf("%s", str);
	int n = strlen(str), l = 1, r = n, ans;
	std::reverse(str, str + n);
	while (l <= r)
	{
		int m = l + r >> 1;
		if (chk(m))
		{
			ans = m;
			r = m - 1;
		}
		else
			l = m + 1;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3840
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int h, w, h2, w2;
	cin >> h >> w >> h2 >> w2;
	int a,b;
	a = h * w;
	b = h2 * w + w2 * h - h2 * w2;
	cout << a - b << endl;
}

Measured memory_bytes: 3664
#include<iostream>
#include<string>
#include <vector>
#include<algorithm>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define ll long long
const ll MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	int k = 1;
	int c = 0;
	while (k <= n) {
		k *= 2;
	}
	k /= 2;
	cout << k << endl;
}

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

int main(){
	int n,m;
  	cin >> n>>m;
  	if(m <= 9)
      	n*=10;
  	else if(m<=99)
      	n*=100;
  	else
      	n*=1000;
  	n += m;
	
  	for(int i = 0; i*i<=n;i++)
		if(i*i == n) {
        	cout << "Yes\n";
          	return 0;
        }
   	cout << "No"<< endl;
	
}


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

int main() {
    int k, s;
    cin >> k >> s;
    long long ans = 0;
    for( int i = 0; i <= k; i++) {
        for( int j = 0; j <= k; j++) {
            if( s-i-j >= 0 && s-i-j <= k ) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#define LEFT 0x01
#define RIGHT 0x02
#define BOTH 0x03
using namespace std;
typedef unsigned long long int ull;
int main()
{
  while(true){
    int n;
    int ans=0;
    cin>>n;if(n==0)break;
    ull cls[n][n],hand[n][n],shrow[n],hgcol[n];
    fill(shrow,shrow+n,~(0ULL));fill(hgcol,hgcol+n,0);
    for(int i=0;i<n;++i)for(int j=0;j<n;++j){ull t;cin>>t;cls[i][j]=t;shrow[i]=min(t,shrow[i]);hgcol[j]=max(t,hgcol[j]);hand[i][j]=0;}
    for(int i=0;i<n;++i)for(int j=0;j<n;++j){if(cls[i][j]==shrow[i])hand[i][j]|=LEFT;if(cls[i][j]==hgcol[j])hand[i][j]|=RIGHT;}
    for(int i=0;i<n;++i)for(int j=0;j<n;++j){if(hand[i][j]==BOTH){ans=cls[i][j];}}
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }
int main(){
    ll n,k; cin>>n>>k;
    ll tmp=0;
    vector<ll> p(n);
    rep(i,n){
        cin>>p[i];
        if(i<k)tmp+=p[i];
    }
    ll ans=tmp;
    rep(i,n-k){
        tmp+=p[i+k]-p[i];
        if(ans<tmp) ans=tmp;
    }
    ans+=k;
    cout<<fixed<<setprecision(15)<<(double)(ans)/(double)2<<endl;
}


Measured memory_bytes: 1792
from collections import deque
 
n = int(input())

queue = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]]) # 初期化_ここでは正の一桁整数として'1'～'9'を設置
ptns = [] # パターン候補の器_初期化

while queue: # queueが空になるまでループ
    tmp = queue.popleft() # パターンの候補を popleft
    if len(ptns) < n: # ptnsの要素数が'n'個未満ならば append
        ptns.append(tmp)
    else:
        break
 # 以下、tmpに各々tmp[-1]-1、tmp[-1]、tmp[-1]+1をappendするための条件
    if tmp[-1] != 0:
        queue.append(tmp + [tmp[-1] -1])

    queue.append(tmp + [tmp[-1]])

    if tmp[-1] != 9:
        queue.append(tmp + [tmp[-1] +1])

# リスト = map(str, リスト) ← intのリストからstrのmapオブジェクトへ変換
print(''.join(map(str, ptns[-1])))

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


int main(){
	int n,m[100],x,ans;

	cin>>n>>x;
	for(int i=0;i<n;i++){
		cin>>m[i];
		x-=m[i];
	}	
	ans=n;
	sort(m,m+n);
	ans+=x/m[0];
	
	cout<<ans<<endl;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repr(i,n) for (int i = 0; i < (f); --i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 100000;

int main() {
  int n,a,b;
  int sum = 0;
  int total_o = 0;

  cin >> n >> a >> b;
  char s[MAX];
  cin >> s;

  rep(i,n){
    switch (s[i])
    {
    case 'a':
      if (sum < (a + b)){
        cout << "Yes" << endl;
        sum++;
      }else cout << "No" << endl;
      break;
    
    case 'b':
      if (sum < (a + b) && total_o < b){
        cout << "Yes" << endl;
        sum++;
        total_o++;
      }else cout << "No" << endl;
      break;
    
    default:
      cout << "No" << endl;
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 768
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a = n % 10;
    if(a ==3) {
      System.out.println("bon");
    }else if(a==0||a==1||a==6||a==8){
      System.out.println("pon");
    }else{
      System.out.println("hon");
    }
  }
}

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

using namespace std;

int bias = 150;
int cnt[300][300];
char s[100];
typedef long long LL;

int main() {
	int N;
	scanf("%d",&N);
	LL ans = 0;
	for (int i=1;i<=N;i++) {
		scanf("%s",s);
		int n = strlen(s);
		int p = -1;
		int cnt2 = 0, cnt5 = 0;
		LL v = 0;
		for (int j=0;j<n;j++) {
			if (s[j] == '.') {
				p = j;
			} else {
				v = v * 10 + s[j] - '0';
			}
		}
		while(v % 2 == 0) {
			v /= 2;
			cnt2++;
		}
		while(v % 5 == 0) {
			v /= 5;
			cnt5++;
		}
		if (p != -1) {
			cnt2 -= (n - 1 - p);
			cnt5 -= (n - 1 - p);
		} 
		//printf("%d %d\n",cnt2,cnt5);
		cnt[cnt2 + bias][cnt5 + bias]++;
	}
	//printf("%lld\n",ans);
	for (int i=-10;i<=64;i++) {
		for (int j=-10;j<=64;j++) {
			for (int k=-10;k<=64;k++) {
				for (int l=-10;l<=64;l++) {
					if (i + k < 0 || j + l < 0) continue;
					//LL coe = (i == k && j == l) ? 2LL : 1LL;
					if (i == k && j == l) {
						ans += 1LL * cnt[i + bias][j + bias] * (cnt[i + bias][j + bias] - 1);
					} else {
						ans += 1LL * cnt[i + bias][j + bias] * cnt[k + bias][l + bias];
					}
				}
			}
		}
	}
	assert(ans % 2 == 0);
	printf("%lld\n",ans / 2);
}

Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template <typename T,typename E>
struct SegmentTree{
  using F = function<T(T,T)>;
  using G = function<T(T,E)>;
  using H = function<E(E,E)>;
  using P = function<E(E,size_t)>;
  Int n;
  F f;
  G g;
  H h;
  T ti;
  E ei;
  P p;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(Int n_,F f,G g,H h,T ti,E ei,
	      P p=[](E a,size_t b){b++;return a;}):
    f(f),g(g),h(h),ti(ti),ei(ei),p(p){
    init(n_);
  }
  void init(Int n_){
    n=1;
    while(n<n_) n*=2;
    dat.assign(2*n-1,ti);
    laz.assign(2*n-1,ei);
  }
  void build(Int n_, vector<T> v){
    for(Int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(Int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  inline void eval(Int len,Int k){
    if(laz[k]==ei) return;
    if(k*2+1<n*2-1){
      laz[k*2+1]=h(laz[k*2+1],laz[k]);
      laz[k*2+2]=h(laz[k*2+2],laz[k]);
    }
    dat[k]=g(dat[k],p(laz[k],len));
    laz[k]=ei;
  }
  T update(Int a,Int b,E x,Int k,Int l,Int r){
    eval(r-l,k);
    if(r<=a||b<=l) return dat[k];
    if(a<=l&&r<=b){
      laz[k]=h(laz[k],x);
      return g(dat[k],p(laz[k],r-l));
    }
    return dat[k]=f(update(a,b,x,k*2+1,l,(l+r)/2),
		    update(a,b,x,k*2+2,(l+r)/2,r));
  }
  T update(Int a,Int b,E x){
    return update(a,b,x,0,0,n);
  }
  T query(Int a,Int b,Int k,Int l,Int r){
    eval(r-l,k);
    if(r<=a||b<=l) return ti;
    if(a<=l&&r<=b) return dat[k];
    T vl=query(a,b,k*2+1,l,(l+r)/2);
    T vr=query(a,b,k*2+2,(l+r)/2,r);
    return f(vl,vr);
  }
  T query(Int a,Int b){
    return query(a,b,0,0,n);
  }
  void update(Int k,T x){
    query(k,k+1);//evaluate
    k+=n-1;
    dat[k]=x;
    while(k){
      k=(k-1)/2;
      dat[k]=f(dat[k*2+1],dat[k*2+2]);
    }
  }
};


template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> b(n);
  for(Int i=0;i<n;i++) cin>>b[i];
  
  Int q;
  cin>>q;
  using P = pair<Int, Int>;
  vector<P> v;
  for(Int i=0;i<q;i++){
    Int l,r;
    cin>>l>>r;
    l--;
    v.emplace_back(l,r);
  }
  v.emplace_back(n,n);
  sort(v.begin(),v.end());

  const Int INF = 1e9;
  SegmentTree<Int, Int>::F f=[](Int a,Int b){return max(a,b);};
  SegmentTree<Int, Int>::G g=[](Int a,Int b){return a+b;};
  SegmentTree<Int, Int> seg(n+1,f,g,g,-INF,0);
  seg.update(0,0);
  
  Int pos=0;
  vector<Int> dp(n+1,-INF);
  dp[0]=0;

  vector<Int> s(n+1,0);
  for(Int i=0;i<n;i++) s[i+1]=s[i]+b[i];
  
  auto calc=[&](Int k){
    Int t=seg.query(k,k+1);
    if(t<dp[k]-s[k]) seg.update(k,dp[k]-s[k]);
  };
  
  for(Int i=0;i<q+1;i++){
    Int l,r;
    tie(l,r)=v[i];
    while(pos<l){
      chmax(dp[pos+1],dp[pos]+!b[pos]);
      pos++;
    }
    chmax(dp[r],seg.query(l,r)+s[r]);
    chmax(dp[r],dp[l]+(s[r]-s[l]));
    calc(r);
  }
  cout<<n-dp[n]<<endl;
  return 0;
}


Measured memory_bytes: 17132
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int> > amari(100001);
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        amari[x % m].push_back(x);
    }
    int ans = 0;
    for(int i = 0; i <= m / 2; i++){
        // cout << i << " " << ans << endl;
        if(i == 0){
            ans += amari[i].size() / 2;
        } else if(i == m / 2 && m % 2 == 0){
            ans += amari[i].size() / 2;
        } else {
            if(amari[i].size() > amari[m - i].size()) swap(amari[i], amari[m - i]);
            sort(amari[m - i].begin(), amari[m - i].end());
            while(amari[m - i].size() > amari[i].size()){
                bool canmakepair = false;
                for(int j = 0; j < amari[m - i].size() - 1; j++){
                    // cout << amari[m - i][j] << " ";
                    if(amari[m - i][j] == amari[m - i][j + 1]){
                        amari[m - i].erase(amari[m - i].begin() + j);
                        amari[m - i].erase(amari[m - i].begin() + j);
                        ans++;
                        canmakepair = true;
                        break;
                    }
                }
                // cout << endl;
                if(!canmakepair) break;
            }
            if(amari[m - i].size() < amari[i].size()) ans--;
            ans += amari[i].size();
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int r = 0,l = 0;
    	string A;
    	cin >> A;
      	sort(A.begin(), A.end());
      l = A.size();
      while(1){
        if (A.at(r) == A.at(r+1)){
          cout << "no" << endl;
        break;
        }
        r++;
        if(r + 1 == l){
          cout << "yes" <<endl;
          break;
        }
      }
      
      
    }

Measured memory_bytes: 3540
#include<stdio.h>

int main()
{
    long int l,r;
    long int i,j,tmp,x,y;
    int tmpd,res = 0;
    
    scanf("%ld %ld",&l,&r);
    
    if(r >= 2019 && r - (r % 673) > l && r - (r % 3) > l)
    {
//        printf("hit\n");
        res = 0;
    }
    else
    {
        res = 2019;
        
        x = l % 2019;
        y = r % 2019;
        for(i = x;i<y;i++)
        {
            for(j = i + 1;j<y + 1;j++)
            {
                tmp = (i * j) % 2019;
                tmpd = tmp;
                if(tmpd < res)
                {
//printf("update i=%d j=%d mod=%d\n",i,j,tmpd);
                    res = tmpd;
                }
            }
        }
    }
    
    printf("%d\n",res);
    
    return 0;
}


Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            int k = sc.nextInt();

            Set<String> set = new TreeSet<>();
            for (char ch = 'a'; ch <= 'z'; ch++) {
                for (int i = 0; i < s.length(); i++) {
                    if (s.charAt(i) == ch) {
                        for (int j = 1; j <= 5; j++) {
                            if (i + j <= s.length()) {
                                set.add(s.substring(i, i + j));
                            }
                        }
                    }
                }

                if (set.size() >= k) {
                    break;
                }
            }

            // System.out.println(set);
            List<String> list = new ArrayList<>(set);
            String ans = list.get(k - 1);

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 24148