akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, Q = MAP()
S = input()
lr = [LIST() for _ in range(Q)]

T = [0]*N
cnt = 0
for i in range(1, N):
	if S[i] == "C" and S[i-1] == "A":
		cnt += 1
		T[i] = cnt
	else:
		T[i] = cnt

for i in range(Q):
	print(T[lr[i][1]-1]-T[lr[i][0]-1])

Measured memory_bytes: 32716
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int n;
	cin >> n;
	
	ll ans = 0;
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		if (i % 3 == 0 || i % 5 == 0) continue;
		++cnt;
		ans += i;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int N,M,K;
int par[100005],size[100005],friends[100005];

//initialize root
void init(int n){
  rep(i,n)par[i]=i,size[i]=1;
}

//get the root of cuurent no.
int root(int x){
  return par[x]==x? x:
  par[x]=root(par[x]);
}

//judge if x and y belongs to a same group
bool same(int x,int y){
  return root(x)==root(y);
}

//unite to the same group
void unite(int x,int y){
  int rx=root(x);
  int ry=root(y);
  if(rx==ry)return;
  if(size[rx]<size[ry]) swap(rx,ry);
  size[rx] += size[ry];
  par[ry]=rx;

}

int main() {
  cin >> N >> M >> K;
  init(N);

  rep(i,M){
    int a,b;
    cin >> a >> b;
    unite(a,b);
    friends[a]++;
    friends[b]++;
  }

  vector<vector<int>> blocks(100005);

  rep(i,K){
    int a,b;
    cin >> a >> b;
    blocks.at(a).push_back(b);
    blocks.at(b).push_back(a);
  }


  reps(i,N){

    ll ans= size[root(i)]-friends[i]-1;
    for(auto b:blocks.at(i)){
      if(root(b)==root(i))ans--;
    }
    cout << ans << ' ';
  }
}


Measured memory_bytes: 7168
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;i++)
#define FORD(i,a,b) for (int i=a;i>=b;i--)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
pa a[200010];
int n,l[200010],ans,b[200010],s[200010],mn,mx,r[200010],L,R,tmp[200010],f[200010],ts;
int main(){
	scanf("%d",&n);
	FOR(i,1,n){
		scanf("%d%d",&a[i].fi,&a[i].se);
		tmp[++ts]=a[i].se;
	}
	sort(tmp+1,tmp+ts+1);
	ts=unique(tmp+1,tmp+ts+1)-tmp-1;
	sort(a+1,a+n+1);
	FOR(i,1,n){
		b[i]=lower_bound(tmp+1,tmp+ts+1,a[i].se)-tmp;
	}
	mx=0;
	FOR(i,1,n){
		mx=max(mx,b[i]);
		r[i]=mx;
	}
	mn=n+1;
	FORD(i,n,1){
		mn=min(mn,b[i]);
		l[i]=mn;
	}
	f[0]=s[0]=1;
	L=0;
	FOR(R,1,n){
		while (L<R && r[L]<l[R]-1) ++L;
		f[R]=(s[R-1]-s[L-1]+MO)%MO;
		s[R]=(s[R-1]+f[R])%MO;
	}
	FOR(R,1,n)
		if (r[R]==ts) (ans+=f[R])%=MO;
	cout<<ans<<endl;
	return 0;
}


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

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

	int sum=0;
	for (int i=0;i<n.size();++i)
	{
		sum+=(n[i]-'0');
	}

	if (sum%9==0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}







Measured memory_bytes: 3748
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;++i) cin>>A[i];
  sort(A.begin(), A.end());
  int l=0, r=N-1, m;
  ll size;
  bool ok;
  while(l<r) {
    m = (l+r)/2;
    size = 0;
    for(int i=0;i<=m;++i) {
      size += A[i];
    }
    ok = true;
    for(int i=m+1;i<N;++i) {
      if(size*2<A[i]) {
        ok = false;
        break;
      }
      size += A[i];
    }
    if(ok) r = m;
    else l = m+1;
  }
  cout<<N-l<<endl;
}



Measured memory_bytes: 4028
#include <iostream>
using namespace std;
int s[100001];
int ans;
int main(){
int a;
cin>>a;
for(int i=0;i<a;i++){
cin>>s[i];
if(s[i]==i+1)
s[i]=1;
else
s[i]=0;}
for(int i=0;i<a;i++){
if(s[i]==1)
{ans++;
if(s[i+1]==1)
s[i+1]=0;}}
cout<<ans;
return 0;
}

Measured memory_bytes: 640
// ------------------------------------
// Date:2018/ 4/ 3
// Problem:grid repainting / e.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 51;

typedef pair< int, int > P;

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

int H, W;
string s[MAX_N];

int d[MAX_N][MAX_N];

int bfs()
{
  REP(hi, H) fill_n(d[hi], W, INF);
  queue< P > q;
  q.push({0, 0});
  d[0][0] = 0;

  while(!q.empty()) {
    P from = q.front(); q.pop();
    if (from == make_pair(H - 1, W - 1)) return d[H - 1][W - 1];

    REP(i, 4) {
      P next;
      next.first = from.first + dx[i];
      next.second = from.second + dy[i];

      if (!(0 <= next.first && next.first < H &&
	    0 <= next.second && next.second < W)) continue;
      if (d[next.first][next.second] != INF) continue;
      if (s[next.first][next.second] == '#') continue;
      
      d[next.first][next.second] = d[from.first][from.second] + 1;
      q.push({next});
    }
  }
  return INF;
}

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

  cin >> H >> W;
  
  int ans = H * W - 1;
  
  REP(hi, H) {
    cin >> s[hi];
    REP(wi, W)
      if (s[hi][wi] == '#') ans--;
  }

  ans -= bfs();
  if (ans < 0) ans = -1;
  
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 1000005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
int main(void){
	fast;
	ll n,k,i,ma=-inf;
	cin>>n>>k;
	ll a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
		ma=max(ma,a[i]);
	}
	ll lo=0,hi=ma;
	while(lo<hi){
		ll mid=(lo+hi)/2;
		ll c=0;
		if(mid==0LL)
		break;
		for(i=0;i<n;i++)
			c+=(a[i]-1)/mid;
		if(c>k)
		lo=mid+1;
		else
		hi=mid;
	}
	cout<<max(lo,1LL);
}


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

int main(){
  int r,g,b;
  cin >> r >> g >> b;
  int a=100*r+10*g+b;
  if(a%4==0) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;
template<class T> T miman_max(set<T> &S, const T &x){
    typename set<T>::iterator it = S.lower_bound(x);
    it--;
    return *it;
}
template<class T> T maximum_from_set(set<T> &S){
    typename set<T>::iterator it = S.end();
    it--;
    return *it;
}
int main(){

    ll N;
    cin >> N;
    set<P>S;
    S.insert(P(-1, -1));
    rep(i, 1 << N){
        ll x;
        cin >> x;
        S.insert(P(x, i));
    }
    V v;
    v.push_back(maximum_from_set(S).first);
    S.erase(maximum_from_set(S));
    rep(i, N){
        V w;
        rep(j, v.size()){
            P p = miman_max(S, P(v[j], 0));
            if(p.first == -1){
                cout << "No" << endl;
                return 0;
            }
            S.erase(p);
            w.push_back(v[j]);
            w.push_back(p.first);
        }
        swap(v, w);
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 20420
#include<iostream>
using namespace std;
int main() {
	int a;
	for (int i = 0; i < 18; i++) {
		cin >> a;
	}
	cout << 0 << " " << 0 << " " << 1 << endl;
	cout << 0 << " " << 0 << " " << 59 << endl;
	cout << 15 << " " << 59 << " " << 59 << endl;
}

Measured memory_bytes: 3004
#include <cstdio>
#include <algorithm>

using namespace std;


int main ()
{
  // freopen ("file.in", "r", stdin);

    int n, p;
    scanf ("%d %d", &n, &p);

    int par = 0, imp = 0;
    for (int i = 1; i <= n; ++i)
    {
        int x;
        scanf ("%d", &x);

        if (x & 1) ++imp;
        else ++par;
    }

    if (!imp && p)
    {
        printf ("0\n");
        return 0;
    }

    if (n == 1 && par == 1 && !p)
    {
        printf ("2\n");
        return 0;
    }

    long long rez = 1LL;

    if (!imp) ++n;

    for (int i = 1; i < n; ++i)
        rez *= 2LL;

    printf ("%lld\n", rez);

    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int po[]=new int[n+1];
        ArrayList<Po>array=new ArrayList<>();
        for(int i=0;i<m;i++)
            array.add(new Po(sc.nextInt(),sc.nextInt(),i));
        array.sort(new Comparator<Po>() {
					public int compare(Po a, Po b) {
						return a.value - b.value;
					}
				});
        for(int i=0;i<array.size();i++){
            po[array.get(i).place]++;
            array.get(i).make(String.format("%012d",((long)1000000*array.get(i).place)+po[array.get(i).place]));
        }
        array.sort(new Comparator<Po>() {
					public int compare(Po a, Po b) {
						return a.index - b.index;
					}
				});
				for(int i=0;i<array.size();i++){
				    System.out.println(array.get(i).id);
        }
    }
    static class Po{
        int value;
        int place;
        int index;
        String id;
        public Po(int a,int b,int i){
            place=a;
            index=i;
            value=b;
        }
        public void make(String po){
            id=po;
        }
    }
}


Measured memory_bytes: 110228
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll N_MAX = 100000;
constexpr ll A_I_MAX = 1000000000;
constexpr ll T_MAX = 1000000000;

ll N, T;
ll a[N_MAX];

void input() {
	scanf("%lld%lld", &N, &T);
	rep(i, N) scanf("%lld", a + i);
}

void solve() {
	ll mincount=0,maxcount=0,profit=0;
	vector<ll> ruimax(N+1,0),ruimin(N+1,INF);
	rep(i,N){
		ll j=N-1-i;
		ruimax[i+1]=max(a[j],ruimax[i]);
		ruimin[i+1]=min(a[i],ruimin[i]);
	}
	debug(ruimin);
	debug(ruimax);

	repeq(i,N){
		ll j=N+1-i;
		ll t=ruimax[j]-ruimin[i];
		debug(t);
		if(profit<t){
			profit=t;
			mincount=0,maxcount=0;
		}
		if(profit==t){
			if(a[i-1]==ruimin[i])mincount++;
			else if(a[i-1]==ruimax[j])maxcount++;
			debug(mincount);
			debug(maxcount);
		}
	}

	printf("%lld\n", min(mincount,maxcount));
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
void sad(const int a[],int k ,int N, long long &min) {
	min = 0;

	for (int i = 1; i <= N; i++)
	{
		min += abs(a[i] - k);
	}
}

int main() {
	int N;
	
	cin >> N;
	
	int *a = new int[N + 1];
	int *b = new int[N + 1];

	for (int i = 1; i <= N; i++)
	{
		cin >> a[i];
		a[i] -= i;
		b[i] = a[i];
	}
	
	sort(b + 1, b + 1 + N);

	// N/2 or N/2+1
	long long min1, min2;

	sad(a, b[N / 2], N, min1);
	sad(a, b[N / 2 + 1], N, min2);
	
	cout << min(min1, min2) << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
  int n;
  int q;
  scanf("%d", &n);
  scanf("%d", &q);
  char str[n];
  int counts[n];
  scanf("%s", str);
  int i = 0;
  int count = 0;
  for(i=0;i<n-1;i++){
     if(str[i] == 'A'){
      if(str[i+1] == 'C'){
        count++;
      }
    }
    counts[i] = count;
  }
  counts[n-1] = counts[n-2];
  int start;
  int end;
  int ans = 0;
  for(i=0; i<q; i++){
    scanf("%d", &start);
    scanf("%d", &end);
    ans = counts[end-2] - counts[start-2];
    printf("\n%d", ans);
  }
  return 0;
}

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

const int MAX_N = 1005;
int N, M;
lint x[MAX_N], y[MAX_N], z[MAX_N];
P pt[MAX_N];

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++) cin >> x[i] >> y[i] >> z[i];

    lint ans = 0;
    for(int i=0;i<8;i++){
        for(int j=0;j<N;j++){
            pt[j].second = j;
            if((i&1)) pt[j].first = x[j];
            else pt[j].first = -x[j];
            if((i>>1) & 1) pt[j].first += y[j];
            else pt[j].first -= y[j];
            if((i>>2) & 1) pt[j].first += z[j];
            else pt[j].first -= z[j];
        }

        sort(pt, pt+N); reverse(pt, pt+N);

        lint a = 0, b = 0, c = 0;
        for(int j=0;j<M;j++){
            int k = pt[j].second;
            a += x[k]; b += y[k]; c += z[k];
        }
        ans = max(ans, abs(a)+abs(b)+abs(c));
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(b<c||d<a) cout<<0;
    else{
        int x=max(a,c),y=min(b,d);
        cout<<y-x;
    }
}

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

const int MAXN = 2.1e5;
int N;
int P[MAXN];
int inDeg[MAXN];
set<int> ch[MAXN];
int V[MAXN];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> P[i];
  for (int i = 1; i <= N; i++) inDeg[P[i]] ++;
  vector<int> q;
  for (int i = 1; i <= N; i++) if (!inDeg[i]) q.push_back(i);
  for (int z = 0; z < int(q.size()); z++) {
    int i = q[z];
    V[i] = 0;
    while (ch[i].count(V[i])) V[i]++;
    ch[P[i]].insert(V[i]);
    if (!(--inDeg[P[i]])) q.push_back(P[i]);
  }
  
  int st = 1;
  while (!inDeg[st]) st++;
  vector<int> vals;
  int cur = 0;
  for (int z = 0; z < 3; z++) {
    for (int i = P[st]; true; i = P[i]) {
      int nxt = 0;
      while (nxt == cur || ch[i].count(nxt)) nxt++;
      cur = nxt;
      if (i == st) break;
    }
    vals.push_back(cur);
  }
  cout << (vals[1] == vals[2] ? "POSSIBLE" : "IMPOSSIBLE") << '\n';
}

Measured memory_bytes: 21876
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int D, N, ans;
  cin >> D >> N;
  if (D==0) {
    if (N==100) {
      ans=101;
    }
    else {
      ans=N;
    }
  }
  else {
    if (D==1) {
      if (N==100) {
        ans=10100;
      }
      else {
        ans=100*N;
      }
    }
    else {
      if (N==100) {
        ans=1010000;
      }
      else {
        ans=10000*N;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String i = s.next();
        if (i.indexOf("7") != -1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35472
from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    # N = int(input())
    A,B = [int(a) for a in input().split()]
    # H = [int(a) for a in input().split()]
    # xy = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]
    print(max(0,A-2*B))



if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;

int main() {
    ll N,A,B,C,D; cin>>N>>A>>B>>C>>D;
    ll diff=B-A;
    for (int i = 0; i <= N-1; ++i) {
        if(diff>=(N-1-i)*C-D*i&&diff<=(N-1-i)*D-C*i){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n;
	cin>>n;
	vector<ll> a(n);
	rep(i, n) cin>>a[i];
	sort(all(a));
	ll lb = -1, ub = n-1;
	while(ub-lb>1){
		ll md = (lb+ub+1)/2;
		ll s = a[md];
		rep(i, n){
			if(i==md) continue;
			if(a[i]<=s*2) s += a[i];
			else s = 0;
		}
		(s?ub:lb) = md;
	}
	cout<<n-ub<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
typedef long long ll;

int main(void){
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)cin>>a[i];
    ll i=0;
    ll j=0;
    ll xsum=0,sum=0;
    ll ans=0;
    sum+=a[i];
    xsum^=a[i];
    while(1){
        if(sum==xsum){
            ans+=i-j+1;
            //cout<<"a"<<sum<<endl;
            i++;
            sum+=a[i];
            xsum^=a[i];
        }else{
            sum-=a[j];
            xsum^=a[j];
            j++;
        }
        if(j==n||i==n)break;
    }
    cout<<ans<<endl;
}


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

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define ll long long
#define pii pair<int, int>
#define is insert
#define er erase

using namespace std;

int solve();

#define TASK ""

int main()
{
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
        //freopen(TASK".in", "r", stdin);
        //freopen(TASK".out", "w", stdout);
    #endif // DEBUG
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

string s;
string t = "keyence";

int solve()
{
    cin >> s;
    if (s == t)
    {
        cout << "YES\n";
        return 0;
    }
    for (int i = 0; i < (int)s.size(); ++i)
    {
        for (int j = i; j < (int)s.size(); ++j)
        {
            string cur = "";
            for (int v = 0; v < i; ++v)
            {
                cur += s[v];
            }
            for (int v = j + 1; v < (int)s.size(); ++v)
            {
                cur += s[v];
            }
            if (cur == t)
            {
                cout << "YES\n";
                return 0;
            }
        }
    }
    cout << "NO\n";
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
#define debug(x) cout<<#x<<": "<<x<<endl

typedef long long ll;

typedef complex<ll> Point;
typedef vector<Point> VP;
#define X real()
#define Y imag()

namespace std {
    bool operator<(const Point a, const Point b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

bool compy(const Point a, const Point b) {
    return a.Y < b.Y;
}

int main(void){
    int N,K;
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K;
    VP p(N);
    rep(i,N){
        ll x,y;
        cin>>x>>y;
        p[i] = Point(x,y);
    }
    sort(all(p));
    ll res = LLONG_MAX;
    rep(r,N)rep(l,r){
        ll w = p[r].X-p[l].X;
        if(r-l+1<K)continue;
        VP pp;
        for(int i=l;i<=r;i++){
            pp.push_back(p[i]);
        }
        int n = pp.size();
        sort(all(pp),compy);
        int idxS,idxT;
        rep(i,pp.size()){
            if(pp[i]==p[l])idxS=i;
            if(pp[i]==p[r])idxT=i;
        }

        if(idxS>idxT)swap(idxS,idxT);
        for(int i=idxT-K+1;i<=idxS;i++){
            if(i<0 || i+K-1>=n)continue;
            ll h = pp[i+K-1].Y-pp[i].Y;
            res = min(res,w*h);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
String a=sc.next();
String b=sc.next();
if(a.equals(b)&&a.equals("H")){
    out.println("H");
}else if(a.equals(b)&&a.equals("D")){
    out.println("H");
}else{
    out.println("D");
}
}
}

Measured memory_bytes: 20948
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   long A = sc.nextLong();
   long B = sc.nextLong();
   
   System.out.println(lcm(A,B));
  
 }
  static long lcm (long a, long b) {
	long temp;
	long c = a;
	c *= b;
	while((temp = a%b)!=0) {
		a = b;
		b = temp;
	}
	return (long)(c/b);
}
}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

const int INF = 1e9;

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

	int n, m, a, b;
	cin >> n >> m >> a >> b;
	if (!(n % a) && !(m % b)) {
		cout << "No" << endl;
		return 0;
	}
	int V = (INF - 1) / (a * b - 1);
	vector<vector<int>> ans(n, vector<int> (m));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if ((i + 1) % a == 0 && (j + 1) % b == 0) {
				ans[i][j] = -(a * b - 1) * V - 1;
			} else {
				ans[i][j] = V;
			}
		}
	}
	// int hu = ((n + a - 1) / a) * a;
	// int wu = ((n + b - 1) / b) * b;
	// for (int i = 0; i < hu; i++) {
	// 	for (int j = 0; j < wu; j++) {
	// 		if (i < n && j < m) continue;
	// 		int toi = min(i, n - 1);
	// 		int toj = min(j, m - 1);
	// 		int val = V;
	// 		if ((i + 1) % a == 0 && (j + 1) % b == 0) val *= -1;
	// 		if (ans[toi][toj] > 0 && val > 0) ans[toi][toj] += val;
	// 	}
	// }
	cout << "Yes\n";
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cout << ans[i][j] << ' ';
		}
		cout << '\n';
	}
}

Measured memory_bytes: 4192
n,m,k = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0] + list(map(int,input().split()))
for i in range(1,n+1):
  a[i] += a[i-1]
for i in range(1,m+1):
  b[i] += b[i-1] 
ans,ai,bi = 0,0,0
for i in range(n+1):
  if a[i]<=k:
    ai = i
for j in range(m+1):
  if a[ai]+b[j]<=k:
    bi = j
ans = ai+bi
for i in range(ai):
  for j in range(bi,m+1):
    if a[ai-i-1]+b[j]>k:
      bi = j
      break
    else:
      ans = max(ans,ai-i-1+j)
print(ans)

Measured memory_bytes: 119632
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>
#include <set>

using namespace std;

int main() {


    int D;
    cin >> D;

    if (D == 25) {
        cout << "Christmas" << "\n";
    } else if (D == 24) {
        cout << "Christmas Eve" << "\n";
    } else if (D == 23) {
        cout << "Christmas Eve Eve" << "\n";
    } else if (D == 22) {
        cout << "Christmas Eve Eve Eve" << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
#ライブラリの点検
class Data():
    def __init__(self):
        self.power=1
        self.rev=1     
class Combi():
    def __init__(self,N,mod):
        self.lists=[Data() for _ in range(N+1)]
        self.mod=mod  
        for i in range(2,N+1):
            self.lists[i].power=((self.lists[i-1].power)*i)%self.mod
        self.lists[N].rev=pow(self.lists[N].power,self.mod-2,self.mod)
        for j in range(N,0,-1):
            self.lists[j-1].rev=((self.lists[j].rev)*j)%self.mod
    def combi(self,K,R):
        if K<R:
            return 0
        else:
            return ((self.lists[K].power)*(self.lists[K-R].rev)*(self.lists[R].rev))%self.mod

######################
N,M,K=map(int,input().split())
mod=998244353
ans=0
C=Combi(2*10**5,mod)
for i in range(K+1):
    ans+=M*C.combi(N-1,i)*pow(M-1,N-1-i,mod)
print(ans%mod)
######################

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

int main(){
	int n;
	int ans[30];
	int hoge;
	while(cin >> n, 0 <= n){
		for(int i=0; i < 30; i++){
			hoge = i;
			ans[i] = n%4;
			if(n < 4) break;
			n /= 4;
		}
		for(int i=hoge; 0 <= i; i--){
			cout << ans[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 1160
N, K= map(int,input().split())

N+=1
ans = 0
mod = 10**9 +7
for i in range(K,N+1):
    min = (i+1)*i//2
    max = (N+N-i+1)*i//2
    ans+= max-min+1
    ans = ans %mod

print(ans)

Measured memory_bytes: 9164
#include <stdio.h>
#include <string.h>
#include <algorithm>

template<int N,typename T> 
struct MaxFlow {
    int s,t,head[N],etot,que[N],qf,qe,dis[N],cur[N];
    struct Edge {int v,next; T cap;}g[501000];
    void init() {
        memset(head,-1,sizeof(head)); etot = 0;
    }
    void add_edge(int u,int v,T cap) {
        g[etot].v = v; g[etot].next = head[u]; g[etot].cap = cap; head[u] = etot ++;
        g[etot].v = u; g[etot].next = head[v]; g[etot].cap = 0; head[v] = etot ++;
    }
    bool bfs() {
        memset(dis,-1,sizeof(dis));
        memcpy(cur,head,sizeof(cur));
        dis[t] = N;
        qf = qe = 0;
        que[qe++] = t;
        while (qf!=qe) {
            int u = que[qf++];
            for (int i = head[u]; i != -1; i = g[i].next) {
                Edge &e = g[i];
                if (g[i^1].cap && dis[e.v] == -1) {
                    dis[e.v] = dis[u] - 1;
                    que[qe++] = e.v;
                }
            }
        }
        return dis[s] != -1;
    }
    T dfs(int u,T a) {
        if (u==t) return a;
        T flow = 0,f;
        for (int &i = cur[u]; i != -1; i = g[i].next) {
            Edge &e = g[i];
            if (e.cap && dis[e.v] > dis[u]) {
                f = dfs(e.v,std::min(a,e.cap));
                flow += f;
                e.cap -= f;
                g[i^1].cap += f;
                a -= f;
                if (a==0) break;
            }
        }
        if (flow==0) dis[u] = -1;
        return flow;
    }
    T dinic(int _s,int _t) {
        s = _s; t = _t;
        T flow = 0;
        while (bfs()) flow += dfs(s,(T)1e30);
        return flow;
    }
};

using LL = long long;
MaxFlow<200, LL> F;
int n, a[100 + 5];

int main()
{
    F.init();
    scanf("%d", &n);
    for (int i = 1; i <= n; ++ i)
        scanf("%d", a + i);
    int _s = n + 1, _t = n + 2;

    LL result = 0;
    for (int i = 1; i <= n; ++ i)
        if (a[i] < 0)
            F.add_edge(_s, i, -a[i]);
        else
            F.add_edge(i, _t, a[i]), result += a[i];

    for (int i = 1; i <= n; ++ i)
        for (int j = i + i; j <= n; j += i)
            F.add_edge(i, j, (LL)1e16);

    printf("%lld\n", result - F.dinic(_s, _t));
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
  int i,n,a,b;
  scanf("%d",&n);
  if(n<1) printf("No\n");
  else if(n==1) printf("Yes\n");
  else{
  for(i=2;i<10;i++){
    if(n%i==0){
        a=n/i;
        b=i;
    }
  }
   if((a>=1 && a<=9)&& (b>=1 && b<=9)&& (a*b==n)){
    printf("Yes\n");
   }
   else{
    printf("No\n");
   }
  }
   return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var G = (from _ in Enumerable.Repeat(0, n)
                     let s = Console.ReadLine()
                     where s.StartsWith("M") || s.StartsWith("A") || s.StartsWith("R") || s.StartsWith("C") || s.StartsWith("H")
                     group s by s[0] into g
                     select g.Count()).ToArray();
            long ans = 0;
            for (int i = 0; i < G.Length; i++)
            {
                for (int j = i + 1; j < G.Length; j++)
                {
                    for (int k = j + 1; k < G.Length; k++)
                    {
                        ans += (long)G[i] * G[j] * G[k];
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}

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

int main()
{
	string s;
	cin >> s;
	if (s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

ll _gcd(ll x, ll y){
    if(y == 0) return x;
    return (x % y) ? _gcd(y, x % y) : y;
}
ll _lcm(ll x, ll y){
    return x / _gcd(x, y) * y;
}

int main(){
    ll n; cin >> n;
    vector<ll> t(n), tlcm(n);
    rep(i, n){
        cin >> t[i];
        if(i == 0) tlcm[i] = t[i];
        else if(i == 1) tlcm[i] = _lcm(t[i-1], t[i]);
        else tlcm[i] = _lcm(t[i], tlcm[i-1]);
    }
    cout << tlcm[n-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  int N,M;
  cin>>N>>M;
  cout<<(1900*M+100*(N-M))*pow(2,M)<<endl;
  return 0;
}

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

int main() {
    string S;
    cin >> S;
    
    if (S.at(2) == S.at(3) & S.at(4) == S.at(5)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, A, B, ans =0, num=0;
    string tmp;
    cin >> N >> A >> B;
    for(int i=1; i<=N; i++){
	tmp = to_string(i);
	num=0;
	for(int j=0; j<tmp.length();j++){
	    num+=tmp[j]-'0';
	}
	if(A<=num && num<=B){
	    ans+=i;
	}
    }
    cout << ans << endl;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int ans    = 0;
    int active = 0;
    for (int i = 0; i < n; i++) {
        if (active >= h[i]) {
            active = h[i];
        } else {
            ans += h[i] - active;
            active = h[i];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
def ass(v):
    if not v:
        print(-1)
        sys.exit(0)

h, w, k = map(int, input().split())
grid = [[1 if v == '1' else 0 for v in input()] for _ in range(h)]


ass(h > 0 and w > 0 and k > 0)
for row in grid:
    ass(len(row) == w)


def count_ones(i):
    cnt = 0
    while i:
        if i & 1:
            cnt += 1
        i >>= 1
    return cnt

ans = h + w

for state in range(1 << h):
    j = 0
    vcnt = 0
    counters = [0] * (h + 1)
    is_ok = True
    while j < w:
        hi = 0
        i = 0
        local_counters = [0] * (h + 1)
        ass(len(counters) == len(local_counters))
        while i < h:
            if (1 << i) & state:
                hi = i
            # print(hi, i, j)
            # print(grid[i])
            ass(len(local_counters) > hi)
            ass(i < h and j < w)
            ass(len(grid) > i)
            ass(len(grid[i]) > j)
            local_counters[hi] += grid[i][j]
            i += 1
        for i, v in enumerate(local_counters):
            if v > k:
                is_ok = False
                break
            counters[i] += local_counters[i]
        if not is_ok:
            break
        # ass(len(counters))
        # ass(k)
        if max(counters) > k:
            counters = local_counters[:]
            vcnt += 1

        j += 1


    if is_ok and ans > count_ones(state) + vcnt:
        ans = count_ones(state) + vcnt
print(ans)



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

int main(){
  int k;
  cin >> k;
  ll seven = 7;
  for(int i=1; i<=k; i++){
    if(seven%k==0){
      cout << i << endl;
      return 0;
    }
    seven = seven%k *10 +7;
  }
  cout << -1 << endl;
}


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

typedef long long ll;

int a[200100];
ll num[200100];
int main()
{
   int n;
   scanf("%d",&n);
   ll sum=0;
   for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        sum+=num[a[i]];
        num[a[i]]++;
   }
   for(int i=1;i<=n;i++)
    printf("%lld\n",sum-num[a[i]]+1);
}


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

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

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

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

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

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

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

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

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

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

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

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

fn main() {
    input!{
        b: String,
    }
    let ans = if b == "A".to_string() {
        "T".to_string()
    } else if b == "T" {
        "A".to_string()
    } else if b == "C" {
        "G".to_string()
    } else {
        "C".to_string()
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

n = int(input())
ass = prime_factor(n)
cnt = {}
for x in ass:
    if x not in cnt:
        cnt[x] = 1
    else:
        cnt[x] += 1
#print(cnt)
ass = set(ass)
ans = 0
for x in ass:
    i = 1
    c = cnt[x]
    while c >= i:
        c -= i
        ans += 1
        i += 1

print(ans)
#print(ass)

Measured memory_bytes: 9472
#include <iostream>
#include <string>
using namespace std;
int main() {
    int n;
    string s = "";
    cin >> n;
    if (n == 0) {
        cout << "0" << endl;
        return 0;
    }
    while (n != 1) {
        int r = n % -2;
        int q = n / -2;
        if (r == -1) {
            q++;
            r = 1;
        }
      	s = (r ? "1" : "0") + s;
        n = q;
    }
    s = "1" + s;
    cout << s << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
using namespace std;
const int maxN = 507;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

inline void NIE() {puts("No"); exit(0);}

int n, m;
struct rec {
	int p, c;
	inline bool operator < (const rec &v) const {return p < v.p;}
}b[maxN];
int a[maxN * maxN];

int main() {

	n = ri();
	rep (i, 1, n) b[i] = (rec){ri(), i}, a[b[i].p] = i;
	sort(b+1, b+n+1);
	m = n * n;
	per (i, n, 1) {
		for (int id = b[i].c, t = n - b[i].c; t; --t) {
			while (m && a[m]) -- m;
			a[m] = id;
		}
		if (m < b[i].p) NIE();
	}
	m = 1;
	rep (i, 1, n) {
		for (int id = b[i].c, t = b[i].c - 1; t; --t) {
			while (m <= n * n && a[m]) ++ m;
			a[m] = id;
		}
		if (m > b[i].p) NIE();
	}
	puts("Yes");
	rep (i, 1, n * n) printf("%d%c", a[i], " \n"[i == n * n]);

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(long long N, std::string S){
    REP(i, S.size()) {
        if (S[i] + (int)N <= 'Z')
            printf("%c", S[i] + (int)N);
        else
            printf("%c", S[i] + (int)N - 26);
    }
    cout << '\n';
}

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		long a;
		long b;
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong();
		b = sc.nextLong();
		sc.close();
		long gcd = gcd(a, b);
		Map<Long, Integer>  result = primeFactorize((long)gcd);
		System.out.println(result.size() + 1);
	}

	public static long gcd(long a, long b) {
        long t;
        if (b == 0) return a;
        while (a % b > 0) {
            t = b;
            b = a % b;
            a = t;
        }
        return b;
    }

	public static Map<Long, Integer> primeFactorize(long p) {
        Map<Long, Integer> factor = new HashMap<>();
        if ((p & 1) == 0) {
            int c = 0;
            do {
                c++;
                p >>= 1;
            } while ((p & 1) == 0);
            factor.put(2L, c);
        }
        for (long i = 3; i * i <= p; i += 2) {
            if (p % i == 0) {
                int c = 0;
                do {
                    c++;
                    p /= i;
                } while ((p % i) == 0);
                factor.put(i, c);
            }
        }
        if (p > 1) {
            factor.put(p, 1);
        }
        return factor;
    }
}


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

string s;
int k;

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

	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'a')
			continue;
		else if (26 - (s[i] - 'a') <= k) {
			k -= 26 - (s[i] - 'a');		
			s[i] = 'a';
		}	
	}
	
	s[s.size() - 1] = (s[s.size() - 1] + (k % 26));

	cout << s << '\n';
	return 0;
}	


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) (vec).begin(),(vec).end()
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n;
long long a,mx,ans;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		mx=max(mx,a);
		ans+=(mx-a);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3612
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, c=0;
    string s;
    cin>>n;
    cin>> s;
    f0(i,n)
    {
        c++;
        while(i+1<n && s[i+1]==s[i]) i++;
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 512
N = int(input())
a = 1
b = 1
c = 1
for i in range(N):
  a = (a * 10) % (10 ** 9 + 7)
  b = (b * 9) % (10 ** 9 + 7)
  c = (c * 8) % (10 ** 9 + 7)
d = a - 2 * b + c
while d < 0:
  d += 10 ** 9 + 7
print(d)

Measured memory_bytes: 63208
use std::io::{Read, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    let mut iter = input.split_whitespace();

    let n: i32 = iter.next().unwrap().parse().unwrap();

    let mut house = [[[0; 10]; 3]; 4];

    for _ in 0..n {
        let b: usize = iter.next().unwrap().parse().unwrap();
        let f: usize = iter.next().unwrap().parse().unwrap();
        let r: usize = iter.next().unwrap().parse().unwrap();
        let v: i32 = iter.next().unwrap().parse().unwrap();

        house[b-1][f-1][r-1] +=v;
    }

    for i in 0..4 {
        for j in 0..3 {
            for k in 0..10 {
                out.write_fmt(format_args!(" {}", house[i][j][k])).unwrap();
            }
            out.write(b"\n").unwrap();
        }
        if i!=3 {
            out.write(b"####################\n").unwrap();
        }
    }
}



Measured memory_bytes: 5020
#include <stdio.h>

int main(void)
{
	int A,B,a,b,c,ans;

	scanf("%d",&A);
scanf("%d",&B);

	a = A + B;
	b = A - B;
	c = A * B;
	ans = a;

	if(ans < b){
	ans = b;
	}

	if(ans<c){
	ans = c;
	}

	printf("%d",ans);

	return 0;
}

Measured memory_bytes: 128