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

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    VI L(N);
    REP(i, N) {
        cin >> L[i];
    }
    int ans = 1;
    int d = 0;
    REP(i, N) {
        if (d + L[i] <= X) {
            ans++;
            d += L[i];
        } else {
            break;
        }
    }
    cout << ans << ln;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
#define fi first
#define se second
//#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef vector<ll> vi;
typedef pair<int,int> P;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define abs(x) ((x)>0?(x):-(x))
#define y1 hhf
#define mp make_pair
const int maxn = 5000;
int n;
vi e[maxn];
int ncnt;
int k;
int u,v,w;
int vis[maxn],cnt,d[maxn];
void dfs(int u){
	vis[u]=1;
	if(d[u]<=k&&u<=n) cnt++;
	for(int i=0;i<e[u].size();i++){
		if(vis[e[u][i]]) continue;
		v=e[u][i];
		d[v]=d[u]+1;
		dfs(v);
	}
}
void addedge(int u,int v){
	e[u].pb(v);
	e[v].pb(u);
}
int main(){
	cin>>n>>k;
	ncnt=n;
	for(int i=0;i<n-1;i++){
		cin>>u>>v;
		ncnt++;
		addedge(u,ncnt);
		addedge(v,ncnt);
	}
	int ans=0x3f3f3f3f;
	for(int i=1;i<=ncnt;i++){
		memset(vis,0,sizeof vis);
		cnt=0;
		d[i]=0;
		dfs(i);
		//cout<<cnt<<endl;
		ans=min(ans,(n-cnt));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
long long knap(long long w[],long long v[],int i,long long n,long long W)
{
   	if(i>n || W<=0)
    return 0;
  if(dp[i][W]!=-1)
    return dp[i][W];
  if(w[i]>W)
		return dp[i][W]=knap(w,v,i+1,n,W);
  return dp[i][W]=max(v[i]+knap(w,v,i+1,n,W-w[i]),knap(w,v,i+1,n,W));
}  

int main()
{
  long long n;
  long long W;
  cin>>n>>W;
  long long v[n],w[n];
  for(int i=0;i<n;i++)
  {
      cin>>w[i]>>v[i];
  }
  memset(dp,-1,sizeof(dp));
    cout<<knap(w,v,0,n-1,W)<<endl;
}


Measured memory_bytes: 82304
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>

using ll = long long;
typedef std::pair<int, int>p;

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll 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;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = true;
struct edge { int to, cost; };
std::vector<edge>v[100];
bool used[210];

int main() {
	ll n, a[300010], ans = 0;
	std::cin >> n;
	for (int i = 0;i < 3 * n;i++) {
		std::cin >> a[i];
	}
	std::sort(a, a + n * 3);
	int l = 0, r = 3 * n - 1;
	while (l < r) {
		ans += a[r - 1];
		r -= 2;
		l++;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int ans;

    if(N <=1 && M <=1 ) ans = 0;
    ans = N * (N -1)/2 + M * (M-1)/2;


    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5100000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  string s; cin >> s;
  int ans = 0;
  int n = s.size();
  rep(i,n/2) {
    if(s[i] != s[n-1-i]) ans++;
  }
  cout << ans << endl;
}


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

#define debug(x) cout << (#x) << " is " << x << endl;
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef unsigned long long int lli;
typedef pair<int, int> pi;


int main()
{
    int n;
    lli k, mod = 1e9+7;
    cin >> n >> k;
    int a[n];
    for(auto &x: a) cin >> x;
    
    lli ans = 0;
    for(int i=0; i<n; i++){
		lli cc=0;
		for(int j=i+1; j<n; j++){
			cc += (a[j] < a[i]);
		}
		lli cnt = ((k*(k+1))/2)%mod;
		cnt = (cnt*cc)%mod;
		ans = (ans+cnt)%mod;
		cc = 0;
		for(int j=i-1; j>=0; j--) cc += (a[j] < a[i]);
		cnt = ((k*(k-1))/2)%mod;
		cnt = (cnt*cc)%mod;
		ans = (ans+cnt)%mod;
	}
	cout << ans << endl;
 
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll, ll> lltpl;



/******************************************************************************************/


const int IINF = 1e9 + 7;
const ll LINF = 1e18 + 7;
const ll MOD = 1e9 + 7;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


//約数の列挙
template<typename T>
vector<T> divisor(T n) {
	vector<T> res;
	for (T i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			res.push_back(i);
			if (i != n / i) {
				res.push_back(n / i);
			}
		}
	}
	return res;
}


//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}

/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return x * y / tmp;
}

//素数判定
bool is_prime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return n != 1;//1の場合は除外
}


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll A, B;
	cin >> A >> B;

	vector<ll> hoge = divisor(A);
	vector<ll> hoge2 = divisor(B);
	
	set<ll> st1, st2;
	for (int i = 0; i < hoge.size(); i++)
	{
		st1.insert(hoge[i]);
	}
	for (int i = 0; i < hoge2.size(); i++)
	{
		st1.insert(hoge2[i]);
	}

	vector<ll> v;
	for (auto itr : st1) {
		if (A % itr == 0 && B % itr == 0) {
			v.push_back(itr);
		}
	}

	ll ans = 1;

	

	for (int i = 0; i < v.size(); i++)
	{
		if (is_prime(v[i])) {
			ans++;
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
int a[NN]={};
int xt[NN][3]={};
char in[NN]={};
LL dp[NN]={};
const int mod=1e9+7;
inline LL upd(LL &x,LL y){
	x=(x+y>=mod?x+y-mod:x+y);
}
int main(){
	//open();
	scanf("%s",in+1);
	n=strlen(in+1);
	bool fl=0;
	for(int i=1;i<=n;++i){
		a[i]=(in[i]=='a'?1:2);
		if(a[i]==a[i-1])fl=1;
	}
	for(int i=1;i<=n;++i){
		(a[i]+=a[i-1])%=3;
	}
	if(!fl){
		printf("1\n");
		return 0;
	}
	xt[n][0]=n+1;
	xt[n][1]=n+1;
	xt[n][2]=n+1;
	for(int i=n-1;i>=0;--i){
		for(int j=0;j<3;++j){
			xt[i][j]=xt[i+1][j];
		}
		xt[i][a[i+1]]=i+1;
	}
	dp[0]=1;
	for(int i=0;i<n;++i){
		for(int j=0;j<3;++j){
			if(j!=a[i]){
				upd(dp[xt[i][j]],dp[i]);
			}
		}
	}
	LL ans=0;
	for(int i=1;i<=n;++i){
		if(a[i]==a[n])upd(ans,dp[i]);
	}
	printf("%lld\n",ans);
	close();
	return 0;
}

Measured memory_bytes: 2688
#-------------
s = input()
#-------------
if len(s) <= 2:
  print(s[0])

else:
  N = len(s)//2
  q = 0
  if N%2 == 1:
    q=1
  Odd = []
  for i in range(N+q):
    Odd.append(s[2*i])
  Odd = "".join(Odd)
  print(Odd)

Measured memory_bytes: 9204
#include <algorithm> 
#include <functional>
#include <iostream>

using namespace std; 
  
int main() 
{ 
    int N;
    cin>>N;
    int L[2*N];
    for (int i=0;i<2*N; i++ ) {
        cin>>L[i];
    }
    int n = sizeof(L)/sizeof(L[0]); 
  
    sort(L, L+n, greater<int>()); 
    int result = 0;
    
    for (int i = 0; i < n; ++i)  {
        if ( ( i + 1 ) % 2  == 0 ) {
            result += L[i];
        }
    }
    cout<<result;
    return 0; 
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll n;
  cin >> n;
  vector<ll> A(n);
  for (auto& _a : A) cin >> _a;
  ll max_height = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += max(0LL, max_height - A[i]);
    max_height = max(max_height, A[i]);
  }
  cout << ans << endl;

}


Measured memory_bytes: 4764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >>s;
    int c=1;
   for(int i=0;i<s.length();i++)
   {
       if(i%2==0&&s[i]=='L')
       {
           c=0;
           cout <<"No"<<endl;
           break;
       }
       if(i%2!=0&&s[i]=='R')
       {
           c=0;
           cout <<"No"<<endl;
           break;
       }
   }
   if(c==1)
   {
       cout <<"Yes"<<endl;
   }
}


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


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

int gcd(int a, int b){
    if(a % b == 0) return b;
    else return (gcd(b, a%b));
}


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c < 22)cout << "win" << endl;
    else cout << "bust" << endl;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int A, B, C, D; cin >> A >> B >> C >> D;
    int ans = min(A, B) + min(C, D);
    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define INF (1LL<<60)

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	string s;
	while(cin>>N) {
		ll ans = 0;
		RANGE(a, 1, N+1)RANGE(b, 1, N+1)RANGE(c, 1, N+1) {
			ans += gcd(a, gcd(b, c));
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3196
N = int(input())
cnt =0
for i in range(1,N+1):
    if 1 <= i and i <= 9:
        cnt += 1
    
    if 100 <= i and i <= 999:
        cnt += 1

    if 10000 <= i and i <= 99999:
        cnt += 1

print(cnt)

Measured memory_bytes: 3064
#!/usr/bin/env python3
# N = int(input())
S = input()
# N, A, B = map(int, input().split())
# A = list(map(int, input().split()))

for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        print("Bad")
        break
else:
    print("Good")

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
    int n,i;
    char str[100];
    
    scanf("%d",&n);
    scanf("%s",str);
    
    if (n%2==1) {
        printf("No\n");
        return 0;
    } else {
        for (i=0;i<(n/2);i++) {
            if (str[i]!=str[i+n/2]) {
                printf("No\n");
                return 0;
            }
        }
    }
    
    printf("Yes\n");
    
    return 0;
    
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
# define ALL(x) (x).begin(), (x).end()
using namespace std;
int main()
{
    int N,a,b;
  cin>>N;
  a=N%100;
  b=a%10;
  if(b==2||b==4||b==5||b==7||b==9){cout<<"hon"<<endl;}
 else if(b==0||b==1||b==6||b==8){cout<<"pon"<<endl;}
  else if(b==3){cout<<"bon"<<endl;}
}

Measured memory_bytes: 3636
# AtCoder Beginner Contest 067
# D - Fennec VS. Snuke
# https://atcoder.jp/contests/abc067/tasks/arc078_b
import sys
from collections import deque

input = sys.stdin.readline
N = int(input())
G = [[] for _ in [0]*N]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

# bfs
def bfs(s):
    q = deque()
    q.append(s)
    D = [0]*N
    visited = [False]*N
    while q:
        v = q.popleft()
        visited[v] = True
        d = D[v]

        for u in G[v]:
            if visited[u]:
                continue
            D[u] = d+1
            q.append(u)

    return D


Df = bfs(0)
Ds = bfs(N-1)

cnt_f = 0
cnt_s = 0
for df, ds in zip(Df, Ds):
    if df <= ds:
        cnt_f += 1
    else:
        cnt_s += 1

print('Fennec' if cnt_f > cnt_s else 'Snuke')


Measured memory_bytes: 30188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
//using static Util;
class Program
{
    static int S;
    static void INPUT()
    {
        S = NextInt();
    }
    static void OUT()
    {
        var a = 0L;
        for (var n = 1; n <= S; n++)
        {
            if (n % 3 != 0 && n % 5 != 0)
            {
                a += n;
            }
        }

        Console.WriteLine(a);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
}




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

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

    if(S=="AAA" || S=="BBB"){
        cout << "No";
    }else {
        cout << "Yes";
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

int main()
{
  char s[11];
  scanf("%s",s);
  int n=strlen(s);
  long long ans=0ll;
  for(int I=0;I<1<<(n-1);I++){
    long long A=0ll,B=0ll;
    for(int i=0;i<n;i++){
      if(i>0&&((I>>(i-1))&1)){
	A+=B;
	B=s[i]-'0';
      }
      else{
	B*=10;
	B+=s[i]-'0';
      }
    }
    A+=B;
    ans+=A;
  }
  printf("%lld\n",ans);
  return 0;
}


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define cutiii(a,b,c) cout << a << " " << b << " " << c << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef long long LL;
typedef pair<int ,int > pii;
typedef pair<string ,int > psi;
typedef pair<string ,string > pss;
typedef pair<LL, LL> pLL;

const long long oo = 1e9 + 7;
const double PI = acos(-1.0);

double DEG_to_RAD(double d) { return d * PI / 180.0; }

string s,t;
vector<char > sp,tp;

int main(){
    //freopen("test.txt","r",stdin);
    cin >> s >> t;
    for (int i = 0 ; i < s.size() ; i++) {
        sp.pb(s[i]);
    }
    for (int i = 0 ; i < t.size() ; i++) {
        tp.pb(t[i]);
    }
    int check = 0;
    sort(sp.begin(),sp.end());
    sort(tp.rbegin(),tp.rend());
    for (int i = 0 ; i < min(sp.size(), tp.size()); i++) {
        if ( tp[i] < sp[i] ) {
            check = 1;
            break;
        }
        if ( sp[i] < tp[i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if ( !check) {
        if ( sp.size() < tp.size() ) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String target = sc.next();
		String test = sc.next();
		int idx = 0;
		StringBuilder sb = new StringBuilder();
		while ((idx = target.indexOf(test, idx)) != -1) {
		    sb.append(idx).append("\n");
		    idx++;
		}
		System.out.print(sb);
	}
}



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

using namespace std;

const int mod=1e9+7;

int main()
{
    int n; cin>>n;
    int k; cin>>k;
    vector<int> dp(k+1,0);
    dp[0]=1;
    for(int i=0;i<n;i++)
    {
        int a; cin>>a;
        vector<int> dodaj(k+1,0);
        for(int j=k;j>=0;j--)
        {
            int tmp=dp[j];
            int L=j+1;
            int R=j+min(a,k-j);
            if(L<=R)
            {
                dodaj[L]+=tmp;
                if(dodaj[L]>=mod) dodaj[L]-=mod;
                if(R+1<=k)
                {
                    dodaj[R+1]-=tmp;
                    if(dodaj[R+1]<0) dodaj[R+1]+=mod;
                }
            }
        }
        int sum=0;
        for(int j=0;j<=k;j++)
        {
            sum+=dodaj[j];
            if(sum>=mod) sum-=mod;
            dp[j]+=sum;
            if(dp[j]>=mod) dp[j]-=mod;
        }
    }
    cout<<dp[k];
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

using namespace std;

int minimum,min_past_num,num_ticket,num_town,m,start,goal;


struct Info{
    Info(){
        current_town = 0;
        index = 0;
    }
    bool visited[102];
    int current_town,index,costs[102],visited_town[101];
};

struct Data{
	Data(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	int to,cost;
};

vector<Data> V[101];

void func(Info info){

    int sum = 0,limit;

    if(info.current_town == goal || minimum != 2000000000)
    {

    	limit = min(num_ticket,info.index);

    	for(int i = 0; i < limit; i++){
    		sum += info.costs[i]/2;
    	}

    	for(int i = limit; i < info.index; i++){
    		sum += info.costs[i];
    	}

		if(info.current_town == goal){
			minimum = min(minimum,sum);
			return;
		}else{
			if(sum >= minimum){
				return;
			}
		}

    }

    int calc;
    for(int i = 0; i < V[info.current_town].size(); i++){
        if(info.visited[V[info.current_town][i].to] == false){
            Info new_info;
            for(int k = 1; k <= num_town; k++)new_info.visited[k] = info.visited[k];
            new_info.visited[V[info.current_town][i].to] = true;
            new_info.current_town = V[info.current_town][i].to;

            if(info.index == 0 || V[info.current_town][i].cost > info.costs[0]){
            	new_info.costs[0] = V[info.current_town][i].cost;
            	for(int k = 1; k <= info.index; k++){
            		new_info.costs[k] = info.costs[k-1];
            	}
            }else if(V[info.current_town][i].cost <= info.costs[info.index-1]){
            	for(int k = 0; k < info.index; k++){
            		new_info.costs[k] = info.costs[k];
            	}
            	new_info.costs[info.index] = V[info.current_town][i].cost;
            }else{
            	for(calc = 0; info.costs[calc] >= V[info.current_town][i].cost;calc++)new_info.costs[calc] = info.costs[calc];
				new_info.costs[calc] = V[info.current_town][i].cost;
				calc++;
				for(;calc-1 < info.index;calc++)new_info.costs[calc] = info.costs[calc-1];
            }
            new_info.index = info.index+1;
            func(new_info);

        }
    }
}

int main(){

    int from,to,fee;

    while(true){
        scanf("%d %d %d %d %d",&num_ticket,&num_town,&m,&start,&goal);
        if(num_ticket == 0 && num_town == 0 && m == 0 && start == 0 && goal == 0)break;

        minimum = 2000000000;

        for(int i = 1; i <= num_town; i++)V[i].clear();

        for(int i = 0; i < m; i++){
            scanf("%d %d %d",&from,&to,&fee);

            V[from].push_back(Data(to,fee));
            V[to].push_back(Data(from,fee));
        }

        Info info;
        for(int i = 1; i <= num_town;i++)info.visited[i] = false;

        info.current_town = start;
        info.visited[start] = true;

        func(info);

        printf("%d\n",minimum);
    }


    return 0;
}

Measured memory_bytes: 2900
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        final String line = readLine();
        System.out.println(calc(line));
    }

    protected static String calc(String input) {
        final int[] intArray = split(input);

        Arrays.sort(intArray);

        StringBuffer sb = new StringBuffer();

        for (int i : intArray) {
            if (sb.length() > 0) {
                sb.append(' ');
            }
            sb.append(i);
        }

        return sb.toString();
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ints = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ints[i] = Integer.parseInt(s0[i]);
        }

        return ints;
    }

    private static String readLine() {
        java.util.Scanner s = null;
        try {
            s = new java.util.Scanner(System.in);
            return s.nextLine();
        } finally {
            if (s != null) {
                s.close();
            }
        }
    }
}

Measured memory_bytes: 17280
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;

int main() {
	int k,x;
	cin >> k >> x;
	rep(i, k + k - 1) {
		cout << x - k + 1 + i << " ";
	}
}


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

int main() {
	int n, x, y,a[2000],dis,min;
	int i, j;
	cin >> n >> x >> y;
	for (i = 0; i < 2000; i++)a[i] = 0;
	for (i = 1; i < n;i++) {
		for (j = i+1; j <= n;j++) {
			min = fabs(x - i) + fabs(y - j)+1;
			dis = j - i;
			if (dis < min)min = dis;
			a[min]++;
		}
	}
	for (i = 1; i < n; i++)cout << a[i] << endl;
}

Measured memory_bytes: 256
N,X=map(int, input().split())
x=list(map(int, input().split()))
 
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

x.append(X)
x.sort()
 
ans=x[1]-x[0]
 
for i in range(N):
    ans=gcd(ans,x[i+1]-x[i])

print(ans)

Measured memory_bytes: 15020
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"YES"<<endl
#define prN         cout<<"NO"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	pr(n*n);
	
	
	
	
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

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

long long gcd(long long x, long long y){
	if(y > x) swap(x, y);
	return !y ? x : gcd(y, x % y);
}

long long lcm(long long x, long long y){
	return x / gcd(x, y) * y;
}

int main() {
	int n;
	cin >> n;
	long long t[n] = {0};
	for(int i = 0; i < n; i++) cin >> t[i];
	
	long long ans = t[0];
	for(int i = 1; i < n; i++){
		ans = lcm(ans, t[i]);
	}
	
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;

int main(void) {
	long long N; cin >> N;
	vector<long long> A(N), B(N), C(N);

	for (int i = 0; i < N; i++) cin >> A[i];
	for (int i = 0; i < N; i++) cin >> B[i];
	for (int i = 0; i < N; i++) cin >> C[i];

	sort(A.begin(), A.end());
	sort(C.begin(), C.end());

	long long res = 0;
	for (int i = 0; i < N; i++) {
		long long up = lower_bound(A.begin(), A.end(), B[i]) - A.begin();
		long long low = C.end() - upper_bound(C.begin(), C.end(), B[i]);
		res += up * low;
	}
	cout << res << endl;

}

Measured memory_bytes: 2688
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		List<Obj> list = new ArrayList<>();
		for (int i = 0; i < m; i++) {
			list.add(new Obj(sc.nextInt(), sc.nextInt()));
		}

		int max = (int) Math.pow(10, n) - 1;
		for (int i = 0; i <= max; i++) {
			int num = i;

			if (Integer.toString(i).length() != n) {
				continue;
			}

			int[] nums = new int[n];
			for (int j = 0; j < n; j++) {
				nums[n - j - 1] = num % 10;
				num = num / 10;
			}

			boolean temp = true;
			for (Obj o : list) {
				temp = temp && nums[o.k - 1] == o.v;
			}
			if (temp) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}

	private static class Obj {
		public Integer k;
		public Integer v;

		public Obj(Integer k, Integer v) {
			this.k = k;
			this.v = v;
		}
	}
}


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

template<typename T, typename E> class SegmentTree {
public:
  typedef function<T (T, T)> Operator;
  typedef function<T (T, E)> Apply;

  vector<T> data;
  ll n;
  T e;
  Operator op;
  Apply apply;

  SegmentTree(ll _n, T e, Operator op, Apply apply): e(e), op(op), apply(apply) {
    for(n = 1; n < _n; n *= 2);
    data.resize(n * 2 - 1, e);
  }

  SegmentTree(const vector<T> &vec, T e, Operator op, Apply apply): e(e), op(op), apply(apply) {
    for(n = 1; n < vec.size(); n *= 2);
    data.resize(n * 2 - 1, e);
    REP(i, 0, vec.size()) data[i + n - 1] = vec[i];
    for(ll i = n - 2; i >= 0; i--) data[i] = op(data[i * 2 + 1], data[i * 2 + 2]);
  }

  T query(ll a, ll b) { return query(a, b, 0, 0, n); }
  T query(ll a, ll b, ll k, ll l, ll r) {
    if(r <= a || b <= l) return e;
    if(a <= l && r <= b) return data[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 op(vl, vr);
  }

  void update(ll k, E x) {
    k += n - 1;
    data[k] = apply(data[k], x);
    while(k > 0) {
      k = (k - 1) / 2;
      data[k] = op(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
};

int main(void) {
  ll N, C;
  cin >> N >> C;
  vector<ll> X(N), V(N);
  REP(i, 0, N) cin >> X[i] >> V[i];

  vector<ll> sum1(N + 1, 0), sum2(N + 1, 0);
  REP(i, 0, N) sum1[i + 1] = sum1[i] + V[i];
  REP(i, 0, N) sum2[i + 1] = sum2[i] + V[N - i - 1];

  SegmentTree<ll, ll>::Operator op = [](ll a, ll b) { return max(a, b); };
  SegmentTree<ll, ll>::Apply apply = [](ll a, ll x) { return x; };
  SegmentTree<ll, ll> segtree1(N, -(1LL << 60), op, apply), segtree2(N, 0, op, apply);

  REP(i, 0, N) segtree1.update(i, sum1[i + 1] - X[i]);
  REP(i, 0, N) segtree2.update(i, sum2[i + 1] - (C - X[N - i - 1]));

  ll ans = 0;
  REP(i, 0, N) {
    ll t = sum1[i + 1] - X[i];
    ans = max(ans, t);
    ans = max(ans, t + segtree2.query(0, N - i - 1) - X[i]);
  }
  REP(i, 0, N) {
    ll t = sum2[i + 1] - (C - X[N - i - 1]);
    ans = max(ans, t);
    ans = max(ans, t + segtree1.query(0, N - i - 1) - (C - X[N - i - 1]));
  }
  cout << ans << endl;
}


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

int main() {

  string S;
  cin >> S;

  int count = 0;
  string s_ = S;

  for (int i = 1; i < S.length(); i++) {
    
    s_ = s_.erase(s_.length() - 1);

    if (s_.length() % 2 == 0) {
      string s1_ = s_.substr(s_.length() / 2);
      string s2_ = s_.substr(0, s_.length() / 2);
      if (s1_ == s2_) {
        count = s_.length();
        break;
      }
    } else {
      continue;
    }

  }
  
  cout << count << endl;

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
////@formatter:on
//endregion


int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    make(int, n, k);
    makev(a, n);
    sort(ALL(a));
    int sm = 0;
    for(int i = 0; i + k < n; ++i){
        sm += a[i];
    }
    cout << sm;

    return 0;
}

Measured memory_bytes: 1792
def selection_sort(N, a):
    c = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            c += 1
    return a, c

ans, cnt = selection_sort(int(input()), [int(s) for s in input().split()])
print(' '.join(str(s) for s in ans), cnt, sep='\n')

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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 103;
const char *YES = "Possible" , *NO = "Impossible";

int n,val[_],cnt[_]={0};

int main()
{
	n=ty();
	for(int i=1;i<=n;i++)val[i]=ty(),cnt[val[i]]++;
	sort(val+1,val+n+1);

	int mi=val[1],mx=val[n];
	if(mi!=(mx+1)/2){puts(NO);return 0;}
	if(cnt[mi]!=1+(mx&1)){puts(NO);return 0;}
	for(int i=mi+1;i<=mx;i++)if(cnt[i]<2){puts(NO);return 0;}
	puts(YES);

	return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
p = []
for i in range(H):
    b = list(input())
    b.append(".")
    p.append(b)

p.append(["."] * (W + 1))
dp = [[10 ** 9] * (W + 1) for i in range(H + 1)]

if p[0][0] == ".":
    dp[0][0] = 0
else:
    dp[0][0] = 1

for i in range(H):
    for j in range(W):
        if p[i + 1][j] == ".":
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])
        elif p[i][j] == "#":
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])
        else:
            dp[i + 1][j] = min(dp[i][j] + 1, dp[i + 1][j])

        if p[i][j + 1] == ".":
            dp[i][j + 1] = min(dp[i][j], dp[i][j + 1])
        elif p[i][j] == "#":
            dp[i][j + 1] = min(dp[i][j], dp[i][j + 1])
        else:
            dp[i][j + 1] = min(dp[i][j] + 1, dp[i][j + 1])

print(dp[H - 1][W - 1])

Measured memory_bytes: 44400
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;

    vector<int> vec(n);
    for (int i = 0; i < n; i++) vec[i] = l + i;

    sort(vec.begin(), vec.end(), [](int i, int j){return abs(i) < abs(j);});

    int total = 0;
    for (int i = 1; i < n; i++) total += vec[i];
    
    cout << total << endl;
}

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

int main() {
	string s;
	cin >> s;
	string output = "";
	for (int i = 0;i < s.size();++i) {
		if (s[i] == '0') {
			output += '0';
		}
		else if (s[i] == '1') {
			output += '1';
		}
		else {
			if (output.size() > 0) {
				output.pop_back();
			}
		}
	}
	cout << output << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;

/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){
  ////////////////////////////////////////
  /* 入力受け取り */
  ////////////////////////////////////////

  /* 縦と横の長さ */
  int height, width;
  cin >> height >> width;
  //cout << height << width << endl;

  /* 盤面 */
  vector<string> field(55);

  /* スタート地点とゴール地点 */
  int sx, sy, gx, gy;
  sx = 0;
  sy = 0;
  gx = height-1;
  gy = width-1;
  
  for (int h = 0; h < height; h++) cin >> field[h];


  ////////////////////////////////////////
  /* 幅優先探索の初期設定 */
  ////////////////////////////////////////

  // 各セルの最短距離 (訪れていないところは -1 としておく)
  vector<vector<int> > dist(55, vector<int>(55, -1)); 
  dist[sx][sy] = 0; // スタートを 0 に

  // 探索中に各マスはどのマスから来たのかを表す配列 (最短経路長を知るだけなら、これは不要)
  vector<vector<int> > prev_x(55, vector<int>(55, -1));
  vector<vector<int> > prev_y(55, vector<int>(55, -1));

  // 「一度見た頂点」のうち「まだ訪れていない頂点」を表すキュー
  queue<pair<int, int> > que; 
  que.push(make_pair(sx, sy)); // スタートを push


  ////////////////////////////////////////
  /* 幅優先探索を実施 */
  ///////////////////////////////////////    

  /* キューが空になるまで */
  while (!que.empty()) {
    pair<int, int> current_pos = que.front(); // キューの先頭を見る (C++ ではこれをしても pop しない)
    int x = current_pos.first;
    int y = current_pos.second;
    que.pop(); // キューから pop を忘れずに

    // 隣接頂点を探索
    for (int direction = 0; direction < 4; direction++) {
      int next_x = x + dx[direction];
      int next_y = y + dy[direction];
      if (next_x < 0 || next_x >= height || next_y < 0 || next_y >= width) continue; // 場外アウトならダメ
      if (field[next_x][next_y] == '#') continue; // 壁はダメ

      // まだ見ていない頂点なら push
      if(dist[next_x][next_y] == -1){
        que.push(make_pair(next_x, next_y));
        dist[next_x][next_y] = dist[x][y] + 1;
        prev_x[next_x][next_y] = x;
        prev_y[next_x][next_y] = y;
      }
    }
  }
  
  vector<string> field_tmp(55);
  field_tmp = field;
  for(int i=0;i<height;i++){
    for(int j=0;j<width;j++){
      field_tmp[i][j] = '#';
    }
  }
  
  int count = 0;
  int current_x, current_y;
  current_x = gx;
  current_y = gy;
  for(int i=0;i<dist[gx][gy];i++){
    int x_tmp = current_x;
    int y_tmp = current_y;
    field_tmp[current_x][current_y] = '.';
    current_x = prev_x[x_tmp][y_tmp];
    current_y = prev_y[x_tmp][y_tmp];
    //cout << current_x << " " << current_y << endl;
  }
  
  field_tmp[sx][sy] = '.';
  
  for(int i=0;i<height;i++){
    for(int j=0;j<width;j++){
      if(field[i][j] == '.' && field_tmp[i][j] == '#') count++;
    }
  }
  
  if(dist[gx][gy] == -1) cout << -1 << endl;
  else cout << count << endl;
  return 0;
}

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

int N;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
Graph g;
vector<int> color;

void dfs(int i, int c, int p) {
  color[i] = c;
  for (auto e: g[i]) {
    if (e.first == p) {
      continue;
    }
    if (e.second % 2 == 0) {
      dfs(e.first, c, i);
    } else {
      dfs(e.first, 1-c, i);
    }
  }
}

int main() {
  cin >> N;
  g.assign(N, vector<Edge>());
  for (int i = 0; i < N-1; i++) {
    int u, v, w;

    cin >> u >> v >> w;
    u--;
    v--;
    g[u].push_back(Edge(v, w));
    g[v].push_back(Edge(u, w));
  }

  color.assign(N, 0);
  dfs(0, 1, -1);
  for (auto c: color) {
    cout << c << endl;
  }

  return 0;
}

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

#define ll long long
#define mod 1000000007
#define pii pair<ll,ll>

#define debug(a) { cout << #a << " = " << a << endl;}

const int maxn = 1e5+1;
ll arr[maxn], n, m, t, k;
unordered_map<ll,ll> u;

ll __min(ll a, ll b) {
    return a < b ? a : b;
}

ll __max(ll a, ll b) {
    return a > b ? a : b;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
   
	ll n,x,t;
	cin>>n>>x>>t;

	ll ans=0;
	if (n <= x) {
		cout << t << "\n";
		return 0;
	}
	while (n>0) {
		ans+=t;
		n-=x;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 3608
import java.io.InputStreamReader;
import java.io.LineNumberReader;

public class Main {
	public static void main(String[] args) {

		try {
			LineNumberReader lineNumReader = new LineNumberReader(new InputStreamReader(System.in));
			String str = null;
			double  scores[] = null;
			int studentsNum = 0;

			while ((str = lineNumReader.readLine()) != null) {
				if (lineNumReader.getLineNumber()%2 == 1) {
					studentsNum = Integer.parseInt(str);
				}
				if (studentsNum == 0) {
					break;
				}
				if (lineNumReader.getLineNumber() % 2 == 0) {
					String[] points = str.split(" ");
					scores = new double[studentsNum];
					int i = 0;

					for (String point : points) {
						scores[i] = Long.parseLong(point);
						i++;
					}

					double sum = 0;

					for (double score : scores) {
						sum += score;
					}
					double mean = sum / studentsNum;
					double sig2 = 0;

					for (double score : scores) {
						sig2 += Math.pow(score - mean, 2);
					}

					//Σ
					double sigma = Math.sqrt(sig2 / studentsNum);
					System.out.println(String.format("%.8f", sigma));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}
}


Measured memory_bytes: 25440