akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

typedef long long int ll;

ll max(ll a, ll b){
	return (a>b?a:b);
}

ll max3(ll a, ll b, ll c){
	return max(max(a,b), c);
}


//recursive solution
ll vacation(ll* a, ll* b,ll* c, ll n, ll choice){
	if(n==1 && choice==0)
		return a[0];
	else if(n==1 && choice==1)
		return b[0];
	else if(n==1 && choice==2)
		return c[0];
	
	else if(choice==0){
		ll case1 = vacation(a,b,c,n-1,1) + a[n-1];//1: 'a' of previous and 'b' of current
		ll case2 = vacation(a,b,c,n-1,2) + a[n-1];
		
		return max(case1, case2);
	}
	else if(choice==1){
		ll case3 = vacation(a,b,c,n-1,0) + b[n-1];
		ll case4 = vacation(a,b,c,n-1,2) + b[n-1];
		
		return max(case3, case4);
	}
	
	else{
		//choose current ka 'c'
		ll case5 = vacation(a,b,c,n-1,0) + c[n-1];
		ll case6 = vacation(a,b,c,n-1,1) + c[n-1];
		
		return max(case5, case6);
	}
}

//dp solution
ll vacation_dp(ll* a, ll* b,ll* c, ll n){

	ll dp[n+1][3];
	
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			if(i==1 && j==0)dp[i][j]=a[0];
			else if(i==1&&j==1)dp[i][j]=b[0];
			else if(i==1&&j==2)dp[i][j]=c[0];
			
			else if(j==0){
				ll case1 = dp[i-1][1] + a[i-1];//1: 'a' of previous and 'b' of current
				ll case2 = dp[i-1][2] + a[i-1];
				
				dp[i][j] = max(case1, case2);
			}
			
			else if(j==1){
				ll case1 = dp[i-1][0] + b[i-1];//1: 'a' of previous and 'b' of current
				ll case2 = dp[i-1][2] + b[i-1];
				
				dp[i][j] = max(case1, case2);
			}
			
			else {
				ll case1 = dp[i-1][0] + c[i-1];//1: 'a' of previous and 'b' of current
				ll case2 = dp[i-1][1] + c[i-1];
				
				dp[i][j] = max(case1, case2);
			}
		}
	}

	return max3(dp[n][0], dp[n][1], dp[n][2]);	
	
	
}


int main(){

	ll N;
	cin>>N;
	ll a[N], b[N], c[N];
	
	for(int i=0;i<N;i++)
		cin>>a[i]>>b[i]>>c[i];
		
	cout<<vacation_dp(a,b,c,N)<<endl;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
} 
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x) / log(base));
}
ll n,k; string s;
ll dp[101][4][2];
ll ff(ll ind,ll num,ll f)
{
	if(ind==n && num==k)
	return 1;
	if(num>k || ind>=n)
	return 0;
	if(dp[ind][num][f]!=-1)
	return dp[ind][num][f];
	ll ans=0;
	ll x= f==1 ? 9 : (s[ind]-'0');
	repi(i,0,x)
	{
		ans+=ff(ind+1,num+(i==0?0:1),((f==1) || (i<s[ind]-'0')));
	}
	return dp[ind][num][f]=ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,m,b,c,a,u;
    	cin>>s>>k;
    	n=s.size();
    	repi(i,0,n)
    	{
    		repi(j,0,3)
    		{
    			repi(k,0,1)
    			dp[i][j][k]=-1;
			}
		}
    	cout<<ff(0,0,0);
	}
	return 0;
}

Measured memory_bytes: 256
//file_name:ABC74_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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


    ll ans = 0;

    rep(i,n){
        int x;
        cin >> x;
        ans += min(x,k-x);
    }
    ans *= 2;

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



Measured memory_bytes: 256
#include<stdio.h>
main(){
	double height[100];
	int i;
	for(i=0;scanf("%lf",&height[i])!=EOF;i++);
	int j,k;
	double tmp;
	for(j=0;j<i;j++){
		for(k=j+1;k<i;k++){
			if(height[j]<height[k]){
				tmp=height[k];
				height[k]=height[j];
				height[j]=tmp;
			}
		}
	}
	printf("%.1f\n",height[0]-height[i-1]);
	return 0;
}

Measured memory_bytes: 652
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
P = list(map(int, input().split()))

length = 102
ans = 102
for i in range(-100,201):
    if not (i in P):
        if abs(x-i)<length:
            length = abs(x-i)
            ans = i

print(ans)


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

int main() {
    int x;
    cin >> x;

    int ans = 1;

    for (int i = 2; i <= 31; i++) {
        int a = i * i;
        while (a <= x) {
            ans = max(ans, a);
            a *= i;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	int N, D, X, A, count = 0;
	cin >> N >> D >> X;
	for (int i = 0; i < N; i++) {
		cin >> A;
		count += (D - 1) / A + 1;
	}
	cout << count + X << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};
long double eps = 1e-6;
long double pi = acos(-1);



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    ll a[n];
    ll x = 0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        x ^= a[i];
    }
    for(int i=0;i<n;i++){
        cout << (x^a[i]) << " ";
    }
    cout << endl;

}

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

int main()
{
   long long t,n,flag=0;
   map<long long,long long>m;
   cin>>t;
   if(t%2==1)
      t--;
   while(t--)
   {
         cin>>n;
         m[n]++;
   }
   for(auto itr=m.begin();itr!=m.end();itr++)
   {
         if(itr->second>=2)
         {
               flag=1;
               break;
         }
   }
   if(flag)
      cout<<"NO"<<endl;
   else
      cout<<"YES"<<endl;

   m.clear();
}


Measured memory_bytes: 12800
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-09-26 20:17
# @url:
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
## 注意嵌套括号!!!!!!
## 先有思路,再写代码,别着急!!!
## 先有朴素解法,不要有思维定式,试着换思路解决
def main():
    n,m=map(int,input().split())
    s=set()
    fa=[i for i in range(n+1)]
    child_sum=[1]*(n+1)
    # 并查集常用函数
    def find(x):
        if x!=fa[x]:
            fa[x]=find(fa[x])
        return fa[x]
    def union(x,y):
        x = find(x)
        y = find(y)
        if x == y:  
            return
        fa[x] = y
        # 计算并查集的交集大小
        child_sum[y]+=child_sum[x]
    pairs=[]
    for i in range(m):
        a=list(map(int,input().split()))
        pairs.append((a[0],a[1]))
    # 求并集
    for (i,j) in pairs:
        union(i,j)
    for (i,j) in pairs:
        union(j,i)
    # print (fa)
    for i in range(1,n+1):
        s.add(fa[i])
    print (len(s)-1)
if __name__ == "__main__":
    main()

Measured memory_bytes: 92320
#include <bits/stdc++.h>
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define rep(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;

ll merge_cnt(vector<ll> &a) {
    int n = a.size();
    if (n <= 1) { return 0; }

    ll cnt = 0;
    vector<ll> b(a.begin(), a.begin()+n/2);
    vector<ll> c(a.begin()+n/2, a.end());

    cnt += merge_cnt(b);
    cnt += merge_cnt(c);

    int ai = 0, bi = 0, ci = 0;
    // merge の処理
    while (ai < n) {
        if ( bi < b.size() && (ci == c.size() || b[bi] <= c[ci]) ) {
            a[ai++] = b[bi++];
        } else {
            cnt += n / 2 - bi;
            a[ai++] = c[ci++];
        }
    }
    return cnt;
}

ll n,k,num;
vector<ll> a;
map<ll,int> mp;
int main(){
    cin>>n>>k;
    a.resize(n+1);
    mp[0]=1;
    FOR(i,1,n+1){
        cin>>a[i];
        a[i]-=k;
        a[i]*=-1;
        a[i]+=a[i-1];
        num+=mp[a[i]];
        mp[a[i]]++;
    }
    cout<<merge_cnt(a)+num<<endl;
}


Measured memory_bytes: 11604
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define r0 return 0;
#define f(k,i,n,j) for(ll k=i;k<=n;k=k+j)
#define cin(a) cin>>a;
#define loop while(t--)
#define vi vector<int>
#define vii vector<long long int>
#define crap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define SORT(v) sort(v.begin(),v.end());
int main()
{
    char c;
    cin>>c;
    cout<<char(c+1)<<endl;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
        int nam[] = new int[n];
        int count = 0;
      
      for(int i = 0 ;i < n ;i++){
       nam[i] =  in.nextInt();
      }
      
      for(int i = 1;i < n-1;i++){
        if(nam[i-1]>nam[i]&&nam[i]>nam[i+1]){count++;}
        else if(nam[i-1]<nam[i]&&nam[i]<nam[i+1]){count++;}
      }
      
      System.out.print(count);
      
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <limits.h>
using namespace std;

int main() {
	int n, a, b, c, d;
	cin >> n;
	a = n / 1000;
	b = n / 100 - a * 10;
	c = n / 10 - b * 10 - a * 100;
	d = n - c * 10 - b * 100 - a * 1000;
	if (a + b + c + d == 7) cout << a << "+" << b << "+" << c << "+" << d << "=7";
	else if (a + b + c - d == 7) cout << a << "+" << b << "+" << c << "-" << d << "=7";
	else if (a + b - c + d == 7) cout << a << "+" << b << "-" << c << "+" << d << "=7";
	else if (a + b - c - d == 7) cout << a << "+" << b << "-" << c << "-" << d << "=7";
	else if (a - b + c + d == 7) cout << a << "-" << b << "+" << c << "+" << d << "=7";
	else if (a - b + c - d == 7) cout << a << "-" << b << "+" << c << "-" << d << "=7";
	else if (a - b - c + d == 7) cout << a << "-" << b << "-" << c << "+" << d << "=7";
	else if (a - b - c - d == 7) cout << a << "-" << b << "-" << c << "-" << d << "=7";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
using namespace std;
ll t;
int main()
{
    ll a,b,c,d,e,f,i,j;
    cin>>a;
    cout<<"Christmas ";
    for(i=0;i<25-a;i++)
    {
        cout<<"Eve";
        if(i!=24-a)cout<<' ';
    }
    cout<<endl;

return 0;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;

public class Main {
	static int ans = Integer.MAX_VALUE;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		Obj[] arr = new Obj[n];
		for (int i = 0; i < n; i++) {
			Obj o = new Obj();
			o.i = i;
			o.a = Integer.parseInt(sa[i]);
			arr[i] = o;
		}
		sa = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			arr[i].b = Integer.parseInt(sa[i]);
		}
		br.close();

		combination(arr, n / 2, new LinkedHashSet<>(), null);
		if (ans == Integer.MAX_VALUE) {
			System.out.println(-1);
		} else {
			System.out.println(ans);
		}
	}

	static void combination(Obj[] arr, int k, LinkedHashSet<Integer> set, Integer last) {
		if (set.size() == k) {
			List<Obj> list1 = new ArrayList<>();
			List<Obj> list2 = new ArrayList<>();
			for (Obj o : arr) {
				if (!set.contains(o.i)) {
					if (o.i % 2 == 0) {
						o.v = o.a;
					} else {
						o.v = o.b;
					}
					list1.add(o);
				} else {
					if (o.i % 2 == 0) {
						o.v = o.b;
					} else {
						o.v = o.a;
					}
					list2.add(o);
				}
			}
			Collections.sort(list1, (o1, o2) -> o1.v - o2.v);
			Collections.sort(list2, (o1, o2) -> o1.v - o2.v);
			int n = arr.length;
			int[] idx = new int[n];
			int x = 0;
			for (int i = 0; i < k; i++) {
				idx[x] = list1.get(i).i;
				x++;
				idx[x] = list2.get(i).i;
				x++;
			}
			if (n > k * 2) {
				idx[x] = list1.get(k).i;
			}
			for (int i = 1; i < n; i++) {
				if (arr[idx[i - 1]].v > arr[idx[i]].v) {
					return;
				}
			}

			for (int i = 0; i < n; i++) {
				idx[i]++;
			}
			BIT bit = new BIT(n);
			int cnt = 0;
			for (int i = 0; i < n; i++) {
				cnt += i - bit.sum(idx[i]);
				bit.add(idx[i], 1);
			}
			ans = Math.min(ans, cnt);
			return;
		}

		int i = 0;
		if (last != null) {
			i = last + 1;
			if (set.size() + arr.length - i < k) {
				return;
			}
		}
		for ( ; i < arr.length; i++) {
			set.add(i);
			combination(arr, k, set, i);
			set.remove(i);
		}
	}

	static class Obj {
		int i, a, b, v;
	}

	static class BIT {
		int n;
		long[] arr;

		public BIT(int n) {
			this.n = n;
			arr = new long[n + 1];
		}

		void add(int idx, long val) {
			for (int i = idx; i <= n; i += i & -i) {
				arr[i] += val;
			}
		}

		long sum(int idx) {
			long sum = 0;
			for (int i = idx; i > 0; i -= i & -i) {
				sum += arr[i];
			}
			return sum;
		}
	}
}


Measured memory_bytes: 50708
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    D, T, S = MAP()

    print("Yes" if D / S <= T else "No")


if __name__ == '__main__':
    main()


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

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

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

char toLowerCase(char c){
  if(isLowerCase(c)){
    return c;
  }else{
    return c+'a'-'A';
  }
}
char toUpperCase(char c){
  if(isLowerCase(c)){
    return c-('a'-'A');
  }else{
    return c;
  }
}
ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
void func(vector<int>& l, int depth, int idx){
  ;
}
int main() {
  int n;cin>>n;
  n--;
  int ans=n/2;
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

#define ll long long
#define pi pair<int, int>
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int mxn = 1e6 + 5;
const ll MOD = 1e9 + 7;
vector<int> arr[mxn];
int n, m, k;
string s, t;

ll pow(ll A,ll B,ll R=1)
{while(B){if(B&1)R=R*A%MOD;A=A*A%MOD;B>>=1;}return R;}


void read(){
    cin >> n;
    for(int i = 1, u, v; i < n; i++){
        cin >> u;
        arr[u].pb(i + 1);
        arr[i + 1].pb(u);
    }
}

void solve(){
    for(int i = 1; i <= n; i++){
        int res = arr[i].size() - 1;
        if(i == 1) res++;
        cout << res << endl;
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    while(T--) read(), solve();
    return 0;
}


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

int h;

int parent(int i){return i / 2;}
int left(int i){return i * 2;}
int right(int i){return i * 2 + 1;}

void maxHeapify(int t[], int i){
  int large;
  int l = left(i);
  int r = right(i);
  if(l <= h && t[l] > t[i]) large = l;
  else large = i;
  if(r <= h && t[r] > t[large]) large = r;
  if(large != i){
    swap(t[i], t[large]);
    maxHeapify(t, large);
  }
}

void buildMaxHeap(int t[]){
  for(int i=h/2;i>=1;i--){
    maxHeapify(t, i);
  }
}

int main(){
  cin >> h;
  int tree[h+1];
  for(int i=1;i<h+1;i++){
    cin >> tree[i];
  }
  buildMaxHeap(tree);
  for(int i=1;i<=h;i++){
    cout << " " << tree[i];
  }
  cout << endl;
  return 0;
}



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

#define IO   {   freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);   }

int main()
{
    //IO;
    int n;  cin>>n;
    while(n!=0)
    {
        int r = n%10;
        n=n/10;
        if(r==7)    { cout<<"Yes\n";    return 0;   }
    }
    cout<<"No\n";
    return 0;
    
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>
int main(void) {
	int x, h;

	while (1) {
		scanf("%d %d ", &x, &h);
		if (!(x || h))
			break;

		printf("%.6lf\n", x * x + hypot(x, h * 2) * x);
	}
	return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
using namespace  std ;
typedef long long  ll;
typedef pair<ll, ll> Pll;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define rad(X) cout << (X) << endl
#define ASH(X) cout << (X) << " "
#define debug(x) cout << #x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define FOR(I,A,B) for(ll I = (A); I <= (B); I++)
#define cir(I,B,A) for(ll I = (A); I >=(B); I--)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define SORT(c) (sort(c.begin(),c.end()))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASES int ___T; cin >> ___T; for(int cs=1;cs<=___T;cs++)
#define FAST()  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
template<typename T>T gcd(T x, T y){if(y==0)return x;else return gcd(y,x%y);}
ll fx[] = {1, 1, 0, -1, -1, -1, 0, 1};
ll fy[] = {0, 1, 1, 1, 0, -1, -1, -1};
vector<ll>a,b,c;
map<ll,ll>m1,m2,m3;
ll mod =    1e9 + 7;
char  s[1001][1001];
ll   dp[1001][1001];

/************************************************/

void Execute()
{
    ll n, nb, k, q, a, b, c, l, r, d, x, y, p, m,i,j;

      cin >> r >> c;

      FOR(i,0,r-1)FOR(j,0,c-1){
        cin >> s[i][j];
      }


            dp[0][0] = 1;

            FOR(i,0,r-1) FOR(j,0,c-1){
              if(s[i][j]=='#') continue;
              if(i-1>=0) dp[i][j] = (dp[i][j]+dp[i-1][j])%mod;
              if(j-1>=0) dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
            }

            std::cout << dp[r-1][c-1] << '\n';

}

int32_t main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("atomm.txt", "r", stdin);
    //#endif

    FAST();
  //  CASES
    //{
        Execute();
    //}
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define debug(x) cout << x << endl;
const ll INF = 1e18;
const ll mod = 1e9 + 7;
const ll N = 1010;
bool isPal(string str){
        size_t len = str.length();

    for(int i = 0; i < len/2; i++){
        if(str[i] != str[len-1-i]){
            return false;
        }
    }
    return true;

}
int main()
{

string s;
cin>>s;
string s2=s.substr(0,s.length()/2);

if(isPal(s2)&&isPal(s)){
    cout<<"Yes";
}
else cout<<"No";










}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a,b,c;
  cin >> a >> b >> c;
  if ( a<=b && b<=c && a<=c ) {
    cout << a << " " << b << " " << c << endl;
  } else if ( b<=a && a<=c && b<=c ) {
    cout << b << " " << a << " " << c << endl;
  } else if ( a<=c && c<=b && a<=b ) {
    cout << a << " " << c << " " << b << endl;
  } else if ( c<=a && a<=b && c<=b ) {
    cout << c << " " << a << " " << b << endl;
  } else if ( b<=c && c<=a && b<=a ) {
    cout << b << " " << c << " " << a << endl;
  } else if ( c<=b && b<=a && c<=a ) {
    cout << c << " " << b << " " << a << endl;
  }
}


Measured memory_bytes: 3084
N = int(input())
S = input()
lst = []
flag = True
for i in range(1,N):
    X = S[0:i]
    Y = S[i:N]
    xlst = list(X)
    ylst = list(Y)
    Zlst = list(set(xlst) & set(ylst))
    z = len(Zlst)
    lst.append(z)
    i=i+1
print(max(lst))

Measured memory_bytes: 3064
using namespace std;

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <numeric>
#include <map>
using namespace std;


int main(void){
	int N,L;

	cin >> N >> L;

  auto tmp = (N * (N - 1) / 2) + (L * N);
  if (L > 0)
    tmp -= L;
  else if (L+N-1 < 0)
    tmp -= L+N-1;
	cout << tmp << endl;

	return 0;
}


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

#define int long long
#define INF 1e18

signed main() {
    string s; cin >> s;
    string t = "";
    for(int i = 0; i < s.size(); i++) {
        if(i % 2 == 0) {
            t += s[i];
        }
    }
    cout << t << endl;
}


Measured memory_bytes: 512
fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val aa = Array(h) { readLine()!! }

    var hPos = 0
    var wPos = 0

    for (hIdx in 0 until h) {
        inner@for (wIdx in 0 until w) {
            if (aa[hIdx][wIdx] != '#') continue@inner

            //println("h:$hIdx w:$wIdx hPos:$hPos wPos:$wPos")

            if (hIdx < hPos || wPos < wIdx) {
                println("Impossible")
                return
            }

            // start
            if (hIdx == 0 && wIdx == 0) {
                if (aa[hIdx+1][wIdx] == '#' && aa[hIdx][wIdx+1] == '#') {
                    println("Impossible")
                    return
                }
                if (aa[hIdx+1][wIdx] == '#') {
                    hPos++
                }
                if (aa[hIdx][wIdx+1] == '#') {
                    wPos++
                }
                continue@inner
            }

            // end
            if (hIdx == h-1 && wIdx == w-1) {
                if (aa[hIdx][wIdx-1] == '#' && aa[hIdx-1][wIdx] == '#') {
                    println("Impossible")
                    return
                }
                continue@inner
            }

            var cnt = 0

            // top
            if (hIdx != 0 && aa[hIdx-1][wIdx] == '#') {
                cnt++
            }
            // bottom
            if (hIdx != h-1 && aa[hIdx+1][wIdx] == '#') {
                hPos++
                cnt++
            }
            // left
            if (wIdx != 0 && aa[hIdx][wIdx-1] == '#') {
                cnt++
            }
            // right
            if (wIdx != w-1 && aa[hIdx][wIdx+1] == '#') {
                wPos++
                cnt++
            }

            //println("h:$hIdx w:$wIdx cnt:$cnt")

            if (cnt != 2) {
                println("Impossible")
                return
            }
        }
    }

    println("Possible")
}

Measured memory_bytes: 36164
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 2000000
#define MOD 1000000007
#define INF 10000000000000000

int main(){
  int N;
  cin>>N;
  vector<ll> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }

  vector<ll> sum(N+1,0);
  for(int i=0;i<N;i++){
    sum.at(i+1)=sum.at(i)+a.at(i);
  }

  vector<vector<ll>> cost(N,vector<ll>(N,INF));
  for(int i=0;i<N;i++){
    cost.at(i).at(i)=0;
  }
  for(int l=1;l<N;l++){
    for(int i=0;i+l<N;i++){
      for(int k=i;k<i+l;k++){
        cost.at(i).at(i+l)=min<ll>(cost.at(i).at(k)+cost.at(k+1).at(i+l)+sum.at(i+l+1)-sum.at(i),cost.at(i).at(i+l));
      }
    }
  }

  cout<<cost.at(0).at(N-1)<<endl;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n];
    int a=INT_MAX;
    for(int i=0;i<n;i++)
        cin>>arr[i];
    for(int t=0;t<n-1;t++){
        int s1=0,s2=0;
        for(int i=0;i<=t;i++){
            s1+=arr[i];
        }
        for(int i=t+1;i<n;i++){
            s2+=arr[i];
        }
        a=min(a,abs(s1-s2));
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1e18;
int n;
ll ans=1;
ll arr[100050];
int main(){
	cin>>n;
	
	for(int i=1;i<=n;i++){
		cin>>arr[i];
		if(arr[i]==0){
			cout<<"0"<<endl;
			return 0;
		}
	}
	
	for(int i=1;i<=n;i++){
		ll t=arr[i];
		double d1,d2;
		d1=ans;
		d2=(double)inf/(double)t;
		if(d1>d2){
			cout<<"-1"<<endl;
			return 0;
		}
		ans*=t;
		if(ans>inf){
			cout<<"-1"<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
}


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

const int N=100001;
const int M=3;
int dp[N][M]; int n; int arr[N]; int brr[N]; int crr[N]; 
int INF=10000000000000000;
int k;

int go(int index, int type){
	if(index==n)
	return 0;
	
	if(dp[index][type]!=-1)
	return dp[index][type];
	
	int ans=0;
	if(type==0)
	ans=max(brr[index]+go(index+1,1),crr[index]+go(index+1,2));
	if(type==1)
	ans=max(arr[index]+go(index+1,0),crr[index]+go(index+1,2));
	if(type==2)
	ans=max(brr[index]+go(index+1,1),arr[index]+go(index+1,0));
	
	return dp[index][type]=ans;
}

#undef int
int main(){
	#define int long long int
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t=1;
	while(t--){
		cin >> n;
		for(int i=0;i<n;i++){
			cin>>arr[i]>>brr[i]>>crr[i];
		}
		memset(dp,-1,sizeof(dp));
		cout<<max(go(0,0),max(go(0,1),go(0,2)))<<endl;
	}
	return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int a[10000],cnt=0;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]!=(i+1)) cnt++;
    }
    if(cnt<=2) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

main(){
  char str[2000];
  int i, p;

  for(i=1;;i++){
    scanf("%c", &str[i]);
    if(str[i]=='\n'){
      p=i;
      break;
    }
  }
  if(p!=0){
    for(i=p-1;i>=1;i--){
      printf("%c", str[i]);
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int calc(string s){
    int res=0;
    rep(i,s.size()){
        res*=10;
        res+=s[i]-'0';
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a,b;
    cin>>a>>b;
    
    int n=calc(a+b);
    for(int i=1;i*i<=n;i++){
        if(i*i==n){
            cout1("Yes")
            return 0;
        }
    }
    
    cout1("No")
}

Measured memory_bytes: 256
//ABC162 B

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint n;


int main() {
  cin >> n;

  rep(i,n+1){
    if(i%3 != 0 && i%5 != 0){
      ans += i;
    }
  }
  
  
  printf("%lld\n",ans);
}


Measured memory_bytes: 3768
while True:
    H,W=map(int,input().split())

    if H==0 and W==0:
        break
    else:
        print("#"*W)
        for i in range(1,H-1):
            print("#",end="")
            for j in range(1,W-1):
                print(".",end="")
            print("#")
        print("#"*W)
        print()



Measured memory_bytes: 7000
open System

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

let rec gcd x y =
    if y = 0L then x
    else gcd y (x % y)

let primeFactors n =
    let limit = n |> float |> sqrt |> int64
    let rec count x p acc =
        if x % p = 0L then count (x / p) p (acc + 1L)
        else acc
    let mutable n = n
    let res =
        seq {
            for p in 2L..limit+1L do
                let c = count n p 0L
                if c <> 0L then
                    let div = (float p) ** (float c) |> int64
                    n <- n / div
                    yield (p, c)
        } |> Map.ofSeq
    if n = 1L then res
    else res.Add (n, 1L)

[<EntryPoint>]
let main _ =
    let [|A;B|] = reada int64
    let primes = gcd A B |> primeFactors
    primes.Count + 1
    |> printfn "%d"
    0


Measured memory_bytes: 15068
#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
  	string S;cin>>S;
  	int ans;ans=0;
  	int size;size=S.size();
  	char bit;bit='0';
	rep(i,size){
    	if(S[i]==bit){
        	ans=ans+1;
        }
      	if(bit=='0'){
          bit='1';
        }else{
        	bit='0';
        }
    }
  	ans=min(ans,size-ans);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 512
INF = int(1e9) + 7

n = int(input())
a = list(map(int,input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
b.reverse()
c.reverse()
j = 0
c.insert(0,INF)
c.append(0)
for i in range(n):
    while b[i] < c[j] and j <= n:
        j += 1
    b[i] = [b[i], j-1]
#print(b)
#print(c)
#print(b)
a.reverse()
cnt = 0
ans = 0
b.insert(0,[INF, 0])
b.append([0,0])
j = 0
for i in range(n):
    while a[i] < b[j][0] and j <= n:
        cnt += b[j][1]
        j += 1



    ans += cnt
print(ans)


Measured memory_bytes: 29776
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    cnt = 1
    field = K
    for i in range(N):
        if field >= N:
            break
        field += K-1
        cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> ii;

const int N = 1e5 + 5;

int a,b,cnt;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> a >> b;
  if (0 >= a && 0 <= b) {
    cout << "Zero\n";
    return 0;
  }
  if (a > 0) {
    cout << "Positive\n";
    return 0;
  }
  if (abs(a - b) % 2 == 1)
    cout << "Positive\n";
  else
    cout << "Negative\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(1, 0); }
	V<V<pin>> qab(2);
	for (pin x : ab) {
		qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2)); }
	}
	V<vel> c(2, vel(2));
	rep(i, 2) {
		for (pin x : qab[i]) {
			int qc = (2 * x.first + x.second) % 3;
			if ((qc + 1) % 2) { c[i][0] ^= 1; }
			if (qc) { c[i][1] ^= 1; }
		}
	}
	rep(i, 2) {
		if (!c[1 - i][0] && !c[1 - i][1]) {
			pin ans = solve(qab[i], ex - 1);
			ans.first *= 2; ans.second *= 2; ans.second += i;
			return ans;
		}
	}
	for (pin& v : ab) { v.first++; }
	pin ans = solve(ab, ex); ans.first--;
	return ans;
}
signed main() {
	long long inf = 2e17;
	int n; scanf("%lld",&n);
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; scanf("%lld %lld",&a,&b);
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 70);
	cout << ret.first - inf << " " << ret.second - inf;
}

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

using namespace std;

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

int add(int a, int b)
{
        a += b;
        if (a >= MOD)
                return a - MOD;
        if (a < 0)
                return a + MOD;
        return a;
}

int mul(int a, int b)
{
        return a * (ll) b % MOD;
}

int pw(int a, int b)
{
        int r = 1;
        while (b)
        {
                if (b & 1)
                        r = mul(r, a);
                a = mul(a, a);
                b /= 2;
        }
        return r;
}

int dv(int a, int b)
{
        return mul(a, pw(b, MOD - 2));
}

const int N = (int) 1e5 + 7;
int n, x[N];

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

int solve()
{
        int ans = 0, sum = 0;
        for (int i = 1; i < n; i++)
        {
                sum = add(sum, dv(1, i));
                ans = add(ans, mul(x[i + 1] - x[i], sum));
        }
        for (int i = 1; i < n; i++)
                ans = mul(ans, i);
        return ans;
}

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

        read();
        cout << solve() << "\n";
}


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

bool IsPrime(long long n){
  if(n == 1) return false;
  for(long long i = 2; i * i < n; i++){
    if(n%i == 0) return false;
  }
  return true;
}

vector<long long> EnumDivisors(long long n){
  vector<long long> res;

  for(long long i = 1; i * i <= n; i++){
    if(n % i == 0){
      res.push_back(i);
      if(n/i != i) res.push_back(n/i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}

vector<pair<long long, long long>> PrimeFactorize(long long n){
  vector<pair<long long, long long>> res;

  long long a = 0;

  for(long long i = 2; i * i <= n; i++){
    a = 0;
    if(n%i == 0){
      if(IsPrime(i)){
        while(n % i == 0){
          n /= i;
          a++;
        }
        res.push_back(make_pair(i, a));
      }
    }
  }

  if(n!= 1) res.push_back(make_pair(n, 1));

  return res;

}

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

  vector<pair<long long, long long>> ans;
  ans = PrimeFactorize(n);
  long long num = 0;

  bool flag = 1;
  long long now = 1;

  while(flag == 1){
    flag = 0;
    for(int i = 0; i < ans.size(); i++){
      if(ans[i].second >= now){
        num ++;
        ans[i].second -= now;
        flag = 1;
      }
    }
    now += 1;
  }
  
  cout << num << endl;

  return 0;
}

Measured memory_bytes: 3632
N, M = map(int, input().split())
M_dict = {i:0 for i in range(1, M+1)}
for _ in range(N):
    K, *A_list = map(int, input().split())
    for k in range(K):
        M_dict[A_list[k]] += 1

ans = 0
for j in range(1, M+1):
    if M_dict[j] == N:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int  MOD=1e9+7;
const int  INF=2000000000;
const int INF2=  10000000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INF2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}

int EintN(int array[],const int num){
    for(int i=0;i<num;i++){printf("%d ",array[i]);}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {printf("%d ",array[i][k]);}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const int num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}


int test(){
    return 0;
}

int Ap(){
    int ans;ans=0;
    
    return 0;
}

int Bp(){
    int ans;ans=0;
    
    return 0;
}

ll gcd(ll a,ll b){//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
    if(b==0){
        return a;
    }else{
        return gcd(b,a%b);
    }
}

int Cp(){
    ll ans;ans=0;
    ll A,B,C,D;
    cin>>B>>A>>C>>D;
    ll E=B-1;
    ans=A -A/C -A/D +A/(C*D/gcd(C, D))-(E-E/C -E/D +E/(C*D/gcd(C,D)));
    
    OutputAndReturn0(ans);
    return 0;
}

int Dp(){
    int ans;ans=0;
    
    return 0;
}

signed main(){
    //test();
    //Ap();
    //Bp();
    Cp();
    //Dp();
    return 0;
}


Measured memory_bytes: 888
// https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_d

#include "algorithm"
#include "functional"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

// i -> i-1 に戻る辺と、 l -> r
// に進む辺のみ考慮すれば十分。その場合のダイクストラ
void solve() {
  ll N, M;
  cin >> N >> M;

  V<V<PL>> edges(N);
  rep(i, N - 1) edges[i + 1].emplace_back(i, 0);

  rep(i, M) {
    ll l, r, c;
    cin >> l >> r >> c;
    l--, r--;
    edges[l].emplace_back(r, c);
  }

  VL dist(N, INF);
  dist[0] = 0;

  ll next_edge_i = M - 1;

  priority_queue<PL, VPL, greater<PL>> q;
  q.push({0, 0});

  while (!q.empty()) {
    auto p = q.top();
    q.pop();

    ll cost = p.first;
    ll u = p.second;

    if (cost > dist[u]) continue;

    for (auto vp : edges[u]) {
      ll v = vp.first;
      ll edge_cost = vp.second;

      ll n_cost = cost + edge_cost;
      if (chmin(dist[v], n_cost)) {
        q.push({n_cost, v});
      }
    }
  }

  ll res = dist[N - 1] == INF ? -1 : dist[N - 1];
  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 10112
#include <stdio.h>

int sum,point;

void rec(int ,int, int ans[]);
int ruijou(int );


int ruijou(int a){
  int i, sum=1;

  for(i=0;i<a;i++){
    sum*=2;
  }
  return sum;
}


void rec(int p, int n, int ans[]){
  
  if( ruijou(p) > n ){
    return;
  }
  if(point==1) return ;
  

  ans[p]=1;
  sum+= ruijou(p);
  if(sum>n){
    ans[p]=0;
    sum-=ruijou(p);
    return;
  }
  rec(p+1,n,ans);
  if(sum == n){
    point=1;
    return;
  }
  ans[p]=0;
  sum-=ruijou(p);
  rec(p+1,n,ans);
}


main(){
  int n;
  int i,max;
  int ans[10];

  while(1){
    sum=0;
    point=0;
    if(scanf("%d", &n)==EOF) break;

    for(i=0;i<10;i++){
      ans[i]=0;
    }

    rec(0,n,ans);

    max=-1;
    for(i=0;i<10;i++){
      if(ans[i]==1){
	if(max<i){
	  max=i;
	}
      }
    }

    for(i=0;i<10;i++){
      if(ans[i]==1 && i!=max){
	printf("%d ", ruijou(i));
      }
      else if(ans[i]==1 && max==i){
	printf("%d\n", ruijou(i));
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
			using namespace std;
			#define ll long long
			#define INF 100000000LL
			#define mod 1000000007
			#define pll pair<long,long>
			#define se second
			#define fi first
			#define pb push_back
			#include <ext/pb_ds/assoc_container.hpp>
			#include <ext/pb_ds/tree_policy.hpp>
			using namespace __gnu_pbds;

			typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
			typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update>pllordered_set;
			
			
			int main()
			{
				ll n,l;
				cin>>n>>l;
				vector<ll> v(n+1);
				for(ll i=1;i<=n;i++)
					cin>>v[i];
				
				for(ll i=1;i<n;i++)
				{
					if(v[i]+v[i+1]>=l)
					{
						cout<<"Possible\n";
						for(ll j=n-1;j>i;j--)
						{
							cout<<j<<endl;
						}
						for(ll j=1;j<i;j++)
						{
							cout<<j<<endl;
							
						}
						cout<<i;
						exit(0);
					}
				}
				cout<<"Impossible";
			}
						
			


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>
#define pll pair<LL,LL>

using namespace std;

int main(){

    string s;
    cin>>s;
    int c=1001,f=-1;
    REP(i,s.size())if(s[i]=='C'){
            c=i;break;
        }
    for(int i=s.size()-1;i>=0;i--)if(s[i]=='F'){
            f=i;break;
        }
    if(f>c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


}

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

using namespace std;

int main()
{
	string s, t;
	cin >> s >> t;
	bool ok = true;
	map<char, char> st, tt;
	int size = s.size();
	for (int i = 0; i < size; i++)
	{
		if (0 < st.count(s[i]) && st[s[i]] != t[i])
			ok = false;
		if (0 < tt.count(t[i]) && tt[t[i]] != s[i])
			ok = false;
		st[s[i]] = t[i];
		tt[t[i]] = s[i];
	}
	cout << (ok ? "Yes" : "No") << endl;

	return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <fstream>

using namespace std;

int main(){
	int n, a, b;
	cin>>n>>a>>b;
	cout<<min(a*n,b)<<endl;
	return 0;
}

Measured memory_bytes: 256