akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N; cin >> N;
  vector<string> S(N); rep(i,N) cin >> S[i];
  map<string,int> mp;
  mp["AC"] = mp["RE"] = mp["TLE"] = mp["RE"] = 0;
  rep(i,N){
    mp[S[i]]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;

  return 0;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main()
{
	int n, ans =0, hiki = INF;
	cin >> n;
	vector<int> s(n);
	rep(i,n){
		cin >> s[i];
		ans+=s[i];
	}
	sort(all(s));
	for(const auto& x : s){
		if(x%10 != 0){
			hiki = x;
			break;
		}
	}
	if(hiki == INF) ans =0;
	else if(ans%10== 0){
		ans -= hiki;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
s = list(input())
swox = []
xnum = []

count = 0
for i in range(len(s)):
    if s[i] != 'x':
        swox.append(s[i])
        xnum.append(count)
        count = 0
    if s[i] == 'x':
        count += 1

xnum.append(count)

for i in range(len(swox)//2):
    if swox[i] != swox[-i-1]:
        print(-1)
        exit()

if len(swox) == 0 or sum(xnum) == 0:
    print(0)
else:
    ans = 0
    for i in range(len(xnum)//2):
        ans += abs(xnum[i]-xnum[-i-1])
    print(ans)

Measured memory_bytes: 11236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const double pi = 3.141592653589793238;
    double a, b, x;
    cin >> a >> b >> x;
    x /= a;
    double space = a * b - x;
    double ans = 0;
    if (space > x) {
        double h = x * 2 / b;
        ans = atan2(b, h) * 180 / pi;
    }
    else {
        double h = space * 2 / a;
        ans = atan2(h, a) * 180 / pi;
    }
    printf("%.10f\n", ans);
    return 0;
}


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

int main() {
    int n; cin >> n;
    ll a[n], b[n], c[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);

    ll ans = 0;
    for (ll b_i : b) {
        ll tops = lower_bound(a, a + n, b_i) - a;
        ll btms = (c + n) - upper_bound(c, c + n, b_i);
        ans += tops * btms;
    }

    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, d, xi, yi, cnt = 0;
    cin >> n >> d;
    while(n--) {
        cin >> xi >> yi;
        if (sqrt(pow(xi, 2)+pow(yi, 2)) <= d) {
            cnt++;
        }
    }
    cout << cnt << "\n";
    return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(string S){
    queue<char> memo;
    int ans = 0;
    REP(i, S.size()){
        if(memo.empty() || memo.front() == S[i]){
            memo.push(S[i]);
        }else{
            memo.pop();
            ans += 2;
        }
    }

    cout << ans << endl;
}

int main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio> 
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<queue>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define fi first
#define se second 
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f; 
const int N=2e5+10;
int k;
ll bfs(int n)
{
	queue<ll>q;
	set<ll>s;
	int num=0;
	for(int i=1;i<=9;i++) q.push(i);
	while(!q.empty()){
		ll on=q.front();
		if(s.count(on)==0){
			s.insert(on);
			num++;
		}
		q.pop();
		if(num==n) return on;
		int f=on%10;
		if(f==0){
			q.push(on*10);
			q.push(on*10+1);
		}else if(f==9){
			q.push(on*10+8);
			q.push(on*10+9);
		}else{
			q.push(on*10+f-1);
			q.push(on*10+f);
			q.push(on*10+f+1);
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	ll n,m,q,k;
	cin>>n;
	ll ans=bfs(n); 
	cout<<ans;
}

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

enum ID{DESERT=-1, A, B, W, X, Y, Z};

int main()
{
    int map[6][2] = {
        {X, Y},
        {Y, X},
        {B, Y},
        {DESERT, Z},
        {X, DESERT},
        {W, B}
    };
    string p;
    while(cin>>p, p!="#") {
        int now = A;
        for(unsigned int i=0; i<p.size(); i++) {
            now = map[now][p[i]-'0'];
            if(now==DESERT) break;
        }
        if(now==B) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 1180
#include <vector>
#include <stack>
#include <bitset>
#include <functional>
#include <algorithm>
#include <queue>
#include <iostream>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

namespace SSCD{

    int c;

    void sscd(const vector<vector<int>>& edges,int s,vector<int>& res){
        stack<int> st;
        vector<bool> vis(edges.size());
        function<void(int)> dfs = [&](int v){
            vis[v] = 1;
            for(auto& to : edges[v]){
                if(vis[to]) continue;
                dfs(to);
            }
            st.push(v);
        };
        dfs(s);

        vector<vector<int>> rev_e(edges.size());

        for(int i = 0;i < edges.size();i++){
            for(int to : edges[i]){
                rev_e[to].push_back(i);
            }
        }
        function<void(int)> rev_dfs = [&](int v){
            res[v] = c;
            for(auto & to : rev_e[v]){
                if(vis[to] == 0) continue;
                if(res[to] != -1) continue; 
                rev_dfs(to);
            }
        };
        while(!st.empty()){
            int v = st.top();
            st.pop();
            if(res[v] != -1) continue;
            rev_dfs(v);
            c++;
        }

    }

    vector<int> sscd(const vector<vector<int>>& edges){
        c = 0;
        vector<int> res(edges.size(),-1);
        for(int i = 0;i < edges.size();i++){
            if(res[i] == -1){
                sscd(edges,i,res);
            }

        }
        return res;
    }

}


int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> edges(n + 1);
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        edges[a].push_back(b);
    }

    auto res = SSCD::sscd(edges);

    int q;
    cin >> q;
    for(int i = 0;i < q;i++){
        int a,b;
        cin >> a >> b;
        if(res[a] == res[b]){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
    }
}







Measured memory_bytes: 4736
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 100;
int N, S[Nmax];

int main(){
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> S[i];
	}

	sort(S, S+N);
	int ans = 0;
	for(int i=0; i<N; i++) ans += S[i];

	if(ans % 10 == 0){
		int i=0;
		while(i<N && S[i]%10 == 0) i++;
		if(i < N) ans -= S[i];
		else ans = 0;
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
	int N, M, P, A, B;
	while( cin >> N >> M >> P >> A >> B, N || M || P || A || B ) {
		A--; B--;
		vector<long double>T( N );
		for( size_t i = 0; i < N; i++ ) {
			cin >> T[i];
		}
		vector<vector<long double>>dp( 1 << N, vector<long double>( M, LDBL_MAX / 3 ) );
		vector<vector<pair<long long int, long long int>>>root( M );
		for( size_t i = 0; i < P; i++ ) {
			long long int X, Y, Z;
			cin >> X >> Y >> Z;
			X--;Y--;
			root[X].push_back( make_pair( Y, Z ) );
			root[Y].push_back( make_pair( X, Z ) );
		}
		dp[0][A] = 0;
		
		priority_queue<pair<long double, pair<long long int, long long int>>, vector<pair<long double, pair<long long int, long long int>>>, greater<pair<long double, pair<long long int, long long int>>>>que;
		que.push( make_pair( 0, make_pair( A, 0 ) ) );
		bool f = true;
		while( que.size() ) {
			auto now = que.top(); que.pop();
			if( now.second.first == B ) {
				cout << fixed << setprecision( 20 ) << now.first << endl;
				f = false;
				break;
			}
			for( auto x : root[now.second.first] ) {
				long long int nextpoint = x.first;
				for( size_t j = 0; j < N; j++ ) {
					if( !(now.second.second&(1 << j)) ) {
						if( x.second*1.L / T[j] + now.first < dp[now.second.second | (1 << j)][nextpoint] ) {
							dp[now.second.second | (1 << j)][nextpoint] = x.second*1.L / T[j] + now.first;
							que.push( make_pair( dp[now.second.second | (1 << j)][nextpoint], make_pair( nextpoint, now.second.second | (1 << j) ) ) );
						}
					}
				}
			}
		}
		if( f ) {
			cout << "Impossible" << endl;
		}
	}
}

Measured memory_bytes: 6260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll x, y;
    cin >> x >> y;
    ll ans = INF;
    if (x <= y) chmin(ans, y-x);
    if (-x <= y) chmin(ans, y+x+1);
    if (x <= -y) chmin(ans, -y-x+1);
    if (-x <= -y) chmin(ans, -y+x+2);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iomanip>
#include <iostream>

using namespace std;

typedef long double ld;

class Point {
public:
	ld x, y;
	Point(ld x, ld y) :
			x(x), y(y) {
	}

	Point operator +(Point p) {
		return Point(x + p.x, y + p.y);
	}

	Point operator -(Point p) {
		return Point(x - p.x, y - p.y);
	}

	Point operator *(ld a) {
		return Point(x * a, y * a);
	}

};

class Segment {
public:
	Point p1, p2;
	Segment(Point p1, Point p2) :
			p1(p1), p2(p2) {
	}
};

ld norm(Point p) {
	return p.x * p.x + p.y * p.y;
}

ld dot(Point p1, Point p2) {
	return p1.x * p2.x + p1.y * p2.y;
}

Point project(Segment s, Point p) {
	Point base = s.p2 - s.p1;
	ld r = dot(p - s.p1, base) / norm(base);
	return s.p1 + base * r;
}

int main() {

	int p1x, p1y, p2x, p2y;
	scanf("%d %d %d %d", &p1x, &p1y, &p2x, &p2y);
	Point p1(p1x, p1y);
	Point p2(p2x, p2y);
	Segment s(p1, p2);

	int q;
	scanf("%d", &q);

	for (int i = 0; i < q; ++i) {
		int qx, qy;
		scanf("%d %d", &qx, &qy);
		Point p(qx, qy);
		Point ans = project(s, p);
		cout << fixed << setprecision(10) << ans.x << " " << ans.y << endl;
	}

	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> V(N), C(N);
  for (int i = 0; i < N; i++) cin >> V[i];
  for (int i = 0; i < N; i++) cin >> C[i];

  int answer = 0;
  for (int i = 0; i < N; i++) {
    answer += max(V[i] - C[i], 0);
  }
  cout << answer;

  return 0;
}


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

# define ll      long long
# define all(vc) vc.begin(),vc.end()
# define pb      push_back
# define speed   ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
# define ALISHER
 
using namespace std;

const ll INF = 1e18;
const int N = 1e6;

ll a, b, c, cnt, A,B, m;
int ar[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};

void solve(){


}

int main(){
	# ifdef ALISHERs
        freopen( "input.txt", "r", stdin );
        freopen( "output.txt", "w", stdout );
    # endif
    speed;

	cin >> A;
	cout<<ar[ A - 1 ];

	time;
}


Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n+1);
    REP(i, n+1){
        cin >> a[i];
    }

    // [i, end)
    vector<ll> raccum(n+2, 0);
    RFOR(i, n, 0){
        raccum[i] = raccum[i+1] + a[i];
    }

    ll ans = 0;
    bool ok = true;
    int i = 0;
    ll now = 1;

    while(1){
        ans += now;
        now -= a[i];
        if(now < 0){
            ok = false;
            break;
        }
        else if(now == 0){
            if(raccum[i+1] > 0){
                ok = false;
            }
            break;
        }
        else{
            // now > 0
            if(now * 2 >= raccum[i+1]){
                now = raccum[i+1];
            }
            else{   
                now *= 2;
            }
            i++;
        }
    }
    if(!ok)
        cout << -1 << endl;
    else
        cout << ans << endl;

    return 0;
}

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

using namespace std;

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

	int ans = 0;
	for (size_t i = 1; i <= S.size(); i++) {
		if (S.find(string(i, 'R')) != string::npos) {
			ans = i;
		}
	}

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


Measured memory_bytes: 3628
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
 
 
int main(){
    string S,T;
    cin >> S >> T;
    string G;
  	G=T+S;
    cout << G;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;


int main() {
  int n, r;
  cin >> n >> r;
  if (n >= 10) {
	  cout << r << endl;
	} else {
	  cout << r + 100 * (10 - n) << endl;
	}
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define li long ll
#define pp pair<ll, ll> 
#define lb lower_bound
#define ub upper_bound
#define mk make_pair
#define pb push_back
#define llp(i, x, n) for (ll i = x; i < n; i++)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define fr first
#define ss second
#define mod 1000000007
using namespace std;
int main()
{
	fast;
    int n,x,t;
    cin>>n>>x>>t;
    int ans=ceil((n*1.0)/x);
    cout<<ans*t<<endl;
}

Measured memory_bytes: 3648
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
p = LI()
q = sorted(p)

cnt = 0
for i in range(n):
    if p[i] != q[i]:
        cnt += 1
if cnt > 2:
    print('NO')
else:
    print('YES')

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

int main()
{
  int N ;
  int K ;
  cin >> N >> K ;
  vector<vector<int>>okashi(K,vector<int>(N));
  vector<int>check(N);


  for(int i=0;i<K;i++){
    int s;
    cin >> s ;
    for(int j=0;j<s;j++){
        int y;
        cin >> y;
        y=y-1;
        check.at(y)=1;
    }
  }

  int ans=0;

  for(int i=0;i<N;i++){
    if(!(check.at(i)==1))
      ans++;
  }

  cout << ans << endl;





return 0;
}

Measured memory_bytes: 3644
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: u64 = 998244353 ;

fn pow(a: u64, n: u64) -> u64 {
    if n == 0 {
        1
    } else if n == 1 {
        a
    } else if n % 2 == 0 {
        let a2 = (a * a) % M;
        pow(a2, n / 2) % M
    } else {
        let a2 = (a * a) % M;
        ((pow(a2, n / 2) % M) * a) % M
    }
}

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ds: Vec<usize> = sc.vec(n);
    if ds[0] != 0 {
        put!(0);
        return;
    }
    let mut cx = vec![0u64; 100002];
    for &d in ds.iter() {
        cx[d] += 1;
    }
    if cx[0] != 1 {
        put!(0);
        return;
    }
    let mut ans = 1;
    for i in 1..100002 {
        ans *= pow(cx[i - 1], cx[i]);
        ans %= M;
    }
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}


Measured memory_bytes: 11768
#include <stdio.h>

int main(void)
{
	int n, ice, counter[10];
	int i, j;
	
	while(1){
		for(i = 0; i <= 9; i++){    //カウンターの初期化
			counter[i] = 0;
		}
		
		scanf("%d", &n);            //入力
		if(n == 0)    break;        //0のとき終了
		
		/*販売個数のカウント*/
		for(i = 0; i < n; i++){
			scanf("%d", &ice);
			
			switch(ice){
				case 0:    counter[0]++;    break;
				case 1:    counter[1]++;    break;
				case 2:    counter[2]++;    break;
				case 3:    counter[3]++;    break;
				case 4:    counter[4]++;    break;
				case 5:    counter[5]++;    break;
				case 6:    counter[6]++;    break;
				case 7:    counter[7]++;    break;
				case 8:    counter[8]++;    break;
				case 9:    counter[9]++;    break;
			}
		}
		
		/*出力*/
		for(i = 0; i <= 9; i++){
			if(counter[i] == 0)
				printf("-");
			else
				for(j = 0; j < counter[i]; j++){
					printf("*");
				}
			
			printf("\n");
		}
	}
	
	return 0;
}

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


int main()
{
    int n;
    cin >> n;
    double coin[n];
    for (int i=0;i<n;i++)
        cin >> coin[i];
    double dp[n+1][n+1];
    for (int i=0;i<n+1;i++){
        for (int j=0;j<n+1;j++){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    for (int i=0;i<n;i++){
        dp[i+1][0]=dp[i][0]*coin[i];
        dp[0][i+1]=dp[0][i]*(1-coin[i]);
    }
    for (int i=1;i<n+1;i++){
        for (int j=1;j<n+1-i;j++){
            dp[i][j]=(dp[i-1][j]*coin[i+j-1])+(dp[i][j-1]*(1-coin[i+j-1]));
        }
    }
    //for (int i=0;i<n+1;i++){
    //    for (int j=0;j<n+1;j++){
    //        cout << dp[i][j] << " ";
    //    }
    //    cout << endl;
    //}
    double koliko=0;
    for (int i=0;i<n+1;i++){
        if (i>n-i)
            koliko+=dp[i][n-i];
    }
    cout.precision(10);
    cout << koliko;
}


Measured memory_bytes: 70528
#include<iostream>
using namespace std;
long long div2(long long H){
  long long hold=H;
  long long count=1;
  while(hold>0){
    if(hold%2==1){
      hold=(hold-1)/2;
      count*=2;
    }else{
      hold/=2;
      count*=2;
    }
  }
  return count;
}
int main(){
  long long H;
  cin>>H;
  unsigned long long count=0;
  count=div2(H);
  cout<<count-1;
  return 0;
}

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

int main(){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans = 0;
    if(a<k){
        ans=a;
        k-=a;
        k-=b;
        if (k>0) ans-=k;
    }
    else ans = k;
    cout<<ans<<endl;
}

Measured memory_bytes: 3576
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;
class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {

		Deque<Integer> train =new ArrayDeque<Integer>();
while(sc.hasNext()) {
	int a=sc.nextInt();
	if(a!=0)train.addFirst(a);
	if(a==0)System.out.println(train.pollFirst());
}
		}
	}



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


int main() {

	string S;
	cin >> S;

	int N = S.size();
	bool can = true;
	for (int i = 0;i < N/2;i++) {
		if (S.at(i) != S.at(N - i - 1)) {
			can = false;
			break;
		}
	}
	bool can2 = true;
	for (int i = 0;i < N / 4;i++) {
		if (S.at(i) != S.at(N / 2 - i - 1)) {
			can2 = false;
			break;
		}
	}

	if (can && can2)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define fo(i, n)         for(int i=0; i<n; i++)
#define Fo(i, a, b)      for(int i=a; i<b; i++)
#define rfo(i, n)        for(int i=n-1; i>=0; i--)
#define Rfo(i, a, b)     for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=a.begin(); it!=a.end(); it++)
#define F                first
#define S                second
#define vi               vector<int>
#define vvi              vector<vector<int>>
#define pii              pair<int, int>
#define mii              map<int, int>
#define pqb              priority_queue<int>
#define pqs              priority_queue<int, vi, greater<int>>
#define mp               make_pair
#define pb(x)            push_back(x)
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define PI               3.1415926535897932384626
const int mod = 1e9+7;
const int inf = 1e18;
int mpow(int base, int exp);
bool isprime(int num);
void prifact(int num);

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //coderprasukj();
    int  n, k, x, y, flag=1;
    int a, b, c;
    cin >> a >> b >> c >> k;
    if(k>=a && k<=a+b) cout << a << "\n";
    else if(k<a && k<=a+b) cout << k << "\n";
    else if(k>a+b && k<=a+b+c) cout << a-(k-(a+b)) << "\n";
    else cout << -k << "\n";  
    return 0;
}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
  return result;
}

bool isprime(int num) {
    if(num <= 1) return false;
    for(int i=2; i*i <= num; i++)
        if(num%i == 0) return false;
    return true;
}

void prifact(int num){
    for(int i=2; i<=num; i++)
    if(num%i == 0){
        int cnt = 0;
        while(num%i == 0)
        cnt++ , num /= i;
        cout << i << "^" << cnt << " ";
    }
    if(num > 1)
    cout << num << "^" << "1" << " ";
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define CLEAR(a) memset(a,0,sizeof a)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define fr freopen("input.txt", "r", stdin);
#define fw freopen("output.txt", "w", stdout);
typedef long long LL;
typedef pair<int,int> pii;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;


int main() {
    string s;
    cin >> s;
    s[5] = ' ' ;
    s[13] = ' ' ;
    cout << s;
}

Measured memory_bytes: 256
import fileinput

for line in fileinput.input():
    tokens = list(map(int, line.strip().split()))
    a, b = tokens[0], tokens[1]
    d = a * b
    if a < b:
        tmp = a
        a = b
        b = tmp

    c = a % b
    while(c != 0):
        a = b
        b = c
        c = a % b

    g = b
    l = d / g

    print(str(g)+" "+str(int(l)))

Measured memory_bytes: 7644
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int h, w, n;
int sx, sy;
string s, t;

int main(){
    cin >> h >> w >> n;
    cin >> sy >> sx;
    sy--, sx--;
    cin >> s >> t;
    int l = 0, r = w, u = 0, d = h;
    for (int i = n-1; i >= 0; --i) {
        if (t[i] == 'L') r = min(r + 1, w);
        if (t[i] == 'R') l = max(0, l - 1);
        if (t[i] == 'U') d = min(d + 1, h);
        if (t[i] == 'D') u = max(0, u - 1);
        if (s[i] == 'L') l++;
        if (s[i] == 'R') r--;
        if (s[i] == 'U') u++;
        if (s[i] == 'D') d--; 
        if (l >= r || u >= d){
            cout << "NO" << endl;
            return 0;
        }
    }
    if (sx < l || sx >= r || sy < u || sy >= d){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
#define PI 3.1415926535

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

char upper(char c){
    if('a' <= c && c <= 'z'){
        c = c - ('a' - 'A');
    }
    return c;
}

char lower(char c){
    if('A' <= c && c <= 'Z'){
        c = c + ('a' - 'A');
    }
    return c;
}

const ll INF = 1000000000000000000;

//input
int N;
int B[100050];

//processing
int A[100050];
ll ans;
//dpTable
int dp[100050];

int main(){
    cin >> N;
    for (int i = 0; i < N - 1; i++){
        cin >> B[i];
    }
    for (int i = 0; i < N; i++){
        if (i == 0) A[0] = B[0];
        else if (i == N - 1) A[N - 1] = B[N - 2];
        else {
            A[i] = min(B[i],B[i - 1]);
        }
    }
    rep(i,N) ans += A[i];
    cout << ans << endl;
}

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

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

  int c[2]={0};
  for (int i = 0; i < s.size(); i++) {
    if(s[i]=='0'){
      c[0]++;
    }else{
      c[1]++;
    }
  }

  cout << 2 * min(c[0],c[1]) << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <set>
using namespace std;
const long long MAXN = 5e5+5;
multiset<long long> s1;
long long arr[MAXN];
long long dp[MAXN];
long long ans = -1e17;
long long dp2[MAXN];
int main() {
    long long n;
    cin>>n;
    for(long long i=1;i<=3*n;i++){
        cin>>arr[i];
    }
    for(long long i=1;i<=n;i++){
        s1.insert(arr[i]);
        dp[n+1] +=arr[i];
    }
    for(long long i=n+2;i<=3*n+1;i++){
        dp[i] = dp[i-1];
        if(arr[i-1]>*s1.begin()){
            long long hold = *s1.begin();
            s1.erase(s1.begin());
            
            s1.insert(arr[i-1]);
            dp[i]-=hold;
            dp[i]+=arr[i-1];
            
        }
        //cout<<i<<" "<<dp[i]<<endl;
    }
    s1.clear();
    for(long long i=3*n;i>=2*n+1;i--){
        s1.insert(-arr[i]);
        dp2[2*n]+=arr[i];
    }
    for(long long i=2*n-1;i>=0;i--){
        dp2[i] = dp2[i+1];
        if((-1*arr[i+1])>*s1.begin()){
            long long hold = *s1.begin();
            s1.erase(s1.begin());
            
            s1.insert(-1*arr[i+1]);
            dp2[i]+=hold;
            dp2[i]+=arr[i+1];
        }
        //cout<<i<<" "<<dp2[i]<<endl;
    }
    for(long long i=n;i<=2*n;i++){
        ans = max(ans,dp[i+1]-dp2[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 12672
package main

import (
	"fmt"
)

type BinaryIndexTree struct{ BIT [][]int }

func (b *BinaryIndexTree) init(N int) {
	for i := 0; i < N; i++ {
		b.BIT[i] = make([]int, N)
	}
}

func (b *BinaryIndexTree) add(left int, right int, val int) {
	for y := left; y <= len(b.BIT); y += y & -y {
		for x := right; x <= len(b.BIT[0]); x += x & -x {
			b.BIT[y-1][x-1] += val
		}
	}
}

func (b *BinaryIndexTree) sum(left int, right int) int {
	res := 0
	for y := left; 0 < y; y -= y & -y {
		for x := right; 0 < x; x -= x & -x {
			res += b.BIT[y-1][x-1]
		}
	}
	return res
}

func main() {
	nmq := scanNums(3)
	N := nmq[0]
	M := nmq[1]
	Q := nmq[2]
	bit := BinaryIndexTree{make([][]int, N)}
	bit.init(N)
	for m := 0; m < M; m++ {
		row := scanNums(2)
		l := row[0]
		r := row[1]
		bit.add(l, r, 1)
	}
	for q := 0; q < Q; q++ {
		row := scanNums(2)
		l := row[0]
		r := row[1]
		fmt.Println(bit.sum(r, r) - bit.sum(l-1, r) - bit.sum(r, l-1) + bit.sum(l-1, l-1))
	}
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, LN = 17, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    reverse(all(s[0]));
    reverse(all(s[1]));
    reverse(all(s[2]));
    int cur = 0;
    while (true) {
        if (s[cur].empty()) {
            cout << (char) ('A' + cur) << '\n';
            return 0;
        }
        char discard = s[cur].back();
        s[cur].pop_back();
        if (discard == 'a') cur = 0;
        else if (discard == 'b') cur = 1;
        else cur = 2;
    }
    return 0;
}

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

int main() {
	int H, W;
	cin >> H >> W;
	while(H != 0 || W != 0) {
	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			if((i + j) % 2 == 0) cout << "#";
			else cout << ".";
		}
		cout << endl;
	}
	cout << endl;
	cin >> H >> W;
	}
}


Measured memory_bytes: 3080
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n , int g){
    for(int i = g; i < n; i++){
        int v = A[i];
        int j = i-g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j -= g;
            cnt++;
        }
        A[j+g] = v;
    }
}

void shellSort(int A[], int n){
    int h = 1;
    while(h <= n){
        G.push_back(h);
        h = 3*h + 1;
    }

    for(int i = G.size()-1; i >= 0; i--){
        insertionSort(A, n, G[i]);
    }
}

int main(){
    scanf("%d" , &n);
    for(int i = 0; i < n; i++){
        scanf("%d" , &A[i]);
    }
    
    cnt = 0;
    shellSort(A,n);

    printf("%d\n", G.size());
    for(int i = G.size()-1; i >= 0; i--){
        printf("%d ",G[i]);
    }

    printf("\n%d\n", cnt);

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

    return 0;
}




Measured memory_bytes: 6644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define vi vector<int>
#define vl vector<long long>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define MOD 1e9+7

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

const int MAX_N = 110;
ll dp[MAX_N][MAX_N];
int p[MAX_N];

ll rec(int i, int j) {
    if (dp[i][j] >= 0) return dp[i][j];
    if (i == j) return dp[i][j] = 0;
    ll res = INF;
    FOR(k, i, j) {
        chmin(res, rec(i, k)+rec(k+1, j)+p[i-1]*p[k]*p[j]);
    }
    return dp[i][j] = res;
}

int main() {
    int n;
    cin >> n;
    int r, c;
    REP(i, n) {
        cin >> r >> c;
        p[i] = r;
    }
    p[n] = c;
    REP(i, n+1) {
        REP(j, n+1) {
            dp[i][j] = -1;
        }
    }
    cout << rec(1, n) << endl;
    return 0;
}


Measured memory_bytes: 3164
//                          **********  YATIN KWATRA  ********** 

//AC bakshi Rabha

#include <bits/stdc++.h>
#define ll                      long long 
#define ull                     unsigned long long 
#define FIO                     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl                    "\n"
#define fo(i,a,b)               for(int i = a; i<=b ; i++)
#define rfo(i,a,b)              for(int i = a; i>=b ; i--)
#define vii                      vector<int>
#define vll                     vector<ll>
#define pq                      priority_queue
#define uom                      unordered_map                
#define all(v)                  v.begin(),v.end()
#define mp                      make_pair
#define pb                      push_back
#define pob                     pop_back
#define ff                      first
#define ss                      second
#define pii                     pair<int,int> 
#define pll                     pair<long,long>
#define mll                     map<ll,ll>
#define mii                     map<int,int>
#define vvii                    vector<vii>
#define vvll                    vector<vll>
#define mod                     1000000007
#define pi                      3.1415926535897932384626433832795
// #define node                    Node

using namespace std;

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

}


uom<ll,ll>h;

void f(ll n)
{
    while(!(n%2))
    {
        n /= 2;

        if(h.count(2)) h[2]++;
        else h[2] = 1;
    }

    for(ll i = 3; i*i <= n ; i+=2)
    {
        while(!(n%i))
        {
            if(h.count(i)) h[i]++;
            else h[i] = 1;

            n /= i;
        }
    }
    if(n>2) h[n] = 1;
}

void solve()
{
     ll n;
     cin >> n;

     h.clear();

     f(n);

     ll cnt = 0, cur = 0,s;

     for(auto &i : h)
     {
        s = i.ss*8+1;

        s = sqrt(s);
        s--;

        s /= 2;

        cnt += s;
     }

     cout << cnt << endl;



    
       
}
int main() {
    
    FIO
    INPUT();
    
    int t;
    t = 1;
 //   cin >> t;
    
    while(t--)
    {
       solve();
    }
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
string s;
cin >> s;
ll north = count(s.begin(), s.end(), 'N');
ll south = count(s.begin(), s.end(), 'S');
ll east = count(s.begin(), s.end(), 'E');
ll west = count(s.begin(), s.end(), 'W');
bool flaga = false;
if (north * south == 0) {
    if (north == 0 && south == 0) flaga = true;
    else {
        cout << "No" << endl;
        return 0;
    }
}
bool flagb = false;
if (east * west == 0) {
    if (east == 0 && west == 0) flaga = true;
    else {
        cout << "No" << endl;
        return 0;
    }
}
cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<62;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

const int M=205;

int n;
vi a,b;

int main(){
	cin>>n;
	a=b=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	vd dp(M,-inf);
	dp[0]=0;
	for(int i=0;i<n;i++) for(int k=0;k<a[i];k++){
		vd DP(M,-inf);
		for(int j=0;j<=b[i];j++){
			DP[j]=max({(j?dp[j-1]-1.0/2+j:-inf),dp[j]+j+(b[i]!=j?1.0/4:0),(j!=b[i]?dp[j+1]+1.0/2+j:-inf)});
		}
		dp=DP;
	}
	cout<<syosu(5)<<dp[0]<<endl;
}

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

int main() {
    long long A, B, V, W, T;
    cin >> A >> V >> B >> W >> T;
    if (V <= W) printf("NO\n");
    else printf("%s\n", T * (V - W) >= abs(A - B) ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

ll inf=(ll)2e18;
const int mod=1000000007;
//const int mod=998244353;
int n,m;






int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,k,u,v;
    ll x,a,b,c,d,y,l,p;
    cin >> n;
    vll vv(n);
    for(int i=0; i<n; i++){
        cin >> vv[i];
    }
    k=n-1;
    sort(all(vv),greater<ll>());
    a=0;
    for(int i=0; i<n; i++){
        if(i!=0&&k!=0){
            a+=vv[i];
            k--;
        }
        if(i!=0&&k!=0){
            a+=vv[i];
            k--;
        }
        if(i==0){
            a+=vv[i];
            k--;
        }
    }
    cout << a << el;
    return 0;
}


Measured memory_bytes: 4780
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int x,t; cin>>x>>t;
    cout<<(t>x ? 0 : x-t)<<endl;
}

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

int main(){
    string s,ans="";
    cin>>s;
    vector<char> vc;
    for(int i=0;i<s.size();++i){
        if(s[i]=='B'){
            if(vc.size()>0)vc.pop_back();
        }
        else vc.push_back(s[i]);
    }
    for(auto j : vc)cout<<j;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int test_cases = 1;
        Solver s = new Solver();
        for (int i = 1; i <= test_cases; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}
 
class Solver {
    void solve(int test_number, InputReader in, PrintWriter out) throws IOException {        
        int n = in.nextInt();
        long all = 1, bad = 1;
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            all *= 3;
            if (x % 2 == 0) bad *= 2;
        }
        out.println(all - bad);
    }
}
 
 
class InputReader {
    BufferedReader br;
    StringTokenizer st;
 
    public InputReader()
    {
        br = new BufferedReader(new
                InputStreamReader(System.in));
    }
 
    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try
            {
                st = new StringTokenizer(br.readLine());
            }
            catch (IOException  e)
            {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
 
    int nextInt()
    {
        return Integer.parseInt(next());
    }
 
    long nextLong()
    {
        return Long.parseLong(next());
    }
 
    double nextDouble()
    {
        return Double.parseDouble(next());
    }
 
    String nextLine()
    {
        String str = "";
        try
        {
            str = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        return str;
    }
} 

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

min = []
max = []

for i in range(n):
    a,b = map(int, input().split())
    min.append(a)
    max.append(b)

min.sort()
max.sort()

if n % 2 == 0:
    bot1 = min[int(n/2)-1]
    bot2 = min[int(n/2)]
    top1 = max[int(n/2)-1]
    top2 = max[int(n/2)]
    ans = (top1 + top2) - (bot1 + bot2) + 1



else:
    bot = min[int((n-1)/2)]
    top = max[int((n-1)/2)]
    ans = top - bot + 1

print(ans)

Measured memory_bytes: 25416