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

using namespace std;

using ll = long long;

int const maxn = 10101;
int const maxd = 101;
int const mod = 1e9 + 7;

string k;
int di;

int dp9[maxn][maxd];
int dp[maxn][maxd];

int solve9(int idx, int r) {
    if (idx < 0) {
        return r == 0;
    }
    int &d = dp9[idx][r];

    if (d != -1) {
        return d;
    }

    d = 0;

    for (int i = 0, rr = r; i < 10; i++, rr++) {
        if (rr == di) rr = 0;
        d += solve9(idx-1, rr);
        if (d >= mod) {
            d -= mod;
        }
    }

    return d;
}

int solve(int idx, int r) {
    if (idx < 0) {
        return r == 0;
    }

    int &d = dp[idx][r];

    if (d != -1) {
        return d;
    }

    d = 0;

    int x = k[idx] - '0';
    for (int i = 0, rr = r; i < x; i++, rr++) {
        if (rr == di) rr = 0;
        d += solve9(idx-1, rr);

        if (d >= mod) {
            d -= mod;
        }
    }

    d += solve(idx-1, (r + x)%di);

    if (d >= mod) {
        d -= mod;
    }

    return d;
}

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

    memset(dp, -1, sizeof(dp));
    memset(dp9, -1, sizeof(dp9));

    cin >> k >> di;

    int n = k.size();

    reverse(k.begin(), k.end());

    cout << (solve(n-1, 0)-1+mod)%mod << "\n";
}

Measured memory_bytes: 9216
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use proconio::{fastout, input};
use std::cmp::*;
use std::collections::*;
use std::mem::*;
#[fastout]
fn main() {
  input! {
    n:usize,
    mut ab:[(i64,i64);n],
  }
  let mut zeroc = 0;
  let mut mp = HashMap::<(i64, i64), (i64, i64)>::new();
  for (xx, yy) in ab {
    let mut x = xx;
    let mut y = yy;
    if x == 0 && y == 0 {
      zeroc += 1;
      continue;
    }
    if x == 0 {
      mp.entry((0, 0)).or_insert((0, 0)).0 += 1;
    } else if y == 0 {
      mp.entry((0, 0)).or_insert((0, 0)).1 += 1;
    } else {
      if y < 0 {
        x = -x;
        y = -y;
      }
      let g = gcd(x.abs(), y.abs());
      x /= g;
      y /= g;
      if x < 0 {
        mp.entry((y, -x)).or_insert((0, 0)).0 += 1;
      } else {
        mp.entry((x, y)).or_insert((0, 0)).1 += 1;
      }
    }
  }
  let mut ans = 1i64;
  for (key, value) in mp {
    let a = mod_pow(2, value.0, MOD) + mod_pow(2, value.1, MOD) - 1;
    ans = (ans * a) % MOD;
  }
  ans = (ans + zeroc + MOD - 1) % MOD;
  println!("{}", ans);
}
pub fn gcd(a: i64, b: i64) -> i64 {
  if b == 0 {
    a
  } else {
    gcd(b, a % b)
  }
}
static MOD: i64 = 1000000007;
pub fn mod_pow(x: i64, n: i64, m: i64) -> i64 {
  let mut res = 1;
  let mut x = x % m;
  let mut n = n;
  while n > 0 {
    if n & 1 == 1 {
      res = (res * x) % m;
    }
    x = (x * x) % m;
    n >>= 1;
  }
  res
}


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

using namespace std;
using ll = long long;


int main()
{
    int N,M;cin >> N >> M;
    vector<int> v(N+1);
    for(int i = 0;i < M;i++){
        int l,r;cin >> l >> r;
        l--,r--;
        v[l]++;
        v[r+1]--;
    }
    int x = 0;
    int ans = 0;
    for(int i = 0;i < N;i++){
        x += v[i];
        if(x == M){
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;

vector<int> adj[100010];
vector<int> ts; /// topological sort

bool vis[100010];
void dfs(int u) {
    vis[u] = true;

    for(auto v : adj[u]) {
        if(vis[v]) continue;
        dfs(v);
    }

    ts.push_back(u);
}

int dp[100010]; /// dp table

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

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

    for(int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;

        u--, v--;

        adj[u].push_back(v);
    }

    for(int i = 0; i < n; i++) if(!vis[i]) dfs(i);
    reverse(ts.begin(), ts.end());

    for(int i = 0; i < n; i++) {
        int u = ts[i];
        for(int v : adj[u]) {
            dp[v] = max(dp[v], dp[u] + 1);
        }
    }

    int ans = 0;
    for(int i = 0; i < n; i++) {
        ans = max(ans, dp[i]);
    }

    cout << ans << endl;
}

/*
 * G
**/


Measured memory_bytes: 8824
#include<bits/stdc++.h>
using namespace std;
#define m(a,b) memset(a,b,sizeof(a))
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
const int MAXN=1e5+100;

int main(){
	IO
		int n,k;
	ll ans=0;
	cin>>n>>k;
	if (k==0) ans=(ll)n*n;
	else{
		for(int  i=k+1;i<=n;i++){
			int t=n/i;
			ans+=t*(i-k);
			ans+=max((ll)(n%i-k+1),0ll);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
long long n, x;
long long s[200];
long long p = 1000 * 1000 * 1000 + 7;
long long dp[203][100005];
int main() {
	scanf("%lld%lld", &n, &x);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &s[i]);
	}
	std::sort(s, s + n);
	for (int i = 0; i <= x; i++) {
		dp[0][i] = i % s[0];
	}
	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= x; j++) {
			dp[i][j] = (i*dp[i - 1][j] + dp[i - 1][j%s[i]]) % p;
		}
	}
	printf("%lld\n", dp[n - 1][x]);
}

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

#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 EPS (1e-7)
#define INF 1e9

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1000000007;
const int MAX_N=200001;

int main(){
	int n;
	cin>>n;
	int a[n];
	REP(i,n)cin>>a[i];
	int absmax=0;
	int idx=0;
	REP(i,n){
		if(absmax<abs(a[i])){
			absmax=abs(a[i]);
			idx=i;
		}
	}
	cout<<2*n-2<<endl;
	REP(i,n){
		if(i!=idx)cout<<idx+1<<" "<<i+1<<endl;;
	}
	if(a[idx]>0){
		REP(i,n-1){
			cout<<i+1<<" "<<i+2<<endl;
		}
	}else{
		for(int i=n-1;i>0;i--){
			cout<<i+1<<" "<<i<<endl;
		}
	}
	return 0;
}


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

#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define all(vec) vec.begin(), vec.end()
#define per(i,N) for (int i=(int)N-1; i>=0; i--)
//#define int long long
#define endl "\n"

typedef long long ll;

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

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

  int w1 = 0, w2 = W, h1 = 0, h2 = H;
  rep(i, N) {
    int x, y, a; cin >> x >> y >> a;
    if(a == 1) w1 = max(w1, x);
    else if(a == 2) w2 = min(w2, x);
    else if(a == 3) h1 = max(h1, y);
    else h2 = min(h2, y);
  }

  if(w1>=w2 || h1>=h2) cout << 0 << endl;
  else cout << (w2-w1)*(h2-h1) << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
    
    public static void main(String[] args) {
    	String s = sc.nextLine();
        if(s.equals("AAA") || s.equals("BBB"))
        	System.out.println("No");
        else
        	System.out.println("Yes");
    }
}


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

using namespace std;

#ifdef DGC
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ll> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.in", "r", stdin);
		//freopen("a.out", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, p;
	string z;
	cin >> n >> p >> z;

	if (p == 2 || p == 5)
	{
		ll ans = 0;
		for (int i = 0; i < n; ++i)
			if ((z[i]-'0') % p == 0)
				ans += i+1;
		cout << ans << "\n";
		return 0;
	}

	vector<int> f(n);
	f[n-1] = 1;
	for (int i = n-2; i >= 0; --i)
		f[i] = 10 * f[i+1] % p;

	int s = 0;
	map<int, int> mp;
	mp[0]++;
	int pt = 0;
	ll ans = 0;
	for (auto i : z)
	{
		s = (s + (i-'0') * f[pt++]) % p;
		ans += mp[s];
		++mp[s];
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1684
//file_name:ABC56_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int w,a,b;
    cin >> w >> a >> b;

    if(a>b){
        swap(a,b);
    }

    int ans = 0;
    ans = max(0,b-a-w);
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
S = list(str(input()))

if S.count("R") == 3:
    print("3")
elif S.count("R") == 1:
    print("1")
elif S.count("R") == 2:
    if S[1] == "R":
        print("2")
    else:
        print("1")
else:
    print("0")

Measured memory_bytes: 61644
from numba import njit, int32
import numpy as np


@njit(int32(int32[:], int32[:], int32[:]))
def main(A, B, C):
    ans = 0

    for a in A:
        B[a] += 1

    for a in C:
        v = 2*a
        while v <= 10**6:
            B[v] += 1
            v += a

    for a in A:
        if B[a] == 1:
            ans += 1

    return ans


if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [0]*(10**6+1)
    ans = main(np.array(A, dtype=np.int32),
               np.array(B, dtype=np.int32),
               np.array([a for a in set(A)], dtype=np.int32))
    print(ans)


Measured memory_bytes: 143952
public class Swapping_Two_Numbers {

  static void Main(string[] args) {
    
    while(true) {
      var line = System.Console.ReadLine().Trim().Split(' ');
      
      // ???????????¶
      if(line[0] == "0" && line[1] == "0") {
        break;
      }

      string[] result = swap(line);

      System.Console.WriteLine("{0} {1}", result[0], result[1]);

    }
  }

  private static string[] swap(string[] input) {
    string[] result = input;
    int x = int.Parse(input[0]);
    int y = int.Parse(input[1]);

    if (x > y) {
      result = new string[] {input[1], input[0]};
    }
    
    return result;
  }

}

Measured memory_bytes: 8916
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    int N, R;
    while (cin >> N >> R) {
        if (N >= 10) cout << R << endl;
        else cout << 100 * (10 - N) + R << endl;
    }
}

















Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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 (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  ll N,ans=0;
  string S;
  cin>>N>>S;
  
  ll AA[N][10],BB[N][10];
  REP(i,N){
    REP(j,10){
      AA[i][j]=0;
      BB[i][j]=0;
    }
  }
  
  bool CAN[1000];
  REP(i,1000) CAN[i]=false;
  
  
  for(int i=0; i<S.size(); ++i){
    if(i<S.size()-1){
      if(AA[i+1][S.at(i)-'0']==0){
        AA[i+1][S.at(i)-'0']++;
      }
    }
    if(i>0){
      for(int j=0; j<10; ++j){
        if(AA[i-1][j]>0) AA[i][j]++;
      }
    }
  }
  
  for(int i=S.size()-1; i>=0; --i){
    if(i>0){
      if(BB[i-1][S.at(i)-'0']==0){
        BB[i-1][S.at(i)-'0']++;
      }
    }
    if(i<S.size()-1){
      for(int j=0; j<10; ++j){
        if(BB[i+1][j]>0) BB[i][j]++;
      }
    }
  }
  
  for(int i=1; i<=S.size()-2; ++i){
    for(int j=0; j<10; ++j){
      for(int k=0; k<10; ++k){
        if(AA[i][j]>0 && BB[i][k]>0) CAN[j*100+(S.at(i)-'0')*10+k]=true;
      }
    }
  }
  
  for(int i=0; i<1000; ++i){
    if(CAN[i]==true) ans++;
  }
  
  co(ans);
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;
int main() {
	cin >> H >> W;
	vector<vector<char>>grid(H, vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> grid[i][j];
		}
	}
	bool flag = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (grid[i][j] == '#') {
				if (i + 1 < H) {
					if(grid[i + 1][j] == '#')continue;
				}
				if (j + 1 < W) {
					if (grid[i][j + 1] == '#')continue;
				}
				if (i - 1 >= 0) {
					if (grid[i-1][j] == '#')continue;
				}
				if (j - 1 >= 0) {
					if (grid[i][j - 1] == '#')continue;
				}
				flag = 1;
			}
		}
		if (flag)break;
	}
	if (flag)cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  int64 N;
  cin >> N;
  if (N % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  int64 divide_by = 10;
  int64 ans = 0;
  while (divide_by <= N) {
    ans += N / divide_by;
    divide_by *= 5;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
/*
 * 2547.cc: Carpet
 */

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

/* constant */

/* typedef */

typedef stack<int> si;

/* global variables */

/* subroutines */

/* main */

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

  int cnt = 0;
  si st;
  st.push(0);

  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;

    while (st.top() > ai) st.pop();
    if (st.top() < ai) st.push(ai), cnt++;
  }

  printf("%d\n", cnt);
  return 0;
}

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

signed main(){
  int A, B, C;
  cin >> A >> B >> C;
  if( C-A-B <= 0 ){
    cout << "No" << endl;
    return 0;
  }else{
    int D = (C-A-B)*(C-A-B);
    int E = 4*(A*B);
    if( D > E ) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
}

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

using namespace std;

int main(){
    int hp,n,num;
    vector<int>v;

    cin >> hp >> n;

    for(int i = 0;i < n;i++){
        cin >> num;
        v.push_back(num);
    }

    sort(v.begin(),v.end(),greater<int>());

    for(auto &i:v){
        hp -= i;
        if(hp <= 0){
            cout << "Yes" << endl;
            return 0;
        }
    }
        
    cout << "No" << endl;

    return 0;


}

Measured memory_bytes: 892
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

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

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	A := f(N)

	for i := 0; i < len(A); i++ {
		fmt.Fprintln(wtr, A[i])
	}
}

func f(N int) []string {
	if N == 1 {
		return []string{"a"}
	}
	A := []string{}
	a := f(N - 1)
	for j := 0; j < len(a); j++ {
		c := count(a[j]) + 1
		for l := 0; l < c; l++ {
			A = append(A, a[j]+string('a'+l))
		}
	}
	return A
}

func count(str string) int {
	set := make(map[rune]bool)
	for _, r := range str {
		set[r] = true
	}
	return len(set)
}


Measured memory_bytes: 10880
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <unordered_map>

#define mod 1000000007

using namespace std;
using ll = long long;

void solve(){
    ll x, y, res = 1;
    cin >> x >> y;

    for(ll i = 0; i < y; i++){
        x = x * 2;
        if(x <= y){
            res++;
        }else{
            cout << res << endl;
            return;
        }
    }
}

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

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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> img(H + 2, vector<char>(W + 2, '#'));
  for (int i = 1; i <= H; ++i) {
    for (int j = 1; j <= W; ++j) {
      cin >> img[i][j];
    }
  }
  for (int i = 0; i < H + 2; ++i) {
    for (int j = 0; j < W + 2; ++j) {
      cout << img[i][j];
    }
    cout << endl;
  }
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
#define chmin(x, v)                                                            \
  do {                                                                         \
    x = min(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

std::vector<ll> fac(300000, 1), finv(300000, 1), inv(300000, 1);

void c4_init(ll m) {
    for (ll i = 2; i < 300000; i++) {
        fac[i] = fac[i - 1] * i % m;
        inv[i] = m - inv[m%i] * (m / i) % m;
        finv[i] = finv[i - 1] * inv[i] % m;
    }
}

ll c4(ll n, ll k, ll m) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % m) % m;
}

// {{{ Modint
// using mint = modint<1000000007>;
// mint x = 2;
// std::cout << x.a << std::endl;
template <std::int64_t M>
class modint {
 public:
  int64_t a;

  explicit constexpr modint(const int64_t x = 0) noexcept :
    a((x % M + M) % M) {}
  constexpr int64_t &value() noexcept { return a; }
  constexpr const int64_t &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= M) {
      a -= M;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += M;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % M;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    int64_t exp = M - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
  constexpr modint pow(ll t) const {
    if (!t) return modint(1);
    modint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};
// }}}

const ll M = 1e9+7;
using mint = modint<M>;
signed main() {
  ll n,k;
  cin >> n >> k;
  c4_init(M);
  mint ans(0);
  for (ll t = max((ll)1, n-k); t <= n; t++) {
    ans += mint(c4(n,t,M)) * mint(c4(n-1,t-1,M));
  }
  cout<<ans.value()<<endl;
  return 0;
}


Measured memory_bytes: 7296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String all ="abcdefghijklmnopqrstuvwxyz";
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();

		String[] afterAll = all.split(line1);

		String ans = afterAll[1].substring(0,1);

		System.out.print(ans);
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N;

int num[101][101];
int high[101][101];

int lef[7][7];//top i,front j

void init(){
    lef[1][3]=2;
    lef[1][2]=4;
    lef[1][4]=5;
    lef[1][5]=3;
    lef[2][1]=3;
    lef[2][3]=6;
    lef[2][4]=1;
    lef[2][6]=4;
    lef[3][1]=5;
    lef[3][2]=1;
    lef[3][5]=6;
    lef[3][6]=2;
    lef[4][1]=2;
    lef[4][2]=6;
    lef[4][5]=1;
    lef[4][6]=5;
    lef[5][1]=4;
    lef[5][3]=1;
    lef[5][4]=6;
    lef[5][6]=3;
    lef[6][2]=3;
    lef[6][3]=5;
    lef[6][4]=2;
    lef[6][5]=4;
}

#define mkp make_pair

void place(int x,int y,int tp,int fr){
    int bt=7-tp;
    int ba=7-fr;
    int le=lef[tp][fr];
    int ri=7-le;

    vector<pair<int,int>> v;
    v.push_back(mkp(fr,0));
    v.push_back(mkp(le,1));
    v.push_back(mkp(ba,2));
    v.push_back(mkp(ri,3));
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());

    bool placed=false;
    for(int i=0;i<v.size();i++){
        int num=v[i].first;
        if(num<=3) continue;

        int dir=v[i].second;
        int nx=x,ny=y,dx=0,dy=0;
        int ntp,nfr;

        if(dir==0){
            ntp=ba;nfr=tp;dx=0;dy=-1;
        }
        else if(dir==1){
            ntp=ri;nfr=fr;dx=-1;dy=0;
        }
        else if(dir==2){
            ntp=fr;nfr=bt;dx=0;dy=1;
        }
        else if(dir==3){
            ntp=le;nfr=fr;dx=1;dy=0;
        }

        nx+=dx;
        ny+=dy;
        if(high[nx][ny]>=high[x][y]) continue;
        place(nx,ny,ntp,nfr);
        placed=true;
        break;
    }

    if(placed==false){
        num[x][y]=tp;
        high[x][y]++;
    }
}

void solve(){
    init();
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            high[i][j]=0;
            num[i][j]=0;
        }
    }

    vector<int> t(N),f(N);
    for(int i=0;i<N;i++) cin>>t[i]>>f[i];

    for(int i=0;i<N;i++){
        place(50,50,t[i],f[i]);
    }

    vector<int> ans(7,0);
    for(int i=0;i<=100;i++){
        for(int j=0;j<=100;j++){
            ans[num[i][j]]++;
        }
    }

    for(int i=1;i<6;i++) cout<<ans[i]<<" ";
    cout<<ans.back()<<endl;
}

int main(){
  while(1){
      cin>>N;
      if(N==0) break;
      solve();
  }

  return 0;
}



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

int main (){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  if (s < t) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
}

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

const int INF=1e9;


int main(){
  string s1,s2,s3;
  cin>>s1>>s2>>s3;
  for(int i=0;i<s2.size();i++){
    if(s2[i]>=65&&s2[i]<=90){
      cout<<"A"<<s2[i]<<"C"<<endl;;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 4000;
#define int long long
int a[maxn], p;
int inv[maxn]{1,1};
int po[maxn]{1};
inline int form(int i){return (i % p + p) % p;}
vector<int> operator * (const vector<int> &a, vector<int> b){
	vector<int> res(a.size() + b.size() - 1ul, 0);
	for(int i = 0;i < a.size();++i){
		for(int j = 0;j < b.size();++j){
			res[i+j] = form(res[i+j] + a[i] * b[j]);
		}
	}
	return res;
}
vector<int> fun{0, 1}, r;
int getv(int i){
	int ci = i, res = r[0];
	for(int j = 1;j < r.size();++j){
		res = form(res + ci * r[j]);
		ci = form(ci * i);
	}
	return res;
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> p;
	for(int i = 0;i < p;++i)cin >> a[i];
	// 
	for(int i = 2;i < p;++i)inv[i] = (p-p/i) * inv[p % i] % p;
	// 
	r.resize(p);	
	r[0] = a[0];
	for(int i = 1;i < p;++i){
		for(int j = 1;j < p;++j)po[j] = form(po[j-1] * i);
		int ls = 0;
		int v = 1;
		for(int j = 0;j < r.size();++j)ls = form(ls + r[j] * po[j]);
		for(int j = 0;j < i;++j){
			v = form(v * form(i-j));
		}
		int sc = form(inv[v] * form(a[i] - ls));
		// cout << v<<" -V " << "target = " << form(a[i]-ls) << '\n';
		for(int i = 0;i < fun.size();++i)r[i] = form(r[i] + sc * fun[i]);
		fun = fun * vector<int>{-i, 1};
	}
	// for(auto j : fun)cout << j << ' ';cout << '\n';
	for(int i = 0;i < p;++i)cout << r[i] << " \n"[i==p-1];
	// for(int i = 0;i < p;++i)assert(getv(i) == a[i]);
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include<iomanip>
using namespace std;


int main()
{
    long S;
    cin >> S;
    long X1,X2,X3,Y1,Y2,Y3;
    X3 = 0;
    Y3 = 0;
    X2 = 0;
    Y2 = 0;
    X1 = 0;
    Y1 = 0;
    long num = ceil(pow(S,0.5));
    X1 = num;
    Y2 = X1;
    long S_dash;
    S_dash = X1*Y2 -S;
    long route = pow(S_dash,0.5);
    //cout << S_dash << endl;
    //cout << route << endl;
    if(S_dash < pow(10,9))
    {
        X2 = S_dash;
        Y1 = 1;
        cout << X1 <<' '<< Y1 <<' '<< X2 <<' '<< Y2 <<' '<< X3 <<' '<< Y3 << endl; 
    }else{
        for (long i = route+1; i > 0; i--)
        {
            if(S_dash%i==0){
                X2 = i;
                Y1 = S_dash/i;
                cout << X1 <<' '<< Y1 <<' '<< X2 <<' '<< Y2 <<' '<< X3 <<' '<< Y3 << endl; 
                break;
            }
        }
        
    }
}

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

using namespace std;

template <class T>
using lim = numeric_limits<T>;

typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin >> n;
	char s[n];
	
	string ans = "";
	int tracker = 0;
	for (int i = 0; i < n; i++){
		cin >> s[i];
		
		if (s[i] == '('){
			tracker++;
			ans += s[i];
		}
		
		// insert open if 0 are open
		else{
			if (tracker <= 0){
				ans = '(' + ans;
				ans += s[i];
			}
			else {
				tracker--;
				ans += s[i];
			}
		}
	}
	
	// close all remaining open
	for (int i = 0; i < tracker; i++){
		ans += ')';
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (W, H, x, y, r) = readLine()!!.split(" ").map { it.toInt() }

    println(
            if (x - r < 0 || y - r < 0 || x + r > W || y + r > H) {
                "No"
            } else {
                "Yes"
            }
    )

}



Measured memory_bytes: 33948
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

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 (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n, x; cin >> n >> x;
    vint a(n); vin(a); sort(all(a));
    int sum = accumulate(all(a), 0LL);
    if(sum == x) {
        print(n);
        return 0;
    }
    if(sum < x) {
        print(n - 1);
        return 0;
    }

    int ans = 0;
    rep(i, n) {
        if(x >= a[i]) {
            x -= a[i];
            ans++;
        } else {
            print(ans);
            return 0;
        }
    }

    return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
	ll N;
	cin>>N;
	string S;
	cin>>S;
	ll ans=1;
	if(N==1){
		cout<<1<<endl;
		return 0;
	}
	char buf = S[0];
	for(int i=1; i<S.size(); i++){
		if(buf != S[i]){
			ans++;
			buf = S[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 512
import std.stdio;
import std.string;
import std.array;
import std.algorithm;
import std.conv;

void main() {
    int H, W, N;
    while (readf("%d %d %d\n", &H, &W, &N), H || W || N) {
        int[][] F = new int[][H];
        foreach (ref L; F) L = readln.chomp.split(" ").map!(to!int).array;
        int[][] C = new int[][](H, W);
        void f() {
            foreach (y; 0 .. H) {
                foreach (x; 0 .. W) {
                    if (y - 1 >= 0) {
                        C[y][x] += (C[y - 1][x] + (F[y - 1][x] == 0)) / 2;
                    }
                    if (x - 1 >= 0) {
                        C[y][x] += (C[y][x - 1] + (F[y][x - 1] == 1)) / 2;
                    }
                }
            }
            foreach (y; 0 .. H) {
                foreach (x; 0 .. W) {
                    if (C[y][x] % 2) {
                        F[y][x] = !F[y][x];
                    }
                }
            }
        }
        C[0][0] = N - 1;
        f;
        int y = 0, x = 0;
        while (true) {
            if (F[y][x]) {
                x++;
            } else {
                y++;
            }
            if (y >= H || x >= W) {
                writeln(y + 1, " ", x + 1);
                break;
            }
        }
    }
}

Measured memory_bytes: 12256
#include <iostream>
#include <vector>
#include <stack>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORI(i,z,n) for(int i=z;i<n;i++)

using namespace std;

vector<vector<int> > graph;
vector<bool> seen;
vector<bool> localSeen;

bool hasLoop(int i) {
    stack<pair<int, bool> > Q;
    Q.push(make_pair(i, true));
    while (! Q.empty()) {
        auto x = Q.top();
        Q.pop();
        int u = x.first;
        bool goingDown = x.second;

        if (goingDown) {
            if (! seen[u]) {
            Q.push(make_pair(u, false));
            localSeen[u] = true;
            for(int v: graph[u])
                if (localSeen[v])
                    return true;
                else
                    Q.push(make_pair(v, true));
            }
        } else {
            localSeen[u] = false;
            seen[u] = true;
        }

    }
    return false;
}

int main () {
    int V, E;
    cin >> V >> E;

    graph.resize(V);
    seen.resize(V, false);
    localSeen.resize(V, false);

    FOR(i, E) {
        int f, t;
        cin >> f >> t;
        graph[f].push_back(t);
    }

    FOR(i, V)
        if (! seen[i])
            if (hasLoop(i)) {
                cout << 1 << endl;
                return 0;
            }

    cout << 0 << endl;
}



Measured memory_bytes: 3148
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

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

/*
完全二分木
v[now].lch = v.size(); v.PB(node(v[now].d+1)); now = v[now].lch;  // 左に追加
v[now].rch = v.size(); v.PB(node(v[now].d+1)); now = v[now].rch;  // 右に追加
*/
struct node {
  int d, lch, rch;
  node() {lch=rch=d=-1;}
  node(int d):d(d){lch=rch=-1;}
};
vector<node> v;

int n, l, ans;
string s[100010];

signed main(void)
{
  cin >> n >> l;
  REP(i, n) cin >> s[i];

  v.PB(node(0));
  REP(i, n) {
    int now = 0;
    REP(j, s[i].size()) {
      if(s[i][j] == '0') {
        if(v[now].lch != -1) now = v[now].lch;
        else {
          v[now].lch = v.size();
          v.PB(node(v[now].d+1));
          now = v[now].lch;
        }
      } else {
        if(v[now].rch != -1) now = v[now].rch;
        else {
          v[now].rch = v.size();
          v.PB(node(v[now].d+1));
          now = v[now].rch;
        }
      }
    }
  }

  int ret = 0;
  for(auto i: v) {
    if(i.lch == -1 && i.rch == -1) continue;
    if(i.lch == -1 || i.rch == -1) ret ^= (l-i.d)&(i.d-l);
  }

  if(ret) cout << "Alice" << endl;
  else cout << "Bob" << endl;

  return 0;
}


Measured memory_bytes: 5924
import java.io.*;
import java.util.*;

public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;

  private static PrintWriter _err = new PrintWriter(System.err);

  private void solve(Scanner sc, PrintWriter out) {
    String w = sc.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (int i = 0; i < w.length(); ++i) {
      char ch = w.charAt(i);
      Integer cnt = map.get(ch);
      if (cnt == null) {
        cnt = 0;
      }
      ++cnt;
      map.put(ch, cnt);
    }
    boolean ok = true;
    for (Integer cnt : map.values()) {
      if (cnt % 2 != 0) {
        ok = false;
        break;
      }
    }
    out.println((ok ? "Yes" : "No"));
  }
  private long C(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    for (long i = r; i > 1; --i) {
      res /= i;
    }
    return res;
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  private long ceil2pow(long n) {
    if (n == 0) {
      return 1;
    }
    n--;
    n |= (n >>> 1);
    n |= (n >>> 2);
    n |= (n >>> 4);
    n |= (n >>> 8);
    n |= (n >>> 16);
    n++;
    return n;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();

    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();

    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

Measured memory_bytes: 9680
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<ldouble, ldouble> pdd;

int n;

typedef pair<pii, int> ppi;
ppi p[110];
pii operator-(pii a, pii b) { return pii(a.Fi - b.Fi, a.Se - b.Se); }
ll operator/(pii a, pii b) { return (ll)a.Fi * b.Se - (ll)a.Se * b.Fi; }
ll operator*(pii a, pii b) { return (ll)a.Fi * b.Fi + (ll)a.Se * b.Se; }
double ans[110];

void solve() {
	scanf("%d", &n);
	rep(i, n) {
		int x, y; scanf("%d%d", &x, &y);
		p[i] = make_pair(pii(x, y), i);
	}
	sort(p, p+n);
	for(int i=n-1;i>=0;i--) {
		p[i].Fi = p[i].Fi - p[0].Fi;
	}
	sort(p, p+n, [&](ppi a, ppi b) {
		ll t = a.Fi / b.Fi;
		if(t != 0) return t > 0;
		else return a.Fi * a.Fi < b.Fi * b.Fi;
	});
	vector <ppi> V;
	rep(i, n) {
		while(szz(V) > 1 && (p[i].Fi - V.back().Fi) / (V.back().Fi - V[szz(V)-2].Fi) >= 0) V.pop_back();
		V.push_back(p[i]);
	}
	if(szz(V) == 2) {
		ans[V[0].second] = ans[V[1].second] = 0.5;
	}
	else {
		rep(i, szz(V)) {
			pii px = V[i].Fi, py = V[(i+1)%szz(V)].Fi, pz = V[(i+szz(V)-1)%szz(V)].Fi;
			double t = atan2((py - px) / (pz - px), (py - px) * (pz - px));
			double P = acos(-1);
			t = P - t;
			t /= 2 * P;
			ans[V[i].second] = t;
		}
	}
	rep(i, n) printf("%.12f\n", ans[i]);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 384
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: [usize; n],
    }
    let mut box_ = vec![0; n];
    let mut cnt = 0;

    for i in (0..n).rev() {
        let mut acc = 0;
        let mut j = i+1;
        while j <= n {
            acc += box_[j-1];
            j += i+1
        }

        if acc % 2 == a[i] {
            continue
        }
        box_[i] = 1;
        cnt += 1;
    }

    println!("{}", cnt);
    for i in 0..n {
        if box_[i] == 1 {
            print!("{} ", i+1)
        }
    }
    println!("");
}


Measured memory_bytes: 9084
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;
bool sr(ll a, ll b)
{
	return a > b;
}
bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(ll n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}

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

	vector<string> aki = {"AKI", "KI", "HA", "H", "BA", "B", "RA", "R"};
	bool ans = false;
	rep(i, 17)
	{
		string tmp ;
		rep(j, 4)
		{
			if (i & 1 << j)
			{
				tmp += aki[j * 2];
			}
			else
			{
				tmp += aki[j * 2 + 1];
			}
		}
		if(s==tmp){
			ans=true;
		}
		
	}
	if(ans){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {

	var N int

	fmt.Scan(&N)

	switch N % 10 {
	case 2, 4, 5, 7, 9:
		fmt.Println("hon")
	case 0, 1, 6, 8:
		fmt.Println("pon")
	case 3:
		fmt.Println("bon")
	}
}


Measured memory_bytes: 1768