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

typedef long long ll;

ll gcd(ll a, ll b){
    if(a<b) return gcd(b,a);
    ll r;
    while(r=a%b){
        a = b; b = r;
    }
    return b;
}

int main(){
    ll K;
    cin >> K ;
    ll ans = 0;
    for(ll i = 1; i <= K; i++){
        for(ll j = i; j <= K; j++){
            for(ll k = j; k <= K; k++){
                ll tmp = gcd(i,j);
                tmp = gcd(tmp, k);
                if(i == j && j == k){
                    ans += tmp;
                } else if(i ==j || j == k || i == k){
                    ans += tmp * 3;
                } else { 
                    ans += tmp * 6;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
#include<map>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define mod 1000000007
//#define mod 998244353

int N;
vector<pair<int,int> > soinsu;
vector<int> tasizan;
signed main(){
    scanf("%lld",&N);
    if(N==1){
        printf("0\n");
        return 0;
    }
    //素因数分解
    int nowN=N;
    int maxcnt=1;
    for(int i=2;i<=sqrt(N)+1;i++){
        int cnt=0;
        while(nowN%i==0){
            cnt++;
            nowN=nowN/i;
        }
        if(cnt>0)soinsu.pb(mp(i,cnt));
        maxcnt=max(maxcnt,cnt);
        if(nowN==1)break;
    }
    if(nowN!=1)soinsu.pb(mp(nowN,1));
    //足し算を作る
    int tasu=0;
    for(int i=1;tasu<maxcnt;i++){
        tasu+=i;
        tasizan.pb(tasu);
        //printf("!%lld\n",tasu);
    }
    int ans=0;
    rep(i,soinsu.size()){
       //printf("%lld %lld\n",soinsu[i].first,soinsu[i].second);
       int e=soinsu[i].second;
       int wakeru=upper_bound(tasizan.begin(),tasizan.end(),e)-tasizan.begin();
       ans+=wakeru;
       //printf("!%lld %lld\n",ans,wakeru);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3228
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
using namespace std;
signed main() {
	int n, m, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0;
	cin >> n >> m;
	if (n % 3 == 0 || m % 3 == 0) { cout << 0 << endl; return 0; }
	a = n * ((m + 1) / 3);
	b = (m - ((m + 1) / 3)) * (n / 2);
	c = (m - ((m + 1) / 3)) * ((n + 1) / 2);
	d = max(a, max(b, c)) - min(a, min(b, c));
	a = 0; b = 0; c = 0;
	a = m * ((n + 1) / 3);
	b = (n - ((n + 1) / 3)) * (m / 2);
	c = (n - ((n + 1) / 3)) * ((m + 1) / 2);
	e = max(a, max(b, c)) - min(a, min(b, c));
	a = 0; b = 0; c = 0;
	a = m * ((n + 1) / 3);
	b = (n - ((n + 1) / 3)) / 2 * m;
	c = (n - ((n + 1) / 3) + 1) / 2 * m;
	f = max(a, max(b, c)) - min(a, min(b, c));
	a = 0; b = 0; c = 0;
	a = n * ((m + 1) / 3);
	b = (m - ((m + 1) / 3)) / 2 * n;
	c = (m - ((m + 1) / 3) + 1) / 2 * n;
	g = max(a, max(b, c)) - min(a, min(b, c));
	cout << min(min(d, e), min(f, g)) << endl;
}

Measured memory_bytes: 256
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())

    MOD = 10 ** 9 + 7
    fact = [1, 1]  # fact[n] = (n! mod MOD)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod MOD)
    inv = [0, 1]

    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % MOD)
        inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
        factinv.append((factinv[-1] * inv[-1]) % MOD)

    def cmb(n, r, p):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n - r] % p

    for i in range(1, K + 1):
        res = cmb(N - K + 1, i, MOD) * cmb(K - 1, i - 1, MOD)
        res %= MOD
        print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 42732
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define F           first
#define S           second
#define vl          vector<ll>
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

const int N = 2e5+5;
ll can[N];
ll a[N];

void solve()
{
       ll n; cin>>n;
       rep(i,1,n+1) cin>>a[i];
       ll ans=0;
       for(ll i=n; i>0; i--)
       {
              ll par=0;
              for(ll j=2*i; j<=n; j+=i) par+=can[j];
              if(a[i]==0)
              {
                     if(par&1) can[i]=1;
              }
              else if(a[i]==1)
              {
                     if(par%2==0) can[i]=1;
              }
              ans+=can[i];
       }
       cout<<ans<<endl;
       for(ll i=1; i<=n; i++) if(can[i]) cout<<i<<endl;
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 3968
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    bool prime[200000];
    int primeNum[10100] = {0};
    rep(i,105000){
        prime[i] = true;
    }
    prime[0] = false;
    prime[1] = false;
    int j = 1;
    rep(i,105000){
        if(prime[i]){
            primeNum[j] = i;
            j++;
            for(int k = 2 * i; k < 105000; k+= i){
                prime[k] = false;
            }
        }
    }
    int ans[50001];
    range(i,1,50000){
        if(primeNum[i] > 50000) break;
        range(j,i,50000){
            if(primeNum[i] + primeNum[j] > 50000) break;
            ans[ primeNum[i] + primeNum[j] ]++;
        }
    }
    int input;
    while(cin >> input, input){
        cout << ans[input] << endl;
    }
}

Measured memory_bytes: 1508
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N,x;cin >> N >> x;
    vector<int> a(N);
    rep(i,N)cin >> a[i];
    ll res=0;
    if(a[0]>x){
        res+=a[0]-x;
        a[0]=x;
    }
    for(int i=0;i<N-1;i++){
        if(a[i]+a[i+1]>x){
            res+=(a[i]+a[i+1])-x;
            a[i+1]-=(a[i]+a[i+1])-x;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
#include <atcoder/scc>;
#include <atcoder/convolution>
#include <atcoder/modint>
#include <atcoder/math>
#include <atcoder/dsu>
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using namespace atcoder;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll mod = 998244353;
int main() {
	ll N, Q;
	cin >> N >> Q;
	vector<ll> t(Q);
	vector<ll> u(Q);
	vector<ll> v(Q);
	rep(i,Q) {
		cin >> t.at(i) >> u[i] >> v[i];

	}
	dsu d(N);
	rep(i, Q) {
		if (t[i] == 0) {
			d.merge(u[i], v[i]);
		}
		else {
			if (d.same(u[i], v[i])) {
				cout << 1 << endl;
			}
			else {
				cout << 0 << endl;
			}
		}
	}
}

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

int main()
{
    int n,k,ans=0;
    cin>>n;
    k = n/100;
    if(n>=k*100&&n<=k*105)
        ans=1;
    if(n<100)
        ans=0;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3640
/**Bismillahir Rahmanir Rahim.**/

/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>

using namespace std;

//----------------------------------------------------------//

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

//-----------------------------------------------------------//
#define      test                       int t; cin>>t;  while(t--)

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)

#define      sc1(x)                     scanf("%lld",&x);
#define      sc2(x,y)                   scanf("%lld %lld", &x, &y)
#define      scf1(x)                    scanf("%lf",&x)
#define      scf2(x,y)                  scanf("%lf %lf", &x, &y)

#define      INPUT                      freopen("input.txt", "r", stdin)
#define      OUTPUT                     freopen("output.txt", "w", stdout)

#define      srev                       reverse(s.begin(),s.end())
#define      sortstr                    sort(s.begin(), s.end());
#define      gtl(x)                     getline(cin, (x))

#define      PI                         acos(-1) // 3.1415926535897932
#define      MIN                        9999999

#define      Faster                     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


//-----------------------------------------------------------//

int main()
{
    Faster;



    ll n ;
    double k ;

    cin >> n >> k;

    ll a, b ;
    int cnt = 0 ;

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

        ll c = sqr(a) + sqr(b);
        double ans = sqrt(c);

        if (ans <= k)
        {
            cnt++;
        }
    }

    cout << cnt << endl;



    return 0 ;
}







Measured memory_bytes: 3772
import sys

c = [list(map(int, input().split())) for _ in range(3)]

for a1 in range(0,c[0][0]+1):
	for a2 in range(0,c[1][0]+1):
		for a3 in range(0,c[2][0]+1):
			b1 = c[0][0] - a1
			b2 = c[1][1] - a2
			b3 = c[2][2] - a3

			if a1 + b2 == c[0][1] and a1 + b3 == c[0][2] and a2 + b1 == c[1][0] and a2 + b3 == c[1][2] and a3 + b1 == c[2][0] and a3 + b2 == c[2][1]:
				print("Yes")
				sys.exit()
print("No")

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

    int main(void)
    {
        int a = 0,b = 0,c = 0;
        scanf("%d %d",&a,&b);
        
        c = (a - (b*2));
        
        if(c > 0)
            {printf("%d\n",c);}
        else
            {printf("0\n");}
        return 0;
    }

Measured memory_bytes: 1724
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n,ans=0; cin>>n; 
    while (n--){
        int a; cin>>a; 
        ans += a-1;
    }
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#define MAX 100000

int A[MAX],n;

int partition(int p, int r)
{
  int x,i,j,tmp;
  x = A[r];
  i = p -1;
  for(j = p; j < r; j++)
    {
      if( A[j] <= x)
        {
          i++;
          tmp = A[i];
          A[i] = A[j];
          A[j] =tmp;
        }
    }
  tmp = A[i+1];
  A[i + 1] = A[r];
  A[r] = tmp;

  return i + 1;
}

int main()
{
  int i,q;

  scanf("%d",&n);
  for(i = 0; i < n; i++)
    scanf("%d",&A[i]);

  q = partition(0,n-1);

  for(i = 0; i < n; i++)
    {
      if(i) printf(" ");
      if(i == q) printf("[");
      printf("%d",A[i]);
      if(i == q) printf("]");
    }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define ninf 0xc0c0c0c0
#define de(x) cout<<#x<<"="<<x<<endl;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define fi first
#define se second
#define pb push_back
#define pdi pair<double,int>
#define mp(a,b) make_pair(a,b)
#define mt(a,b) memset(a,b,sizeof(a))
#define ll long long
using namespace std;
int main()
{
	int flag=0;
    int n;
	cin>>n;
	int t;
	t=n%10;
	if(t==9)
	flag=1;
	n/=10;
	if(n==9)
	flag=1;
	if(flag)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl; 
	return 0;
}



Measured memory_bytes: 256
fun main(args :Array<String>){
  var input : String? = readLine()
  var param = input!!.split(" ")
  var total = param[0].toInt()
  var houses = param[1].toInt()
  var input2 : String? = readLine()
  var len = input2!!.split(" ")
  var max = 0
  var now = 0
  for(i in 1 until houses){
    now = len[i].toInt() - len[i-1].toInt()
    if(max < now){
      max = now
    }
  }
  now = total + len[0].toInt() - len[len.lastIndex].toInt()
  if(max < now ) max = now 
  println(total - max)
}

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

using namespace std;

struct random_class {
	struct xorshift {
		using result_type = unsigned int;
		result_type x=123456789u,y=362436069u,z=521288629u,w;
		static constexpr result_type min() {return 0u;}
		static constexpr result_type max() {return UINT_MAX;}
		xorshift(result_type a) : w(a) {}
		result_type operator()() {
			result_type t;
			t = x ^ (x << 11);
			x = y; y = z; z = w;
			return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
		}
	};
	random_device rd;
	xorshift xor128;
	random_class() : rd(), xor128(rd()) {}
	random_class(unsigned int seed) : rd(), xor128(seed) {}
	double make_random(double min_v, double max_v) { return uniform_real_distribution<double>(min_v, max_v)(xor128);}
};

random_class R;

template<class T>
struct Treap {
	struct node {
		T val;
		double pri;
		node *lch, *rch;
		int cnt;
		node(T v) : val(v), lch(nullptr), rch(nullptr), cnt(1) {
			pri = R.make_random(DBL_MIN, DBL_MAX);
		}
	};
	node* top;
	Treap(node* t = nullptr) : top(t) {}
	node* update(node* n) {
		n->cnt = count(n->lch) + count(n->rch) + 1;
		return n;
	}
	inline int count(node* n) {
		return !n ? 0 : n->cnt;
	}
	node* merge(node* l, node* r) {
		if (!l || !r) return !l ? r : l;
		if (l->pri > r->pri) {
			l->rch = merge(l->rch, r);
			return update(l);
		} else {
			r->lch = merge(l, r->lch);
			return update(r);
		}
	}
	pair<node*, node*> split(node* t, int k) {
		if (!t) return make_pair(nullptr, nullptr);
		if (k <= count(t->lch)) {
			pair<node*, node*> s = split(t->lch, k);
			t->lch = s.second;
			return make_pair(s.first, update(t));
		} else {
			pair<node*, node*> s = split(t->rch, k - count(t->lch) - 1);
			t->rch = s.first;
			return make_pair(update(t), s.second);
		}
	}
	void insert(const T&& val) {
		int pos = 0;
		node* n = top;
		while (n) {
			if (val < n->val) n = n->lch;
			else pos += count(n->lch) + 1, n = n->rch;
		}
		auto t = split(top, pos);
		n = merge(t.first, new node(val));
		n = merge(n, t.second);
		top = update(n);
		// auto t2 = split(t1.second, 1);
		// node* new_top = merge(t1.first, new node(val));
		// top = merge(new_top, t2.second);
	}
	const T& at(int idx) {
		node* n = top;
		while (idx) {
			const int sz = count(n->lch);
			if (sz + 1 == idx) break;
			else if (count(n->lch)  + 1 < idx) idx -= count(n->lch) + 1, n = n->rch;
			else n = n->lch;
		}
		return n->val;
	}
	inline const int size() {
		return count(top);
	}
};

int main() {
	using ll = long long;
	Treap<ll> T;
	int N;
	cin >> N;
	vector<ll> v;
	for (int i = 0; i < N; i++) {
		ll t; cin >> t;
		T.insert(t-i);
		v.push_back(t-i);
	}
	ll b = T.at(N / 2 + 1);
	ll res = 0;
	for (auto x : v) {
		res += abs(x - b);
	}
	cout << res << endl;

}

Measured memory_bytes: 11248
#include<stdio.h>
int N, n, i, t;
int A[100001];
int main(){
	scanf("%d", &N);
	for(i=1; i<=N; i++){
		scanf("%d", A+i);
	}
	i=0;
	n=1;
	do{
		t = A[n];
		A[n] = 1;
		n = t;
		i++;
	}while(n!=1 && n!=2);
	if(n==2){
		printf("%d\n", i);
	}else{
		printf("-1\n");
	}
}


Measured memory_bytes: 512
let () =
	let a, b, c = Scanf.scanf "%d %d %d\n" (fun a b c -> a,b,c) in
    Printf.printf
   	(if 
    (a=5 && b=5 && c=7) || (a=5 && b=7 && c=5) || (a=7 && b=5 && c=5)
    then "YES" else "NO")

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1e9+7;
const int N=2e5+5;
vector<int>adj[N];
bool visi[N];
ll dp[N][2];
void dfs(int s)
{
  visi[s]=1;
  dp[s][1]=dp[s][0]=1;
  ll w=1,b=1;
  for(int i=0;i<adj[s].size();i++)
  {
    if(visi[adj[s][i]]==0)
       {
         dfs(adj[s][i]);
         w=(w*(dp[adj[s][i]][0]+dp[adj[s][i]][1])%mod)%mod;
         b=(b*dp[adj[s][i]][0])%mod;
       }
    }
            dp[s][0]=w;
            dp[s][1]=b;
 }
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=n-1;i++)
  {
    int x,y;
    cin>>x>>y;;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1);
  cout<<(dp[1][0]+dp[1][1])%mod<<endl;
}

Measured memory_bytes: 16512
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;

#define PB push_back
#define MP make_pair

const double pi = acos(-1.);
const double eps = 1e-6;

char a[610][610];
int main()
{
int n;
	scanf("%d", &n);
	int flag = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			scanf(" %c", &a[i][j]);
			if (a[i][j] == '#')
				flag = 1;
		}
	if (!flag) {
		puts("-1");
		return 0;
	}
	int best = n + n - 1;
	for (int i = 0; i < n; i++) {
		int all = 0;
		for (int j = 0; j < n; j++)
			if (a[i][j] == '.') {
				all++;
			}
		int delta = 1;
		for (int j = 0; j < n; j++)
			if (a[j][i] == '#')
				delta = 0;
		all += delta;
		if (all < best)
			best = all;
	}
	for (int i = 0; i < n; i++) {
		int delta = 0;
		for (int j = 0; j < n; j++)
			if (a[j][i] == '.')
				delta = 1;
		best += delta;
	}
	printf("%d\n", best);
}



Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

struct Memo {
	int fact = 0;
	int fact_inv = 0;
	int inv = 0;
};
class Combination {
private:
	int m_module = 1000000007;
	vector<struct Memo> memo;
public:
	int calculate(int, int);
	Combination(int, int);
};
int Combination::calculate(int n, int k) {
	return (memo[n].fact * memo[k].fact_inv * memo[n - k].fact_inv) % m_module;
}
Combination::Combination(int memo_max, int module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - memo[m_module % loop].inv * int(m_module / loop) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

void A_Kth_Term(void) {

	int num[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int K;
	cin >> K;
	cout << num[K - 1] << flush;
	return;
}

void B_Bishop(void) {

	long long H, W;
	cin >> H >> W;

	if (H == 1 || W == 1) {
		cout << 1 << flush;
	}
	else {
		if (H % 2 == 0 || W % 2 == 0)	cout << H * W / 2 << flush;
		else							cout << ((long long)(H * W + 1)) / 2 << flush;
	}
	return;
}

void C_Sqrt_Inequality(void) {

	long long a, b, c;
	cin >> a >> b >> c;

	cout << ((a + b < c && (c - a - b) * (c - a - b) - 4 * a * b > 0) ? "Yes" : "No") << flush;
	return;
}

void D_String_Equivalence(void) {

	int N;
	cin >> N;

	vector<char> S(N);

	for (int loop = N; loop > 0; loop--) {


	}
	return;
}

int main(void) {

	//A_Kth_Term();
	B_Bishop();
	//C_Sqrt_Inequality();
	return 0;
}


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

class Map
{
  public:
    Map(int i, int j);
    ~Map();
    int get_count();
    void block(int i, int j);
    void go_school(int i = 0, int j = 0);
  private:
    bool** m_map;
    int m_a;
    int m_b;
    int m_count;
};

Map::Map(int a, int b)
{
  m_a = a;
  m_b = b;
  m_map = new bool*[m_a];
  for (int i = 0; i < m_a; i++)
  {
    m_map[i] = new bool[m_b];
  }
  for (int i = 0; i < m_a; i++)
  {
    for (int j = 0; j < m_b; j++)
    {
      m_map[i][j] = true;
    }
  }

  m_count = 0;
}

Map::~Map()
{
  for (int i = 0; i < m_a; i++)
  {
    delete[] m_map[i];
  }
  delete[] m_map;
}

int Map::get_count()
{
  return m_count;
}

void Map::block(int i, int j)
{
  m_map[i-1][j-1] = false;
}

void Map::go_school(int i, int j)
{
  if (i == m_a-1 && j == m_b-1)
  {
    m_count++;
  }
  else if (m_map[i][j])
  {
    if ( i+1 < m_a ) go_school(i+1, j);
    if ( j+1 < m_b ) go_school(i, j+1);
  }
}

int main(void)
{
  int a, b;
  int n;
  int buf[2];
  while (true)
  {
    cin >> a >> b;
    if ( a == 0 && b == 0 ) break;
    Map map(a, b);

    cin >> n;
    for (int i = 0; i < n; i++)
    {
      cin >> buf[0] >> buf[1];
      map.block(buf[0], buf[1]);
    }
    map.go_school();
    cout << map.get_count() << endl;
  }

  return 0;
}

Measured memory_bytes: 1192
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int X,Y,Z;
  cin>>X>>Y>>Z;

  cout<<(X-Z)/(Y+Z)<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        var a = cin.nextInt();
        var b = cin.nextInt();
        var diff = b - a;
        var ret = 0;
        for(var i = 1;i < diff; i++)
        {
            ret += i;
        }
        Console.WriteLine(ret - a);
    }


    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
if __name__ == "__main__":
    s = input()
    if s == 'SUN':
        print(7)
    elif s == 'MON':
        print(6)
    elif s == 'TUE':
        print(5)
    elif s == 'WED':
        print(4)
    elif s == 'THU':
        print(3)
    elif s == 'FRI':
        print(2)
    else:
        print(1)


Measured memory_bytes: 2940
s=str(input())
t=str(input())
s=list(s)
t=list(t)
count2=0
count=0
for i in range(len(s)-len(t),-1,-1):
    for j in range(len(t)):
        #print(s[i+j])
        if s[i+j]!='?' and  s[i+j]!=t[j]:
            count=0
            break
        else:
            count+=1
        #print(count)
    
    if count==len(t):
        for z in range(len(s)):
            if z<i or i+len(t)-1<z:
                if s[z]=='?':
                    print("a",end="")
                else:
                    print(s[z],end="")
            else:
                #print(count2)
                print(t[count2],end="")
                count2+=1
        exit()
    count=0
print("UNRESTORABLE")


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

#include <bits/stdc++.h>

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

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

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

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

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

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

int run(istream& in, ostream& out) {
    ll X, Y, A, B, C;
    in >> X >> Y >> A >> B >> C;
    vector<ll> p(A);
    vector<ll> q(B);
    vector<ll> r(C);
    REP(i, A) {
        in >> p[i];
    }
    REP(i, B) {
        in >> q[i];
    }
    REP(i, C) {
        in >> r[i];
    }
    sort(p.begin(), p.end(), greater<>());
    sort(q.begin(), q.end(), greater<>());
    sort(r.begin(), r.end(), greater<>());

    REP(i, A) {
        if (i >= X) {
            p[i] = 0;
        }
    }
    REP(i, B) {
        if (i >= Y) {
            q[i] = 0;
        }
    }
    p.emplace_back(0);
    q.emplace_back(0);
    r.emplace_back(0);
    ll x=0;
    ll y=0;
    ll z=0;
    ll ans = 0;
    while(x+y+z < X+Y) {
        ll m = max(max(p[x], q[y]), (z < C ? r[z] : 0));
        if (m == p[x]) {
            ans += p[x];
            ++x;
            continue;
        }
        if (m == q[y]) {
            ans += q[y];
            ++y;
            continue;
        }
        ans += r[z];
        z++;
    }
    out << ans << endl;
    return 0;
}

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


Measured memory_bytes: 3424
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <regex>
#include <locale>

#include <iomanip>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_Len=int(b);i<i##_Len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

int main () {
  int n, m;
  cin >> n >> m;
  
  cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    void CCout(long long x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const T& x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cerr << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
        template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
    };

    inp inp1; // input one
}

int main() {

    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> x = inp(n);

    ll ans = 0;

    rep(i, n - 1) {
        ll warp = b;
        ll walk = x[i + 1] - x[i];
        walk *= a;
        ans += min(walk, warp);
    }

    Cout(ans);

    return 0;
}

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

int cnt = 0;
int minNum;
int ans = 0;

void water(vector<int> h, int l, int r) {
    if (l > r) {
        return;
    }
    minNum = 100;
    for (int i = l; i <= r; i++) {
        if (h.at(i) < minNum) {
            minNum = h.at(i);
        }
    }
    for (int i = l; i <= r; i++) {
        h.at(i) -= minNum;
    }
    ans += minNum;
    for (int i = l; i <= r; i++) {
        if (h.at(i) == 0) {
            water(h, l, i - 1);
            l = i + 1;
        }
        if (i == r) {
            water(h, l, r);
        }
    }
    return;
}

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h.at(i);
    }
    water(h, 0, n - 1);
    cout << ans << endl;
}



Measured memory_bytes: 256
N = int(input())
oddprime = []
for i in range(3, N + 1, 2):
  com = False
  for p in oddprime:
    if p > i ** 0.5:
      break
    if i % p == 0:
      com = True
      break
  if not com:
    oddprime.append(i)

count = 0
for i in range(1, N + 1, 2):
  yaku_num = 1
  for j in oddprime:
    div_num = i
    div_count = 0
    while div_num % j == 0:
      div_count += 1
      div_num //= j
    yaku_num *= (div_count + 1)
  if yaku_num == 8:
    count += 1
print(count)
  

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <chrono>
#include <random>

using namespace std;

typedef long long ll;

void solve() {
	ll n, x, m;
	cin >> n >> x >> m;
	ll slow = x * x % m;
	ll fast = slow * slow % m;
	ll ans = 0;
	while (fast != slow) {
		slow = (slow * slow) % m;
		fast = (fast * fast) % m;
		fast = (fast * fast) % m;
	}
	ll cy_beg = slow;
	slow = x;
	while (n && slow != cy_beg) {
		ans += slow;
		slow = (slow * slow) % m;
		n--;
	}
	ll cy_val = slow;
	ll cy_cnt = 1;
	slow = (slow * slow) % m;
	while (slow != cy_beg) {
		cy_cnt++;
		cy_val += slow;
		slow = (slow * slow) % m;
	}
	ll need = n / cy_cnt;
	ans += need * cy_val;
	n %= cy_cnt;
	while (n) {
		ans += slow;
		slow = (slow * slow) % m;
		n--;
	}

	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		//cout << endl;
	}
}

Measured memory_bytes: 3632
using System;
using System.Linq;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ');
            var city_count = int.Parse(line[0]);
            var road_count = int.Parse(line[1]);

            var city_road = new int[city_count];

            for (int i = 0; i < road_count; ++i)
            {
                var road_data = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
                city_road[road_data[0] - 1]++;
                city_road[road_data[1] - 1]++;
            }

            for (int i = 0; i < city_count; ++i)
            {
                Console.WriteLine(city_road[i]);
            }
        }
    }
}

Measured memory_bytes: 13396
N, A, B, C, D = map(int, input().split())
S = input()

if "##" in S[A - 1: C] or "##" in S[B - 1: D]:
    print("No")
    exit(0)

if C <= D:
    print("Yes")
    exit(0)

ans = False
for i in range(B - 1, D):
    if (S[i - 1] == '.') and (S[i] == '.') and (S[i + 1] == '.'):
        ans = True
        break

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 40816
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
const int INF = 1 << 20;

char s[105];
int PP[30][105];
int main()
{
	while(scanf("%s", s + 1) != EOF)
	{
		int ans = INF;
		int len = strlen(s + 1);
		for(int i = 1; i <= len; i++)
			PP[s[i] - 'a' + 1][++PP[s[i] - 'a' + 1][0]] = i;
		for(int i = 1; i <= 26; i++)
		{
			if(PP[i][0] > 0)
			{
				int cnt = 0;
				cnt = max(cnt, PP[i][1] - 1);
				for(int j = 2; j <= PP[i][0]; j++)
					cnt = max(cnt, PP[i][j] - PP[i][j - 1] - 1);
				cnt = max(len - PP[i][PP[i][0]], cnt);
				ans = min(ans, cnt);
			}
		}
		printf("%d\n", ans);
		memset(s, 0, sizeof(s));
		memset(PP, 0, sizeof(PP));
	}
	return 0;
}

Measured memory_bytes: 128
N,M,r = map(int,input().split())
R = list(map(int,input().split()))
#dp[i][j][k] -> 町iまで経由地点として使える。j,kの最短移動距離
dp = [[float("INF")]*(N+1) for _ in range(N+1)]
for _ in range(M):
    a,b,c = map(int,input().split())
    dp[a][b] = c
    dp[b][a] = c

for i in range(N+1):
    dp[i][i] = 0

for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(N+1):
            dp[j][k] = min(dp[j][k],dp[j][i]+dp[i][k])

from itertools import permutations
ans = float("INF")
for pattern in permutations(R):
    cost = 0
    for i in range(r-1):
        cost += dp[pattern[i]][pattern[i+1]]
    ans = min(ans,cost)
print(ans)

Measured memory_bytes: 68952
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public int N;
        public int[] T, X, Y;

        public void Run()
        {
            N = Input.ReadInt();
            T = new int[N];
            X = new int[N];
            Y = new int[N];

            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                T[i] = line[0];
                X[i] = line[1];
                Y[i] = line[2];
            }

            for (int i = 0; i < N; i++)
            {
                int x1 = i == 0 ? 0 : X[i - 1];
                int y1 = i == 0 ? 0 : Y[i - 1];
                int t1 = i == 0 ? 0 : T[i - 1];
                int x2 = X[i];
                int y2 = Y[i];
                int t2 = T[i];
                if (!check(x2 - x1, y2 - y1, t2 - t1))
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }

        public bool check(int x, int y, int t)
        {
            int z = t - Math.Abs(x) - Math.Abs(y);
            return z >= 0 && z % 2 == 0;
        }
    }

    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 16352
def main():
    call(int(input()))


def call(n):
    i = 1
    while True:
        x = i
        # CHECK_NUM
        if int(x % 3) == 0:
            print(" {}".format(i), end="")
        else:
            # INCLUDE3
            while True:
                if (x % 10) == 3:
                    print(" {}".format(i), end="")
                    break
                else:
                    x = int(x / 10)
                    if not(x):
                        break
        # END_CHECK_NUM
        i += 1
        if n < i:
            break

    print("")

main()


Measured memory_bytes: 5872
S = input()
AA, BB = int(S[:2]), int(S[2:])
if 1 <= AA and AA <= 12:
    if 1 <= BB and BB <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= BB and BB <= 12:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 3060
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//INT_MAXなど
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  int N, D, X;
  cin >> N >> D >> X;

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

  int res = X;
  vector<int> DAYS(N, 1);
  for (int i = 1; i <= D; i++) {
    for (int j = 0; j < N; j++) {
      if (i == DAYS[j]) {
        res++;
        DAYS[j] += A[j];
      }
    }
  }
  cout << res << endl;
  return 0;
}

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

 int main() {
 int n;  cin >> n;
 vector<int> dp(n);
 for(int i = 0; i < n; i++) cin >> dp[i];
 int ans = 0;
 for(int i = 0; i < n; i++) {
 for(int j = i + 1; j < n; j++) {
 ans += dp[i] * dp[j];
 }
 }
 cout << ans << endl;
 return 0;
 }


Measured memory_bytes: 3584
X = input()

#入力をsplitでくぎり細裂に代入
inputs = X.split(' ')

#入力は固定１、２、３、４、５
#配列を変数に代入して整理する

x1 = int(inputs[0])
x2 = int(inputs[1])
x3 = int(inputs[2])
x4 = int(inputs[3])
x5 = int(inputs[4])

if x1 != 1:
    print('1')
elif x2 != 2:
    print('2')
elif x3 != 3:
    print('3')
elif x4 != 4:
    print('4')
elif x5 != 5:
    print('5')

Measured memory_bytes: 9204
use std::io;
use std::cmp;

fn main() {
    let (n, q) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    let id = 2usize.pow(31) - 1;
    let mut st = SegmentTree::new(n, id, |&x, &y| cmp::min(x, y));
    for _ in 0..q {
        let (com, x, y) = {
            let i = read::<usize>();
            (i[0], i[1], i[2])
        };
        if com == 0 {
            st.update(x, y);
        } else {
            let m = st.apply(x, y + 1);
            println!("{}", m);
        }
    }
}

#[allow(dead_code)]
pub struct SegmentTree<T, F> {
    n: usize,
    v: Vec<T>,
    id: T,
    f: F,
}

impl<T, F> SegmentTree<T, F>
where
    T: Clone,
    F: Fn(&T, &T) -> T,
{
    pub fn new(n: usize, id: T, f: F) -> Self {
        SegmentTree {
            n: n,
            v: vec![id.clone(); 2 * n],
            id: id,
            f: f,
        }
    }

    pub fn update(&mut self, mut i: usize, x: T) {
        i += self.n;
        self.v[i] = x;
        while { i /= 2; i > 0 } {
            self.v[i] = (self.f)(&self.v[i * 2], &self.v[i * 2 + 1]);
        }
    }

    pub fn apply(&mut self, s: usize, t: usize) -> T {
        let (mut x, mut y) = (self.id.clone(), self.id.clone());
        let (mut s, mut t) = (s + self.n, t + self.n);
        while s < t {
            if s % 2 != 0 {
                x = (self.f)(&x, &self.v[s]);
                s += 1;
            }
            if t % 2 != 0 {
                t -= 1;
                y = (self.f)(&self.v[t], &y);
            }
            s /= 2;
            t /= 2;
        }
        (self.f)(&x, &y)
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int N;
    cin >> N;
    bool ans = true;
    map<string, int> W;
    string s;
    cin >> s;
    char tail = s[s.length()-1];
    W[s]++;

    for(int i = 1; i < N; ++i) {
        cin >> s;
        W[s]++;
        if(s[0] != tail || W[s] > 1) { ans = false; }
        tail = s[s.length()-1];
    }

    if(ans) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a.at(i);
  }
  vector<int>d;
  d.push_back(-a[0]);
  rep2(i,1,n){ 
    if(d[d.size()-1]<=-a[i]){
      d.push_back(-a[i]);
    }
    else{
      int itr = upper_bound(d.begin(), d.end(), -a[i])-d.begin();
      d[itr]=-a[i];
    }
    
  }
  cout<<d.size()<<endl;
}

Measured memory_bytes: 4316
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(N):
    div = np.zeros(N+1, np.int64)
    for n in range(1, N+1):
      for m in range(n, N+1, n):
        div[m] += m
    return div.sum()

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.int64
    cc = CC('my_module')

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    main = cc_export(main, (i8, ))
    cc.compile()

from my_module import main

N = int(read())
print(main(N))


Measured memory_bytes: 105196
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var r=n(1);n(2)(r.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";var r=n(3),i=n(5);t.exports=function(t){var e=new r(t);i(e)}},function(t,e,n){"use strict";var r=n(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new r(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,n){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,n){"use strict";t.exports=function(t){for(var e=t.in(),n=0,r=Math.ceil(e/2),i=1;i<r;i++)e-i>i&&n++;console.log(n)}}]);

Measured memory_bytes: 21192
import sys
import math

def get_seat():
    i = input()
    if i == "Vacant":
        sys.exit()
    return i

n = int(input())
print(0)
seat0 = get_seat()

def check_half(s, e):
    half_i = math.floor((e - s) / 2) + s
    if s == e:
        return
    if (s + 1) >= e:
        print(half_i)
        get_seat()
        return
    print(half_i)
    seat = get_seat()
    correct = False
    if (half_i % 2) == 0:
        correct = seat0 == seat
    else:
        correct = seat0 != seat
    if correct:
        # both branches could be correct!
        check_half(half_i + 1, e)
        check_half(s, half_i)
    else:
        # there's a vacant seat at the start
        check_half(s, half_i)

check_half(1, n)


Measured memory_bytes: 3660