akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<ll,ll>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;
void bfs(vector<vector<int>> &v,vector<bool> &vv) {
    int l=v.size();
    vector<int> ans(l);
    queue<int> q;
    q.push(1);
    while(!q.empty()) {
        int t=q.front();q.pop();
        for(auto i:v[t])
        if(!vv[i]) {vv[i]=1;q.push(i);ans[i]=t;}
    }
    Rep(i,l) if(!vv[i]) {cout<<"No";return;}
    cout<<"Yes\n";
    repp(i,2,l-1) cout<<ans[i]<<'\n';
}
int main() {
    cs
    int n,m,x,y;
    cin>>n>>m;
    vector<vector<int>> v(n+1);
    vector<bool> vv(n+1);vv[1]=1;
    rep(i,m) {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    bfs(v,vv);
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    m[a] = i;
  }
  for (int i = 1; i <= n; i++) {
    cout << m[i] << " ";
  }
  cout << endl;
  return 0;
}


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

string conv(string s, int d) {
  for(int i = 0; i < s.size(); ++i) {
    if(isalpha(s[i])) s[i] = (s[i]-'a'+d)%26+'a';
  }
  return s;
}

int main() {
  string s;
  while(getline(cin, s)) {
    for(int i = 0; i < 26; ++i) {
      string t = conv(s, i);
      if(t.find("the") != string::npos ||
	 t.find("this") != string::npos ||
	 t.find("that") != string::npos) {
	cout << t << endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1184
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

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;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int t[64];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}

void Solve() {

	int n;
	cin >> n;
	ll a[300010];
	for (size_t i = 0; i < n * 3; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n * 3);
	reverse(a, a + n * 3);
	ll res = 0;
	for (size_t i = 1; i < n * 2; i += 2)
	{
		res += a[i];
	}
	cout << res << endl;
}


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



Measured memory_bytes: 8320
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputReader r = new InputReader(System.in);
		char[] arr = r.next().toCharArray();
		for (int len = 2; len <= Math.min(arr.length, 50); len++) {
			for (int i = 0; i < arr.length; i++) {
				int[] cnt = new int[26];
				boolean can = true;
				for (int j = i; j < i + len; j++) {
					if (j >= arr.length) {
						can = false;
						break;
					}
					cnt[arr[j] - 'a']++;
				}
				if (can) {
					int max = -1;
					for (int x = 0; x < 26; x++)
						max = Math.max(cnt[x], max);
					if (max > len / 2) {
						System.out.println((i + 1) + " " + (i + len));
						return;
					}
				}
			}
		}
		System.out.println("-1 -1");
	}

	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 18852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

template <class T>
map<T,T> prime_factor(T x){
	map<T,T> ans;
	for(T i=2;i*i<=x;i++){
		while(x%i==0){
			x/=i;
			ans[i]++;
		}
	}
	if (x!=1){
		ans[x]=1;
	}
	return ans;
}

//エラトステネスの篩,n以下の素数の列挙の時に
//primeはi番目の素数、適当に返却を変えて
template <class T>
vector<ll> sieve(T n){
    vector<bool> is_prime(n+1,true);
    vector<ll> prime;
    is_prime[0]=false;
    is_prime[1]=false;
    T ret=0;
    FOR(i,2,n+1){
        if(is_prime[i]){
            prime.push_back(i);
            for(T j=2*i;j<=n;j+=i){
                is_prime[j]=false;
            }
        }
    }
    return prime;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans=0;
    vector<ll> cnt(n+1,1);
    vector<ll> ret=sieve(n);
    for(auto p:ret){
        for(int i=p;i<=n;i+=p){
            ll now=0;
            ll num=i;
            while(num%p==0){
                now++;
                num/=p;
            }
            cnt[i]*=(now+1);
        }
    }
    FOR(k,1,n+1){
        ans+=k*cnt[k];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 90940
#include <iostream>
#include <cmath>
using namespace std;
static const int MAX_N=1000100;

int main(void){
    // 入力
    int n; cin >> n;
    int A[MAX_N+1];
    int B[MAX_N];
    for(int i=0; i<n+1; i++){
        cin >> A[i];
    }
    for(int i=0; i<n; i++){
        cin >> B[i];
    }

    // i番目を倒せるだけ倒してi+1へ(左から右へ)
    long long counter_l = 0;
    for(int i=0; i<n; i++){
        if(A[i]>=B[i]){
            A[i] = 0;
            counter_l += B[i];
        }
        else{
            counter_l += A[i];
            B[i] = B[i]-A[i];

            // 余力で隣町を守りに行ける
            if(A[i+1]>=B[i]){
                A[i+1]-=B[i];
                counter_l+=B[i];
            }
            else{
                counter_l+=A[i+1];
                A[i+1] = 0;
            }
        }
    }
    cout << counter_l;
    return 0;
}

Measured memory_bytes: 6400
#include <cstdio>
#include <algorithm>
#include <ctype.h>
const int bufSize = 1e6;
inline char nc()
{
    #ifdef DEBUG
    return getchar();
    #endif
    static char buf[bufSize], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, bufSize, stdin), p1 == p2) ? EOF : *p1++;
}
inline void read(char *s)
{
    static char c;
    for (; !isalpha(c); c = nc());
    for (; isalpha(c); c = nc()) *s++ = c;
    *s = '\0';
}
template<typename T>
inline T read(T &r)
{
    static char c;
    static int flag;
    flag = 1, r = 0;
    for (c = nc(); !isdigit(c); c = nc()) if (c == '-') flag = -1;
    for (; isdigit(c); c = nc()) r = r * 10 + c - 48;
    return r *= flag;
}
const int maxn = 110;
int n;
int a[maxn];
int d[10];
int main()
{
    read(n);
    for (int i = 1; i <= n; ++i) read(a[i]);
    int ans = 0;
    for(int i = 1;i<=n;++i) for(int j = i + 1;j<=n;++j) for(int k = j + 1;k<=n;++k)
    {
        if(a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) continue;
        d[1] = a[i],d[2] = a[j],d[3] = a[k];
        std::sort(d + 1,d + 1 + 3);
        if(d[1] + d[2] > d[3]) ++ans;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int N,A,B;
vi v, ans;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> A >> B;
    int lo = (N+A-1)/A, hi = N+1-A;
    if (B < lo || B > hi) {
        cout << -1;
        return 0;
    }
    FOR(i,1,N+1) v.pb(i);
    
    int cur = 0;
    while (sz(v)) {
        vi V;
        F0R(i,A) if (sz(v)) V.pb(v.back()), v.pop_back();
        if (cur+1+sz(v) < B) {
            // cout << "A\n";
            int ne = B-(cur+1+sz(v)); 
            int mx = sz(v)?v.back():0;
            F0R(i,ne) {
                mx = max(mx,V.back());
                V.pop_back();
            }
            reverse(all(V));
            for (int i: V) ans.pb(i);
            FORd(i,1,mx+1) ans.pb(i);
            break;
        } else {
            // cout << "B\n";
            reverse(all(V));
            for (int i: V) ans.pb(i);
        }
        cur ++;
    }
    for (int i: ans) cout << i << " ";
}

// read the question correctly (is y a vowel?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

Measured memory_bytes: 5640
#include <bits/stdc++.h>
   using namespace std;
   using pii = pair<int, int>;
   using ll = long long;
   #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
   const ll MOD = 1000000007;
   const ll INFL = (1LL << 60);
   const int INFI = (1 << 30);

   int main() {
     int S, W; cin >> S >> W;
     if (S <= W) cout << "unsafe" << endl;
     else cout << "safe" << endl;
   }


Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 3e5 + 5;
const int maxa = 3e5;
const int MAXA = maxa + 5;

struct Segment_Tree
{
	int mx[MAXA<<2];
	#define ls(u) ((u)<<1)
	#define rs(u) ((u)<<1|1)
	#define lson(u) ls(u),l,mid
	#define rson(u) rs(u),mid+1,r
	inline void push_up(int u){ mx[u] = max(mx[ls(u)], mx[rs(u)]);}
	void update(int u,int l,int r,int q,int k)
	{
		if(l==r){ mx[u] = max(mx[u], k); return;}
		int mid = (l+r)>>1;
		if(q<=mid) update(lson(u),q,k);
		else update(rson(u),q,k);
		push_up(u);
	}
	int query(int u,int l,int r,int ql,int qr)
	{
		if(ql<=l && r<=qr) return mx[u];
		int mid = (l+r)>>1, res = 0;
		if(ql<=mid) res = max(res, query(lson(u),ql,qr));
		if(mid<qr) res = max(res, query(rson(u),ql,qr));
		return res;
	}
}tree;

int a[MAXN];

int main(void)
{
	int n,d;
	scanf("%d%d",&n,&d);
	for(int i=1; i<=n; ++i) scanf("%d",&a[i]);
	
	int ans = 0;
	for(int i=1; i<=n; ++i)
	{
		int x = a[i];
		int res = tree.query(1,0,maxa, max(0,x-d), min(maxa,x+d)) + 1;
		ans = max(ans, res);
		tree.update(1,0,maxa, x,res);
	}
	printf("%d",ans);
	return 0;
}

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

int main(){
  int w,h;
  int maph1[100][100],maph2[100][100],mapv1[100][100],mapv2[100][100],map[100][100];

  while(1){
    cin >> w >> h;
    if(!w && !h)break;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	maph1[i][j] = 0;
	maph2[i][j] = 0;
	mapv1[i][j] = 0;
	mapv2[i][j] = 0;
      }
    }

    for(int i=0;i<h;i++)mapv1[i][0] = 1;
    for(int i=0;i<w;i++)maph1[0][i] = 1;
    for(int i=0;i<h;i++)map[i][0] = 1;
    for(int i=0;i<w;i++)map[0][i] = 1;

    for(int i=1;i<h;i++){
      for(int j=1;j<w;j++){
	mapv1[i][j] = (mapv1[i-1][j] + mapv2[i-1][j])%100000;
	mapv2[i][j] = (maph1[i-1][j])%100000;
	maph1[i][j] = (maph1[i][j-1] + maph2[i][j-1])%100000;
	maph2[i][j] = (mapv1[i][j-1])%100000;
	map[i][j] = (mapv1[i][j] + mapv2[i][j] + maph1[i][j] + maph2[i][j])%100000;
      }
    }

    cout << map[h-1][w-1]<< endl;
  }
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main()
{
	int x, y, c;
	while (cin >> x >> y && x && y)
	{
		if (x < y) swap(x, y);
		c = 0;
		while (y > 0)
		{
			x %= y;
			swap(x, y);
			c++;
		}
		cout << x << " " << c << endl;
	}
}

Measured memory_bytes: 0
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int a[] = {0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1};
    System.out.println(a[x] == a[y] ? "Yes" : "No");
  }
}

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

using namespace std;

int main()
{
	int N, M;
	int sport[1000];
	int score[1000];
	int judge[1000];
	pair<int, int> result[1000];
	cin >> N >> M;
	for (int a = 0; a < 1000; a++)
	{
		score[a] = 0;
	}
	for (int a = 0; a < N; a++)
	{
		cin >> sport[a];
	}
	for (int a = 0; a < M; a++)
	{
		cin >> judge[a];
	}
	for (int a = 0; a < M; a++)
	{
		for (int b = 0; b < N; b++)
		{
			if (sport[b] <= judge[a])
			{
				score[b]++;
				break;
			}
		}
	}

	for (int a = 0; a < N; a++)
	{
		result[a] = make_pair(score[a], a+1);
	}
	sort(result, result + N,greater<pair<int,int> >());

	cout << result[0].second << endl;

	return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>

int main(int argc, char *argv[]){
    constexpr long long sup = std::numeric_limits<long long>::max();
    constexpr long long inf = std::numeric_limits<long long>::min();

    int A, B, Q;
    std::cin >> A >> B >> Q;
    std::vector<long long> distS(A), distT(B), distQ(Q);
    for(int i=0; i<A; ++i){
        std::cin >> distS[i];
    }
    for(int i=0; i<B; ++i){
        std::cin >> distT[i];
    }
    for(int i=0; i<Q; ++i){
        std::cin >> distQ[i];
    }

    for(int i=0; i<Q; ++i){
        auto rightSIter = std::upper_bound(distS.begin(),distS.end(),distQ[i]);
        auto rightS = rightSIter < distS.end() ? *rightSIter : sup;

        auto rightTIter = std::upper_bound(distT.begin(),distT.end(),distQ[i]);
        auto rightT = rightTIter < distT.end() ? *rightTIter : sup;

        auto leftSIter = rightSIter - 1;
        auto leftS = leftSIter >= distS.begin() ? *leftSIter : inf;

        auto leftTIter = rightTIter - 1;
        auto leftT = leftTIter >= distT.begin() ? *leftTIter : inf;

        long long tmp, dist=sup;
        //S: left, T: left
        if(leftS>inf && leftT>inf){
            tmp = distQ[i] - std::min(leftS, leftT);
            dist = std::min(dist, tmp);
        }
        //S: left, T: right
        if(leftS>inf && rightT<sup){
            tmp = 2*std::min(distQ[i]-leftS, rightT-distQ[i]) + std::max(distQ[i]-leftS, rightT-distQ[i]);
            dist = std::min(dist, tmp);
        }
        //S: right, T: left
        if(rightS<sup && leftT>inf){
            tmp = 2*std::min(rightS-distQ[i], distQ[i]-leftT) + std::max(rightS-distQ[i], distQ[i]-leftT);
            dist = std::min(dist, tmp);
        }
        //S: right, T: right
        if(rightS<sup && rightT<sup){
            tmp = std::max(rightS, rightT) - distQ[i];
            dist = std::min(dist, tmp);
        }

        std::cout << dist << std::endl;
    }
    return 0;
}


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

int d[222][222];
string s[222];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		fill(d[i], d[i] + n, 1e8);
	for (int i = 0; i < n; i++)
		cin >> s[i], d[i][i] = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (s[i][j] == '1')
				d[i][j] = 1;
	for (int k = 0; k < n; k++)
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	int m = 0;
	for (int i = 0; i < n; i++) {
		int mm = 0;
		for (int j = 0; j < n; j++) {
			mm = max(mm, d[i][j]);
			for (int k = 0; k < n; k++) {
				if (s[j][k] == '0')
					continue;
				if (d[i][j] == d[i][k])
					goto pn;
			}
		}
		m = max(m, mm);
	pn:;
	}
	cout << (m ? m + 1 : -1) << endl;
	return 0;
}


Measured memory_bytes: 512
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n;
	scanf("%d", &n);
	std::map<int,int> mp;
	REP(x, 0, n+1){
		int y = x;
		for(int i=2; i*i<=y; i++){
			while(y%i==0){
				mp[i]++;
				y /= i;
			}
		}
		if(y>1) mp[y]++;
	}

	ll ans = 0;

	int ar2=0, ov4=0;
	for(auto p: mp){
		if(p.se>=4) ov4++;
		else if(p.se>=2) ar2++;
	}
	ans += ov4*(ov4-1)/2 * ar2;
	ans += ov4*(ov4-1)/2 * (ov4-2);

	int ov24 = ar2 = 0;
	for(auto p:mp){
		if(p.se>=24) ov24++;
		else if(p.se>=2) ar2++;
	}
	ans += ov24*(ov24-1);
	ans += ov24*ar2;

	int ar4=0, ov14=0;
	for(auto p:mp){
		if(p.se>=14) ov14++;
		else if(p.se>=4) ar4++;
	}
	ans += ov14*(ov14-1);
	ans += ov14*ar4;

	int ov74 = 0;
	for(auto p:mp){
		if(p.se>=74) ov74++;
	}
	ans += ov74;

	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long double ldouble;
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 ll INF=1e18;

template<typename T>
struct BIT{
    int n;
    vector<T> d;
    BIT(int n=0):n(n),d(n+1) {}
    void add(int i,T x=1){
        for(i++;i<=n;i+=i&-i){
            d[i]+=x;
        }
    }
    T sum(int i){
        T x=0;
        for(i++;i;i-=i&-i){
            x+=d[i];
        }
        return x;
    }
    T sum(int l,int r){
        return sum(r-1)-sum(l-1);
    }
};

const int MX=200005;

V<int> G[MX];
int in[MX],out[MX],k;

void dfs(int v,int p=-1){
    in[v]=k++;
    for(int u:G[v]){
        if(u==p) continue;
        dfs(u,v);
    }
    out[v]=k;
}
V<int> vs[MX];

ll ch(ll n){
    return n*(n+1)/2;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<int> c(n);
    cinf(n,c);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(0);
    rep(i,n) vs[c[i]-1].push_back(i);
    ll tot=ch(n);
    BIT<int> d(n);
    rep(i,n) d.add(i,1);
    rep(i,n){
        ll ans=tot;
        V<int>& nvs=vs[i];
        sort(nvs.begin(),nvs.end(),[&](int a,int b){
            return in[a]>in[b];
        });
        V<P> his;
        for(int v:nvs){
            int cnt=1;
            for(int u:G[v]){
                if(in[u]<in[v]) continue;
                int num=d.sum(in[u],out[u]);
                ans-=ch(num);
                cnt+=num;
            }
            his.emplace_back(in[v],cnt);
            d.add(in[v],-cnt);
        }
        ans-=ch(d.sum(0,n));
        for(auto p:his){
            d.add(p.ft,p.sc);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 35292
#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;

int main(){
  int A,B;
  cin >> A >> B;

  int ans = A+B;

  ans = max(ans,A-B);
  ans = max(ans,A*B);

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    string X;
    cin >> X;
    stack<char> S;
    rep(i,X.size())
    {
        if(X[i]=='S')
        {
            S.push('S');
        }
        else
        {
            if(!S.empty() and S.top()=='S')
            {
                S.pop();
            }
            else
            {
                S.push('T');
            }
        }
        
    }
  cout<<S.size();
    return 0;
}

Measured memory_bytes: 720
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  int N,X,Y;
  cin>>N>>X>>Y;
  int answer[2000];
  for(int i=0;i<N;i++) answer[i]=0;
  for(int i=1;i<N;i++){
    for(int j=i+1;j<=N;j++){
      if(i<X){
        if(j<=X) answer[j-i]++;
        else if(j<=Y){
          int k=min(j-i,X+Y-i-j+1);
          answer[k]++;
        }
        else answer[X-Y-i+j+1]++;
      }
      else if(i<=Y){
        if(j<=Y){
          int k=min(j-i,i-X+Y-j+1);
          answer[k]++;
        }
        else{
          int k=min(j-i,i+j-X-Y+1);
          answer[k]++;
        }
      }
      else answer[j-i]++;
    }
  }
  for(int i=1;i<N;i++) cout<<answer[i]<<endl;
  
  return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>
int main()
{
  int k,i,sum=0,l;
  scanf("%d%d",&k,&l);
  int ar[l];
  for(i=0;i<l;i++)
  { 
    scanf("%d",&ar[i]);
    sum=sum+ar[i];
  }
  if(k<=sum)
  {
    printf("Yes\n");
  }
  else 
   {
     printf("No\n");
   }
  return 0;
}

Measured memory_bytes: 1964
n = int(input())
a =[0]*10001

for x in range(1,100,1):
    for y in range(1,100,1):
        for z in range(1,100,1):
            i = x*x+y*y+z*z+x*y+y*z+z*x
            if i <=10000:
                a[i]=a[i]+1
for i in range(1,n+1,1):
    print(a[i])

Measured memory_bytes: 9288
from collections import deque
N, M = map(int, input().split())
g = [[] for i in range(N+1)]
for _ in range(M):
    A, B = map(int, input().split())
    g[A].append(B)
    g[B].append(A)
Q = deque()
vstd = [0]*(N+1)
mark = [0]*(N+1)
vstd[1] = 1
Q.append(1)
while Q:
    par = Q.popleft()
    for r in g[par]:
        if vstd[r]==0:
            mark[r]=par
            vstd[r]=1
            Q.append(r)
print('Yes')
for mk in mark[2:]:
    print(mk)

Measured memory_bytes: 35672
/*
 * @Author: Kaizyn
 * @Date: 2020-03-21 19:57:52
 * @LastEditTime: 2020-03-21 20:34:08
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const int N = 1e2+7;
const int MOD = 1e9+7;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
typedef pair<int, int> pii;
const int dir[] = {0, 1, 0};

struct Node
{
    int x, y, step;
    friend bool operator < (const Node &n1, const Node &n2) {
        return n1.step > n2.step;
    }
};

int n, m;
int a[N][N], vis[N][N];
priority_queue<Node> q;

inline void bfs()
{
    memset(vis, 0x3f, sizeof vis);
    q.push({1, 1, 0});
    vis[1][1] = 0;
    while (q.size()) {
        Node u = q.top();
        q.pop();
        if (u.step > vis[u.x][u.y]) continue;
        for (int i = 0, nx, ny; i < 2; ++i) {
            nx = u.x+dir[i];
            ny = u.y+dir[i+1];
            if (nx < 1 || ny < 1 || nx > n || ny > m) continue;
            Node v = {nx, ny, u.step+(a[nx][ny] != a[u.x][u.y])};
            if (vis[nx][ny] <= v.step) continue;
            vis[nx][ny] = v.step;
            q.push(v);
        }
    }
}

inline void solve()
{
    string str;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        cin >> str;
        for (int j = 1; j <= m; ++j) {
            a[i][j] = str[j-1] == '#';
        }
    }
    bfs();
    cout << vis[n][m]/2+(a[1][1]|a[n][m]) << endl;
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int testcase = 1;
    // cin >> testcase;
    for (int i = 1; i <= testcase; ++i) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 384
n = int(input())

a = n // 100
b = n % 100

if a >= 1 and a <= 12 and b >= 1 and b <= 12:
    print("AMBIGUOUS")
elif (a >= 13 or a == 0) and b >= 1 and b <= 12:
    print("YYMM")
elif a >= 1 and a <= 12 and (b == 0 or b >= 13):
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
    int i,j,k,l;
    scanf("%d",&i);
    char s[i],ss[i],sss[2*i];
    printf("\n");
    scanf("%s %s",s,ss);

    for(j=0;j<=2*i;j++){
        sss[2*j]=s[j];
        sss[2*j+1]=ss[j];

    }    
    printf("%s",sss);

}

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

using namespace std;
#define ll long long int

int main()
{
   ll t;
   t = 1;	
  // cin t;
   while(t--){
      string s;
      cin >> s;
      int len = s.length();
      int ans = 0;
      int pre[len];
      pre[len - 1] = (ll)(s[len - 1] - '0');
      ll p = 1;
      int count[2019] = {0};
      count[0] = 1;
      count[pre[len - 1]]++;
      
      for(int i = len - 2; i >= 0 ; i --)
      {
          p *= 10;
          p %= 2019;
          pre[i] = (pre[i + 1] % 2019 + ((ll)(s[i] - '0') * p ) % 2019) % 2019;
         // cout << pre[i] << " ";
          ans += count[pre[i]];
          count[pre[i]]++;

      }       
      //cout << endl;
      cout << ans << endl;
   }
}


Measured memory_bytes: 4504
#include<stdio.h>

int main() {
	int x, y;
	int i = 0;
	int j,t;
	int a[3001][2];
	while (scanf("%d %d",&x,&y)==2) {
		if (x == 0 && y == 0)
			break;
		a[i][0] = x;
		a[i][1] = y;
		i++;
	}
	for (j = 0;j < i;j++) {
		if (a[j][0]>a[j][1]) {
			printf("%d %d\n", a[j][1], a[j][0]);
		}
		else
			printf("%d %d\n", a[j][0], a[j][1]);
	}
}

Measured memory_bytes: 1804
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d %d",&a,&b);
  if(1<=a && a<=1000000000 && 1<=b && b<=1000000000){
    while(a%b!=0){
      c=a%b;
      a=b;
      b=c;
    }
    printf("%d\n",b);
  }
  return 0;
}

Measured memory_bytes: 592
import Control.Monad
import Data.List
import Data.Char

main = do
    nums <- map digitToInt <$> getLine
    putStrLn $ solve operatorCombi nums
    

-- 使う演算子たち
operators = [((+), "+"), ((-), "-")]

-- 取りうる演算子の組み合わせ
operatorCombi =
    [(a, b, c) 
    | a <- operators
    , b <- operators
    , c <- operators
    ]

type Op = (Int -> Int -> Int, String)

-- 数値の一覧に演算子をそれぞれ適用した結果7になる式を文字列で返す
solve :: [(Op, Op, Op)] -> [Int] -> String
solve (op:ops) operands =
    if (apply op operands) == 7 then
        expStr op operands
    else
        solve ops operands


apply :: (Op, Op, Op) -> [Int] -> Int
apply ((op1, _), (op2, _), (op3, _)) [n1, n2, n3, n4] = n1 `op1` n2 `op2` n3 `op3` n4


expStr :: (Op, Op, Op) -> [Int] -> String
expStr ((_, op1s), (_, op2s), (_, op3s)) [n1, n2, n3, n4] =
    show n1 ++ op1s ++ show n2 ++ op2s ++ show n3 ++ op3s ++ show n4 ++ "=7"


Measured memory_bytes: 380
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static final int MOD = 1_000_000_007;

	static long[] fact(int n, long mod) {
		long[] fact = new long[n+1];
		fact[0] = fact[1] = 1;
		for (int i=2; i<=n; i++) {
			fact[i] = fact[i-1]*i%mod;
		}
		return fact;
	}

	public static long[] extgcd(long a, long b) {
		if (a == 0 || b == 0) return null;
		int asig = Long.signum(a);
		int bsig = Long.signum(b);
		a = Math.abs(a); b = Math.abs(b);
		long x = 1, y = 0;
		long p = 0, q = 1;
		while (b > 0) {
			long c = a/b, d = a;
			a = b; b = d % b;
			d = x; x = p; p = d - c*p;
			d = y; y = q; q = d - c*q;
		}
		return new long[]{x*asig,y*bsig,a};
	}


	static long inv(long a, long mod) {
		long[] gcd = extgcd(a, mod);
		return (mod + gcd[0]%mod)%mod;
	}

	static long[] factInv(long[] fact, long mod) {
		int n = fact.length;
		long[] inv = new long[n];
		inv[n-1] = inv(fact[n-1], mod);
		for (int i=n-1; i>0; i--) {
			inv[i-1] = inv[i]*i%mod;
		}
		return inv;
	}

	static long nCk(int n, int k, long mod, long[] fact, long[] factI) {
		if (k < 0 || n < k) return 0;
		return fact[n] * factI[k] % mod * factI[n-k] % mod;
	}

	static void solve() {
		int h = in.nextInt();
		int w = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		long[] fact = fact(w+h, MOD);
		long[] factI = factInv(fact, MOD);
		long ans = 0;
		for (int i=1; i<=h-a; i++) {
			// System.out.println((i+b-2)+" "+(b-1)+" "+nCk(i+b-2, b-1, MOD, fact, factI));
			// System.out.println((h-i-1 + w-b-1)+" " +  (w-b-1)+" "+nCk(h-i + w-b-1, w-b-1, MOD, fact, factI));
			ans = (ans + nCk(i+b-2, b-1, MOD, fact, factI)*nCk(h-i + w-b-1, w-b-1, MOD, fact, factI)%MOD)%MOD;
		}

		out.println(ans);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 12756
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    int n, k; cin >> n >> k;
    vector<char> d(k); REP(i,k) cin >> d[i];
    
    //for (int i=n;i<=10*n;i++)
    for (int i=n;i<=(10*n);i++)
    {
        string str = to_string(i);
        int flag = 0;

        REP(j,str.size()) {
            REP(l,k) {
                if (d[l]==str[j]) {
                    flag = 1;
                }
            }
        }

        if (flag==0) {
            cout << str << endl;
            return 0;
        }

    }    


    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    map<string, vector<Pii>> m;
    string S;
    int P;
    REP(i, N){
        cin >> S >> P;
        m[S].pb(Pii(P, i));
    }
    for(auto p: m){
        vector<Pii> t = m[p.f];
        Sort(t);
        Reverse(t);
        REP(i, SZ(t)) Out(t[i].s + 1);
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main { 
	public static void main (String...args) {
		int count = 0;
		Scanner scan = new Scanner(System.in);
		String w = scan.next();
		List<String>tList = new ArrayList<>();
		while(scan.hasNext()){
             String str = scan.next().toLowerCase();
			 tList.add(str);
		}
		for(int i = 0; i < tList.size(); i++) {
			if(w.equals(tList.get(i))) {
				count++;
			}
		}
		System.out.println(count);
	}
}
	


Measured memory_bytes: 26052
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read();
    let m = sc.read();
    let mut a: Vec<usize> = sc.vec(n);
    let b: Vec<usize> = sc.vec(m);

    let max_b: usize = *b.iter().max().unwrap();
    let mut count_b = vec![0; max_b + 1];
    for b in b.into_iter() {
        count_b[b] += 1;
    }
    let count_b: Vec<(usize, usize)> = count_b
        .into_iter()
        .enumerate()
        .filter(|&(_, c)| c > 0)
        .collect();

    a.sort();

    let mut sum_a = vec![0; n + 1];
    for i in 0..n {
        sum_a[i + 1] = sum_a[i] + a[i];
    }

    let mut sum = 0;
    for (b, count) in count_b.into_iter() {
        let mut head = 0;
        let mut cur_b = b;
        let mut ans = 0;
        while head < a.len() {
            let upper = a
                .binary_search_by_key(&(cur_b * 2 - 1), |&x| x * 2)
                .err()
                .unwrap();

            let count = upper - head;
            ans += sum_a[upper] - sum_a[head];
            ans -= (cur_b - b) * count;

            head = upper;
            cur_b += b;
        }

        sum += count * ans;
    }

    println!("{}", sum);
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}



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

void fnInput(string& rsColor)
{
  int nColorSiz;
  cin >> nColorSiz >> rsColor;
}

int fnColorCount(string sColor)
{
  int nColorCnt = 0;
  int nBgn = 0;

  while (nBgn < sColor.size())
  {
    char cBgn = sColor[nBgn];
    nColorCnt++;

    int nFoward = nBgn + 1;
    while ( nFoward < sColor.size() &&
            cBgn == sColor[nFoward]    )
      nFoward++;

    nBgn = nFoward;
  }
  return nColorCnt;
}

int main()
{
  string sColor;

  fnInput(sColor);
  cout << fnColorCount(sColor) << endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97 '0'=0x30=48
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef string str;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)

ll sim( int x/*current score*/,vector<veci> s/*sid*/,veci &cc,veci c,int t,int l);
ll sims( int x/*current score*/,vector<veci> s/*sid*/,veci cc,veci c,int t,int l);

int main(){
  
  ll x=0;
  int d;cin>>d;
  veci c(26);
  rep(i,26)cin>>c[i];
  vector<veci> s(d);
  rep(j,d){
    rep(k,26){
      int tmp;
      cin>>tmp;
      s[j].push_back(tmp);
    }
  }//
  
  veci curans(d,1);
  veci cc(26,0);
  veci cb(26,0);
  int xb=0;int xbb=0;
  rep(cn,d){
    int mem=0;ll ma=INT_MIN;
    rep(i,26){
      
      int cur=sim(x,s,cc,c,i,cn);
      if(ma<cur){mem=i;ma=cur;}
      cc=cb;
    }curans[cn]=mem;
int xi,memd=0;
    if(cn>1){int tm=rand()%26;int  ma=INT_MIN;
             xi=sim(xbb,s,cb,c,tm,cn-1);
      rep(i,26){
      int cur=sim(xi,s,cb,c,i,cn);
      if(ma<cur){memd=i;ma=cur;}
      cb=cc; }
             if(ma>x){curans[cn-1]=tm;mem=memd;x=xi;}
            }
    x=sim(x,s,cc,c,mem,cn);
    xbb=xb;
    xb=x;
        
    //cerr<<x<<endl;
    cb=cc;
    curans[cn]=mem+1;
    /*cout<<mem+1<<endl;*/
  }
  rep(iii,d){
    if(curans[iii]<1)curans[iii]=1;
    if(curans[iii]>26)curans[iii]=26;
    cout<<curans[iii]<<endl;}
}
  
  ll sim( int x/*current score*/,vector<veci> s/*sid*/,veci &cc,veci c,int t,int l) {
   rep(ss,26)cc[ss]++;
    cc[t]=0;
    x+=s[l][t];
    rep(st,26)x-=cc[st]*c[st];
  return x;
}
ll sims( int x/*current score*/,vector<veci> s/*sid*/,veci cc,veci c,int t,int l) {
   rep(ss,26)cc[ss]++;
    cc[t]=0;
    x+=s[l][t];
    rep(st,26)x-=cc[st]*c[st];
  return x;
}

Measured memory_bytes: 3704
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace manyDiv
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, count = 0;
            String[] str = Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            c = int.Parse(str[2]);
            for (int i = a; i <= b; i++) {
                if (c % i == 0) count++;
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 19884
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>

using namespace std;

int main(){

	string S;
	cin>>S;
	bool N=false,South=false,W=false,E=false;

	for(int i=0;i<S.size();i++){
		if(S[i]=='N'){
			N=true;
		}else if(S[i]=='S'){
			South=true;
		}else if(S[i]=='W'){
			W=true;
		}else if(S[i]=='E'){
			E=true;
		}
	}

	if(N==South && W==E){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int
main() {
  // int a = std::stoi("123");
  // int a {std::stoi("0123") };
  // vector<int> in { 9, 99, 123 };

  int n;
  cin >> n;
  vector<int> in;
  
  for (int i=0; i<n; ++i) {
    string v;
    cin >> v;
    in.push_back( stoi(v) );
  }
  
  for (auto i:in ) {
    int a = i, cnt=0;;
    string s{};
    while (a >= 10) {
      auto enum_int = [&] {
	s = to_string(a);
	vector<pair<string,string> > xs;    
	for (int i=1;i<s.size(); i++) {
	  xs.push_back( std::make_pair( s.substr(0,i), s.substr(i) ) );
	}
	return xs;
      };
      auto && xs = enum_int();
      int m = 0;
      for (auto & x : xs) {
	m = max(m, std::stoi(x.first) * std::stoi(x.second) );
      }
      a = m;
      cnt++;
    }
    cout << cnt << endl;    
  }
  return 0;
}

Measured memory_bytes: 3244
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

#include <random>
template< class T>
T pow_ (T x, uint64_t n, uint64_t M){
    T u = 1;
    if(n > 0){
        u = pow_(x, n/2, M);
        if (n % 2 == 0) u = (u*u) % M;
        else u = (((u * u)% M) * x) % M;
    }
    return u;
};

bool suspect(__uint128_t a, uint64_t s, uint64_t d, uint64_t n){
    __uint128_t x = pow_(a, d, n);
    if (x == 1) return true;
    for (int r = 0; r < s; ++r) {
        if(x == n-1) return true;
        x = x * x % n;
    }
    return false;
}

template<class T>
bool miller_rabin(T m){
    uint64_t n = m;
    if (n <= 1 || (n > 2 && n % 2 == 0)) return false;
    uint64_t d = n - 1, s = 0;
    while (!(d&1)) {++s; d >>= 1;}
    vector<uint64_t> v = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
    if(n <= 4759123141LL) v = {2, 7, 61};
    for (auto &&p : v) {
        if(p >= n) break;
        if(!suspect(p, s, d, n)) return false;
    }
    return true;
}

int main() {
    int n;
    int ans = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int k;
        scanf("%d", &k);
        if(miller_rabin(k)) ans++;
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
ll m, a, r, c, h;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    rep(i, 0, n) {
        string s; cin >> s;
        char ch = s[0];
        if (ch == 'M') m++;
        else if (ch == 'A') a++;
        else if (ch == 'R') r++;
        else if (ch == 'C') c++;
        else if (ch == 'H') h++;
    }
    ll ans = m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();

        double radian_H = Math.toRadians(30.0*h+(6.0*((m)/15.0)));
        double radian_M = Math.toRadians(6.0*m);
        double hx = a*Math.cos(Math.toRadians(30.0*h+(6.0*(m/12.0))));
        double hy = a*Math.sin(Math.toRadians(30.0*h+(6.0*(m/12.0))));
        double mx = b*Math.cos(Math.toRadians(6.0*m));
        double my = b*Math.sin(Math.toRadians(6.0*m));
        double hsa = Math.abs(hx-mx);
        double msa = Math.abs(hy-my);

        double ans = Math.sqrt(hsa*hsa + (msa*msa));
        System.out.println(ans);
    }
}

Measured memory_bytes: 36020
import java.util.*;

public class Main{
    
    static final long INF = (long)1L<<60;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int l = Integer.parseInt(sc.next());
        
        long[][] dist = new long[n][n];
        for(long[] tmp : dist){
            Arrays.fill(tmp, INF);
        }
        for(int i=0; i<n; i++){
            dist[i][i] = 0;
        }
        
        for(int i=0; i<m; i++){
            int a = Integer.parseInt(sc.next())-1;
            int b = Integer.parseInt(sc.next())-1;
            int c = Integer.parseInt(sc.next());
            dist[a][b] = c;
            dist[b][a] = c;
        }
        
        for(int k=0; k<n; k++){
            for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){
                    dist[i][j] = Math.min(dist[i][j], dist[i][k]+dist[k][j]);
                }
            }
        }
        
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                if(dist[i][j] <= l){
                    dist[i][j] = 1;
                }else{
                    dist[i][j] = INF;
                }
            }
        }
        
        for(int k=0; k<n; k++){
            for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){
                    dist[i][j] = Math.min(dist[i][j], dist[i][k]+dist[k][j]);
                }
            }
        }
        
        int q = Integer.parseInt(sc.next());
        for(int i=0; i<q; i++){
            int s = Integer.parseInt(sc.next())-1;
            int t = Integer.parseInt(sc.next())-1;
            if(dist[s][t] != INF){
                System.out.println(dist[s][t]-1);
            }else{
                System.out.println(-1);
            }
        }
        
    }
}



Measured memory_bytes: 62968