akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int[] c = new int[N];
		int[] t = new int[N];
		int p = 1100;
		for(int i = 0; i < N; i++){
			c[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++){
			if((t[i] <= T) && (c[i] < p)){
					p = c[i];
				}
			}
		if(p == 1100){
			System.out.println("TLE");
		}else{
			System.out.println(p);
		}
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int main() {
	cin >> n;
	int s = 2;
	while ((2 << s) <= n) s++;
	int ret = -1;
	for (int i = 2; i <= s; i++) {
		for (int j = 1; ; j++) {
			int mul = 1;
			for (int k = 0; k < i; k++) {
				mul *= j;
				if (mul > n) mul = n + 1;
			}
			if(mul != n + 1) ret = max(ret, mul);
			else break;
		}
	}
	cout << ret << '\n';
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define REPS(i, n) for (int i = 1; i <= (n); i++)
#define RREPS(i, n) for (int i = (n); i > 0; i--)
#define mp make_pair
#define pb(a) push_back(a)
typedef long long ll;

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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~


N = int(input())
S = input()

W = S.count('.')
B = S.count('#')

w_dp, b_dp = [0] * N, [0] * N
for i in range(N):
    if S[i] == '.':
        w_dp[i] = 1
    else:
        b_dp[i] = 1

w_p_dp, b_p_dp = [0] * (N + 1), [0] * (N + 1)
for i in range(N):
    w_p_dp[i + 1] = w_p_dp[i] + w_dp[i]
    b_p_dp[i + 1] = b_p_dp[i] + b_dp[i]

ans = 100000000000000000
for i in range(N + 1):
    w = b_p_dp[i]
    b = W - w_p_dp[i]
    ans = min(ans, w + b)

print(ans)


Measured memory_bytes: 22692
while True:
    n, x = map(int, raw_input().split())
    if n == 0 and x == 0:
        break

    c = 0
    for i1 in range(1, n+1):
        for i2 in range(i1+1, n+1):
            s = x - (i1 + i2)
            if s > i2 and s <= n:
                c += 1
    print(c)

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

#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define endl "\n"
#define int long long

int32_t main()
{
    IOS;

    int n;
    cin >> n;
    map<int, int> count;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        count[a]++;
    }

    for (auto x : count)
    {
        if (x.second > 1)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin>>a;
    int b[a];
    for(int i=0;i<a;i++){
            cin>>b[i];
    }
    int c[a];
    memcpy(c,b,sizeof(b));
    sort(c,c+a);
    for(int i=0;i<a;i++){
        if(b[i]==c[a-1]) cout<<c[a-2]<<endl;
        else if(b[i]!=c[a-1]) cout<<c[a-1]<<endl;
    }
}


Measured memory_bytes: 3200
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, K;
  cin >> N >> K;
  constexpr int64_t kMaxA = 20;
  vector<int64_t> counts(kMaxA, 0);
  for (int64_t n = 1; n <= N; ++n) {
    int64_t a;
    for (int64_t i = 0; i < kMaxA; ++i) {
      if (n * (1LL << i) >= K) {
        a = i;
        break;
      }
    }
    counts[a]++;
  }

  double result = 0.0;
  for (int64_t a = 0; a < kMaxA; ++a) {
    result += static_cast<double>(counts[a]) / static_cast<double>((1LL << a) * N);
  }
  cout << std::setprecision(20) << result << endl;

  return 0;
}


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

int main()
{
  int a = 0;
  int b = 0;
  
  cin >> a >> b;
  if(a == b)
  {
    cout << "a == b" << endl;
  }else if ( a > b)
  {
    cout << "a > b" << endl;
  }else
  {
    cout << "a < b" << endl;
  }
}


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

int main() {
    lli X, K, D;
    cin >> X >> K >> D;

    if (X < 0LL) X = -X;

    if ((X + D) / D >= K) {
        X -= D * K;
        cout << llabs(X) << "\n";
        return 0;
    }

    lli t = X / D;
    X -= D * (X / D);
    K -= t;
    if (K % 2) X -= D;

    cout << llabs(X) << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int x,a;cin>>x>>a;

  if(x<a){
    cout<<0<<endl;
  }else{
    cout<<10<<endl;
  }

 

  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

H, W = map(int, input().split())
S = []
for i in range(H):
    s = list(input().rstrip())
    S.append(s)

#print(S)

for h in range(H):
    for w in range(W):
        if S[h][w] != '#':
            continue


        # 上
        if h > 0:
            if S[h-1][w] == '#':
                continue

        # 左
        if w > 0:
            if S[h][w-1] == '#':
                continue

        # 下
        if h < H-1:
            if S[h+1][w] == '#':
                continue

        # 右
        if w < W-1:
            if S[h][w+1] == '#':
                continue

        # 全部ダメ
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,k;
  cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  for(int i=k;i<n;i++){
    if(a[i]>a[i-k]) COUT("Yes");
    else COUT("No");
  }
}

Measured memory_bytes: 4832
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 1000000000000000
#define N 505
#define MOD 998244353
using namespace std;

int n;
int mx[N];
vector<pair<int,ii>> deep;
vector<int> v[N];

void dfs2(int node,int ata,int h) {

	int cnt=0;

	for(auto x:v[node]) {

		if(x==ata) continue; 

		++cnt;

		dfs2(x,node,h+1);		

	}

	umax(mx[h+1],cnt);

}

int dfs(int node,int ata) {

	int res=0;

	for(auto x:v[node]) {

		if(x==ata) continue ;

		umax(res,dfs(x,node)+1);

	}

	return res;

}

ll solve(int a,int b) {

	for(int i=1;i<=n;i++) mx[i]=0;

	dfs2(a,b,0);
	dfs2(b,a,0);
	
	ll res=1;

	for(int i=1;mx[i];i++) res*=mx[i];

	return res;

}

int main() {

	scanf("%d",&n);

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

		int x,y;

		scanf("%d %d",&x,&y);

		v[x].pb(y);
		v[y].pb(x);

	}

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

		deep.pb({dfs(i,0),{i,i}});;

		for(auto x:v[i]) {

			deep.pb({max(dfs(i,x),dfs(x,i)),{i,x}});

		}

	}

	sort(deep.begin(),deep.end());

	ll leaf=inf;

	for(int i=0;i<sz(deep);i++) {

		if(i && deep[i].st!=deep[i-1].st) break ;

		umin(leaf,(ll) (1+(deep[i].nd.st!=deep[i].nd.nd))*solve(deep[i].nd.st,deep[i].nd.nd));

	}

	printf("%d %lld",deep[0].st+1,leaf);

}

Measured memory_bytes: 256
N,P = map(int, input().split())
A = [int(a) for a in input().split()]

even = 0
odd = 0
for a in A:
    if a%2 == 0:
        even += 1
    else:
        odd += 1

L = [1]*(N+1)
for i in range(N):
    L[i+1] = L[i]*(i+1)
    
def cmb(n, r):
    return L[n]//L[r]//L[n-r]

ans = pow(2, N)    
for i in range(1, odd+1, 2):
    ans -= cmb(odd, i)*pow(2, even)
if P == 1:
    ans = pow(2, N) - ans

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define N 1000
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
unordered_map<ll,int> num;
int c[N][10]; ll a[N],col[N],mi[10];
void add(ll x,int k)
{	ll v[4]={x%mi[1],x/mi[1]%mi[1],x/mi[2]%mi[1],x/mi[3]%mi[1]};
	reverse(v,v+4);
//	debug(v[0]);debug(v[1]);debug(v[2]);debug(v[3]);
	for(rint i=0;i<4;i++)
	{	ll sum=0;
		for(rint j=0;j<4;j++) sum=sum*2333+v[(i+j)%4];
		num[sum]+=k;
	}
}
inline ll hsh(int A,int B,int C,int D){return A*mi[3]+mi[2]*B+mi[1]*C+mi[0]*D;}
int main()
{	int n; ll sum=0; cin>>n;
	mi[0]=1; mi[1]=2333; mi[2]=mi[1]*2333; mi[3]=mi[2]*2333;
//	add(hsh(1,2,3,4),1); return 0;
	for(rint i=1;i<=n;i++)
	{	for(rint j=0;j<4;j++) scanf("%d",&c[i][j]),c[i][j]++;
		for(rint j=0;j<4;j++) a[i]=2333*a[i]+c[i][j];
		a[i]=hsh(c[i][0],c[i][1],c[i][2],c[i][3]);
		add(a[i],1);
	}
	for(rint i=1;i<=n;i++)
	{	add(a[i],-1);
		for(rint j=i+1;j<=n;add(a[j],1),j++)
		{	add(a[j],-1);
			for(rint k=0;k<4;k++)
			{//	if(j==5) debug(c[j][0]);
				col[0]=hsh(c[i][0],c[j][(k+1)%4],c[j][k],c[i][1]);
				col[1]=hsh(c[i][1],c[j][k],c[j][(k+3)%4],c[i][2]);
				col[2]=hsh(c[i][2],c[j][(k+3)%4],c[j][(k+2)%4],c[i][3]);
				col[3]=hsh(c[i][3],c[j][(k+2)%4],c[j][(k+1)%4],c[i][0]);
			//	if(i==1&&j==5&&k==0) debug(num[col[0]]),debug(num[col[1]]),debug(num[col[2]]),debug(num[col[3]]),exit(0);
				ll ans=1;
				for(rint l=0;l<4;l++) ans=(ll)ans*num[col[l]],add(col[l],-1);
				for(rint l=0;l<4;l++) add(col[l],1); sum+=ans;
			}
		}
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 239576
#include<bits/stdc++.h>
using namespace std;
int a[200001],b[200001]; 
int main(){
	register int n,m,i,x,y,s=0;
	cin>>n>>m;
	for(i=1;i<=n;++i)cin>>a[i];
	for(i=1;i<=m;++i){
		cin>>x>>y;
		b[x]=max(b[x],a[y]);
		b[y]=max(b[y],a[x]);
	}
	for(i=1;i<=n;++i)
		if(a[i]>b[i])++s;
	cout<<s;
} 

Measured memory_bytes: 4376
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

ll binpow(ll a, ll b) {
    if (b == 0)
    {
        return 1;
    }
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
    {
        return res * a;
    }
    return res;
}

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int x,y;
    cin>>x>>y;
    for (int i=0;i<=x;++i)
        if (i*2+(x-i)*4==y)
        {
            cout<<"Yes";
            return 0;
        }
    cout<<"No";
    return 0;
}

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

class Cube {
public:
  int f[6];
  Cube() {}
  void roll_z() { roll(1, 2, 4, 3); }
  void roll_y() { roll(0, 2, 5, 3); }
  void roll_x() { roll(0, 1, 5, 4); }
  void roll(int i, int j, int k, int l) {
    int t = f[i]; f[i] = f[j], f[j] = f[k]; f[k] = f[l]; f[l] = t;
  }
};

bool eq(Cube c1, Cube c2) {
  for (int i = 0; i < 6; i++)
    if (c1.f[i] != c2.f[i])return false;
  return true;
}

bool equal(Cube c1, Cube c2) {
  for (int i = 0; i < 6; i++){
    for (int j = 0; j < 4; j++) {
      if (eq(c1, c2))return true;
      c1.roll_z();
    }
    if (i % 2 == 0)c1.roll_y();
    else c1.roll_x();
  }
  return false;
}

Cube C[100]; int n;

bool check() {
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)if (equal(C[i], C[j]))return false;
  return true;
}

int main() {
  cin >> n;
  for (int j = 0; j < n; j++)
    for (int i = 0; i < 6; i++)cin >> C[j].f[i];

  if (check())cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3100
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double[] now = new double[2];
        double sumangle = 0.0;
        while(true) {
            String line = sc.nextLine();
            String[] linesp = line.split(",");
            int walk = Integer.parseInt(linesp[0]);//歩数
            int angle = Integer.parseInt(linesp[1]);//整数
            if(walk == 0 && angle == 0) {
                System.out.println((int)now[0]);
                System.out.println((int)now[1]);
                break;
            }
            now[1] += (double)walk * Math.cos(Math.toRadians(sumangle));
            now[0] += (double)walk * Math.sin(Math.toRadians(sumangle));
        sumangle += (double)angle;
        }
    }
}


Measured memory_bytes: 26052
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;

int main(){
  ll n,m,ans=0; cin>>n>>m;
  vector<ll>a(m);
  rep(i,n){
  ll k; cin>>k;
    rep(l,k){
    ll A; cin>>A;
      a[A-1]++;
    }
  }
  rep(i,m){
  if(a[i]==n) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#Min, Max and Sum
n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0
amax = a.max
amin = a.min
for i in 0..n
    a[i] = a[i].to_i
    sum += a[i]
end

puts "#{amin} #{amax} #{sum}"

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

const int maxn = 1e2 + 5;
char s[maxn];

bool Judge(char *a, int n) {

    for(int i = 0, j = n-1; i < j; i++, j--)
        if(a[i] != a[j]) return false;
    return true;
}

int main() {

    scanf("%s", s);
    int n = strlen(s);
    if(Judge(s, n) && Judge(s, n/2) && Judge(s+n/2+1, n/2)) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int k;
  cin >> k;
  int total = 0;
  for(int i=1;i <= k;i++){
    for(int j=i+1;j <= k;j++){
      if(i%2 == 0){
        if(j%2 != 0){
          total++;
        }
      }else{
        if(j%2 == 0){
          total++;
        }
      }
    }
  }
  cout << total << endl;
}

  


Measured memory_bytes: 256
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll n,m,v,p,a[100001];
ll pre[100001];

bool check(ll mid)
{
	mid--;
	ll na=a[mid]+m;
	ll left=max(0ll,v-(n-mid));

	if(left<=p-1 && a[p-1]<=na) return true;
	if(a[p-1]>na) return false;
	if(a[p-1]+m<=na) return true;

	ll leftno=(left-p+1)*m;
	ll csum;
	if(p==1) csum=pre[mid-1]; 
	else csum=pre[mid-1]-pre[p-2];

	if(ceil((csum+leftno)/double(mid-1-(p-2)))>na) return false;
	return true;
}
void solve()
{
	cin>>n>>m>>v>>p;

	ll i;
	rep(i,n) cin>>a[i];
	sort(a,a+n, greater<ll>());
	
	rep(i,n)
	{
		if(i==0) pre[i]=a[i];
		else pre[i]=pre[i-1]+a[i];
	}
	ll l=p+1,r=n, ans=p;

	while(l<=r)
	{
		ll mid=(l+r)>>1;
		if(check(mid))
		{
			ans=mid;
			l=mid+1;
		}
		else r=mid-1;
	}
	cout<<ans;
}

int main()
{
	//fio();
	fast
	ll t=1;
	//cin>>t;

	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1)
using namespace std;
int a[200005];
int main()
{
//    int n;
//    scanf("%d",&n);
//    for(int i=1;i<=n;i++)
//    {
//        scanf("%d",&a[i]);
//    }
//    int T;
//    scanf("%d",&T);
//    while(T--)
//    {
//        int n;
//        scanf("%d",&n);
//        for(int i=1;i<=n;i++)
//        {
//            scanf("%d",&a[i]);
//        }
//    }
    double x;
    scanf("%lf",&x);
    printf("%.10f\n",pi*2*x);
}


Measured memory_bytes: 3800
X,N = list(map(int,input().split()))
if N == 0:
  P = []
else:
  P = list(map(int,input().split()))
MIN = float('inf')
MINLIST = []
for i in range(-1000,1000):
    if i not in P and abs(X-i) <= MIN:
        if abs(X-i) == MIN:
            MINLIST.append(i)
        else:
            MIN = abs(X-i)
            MINLIST = [i]
print(min(MINLIST))

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

int main()
{
	int a,b;

	cin >> a >> b;

	int c;

	c = a * b;

	if(c % 2 == 0){
		cout << "Even" << endl;
	}else{
		cout << "Odd" << endl;
	}
  
	return 0;
}

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

#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define cot cout.tie(0)

using namespace std;

int main()
{
    int x,size;
	string s;
    cin>>s;
    size=s.length();
    for (int i = size; i < 15; i++)
        s.append("o");
    
    x = count(s.begin(),s.end(),'o');
    if ( x>=8 )
        cout<<"YES";
    else
        cout<<"NO";
	return 0;
	
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 10000000
int p[N+1];
void era(void){
	int i,j;
	for(i=2;i<N;i++){
		p[i]=1;
	}
	for(i=2;i*i<N;i++){
		if(p[i]){
			for(j=2*i;j<=N;j=j+i){
				p[j]=0;
			}
		}
	}
}
int main(void){
	int n;
	era();
	while(1){
		scanf("%d",&n);
		if(!n)
			break;
		while(1){
			if(p[n]&&p[n-2]&&p[n-6]&&p[n-8])
				break;
			n--;
		}
		printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 39656
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<vector<int>> G(n);
  vector<pair<int,int>> vp; //頂点のペア
  REP(i,n-1){
    int a,b;
    cin>> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    vp.emplace_back(a,b);
  }
 
  int K = 0;
  map<pair<int,int>,int> I; //連想配列クラス
  vector<int> color(n,0); //色の初期化
  vector<int> used(n,0); //訪問したかの初期化
  queue<int> que;
  used[0] = 1; //0が親なので使用済み
  que.emplace(0); //親をpush
  
  while(!que.empty()){
    int v = que.front(); //キューから先頭頂点取り出す
    que.pop(); //popは忘れずに
    if(K < (int) G[v].size()) K = G[v].size();
    
    int usable = 1;
    //G[que.front()]の要素（ペアの相手）についてループ
    for(int nv : G[v]){
      if(used[nv] != 0) continue;
      if(usable == color[v]) usable++;
      color[nv] = usable;
      I[pair<int,int>(nv,v)] = usable;
      I[pair<int,int>(v,nv)] = usable;
      usable++;
      used[nv] = 1; //ペアの相手は使用済み
      que.emplace(nv); //次の親
    }
  }
   
  cout << K << endl;
  for(auto p : vp) cout << I[p] << endl;
  return 0;
}

Measured memory_bytes: 20084
#include <bits/stdc++.h>
using namespace std;
    long long n,k,s;
int main()
{
  cin>>n>>k;

  if (!k) s=n*n;
  if (k)
    for (int i=k+1;i<=n;++i)
      {
        s+=n/i*(i-k);
        if (n%i>=k) s+=n%i-k+1;
      }    
  
  cout<<s;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)
#define rep(i, n) repi(i, 0, n)
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
// using P = pair<int, int>;
struct Vec{
    double x, y;
};
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;
int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*c, a*d), max(b*c, b*d)) << endl;
    return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	cout<<fixed<<setprecision(10)<<(((n+1)/2)/(double)n)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n;
    int i;
    string s="";
    cin>>n;
    while(n>0)
    {
        --n;
        s+='a'+(n%26);
        n/=26;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
vector<int> v, c;
int temp;
for(int i=0; i<n ;i++)
   cin>>temp,v.emplace_back(temp);
for(int i=0;i<n; i++)
    cin>>temp,c.emplace_back(temp);
int total=0;
for(int i=0;i<n;i++){
    if(c[i]<v[i])
        total+=(v[i]-c[i]);
}
cout<<total<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int N,X;cin>>N>>X;
  std::vector<int> ans;
  while(N||X){
    int res=0;
    for(int i=0;i<N;i++){
      for(int j=i+1;j<N;j++){
        for(int k=j+1;k<N;k++){
          if(i+j+k+3==X)res++;
        }
      }
    }
    ans.push_back(res);
    cin>>N>>X;
  }
  for(int p:ans)cout<<p<<endl;
}



Measured memory_bytes: 3104
#include <algorithm>
#include <cmath>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <random>
#include <string>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
/*---------------------------------------*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int N, X; cin >> N >> X;
  vector<int> x(N);
  REP(i, N) cin >> x[i];

  int ans = abs(X - x[0]);
  FOR(i, 1, N) {
    ans = __gcd(ans, abs(X - x[i]));
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CDistinctOrNot solver = new CDistinctOrNot();
        solver.solve(1, in, out);
        out.close();
    }

    static class CDistinctOrNot {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            HashSet<Integer> hs = new HashSet<>();
            for (int i = 0; i < n; i++) {
                int temp = in.nextInt();
                if (hs.contains(temp)) {
                    out.println("NO");
                    return;
                }
                hs.add(temp);
            }
            out.println("YES");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

using namespace std;

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

const uint64_t INF = static_cast<uint64_t>(-1);

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

  vector<uint64_t> N(S.size(), 0);
  N_TIMES(i, S.size()) { N[i] = S[i] - '0'; }

  vector<array<uint64_t, 2>> dp(S.size() + 1, {INF, INF});
  dp[0] = {0, 1};
  N_TIMES(i, S.size()) {
    uint64_t P = (i == S.size() - 1) ? 10 : 9;
    dp[i + 1][0] = min(N[i] + dp[i][0], (10 - N[i]) + dp[i][1]);
    dp[i + 1][1] = min((N[i] + 1) + dp[i][0], (P - N[i]) + dp[i][1]);
  }

  cout << min(dp[S.size()][0], dp[S.size()][1]) << endl;

  return 0;
}

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

int main()
{
  int N,K,T,U,V,L,a;
  bool nin[100001]={};
  double ans=0;
  pair<int,int> S;

  cin>>N>>K>>T>>U>>V>>L;
  for(int i=0;i<N;i++){
    cin>>a;
    nin[a]=true;
  }

  S.first=0;
  S.second=0;
  for(int k=0;k<L;k++){

    if(nin[k]){
      if(S.second<K){
	S.second++;
	if(S.first==0){
	  S.second--;
	  S.first=T*V;
	}
      }
      else if(S.second==K){
	S.first=T*V;
      }
    }

    if(S.first==0)ans+=1/(double)U;
    else {
      ans+=1/(double)V;
      S.first--;
      if(S.first==0){
	if(S.second!=0){
	  S.second--;
	  S.first=T*V;
	}
      }
    }
  }
  
  printf("%.8f\n",ans);
  return 0;
}

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

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

    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n-1);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];

    int res = 0;
    rep(i, n){
        res += b[a[i]-1];
        if(a[i]+1 == a[i+1]) res += c[a[i] - 1];
    }

    cout << res << endl;

    return 0;
}

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

# dp = [float("INF")] * 100010
# dp[0] = 0
dp = [x for x in range(1000010)]


for i in range(1, 100001):
    power = 1
    while power <= n:
        dp[i] = min(dp[i], dp[i - power] + 1)
        power *= 6


for i in range(1, 100001):
    power = 1
    while power <= n:
        dp[i] = min(dp[i], dp[i - power] + 1)
        power *= 9


ans = dp[n]
print(ans)

Measured memory_bytes: 42648
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;

int main (void)
{
	long long n,m;

	cin >> n >> m;

	if (n % m == 0)
	{
		cout << "-1" << endl;
	}
	else
	{
		cout << n << endl;
	}
}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll seica(ll n, ll ga, ll sa, ll ba, ll gb, ll sb, ll bb){
	vector<P> now;
	if(ga < gb)now.EB(ga, gb);
	if(sa < sb)now.EB(sa, sb);
	if(ba < bb)now.EB(ba, bb);
	ll ret = n;
	if(now.size() == 1){
		ll tmp = n / now[0].FI;
		ll ama = n - tmp * now[0].FI;
		ret = ama + tmp * now[0].SE;
	}
	else if(now.size() == 2){
		REP(i, n+1){
			ll tmp = n - i * now[0].FI;
			if(tmp < 0)continue;
			ll a = tmp / now[1].FI;
			ll ama = tmp - a * now[1].FI;
			ret = max(ret, ama + i * now[0].SE + a * now[1].SE);
		}
	}
	else if(now.size() == 3){
		REP(i, n + 1){
			REP(j, n + 1){
				ll tmp = n - (i * now[0].FI + j * now[1].FI);
				if(tmp < 0)continue;
				ll a = tmp / now[2].FI;
				ll ama = tmp - a * now[2].FI;
				ret = max(ret, ama + i * now[0].SE + j * now[1].SE + a * now[2].SE);
			}
		}
	}
	return ret;
}

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

	ll n, ga,gb,sa,sb,ba,bb;cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;
	n = seica(n, ga, sa, ba, gb, sb, bb);
	cout << seica(n, gb, sb, bb, ga, sa, ba) << endl;

	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

typedef long long ll, lint;
typedef long double ldouble;

#define sz(v) ((int) (v).size())
#define FOR(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define For(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()

#define mp make_pair
#define pb push_back
#define fst first
#define snd second

template<class T>
string to_string(T arr, int len = 1e9) {
    stringstream ss;
    int i = 0;
    for (auto item : arr) {
        ss << item << ' ';
        if (++i == len)
            break;
    }
    return ss.str();
}

#ifdef LOCAL
    #define dbg(expr) cout << "[line " << __LINE__ << "] " << (#expr) << ": " << (expr) << endl;
#else
    #define dbg(expr) (void) 0;
#endif


lint emulate(lint k, const vector<lint>& a) {
    for (auto i : a)
        k -= k % i;
    return k;
}

int main() {
#ifndef LOCAL
    cin.tie(0);
    ios_base::sync_with_stdio(false);
#endif

    int n;
    cin >> n;
    vector<lint> a(n);
    For (i, n)
        cin >> a[i];
    lint lbound = 2, hbound = 1e18;
    while (hbound - lbound > 1) {
        lint mid = (hbound + lbound) / 2;
        lint number = emulate(mid, a);
        if (number > 2)
            hbound = mid;
        else
            lbound = mid;
    }
    if (emulate(hbound - 1, a) != 2) {
        cout << -1 << endl;
        return 0;
    }
    lint max_value = hbound - 1;
    lbound = 1, hbound = 1e18;
    while (hbound - lbound > 1) {
        lint mid = (hbound + lbound) / 2;
        lint number = emulate(mid, a);
        if (number < 2)
            lbound = mid;
        else
            hbound = mid;
    }
    if (emulate(hbound, a) != 2)
        throw;
    lint min_value = hbound;
    cout << min_value << ' ' << max_value << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (int i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<int,int> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.begin(),a.end(),greater<int>())
#define sz(a) (int)a.size()
#define endl '\n'
#define po(a,b) (ll)(pow(a,b)+0.5)
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
const ll M=1e9+7;
const int MX=1e5+5;

int main()
{     

    Fast

   ll n;
   cin>>n;string ans="";
   while(n>0)
   { 
       n--;
       ans+='a'+n%26;
       n/=26;
   }
   rev(ans);
   cout<<ans;
    
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> //tuple<ll,ll,ll>
#define pr(x) cout << x << endl;
using namespace std;

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll ans=0;
  ll sum=0;
  rep(i,n){
    sum+=a[i];
    if(i%2==0 && sum<=0){
      ans+=-sum+1;
      sum=1;
    }
    if(i%2==1 && sum>=0){
      ans+=sum+1;
      sum=-1;
    }
  }
  ll ans2=0;
  sum=0;
  rep(i,n){
    sum+=a[i];
    if(i%2==1 && sum<=0){
      ans2+=-sum+1;
      sum=1;
    }
    if(i%2==0 && sum>=0){
      ans2+=sum+1;
      sum=-1;
    }
  }
  cout << min(ans,ans2) << endl;
return 0;
}


Measured memory_bytes: 4052
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int H,W;
    cin>>H>>W;
    int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
    string fie[1000];
    int  fieans[100][100];
    for(int i=0;i<100;i++){
        for(int j=0;j<100;j++){
            fieans[i][j]=2100000000;
        }
    }
    for(int i=0;i<H;i++)cin>>fie[i];
    queue<int> Qx,Qy,Qte;
    Qx.push(0);
    Qy.push(0);
    Qte.push(0);
    while(Qx.size()!=0){
        int a,b,c;
        a=Qx.front();
        b=Qy.front();
        c=Qte.front();
        Qx.pop();
        Qy.pop();
        Qte.pop();
        //if(a<=0||b<=0||H<b||W<a){
            //continue;
        //}
        //printf("[%d][%d][%d]\n",a,b,c);
        for(int i=0;i<4;i++){
            if(a+dx[i]<0||b+dy[i]<0||H<=b+dy[i]||W<=a+dx[i]){
                continue;
            }
            if(fie[b+dy[i]][a+dx[i]]!='#'&&fieans[b+dy[i]][a+dx[i]]>c+1){
                fieans[b+dy[i]][a+dx[i]]=c+1;
                Qy.push(b+dy[i]);
                Qx.push(a+dx[i]);
                Qte.push(c+1);
            }
        }
    }
    int cou=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(fie[i][j]=='#')cou++;
            //printf("[%2d]",fieans[i+1][j+1]);
        }
        //puts("");
    }
    if(fieans[H-1][W-1]==2100000000){
        cout<<-1<<endl;
        return 0;
    }
    cout<<H*W-fieans[H-1][W-1]-1-cou<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
ans = 0
for i in range(1, N+1):
    head, tail = str(i)[0], str(i)[-1]
    if tail == "0":
        continue
    if head == tail:
        ans += 1
    if int(tail + head) <= N:
        ans += 1
    if len(str(N))-2 >= 1 or head == tail:
        num = len(str(N))-2
        if int(tail) <= int(str(N)[0]) and num > 0:
            if int(tail + "9"*(len(str(N))-2) + head) <= N:
                j = int("9"*(len(str(N))-2))
            else:
                if int(tail + str(N)[1:-1] + head) <= N:
                    j = int(str(N)[1:-1])
                else:
                    j = int(str(N)[1:-1]) - 1
            ans += int(j) + 1
        if num > 1:
            ans += int((num - 1) * "1") * 10
    # print(i, ans)
                    
print(ans)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



map<ll,ll> prime_factorise(ll n){
    map<ll,ll> res;
    for(ll i = 2;i*i <= n;i++){
        while(!(n%i)){
            res[i]++;
            n /= i;
        }
    }
    if(n != 1)res[n]++;
    return res;
}

int main(){

  ll n;
  cin >> n;
  if(n == 1){
    cout << 0 << endl;
    return 0;
  }
  map<ll,ll> k = prime_factorise(n);
  ll res = 0;
  for(auto iter = k.begin();iter != k.end();iter++){
    ll l = (*iter).second;
    for(int i = 1;i <= l;i++){
      res++;
      l -= i;
    }
  }
  cout << res << endl;




  




  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::pair<ll, ll> pll;

using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }
ll lcm(ll a, ll b) { return a*(b/gcd(a,b)); }

int main() 
{
    int n; cin >> n;
    v_ll t(n);
    ll ans = 1;
    irep(i, n) { 
        cin >> t[i]; 
    }

        irep(i, n) {
            ans = lcm(ans, t[i]);
        }
        cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    const int inf = 1e9 + 5;
    const int MAX = 1e5;
    int main() {
        int n, W;
        scanf("%d%d", &n, &W);
        
        vector<int> dp(MAX+1, inf);
        dp[0]=0;
        for(int i = 0; i < n; ++i) {
            int w, v;
            scanf("%d %d", &w, &v);
            
            for(int j = MAX - v; j >= 0; --j) {
                dp[j + v] = min(dp[j + v], dp[j] + w);//cout<<dp[j+v]<<endl;
            }
        }
        int ans=MAX;   
        
        while(ans>=0 && dp[ans]>W)
        {
            ans--;
        }
        printf("%d\n", ans);
    }

Measured memory_bytes: 640
S = input()

front = int(S[:2])
back = int(S[2:])
if 1 <= front and front <= 12:
    if 1 <= back and back <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")  
elif 1 <= back and back <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int N_MAX = 100000;
int main()
{
  int n,k,q,t,i;
  int p[N_MAX];
  cin >> n >> k >> q;
  fill(p,p+n,0);
  for(i=0;i<q;i++){
    cin >> t;
    p[t-1]++;
  }
  for(int i=0;i<n;i++){
    if(k-q+p[i]>0)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long int N,A,B;
  long long int sum=0;
  cin >> N >> A >> B;
  sum += (N/(A+B))*A;
  if(N%(A+B)>A) sum+=A;
  else sum+=N%(A+B);
  cout << sum << endl;
}


Measured memory_bytes: 256
n,m = list(map(int, input().split()))
ps = [input().split() for _ in range(m)]

acCount = 0
penaltyCount = 0
wa = [0]*n
aced = [False]*n

for i in ps:
    ind = int(i[0])-1
    if i[1]=='WA' and not aced[ind]:
        wa[ind] += 1
    elif i[1]=='AC' and not aced[ind]:
        aced[ind] = True
        acCount += 1
        penaltyCount += wa[ind]

print(acCount, penaltyCount)

Measured memory_bytes: 33692
N,K=map(int,input().split())
A=list(map(int,input().split()))
mini=100000
p=0
for i in range(N):
  if mini>A[i]:
    mini=A[i]
    p=i+1
a=-(-(p-1)//(K-1))
b=-(-(N-(K-1)*a-1)//(K-1))
c=-(-(N-p)//(K-1))
d=-(-(N-c*(K-1)-1)//(K-1))
print(min((a+b),(c+d)))

Measured memory_bytes: 13880
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String l1 = scan.nextLine();
        scan.close();

        int h = Integer.valueOf(l1.split(" ")[0]);
        int a = Integer.valueOf(l1.split(" ")[1]);

        int result = 0;

        while (true) {
        	result++;

        	h = h - a;

        	if (h <= 0) {

                System.out.println(result);
                return;
        	}
        }
	}
}


Measured memory_bytes: 21972
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        long res = 0;
        for (int i = 1; i < n; i ++) {
            res += (n / i);
            if (n % i == 0) res--;
        }
        out.println(res);
        out.close();
    }



    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

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

int main() {
    int n;
    cin >> n;
    // w[i][x] := index i 以下で整数x以上の個数
    vector<vector<int>> w(2 * n, vector<int>(n + 2, 0)), b(2 * n, vector<int>(n + 2, 0));
    vector<pair<char, int>> v(2 * n);
    // p[x] := 整数xが存在するindex
    vector<int> pw(n + 1), pb(n + 1);

    for (int i = 0; i < 2 * n; i++) {
        cin >> v[i].first >> v[i].second;
        if (v[i].first == 'W') pw[v[i].second] = i;
        if (v[i].first == 'B') pb[v[i].second] = i;
    }
    for (int x = 0; x <= n; x++) {
        for (int i = 0; i < 2 * n; i++) {
            if (v[i].first == 'W' && v[i].second >= x) w[i][x] = 1;
            if (v[i].first == 'B' && v[i].second >= x) b[i][x] = 1;
            if (i) w[i][x] += w[i - 1][x], b[i][x] += b[i - 1][x];
        }
    }
    vector<vector<int>> dp(n + 1, vector<int>(n + 1, 1e8));
    dp[0][0] = 0;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (i < n)
                dp[i + 1][j] =
                    min(dp[i + 1][j], dp[i][j] + w[pw[i + 1]][i + 2] + b[pw[i + 1]][j + 1]);
            if (j < n)
                dp[i][j + 1] =
                    min(dp[i][j + 1], dp[i][j] + w[pb[j + 1]][i + 1] + b[pb[j + 1]][j + 2]);
        }
    }
    cout << dp[n][n] << endl;
    return 0;
}

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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

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

    cout << 2.0 * n * 3.141592 << endl;
}


Measured memory_bytes: 3736
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        Drink[] d = new Drink[n];
        for(int i = 0; i < n; i++){
            d[i] = new Drink(Integer.parseInt(sc.next()), Integer.parseInt(sc.next()));
        }
        Arrays.sort(d);
        
        long ans = 0;
        int count = 0;
        for(int i = 0; i < n; i++){
            if((count + d[i].number) >= m){
                ans += d[i].price * (m - count);
                break;
            }else{
                ans += d[i].price * d[i].number;
                count += d[i].number;
            }
        }
        
        System.out.println(ans);
    }
}

class Drink implements Comparable<Drink>{
    long price;
    int number;
    
    Drink(int price, int number){
        this.price = price;
        this.number = number;
    }

    @Override
    public int compareTo(Drink d) {
        
        if(this.price < d.price){
            return -1;
        }else if(this.price > d.price){
            return 1;
        }else{
            return 0;
        }
    }
}

Measured memory_bytes: 63920
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<cmath>
using namespace std;
	int cnt=0;
	int crr[51];
	int drr[51];
	int arr[51];
	int brr[51];
	int n,m,q;
	int rr[11];
void culc(int fr, int ls, int num){
	if(num==0){
		int cur=0;
		for(int i=1;i<=q;i++){
			if(rr[brr[i]]-rr[arr[i]]==crr[i])cur+=drr[i];
		}
		cnt=max(cur,cnt);			
	}
	else {
		for(int i=fr;i<=ls;i++){
			rr[n-num+1]=i;
			culc(i,ls,num-1);
		}
	}
}

int main(){
	

	for(int i=0;i<11;i++)rr[i]=0;
	cin>>n>>m>>q;
	for(int i=0;i<51;i++){crr[i]=-1;drr[i]=-1;arr[i]=-1;brr[i]=-1;}
	for(int i=1;i<=q;i++){
		cin>>arr[i]>>brr[i]>>crr[i]>>drr[i];
	}
	culc(1,m,n);
	cout<<cnt<<endl;
	return 0;
}


	


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n>>k;
    string s;
    cin >> s;
    for(int i =0; i<s.size(); i++){
        if(i==k-1){
            putchar(tolower(s[i]));
        }else{
           cout << s[i]; 
        }
    }
}

Measured memory_bytes: 3576