akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#define MAX_NUM 100000
#define INF 100000000


using namespace std;




int inputnumber(int *n){
	cin >> *n;
	return 0;
}

int initm(int k,int *m,priority_queue<pair<int,int>> *q){
	for(int i=0;i<k;i++)
		m[i]=1<<30;

	for(int i=1;i<=9;i++){
		if(i<m[i%k]){
			m[i%k]=i;
			q->push({-m[i%k],i%k});
		}
	}
	return 0;
}


int printq(priority_queue<pair<int,int>> *q){
	while(q->size()){
		cout << q->top().first << " " << q->top().second << endl;
		q->pop();
	}
	return 0;
}

int printm(int k,int *m){
	for(int i=0;i<k;i++)
		cout << "m[" << i << "]=" << m[i] << endl;
	return 0;
}

int firstresolv(int k,int *mi,priority_queue<pair<int,int>> *q){
	int i;
	int m;
	int x;
	for(i=1;i<=9;i++){
		m=mi[i];
		for(int j=0;j<=9;j++){
			if(j==0){
				x=i*10;
			}else{
				x=i+j;
				m=m+j;
			}
			if(m<mi[x%k]){
				mi[x%k]=m;
				q->push({-mi[x%k],x%k});
				cout << "push " << x%k << endl;
			}
		}
	}
	return 0;
}

int resolv(int k,int *mi,priority_queue<pair<int,int>> *q){
	int j,x;
	int m,i;
	while(q->size()>0){
		//cout << "q size = " << q->size() << endl;
		m=-q->top().first;
		i=q->top().second;
		//cout << "pop " << i << " " << m << endl;
		q->pop();
		//if(mi[i%k]>m){
			for(j=0;j<=9;j++){
				if(j==0){
					x=i*10;
				}else{
					x=i+j;
					m=m+j;
				}
				//cout << "compare " << x%k << " " << m << ' ' << mi[x%k]<<' '<<m<<endl;
				if(m<mi[x%k]){
					mi[x%k]=m;
					q->push({-mi[x%k],x%k});
					//cout << "push " << x%k << endl;
				}
			}
		//}
	}
	return 0;
}




int main() {
	int k;
	int m[MAX_NUM];
	priority_queue<pair<int,int>> q;

	inputnumber(&k);
	initm(k,m,&q);
	//cout << m[0] << endl;
	//cout << q.size() << endl;
	//firstresolv(k,m,&q);
	resolv(k,m,&q);
	cout << m[0] << endl;
	//cout << endl;
	//printm(k,m);
	//printq(&q);

	return 0;
}


Measured memory_bytes: 2804
#include<cstdlib>
#include<vector>
#include<string>
#include<algorithm>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<cstdio>
#include<iostream>
#include<vector>
#define MAXN 1000
using namespace std;
typedef long long ll;
priority_queue<ll>op;
int main()
{
	ios::sync_with_stdio(false);
	//freopen("../in", "r", stdin);
	//freopen("../out", "w", stdout);
	ll m,n;
	ll temp;
	cin>>m>>n;
	for(ll i=0;i<m;i++)
	{
		cin>>temp;
		op.push(temp);
	}
	while(n!=0)
	{
		ll k=op.top();
		op.pop();
		k/=2;
		op.push(k);
		n--;
	}
	ll sum=0;
	while(!op.empty())
	{
		sum += op.top();
		op.pop();
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>

#include<vector>
#include<set>

using namespace std;

const int mod=1000000007;

int main()
{
	
	int t[] = { 500,100,50,10,5,1 };

	while (1) {
		int n, ans = 0;
		cin >> n;
		if (n == 0)break;

		n = 1000 - n;


		for (int i = 0; i < 6; i++) {
			ans += n / t[i];
			n %= t[i];
		}

		cout << ans << endl;

	}
	
    return 0;
}




Measured memory_bytes: 2996
N=int(input())
ans=[0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v=i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1

for i in range(N):
    print(ans[i+1])

Measured memory_bytes: 9300
#include<bits/stdc++.h>
using namespace std;
// #define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	long double ans=0;
	for(int i=1;i<=n;++i)
	{
		long double p=1;
		int j=i;
		while(j<k)
		{
			j*=2;
			p/=2.00;
		}
		ans+=p;
	}
	cout<<fixed<<setprecision(15)<<ans/n;
}


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

int main(){
    int N,L,i;
    cin>>N>>L;
    vector<string>S(N);
    for(i=0;i<N;i++)cin>>S[i];
    sort(S.begin(),S.end());
    for(i=0;i<N;i++)cout<<S[i];
    cout<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
void MergeSort(long long int x[ ],long long int left,long long int right);
        long long int temp[200001];
int main (void){
        int ans;
        int N;
        long long int A[200001];
        long long int B[200001];

        scanf("%d",&N);
        for (int i = 0; i < N; i++) {
                scanf("%lld",&A[i]);
                B[i]=A[i];
        }

MergeSort(A, 0, N-1);
if(N==2){
  printf("%lld\n",A[1]);
  printf("%lld\n",A[0]);
}else{
for (int i = 0; i < N; i++) {
  if (B[i]<=A[(N/2)-1]) {
    printf("%lld\n",A[N/2]);
  }else{
    printf("%lld\n",A[(N/2)-1]);
  }
      }
}
        return 0;
}

void MergeSort(long long int x[ ],long long int left,long long int right)
{
    long long int mid, i, j, k;

    if (left >= right)              /* 配列の要素がひとつなら */
        return;                     /* 何もしないで戻る */

                                    /* ここでは分割しているだけ */
    mid = (left + right) / 2;       /* 中央の値より */
    MergeSort(x, left, mid);        /* 左を再帰呼び出し */
    MergeSort(x, mid + 1, right);   /* 右を再帰呼び出し */

      /* x[left] から x[mid] を作業領域にコピー */
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      /* x[mid + 1] から x[right] は逆順にコピー */
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         /* i とj は作業領域のデーターを */
    j = right;        /* k は配列の要素を指している */

    for (k = left; k <= right; k++)    /* 小さい方から配列に戻す */
        if (temp[i] <= temp[j])        /* ここでソートされる */
            x[k] = temp[i++];
        else
            x[k] = temp[j--];
}

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

using namespace std;

const int N = 205;

int n, a[N];

int main(){
    scanf("%d", &n);
    for (int i = 1; i <= n * 2; i++) scanf("%d", &a[i]);

    sort(a + 1, a + 2 * n + 1);
    int ans = 0;
    for (int i = 1; i <= n * 2; i = i + 2) ans += a[i];
    printf("%d", ans);
    return 0;
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

long long gcd(long long a, long long b) {
    return b ? gcd(b, a % b) : a;
}

int n, x;

int main() {
    cin >> n >> x;
    Vl a(n);
    REP(i, n) {
        ll b; cin >> b;
        a[i] = abs(x - b);
    }

    ll g = a[0];
    REP2(i, 1, n) {
        g = gcd(g, a[i]);
    }
    cout << g << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main(){
  string a, b, c;
  cin >> a >> b >> c;
  if(a[a.size()-1] == b[0] && b[b.size() - 1] == c[0])  cout << "YES" << endl;
  else  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n; cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a, b; cin >> a >> b;
        cout << a+b << endl;
    }
    return 0;
}

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

typedef pair <int, int> ii;
typedef pair <ii, int> iii;

const int Maxn = 2005;
const int Inf = 1000000000;

int n;
char str[Maxn];
vector <int> neigh[Maxn];
int res = Inf, best, bi;
ii tr[Maxn][Maxn];
int solv[Maxn][Maxn];

ii Traverse(int v, int p)
{
    if (tr[v][p].first == -1) {
        ii res = ii(0, 0);
        if (str[v] == '1') res.second++;
        for (int i = 0; i < neigh[v].size(); i++) {
            int u = neigh[v][i];
            if (u == p) continue;
            ii got = Traverse(u, v);
            res.first += got.first + got.second;
            res.second += got.second;
        }
        tr[v][p] = res;
    }
    return tr[v][p];
}

int Solve(int v, int p)
{
    if (solv[v][p] == -1) {
        vector <iii> seq;
        for (int i = 0; i < neigh[v].size(); i++) {
            int u = neigh[v][i];
            if (u == p) continue;
            ii got = Traverse(u, v);
            seq.push_back(iii(ii(got.first + got.second, got.second), u));
        }
        if (seq.empty()) return solv[v][p] = 0;
        sort(seq.begin(), seq.end());
        int mx = seq.back().first.second + Solve(seq.back().second, v);
        int sum = 0;
        for (int i = 0; i + 1 < seq.size(); i++)
            sum += seq[i].first.first;
        if (sum >= mx) return solv[v][p] = (sum + mx) % 2;
        else return solv[v][p] = mx - sum;
    }
    return solv[v][p];
}

int main()
{
    fill((ii*)tr, (ii*)tr + Maxn * Maxn, ii(-1, -1));
    fill((int*)solv, (int*)solv + Maxn * Maxn, -1);
    scanf("%d", &n);
    scanf("%s", str + 1);
    for (int i = 0; i < n - 1; i++) {
        int a, b; scanf("%d %d", &a, &b);
        neigh[a].push_back(b);
        neigh[b].push_back(a);
    }
    for (int i = 1; i <= n; i++) {
        int g = Traverse(i, 0).first;
        if (g % 2 == 0 && g / 2 < res)
            if (Solve(i, 0) == 0) res = g / 2;
    }
    printf("%d\n", res >= Inf? -1: res);
    return 0;
}


Measured memory_bytes: 47744
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a * b) % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    int n, q;
    int[] as;
    Query[] qs;

    public static void main(String[] args) {
        Main m = new Main();
        m.read();
        m.solve();
    }

    void read() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        q = sc.nextInt();
        as = new int[n];
        Arrays.fill(as, (2 << 30) - 1);
        qs = new Query[q];
        for (int i = 0; i < q; i++) {
            int num = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            qs[i] = new Query(num, x, y);
        }
    }

    void solve() {
        SegmentTree tree = new SegmentTree(n);
        tree.initialize(as);
        for (Query query: qs) {
            if (query.num == 0) {
                as[query.x] = query.y;
                tree.update(query.x, query.y);
            } else {
                int ans = tree.query(query.x, query.y+1,
                            0, 0, tree.n);
                System.out.println(ans);
            }
        }
    }

    private class Query {
        int num, x, y;
        Query(int n, int x, int y) {
            num = n;
            this.x = x;
            this.y = y;
        }
    }

    private class SegmentTree {
        int n;
        int[] tree;
        SegmentTree (int k) {
            for (n = 1; n < k; n *= 2) {}
            tree = new int[2*n - 1];
            Arrays.fill(tree, Integer.MAX_VALUE);
        }

        void initialize(int[] as) {
            for (int i = 0; i < as.length; i++) {
                update(i, as[i]);
            }
        }

        void update(int i, int x) {
            i += n  - 1;
            tree[i] = x;
            while (i > 0) {
                i = (i - 1) / 2;
                tree[i] = Math.min(tree[i * 2 + 1], tree[i * 2 + 2]);
            }
        }

        int query(int x, int y, int k, int l, int r) {
            if (r <= x || y <= l) return Integer.MAX_VALUE;
            if (x <= l && r <= y) return tree[k];
            else {
                int vl = query(x, y, k * 2 + 1, l, (l + r) / 2);
                int vr = query(x, y, k * 2 + 2, (l + r) / 2, r);
                return Math.min(vl, vr);
            }
        }
    }
}

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

using lli = int64_t;

int dig(lli k)
{
    int ans = 0;

    for(; k; k /= 10) ans++;

    return ans;
}

lli f(lli a, lli b)
{
    return max(dig(a), dig(b));
}

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

    lli n; cin >> n;

    lli q = sqrtl(n) + 1;

    lli ans = LLONG_MAX;

    for(lli i = 1; i <= q; i++) if(n % i == 0)
    {
        ans = min(ans, f(i, n / i));
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#階乗のリストを作成する
mod = 10**9 + 7

frac = [1]
for i in range(2005):
    frac.append(frac[i]*(i+1)%mod)
#上の公式を用いてcombの計算を行う
def comb(n, k, mod):
    a=frac[n]
    b=frac[k]
    c=frac[n-k]
    return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod

def main():
  s = int(input())
  n = 1
  ans = 0
  while s-3*n >= 0:
    ans += comb(s-2*n-1, n-1, mod)
    ans %= mod
    n += 1
  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 9148
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++)
        seq[i] = Integer.parseInt(line[i]);

      count = bubbleSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int bubbleSort(int[] a, int n) {
    int count=0;

    for(int i=0,f=1,t; i<n || f==1; i++ ) {
      f=0;
      for(int j=n-1; j>0; j-- ) {
        if( a[j] < a[j-1]) {
          t = a[j];
          a[j] = a[j-1];
          a[j-1] = t;
          count++;
          f=1;
        }
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> M;
    for (int i = 0; i < H; i++) {
        string s;
        cin >> s;
        M.push_back(s);
    }

    vector<vector<int>> cnt(H, vector<int>(W, 0));

    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if (M[i][j] == '#') {
                for(int dy = -1; dy <= 1; dy++) {
                    for(int dx = -1; dx <= 1; dx++) {
                        if (dx == 0 && dy == 0) continue;
                        int tx = j + dx;
                        int ty = i + dy;
                        if (tx < 0 || tx >= W || ty < 0 || ty >= H) continue;
                        cnt[ty][tx]++;
                    }
                }
            }
        }
    }

    for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
            if (M[i][j] == '#') {
                cout << '#';
            } else {
                cout << cnt[i][j];
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const ll inf=1e9;
const int MAX = 510000;
const ll MOD = 998244353;

inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

int main(){
  ll k,t;cin>>k>>t;
  vll a(t);
  ll sum=0;
  rep(i,0,t){
    cin>>a[i];
    sum+=a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll e=sum-a[0];
  if(e>a[0]){
    cout<<0<<endl;
  }
  else{
    cout<<a[0]-e-1<<endl;
  }
}








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

int main(void){
    double sum=0;
    int c=0;
    int n,m;cin>>n>>m;
    double a[n];
    for(int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
    for(int i=0;i<n;i++){if(a[i]>=sum/(4*m))c++;}
    if(c>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev, col;
	Edge(ll _to, ll _cap, ll _rev, ll _col) {
	to = _to; cap = _cap; rev = _rev; col=_col;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap, ll col) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size(), col));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1, col));
}


class SumSegTree {
private:
	
	ll _sum(ll a, ll b, ll k, ll l, ll r) {
		if (r <= a || b <= l)return 0;
		if (a <= l && r <= b)return dat[k];
		else {
			ll s1 = _sum(a, b, 2 * k + 1, l, (l + r) / 2);
			ll s2 = _sum(a, b, 2 * k + 2, (l + r) / 2, r);
			return s1 + s2;
		}
	}
public:
	ll n, height;
	vector<ll> dat;

	SumSegTree(ll _n) {
		n = 1;
		height = 1;
		while (n < _n) {
			n *= 2;
			height++;
		}
		dat = vector<ll>(2 * n - 1,0);
	}

    //場所i(0-indexed)にxを足す
	void add(ll i, ll x) {
		i += n - 1;
		dat[i] += x;
		while (i > 0) {
			i = (i - 1) / 2;
			dat[i] += x;
		}
	}
    
    //区間[a,b)の総和
	ll sum(ll a, ll b) {
		return _sum(a, b, 0, 0, n);
	}
};

void solve(){
    ll n;
    cin>>n;
    Array a(n);
    REP(i,n) cin>>a[i];

    auto check = [&](ll x){
        Array sum(n+1, 0);
        REP(i,n) sum[i+1]=sum[i]+(a[i]>=x?1:-1);
        ll base=n+10;
        SumSegTree seg(2*base+1);
        ll con0 = 0;
        ll con1 = 0;
        REP(i,n+1){
            ll num = seg.sum(0, sum[i]+1+base);
            con0 += num;
            con1 += i-num;
            seg.add(sum[i]+base,1);
        }
        return con0>=con1;
    };

    ll l=0;
    ll r=(ll)1e9+1;
    while(l+1<r){
        ll m=l+r>>1;
        if(check(m)) l=m;
        else r=m;
    }
    cout<<l<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 5896
#include<algorithm>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<cstring>
#include<queue>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define output(x) cout<<x<<endl;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;

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

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

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


int par[100001];

void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
}
//木の根を求める
int root(int x) {
	if (par[x] == x)
		return x;
	else {
		return par[x] = root(par[x]);
	}
}
//find
bool same(int x, int y) {
	return root(x) == root(y);

}
//union
void unite(int x, int y) {
	x = root(x);
	y = root(y);
	if (x == y) return;
	par[x] = y;
}

int main()
{
	long long int i, j, k, l, m, n, sum,flag,ans1,N,M,K,X,Y;
	sum = 0;
	flag = 0;
	ans1 = 0;
	cin >> N >> M;
	bool isprime[200001] ;
	REP(i, 0, 200001) {
		isprime[i]= 1;
	}
	long long int prime[200001] = {};
	isprime[0] = isprime[1] = 0;
    int p = 0;
	REP(i, 2, 200001) {
		if (isprime[i]) {
			prime[p] = i;
			p++;
			for (j = i + i; j < 200001; j += i) {
				isprime[j] = 0;
			}
		}
	}
	long long int A;
	A = M;
	int soinsu[100000] = {};
	int z = 0;
	REP (i, 0, p) {
		if (M%prime[i] == 0) {
			while (M%prime[i] == 0) {
				M /= prime[i];
				soinsu[z]++;
			}
			z++;
		}
	}
	if (M != 1) {
		soinsu[z] = 1;
	}
	sum = 1;
	COMinit();
	REP(i, 0, z+1) {
		sum *= COM(soinsu[i] + N - 1, soinsu[i]);
		sum %= MOD;
	}
	output(sum);


	return 0;
}



Measured memory_bytes: 14336
#include <iostream>
    #include <vector>
    #include <array>
    #include <string>
    #include <stack>
    #include <queue>
    #include <deque>
    #include <map>
    #include <unordered_map>
    #include <set>
    #include <unordered_set>
    #include <tuple>
    #include <bitset>
    #include <memory>
    #include <cmath>
    #include <algorithm>
    #include <functional>
    #include <iomanip>
    #include <numeric>
    #include <climits>
    #include <cfloat>
     
    long double cal_min_estimate(const std::vector<std::vector<int>> &rooms, const int current_room, const int remove, std::vector<std::vector<long double>>& memo) {
    	if (current_room + 1 == rooms.size()) 
    		return 0;
    	if (remove < current_room && memo[current_room].back() >= 0) 
    		return memo[current_room].back();
    	if (memo[current_room][remove] >= 0) 
    		return memo[current_room][remove];
    	if (current_room == remove && rooms[current_room].size() > 1) {
    		long double sum = 0;
    		long double max = 0;
    		for (const auto next : rooms[current_room]) {
    			const auto res = cal_min_estimate(rooms, next, remove, memo);
    			sum += res;
    			max = std::max(max, res);
    		}
    		return memo[current_room][remove] = std::min((sum - max) / (rooms[current_room].size() - 1), sum / rooms[current_room].size()) + 1;
    	}
    	else {
    		long double sum = 0;
    		for (const auto next : rooms[current_room]) {
    			sum += cal_min_estimate(rooms, next, remove, memo);
    		}
    		if (remove < current_room) 
    			memo[current_room][rooms.size() - 1] = sum / rooms[current_room].size() + 1;
    		return memo[current_room][remove] = sum / rooms[current_room].size() + 1;
    	}
    }
    int main() {
    	std::cin.tie(0); std::cin.sync_with_stdio(false);
    	int n, m; std::cin >> n >> m;
    	std::vector<std::vector<int>> rooms(n);
    	for (auto i = 0; i < m; ++i) {
    		int s, t; std::cin >> s >> t;
    		rooms[s - 1].push_back(t - 1);
    	}
    	std::vector<std::vector<long double>> memo(n, std::vector<long double>(n, -1));
    	long double min = n;
    	for (auto i = 0; i < n - 1; ++i) {
    		min = std::min(min, cal_min_estimate(rooms, 0, i, memo));
    	}
    	std::cout << std::setprecision(15) << std::fixed << min << '\n';
    }

Measured memory_bytes: 7040
#include <stdio.h>
int main() {
	int a,b,i,j;

	while(1)
	{
		scanf("%d %d",&a,&b);
		if(a==0 && b==0) break;
		for(i=0;i<a;i++)
		{
				if(i==0 || i==a-1)
				{
					for(j=0;j<b;j++)
					{
						printf("#");
					}
					printf("\n");
				}else
				{
					printf("#");
					for(j=1;j<b-1;j++)
					{
						printf(".");
					}
					printf("#\n");
				}
		}
		printf("\n");
	}
	return 0;
}


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

vector<vector<int>> to;
vector<int> counter;

void dfs(int v, int p){
	for(auto nextv: to[v]){
		if(nextv == p) continue;
		counter[nextv] += counter[v];
		dfs(nextv, v);
	}
	return ;
}

int main(){
	int N,Q;
	cin >> N >> Q;
	
	to.resize(N);
	rep(i,N-1){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	
	counter.resize(N);
	
	rep(i,Q){
		int p,x;
		cin >> p >> x;
		p--;
		counter[p] += x;
	}
	
	dfs(0,-1);
	
	rep(i,N) {
		cout << counter[i] << " ";
	}
	
    return 0;
}



Measured memory_bytes: 23424
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    string s;

    cin >> n >> s;

    string t = s.substr(0, n / 2);

    if (t + t == s)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(void){
	int n,x,t;
	scanf("%d%d%d",&n,&x,&t);
	if(n%x==0) printf("%d",n/x*t);
	else printf("%d",(n/x+1)*t);
	return 0;
} 

Measured memory_bytes: 3792
Module _20190422

    Sub Main()

        Dim sStr() As Char = Console.ReadLine().ToCharArray

        Dim iMaxLength As Integer = 0
        Dim iCurrentLength As Integer = 0

        For i As Integer = 0 To sStr.Length - 1

            iCurrentLength = 0

            For j As Integer = i To sStr.Length - 1

                If sStr(j) = "A" OrElse sStr(j) = "C" OrElse sStr(j) = "G" OrElse sStr(j) = "T" Then

                    iCurrentLength = iCurrentLength + 1

                Else

                    Exit For

                End If

            Next

            If iMaxLength < iCurrentLength Then

                iMaxLength = iCurrentLength

            End If

        Next

        Console.WriteLine(iMaxLength)

    End Sub

End Module

Measured memory_bytes: 19792
N = int(input())
S = []
for i in range(N):
    S.append(str(input()))
    
from collections import Counter
import numpy as np
import itertools
initial = np.array([list(i)[0] for i in S])

counter = Counter(initial)
iflist = np.array(["M","A","R","C","H"])
num = []
for word, cnt in counter.most_common():
    if any(word == iflist):
        num.append(cnt)
        
ans = 0
for i in itertools.combinations(num,3):
    ans += np.array(i).prod()
    
print(ans)

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

typedef signed long long ll;
const int MX = 1e3 + 5;

int main() {
    string odd, even;
    cin >> odd >> even;

    int n = odd.size();
    int m = even.size();

    for(int i = 0; i < max(n, m); i++) {
        if(i < n) cout << odd[i];
        if(i < m) cout << even[i];
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
M=10**9+7;I=[1,1];*F=I;*R=I
2.upto(10**6){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}
n,*z=`dd`.split.map &:to_i
a=[]
x=0
(1..n+1).each{|i|
	j=z.shift
	if a[j]
		x=a[j]+n-i
	end
	a[j]=i
}
r=j=1
(1..n+1).each{|i|
	p ((r=r*(n+2-i)*I[i]%M)+M-j)%M
	j=j*x*I[i]%M
	x-=1
}

Measured memory_bytes: 40484
# -*- coding: utf-8 -*-

import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    b = tokens[0]

    return (b,)


def solve(b):
    
    m = {
        "A": "T",
        "C": "G",
        "G": "C",
        "T": "A",
    }

    return m[b]

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()


Measured memory_bytes: 3060
def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= i * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    n, a, b = [int(x) for x in input().split()]
    mod = 1000000007
    total = pow(2, n, mod) - 1
    ans = total - combinations_mod(n, a) - combinations_mod(n, b)
    ans %= mod
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];

  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);

  int sum=0;
  for(int i=0;i<k;i++)sum+=a[i];

  cout<<sum;

  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int a[101];
long long b[101][100005];
long long c[101][100005];

int main()
{
    int mod = 1000000000 + 7;
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i <= k; i++)
        if (i <= a[0])
            b[1][i] = 1;
    for (int i = 2; i <= n; i++) {
        c[i - 1][0] = 1;
        for (int j = 1; j <= k; j++) {
            c[i - 1][j] = c[i - 1][j - 1] + b[i - 1][j];
            c[i - 1][j] %= mod;
        }
        for (int j = 0; j <= k; j++) {
            b[i][j] = c[i - 1][j];
            if (j - a[i - 1] - 1 >= 0) {
                b[i][j] -= c[i - 1][j - a[i - 1] - 1];
                if (b[i][j] < 0)
                    b[i][j] += mod;
            }
        }
    }
    cout << b[n][k];
    return 0;
}

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

vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << endl;
}

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

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

    int counter1 = 0;
    int counter2 = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = i; j >= 1; j--) {
            if (i%j == 0 && i%2 != 0) {
                counter1++;
            }

            if (counter1 == 8) {
                counter2++;
            }
        }
        counter1 = 0;
    }
    printf("%d\n", counter2);


    return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-

N, M = list(map(int, input().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


F = make_divisors(M)
gcd = 0

for i in range(len(F)):
    if F[i] * N > M:
        break

    gcd = F[i]

print(gcd)

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll gcd(ll a, ll b){
  if(a < b)
    return gcd(b, a);

  if(b == 0)
    return a;

  ll r = a % b;
  return gcd(b, r);
}

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

  ll a,b;
  cin >> a >> b;

  ll gcd_num = gcd(a, b);
  set<ll> factor_list;

  factor_list.insert(1);
  for(ll i = 2; i <= sqrt(gcd_num); i++){
    while(gcd_num%i == 0){
      gcd_num /= i;
      factor_list.insert(i);
    }
  }

  factor_list.insert(gcd_num);
  cout << factor_list.size() << endl;

  
}


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

using namespace std;

int A[3];

int main(){
	scanf("%d %d %d", A, A + 1, A + 2);
	sort(A, A + 3);
	if (A[0] == A[2]) {
		printf("No\n");
	} else {
		if (A[1] == A[0] || A[1] == A[2]) {
			printf("Yes\n");
		} else {
			printf("No\n");
		}
	}
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
from fractions import gcd
from functools import reduce

n,m = map(int,readline().split())
alst = list(map(int,readline().split()))

def lcm(x,y):
  g=gcd(x,y)
  if x//g %2==0 or y//g%2==0:
    return 0
  return x*y//g
g=reduce(lcm,alst)
if g==0:
  print(0)
  quit()
else:
  res=(2*m//g)
  print(res//2+res%2)

Measured memory_bytes: 14532
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int t; cin >> t;
    cout << 48 - t << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll N;
    ll A[MAX_N];
    ll answer = 0;

    cin >> N;
    rep(i, N) cin >> A[i];
    sort(A,A+N);

    map<ll,ll> cnt;
    rep(i,N) {cnt[A[i]] = 0; cnt[A[i] + 1] = 0; cnt[A[i] - 1] = 0;}
    rep(i,N) cnt[A[i]] ++;

    for(auto& kv: cnt){
        if (kv.second > 0){
            ll idx = kv.first;
            answer = max(cnt[idx - 1] + cnt[idx] + cnt[idx + 1], answer);
        }
    }

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 6912
class PriorityQueue
  attr_accessor :data, :compare, :compare_method_name

  def initialize(array = [], compare_proc = nil)
    @data = []
    array.each { |a| push(a) }
    @compare_proc = compare_proc
    @compare = "small_compare"
  end

  def change_to_bigger
    @compare = "large_compare"
  end

  def push(element)
    current = @data.size
    while current > 0
      p = parent(current)
      break if compare_equal(@data[p], element)
      @data[current] = @data[p]
      current = p
    end
    @data[current] = element
  end

  def pop
    ret = @data[0]
    x = @data[-1]
    current = 0
    while have_child?(current)
      a = left_child(current)
      b = right_child(current)
      a = b if b < @data.size - 1 && compare(@data[b], @data[a])
      break if compare_equal(x, @data[a])
      @data[current] = @data[a]
      current = a
    end
    @data[current] = x
    @data.pop

    ret
  end

  def front
    @data[0]
  end

  def empty?
    @data.empty?
  end

  def size
    @data.size
  end

  private
  def parent(num)
    (num - 1) / 2
  end

  def left_child(num)
    num * 2 + 1
  end

  def right_child(num)
    num * 2 + 2
  end

  def have_child?(num)
    left_child(num) < @data.size - 1
  end

  def small_compare(a, b)
    a < b
  end

  def large_compare(a, b)
    a > b
  end

  def compare(a, b)
    return @compare_proc.call(a, b) unless @compare_proc.nil?
    send(@compare, a, b)
  end

  def compare_equal(a, b)
    return true if a == b
    compare(a, b)
  end
end

def add(a, b)
  @value += (@current - a).abs + b if @small.size == @large.size
  if @small.size == @large.size
    if a < @current
      @large.push(@current)
      @small.push(a)
      @current = @small.pop
    else
      @large.push(a)
    end
  else
    if a < @current
      @small.push(a)
    else
      @small.push(@current)
      @large.push(a)
      @current = @large.pop
    end
  end
  @value += (@current - a).abs + b if @small.size == @large.size
end

N = gets.chomp.to_i

@small = PriorityQueue.new
@small.change_to_bigger
@large = PriorityQueue.new

query = gets.chomp.split.map(&:to_i)
@current = query[1]
@value = query[2]

(N - 1).times do
  query = gets.chomp.split.map(&:to_i)
  if query[0] == 1
    add(query[1], query[2])
  else
    puts "#{@current} #{@value}"
  end
end


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



#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long 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 long long INF = 1LL<<60;

int lcm(int a,int b){
    //最小公倍数
    return a/__gcd(a,b) * b;
}

ll x;

int main()
{
    cin>>x;
    ll now=100;
    int time=0;
    while(now<x){
        time++;
        now*=1.01;
    }
    cout<<time<<endl;

    return 0;

}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
using ll =long long;
using namespace std;

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

    ll c=100;
    ll i=0;
    while(1){
        if(c>=x){
            cout<<i<<endl;
            return 0;
        }
        c=c+(c/100); 
        i++;
    }
}


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

char cs[10][16] = {
    "", ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"
};
char s[2000];

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        scanf("%s", s);
        int cur = 0, cx = -1;
        for (int i = 0; s[i]; i++) {
            if (s[i] == '0') {
                if (cur != 0) putchar(cs[cur][cx%strlen(cs[cur])]);
                cur = 0;
                cx = -1;
            }
            else {
                cur = s[i] - '0';
                cx++;
            }
        }
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 1000
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
ll N,M;

ll inf = 1e9+7;
ll func[200010] = {0};
ll inv[200010] = {0};

ll mult(ll n, ll m){
	if(n==0 || m==0) return 1;
	if(m==1) return n%inf;
	else if(m%2==0){
		ll t = mult(n,m/2);
		return (t*t)%inf;
	}else{
		ll t = mult(n,m-1);
		return (t*n)%inf;
	}
}

void factorial(ll N){
	for(ll i=0;i<=N;i++){
		if(i==0){
			func[i] = 1;
			inv[i] = 1;
		}
		else{
			func[i] = (i*func[i-1])%inf;
			inv[i] = mult(func[i],inf-2);
		}
	}
}

ll comb(ll n,ll k){
	if(n<k || n<0 || k<0) return 0;
	else return (((func[n]*inv[k])%inf)*inv[n-k])%inf;
}

ll hcomb(ll n,ll k){
	if(n==0 && k==0) return 1;
	return comb(n+k-1,k);
}

int main(){
	cin >> N >> M;
	map<int,ll> m;
	factorial(200009);
	for(int i=2;i*i<=M;i++){
		int count = 0;
		while(M%i==0){
			count++;
			M /= i;
		}
		if(count!=0) m[i] = count;
	}
	if(M!=1) m[M]++;
	ll ans = 1;
	for(auto x:m){
		ans *= hcomb(N,x.second);
		ans %= inf;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
/*I wanna be the very best, like no one ever was...*/

#include <bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and typedef Constants *******/

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

#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j; i < k; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for (auto i : a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert(B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#endif

int main()
{
    io;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);

    string s;
    cin>>s;
    if(s.size()%2==0){
        for(int i = 0; i < s.size();i+=2){
            if(s[i]=='h' && s[i+1]=='i'){
                continue;
            }else
            {
                cout<<"No\n";
                return 0;
            }
            
        }
        cout<<"Yes\n";

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



    return 0;
}

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

int main()
{
	char c;
	cin >> c;

	string res = "consonant";

	if (c == 'a') res = "vowel";
	if (c == 'i') res = "vowel";
	if (c == 'u') res = "vowel";
	if (c == 'e') res = "vowel";
	if (c == 'o') res = "vowel";

	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  int a,b,x;
  cin>>a>>b>>x;
  string ans="YES";
  if(x-a>b||x<a)ans="NO";
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 125568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
const int Nmax=200010;

int par[Nmax];

void init(int n){ //initialize
	for(int i=0;i < n;i++) par[i] = i;
}
int root(int x){ //根を求める
	if(par[x] == x) return x;
	else return par[x] = root(par[x]); //経路圧縮
}
bool find(int x, int y){
	return root(x) == root(y);
}
void unite(int x, int y){ //union
	x = root(x);
	y = root(y);
	if(x==y) return;
	par[x] = y;
}
int main() {
	int N,M;
	cin >> N >> M;
	int p[Nmax],x,y;
  init(N);
	for(int i=0;i < N;i++){
		cin >> p[i];
		//par[p[i]] = i+1;
	}
	for(int i=0;i < M;i++){
		cin >> x >> y;
		unite(p[x-1], p[y-1]);
	}
	int cnt=0;
	for(int i=0;i < N;i++){
		if(find(i+1, p[i])) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024