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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,m;
  cin>>n>>m;

  vector<int> AC(n+1);
  vector<int> WA(n+1);

  rep(i,m){
    int p;
    string s;
    cin>>p>>s;
    if(s=="AC"){
      AC[p]++;
    }else{
      if(!AC[p])WA[p]++;
    }
  }
  int a=0,b=0;
  rep(i,n)a+=(AC[i+1]>0);
  rep(i,n){
    b+=(AC[i+1]?WA[i+1]:0);
  }
  cout<<a<<" "<<b<<endl;

}

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

int main() {
  int N = 0, A = 0;
  cin >> N >> A;
  while(N<0 || A>pow(N, 2.0) || A<0){
    cout << "please confirm input" << endl;
    cin >> N >> A;
  }
  cout << pow(N, 2.0) - A << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

int w_reach[maxn], s_reach[maxn];
int water, suger;
int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    //cin >> T;
    T = 1;
    for (int cs = 1; cs <= T; cs++) {
        int a, b, c, d, e, f;
        cin >> a >> b >> c >> d >> e >> f;

        s_reach[0] = 1;
        w_reach[0] = 1;

        for (int i = 0; i <= 3000; i++) {
            if (s_reach[i]) {
                s_reach[i + c] = 1;
                s_reach[i + d] = 1;
            }
            if (w_reach[i]) {
                w_reach[i + a] = 1;
                w_reach[i + b] = 1;
            }
        }
        double mx = INT_MIN;
        for (int i = 100; i <= f; i++) {
            for (int j = 0; j + i <= f; j++) {
                if (i % 100) continue;
                if (w_reach[i / 100] == 0 || s_reach[j] == 0) continue;
                if (j > i / 100 * e) continue;
                if (j * 1.0 / i > mx) {
                    mx = j * 1.0 / i;
                    water = i;
                    suger = j;
                }
            }
        }
        cout << (water + suger) << " " << suger << endl;
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    return 0;
}

Measured memory_bytes: 256
#include<iostream> //cinなど
#include<string> //文字列
#include<algorithm> //sort など
#include<math.h> //paw(冪乗など)
#include<set> // 集合
#include<map> //写像
#include<stdio.h> //printf
#include<stack>

using namespace std;
int main(){
   int A,B;
   cin >> A >> B;
   if(A%3==0 || B%3==0 || (A+B)%3==0){
     cout<<"Possible"<<endl;
   }else{
     cout<<"Impossible"<<endl;
   }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
typedef long long ll;
typedef long double ld;
const ld eps = 1e-9;

int n;
ld x[N], y[N];

bool eq(ld x) { return abs(x) < eps; }
bool eq(ld x, ld y) { return eq(x - y); }
void mxm(ld &x, ld y) { x = max(x, y); }
void mnm(ld &x, ld y) { x = min(x, y); }
ll det(ll x1, ll y1, ll x2, ll y2) {
	return x1 * y2 - x2 * y1;
}
ld det(ld x1, ld y1, ld x2, ld y2) {
	ld d = x1 * y2 - x2 * y1;
	return d;
}
bool colinear(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3) {
	ld xu = x3 - x1, yu = y3 - y1, xv = x2 - x1, yv = y2 - y1;
	return eq(det(xu, yu, xv, yv));
}
bool solveEQ(ld a1, ld b1, ld c1, ld a2, ld b2, ld c2, ld &k1, ld &k2) {
	if (eq(det(a1, b1, a2, b2))) return false;
	ld detAB = det(a1, b1, a2, b2),
		detAC = det(a1, c1, a2, c2),
		detBC = det(b1, c1, b2, c2);
	k1 = -detBC / detAB; k2 = detAC / detAB;
	return true;
}
bool centerInscibe(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3, ld &xc, ld &yc) {
	if (colinear(x1, y1, x2, y2, x3, y3)) return false;
	ld xa = (x1 + x2) / 2, ya = (y1 + y2) / 2, xb = (x1 + x3) / 2, yb = (y1 + y3) / 2;
	ld x_12 = x2 - x1, y_12 = y2 - y1, x_13 = x3 - x1, y_13 = y3 - y1;
	ld xu = -y_12, yu = x_12, xv = -y_13, yv = x_13;
	ld k1, k2;
	if (!solveEQ(xu, -xv, xb - xa, yu, -yv, yb - ya, k1, k2)) return false;
	xc = xa + k1 * xu;
	yc = ya + k1 * yu;
	return true;
}
ld dist(ld x1, ld y1, ld x2, ld y2) { return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)); }
ld R(ld X, ld Y) {
	ld ans = 0.0;
	for (int i = 0; i < n; ++i)
		mxm(ans, dist(X, Y, x[i], y[i]));
	return ans;
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n; for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
	ld ans = R(x[0], y[0]);
	for (int i=0; i<n; ++i)
		for (int j = i + 1; j < n; ++j) {
			ld xm = (x[i] + x[j]) / 2, ym = (y[i] + y[j]) / 2;
			mnm(ans, R(xm, ym));
		}
	for (int i=0; i<n; ++i)
		for (int j=i+1; j<n; ++j)
			for (int k = j + 1; k < n; ++k) {
				ld xc, yc;
				if (centerInscibe(x[i], y[i], x[j], y[j], x[k], y[k], xc, yc)) {
					int debug = 1;
					mnm(ans, R(xc, yc));
				}
			}
	cout.precision(20);
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <set>

using namespace std;

int main() {
  int n, m;
  set<string> admin;
  cin >> n;
  for( int i = 0; i < n; i++ ) {
    string tmp;
    cin >> tmp;
    admin.insert( tmp );
  }
  cin >> m;
  bool door = false; // closed
  for( int i = 0; i < m; i++ ) {
    string tmp;
    cin >> tmp;
    if( admin.find( tmp ) == admin.end() ) {
      cout << "Unknown ";
    }else if( !door ){
      cout << "Opened by ";
      door = !door;
    }else{
      cout << "Closed by ";
      door = !door;
    }
    cout << tmp << endl;
  }

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1232
def resolve():
    n = int(input())
    xxyy = [list(map(int, input().split())) for _ in range(n)]
    xxyy = sorted(xxyy, key=lambda x: x[1])
    xxyy = sorted(xxyy, key=lambda x: x[0])
    for xy in xxyy:
        print(*xy)


resolve()



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

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

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

  ll a;
  if (N == M) {
    a = 2;
  } else if (abs(N - M) == 1){
    a = 1;
  } else {
    cout << 0 << endl;
    return 0;
  }

  ll b = 1;
  for (int i = 2; i <= N; i++) {
    b = b * i % mod;
  }
  ll c = 1;
  for (int i = 2; i <= M; i++) {
    c = c * i % mod ;
  }
  cout << a * b * c % mod << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll mod = 998244353;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
int n,k;
double a[maxn],sum[maxn];
int main(){
// 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	scanf("%d %d",&n,&k);
	double x;
	for(int i = 1;i <= n;i++){
		scanf("%lf",&x);
		a[i] = (x + 1) / 2;
	}
	for(int i = 1;i <= n;i++) sum[i] = sum[i-1] + a[i];
	double ans = -1.0;
	for(int i = k;i <= n;i++) ans = max(ans,sum[i] - sum[i-k]);
	printf("%.12lf\n",ans);
	return 0;
}

Measured memory_bytes: 3328
use proconio::input;

fn main() {
  let mut _k :i128;
  let mut _x :i128;


   input! {

    k: i128 ,
x : i128,
}
 
let en = 500 ; 


if k*en >= x {
  println!("Yes");
}else{
  println!("No");
}

}


Measured memory_bytes: 2056
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias N = Tuple!(int, "v", int, "cnt");

N[10^^5+1] A, B;

void main()
{
    auto n = readln.chomp.to!int;
    foreach (i, v; readln.split.to!(int[])) {
        if (i%2) {
            A[v].v = v;
            ++A[v].cnt;
        } else {
            B[v].v = v;
            ++B[v].cnt;
        }
    }
    sort!"a.cnt > b.cnt"(A[]);
    sort!"a.cnt > b.cnt"(B[]);

    if (A[0].v != B[0].v) {
        writeln(n - A[0].cnt - B[0].cnt);
    } else {
        writeln(min(
            n - A[0].cnt - (B[1].v == 0 ? 0 : B[1].cnt),
            n - (A[1].v == 0 ? 0 : A[1].cnt) - B[0].cnt
        ));
    }
}

Measured memory_bytes: 6080
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];





int main(){
  long long a;
  cin>>a;
  vector<string> vec(a);
  rep(i,a){
      cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  rep(i,a-1){
      if(vec.at(i)==vec.at(i+1)){
          cout<<"NO"<<endl;
          break;
      }
      if(i==a-2){
          cout<<"YES"<<endl;
          break;
      }
  }
}



Measured memory_bytes: 13824
def main() -> None:
    S = input()
    a1 = cou(S, '0', '1')
    a2 = cou(S, '1', '0')
    print(min(a1, a2))


def cou(S, f, s):
    num = 0
    for i in range(len(S)):
        if i % 2 == 0:
            if S[i] == f:
                num += 1
            else:
                pass
        elif i % 2 != 0:
            if S[i] == s:
                num += 1
            else:
                pass
    return num


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
a,b = input().split()
a = int(a)
b = int(b)
if a >= 2 and b >= 2:
  print(int(a * (a-1) / 2 + b * (b-1) / 2))
elif a < 2 and b < 2:
  print(0)
elif a>=2 and b < 2:
  print(int(a * (a-1)/2))
elif a<2 and b>=2:
  print(int(b * (b-1)/ 2))


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

int main() {
  ll n;
  cin >> n;

  ll leaf = 0;
  vector<ll> a(n+1);
  for (ll i = 0; i <= n; i++) {
    cin >> a[i];
    leaf += a[i];
  }
  
  if (n == 0) {
    if (a[0] == 1) {
      cout << 1 << endl;
      return 0;
    }
  }

  if (a[0] != 0) {
    cout << -1 << endl;
    return 0;
  }

  ll current = 1;
  ll node = 1;
  for (ll i = 1; i <= n; i++) {
    if (current > leaf) {
      cout << -1 << endl;
      return 0;
    }
    leaf -= a[i];
    current = min(leaf, current * 2 - a[i]);
    node += current + a[i];
    if (i != n && current <= 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  if (current != 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << node << endl;
}


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

    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse(Console.ReadLine());
            var kouyakusuu_500 = input / 500;
            var zan = input - kouyakusuu_500 * 500;
            var kouyakusuu_5 = zan / 5;
            Console.WriteLine(kouyakusuu_500 * 1000 + kouyakusuu_5 * 5);
        }
    }


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

int main(){
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(30) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W;double sum=0,num=0,flag=0;string S,T;
  cin >> N;
  A=1;
  rep(i,1,N+1)A*=i;
  Vec(P,lli,N,0);
  Vec(Q,lli,N,0);
  rep(i,0,N)cin >> P[i] >> Q[i];
  Vec(O,lli,N,0);
  rep(i,0,N)O[i]=i;
  do{
    rep(i,0,N-1)sum+=sqrt(pow(P[O[i]]-P[O[i+1]],2)+pow(Q[O[i]]-Q[O[i+1]],2));
  }while(next_permutation(O.begin(),O.end()));
  HpOut(sum/A);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 1e5 + 1e3;

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

queue<int> Q;
int dig[N],Mod,inq[N];

void Spfa() {
	memset(dig,63,sizeof(dig));

	For(i,1,9) inq[i] = true,dig[i] = i,Q.push(i);
	while(!Q.empty()) {
		int u = Q.front(); inq[u] = false; Q.pop();
		For(i,0,9) {
			int v = (u * 10 + i) % Mod;
			if(chkmin(dig[v],dig[u] + i) && !inq[v]) inq[v] = true,Q.push(v);
		}
	}
}

int main () {

	Mod = read();
	Spfa();
	printf("%d\n",dig[0]);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    ll N;
    cin >> N;
    ll sum = 0;
    ll count = 1;
    ll a;
    for(ll i=0; i<N; i++){
        cin >> a;
        if(a == count){
            count++;
        }
        else{
            sum++;
        }
    }
    if(sum >=N){
        sum = -1;
    }
    cout << sum << endl;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int R, C, N; cin >> R >> C >> N;
	auto idx = [&](int x, int y) {
		if (y == 0)return x;
		if (x == R)return R + y;
		if (y == C)return R + C + (R - x);
		if (x == 0)return R + C + R + (C - y);
		return -1;
	};
	auto inboarder = [&](int x, int y) {
		return (x == 0 || x == R || y == 0 || y == C);
	};
	using P = pair<int, int>;
	vector<P> v;
	rep(i, 0, N) {
		int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
		if (inboarder(x1, y1) && inboarder(x2, y2)) {
			v.emplace_back(idx(x1, y1), i);
			v.emplace_back(idx(x2, y2), i);
		}
	}
	sort(all(v));
	dump(v);
	stack<int> st;
	rep(i, 0, v.size()) {
		dump(st);
		if (st.size() && st.top() == v[i].second) {
			st.pop();
		}
		else {
			st.push(v[i].second);
		}
	}
	dump(st);
	if (st.size()) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 2420
#include"bits/stdc++.h"
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000009
#define MX 100005
#define MOD 1000000007

using namespace std;

int main(){
    int n,a[MX];
    cin>>n;
    fill(a,a+n,0);
        int k;
    rep(i,n){
        cin>>k;
        a[k]++;
    }
    int s=1;
    if(n%2==1)s=0;
    for(int i=s;i<n;i+=2){
        if(i==0&&a[i]==1)continue;
        if(a[i]!=2){
            cout<<0<<endl;
            return 0;
        }
    }
    int ans=1;
    rep(i,n/2){
        ans*=2;
        if(ans>=MOD)
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

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

using ll = long long;
using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(false)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;

ll gcd(ll a, ll b) { return __gcd(a, b); }
ll lcm(ll a, ll b) { return (a == 0 || b == 0) ? 0 : (a / __gcd(a, b) * b); }

int main(int argc, const char* argv[]) {
	ll a, b;
	cin >> a >> b;

	cout << max({a + b, a - b, a * b}) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL N, M;

int main(void)
{
	cin >> N >> M;
	if (N > M)swap(N, M);
	LL ans = (N - 2) * (M - 2) + 0;
	if (N == 2) {
		ans = 0;
	}
	else if (N == 1) {
		ans = abs(M - 2);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let (%) a b = ((a mod b) + b) mod b
    in
    let rec loop repl b cur acc =
        if acc = n then repl else
            if acc % b = n % b then loop ("0" ^ repl) (2 * b) (-2 * cur) acc
                               else loop ("1" ^ repl) (2 * b) (-2 * cur) (acc + cur)
    in
    print_endline @@
        if n = 0 then "0" else loop "" 2 1 0
)

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int>V(0);
  rep(i, n){
    int x;
    cin >>x;
    V.push_back(x);
  }
  sort(V.begin(), V.end());
  int sum=0;
  rep(i, k){
    sum += V[i];
  }
  cout << sum << endl;
}



Measured memory_bytes: 3628
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn=3E5+77;
typedef long long LL; 

LL N,A,B,V[maxn];
int cv=0,idx[maxn],ans[maxn];

bool cmp(int a,int b){ 
        return V[a]<V[b];
}

int main(){
        cin>>N>>A>>B;
        if(A+B>N+1 || A*B<N){
                printf("-1\n");
                return 0;
        }   

        N-=A;
        for(LL i=B;i<=B*A;i+=B){
                V[cv++]=i;
                for(LL j=1;N && j<B;++j){
                        --N;
                        V[cv++]=i-j;
                }   
        }   

        for(int i=0;i<cv;++i) idx[i]=i;
        sort(idx,idx+cv,cmp);
        for(int i=0;i<cv;++i) ans[idx[i]]=i+1;
        printf("%d",ans[0]);
        for(int i=1;i<cv;++i) printf(" %d",ans[i]);
        printf("\n");
 }


Measured memory_bytes: 6912
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
const int N=2010;
int f[N][N],fac[N*N],inv[N*N];
const int mod=1e9+7;
inline int C(int n,int m) {
	return 1LL*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
inline int qpow(int x,int y) {
	int ans=1;
	while (y) {
		if (y&1) ans=1LL*ans*x%mod;
		x=1LL*x*x%mod;y>>=1;
	}
	return ans;
}
int main() {
	int n=gi(),m=gi(),i,j;
	if (m==1) { puts("1"); return 0; }
	for (i=fac[0]=1;i<=m*n;i++) fac[i]=1LL*fac[i-1]*i%mod;
	inv[n*m]=qpow(fac[n*m],mod-2);
	for (i=n*m;i;i--) inv[i-1]=1LL*inv[i]*i%mod;m--;
	f[0][0]=1;
	for (i=1;i<=n;i++)
		for (j=0;j<=i;j++)
			f[i][j]=((j?f[i][j-1]:0)+(i==j?0:1LL*f[i-1][j]*C(j+i*m-1,m-1)))%mod;
	printf("%d\n",int(1LL*f[n][n]*fac[n]%mod));
	return 0;
}


Measured memory_bytes: 46592
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

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

    ll n,m;
    cin>>n>>m;
    cout<<(n-1)*n/2+(m-1)*m/2;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int e = 0;
        int o = 0;
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if ((i + 1) % 2 == 0) {
                if (s.charAt(i) == '0') {
                    e++;
                } else {
                    o++;
                }
            } else {
                if (s.charAt(i) == '0') {
                    o++;
                } else {
                    e++;
                }
            }
        }
        for (int i = 0; i < s.length(); i++) {
            if (e > o) {
                if ((i + 1) % 2 == 0 && s.charAt(i) != '0') {
                    ans++;
                } else if ((i + 1) % 2 != 0 && s.charAt(i) != '1') {
                    ans++;
                }
            } else {
                if ((i + 1) % 2 == 0 && s.charAt(i) != '1') {
                    ans++;
                } else if ((i + 1) % 2 != 0 && s.charAt(i) != '0') {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26192
import math
N, H = map(int, input().split())
a_list = []
b_list = []
for _ in range(N):
    a,b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

max_a = max(a_list)
b_list = [ i for i in b_list if i > max_a ]
b_list.sort(reverse = True)

total = 0
count = 0
for d in b_list:
    total += d
    count += 1
    if total >= H:
        break

if total < H:
    x = math.ceil((H - total) / float(max_a))
    count += x

print(count)

Measured memory_bytes: 11792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn =2e5+10;
const int inf = 0x3f3f3f3f;
vi g[maxn];
int id[maxn],cnt,siz[maxn],c[maxn],fa[maxn];
vi col[maxn];
void dfs(int now,int f) {
	siz[now]=1;
	fa[now]=f;
	id[now]=++cnt;
	for(int x:g[now]) {
		if(x==f) continue;
		dfs(x,now);
		siz[now]+=siz[x];
	}
}
ll a[maxn];
int lowbit(int x) {
	return x&(-x);
}
void add(int pos,int x) {
	for(int i=pos;i<maxn;i+=lowbit(i)) a[i]+=x;
}
ll query(int pos) {
	ll ans=1;
	for(int i=pos;i;i-=lowbit(i)) ans+=a[i];
	return ans;
}
ll n;
ll cal(int now) {
	return siz[now]+(query(id[now]+siz[now]-1)-query(id[now]-1));
}
ll b[maxn];
void solve(int cc) {
	if(col[cc].size()==0) {
		cout<<0<<'\n';
		return ;
	}
	ll ans=n*(n-1)/2+col[cc].size();
	//cout<<"ans="<<ans<<'\n';
	for(int i=col[cc].size()-1;i>=0;i--) {
		int x=col[cc][i];
		//cout<<"x="<<x<<'\n';
		for(int son:g[x]) {
			if(son==fa[x]) continue;
			ll now=cal(son);
		//	cout<<son<<' '<<now<<'\n';
			ans-=now*(now-1)/2;
		}
		ll now=cal(x);
		add(id[x],-now);
		b[x]=now;
	}
	if(c[1]!=cc) {
		ll now=cal(1);
		ans-=now*(now-1)/2;
	}
	for(int x:col[cc]) {
		add(id[x],b[x]);
	}
	cout<<ans<<'\n';
}
bool cmp(int a,int b) {
	return id[a]<id[b];
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n;
	rep(i,1,n) {
		cin>>c[i];
		col[c[i]].pb(i);
	}
	rep(i,1,n-1) {
		int u,v;
		cin>>u>>v;
		g[u].pb(v);
		g[v].pb(u);
	}
	dfs(1,0);
	rep(i,1,n) {
		sort(col[i].begin(),col[i].end(),cmp);
	}
	rep(i,1,n) solve(i);
	return 0;
}


Measured memory_bytes: 45008
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int main(){
  int N,M;
  cin >>N>>M;
  int a[50],b[50];
  for(int i=0;i<M;i++){ 
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
  }
  int ans=0;
  for(int i=0;i<M;i++){
    vector<vector<int>> to(N);
    for(int j=0;j<M;j++){
      if(j==i) continue;
      to[a[j]].push_back(b[j]);
      to[b[j]].push_back(a[j]);
    }
    queue<int> que;
    vector<bool> d(50,false);
    que.push(0);
    d[0]=true;
    int count =1;
    while(!que.empty()){
      int p=que.front();que.pop();
      for(int j=0;j<to[p].size();j++){
        int v=to[p][j];
        if(!d[v]){
          que.push(v);
          count++;
          d[v]=true;
        }
      }
    }
    if(count!=N) ans++;
  }
  cout<<ans<<endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N){
    cin >> A[i];
  }
  
  int count = 0;
  int judge = 0;
  rep(i, N-1){
    if (A[i] > A[i+1]) {
      if (judge == 2) {
        count++;
        judge = 0;
      }
      else judge = 1;
    }
    else if (A[i] < A[i+1]) {
      if (judge == 1){
        count++;
        judge = 0;
      }
      else judge = 2;
    }
  }
                    
  
  cout << count + 1 << endl;
}

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



int main() {
	int N; cin >> N;
	set<vector<int>>points;
	for(int i=0;i<N;++i){
		vector<int>v(3);
		for (int i = 0; i < 3; ++i)cin >> v[i];
		sort(v.begin(), v.end());
		points.emplace(v);
	}
	cout << N-points.size() << endl;
	return 0;
}

Measured memory_bytes: 3220
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0;
  string s="",t="";
  //

  // ここから
  IN2(n,m);
  Vs A(n);
  Vs B(m);
  VIN(A)
  VIN(B)
  //全探索すれば良さそう
  bool exist = false;
  REP(ly,n){
    REP(lx,n){
      if(ly+m-1>=n || lx+m-1>=n) continue;
      bool flg = true;
      REP(y,m){
        REP(x,m){
          if(A[ly+y][lx+x] != B[y][x]) flg = false;
        }
      }
      if(flg) exist=true;
    }
  }
  Yes(exist);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
   int n;
   cin>>n;
   vector<pair<int,int>> v;
   FOR(i,1,n)
   {
       int x;
       cin>>x;
       v.push_back({x,i});
   }
   sort(v.begin(),v.end());
   for(auto i:v)
   cout<<i.second<<" ";   
  }
  return 0;
}

Measured memory_bytes: 1780
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll N;
    in >> N;
    ll ans = (N + 1)/2;

    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string ch;
    //gets(ch);
    cin>>ch;
    if(ch[2]==ch[3]&&ch[4]==ch[5]){

        cout<<"Yes\n"<<endl;
    }
    else{
      cout<<"No\n"<<endl;

    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cctype>
#include <algorithm>
#include <functional>
#include <utility>
using ll = long long;
ll ha;
inline ll pow_mod(ll a, ll b, const ll &mod) {
  ll ans = 1, res = a;
  while(b) {
    if(1LL & b) ans = ans * res % mod;
    res = res * res % mod; b >>= 1;
  }
  return ans;
}

const int maxn = 3005;

ll f[maxn][maxn], C[maxn][maxn];
ll tp_1[maxn], tp_2[maxn];
int n;
inline void process() {
  C[0][0] = 1;
  for(int i = 1; i <= n; i ++) {
    C[i][0] = C[i][i] = 1;
    for(int j = 1; j < i; j ++) {
      C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
      if(C[i][j] >= ha) C[i][j] -= ha;
    }
  }
  f[0][0] = 1;
  for(int i = 1; i <= n; i ++) {
    for(int j = 0; j <= i; j ++) {
      f[i][j] = f[i - 1][j] * (j + 1) % ha;
      if(j > 0) {
        f[i][j] += f[i - 1][j - 1];
        if(f[i][j] >= ha) f[i][j] -= ha;
      }
    }
  }
  tp_1[0] = 1;
  for(int i = 1; i <= n; i ++) {
    tp_1[i] = (tp_1[i - 1] << 1);
    if(tp_1[i] >= ha) tp_1[i] -= ha;
  }
  tp_2[0] = 1;
  for(int i = 1; i <= n; i ++) {
    tp_2[i] = (tp_2[i - 1] << 1);
    if(tp_2[i] >= ha - 1) tp_2[i] -= ha - 1;
  }
}

int main() {
  scanf("%d%lld", &n, &ha);
  process();
  ll ret = 0;
  for(int i = 0; i <= n; i ++) {
    ll ans = 0; ll tp = tp_1[n - i], val = 1;
    for(int j = 0; j <= i; j ++) {
      ans = (ans + val * f[i][j]) % ha;
      val = val * tp % ha;
    }
    ans = ans * C[n][i] % ha * pow_mod(2, pow_mod(2, n - i, ha - 1), ha) % ha;
#ifdef LOCAL
    printf("val %d : %lld\n", i, ans);
#endif
    if(i & 1) ret += (- ans + ha);
    else ret += ans;
    if(ret >= ha) ret -= ha;
  }
  printf("%lld\n", ret);
  return 0;
}

Measured memory_bytes: 139520
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>

int main() {
	long long N, M; std::cin >> N >> M;
	std::map<long long, long long> C;
	std::vector<long long> D(N + 1);
	long long wa = 0;
	long long ac = 0;
	for (int i = 0; i < M; ++i) {
		long long c; std::string s;
		std::cin >> c >> s;
		if (s == "WA" && D[c] != 1) {
			D[c] = 5;
			++C[c];
			++wa;
		}
		if (s == "AC" && D[c] != 1) {
			D[c] = 1;
			++ac;
		}
	}
	for (int i = 0; i < N + 1; ++i) {
		if (D[i] == 5)
			wa -= C[i];
	}
	std::cout << ac << " " << wa << std::endl;


	return 0;
}


Measured memory_bytes: 7812
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

size_t strlen(const char* s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N = 200010;
const int P = 1000000007;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b) {
	if (a > b) {
		return a - b;
	}
	else {
		return b - a;
	}
}
//小さい方
long long int min(long long int a, long long int b) {
	if (a > b) {
		return b;
	}
	else {
		return a;
	}
}
//大きい方
long long int max(long long int a, long long int b) {
	if (a > b) {
		return a;
	}
	else {
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
	return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod) {
	return (a * b) % mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main() {
	int n;
	cin >> n;
	n = n % 10;



	if (n == 3)puts("bon");


	else if (n == 0 || n == 1 || n == 6 || n == 8)puts("pon");
	else puts("hon");

	/////      1
}


Measured memory_bytes: 3864
#include<iostream>
#include<cmath>
#include<string>
#include<cstdlib>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<string.h>
#include<iomanip>
using namespace std;
int main()
{
	string a,b;//??????????????????????????\????????????????????\????????????
	int sum=0;
		cin>>a;
		while(cin>>b)//????????\??¨cin????°±?????¨??????????????????????\????
		{
			if(b=="END_OF_TEXT")
			break;
			//??\????????°?????°
			//?°±?????¨??????????????????????????\?????¨for
			for(int j=0;j<b.length ();j++)
				b[j]=tolower(b[j]);
		    
			if(b[0]!=a[0])
				continue;

			int i=b.find(a[0]);//a?????????
			int k=0;
		
			for(i;i<b.length ();)//??????????????????????????°??¨?\????????????\??¨cin??´?§£?????????????°±????????????
			{
				
			if(b[i]==a[k])//?????????i?????\????????°b???0???????¬¬????????????,??????????????°??????????????°????¬¬???????????????????????¨???,??????i?????\????¬¬??????????????????
			{
				i++;
			k++;
			
			if(k==a.length()&&i==b.length())//????????°????????????????????????????????????.&&i==b.length()
			{
				sum++;
				break;
			}
				



			}
			else
			     break;
			}
		}
			



		cout<<sum<<endl;//???????????????????????¬???
		
		
		
		
		
		}
		
	
	
	
	

Measured memory_bytes: 3100
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int long long
#define endl "\n"
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n+1) {fr(j, 1, m+1) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
using vi=vector<int>;
const int inf = 1e18;
const int mod=1e9+7;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(b.fi==a.fi)return (b.se>=a.se);
    return (b.fi>a.fi);
}
signed main()
{
    fastio;
    R(n);
    bool f=0;
    RA(a,n);
    fr(i,1,n+1)
    {
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)f=1;
        }
    }
    if(f)cout<<"DENIED"<<endl;
    else
        cout<<"APPROVED"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#define PI 3.14159265359
typedef long long ll;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
using namespace std;



int main(){
	int m, k;
	cin >> m >> k;
	if (m == 0){
		if (k == 0) cout << "0 0" << endl;
		else cout << -1 << endl;
	}else if (m == 1){
		if (k == 0) cout << "0 0 1 1" << endl;
		else cout << -1 << endl;
	}else if (pow(2, m) <= k){
		cout << -1 << endl;
	}else{
		for (int i = 0; i < pow(2, m); i++){
			if (i == k) continue;
			cout << i << " ";
		}
		cout << k << " ";
		for (int i = pow(2, m)-1; i >= 0; i--){
			if (i == k) continue;
			cout << i << " ";
		}
		cout << k << endl;
	}
	return 0;
}


Measured memory_bytes: 3968
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        int[][] paper = new int[14][14];
        // assume we use 14*14 cells, then finally ignore the 0 to 1 and 12 to 13
        int count=0, max=0;
         
        while((s = br.readLine())!=null && !s.isEmpty())
        {
            int x = Integer.parseInt(s.split(",")[0]);
            int y = Integer.parseInt(s.split(",")[1]);
            int size = Integer.parseInt(s.split(",")[2]);
             
            drop(x+2,y+2,size,paper); // as we use 14*14 paper(but just assumes it as 10*10)
        }
        for(int i=2; i<12; i++)
            for(int j=2; j<12; j++){
                if(paper[i][j]==0) count++;
                max = Math.max(paper[i][j],max);
            }
        System.out.println(count);
        System.out.println(max);
    }
         
    private static void drop(int x, int y, int size, int[][] paper)
    {
        if(size==1){
            for(int i=x-1; i<x+2; i++) paper[y][i]++;
            for(int i=y-1; i<y+2; i++) paper[i][x]++;
            paper[y][x]--;
        } else if(size==2) {
            for(int i=x-1; i<x+2; i++)
                for(int j=y-1; j<y+2; j++)
                    paper[j][i]++;
        } else {
            for(int i=x-2; i<x+3; i++) paper[y][i]++;
            for(int i=x-1; i<x+2; i++) {
                paper[y+1][i]++;
                paper[y-1][i]++;
            }
            for(int i=y-2; i<y+3; i++) paper[i][x]++;
                paper[y+1][x]--;
                paper[y-1][x]--;
                paper[y][x]--;
        }
    }
}

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

struct Node{
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key) x = x->left;
        else x = x->right;
    }

    z->parent = y;
    if(y == NIL) root = z;
    else if(z->key < y->key) y->left = z;
    else y->right = z;
    
}

Node* find(Node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}


Node* getSuccessor(Node *z){
    if (z->right != NIL){
        Node *y = z->right;
        while(y->left != NIL){
            y = y->left;
        }
        return y;
    }

    Node *y = z->parent;
    while(y != NIL && z == y->right){
        z = y;
        y = y->parent;
    }
    return y;
}


void deleteNode(Node *z){
    Node *x, *y; // x: y's left or right,  y: deleted node

    if(z->left == NIL || z->right == NIL) y = z;
    else y = getSuccessor(z);

    if(y->left != NIL) x = y->left;
    else x = y->right;

    if(x != NIL) x->parent = y->parent;
    
    if(y->parent == NIL) root = x;
    else if(y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;

    if(y != z) z->key = y->key;

    free(y);
}


void preOrder(Node *u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preOrder(u->left);
    preOrder(u->right);
}

void inOrder(Node *u){
    if(u == NIL) return;
    inOrder(u->left);
    printf(" %d", u->key);
    inOrder(u->right);
}

int main(){
    int N;
    scanf("%d", &N);
    rep(i, N){
        char S[10];
        int k;
        scanf("%s%d", S, &k);
        if(S[0] == 'i') insert(k);
        else if(S[0] == 'f'){
            Node *u = find(root, k);
            if(u != NIL) printf("yes\n");
            else printf("no\n");
        } 
        else if(S[0] == 'd') deleteNode(find(root, k));
        else {
            inOrder(root);
            printf("\n");
            preOrder(root);
            printf("\n");
        }
    }
}


Measured memory_bytes: 21900