akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

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

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

int main() {
    int n;
    cin >> n;
    string ss[] = {"AC", "WA", "TLE", "RE"};
    map<string, int> cnt;
    REP(i, n){
        string s;
        cin >> s;
        cnt[s]++;
    }
    for(auto s: ss){
        cout << s << " x " << (cnt.count(s)?cnt[s]:0) << endl;
    }
    return 0;
}

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

b = 0
a = 0
ab = 0
ex = 0

for i in range(n) :
    tmp = input()
    ab += tmp.count('AB')
    if tmp[0] == 'B' :
        b += 1
    if tmp[-1] == 'A' :
        a += 1
    if tmp[0] == 'B' and tmp[-1] == 'A' :
        ex += 1

if max(a, b) > ex or ex == 0 :
    print(ab + min(a, b))
else :
    print(ab + min(a, b) - 1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<ll,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
ll n,p,ans=1;map<ll,int> m;
int main()
{
    scanf("%lld%lld",&n,&p);
    for(ll i=2;i*i<=p;i++)
    while(p%i==0) p/=i,m[i]++;
    if(p>1) m[p]++;
    for(mit it=m.begin();it!=m.end();it++)
    {
        int cnt=it->se/n;
        while(cnt) cnt--,ans*=it->fi;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
using namespace std;
int a[103];
int b[104];
int main(){
  int n,im=0,ca=0;
  cin>>n;
  for (int i=0;i<n;i++)
  cin>>a[i];
  for (int j=0;j<n;j++)
  cin>>b[j];
  for (int p=2;p<=n;p++){
  for (int a1=0;a1<p-1;a1++)
  im=im+a[a1];
  im=im+b[p-2];
  for (int a2=p-1;a2<n;a2++)
  im=im+b[a2];
  if (im>ca) ca=im;
  im=0;
  }
  if (n==1)
  ca=a[0]+b[0];
  cout<<ca;
  system ("pause");
  return 0;
  }

Measured memory_bytes: 504
// ABC055 B - Training Camp
'use strict';

function Main(input) {
    const tmp = input.trim().split('\n');
    const N = Number(tmp[0]);
    // console.log(N);

    const M = Math.pow(10, 9) + 7;

    let result = 1;
    for (let i = 1; i <= N; i++) {
        result = ((result % M) * (i % M)) % M;
    }
    console.log(result);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

// Main(`3`);
// Main(`10`);
// Main(`100000`);


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

int main(void){
    int n,k;
    cin >> n >> k;
    int ans = 0;
    if(n%k==0){
        ans = 0;
    }
    else{
        ans = 1;
    }
    
    cout << ans <<endl;
    
    return 0;
}






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

using namespace std;
int main(void)
{
	int a[5];
	for(int i = 0;i<5;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a,a+5);
	reverse(a,a+5);
		for(int i = 0;i < 5;i++)
		{
			printf("%d",a[i]);
			if(i <= 3) printf(" ");
		}
		printf("\n");



	return 0;
}

Measured memory_bytes: 1044
using System;
using System.Collections.Generic;

namespace ABC_042
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');

            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);

            if(A == 7 || B == 7 || C == 7)
            {
                if(A==5 || B == 5 || C == 5)
                {
                    if((A+B+C) == 17)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                }
            }
            Console.WriteLine("NO");
            return;
        }
    }
}

Measured memory_bytes: 2648
//     自己选择的路，跪着也要走完。朋友们，虽然这个世界日益浮躁起来，只
// 要能够为了当时纯粹的梦想和感动坚持努力下去，不管其它人怎么样，我们也
// 能够保持自己的本色走下去。                               ——陈立杰
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

typedef signed char          int8;
typedef unsigned char       uint8;
typedef short                int16;
typedef unsigned short      uint16;
typedef int                  int32;
typedef unsigned            uint32;
typedef long long            int64;
typedef unsigned long long  uint64;

template <typename Int>
inline Int read()       
{
    Int flag = 1;
    char c = getchar();
    while ((!isdigit(c)) && c != '-' && c != EOF) c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
       return init * flag;
}

template <typename Int>
inline Int read(char &c)       
{
    Int flag = 1;
    c = getchar();
    while ((!isdigit(c)) && c != '-' && c != EOF) c = getchar();
    if (c == '-') flag = -1, c = getchar();
    Int init = c & 15;
    while (isdigit(c = getchar())) init = (init << 3) + (init << 1) + (c & 15);
       return init * flag;
}

template <typename Int>
inline void write(Int x)
{
    if (x < 0) putchar('-'), x = ~x + 1;
    if (x > 9) write(x / 10);
    putchar((x % 10) | 48);
}  

template <typename Int>
inline void write(Int x, char nextch)
{
    write(x);
    putchar(nextch);
}

#define int int64

char t[200007];
int n;
int c[2], sum[2];
int64 ans;

int64 SolveIt() {
    c[0] = c[1] = 0;
    ans = 0;
    sum[0] = sum[1] = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] & 1) {
            ans += (sum[0] + (sum[1] & 1)) >> 1;
            c[sum[1] & 1]++;
            sum[1]++;
            ans += (sum[1] + 1) >> 1;
        } else {
            ans += c[0] = c[1] = max(c[0], c[1]);
            sum[0]++;
        }
    }
    return ans;
}

signed main() {
    scanf("%s", t + 1);
    n = strlen(t + 1);
    write(SolveIt(), 10);
    return 0;
}

// Create File Date : 2020-05-30
/*
$ $ $ $ $
0111101101
0 1 1 1 0
 1 1 0 1 1

1               1
11              1
111             2
1111            2
11111           3
111111          3
1111111         4
11111101        3
111101101       4
0111101101      3

1       1
11      1
111     2
1101    1

0111101101
1111111         
01111111        3
011110111       4
0111101101      3
*/

Measured memory_bytes: 3952
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2]:
  print("Yes")
else:
  print("No")


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

using namespace std;

void printArray(int* arr, int n) {

    for(int i = 0; i < n; ++i) {

        cout << arr[i] << " ";
    }
    cout << endl;
}

int main() {

    int n, k;
    cin >> n >> k;
    int a[n], dp[k+1];
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    
    memset(dp, 0, sizeof(dp));

    for(int i = 0; i <= k; ++i) {

        for(int j : a) {

            if(j <= i) {

                if(dp[i - j] == 0) 
                    dp[i] = 1;
            }
            //printArray(dp, k+1);
        }
    }

    (dp[k]) ? cout << "First" : cout << "Second";

    return 0;
}

Measured memory_bytes: 640
import sys
import math
X, Y = map(int, input().split())
flag = False
for i in range(int(math.log2(Y / X)) + 10):
    if 2 ** i == Y // X:
        flag = True
if flag:
    print(int(math.log2(Y / X)) + 1)
else:
    print(int(-((-math.log2(Y/X))//1)))

Measured memory_bytes: 3316
#include <stdio.h>
#define N 200000

int main(void){
    int n;
    int a[N];
    int memor[N] = {}, memol[N] = {};
    int i;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    
    for(i = 1; i < n; i++){
        if(memol[i-1] > a[i-1]){
            memol[i] = memol[i-1];
        }else{
            memol[i] = a[i-1];
        }
    }
    
    for(i = n-2; i >= 0; i--){
        if(memor[i+1] > a[i+1]){
            memor[i] = memor[i+1];
        }else{
            memor[i] = a[i+1];
        }
    }
    
    for(i = 0; i < n; i++){
        printf("%d\n", (memor[i] > memol[i]) ? memor[i] : memol[i]);
    }
    
    return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}

#define pii pair<int,int>
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i);
#define int long long int
#define all(n) n.begin(),n.end()
#define mem(n,i) memset(n,i,sizeof n);
//vector<vector<int>>arr(n + 5, vector<int>(m + 5,0));

signed main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b; cin >> a >> b;
	cout << a*b;
}

Measured memory_bytes: 3652
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <iostream>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;
ll five(ll n){
    return n*n*n*n*n;
}
ll fivelist[150];
int main() {
    ll ans1,ans2;
    ll x;
    cin >> x;
    for (int i = 0; i< 150; i++){
        fivelist[i] = five(i);
    }
    for (int i = 0; i < 150; i++){
        for (int j = i; j < 150; j++){
            if (fivelist[i]+fivelist[j] == x){
                ans1 = i;
                ans2 = j*(-1);
                break;
            }
            if (fivelist[j]-fivelist[i] == x){
                ans1 = j;
                ans2 = i;
                break;
            }
        }
    }
    cout << ans1 << " " << ans2 <<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

ll N;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N;
	FOR(h,1,3501) FOR(n,1,3501) {
	    ll num = 4*h*n-N*n-N*h;
	    ll den = N*h*n;
	    ll g = abs(__gcd(num,den)); 
	    num /= g, den /= g;
	    if (num == 1) {
	        cout << h << " " << n << " " << den;
	        return 0;
	    }
	}
}

// read!
// ll vs. int!

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb puah_back

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

vector<string> lis;
int ma = 0;
int h, w;

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

struct zahyo{
    int x;
    int y;
};

void solve(int x, int y){
    vector<vector<int> > flag(h, vector<int>(w, -1));
    flag[x][y] = 0;
    queue<zahyo> q;
    q.push({x,y});
    while(!q.empty()){
        zahyo z = q.front();
        q.pop();
        REP(i, 0, 4){
            int nx = z.x + dx[i];
            int ny = z.y + dy[i];
            if((nx >= 0) && (ny >= 0) && (nx < h) && (ny < w)){
                if(lis[nx][ny] == '.' && flag[nx][ny] == -1){
                    flag[nx][ny] = flag[z.x][z.y] + 1;
                    q.push({nx, ny});
                    ma = max(ma, flag[nx][ny]);
                }
            }
        }
    }
}

int main(){
    cin >> h >> w;
    lis = vector<string>(h);
    REP(i, 0, h){cin >> lis[i];}
    REP(i, 0, h){
        REP(l, 0, w){
            if(lis[i][l] == '.'){
                solve(i, l);
            }
        }
    }
    cout << ma << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] f = new int[n][10];
		int[][] p = new int[n][11];
		for(int i = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 10 ; j++) {
				f[i][j] = sc.nextInt();
			}
		}
		for(int i = 0 ; i < n ; i++) {
			for(int j = 0 ; j < 11 ; j++) {
				p[i][j] = sc.nextInt();
			}
		}
		int ans = -Integer.MAX_VALUE;
		for(int mask = 1 ; mask < (1<<10) ; mask++) {
			int[] cnt = new int[n];
			for(int i = 0 ; i < n ; i++) {
				for(int j = 0 ; j < 10 ; j++) {
					if(f[i][j] == 1 && (mask&(1<<j)) >= 1) {
						cnt[i]++;
					}
				}
			}
			int sum = 0;
			for(int i = 0 ; i < n ; i++) {
				sum += p[i][cnt[i]];
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 28132
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
vector<int>adj[100001];
int vis[100001]={false};
void dfs(int i){
	vis[i]=true;
	for(auto p : adj[i]){
		if(!vis[p])
		 dfs(p);}}
int main(){IOS;
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);}
		int ans=0;
		for(int i=1;i<=n;i++){
			if(!vis[i])
			ans++;
			dfs(i);}
			cout<<ans-1<<endl;}

Measured memory_bytes: 9904
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;

using namespace std;


int main(void) {
	int n;
	cin >> n;
	vector<vector<double>> v(n, vector<double>(2));
	rep(i,n)
		rep(j, 2) {
		cin >> v[i][j];
	}
	double ans = 0;
	rep(i, n)
		for (int j = i + 1; j < n; j++) {
			ans += sqrt(pow(v[i][0] - v[j][0], 2) + pow(v[i][1] - v[j][1], 2));
		}
	//cout << ans << endl;
	ans = ans * 2 / n;
	printf("%8f", ans);
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<functional>
#include<string>
using namespace std;
const long long int mod = 1000000007;
const long long int big = 1152921504606846976;

int main(void) {
	int Q,h,i,j,x,l,r;
	int c;
	static int next[500010][27];
	static int goemp[500010][20];
	string S;
	for (i = 0; i < 500010; i++) {
		for (j = 0; j < 27; j++) {
			next[i][j] = 500009;
		}
	}
	//a=0,b=1...z=25
	cin >> S;//読み込むためには仕方がない
	for (i = S.size()-1; i >=0; i--) {
		c = S[i];
		c -= 0x61;
		next[i][c] = i + 1;
		for (j = c+1; j<27; j++) {
			next[i][j] =  next[next[i][j - 1]][j - 1];
		}
		for (j = 0; j < c; j++) {
			 next[i][j] = next[next[i][26]][j]; 
		}
		
	}
	for (i = 0; i < 500010; i++) {
		goemp[i][0] = next[i][26];
	}
	for (i = 0; i < 20; i++) {
		goemp[500009][i] = 500009;
	}
	for (j = 1; j < 20; j++) {
		for (i = 0; i < 500010; i++) {
			goemp[i][j] = goemp[goemp[i][j - 1]][j - 1];
		}
	}
	scanf("%d", &Q);
	for (h = 0; h < Q; h++) {
		scanf("%d %d", &l, &r);
		x = l - 1;
		for (i = 19; i >= 0; i--) {
			if (goemp[x][i] <= r) { x = goemp[x][i]; }
		}
		if (x == r) { printf("Yes\n"); }
		else { printf("No\n"); }
	}
	
	return 0;
}

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

using namespace std;

void solve()
{
	int n;
	int b = 1;
	while(cin >> n, n)
	{
		vector< vector<int> > Vec(n);
		for(int i = 0; i < n; ++i)
		{
			Vec[i].resize(n);
		}
		int pos = 1;
		int width = 0;
		int height = 0;
		int count = 2;
		Vec[0][0] = 1;
		for(int i = 1; i < n; ++i)
		{
			if(i % 2 == 1)
			{
				width = pos;
				height = 0;
				for(int j = 0; j < pos + 1; ++j)
				{

					Vec[height][width] = count;
					width--;
					height++;
					count++;
				}
				++pos;
			}
			else
			{
				height = pos;
				width = 0;
				for(int j = 0; j < pos + 1; ++j)
				{
					Vec[height][width] = count;
					height--;
					width++;
					count++;
				}
				++pos;
			}
		}
		pos = 1;
		int size = n - 1;
		int a = n;
		for(int i = 0; i < n - 1; ++i)
		{
			if(a % 2 == 0)
			{
				width = pos;
				height = n - 1;
				for(int j = 0; j < size; ++j)
				{

					Vec[height][width] = count;
					width++;
					height--;
					count++;
				}
				++pos;
				size--;
				--a;
			}
			else
			{
				height = pos;
				width = n - 1;
				for(int j = 0; j < size; ++j)
				{
					Vec[height][width] = count;
					height++;
					width--;
					count++;
				}
				++pos;
				size--;
				--a;
			}
		}
		cout << "Case " << b << ":" << endl;
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				printf("%3d", Vec[i][j]);
			}
			cout << endl;
		}
		++b;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/
//---------------------------------------------------
#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)
//---------------------------------------------------
void swap(int *a, int *b)
{
  int temp;
  temp = *a;*a = *b;*b = temp;
}
//---------------------------------------------------

int main(void)
{
  int n;
  int m;
  int c;
  int sum = 0;
  scanf("%d %d",&n,&m);
  for (size_t i = 0; i < m; i++) {
    scanf("%d", &c);
    sum += c;
  }
  if (sum > n) {
    printf("-1\n");
  }else{
    printf("%d\n",n-sum );
  }
  return 0;
}


Measured memory_bytes: 1732
package main

import (
	"fmt"
)


func main() {
	var n int
	fmt.Scan(&n)
	ans := 0

	for i:=1 ; i < n; i++{
		for  j:=1; j < n; j++{
			if i*j >= n {
				break
			}
			if n - i*j < n {
				ans++
			}
		}
	}
	fmt.Println(ans)
}



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


bool isprime(int64_t n) {
  if(n==2) return true;
  else if(n%2==0) return false;

  bool ans = true;
  int64_t check = 3;
  while(check*check<=n) {
    if(n%check==0) {
      ans = false;
      return ans;
    }

    check += 2;
  }
  return ans;
}

int sankaku(int n) {
  int ans = 0;
  int sum = 1;
  int check = 1;
  while(n>=sum) {
    ans++;
    check++;
    sum += check;
  }

  return ans;
}


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

  int64_t n2 = n;



  if(n==1) {
    cout<<0<<endl;
    return 0;
  }
  if(isprime(n)) {
    cout<<1<<endl;
    return 0;
  }


  int64_t ma = 1;
  while(ma*ma<n) ma++;
  ma++;


  // bool prime[ma];
  bool *prime = (bool*)malloc(sizeof(bool)*ma);

  for(int i=0; i<ma; i++) {
    prime[i] = true;
  }
  

  int64_t posi = 2;
  while(posi<ma) {
    if(prime[posi]) {
      int64_t move = posi*posi;
      while(move<ma) {
        prime[move] = false;
        move += posi;
      }
    }
    posi++;
  }

  // cout<<"B"<<endl;

  int ans = 0;
  for(int i=2; i<ma; i++) {
    if(prime[i]) {
      int tmp = 0;
      while(n2%i==0) {
        n2 = n2/i;
        tmp++;
      }
      ans += sankaku(tmp);

      if(n2==1) break;
    }
  }

  if(n2>=ma) ans++;

  cout<<ans<<endl;

  return 0;
}

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

int main()
{
    char S[100];
    cin >> S;
    int N = strlen(S);
    int count = 0;

    for(int i=0; i<N/2; i++)
    {
        if(S[i] != S[N-1-i])
        {
            count++;
        }
    }
    
    cout << count;
    
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func count_choice(a int) int{
	count := a * (a-1)/2
	return count
}

func main()  {
	var b, c int
	fmt.Scanf("%d %d", &b, &c)

	b_ := count_choice(b)
	c_ := count_choice(c)
	fmt.Printf("%d", b_+c_)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int N, T;
  cin >> N >> T;

  int ans = 2000;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;

    if (t > T)
      continue;

    ans = min(ans, c);
  }

  if (ans == 2000) {
    cout << "TLE" << endl;
  } else {
    cout << ans << endl;
  }
 
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N=int(input())

A=list(map(int,input().split()))

wa=0
ans=0
for i in range(N):
    wa+=A[i]
    if i%2:
        if wa<1:
            ans+=1-wa
            wa=1
    else:
        if wa>-1:
            ans+=(1+wa)
            wa=-1
wa=0
ans2=0
for i in range(N):
    wa+=A[i]
    if (i+1)%2:
        if wa<1:
            ans2+=1-wa
            wa=1
    else:
        if wa>-1:
            ans2+=1+wa
            wa=-1

print(min(ans,ans2))


Measured memory_bytes: 14332
#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 2e5 + 5, MAXVAL = 2e5 + 5;
int n, k, a[N], nxt[N];
vector<int> pos[MAXVAL], realA;
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	fw (i, 0, n) cin >> a[i];
	fw (i, 0, n) pos[a[i]].pb(i);
	memset(nxt, -1, sizeof nxt);
	fw (i, 0, MAXVAL) {
		fw (j, 0, (int)pos[i].size() - 1) nxt[pos[i][j]] = pos[i][j + 1];
		if (pos[i].size()) nxt[pos[i][pos[i].size() - 1]] = pos[i][0];
	}
	//Cycle through the array to find a loop.
	int curPos = 0, cntCycles = 1;
	while (curPos < n) {
		if (nxt[curPos] <= curPos) cntCycles++;
		curPos = nxt[curPos] + 1;
	}
	k %= cntCycles;
	cntCycles = 1;
	curPos = 0;
	vector<int> ans;
	while (curPos < n) {
//		cout << "curPos = " << curPos << " cntCycles = " << cntCycles << "\n";
		if (nxt[curPos] <= curPos) {
			if (cntCycles < k) {
				cntCycles++;
				curPos = nxt[curPos] + 1;
			} else {
				ans.pb(a[curPos]);
				curPos++;
			}
		} else {
			curPos = nxt[curPos] + 1;
		}
	}
	fa (i, ans) cout << i << " ";
	return 0;
}

Measured memory_bytes: 17268
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
#define REP(i,n) for(int i;i<(int)n;i++)

using namespace std;

int main(){
  string s1,s2,s3,s4,s5,s6;
  cin>>s1;
  s2=s1;
  reverse(s1.begin(),s1.end());

  //ok
  s3=s1.substr(0,(s1.length()-1)/2);
  s4=s2.substr(0,(s2.length()-1)/2);
  s5=s1.substr((s1.length()+1)/2,(s1.length()-1)/2);
  s6=s2.substr((s2.length()+1)/2,(s2.length()-1)/2);
  if(s1==s2){
    if(s3==s6){
      if(s4==s5){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

manzoku=0
for i in range(n):
    manzoku=manzoku+B[A[i]-1]
    if i!=0 and A[i]==A[i-1]+1:
        manzoku=manzoku+C[A[i-1]-1]

print(manzoku)

Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const ll MOD = (ll)1000000007;//10^9+7
const ll INF2 = (ll)100000000000000000;//10^18


int main() {
    string s;
    cin>>s;
    ll p=0;
    REP(i,s.size()){
        if(s[i]=='p') p++;
    }
    cout<<s.size()/2 - p<<endl;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

const string D_blue    = "\x1b[36m";
const string D_green   = "\x1b[32m";
const string D_red     = "\x1b[31m";
const string D_yellow  = "\x1b[33m";
const string Db_red    = "\x1b[41m";
const string Db_yellow = "\x1b[43m";
const string D_end     = "\x1b[39m";
const string Db_end    = "\x1b[49m";

int main (){
  int a,b;
  while (cin >> a>> b ){
    int ans = max(a + b,a-b);
    ans = max(ans , a*b);
    cout << ans << endl;
  }
  return 0;
}


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

struct UnionFind {
	vector<int> par;

	UnionFind(int n) : par(n, -1) { }
	void init(int n) { par.assign(n, -1); }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

int main() {
	long long N, M;
	cin >> N >> M;
	vector<int>A(M);
	vector<int>B(M);
	vector<long long>Ans(M + 1);
	for (int n = 0; n < M; ++n) {
		cin >> A[n] >> B[n];
		--A[n];
		--B[n];
	}
	UnionFind uf(N);
	Ans[M] = (N - 1)*N / 2;
	for (int n = 0; n < M; ++n) {
		Ans[M - 1 - n] = Ans[M - n];
		if (!uf.issame(A[M - 1 - n],B[M - 1 - n])) {
			int x = uf.size(A[M - 1 - n]);
			int y = uf.size(B[M - 1 - n]);
			//Ans[M - 1 - n] += (long long)(x * x + y * y - (x + y)*(x + y)) / 2;
			Ans[M - 1 - n] -= (long long) (x* y);
		}
		uf.merge(A[M - 1 - n], B[M - 1 - n]);
	}
	
	for (int n = 0; n < M; ++n) {
		cout << Ans[n+1] << endl;
	}
	return 0;
}


Measured memory_bytes: 5068
#include<stdio.h>
int main(void)
{
puts("1x1=1");
puts("1x2=2");
puts("1x3=3");
puts("1x4=4");
puts("1x5=5");
puts("1x6=6");
puts("1x7=7");
puts("1x8=8");
puts("1x9=9");
puts("2x1=2");
puts("2x2=4");
puts("2x3=6");
puts("2x4=8");
puts("2x5=10");
puts("2x6=12");
puts("2x7=14");
puts("2x8=16");
puts("2x9=18");
puts("3x1=3");
puts("3x2=6");
puts("3x3=9");
puts("3x4=12");
puts("3x5=15");
puts("3x6=18");
puts("3x7=21");
puts("3x8=24");
puts("3x9=27");
puts("4x1=4");
puts("4x2=8");
puts("4x3=12");
puts("4x4=16");
puts("4x5=20");
puts("4x6=24");
puts("4x7=28");
puts("4x8=32");
puts("4x9=36");
puts("5x1=5");
puts("5x2=10");
puts("5x3=15");
puts("5x4=20");
puts("5x5=25");
puts("5x6=30");
puts("5x7=35");
puts("5x8=40");
puts("5x9=45");
puts("6x1=6");
puts("6x2=12");
puts("6x3=18");
puts("6x4=24");
puts("6x5=30");
puts("6x6=36");
puts("6x7=42");
puts("6x8=48");
puts("6x9=54");
puts("7x1=7");
puts("7x2=14");
puts("7x3=21");
puts("7x4=28");
puts("7x5=35");
puts("7x6=42");
puts("7x7=49");
puts("7x8=56");
puts("7x9=63");
puts("8x1=8");
puts("8x2=16");
puts("8x3=24");
puts("8x4=32");
puts("8x5=40");
puts("8x6=48");
puts("8x7=56");
puts("8x8=64");
puts("8x9=72");
puts("9x1=9");
puts("9x2=18");
puts("9x3=27");
puts("9x4=36");
puts("9x5=45");
puts("9x6=54");
puts("9x7=63");
puts("9x8=72");
puts("9x9=81");
return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;


const int N = (int) 1e5 + 100;

const int LEN = (int) 4e5 + 100;
char str[LEN];
string s[N];
char p[N];
const int ALP = 26;

int cnt[27];
int cmp[N][ALP][ALP];
int add[N];

void build(int sh, vector <int> &v)
{
	if ((int) v.size() <= 1) return;
	eprintf("sh = %d\n", sh);
	for (int x : v)
		eprintf("%d ", x);
	eprintf("\n");
	memset(cnt, 0, sizeof cnt);
	for (int x : v)
	{
		int cur;
		if (sh == (int) s[x].length() )
			cur = 26;
		else
			cur = s[x][sh] - 'a';
		cnt[cur]++;
	}
	for (int i = 0; i < 26; i++)
	{
		for (int x : v)
		{
			if (sh != (int) s[x].length() && s[x][sh] - 'a' == i)
			{
				for (int j = 0; j < 26; j++)
				{
					if (i != j && cnt[j] != 0)
					{
						if (x == 3)
							eprintf("%d : %d - %d : %d\n", sh, i, j, cnt[j] );
						cmp[x][i][j] += cnt[j];
					}
				}
				add[x] += cnt[26];
			}
		}
	}
	for (int i = 0; i < 26; i++)
	{
		vector <int> nx;
		for (int x : v)
		{
			if (sh != (int) s[x].length() && s[x][sh] - 'a' == i)
			{
				nx.push_back(x);
			}
		}
		build(sh + 1, nx);
	}
}

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%s", str);
		s[i] = string(str);
	}
	vector <int> v;
	for (int i = 0; i < n; i++)
		v.push_back(i);
	build(0, v);
	int q;
	scanf("%d", &q);
	for (int it = 0; it < q; it++)
	{
		int x;
		scanf("%d %s", &x, p);
		x--;
		int ans = 1 + add[x] ;
		for (int i = 0; i < ALP; i++)
			for (int j = i + 1; j < ALP; j++)
			{
				ans += cmp[x][p[j] - 'a'][p[i] - 'a'];
			}
		printf("%d\n", ans);
	}


	return 0;
}



Measured memory_bytes: 271224
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1e18;


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(500005);


//nPk
 mint f(int n, int k) {
    if (n < 0) return 0;
    // nPk = nCk * k!
    mint res = comb(n,k);
    res *= comb.fact[k];
    return res;
}




//組み合わせの数nCrを計算
   int calcNumOfCombination(int n, int r){
       int num = 1;
       for(int i = 1; i <= r; i++){
           num = num * (n - i + 1) / i;
       }
       return num;
   }

int main() {
  ll n,m;
  cin>>n>>m;
  mint ans=0;
  rep(i,n+1){
  //  cout<<"i"<<i<<endl;
    mint c1=comb(n,i);
    mint c2=f(m,i);
    mint c3=f(m-i,n-i);
    mint now=c1;
    now*=c2;
    now*=c3;
    now*=c3;
    //cout<<now<<endl;
    if(i%2==1)ans-=now;
    else ans+=now;
  }
cout<<ans;
}



Measured memory_bytes: 10884
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

bool isAllVisit(const vector<bool>& visit) {
    for (auto&& v : visit) {
        if (!v)return false;
    }
    return true;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}


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

    int A, B, C;
    cin >> A >> B >> C;

    cout << max(0, C - (A - B)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

const ll INF = 1e9;
const long long INFL = 1LL<<60;

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

  map<ll, ll> mp;

  rep(i, m) {
    ll d, c;
    cin >> d >> c;
    mp[d] += c;
  }

  ll ans = 0;

  bool flag = true;
  while (flag) {
    flag = false;
    rep(i, 10) {
      if (mp[i] > 1) flag = true;
      ll num = mp[i] / 2;
      ans += num;
      mp[i] -= num * 2;
      if (i + i < 10) mp[i+i] += num;
      else {
        mp[1] += num;
        mp[(i + i) % 10] += num;
      }
    }
  }

  vector<ll> a;
  rep(i, 10) {
    if (mp[i] != 0) a.push_back(i);
  }

  while (a.size() > 1) {
    int x = a.back(); a.pop_back();
    int y = a.back(); a.pop_back();
    if (x + y < 10) a.push_back(x + y);
    else {
      a.push_back(1);
      a.push_back((x + y) % 10);
    }
    ans++;
  }

  cout << ans << endl;

  return 0;
}


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

int n;
long long a[500];
long long nemui=1;

int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;i++){
		if(a[i]>=i/4){
			nemui=nemui+a[i]-i/4;
		}else{
			break;
		}
	}
cout<<nemui<<endl;}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int n, C, ch[35][100005]{}, ans = 0;

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

    REP(i,n){
        int s, t, c;
        cin >> s >> t >> c;
        ch[c-1][s]++;
        ch[c-1][t+1]--;
    }
    REP(i,C){
        REP(j,100001){
            ch[i][j+1] += ch[i][j];
        }
    }
    REP(j,100001){
        int cnt = 0;
        REP(i,C) if(ch[i][j]>0) cnt++;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12544
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	long long int sum[200001];
	for(int i = 0; i < n; i++){
		long long int a;
		cin >> a;
		if(i == 0) sum[i] = a;
		else sum[i] = a + sum[i - 1];
	}
	sort(sum, sum + n);
	// for(int i = 0; i < n; i++){
	// 	cout << sum[i] << endl;
	// }
	long long int ans = 0;
	for(int i = 0; i < n; i++){
		long long int a;
		if(i == 0) a = sum[i];
		else a = sum[i] - sum[i - 1];
		ans += lower_bound(sum + i, sum + n, sum[i] - a + 1) - lower_bound(sum + i, sum
			+ n, sum[i] - a);
		// cout << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

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

N, M = MAP()

gout = [[] for _ in range(N)]
deg = [0]*N
for _ in range(M):
	x, y = MAP()
	gout[x-1].append(y-1)
	deg[y-1] += 1
topo = [v for v in range(N) if deg[v]==0]
path_len = [0]*N
deq = deque(topo)
ans = 0
while deq:
    v = deq.popleft()
    for t in gout[v]:
        deg[t] -= 1
        if deg[t]==0:
            deq.append(t)
            path_len[t] = path_len[v] + 1
            ans = path_len[t]

print(ans)


Measured memory_bytes: 24708
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq

X,Y,Z,K=map(int, input().split())
A=list(sorted(map(int, input().split()), reverse=True))
B=list(sorted(map(int, input().split()), reverse=True))
C=list(sorted(map(int, input().split()), reverse=True))

def evaluate(x,y,z): return (-A[x]-B[y]-C[z], x,y,z)

Q=[]
heapq.heappush(Q, evaluate(0,0,0))
for i in range(1,K+1):
    (e,x,y,z) = heapq.heappop(Q)
    print(-e)
    if x+1 < X and evaluate(x+1, y, z) not in Q:
        heapq.heappush(Q, evaluate(x+1, y, z))
    if y+1 < Y and evaluate(x, y+1, z) not in Q:
        heapq.heappush(Q, evaluate(x, y+1, z))
    if z+1 < Z and evaluate(x, y, z+1) not in Q:
        heapq.heappush(Q, evaluate(x, y, z+1))

Measured memory_bytes: 3956
n,k,q = map(int,input().split())
a = [0]*q
# score = [k]*n
count = [0]*n
for i in range(q):
    a[i] = int(input())
    count[a[i]-1] += 1

g = k-q

for i in range(n):
    if g > 0:
        print('Yes')
    else:
        if count[i] > abs(g):
            print('Yes')
        else:
            print('No')


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

check = [[0] * 9 for i in range(9)]

if n <= 10:
    print(n)
else:
    for i in range(1, n+1):
        I = str(i)
        if I[-1] != '0':
            check[int(I[0]) - 1][int(I[-1]) - 1] += 1
    ans = 0
    for i in range(9):
        for j in range(9):
            ans += check[i][j] * check[j][i]
    print(ans)

Measured memory_bytes: 3064
from heapq import heapify, heappush, heappop
N, M = map(int, input().split())
heap = []
heapify(heap)

A = [[] for i in range(M)]

for i in range(N):
    a, b = map(int, input().split())
    if a > M:
        continue
    A[a-1].append(b)

count = 0
for a in A:
    for b in a:
        heappush(heap, -b)
    if len(heap) == 0:
        continue
    num = heappop(heap)
    count += num

print(-count)


Measured memory_bytes: 71584
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll>x(n), y(n), s(n), t(n);
    rep(i,n){
        cin >> x[i] >> y[i];
        s[i] = x[i] + y[i];
        t[i] = x[i] - y[i];
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    cout << max(s[n-1] - s[0] , t[n-1] - t[0] )<< endl;
}


Measured memory_bytes: 9516
#include <cstdio>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define MAXN (14)
#define INF  (1<<29)
#define X    real()
#define Y    imag()

typedef complex<double> P;

template<class T>
inline T Sq(T x) { return x*x; }

inline double getDist(P, P);
struct Segment {
  P s, t;
  double d;
  Segment() {}
  Segment(P s, P t) : s(s), t(t) { d = getDist(s, t); }
};

inline double getDist(P a, P b) { return sqrt(Sq(a.X-b.X)+Sq(a.Y-b.Y)); }
// inline double getDist(Segment sg) { return sqrt(Sq(sg.s.X-sg.t.X)+Sq(sg.s.Y-sg.t.Y)); }

int n;
double dist[MAXN][2][MAXN][2]; // seg s: 0, t: 1
double dp[1<<MAXN][MAXN][2];
Segment seg[MAXN];

int main() {
  
  int tcase = 1;
  double x1, y1, x2, y2;
  double allseglen;
  
  while(~scanf("%d", &n) && n) {
    
    allseglen = 0.0;
    
    for(int i=0; i<n; i++) {
      scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
      seg[i] = Segment(P(x1, y1), P(x2, y2));
      allseglen += seg[i].d;
    }
    
    for(int i=0; i<n; i++) {
      for(int j=0; j<n; j++) {
	
	if(i == j) {
	  for(int ii=0; ii<2; ii++) {
	    for(int jj=0; jj<2; jj++) {
	      if(ii == jj) { dist[i][ii][j][jj] = 0; }
	      else { dist[i][ii][j][jj] = seg[i].d; }
	    }
	  }
	  
	  continue;
	}
	
	dist[i][0][j][0] = getDist(seg[i].s, seg[j].s);
	dist[i][0][j][1] = getDist(seg[i].s, seg[j].t);
	dist[i][1][j][0] = getDist(seg[i].t, seg[j].s);
	dist[i][1][j][1] = getDist(seg[i].t, seg[j].t);
	
      }
    }
        
    for(int i=0; i<(1<<n); i++)
      for(int j=0; j<n; j++)
	for(int k=0; k<2; k++)
	  dp[i][j][k] = INF;
      
    for(int i=0; i<n; i++)
      for(int j=0; j<2; j++)
	dp[(1<<n)-1][i][j] = 0;
    
    for(int S=(1<<n)-1; S>=0; S--)
      for(int v=0; v<n; v++)
	for(int u=0; u<n; u++)
	  for(int i=0; i<2; i++)
	    for(int j=0; j<2; j++)
	      if(!(S>>u & 1))
		dp[S][v][j] = min(dp[S][v][j], dp[S|1<<u][u][i]+dist[u][(i+1)%2][v][j]);
    
    double ans = INF;
    for(int i=0; i<n; i++)
      for(int j=0; j<2; j++)
	ans = min(ans, dp[0][i][j]);
    
    printf("Case %d: %f\n", tcase++, ans + allseglen);
  }
  
  return 0;
}

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

using namespace std;

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

#define int ll


main(){
	ll a;
	double b;
	cin >> a >> b;
	b *= 100.01;
	ll b2  = (ll)b;
	ll ans = (ll) a*b2/100;
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 3780