akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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, k;
  cin >> n >> k;
  int ans = 1;
  rep (i, n) {
    ans = min(ans + k, ans * 2);
  }
  P(ans);

  return 0;
}

Measured memory_bytes: 256
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author anvit
 */
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        String s1=in.next();
        String s2=in.next();
        //int[] arr=new int[n];
        long p=1;
        if(s1.charAt(0)==s2.charAt(0))
            p=3;
        else if(s1.charAt(0)==s1.charAt(1))
            p=6;
        for(int i=1;i<s1.length();i++){
            if(i<s1.length()-1 && s1.charAt(i)==s1.charAt(i+1)){
                if(s1.charAt(i-1)==s2.charAt(i-1))
                    p*=2;
                else
                    p*=3;
                p=p%1000000007;
            }
            else if(s1.charAt(i)==s2.charAt(i)){
                if(s1.charAt(i-1)==s2.charAt(i-1))
                    p*=2;
                p=p%1000000007;
            }
            p=p%1000000007;
            //System.out.println(p);
        }
        System.out.println(p%1000000007);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	int L;
	cin >> L;

	cout << fixed << setprecision(15) << pow(L / 3.0, 3);

	return 0;
}

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

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

    int pos = 0, res = 1;
    for (int i=1; i<=n; i++) {
        int a; scanf("%d", &a);
        if ((pos += a) <= x) res += 1;
    }

    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF (1e9)
#define N 102
using namespace std;
int n,m;
char a,ans[N];
 
void UpdateA(){
  for(int i=1;i<=n;i++)
    if(ans[i]=='#'){
      ans[i]='A';
      return;
    }
}
 
void UpdateB(){
  for(int i=n;i>0;i--){
    if(ans[i]!='#')continue;
    if(ans[i-1]!='A'&&ans[i+1]!='A'){
      ans[i]='B';
      return;
    }
  }
  for(int i=1;i<=n;i++)
    if(ans[i]=='#'){
      ans[i]='B';
      return;
    }
}
 
void UpdateC(){
  for(int i=1;i<=n;i++){
    if(ans[i]=='#')continue;
    if(ans[i+1]=='#'&&i+1<=n){
      ans[i+1]='C';
      return;
    }
    if(ans[i-1]=='#'&&1<=i-1){
      ans[i-1]='C';
      return;
    }
  }
  if(n%2)ans[(n+1)/2]='C';
  else ans[n/2+1]='C';
}
 
void UpdateD(){
  int d[2][N],cnt=INF,maxd;
  for(int i=0;i<2;i++)
    for(int j=1;j<=n;j++)d[i][j]=INF;
  for(int i=1;i<=n;i++){
    if(ans[i]!='#')cnt=0;
    else cnt++;
    d[0][i]=cnt;
  }
  cnt=INF;
  for(int i=n;i>=1;i--){
    if(ans[i]!='#')cnt=0;
    else cnt++;
    d[1][i]=min(cnt,d[0][i]);
  }
  maxd=0;
  for(int i=1;i<=n;i++)maxd=max(maxd,d[1][i]);
  if(maxd>=INF){
    ans[1]='D';
    return; 
  }else{
    for(int i=1;i<=n;i++){
      if(d[1][i]==maxd){
    ans[i]='D';
    return;
      }
    }
  }
}
 
int main(){
  while(1){
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=1;i<=n;i++)ans[i]='#';
    for(int i=0;i<m;i++){
      cin>>a;
      if(a=='A')UpdateA();
      if(a=='B')UpdateB();
      if(a=='C')UpdateC();
      if(a=='D')UpdateD();
    }
    for(int i=1;i<=n;i++)cout<<ans[i];
    cout<<endl;  
  }
  return 0;
}

Measured memory_bytes: 1152
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;




int main() {
int n;
cin>>n;
vector<pair<ll,ll>> robot(n);
rep(i,n){
  ll X,L;
  cin>>X>>L;
  robot[i]=make_pair(X+L,X-L);
}
sort(all(robot));
ll now=-1e10,count=0;
rep(i,n){
  if(now<=robot[i].second){
    now=robot[i].first;
    count++;
  }
}
cout<<count<<endl;
return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int n,k; cin >> n >> k;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  
  ll ans = 0;
  rep(l,k+1){
    rep(r,k-l+1){
      if(l+r > n) continue;
      int d = k-l-r;
      ll now = 0;
      vector<int> s;
      rep(i,l){
        now += v[i];
        s.push_back(v[i]);
      }
      for(int i = n-r; i<n;i++){
        now += v[i];
        s.push_back(v[i]);
      }
      sort(s.begin(),s.end());
      rep(i,d){
        if(i >= s.size()) break;
        if(s[i] > 0) break;
        now -= s[i];
      }
      chmax(ans,now);
    }
  }
  
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
 
int main(){
	ll N;
    cin>>N;
    cout<<800*N - (N/15)*200<<endl;
	return 0;
}

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

int D[2003];
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int N; cin >> N;
	for (int i = 0; i < N; ++i) cin >> D[i];
	sort(D, D + N);
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			ans += lower_bound(D + j, D + N, D[i] + D[j]) - D - j - 1;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
print(40,100)
rows=['#'*100 for _ in range(20)]+['.'*100 for _ in range(20)]
rows[0]='#.'*((a-1)%50)+'##'*(50-(a-1)%50)
for i in range((a-1)//50):
  rows[2*i+2]='#.'*50
rows[21]='#.'*((b-1)%50)+'..'*(50-(b-1)%50)
for i in range((b-1)//50):
  rows[2*i+23]='#.'*50
print('\n'.join(rows))


Measured memory_bytes: 3064
str = ["0"]
s = gets.to_s.chomp
q = gets.to_i
# print str
# print q
ret = 0

q.times do |i|
  arr = gets.split(' ').to_a
  if arr[0] == "1"
    ret += 1
  elsif arr[1] == "1"
    if ret % 2 == 0
      str.unshift(arr[2])
    else
      str.push(arr[2])
    end
  else
    if ret % 2 == 0
      str.push(arr[2])
    else
      str.unshift(arr[2])
    end
  end
end

n = str.index("0")

if ret % 2 == 0
  str[n] = s
else
  str[n] = s.reverse
  str.reverse!
end

print(str.join(''))

Measured memory_bytes: 17276
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

#define SIZE 120

int main(void){
    int N;
    cin >> N;
    for(int i=0; 7*i<=N; i++){
        if((N-7*i)%4 == 0){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#define ll long long int

#include <bits/stdc++.h>

using namespace std;

int main() {

 int n ;
 cin >> n ;
 map<string ,int>mp;
 for(int i = 0 ; i < n ; i++)
 {
     string s ;
     cin >> s ;
     mp[s]++;
 }

    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: 3572
#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

int main() {
  ll n, m;
  cin >> n >> m;
  vl a(m, 0);
  rep(i, m) {
    cin >> a[i];
  }

  vl comb(n, 0);

  ll a_pos = 0;
  for (ll i=0; i < n; i++) {
    if (a_pos < m && a[a_pos] == (i + 1)) {
      a_pos += 1;
      continue;
    } 
    if (i == 0) {
      comb[i] = 1;
    } else if (i == 1) {
      comb[i] = comb[i-1] + 1;
    } else {
      comb[i] = (comb[i-2] + comb[i-1]) % 1000000007;
    }
  }

  cout << comb[n-1] << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

signed main(){
	ll n; cin>>n;
	ll m=n;
	ll ans=0;
	if(n%2==1){
		cout<<0<<endl;
		return 0;
	}
	ll j=5;
	ll cnt=1;
	while(n>0){
		n/=5;
		ans+=n-(n%2);
	}
	cout<<ans/2<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<pi>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
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;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int n;
ll cst[1 << 16];
ll A[16][16];
ll dp[1 << 16];

int main(){
    cin >> n;
    rep(i, n) rep(j, n) cin >> A[i][j];
    rep(msk, 1 << n) rep(i, n) REP(j, i + 1, n) if ((msk >> i & 1) && (msk >> j & 1)) cst[msk] += A[i][j];
    rep(msk, 1 << n) {
        for (int msk2 = msk; msk2 > 0; msk2 = msk2 - 1 & msk) {
            dp[msk] = max(dp[msk], dp[msk - msk2] + cst[msk2]);
        }
    }
    co(dp[(1 << n) - 1]);
}


Measured memory_bytes: 4704
#include <set>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;

const int maxn = 1e5;

int pos[maxn + 11];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		pos[x] = i;
	}
	set <int> s;
	set <int> ::iterator itl, itr;
	s.insert(0); s.insert(n + 1);s.insert(n + 2);s.insert(-1);
	ll ans = 0;
	for (int i = n; i >= 1; i--) {
		itl = s.lower_bound(pos[i]); itr = itl--;
		int l = *itl;
		int r = *itr;
		if (l == 0) {
			itr++;
			int R = *itr;
			if (r != n + 1) {
				ans += 1ll * pos[i] * (R - r) * i;
			}
		}
		else if (r == n + 1) {
			itl--;
			int L = *itl;
			ans += 1ll * (l - L) * (n - pos[i] + 1) * i;
		}
		else {
			itl--; itr++;
			int L = *itl; int R = *itr;
			ans += (1ll * (l - L) * (r - pos[i]) + 1ll * (R - r) * (pos[i] - l)) * i;
		}
		s.insert(pos[i]);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 8808
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
using ldb = long double;
using pa = pair < int, int >;
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
#define pb push_back
#define all(c) c.begin(),c.end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 5e5 + 10;
const double PI = acos(-1);
const int LINF = LLONG_MAX;

struct BIT{
    int N;
    vector<int> bit;
 
    void init(int n){
        N = n;
        bit.assign(n + 1, 0);
    }
 
    void update(int idx, int val){
        while(idx <= N){
            bit[idx] += val;
            idx += idx & -idx;
        }
    }
 
    void updateMax(int idx, int val){
        while(idx <= N){
            bit[idx] = max(bit[idx], val);
            idx += idx & -idx;
        }
    }
 
    int pref(int idx){
        int ans = 0;
        while(idx > 0){
            ans += bit[idx];
            idx -= idx & -idx;
        }
        return ans;
    }
 
    int rsum(int l, int r){
        return pref(r) - pref(l - 1);
    }
 
    int prefMax(int idx){
        int ans = -2e9;
        while(idx > 0){
            ans = max(ans, bit[idx]);
            idx -= idx & -idx;
        }
        return ans;
    }
};
int modpow(int x, int y){
    int ans=1;
    if(y==1){
        return x%MOD;
    }
    x=x % MOD;
    y=y % (MOD-1);
    while(y>0){
        if(y & 1){
            ans = (ans*x) %MOD;
        }
        x *= x;
        x = x % MOD;
        y >>= 1;
    }
    return ans;
}

int modinv(int x){
    return modpow(x,MOD-2);
}
int sub(int x, int y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
int add(int x, int y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
int multiply(int a,int b){
    a %= MOD;
    b %= MOD;
    return (a*b)%MOD;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int>v(n+1);
    f(i,1,n+1){
        cin >> v[i];
    }
    BIT bt;
    bt.init(n+1);
    f(i,1,n+1){
        bt.update(i,v[i]);
    }
    int ans = 0;
    f(i,1,n+1){
        int r = bt.rsum(i+1,n);
        ans = add(ans,multiply(v[i],r));
    }
    cout << ans;
    return 0;
}
 

Measured memory_bytes: 6348
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
int p[10000]={0},f[10000]={0},o[10000]={0};
int X(int x){
int e,z,u,t=0,k,g=0,w;
for(e=0;e<x;e++){
	u=0;
	w=0;
	if(o[e]!=0){
		for(z=e;z<x;z++){
				if(o[e]==o[z])u++;
				else if(o[z]==0)w++;
				else break;
		}
		if(u>=4){
			t=1;
			for(k=0;k<w+u;k++)o[e+k]=0;
		}
	}
	if(o[e]!=0)g++;
}
if(t==1)return X(x);
return g;
}
int main(){
//int a[1000],b=0;
while(1){
	int n,i,j,m,l;
	cin>>n;
	if(n==0)break;
	memset(f,0,sizeof(f));
	for(i=0;i<n;i++)cin>>p[i];
	for(i=0;i<n;i++){
		if(p[i]==p[i-1]&&i!=0)f[i]=f[i-1];
		else{
			for(j=i;j<n;j++){
				if(p[i]==p[j])f[i]++;
				else break;
			}
		}
	}
	m=n;
	for(i=0;i<n;i++){
		if( (i!=n-1&&p[i]!=p[i+1]&&1+f[i+1]>=4) || i!=0&&p[i]!=p[i-1]&&1+f[i-1]>=4||p[i+1]==p[i-1]&&i!=0&&i!=n-1&&f[i]+f[i+1]+f[i-1]>=4&&f[i]==1){
			for(j=1;j<=3;j++){
				for(l=0;l<n;l++)o[l]=p[l];
				if(o[i]!=j){
					o[i]=j;
					m=min(m,X(n));
				}
			}
		}
	}
	/*a[b]=m;
	b++;*/
	cout<<m<<endl;
}
//for(int r=0;r<b;r++)cout<<a[r]<<endl;
return 0;
}
		

Measured memory_bytes: 3204
#include <iostream>]
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <map>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
int main()
{
  int n;
  int a[12];
  int s[12];
  while(true){
    map<int,int>Map;
    cin>>n;
    if(n==0){break;}  
    rep(i,n){
      cin>>a[i];
    }
    for(int cnt=0;cnt<n*3;cnt++)
    {Map.clear();
      rep(i,n){
        Map[a[i]]++;
      }
      bool flag=true;
      rep(i,n)
      {
        flag=flag&&(Map[a[i]]==a[i]);
        s[i]=Map[a[i]];
      }
      if(flag)
      {
        cout<<cnt<<endl;
        rep(i,n){
          if(i!=0){
            cout<<" ";
          }
          cout<<a[i];
        }
        cout<<endl;
        break;
      }
      rep(i,n){
        a[i]=s[i];
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3024
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll n, i;
	cin >> n;
	string s[n];
	fr(i,0,n)
	{
		cin >> s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s, s+n);
	ll tmp = 1, ans = 0;
	fr(i,1,n)
	{
//		cout << s[i] << " " << s[i-1] << endl;
		if(s[i] == s[i-1])
			tmp++;
		else
		{
			if(tmp >= 2)
				ans = ans + (tmp * (tmp-1))/2;
			tmp = 1;
		}	
//		trace1(tmp);
	}
	if(tmp >= 2)
		ans = ans + (tmp * (tmp-1))/2;
	cout << ans;	
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
/*    #ifndef ONLINE_JUDGE
      // for getting input from input.txt
      freopen("input.txt", "r", stdin);
      // for writing output to output.txt
      freopen("output.txt", "w", stdout);
  #endif*/
fast();
//ll  t;cin>>t;while(t--)
{
  ll a,b,c,x=0;
  cin>>x>>a>>b;
  if(abs(x-a)<abs(x-b))
  {
    cout<<"A"<<endl;
  }
  else
  {
    cout<<"B"<<endl;
  }
  
  
  
  

}
return 0;
}


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

int main() {
    int n,m,k,count=0;
    cin>>n>>m;
    int totals[m+1] = {0};
    for(int i = 0; i < n; i++) {
        cin>>k;
        for(int j = 0; j < k; j++) {
            int temp;
            cin>>temp;
            totals[temp]++;
        }
    }
    for(int i = 0; i <=m;i++) {
        if(totals[i] == n) count++;
    }
    cout<<count<<"\n";
	return 0;
}

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

void solve(long long N, long long K)
{
    ll max_K = (N - 1) * (N - 2) / 2;
    if (K > max_K) {
        cout << -1 << endl;
        return;
    }

    cout << N - 1 + max_K - K << endl;
    for (ll i = 2; i <= N; i++) {
        cout << 1 << " " << i << "\n";
    }

    for (ll i = 2; i <= N; i++) {
        for (ll j = i + 1; j <= N; j++) {
            if (K >= max_K) {
                return;
            }
            cout << i << " " << j << "\n";
            K++;
        }
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
// clang-format off
#pragma GCC diagnostic ignored "-Wunused-result"
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

int main(){
    int d;
    cin >> d;
    string s;
    if(d==25) s="Christmas";
    else if(d==24) s="Christmas Eve";
    else if(d==23) s="Christmas Eve Eve";
    else s="Christmas Eve Eve Eve";
    cout << s << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int b,n,a[201],count=0,temp=2,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&b);
        if(b%2==1) count++;
        a[i]=b;
    }
    if(count!=0) printf("0\n");
    else{
        count=0;
        while(temp%2==0){
            for(i=0;i<n;i++){
                a[i]=a[i]/2;
                if(a[i]%2==1) temp=a[i];
            }
            count++;
        }
        printf("%d\n",count);
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

int main(){
    int N, W[110];
    int i;
    int sum = 0;
    int sum2 = 0;
    int delta;
    int ans = 100000;

    scanf("%d", &N);
    for(i=0; i<N; i++){
        scanf("%d", &W[i]);
        sum += W[i];
    }
    for(i=0; i<N; i++){
        sum2 += W[i];
        sum = sum - W[i];
        delta = abs(sum-sum2);
        if(delta < ans){
            ans = delta;
        } 
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
# なぜかうまくいかない
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_right, bisect_left

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

e = [0] * (N + 1)

for i in range(2, N + 1):
    cur = i
    for j in range(2, N + 1):
        while cur % j == 0:
            # 割り切れるなら，割り切れるjの数を数える
            e[j] += 1
            cur //= j
def num(m):
    return len(list(filter (lambda x: x >= m - 1, e)))

ans = num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2
print(ans)
# for n in range(1, N+1):
#     prime = prime_decomposition(n)
#     print(prime)
#     for p in prime:
#         p = int(p)
#         prime_num[p] += 1
# print(prime_num)
# num = [0] * 81
# for p_num in prime_num:
#     # if p_num <= 80:
#     p_num = min(80, p_num)
#     for i in range(1, p_num+1):
#         num[i] += 1
# print(num)
# # 同じ素数は取らないように
# ans = num[75] + num[25] * (num[3] - 1) + num[15] * (num[5] - 1) + num[5] * (num[5] - 1) * (num[3] - 2) // 2
# print(ans)    


Measured memory_bytes: 5200
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import Control.Applicative

findMinimum :: Ord a => [a] -> (a,Int)
findMinimum = minimum . flip zip [0..]


selectionSort :: Ord a => [a] -> ([a],Int)
selectionSort = selectionSort' . (,0)

-- |
-- >>> selectionSort ([5,6,4,2,1,3] :: [Int])
-- ([1,2,3,4,5,6],4)
-- >>> selectionSort ([5,2,4,6,1,3] :: [Int])
-- ([1,2,3,4,5,6],3)
 
-- TODO : find a good higer order function>
selectionSort' :: Ord a => ([a],Int) -> ([a],Int)
selectionSort' ([],n) = ([],n)
selectionSort' (x:xs,n) = let (h,i) = findMinimum (x:xs)
                              rs = take (i-1) xs ++ x:drop(i) xs
                            in
                            h <:> if i /= 0
                                     then selectionSort' (rs, n+1)
                                     else selectionSort' (xs,n)
-- |

(<:>) x (xs,b) = (x:xs,b)
main = do
    _ <- getLine
    ns <- map (read :: String -> Int) . words <$> getLine
    let (sorted,n) = selectionSort ns
    putStrLn . unwords . map show $ sorted
    print n

Measured memory_bytes: 4084
// failed to generate code

#include <bits/stdc++.h>
using namespace std;


int h[100010];
int dp[100010];

int main(){
    int N, K;
    cin >> N >> K;

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

    for(int i = 0 ; i < 100010 ; i++) dp[i] = 1e9;

    dp[0] = 0;
    for(int i = 0 ; i < N ; i++){
        for(int j = 1 ; j <= K && i + j < N ; j++){
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]));
        }
    }
    cout << dp[N-1] << endl;
}

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

int main(){
    int n,ans;
    cin >>n;
    if(n<10) ans=n;
    if(9<n&&n<100) ans=9;
    if(99<n&&n<1000) ans=9+(n-99);
    if(999<n&&n<10000) ans=9+(999-99);
    if(9999<n&&n<100000) ans=9+(999-99)+(n-9999);
    if(n==100000) ans=9+(999-99)+(99999-9999);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NM = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, M) = (NM[0], NM[1]);

        var ans = Divisor.GetDivisors(M).OrderByDescending(x => x).First(x => N <= (M / x));

        WriteLine(ans);
    }
}
static class Divisor
{
    public static IEnumerable<long> GetDivisors(long x)
    {
        var oppositeDivisors = new List<long>();

        for (long i = 1; i * i <= x; i++)
        {
            if (x % i == 0)
            {
                yield return i;
                if (x / i != i)
                    oppositeDivisors.Add(x / i);
            }
        }

        for (int i = oppositeDivisors.Count - 1; i >= 0; i--)
            yield return oppositeDivisors[i];
    }
}


Measured memory_bytes: 28296
#include<bits/stdc++.h>
using namespace std;
long long a,b,x,s,e;
int main()
{
    cin>>a>>b>>x;
    if(a%x==0)	s=a/x;
    else	s=a/x+1;
    e=b/x;
    cout<<e-s+1;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=9;i++)
	{
		if(n%i==0&&(n/i)<=9)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stdout,f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;

const int N=1e5+50 ; 
const ll oo=1e18; 

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

int n;
ll T,E,x[N],f[N]; 

ll cal(int j,int i){ return f[j]+max(2*(x[i]-x[j+1]),T); }
void sol(){
	static int q[N],l[N],h,t; 
	h=1,t=0;
	q[++t]=0,l[t]=1;
	rep(i,1,n){
		if(h+1<=t&&i>=l[h+1])++h;
		f[i]=cal(q[h],i); 
		int L,R=n+1,mid;
		while(true){
			if(i<l[t]&&cal(i,l[t])<=cal(q[t],l[t])){
				R=l[t--];
				continue;
			}
			L=max(i,l[t]);
			while(R-L>1){
				int mid=(L+R)>>1;
				if(cal(i,mid)>cal(q[t],mid))L=mid;
				else R=mid;
			}
			if(L<n)q[++t]=i,l[t]=L+1;
			break;
		}
	}
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout); 
#endif
	read(n),read(E),read(T); 
	rep(i,1,n)read(x[i]);
	sol(); 
	printf("%lld\n",f[n]+E); 
	return 0; 
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

template<class T>
struct SegmentTree {
	using F = function<T(T, T)>;
	const T init;
	const F f;
	int sz;
	vector<T> seg;
	SegmentTree(int n, const T init, const F f) :
		init(init),
		f(f)
		{
			sz = 1;
			while(sz < n) sz <<= 1;
			seg.resize(sz << 1, init);
		}
	void update(int id) {
		while(id >>= 1) {
			seg[id] = f(seg[2 * id], seg[2 * id + 1]);
		}
	}
	void replace(int id, T x){
		id += sz;
		seg[id] = x;
		update(id);
	}
	// [l,r)
	T get(int l, int r){
		T L = init, R = init;
		for(l += sz, r += sz; l < r; l >>= 1, r>>= 1) {
			if(l & 1) L = f(L, seg[l++]);
			if(r & 1) R = f(seg[--r], R);
		}
		return f(L, R);
	}
	void debug(){
		int i = 1;
		for(int r = 2; r <= 2 * sz; r <<= 1) {
			while(i < r) {
				cout << seg[i++] << " ";
			}
			cout << "\n";
		}
	}
};

vector<int> v[500010];
vector<int> vv[500010];
SegmentTree<int> seg(500010, 0, [](int l, int r) {
	return l + r;
});
tuple<int, int, int> que[500010];

int main() {
	int n, q; cin >> n >> q;
	rep(i,500010) {
		v[i].push_back(0);
	}
	rep(i,n) {
		int c; cin >> c;
		--c;
		v[c].push_back(i + 1);
	}
	rep(i,n) {
		for(int j = 1; j < (int)v[i].size(); ++j) {
			vv[v[i][j - 1] + 1].push_back(v[i][j]);
		}
	}
	rep(i,q) {
		int l, r; cin >> l >> r;
		que[i] = make_tuple(l, r, i);
	}
	sort(que, que + q);
	int ans[q];
	int now = 0;
	for(int j : vv[1]) {
		seg.replace(j, 1);
	}
	for(int i = 1; i <= n; ++i) {
		while(true) {
			if(now >= q) break;
			auto[l, r, idx] = que[now];
			if(l > i) break;
			ans[idx] = seg.get(1, r + 1);
			// cout << l << " " << r << " " << ans[idx] << '\n';
			++now;
		}
		for(int j : vv[i + 1]) {
			seg.replace(j, 1);
		}
		seg.replace(i, 0);
	}
	rep(i,q) {
		cout << ans[i] << '\n';
	}
	return 0;
}

Measured memory_bytes: 72396
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
    int a[9];
    for (int i=0; i<9; i++){
        cin >> a[i];
    }
    int n;
    cin >> n;
    int b[n];
    for (int i=0; i<n; i++){
        cin >> b[i];
    }
    for (int i=0; i<9; i++){
        for (int j=0; j<n; j++){
            if (a[i] == b[j]){
                a[i] -= b[j];
            }
        }
    }
    
    int c=0;
    if (c==0 && a[0]==0 && a[3]==0 && a[6]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[1]==0 && a[4]==0 && a[7]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[2]==0 && a[5]==0 && a[8]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[0]==0 && a[1]==0 && a[2]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[3]==0 && a[4]==0 && a[5]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[6]==0 && a[7]==0 && a[8]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[0]==0 && a[4]==0 && a[8]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0 && a[2]==0 && a[4]==0 && a[6]==0){
        c += 1;
        cout << "Yes" << endl;
    }
    else if (c==0){
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> edge[n];
    rep(i, 0, n - 1) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        edge[a].push_back(make_pair(b, c));
        edge[b].push_back(make_pair(a, c));
    }

    int q, k;
    cin >> q >> k;
    k--;
    queue<int> que;
    que.push(k);
    vector<ll> dist(n, -1);
    dist[k] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (auto pr : edge[v]) {
            int nv = pr.first;
            int c = pr.second;
            if (dist[nv] != -1) continue;
            dist[nv] = dist[v] + c;
            que.push(nv);
        }
    }

    int x[q], y[q];
    rep(i, 0, q) {
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
    }
    rep(i, 0, q) {
        cout << dist[x[i]] + dist[y[i]] << endl;
    }
    return 0;
}


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

int main(){
    int n;cin>>n;
    int F[n+1]={};F[0]=1;F[1]=1;
    for(int i=2;i<n+1;i++){
        F[i]=F[i-1]+F[i-2];//小さい値から計算していくので無駄がない.
    }
    cout<<F[n]<<endl;
    return 0;
}


Measured memory_bytes: 3124
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 100005
using namespace std;
inline int in(){
    int x=0;bool f=0;char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
struct edge{
	int to,nxt;
}e[MN<<1];
int h[MN],dep[MN],fa[MN],siz[MN];
int n,x,y,cnt,d;
inline void ins(int x,int y){
	e[++cnt].to=y;e[cnt].nxt=h[x];h[x]=cnt;
}
inline void dfs(int u){
	siz[u]=1;
	for (int i=h[u];i;i=e[i].nxt){
		int v=e[i].to;
		if (v==fa[u]) continue;
		dep[v]=dep[u]+1;fa[v]=u;
		dfs(v);siz[u]+=siz[v];
	}
}
int main()
{
	n=in();
	for (int i=1;i<n;++i){
		x=in();y=in();
		ins(x,y);ins(y,x);
	}fa[n]=0;dep[n]=1;dfs(n);d=(dep[1]>>1)+1;
	for (int i=1;i;i=fa[i])
	if (dep[i]==d){
		printf((siz[i]>n-siz[i])?"Fennec":"Snuke");return 0;
	}return 0;
}

Measured memory_bytes: 5760
import sys
def input():
    return sys.stdin.readline()[:-1]

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)

# 素因数分解
def prime_factorization(n):
    arr = []
    tmp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if tmp % i == 0:
            while tmp % i == 0:
                arr.append(i)
                tmp //= i
    if(tmp != 1):
        arr.append(tmp)
    if not arr:
        arr.append(n)
    return arr 

def main():
    A, B = map(int, input().split())
    tmp = gcd(A, B)
    if tmp == 1:
        print(1)
    else:
        print(1 + len(set(prime_factorization(tmp))))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int len=10000,maxlen=1000000;
const int mod=1e9+7;

int n,ans=0,lcm=1,cnt=0;
int a[len+5],p[maxlen+5];

int quick_power(int a,int b)
{
	if (b==0)  return 1;
	
	int res=1;
	for (;b;b=b>>1,a=(a*a)%mod)
	{
		if (b&1)  res=(res*a)%mod;
	}
	return res;
}

int ny(int x)
{
	return quick_power(x,mod-2)%mod;
}

int divide(int a,int b)
{
	return (a*ny(b))%mod;
}

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

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin>>n;
	for (int i=1;i<=n;i++)  cin>>a[i];
	
	for (int i=1;i<=n;i++)
	{
		int k=a[i];
		if (moid(k))  p[k]=max(p[k],1ll);
		for (int j=2;j*j<=a[i];j++)
		{
			if (k%j==0)
			{
				int pos=0;
				while (k%j==0)
				{
					k=k/j;
					pos++;
				}
				p[j]=max(p[j],pos);
			}
		}
		p[k]=max(p[k],1ll);
	}
	for (int i=1;i<=maxlen;i++)  lcm=(lcm*quick_power(i,p[i]))%mod;
	for (int i=1;i<=n;i++)  ans=(ans+divide(lcm,a[i]))%mod;
	
	cout<<ans<<endl;
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  if(N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9){
    cout << "hon" << endl;
  } else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
    cout << "pon" <<endl;
  } else {
    cout << "bon" << endl;
  }
}


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

int main(){
  string S, T;
  
  cin >> S;
  cin >> T;
  
  sort(S.begin(), S.end());  
  sort(T.begin(), T.end(), greater<int>());  
	
  if(S < T){
    cout << "Yes"; 
  }
  else{
      cout << "No"; 
  }


}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
vector<int>v;
int main()
{
    int n;
    cin>>n;
    int cnt=0;
    double s=0;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    s=a[0];
    for(int i=1; i<n; i++)
    {
        s+=a[i];
        s=s/2;
    }
    cout<<prec(10)<<s;

}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define re register
#define ll long long
#define in inline
#define get getchar()
in int read()
{
	int t=0; char ch=get;
	while(ch<'0' || ch>'9') ch=get;
	while(ch<='9' && ch>='0') t=t*10+ch-'0', ch=get;
	return t;
}
int h,w,d;
char s[4]={'R','Y','G','B'};
int main()
{
	h=read();
	w=read();
	d=read();
	for(re int i=1;i<=h;i++){
		for(re int j=1;j<=w;j++)
		{
			int x=(i+j+w)/d,y=(i-j+w)/d;
			//cout<<x<<' '<<y<<endl;
			cout<<s[(x%2)*2+y%2];
		}
		cout<<endl;
	}
}


Measured memory_bytes: 512
#include <stdio.h>

void swap(int *x, int *y)
{
  int tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(int argc, char *argv[])
{
    int a, b, c;

    scanf("%d%d%d", &a, &b, &c);
    if (a > b) swap(&a, &b);
    if (b > c) swap(&b, &c);
    if (a > b) swap(&a, &b);
    
    printf("%d %d %d\n", a, b, c);

    return 0;
}


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

struct STATE
{
	int num;
	int time;
	int id;
	int pe[10];
	
	bool operator < (const STATE& t) const{
		if (num == t.num){
			if (time == t.time){
				return id < t.id;
			}
			return time > t.time;
		}
		return num < t.num;
	}
	
	bool operator == (const STATE& t) const{
		return num == t.num && time == t.time;
	}
};

STATE team[50];

void init()
{
	for (int i = 0; i < 50; i++){
		team[i].num = team[i].time = 0;
		team[i].id = i + 1;
		for (int j = 0; j < 10; j++){
			team[i].pe[j] = 0;
		}
	}
}

int main()
{
	int M, T, P, R;
	while (scanf("%d %d %d %d", &M, &T, &P, &R), M + T + P + R){
		init();
		
		for (int i = 0; i < R; i++){
			int m, t, p, j;
			scanf("%d %d %d %d", &m, &t, &p, &j);
			t--; p--;
			
			if (j == 0){
				team[t].num++;
				team[t].time += m + team[t].pe[p];
			}
			else {
				team[t].pe[p] += 20;
			}
		}
		
		sort(team, team + T);
		reverse(team, team + T);
		
		for (int i = 0; i < T; i++){
			if (i){
				if (team[i] == team[i - 1]){
					cout << "=";
				}
				else {
					cout << ",";
				}
			}
			cout << team[i].id;
		}
		cout << endl;
	}
	
	return 0;
}

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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i, k , n) for(int i = k; i <= n; i++)
typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n; cin >> n;
   string s; cin >> s;
   int ans = 0;
   for(int i =1; i < n-1; i++)
   {
      int tmp = 0;
      for(int j = 'a'; j <= 'z'; j++)
      {
         int co = 0;
         for(int h = 0; h < i; h++)
         {
            if(s[h] == j)
               co =1;
         }
         for(int m = i; m <n; m++)
         {
            if(s[m] == j)
            {
               co++;
               break;
            }

         }
         if(co>=2)
            tmp++;
      }
      ans = max(ans, tmp);
   }
   cout << ans << nl;
   return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
using ll = long long int ;
#define fo(i,j,k) for(auto i=j;i<k;i++)
#define forr(i,j,k) for(auto i=j;i>k;i--)
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define vec(i) vector<i>
#define vec2d(i) vector<vector<i>>
#define hashtab(i,j) unordered_map< i, vector<j> >
#define hash(i,j) unordered_map<i,j>
#define set(i) set<i>
#define PB push_back
#define MP make_pair 
#define F first
#define S second
#define FASTIO std::ios_base::sync_with_stdio(0);std::cin.tie(NULL)
void solve(int m, int n)
{
	cout<< n*(n-1)/2 + m*(m-1)/2 <<endl;
	
}
int main()
{
	FASTIO;
	ll j,k,q,r,s,m,n,p,t;
	//cin>>n;
	//vec(ll) v; /*vector for input*/ 
	//scanf("%lld",&t); /*test case no input*/
	//while(t--)
	//{
//	scanf("%lld",&n); /*single integer input*/
	scanf("%lld %lld",&m,&n); /*two integer input*/
//	scanf("%lld %lld %lld",&m,&n,&p); /*three integer input*/
//	fo(i,0,n) /*vector scanning*/ 
//	{
	
//	}

	//}
	solve(n,m);
	return 0;
}

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

using namespace std;

const int MAX_N = 20000;

int n, p[MAX_N + 1], a[MAX_N + 1], b[MAX_N + 1];

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

    cin >> n;

    for (int i = 1; i <= n; i++) {
        cin >> p[i];
    }

    for (int i = 1; i <= n; i++) {
        a[i] = (i - 1) * n + 1;
    }

    for (int i = 1; i <= n; i++) {
        b[i] = (n - i) * n + 1;
    }

    for (int i = 2; i <= n; i++) {
        b[p[i]] += i - 1;
    }

    for (int i = 1; i <= n; i++) {
        cout << a[i];

        if (i < n) {
            cout << ' ';
        } else {
            cout << '\n';
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << b[i];

        if (i < n) {
            cout << ' ';
        } else {
            cout << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<string>
#include<utility>
using namespace std;

int main(){
    
    int n,t,a;
    cin >> n >> t >> a;
    vector<pair<int,int>> v(n);
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        v[i] = make_pair(i,a);
    }
    
    double ans = 1e9;
    int num;
    for (int i = 0; i < n; i++)
    {
        if(ans > abs(t-v[i].second*0.006-a)){
            num = v[i].first;
        }
        ans = min(ans,abs(t-v[i].second*0.006-a));
    }
    
    cout << num+1 << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

#define REP(i, s, e) for (ll i = s; i < e; ++i)

using namespace std;
using ll = long long;
using ld = long double;

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

    ll N;
    cin >> N;

    ll result = N;
    while (result % 2 != 0 || result % N != 0) result *= 2;
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256