akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

A, B, C, K = map(int, input().split())

n1 = min(A, K)
ans = n1
K -= n1

n2 = min(B, K)
K -= n2

n3 = min(C, K)
ans -= n3

print(ans)





Measured memory_bytes: 10816
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    double p[3100];
    rep(i, n) cin >> p[i];

    double dp[3100][3100];
    dp[0][0] = 1;

    rep(i, n) {
        for (ll j = 0; j <= i; j++) {
            dp[i+1][j+1] += dp[i][j] * p[i];
            dp[i+1][j] += dp[i][j] * (1 - p[i]);
        }
    }

    double ans = 0;
    for (ll j = n; j >= (n+1)/2; j--) ans += dp[n][j];
    cout.precision(20);
    cout << ans << endl;
}

Measured memory_bytes: 74112
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int A;
  int B;
  int C;
  int i;

  
  cin >> A;
  cin >> B;
  
  if(A<B){
    for(i=0;i<B;i++){
      C=C*10+A;
    }
  }
  else{
    for(i=0;i<A;i++){
      C=C*10+B;
    }
  }
  std::string s = std::to_string(C);
  cout << s;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
    char W[10], T[100];
    int count = 0, i;
    scanf("%s", W);
    while (scanf("%s", T) != EOF && strcmp(T, "END_OF_TEXT")) {
        for (i = 0; T[i]; i++) {
            T[i] = tolower(T[i]);
        }
        if (!strcmp(W, T)) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

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

int main() {
  int n,k;
  cin>>n>>k;
  string s;
  cin>>s;
  
  int start = 0;
  int back = 0;
  for (int i=0; i<n-1; i++) {
    if (s.at(i) == s.at(i+1))
      start++;
  }
  
  back = n - 1 - start;
  
  if (2*k + start < n)
    cout<< 2*k + start <<endl;
  else
    cout<< n-1 <<endl;
}

Measured memory_bytes: 512
n, m = map(int, input().split())

Left = -1
Right = n + 1
for i in range(m):
    l, r = map(int, input().split())
    Left = max(Left, l)
    Right = min(Right, r)
if Left <= Right:
    ans = Right - Left + 1
else:
    ans = 0
print(ans)

Measured memory_bytes: 45272
#include <stdio.h>
#include <stdlib.h>

int main()
{

    int c=0,n,r;
    scanf("%d",&n);
    for(;n>0;n/=10)
    {
        r=n%10;
        if(r==1)
            c++;
    }
printf("%d",c);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>

bool solve(int i, int m, int n, int* A){
    if(m == 0){
        return true;
    }
    if(i >= n || m < 0){
        return false;
    }
    bool ans = solve(i + 1, m, n, A) || solve(i + 1, m - A[i], n, A);
    return ans;
}

int main(){
    int n, q;
    std::cin >> n;
    int* A = new int[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }
    std::cin >> q;
    int* B = new int[q];
    for(int i = 0; i < q; i++){
        scanf("%d", &B[i]);
    }
    for(int i = 0; i < q; i++){
        if(solve(0, B[i], n, A)){
            printf("yes\n");
        }else{
            printf("no\n");
        }
    }

    return 0;
}


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


namespace Sample
{
  class Sample
  {
    static void Main()
    {
      var p = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
      var q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
      int count =0;
      int hoge = 0;
      for(int i =0;i<p[0];i++){
      		count = 0;
        var r = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        
        for(int t=0;t<p[1];t++){
              
           count += r[t]*q[t] ;
         

        
        }
      
         if(count + p[2] > 0){
          hoge++;
          }
        
      }
      Console.Write(hoge);
      
      
		}
	}
}



Measured memory_bytes: 11092
// 2013/11/05 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

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

	for(int i=0; i<Q; i++){
		int c, a, n;
		cin >> c >> a >> n;

		int t = 0;

		int can = min(min(c, a), n);
		t += can;
		c -= can;
		a -= can;

		int cca = min(c/2, a);
		t += cca;
		c -= cca*2;

		int ccc = c/3;
		t += ccc;

		cout << t << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

int main()
{
  int N, X;
  std::cin >> N >> X;
  std::vector<int> L(N);
  for(int i=0; i<N; i++) {
    std::cin >> L[i];
  }

  int d = 0;
  int n_bounds = 1; // 0
  for(int i=0; i<N; i++) {
    d += L[i];
    if(d <= X) {
      n_bounds++;
    }
  }

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



Measured memory_bytes: 3624
#include<iostream>
#include<cstring>
//#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<set>
#define  si(a)       scanf("%d",&a)
#define  sl(a)       scanf("%lld",&a)
#define  sii(a,b)    scanf("%d%d",&a,&b)
#define  sll(a,b)    scanf("%lld%lld",&a,&b)
#define  queues      priority_queue
#define mod 1000000007
#define mem(a)  memset(a,0,sizeof(a));
#define def(a) ((a)&(-a))
#define fi  first
#define se  second
#define mp  make_pair
#define  pb push_back
typedef long long ll;
//priority_queue<int,vector<int >,greater<int > >q;
const ll INF=0x3f3f3f3f;
const double E=exp(1);
const double PI=acos(-1);
using namespace std;
ll kc(ll a,ll b)
{
    ll c=1;
    while(b)
    {
        if(b&1)c*=a;
        a*=a;
        b>>=1;
    }return c;
}
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
int s[200003];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
  int a,b;
  cin>>a>>b;
  int sum=0;
  if(a>b)
  {
      sum=a+max(b,a-1);
  }
  else sum+=b+max(a,b-1);
  cout<<sum<<endl;
}
/******************************************
**        **             ********       **
**       ** **           **             **
**      **   **          **             **
**     **     **         **             **
**    ***********        **             **
**   **         **       ********       **
******************************************/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define pii pair <int, int>
#define mp make_pair
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n'; return 0;

string s;
int ans;

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> s;
	ans = 0;
	char pre = s[0];
	cerr << pre << '\n';
	rep(i, 1, (int)s.length(), 1) {
		if (s[i] == pre) {
			++ans;
			if (s[i] == '0') s[i] = '1';
			else s[i] = '0';
		}
		pre = s[i];
	}
	cout << ans;
}

Measured memory_bytes: 3744
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    lint N;
    cin >> N;
    pdouble X[N];
    rep(i,N) cin >> X[i].first >> X[i].second;
    int ans=0;
    pdouble itv[N];
    rep(i,N) itv[i].first=X[i].first+X[i].second-1e-5,itv[i].second=X[i].first-X[i].second+1e-5;
    sort(itv,itv+N);
    double t=-LINF;
    for(int i=0;i<N;i++){
        if(t<itv[i].second){
            ans++;
            t=itv[i].first;
        }
    }
    cout << ans << endl;
}

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

int arr[100005 << 2], value[100005], n, q;

void updata(int a, int b, int x, int k = 0, int l = 0, int r = (1 << 17)){
	if (b <= l || r <= a)return;
	if (a <= l && r <= b){
		arr[k] = max(arr[k], x);
		return;
	}
	int m = (l + r) / 2;
	updata(a, b, x, k * 2 + 1, l, m);
	updata(a, b, x, k * 2 + 2, m, r);
}

int query(int x){
	x += (1 << 17) - 1;
	int res = arr[x];
	while (x){
		x = (x - 1) / 2;
		res = max(res, arr[x]);
	}
	return res;
}

int main()
{
	value[0] = 2147483647;
	scanf("%d%d", &n, &q);
	for (int i = 1; i <= q; ++i){
		int ch, a, b;
		scanf("%d", &ch);
		if (ch){
			scanf("%d", &a);
			printf("%d\n", value[query(a)]);
		}else{
			scanf("%d%d%d", &a, &b, &value[i]);
			++b;
			updata(a, b, i);
		}
	}
	return 0;
}


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

const int INF = 1001001001;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    sort(h.begin(), h.end());
    int ans = INF;
    rep(i, n - k + 1) {
        ans = min(ans, h[i + k - 1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
from collections import deque
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M = map(int, readline().split())
graph = [[] for _ in range(N + 1)]

for i in readlines():
    x, y, z = map(int, i.split())
    graph[x].append(y)
    graph[y].append(x)

cnt = 0
checked = set([])

for i in graph:
    if i:
        if i[0] not in checked:
            queue = deque([i[0]])
            while queue:
                v = queue.popleft()
                for j in graph[v]:
                    if j not in checked:
                        queue.append(j)
                        checked.add(j)
            cnt += 1


print(N - len(checked) + cnt)

Measured memory_bytes: 29528
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

using ll = long long;
const int maxn = 100 + 5;
int N;
ll X[maxn], Y[maxn], h[maxn];
ll check;
ll ans_x, ans_y, ans_h;

void solve()
{
	ll H;
	for(ll x = 0; x <=100; x++)
		for(ll y = 0; y <= 100; y++)
		{
			H = h[check] + abs(x-X[check]) + abs(y-Y[check]);
			bool ok = 1;
			for(int i = 0; i < N; i++)
			{
				if(h[i])
				{
					ll tmp = h[i] + abs(x-X[i]) + abs(y-Y[i]);
					if(tmp != H) { ok = 0; break; }
				}
				else
				{
					if(H > h[i] + abs(x-X[i]) + abs(y-Y[i])) 
					{ 	
						ok = 0; 
						break; 
					}
				}
			}
			if(ok) { ans_x = x; ans_y = y; ans_h = H; return; }
		}
}

int main()
{
	cin >> N;
	for(int i = 0; i < N; i++)
	 { 
	 	cin >> X[i] >> Y[i] >> h[i]; 
	 	if(h[i]) check = i;
	 }
	solve();
	printf("%lld %lld %lld\n", ans_x, ans_y, ans_h);
}

Measured memory_bytes: 256
n,k,q =  list(map(int, input().split()))
a = [int(input()) for i in range(q)]
import numpy as np
p = np.ones(n) * (k-q)

for i in range(q):
    p[a[i]-1] += 1

for i in range(len(p)):
    if p[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 17904
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, T;
        cin >> N >> T;
        vll t(N);
        rep(i, 0, N) cin >> t[i];

        if (N == 1) {
                cout << T << endl;
                return 0;
        }

        ll sm = T * N;

        vll diff(N - 1);
        rep(i, 0, N-1) {
                diff[i] = t[i+1] - t[i];
        }
        
        ll tmp = 0;
        rep(i, 0, N-1) {
                if (diff[i] < T) {
                        tmp += T - diff[i];
                }
        }
        cout << sm - tmp << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int d=80*160+100;
const int d2=2*d;
int main(){
    int h,w;cin>>h>>w;
    vector<vector<ll>> g(h,vector<ll>(w));
    rep(i,h){
        rep(j,w){
            ll x;cin>>x;
            g[i][j]=x;
        }
    }
    rep(i,h){
        rep(j,w){
            ll x;cin>>x;
            g[i][j]=abs(x-g[i][j]);
        }
    }
    vector<vector<bitset<d2>>> dp(h,vector<bitset<d2>>(w));
    dp[0][0][d+g[0][0]]=1;
    dp[0][0][d-g[0][0]]=1;
    rep(i,h){
        rep(j,w){
            if(i){
                dp[i][j]|=dp[i-1][j]<<g[i][j];
                dp[i][j]|=dp[i-1][j]>>g[i][j];
            }
            if(j){
                dp[i][j]|=dp[i][j-1]<<g[i][j];
                dp[i][j]|=dp[i][j-1]>>g[i][j];
            }
        }
    }
    int ans=d2;
    rep(i,d2){
        if(dp[h-1][w-1][i]){
            chmin(ans,abs(i-d));
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 20992
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int G[100][100];
int n,m;

void dfs(int p, vector<bool>& used) {
	used[p]=true;
	REP(i,n) if(G[p][i]&&!used[i]) dfs(i,used);
	return;
}

bool isConnected() {
	vector<bool> used(n,false);
	dfs(0,used);
	bool ret=true;
	REP(i,n) ret=ret&used[i];
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(1) {
		REP(i,100) REP(j,100) G[i][j]=0;
		cin>>n>>m;
		if(n==0&&m==0) break;
		vector<pair<int,P>> e(m);
		REP(i,m) {
			int a,b,w;
			cin>>a>>b>>w;
			a--; b--;
			e[i]=make_pair(w,P(a,b));
		}
		sort(ALL(e));
		int ans=INF;
		int r=-1;
		REP(i,m) {
			while(!isConnected()&&r<m-1) {
				r++;
				G[e[r].second.first][e[r].second.second]++;
				G[e[r].second.second][e[r].second.first]++;
			}
			if(isConnected()) ans=min(ans,e[r].first-e[i].first);
			G[e[i].second.first][e[i].second.second]--;
			G[e[i].second.second][e[i].second.first]--;
		}
		if(ans!=INF) cout<<ans<<endl;
		else cout<<-1<<endl;
	}
}



Measured memory_bytes: 3240
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vecll>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}


main(){
    int n=in();
    int p=in();
    string s;cin>>s;
    ll ans=0;
    if(p==2){
        rep(i,n){
            if((s[i]-'0')%2 == 0){
                ans+=i+1;
            }
        }
    }
    else if(p==5){
        rep(i,n){
            if(s[i]=='0'||s[i]=='5'){
                ans+=i+1;
            }
        }
    }
    else{
        map<int,ll> mp;
        int tmp=0;
        mp[tmp]++;
        ll k=1;
        rep3(i,n-1,0){
            tmp=(tmp+(s[i]-'0')*k)%p;
            ans+=mp[tmp];
            mp[tmp]++;
            k=k*10%p;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1028
#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 pu push_back
//#define po pop_back
#define pi (acos(-1))
#define fast ios::sync_with_stdio(false); cin.tie(0)
//#define pii pair<int,int>
//#define pll pair<ll,ll>
//#define vec vector
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int, int> P;
const int INF = 1001001001;

// Gcd & Lcm
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(void) {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  int ans = 0;
  sort(p.begin(), p.end());
  for (int i=0; i<k; i++) {
    ans += p[i];
  }
  cout << ans << endl;
  return 0;
}







  








  



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
int n,a[maxn],b[maxn];
vector<int> G[maxn];
int dfs(int u,int fa) {
    int ret=0,empty=G[u].size()-1;
    if (fa==-1)
        ++empty;
    for (int i=0;i<(int)G[u].size();++i) {
        int v=G[u][i];
        if (v==fa)
            continue;
        int tmp=dfs(v,u);
        if (tmp!=0)
            ret+=tmp,--empty;
    }
    ret+=max(0,empty-1);
    return ret;
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n-1;++i) {
        scanf("%d%d",&a[i],&b[i]);
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    bool flag=false;
    for (int i=0;i<n;++i)
        if (G[i].size()>2)
            flag=true;
    if (!flag)
        return 0*printf("1");
    for (int i=0;i<n;++i)
        if (G[i].size()>2)
            return 0*printf("%d",dfs(i,-1));
    return 0;
}


Measured memory_bytes: 9856
N = int(input())

ans=0

for i in range(1,N+1):
    howyaku=0
    if i%2==0:
        continue
    for k in range(1,int(i**0.5)+1):
        if i%k==0:
            howyaku+=1
            if k != i//k:
                howyaku+=1
    if howyaku==8:
        ans+=1

print(ans)


Measured memory_bytes: 3060
from collections import defaultdict

s=input()
t=input()

n=len(s)

ss=defaultdict(list)
tt=defaultdict(list)

for i in range(n):
  ss[s[i]].append(i)
  tt[t[i]].append(i)

  
sss=[]
ttt=[]
for k,v in ss.items():
  sss.append(v)
for k,v in tt.items():
  ttt.append(v)

sss.sort()
ttt.sort()


ans="No"
if sss==ttt:
  ans="Yes"
print(ans)





Measured memory_bytes: 14640
#include<iostream>

using namespace std;

int main(){
    int n, mx=0, sm=0;
    cin >> n;
    for(int i=0;i<n;i++){
        int p;
        cin >> p;
        sm+=p;
        mx = max(mx, p);
    }
    sm -= mx;
    cout << sm + mx/2 << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class A11{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    int[,] array = new int[n,n];
    int i;
    for(i = 0;i < n;i++){
      int[] str = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
      for(int j = 0;j < str[1];j++){
        int v = str[j + 2];
        int id = v - 1;
        array[i,id] = 1;
      }
    }

    int count = 0;

    for(i = 0;i < n;i++){
      for(int j = 0;j < n;j++){
        if(count != n - 1)
        Console.Write(array[i,j] + " ");
        else Console.Write(array[i,j]);
        count++;
      }
      Console.WriteLine();
      count = 0;
    }
  }
}



Measured memory_bytes: 17944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int n;
vl a;
map<ll, int> r;

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	cin >> n;
	a.resize(n);
	rep(i,0,n) {
		cin >> a[i];
	}

	sort(a.rbegin(), a.rend());

	rep(i,0,n) {
		if(r.find(a[i]) != r.end()) {
			r[a[i]]++;
		} else {
			r[a[i]] = 1;
		}
	}

	int ret = 0;

	rep(i,0,n) {
		if(r[a[i]] == 0) continue;
		//cout << i << ", " << a[i] << endl;
		ll x = 2;
		while(x <= 2 * a[i]) {
			if (x <= a[i]) {
				x = 2 * x;
				continue;
			}
			ll y = x - a[i];
			if(r.find(y) == r.end()) break;
			if(a[i] == y) {
				if(r[y] >= 2) {
					ret++;
					r[y] -= 2;
				}
			} else {
				if(r[y] > 0 && r[a[i]] > 0) {
					ret++;
					r[y] -= 1;
					r[a[i]] -= 1;
				}
			}
			break;
		}
	}

	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 16384
/*
  A - Remaining Time
  <http://abc057.contest.atcoder.jp/tasks/abc057_a>
*/

#include <stdio.h>

int main(int argc, char const *argv[]) {

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

  if( A+B < 24 ){
    printf("%d", A+B);
  }else{
    printf("%d", (A+B)%24);
  }
  
  return 0;
}


Measured memory_bytes: 128
//Forever... Check size - Reading order - Use scanf - Clear structures
#pragma GCC optimize ("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define pb push_back
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define REP(i,a,b) for(int i = int(a); i < int(b); ++ i)
typedef long long ll;
typedef pair<int, int> ii;

const int N = 1e5 + 2;

vector<int> par, impar;
map<int, int> mapa[2];
int a[N];

int main(){
	fastio;
	int n; cin >> n;
	for(int i = 0; i < n; ++ i) {
		cin >> a[i];
		mapa[i % 2][a[i]] ++;
	}
	mapa[0][0] = 0; mapa[1][-1] = 0;
	
	REP(i,0,2){
		int high = -1, key = -1;
		for(auto x: mapa[0]){
			if(x.ss > high){
				high = x.ss;
				key = x.ff;
			}
		}
		par.pb(key);
		mapa[0].erase(key);
	}

	REP(i,0,2){
		int high = -1, key = -2;
		for(auto x: mapa[1]){
			if(x.ss > high){
				high = x.ss;
				key = x.ff;
			}
		}
		impar.pb(key);
		mapa[1].erase(key);
	}
	
	int ans = 1e9;
	for(int x: par){
		for(int y: impar){
			if(x == y) continue;
			int ret = 0;
			for(int i = 0; i < n; i += 2){
				if(a[i] != x) ret ++;
			}
			for(int i = 1; i < n; i += 2){
				if(a[i] != y) ret ++;
			}
			ans = min(ans, ret);
		}
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 8560
def solve(inputstr):
  return inputstr

def rec_cost(x,acc,plist,clist):
  if x == 1:
    return acc
  else:
    minimum = -1
    for next in plist:
      nextplist = plist.copy()
      nextplist.remove(next)
      candidate = rec_cost(next,acc+clist[x][next],nextplist,clist)
      if minimum == -1:
        minimum = candidate
      elif candidate < minimum:
        minimum = candidate
    return minimum
      

def cost(n,clist):
 # print("invoked")
  plist = [0,1,2,3,4,5,6,7,8,9]
  plist.remove(n)
  return rec_cost(n,0,plist,clist)

def joisino(a,clist):
  note = [-1,0,-1,-1,-1,-1,-1,-1,-1,-1]
  answer = 0
  for raw in a:
    for number in raw:
      if number != -1:
        if note[number] == -1:
          note[number] = cost(number,clist)
        answer += note[number]
      
  return answer

def i_o():
  h, w = map(int,input().split(" "))
  i = 0 
  clist = []
  while i < 10:
    raw = list(map(int,input().split(" ")))
    clist.append(raw)
    i += 1
  a = []
  i = 1
  while i <= h:
    raw = list(map(int,input().split(" ")))
    a.append(raw)
    i += 1
  return h,w,clist,a

def fact(n):
  if n == 1:
    return 1
  else:
    return n * fact(n-1)
  
  
 
if __name__ == '__main__':
  h,w,clist,a = i_o()
  ans =joisino(a,clist)
  
  print(ans, flush=True)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,count=0,take;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>take;
    if(take%2!=0 && (i+1)%2!=0)
    {
      count++;
    }
  }
  cout<<count<<"\n";
}
  

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    string s,t;
    cin>>s>>t;
    ll n=s.length(),m=t.length();
    ll ans=1e15;
    for (int i=0;i<=n-m;i++)
    {
        ll cnt=0;
        for (int j=0;j<m;j++)
        {
            if (s[i+j]!=t[j])
            {
                cnt++;
            }
        }
        ans=min(ans,cnt);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3660
import java.util.Scanner;

public class Main
 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		for(int i = 0; i < count; i++){
			Circle a = new Circle(sc.nextDouble(),
					sc.nextDouble(), sc.nextDouble());
			Circle b = new Circle(sc.nextDouble(),
					sc.nextDouble(), sc.nextDouble());
			System.out.println(a.isInclude(b));
		}
		sc.close();
	}
	
	public static class Circle{
		private Point p;
		private double r;
		
		public Circle(double x, double y, double r){
			this(new Point(x,y), r);
		}
		public Circle(Point p, double r){
			this.p = p;
			this.r = r;
		}
		
		public Point getCenter(){return p;}
		public double getRadius(){return r;}
		
		public int isInclude(Circle c){
			double dist = this.p.distance(c.getCenter());
			if (this.r > dist + c.getRadius() ){
				return 2;
			}else if(c.getRadius() > dist + this.r){
				return -2;
			}else if(this.r + c.getRadius() >= dist){
				return 1;
			}else if(this.r + c.getRadius() < dist){
				return 0;
			}
			return -3;
		}
	}
	
	public static class Point{
		private double x,y;
		
		public Point(double x, double y){
			this.x = x;
			this.y = y;
		}
		public double getX(){return x;}
		public double getY(){return y;}
		
		public double distance(Point t){
			return Math.sqrt(
					Math.pow((this.x - t.getX()), 2)
					+Math.pow((this.y - t.getY()), 2));
		}
		
		public static double distance(Point a, Point b){
			return a.distance(b);
		}
	}
}

Measured memory_bytes: 20588
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

bool solve(const auto& balls) {
    const int n = balls.size();
    stack<int> l, r;
    
    function<bool(int)> rec = [&](int i) {
        if (i == n) return true;

        bool pro = false;
        if (l.empty() || l.top() < balls[i]) { // left push
            l.push(balls[i]);
            pro = pro || rec(i + 1);
            l.pop();
        } 

        if (r.empty() || r.top() < balls[i]) { // right push
            r.push(balls[i]);
            pro = pro || rec(i + 1);
            r.pop();
        }

        return pro;
    };

    return rec(0);
}

int main() {
    constexpr int BALLS = 10;
    int n; cin >> n;
    REP(i, n) {
        vector<int> b(BALLS);
        REP(j, BALLS) cin >> b[j];

        if (solve(b)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3068
#include<stdio.h>
#define N 100000
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
  int k;
}Node;

Node node[N];

int depth(int);

int main(){
  int i, j, id, sub, m, n, child;
  scanf("%d", &n);
  for(i = 0;i < n;i++){
    node[i].left = node[i].parent = NIL;
  }
  for(i = 0;i < n;i++){
    scanf("%d%d", &id, &m);
    node[id].k = m;
    sub = id;
    for(j = 0;j < m;j++){
      scanf("%d", &child);
      if(j == 0){
        node[sub].left = child;
        node[node[sub].left].parent = id;
        sub = child;
      }
      else{
        node[sub].right = child;
        node[node[sub].right].parent = id;
        sub = child;
      }
    }
  }
  for(i = 0;i < n;i++){
    printf("node %d: parent = %d, depth = %d, ", i, node[i].pa\
rent, depth(i));
    if(node[i].left != NIL){
      if(node[i].parent != NIL){
        printf("internal node, [");
      }
      else{
        printf("root, [");
      }
      for(j = 0;j < node[i].k-1;j++){
        if(j == 0){
          sub = node[i].left;
          printf("%d, ", node[i].left);
        }
        else{
          printf("%d, ", node[sub].right);
          sub = node[sub].right;
        }
      }
      if(node[i].k == 1){
        printf("%d]\n", node[i].left);
      }
      else{
        printf("%d]\n", node[sub].right);
      }
    }
    else{
      if(node[i].parent == NIL){
        printf("root, []\n");
      }
      else{
        printf("leaf, []\n");
      }
    }
  }  
  return 0;
}

int depth(int id){
  int dep = 0;
  while(1){
    if(node[id].parent == NIL){
      return dep;
    }
    else{
      dep++;
      id = node[id].parent;
    }
  }
}

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for(long long i=0; i<(long long)c; i++)
int main() {
	int k,a;
	string  s,ans;
	cin >>k>>s;
	a=s.length();
	ans=s;
	if (a>k){
		ans=s.substr(0,k);
		ans+="...";
	}
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;

int main() {
    string s;
    cin >> s;
    
    int cntg = 0;
    int cntp = 0;
    int kachi = 0;
    int make = 0;
    
    REP(i,s.size()) {
        if (s[i] == 'g') {
            if (cntp < cntg) {
                cntp++;
                kachi++;
            } else {
                cntg++;
            }
        } else {
            if (cntp < cntg) {
                cntp++;
            } else {
                cntg++;
                make++;
            }
        }
    }
    
    cout << kachi - make << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  ll p; cin >> p;
  ll pp = p;
  map<ll, ll> m;
  for(ll i=2; i<sqrt(p)+4; i++){
      while(p%i==0){
          m[i]++;
          p/=i;
      }
      if(p==1)break;
  }
  if(m.size()==0){
      m[p]=1;
  }
  ll ans =1;
  auto itr=m.begin();
  while(itr!=m.end()){
      ans *= pow(itr->first, itr->second/n);
      itr++;
  }
  if(n==1)ans = pp;
  cout << ans << endl;

}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        int a;
        cin >> a;
        if (i % 2 == 1 && a % 2 == 1) {
            ++ans;
        }
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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


int main(void){
  int s,c,ans=1;
  set<int> yt;
  
  cin >> s;
  
  c=s;
  while (1){
    if (yt.find(c)!=yt.end()){
      break;
    }
    yt.insert(c);
    if (c%2==0) c/=2;
    else c=c*3+1;
    ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=[int(i) for i in input().split()]
a=[[int(i) for i in input().split()]for j in range(n)]
ans=0
for i in range(n):
    k=0
    for j in range(m):
        k += b[j]*a[i][j]
    if k>-c:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;


int main(){
    ll n,m; cin >> n >> m;
    priority_queue<ll> pq;
    rep(i,sqrt(m)+1){
        if(!i)continue;
        if(m%i == 0){
            pq.push(i);
            pq.push(m/i);
        }
    }

    bool ok = true;
    ll ans = 0;
    while(ok){
        ll temp = pq.top();pq.pop();
        if(n * temp <= m){
            ans = temp;
            ok = false;
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include "/Users/student/Documents/Sublime/stdc++.h"

typedef long long ll;

using namespace std;

string s;

int main() {
//    freopen("input.in", "r", stdin);
//    freopen("output.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s;
    
    int f = 0, l = s.length()-1, ans = 0;
    while(f < l){
        if(s[f] != s[l]){
            ans++;
        }
        f++;
        l--;
    }
    cout << ans;
}

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

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
 
	int n,k,i,j,r,a,b,sum;
  vector<int> v;
  int aaa[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin>>K;
  cout<<aaa[K-1];

  return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())

from functools import reduce

def nCr(n,r,DIV):
  f=lambda x,y:x*y%DIV
  X=reduce(f,range(n-r+1,n+1))
  Y=reduce(f,range(1,r+1))
  return X*pow(Y,DIV-2,DIV)%DIV

DIV=10**9+7

ans=pow(2,n,DIV)-1
ans-=nCr(n,a,DIV)
ans-=nCr(n,b,DIV)
print(ans%DIV)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
struct edge {
    long to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;

typedef pair<long, long> P;

const long INF = 1001001001001001001;

vector<long> dist; 
vector<long> prever;
void dijkstra(int n, int s){
    dist = vector<long>(n,INF);
    prever = vector<long>(n,-1);
    dist[s] = 0;

    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        long v = p.second;
        if(dist[v] < p.first){
            continue;
        }
        for(int i=0;i<graph[v].size();i++){
            edge e = graph[v][i];
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                prever[e.to] = v;
                que.push(P(dist[e.to],e.to));
            }
        }
    }
}

vector<long> get_path(int t){ //頂点tへの最短路
    vector<long> path;
    for(; t != -1;t=prever[t]){
        path.push_back(t);
    }

    reverse(path.begin(), path.end());
    return path;
}

int main(void){
    int n;
    cin >> n;
    graph = AdjList(n);
    for(int i=0;i<n-1;i++){
      long from, to, cost;
      cin >> from >> to >> cost ;
      from--;
      to--;
      graph[from].push_back((edge){to,cost});
      graph[to].push_back((edge){from,cost});
    }
  int q,k;
  cin>>q>>k;
  dijkstra(n,k-1);
  rep(i,q){ 
    int a,b;
    cin>>a>>b;
    cout<<dist[a-1]+dist[b-1]<<endl;
  }
}

Measured memory_bytes: 14892
import sys  
from itertools import accumulate
input = sys.stdin.readline  

N, Q = list(map(int, input().split()))
S = input()

l = [None]*Q
r = [None]*Q
for i in range(Q):
    l[i], r[i] = list(map(int, input().split()))

s = list(S)
ac = [0] * N

for i in range(N-1):
    if s[i] == 'A':
        if s[i+1] == 'C':
            s[i] = "AC"
            ac[i] += 1

ans = list(accumulate(ac))
ans = [0] + ans


for i in range(Q):
    print(ans[r[i]-1]- ans[l[i]-1])

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

int main(){
    ll n;
    cin >> n;
    int tot = 0;
    ll tmp = n;
    vector<pair<ll,ll>> vp;
    for(int i=2;i<(ll)sqrt(n)+1;i++){
        if(tmp % i == 0){
            int cnt = 0;
            while(tmp%i==0){
                tmp /= i;
                cnt++;
            }
            vp.push_back({i,cnt});
        }
    }
    if(tmp > 1){
        vp.push_back({tmp,1});
    }
    tot = 0;
    for(auto p : vp){
        int x = p.second;
        int y = 1;
        while(x >= y){
            tot++;
            x -= y;
            y++;
        }
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 3728
c = 1000000007
f = 0
s = input()
for i in range(len(s)):
    if s[i] == 'C':
        c = min(c,i)
    if s[i] == 'F':
        f = max(f,i)
if c<f:
    print("Yes")
else:
    print("No")

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

int main() {
  vector<char> a;
  string s;
  cin >> s;
  for ( char c:s ) {
    if ( c=='B' ) { if ( a.size() ) a.pop_back() ; }
    else a.push_back(c);
  }
  for ( char c:a ) {
    cout << c;
  }
  return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;string s;cin>>n>>s;
  int ans=0;
  rep(i,1000){
    string t;
    int x=i;
    rep(j,3){
      t+='0'+x%10;
      x/=10;
    }
    int a=0;
    rep(j,n){
      if(s[j]==t[a]){
        a++;
        if(a==3)break;
      }
    }
    if(a==3)ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3684
N = int(input())
A = [int(n) for n in input().split()]

def gcd(a,b):
    while b>0:
        a, b = b, a%b 
    return a

temp_gcd = gcd(A[0],A[1])
for i in range(2,N):
     temp_gcd = gcd(A[i],temp_gcd)
print(temp_gcd)

Measured memory_bytes: 14224
n,k = map(int,input().split())
d = []
A = []
sunuke = [0 for _ in range(n)]
for i in range(k):
	d.append(int(input()))
	a = list(map(int,input().split()))
	for j in range(len(a)):
		sunuke[a[j]-1] += 1

count = 0
for i in sunuke:
	if i == 0:
		count += 1 

print(count)

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

#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int main(){
  char s[6];
  rep(i,6){
    cin>>s[i];
  }
  if(s[0]==s[5] && s[1]==s[4] && s[2]==s[3]){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}


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

int main() {
    int A, B, C; cin >> A >> B >> C;
    if ((A == B && A != C) || (A == C && A != B) || (B == C && A != B)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<string>
#define M 1000000007ULL
using namespace std;

typedef unsigned long long ull;
set<ull> ans;
ull hash[300100];

int main(){
  int n,m;
  string str,q;
  int l=0,r=1;
  ull c[300100],val;

  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  cin >> str;

  hash[0] = 0;
  c[0] = 1;
  for(int i=1;i<=n;i++){
    c[i] = c[i-1] * M;
    hash[i] = hash[i-1] * M + str[i-1];
  }

  while(m--){
    cin >> q;
    if(q[0] == 'R'){
      if(q[1] == '+')r++;
      else r--;
    }else{
      if(q[1] == '+')l++;
      else l--;
    }
    val = hash[r] - hash[l] * c[r-l];
    ans.insert(val);
  }
  cout << ans.size() << endl;
}

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

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

    int nums[3];
    for (int i = 0; i < 3; i++) {
        cin >> nums[i];
    }
    map<int, int> counter;
    for (auto &c : nums) {
        counter[c]++;
    }
    int result = 0;
    for (auto &p : counter) {
        if (p.second >= 1) {
            result++;
        }
    }
    cout << result;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var AB = Sarray();
            var A = AB[0];
            var B = AB[1];
            var gcd = Gcd(A, B);
            var ans = primefactorize(gcd);
            WriteLine(ans.Distinct().Count() + 1);
            //Out.Flush();
        }
        static long Gcd(long x, long y) => y == 0 ? x : Gcd(y, x % y);
        static List<long> primefactorize(long n)
        {
            var primes = new List<long>();
            for (long i = 2; i * i <= n; ++i)
            {
                if (n % i == 0)
                {
                    while (n % i == 0)
                    {
                        primes.Add(i);
                        n /= i;
                    }
                }
            }
            if (n != 1) primes.Add(n);
            return primes;
        }
    }
}

Measured memory_bytes: 13396
// Vicfred
// https://atcoder.jp/contests/dp/tasks/dp_c
// dynamic programming
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.stdio;
import std.string;

void main() {
    const long n = readln.chomp.to!long;
    long[] a = new long[n+1];
    long[] b = new long[n+1];
    long[] c = new long[n+1];

    foreach(i; 1..n+1) {
        readf("%s %s %s\n", &a[i], &b[i], &c[i]);
    }

    long[][] dp = new long[][](n+1, 4);

    dp[1][1] = max(a[1], b[1], c[1]);
    dp[1][2] = max(a[1], b[1], c[1]);
    dp[1][3] = max(a[1], b[1], c[1]);

    for(int i = 2; i <= n; ++i) {
        for(int j = 1; j <= 3; ++j) {
            if(j == 1)
                dp[i][1] = max(
                        dp[i-1][2] + b[i],
                        dp[i-1][3] + c[i]);
            if(j == 2)
                dp[i][2] = max(
                        dp[i-1][1] + a[i],
                        dp[i-1][3] + c[i]);
            if(j == 3)
                dp[i][3] = max(
                        dp[i-1][1] + a[i],
                        dp[i-1][2] + b[i]);
        }
    }

    long ans = max(dp[n][1], dp[n][2], dp[n][3]);
    ans.writeln;
}


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

using namespace std;

long long ans, n;

bool check(long long v)
{
    vector<bool> ok(10);
    while (v) {
        ok[v % 10] = 1;
        v /= 10;
    }
    return ok[7] && ok[5] && ok[3];
}

void dfs(long long v)
{
    if (v > n) return;
    if (check(v)) ++ans;
    dfs(v*10+3);
    dfs(v*10+5);
    dfs(v*10+7);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    dfs(0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256