akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdio>
using namespace std;
#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)
class Point {
public:
	long double x, y;
	Point(long double x = 0, long double y = 0) :x(x), y(y) {}
	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(x*a, y*a); }
	Point operator / (double a) { return Point(x / a, y / a); }
	long double abs() { return sqrt(norm()); }
	long double norm() { return x*x + y*y; }
	bool operator < (const Point &p) const { return x != p.x ? x < p.x : y < p.y; }
	bool operator > (const Point &p) const { return x != p.x ? x > p.x : y > p.y; }
	bool operator == (const Point &p) const { return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS; }
};
struct Segment {
	Point p1, p2;
};
long double norm(Point p) { return p.x*p.x + p.y*p.y; }
long double abs(Point p) { return sqrt(norm(p)); }
double dot(Point a, Point b) {
	return a.x*b.x + a.y*b.y;
}
Point projection(Segment a, Point b) {
	Point sa = a.p2 - a.p1;
	double hyp = dot(b - a.p1, sa); double r = hyp / norm(sa);
	return a.p1 + sa * r;
}
Point reflection(Segment a, Point b) {
	return b + ((projection(a, b) - b)*2.0);
}
int main() {
	Point P1, P2, P3; Segment G; int q;
	while (scanf("%Lf,%Lf,%Lf,%Lf,%Lf,%Lf", &P2.x, &P2.y, &P3.x, &P3.y, &P1.x, &P1.y) != EOF) {
		G.p1 = P2; G.p2 = P3; P2 = reflection(G, P1);
		cout << fixed << setprecision(15) << P2.x << ' ' << fixed << setprecision(15) << P2.y << endl;
	}
	return 0;
}

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

int N, Q;
struct LazySegmentTree {
private:
    int n;
    vector<ll> node, lazy;

public:
    LazySegmentTree(vector<ll> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k] * (r-l);
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k];
                lazy[2*k+2] += lazy[k];
            }
            lazy[k] = 0;
        }
    }

    void add(int a, int b, ll x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};
int main() {
    cin >> N >> Q;
    LazySegmentTree seg( vector<ll>(N, 0) );
    for(int i=0; i<Q; i++) {
        int query; cin >> query;
        if(query == 0) {
            int s, t, x; cin >> s >> t >> x;
            seg.add(s-1, t, x);
        }
        else {
            int s, t; cin >> s >> t;
            cout << seg.getsum(s-1, t) << endl;
        }
    }
    return 0;
}


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

 const int AMAX = 100000;
 long long t[AMAX+1];
 
int main(){
    int N;
    long long K;
    cin >> N >> K;
    for(int i=0; i< N; ++i) {
        int a, b;
        cin >> a >> b;
        t[a] += b;
    }
    
    for(int i=1; i<= AMAX; ++i) {
        if(K <= t[i]){
            cout << i << endl;
            return 0;
        }
        K -= t[i];
    }

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define em emplace_back
#define sqr(x) (x) * (x)
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
    ios_base::sync_with_stdio(0);
    int x, y;
    cin >> x >> y;
    cout << x + y / 2 << '\n';
}


Measured memory_bytes: 256
s = int(input())
i = 1
mae = s
list = [s]
while True:
    i += 1
    if mae%2 == 0:
        y = mae/2
    else:
        y = 3*mae+1
    mae = y
    if list.count(y) == 1:
        print(i)
        break
    list.append(y)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define rep(I,N) for(int I = 0; I < (int)(N); I++)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);


int main(void){
	int N, M;
	vector<int> vec;
	int t;
	cin >> N;
	rep(i, N){
		int a, b, c;
		cin >> a >> b;
		t = (a*3600)+(b*60);
		vec.erase(remove(vec.begin(), vec.end(), t), vec.end());
		vec.push_back(t);
	}
	cin >> M;
	rep(i, M){
		int a, b, c;
		cin >> a >> b;
		t = (a*3600)+(b*60);
		vec.erase(remove(vec.begin(), vec.end(), t), vec.end());
		vec.push_back(t);
	}
	sort(vec.begin(), vec.end());
	rep(i, vec.size()){
		int h = vec[i]/3600;
		vec[i] -= (h*3600);
		int m = vec[i]/60;
		vec[i] -= (m*60);
		cout << h << ":";
		if(m <= 9)cout << "0";
		if(i != vec.size()-1)
			cout << m << " ";
		else cout << m;
	}
	cout << endl;

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

Measured memory_bytes: 1224
/*
 * main.c
 *
 *  Created on: 2020/03/28
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

void yesno(int ans) {
	if (ans == 1) {	printf("Yes\n");
	} else {		printf("No\n");	}
	return;
}

void okng(int ans) {
	if (ans == 1) { printf("OK\n");
	} else { 		printf("NG\n");	}
	return;
}

int main()
{
	int a = 0;
	scanf("%d", &a);
	printf("%d\n", a+(a*a)+(a*a*a));
	//yesno(ans);
	//okng(ans);
	return 0;
}


Measured memory_bytes: 1736
#include <iostream>
#include <cstdio>
#include <vector>
#define N 100005
using namespace std;

int n, ans[N], s[N];
vector<int> a[N], b[N];
void f(int p, int q) {
	int i, z;
	if (s[p] % 2 == 1) ans[p] = 1;
	for (i = 0; i < a[p].size(); i++) {
		z = a[p][i];
		if (z == q) continue;
		s[z] = s[p] + b[p][i];
		f(z, p);
	}
}

int main()
{
	int i, t1, t2, t3;
	cin >> n;
	for (i = 1; i <= n - 1; i++) {
		scanf ("%d %d %d", &t1, &t2, &t3);
		t3 %= 2;
		a[t1].push_back(t2);
		a[t2].push_back(t1);
		b[t1].push_back(t3);
		b[t2].push_back(t3);
	}
	f(1, 0);
	for (i = 1; i <= n; i++) printf("%d\n", ans[i]);
    return 0;
}


Measured memory_bytes: 15488
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max(a, d), max(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

string s, t;
int n, m;
ll ans = 0;
bool exist[26];
set<int> pos[26];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("A.txt", "r", stdin);
    #endif
    cin >> s >> t;
    n = sz(s), m = sz(t);
    for(int i=0; i<n; i++)
    {
        exist[s[i]-'a'] = 1;
        pos[s[i]-'a'].insert(i);
    }
    int cur = -1;
    for(int i=0; i<m; i++)
    {
        char ch = t[i]-'a';
        if(!exist[ch])
        {
            puts("-1");
            return 0;
        }
        auto it = pos[ch].upper_bound(cur);
        if(it==pos[ch].end())
        {
            cur = *pos[ch].begin();
            ans += n;
        }
        else cur = *it;
    }
    cout << ans + cur + 1;
}



Measured memory_bytes: 5200
#include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>
#define vi vector<int>
#define vvi vector<vector<int> > 
#define vl vector<long long>
#define vpi vector<pair<int,int> >
#define ll long long 
#define all(x) x.begin(),x.end()
#define vpl vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define ld long double
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pci pair<char,int>
#define un unsigned
# define M_PI           3.14159265358979323846  /* pi */
// #define mod 998244353
#define mod 1000000007
#define MAXN  1000001
using namespace std; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


void solve()
{
    ll n;
    cin>>n;
    ll ans = 0;
   for(int i = 2 ; i <= 1000010 ; i++)
   {
       int curr = 0;
       while(n%i == 0)
       {
           n /= i;
           curr++;
       }
       for(int j = 1 ; j < 1000 ; j++)
       {
           if(curr < j)
           break;
           curr -= j;
           ans++;
       }
   }
   if(n > 1)
   ans++;
   cout<<ans<<endl;
}


int main()
{
    fast;
    int t;
    t = 1;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;

int dp[MAXN], h[MAXN];
int n;

int solve(int i)
{
	if(dp[i] != -1) return dp[i];

	if(i == n) return 0;

	int caso1 = solve(i + 1) + abs(h[i] - h[i + 1]);

	int caso2;

	if(i + 2 > n) caso2 = 1e9;

	else caso2 = solve(i + 2) + abs(h[i] - h[i + 2]);

	return dp[i] = min(caso1, caso2);
}

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

	memset(dp, -1, sizeof(dp));

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

Measured memory_bytes: 5760
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

//Matsuzaki Number
public class Main{

	void run(){
		int N = 150000;
		Scanner sc = new Scanner(System.in);
		boolean[] p = new boolean[N];
		Arrays.fill(p, true);
		List<Integer> l = new ArrayList<Integer>();
		p[0]=p[1]=false;
		for(int i=2;i<N;i++){
			if(p[i]){
				l.add(i);
				for(int j=i+i;j<N;j+=i)p[j]=false;
			}
		}
		for(;;){
			int n = sc.nextInt(), P = sc.nextInt();
			if(n==-1&&P==-1)break;
			List<Integer> res = new ArrayList<Integer>();
			int k=0;
			while(l.get(k)<=n)k++;
			for(int i=k;i<k+P;i++)for(int j=i;j<k+P;j++)res.add(l.get(i)+l.get(j));
			Collections.sort(res);
			System.out.println(res.get(P-1));
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  ll ans = INFL;
  for (ll x = -100; x <= 100; x++) {
    ll res = 0;
    for (int i = 0; i < v.size(); i++) {
      res += (v[i] - x) * (v[i] - x);
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
s=list(input())
t=list(input())
s.sort()
t.sort(reverse=True)
a=''.join(s)
b=''.join(t)
if a==b:
  print('No')
  exit()
tmp=sorted([a, b])
if tmp[0]==a:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
N, M = list(map(int, input().split()))
a = N * (N - 1) // 2 + M * (M-1) // 2
print(a)
# N, M = list(map(int, input().split()))
# a = N * (N - 1) / 2 + M * (M-1) / 2
# print(int(a))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;
int main() {
   int a, b, c;
   cin >> a >> b >> c;
   int ans = 0;
   for (int x = a; x <= b; x++) {
      if (c % x == 0)
         ans++;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main()
{
	int max=0;
	int n=0;
	int temp=0;
	cin>>n;
	int num[n]={0};
	for(int i=0;i<n;i++)
	{
		cin>>temp;
		num[i]=temp;
	}
	int min=num[0];
	max=num[1]-num[0];
	for(int i=1;i<n;i++)
	{
		if(max<(num[i]-min))
		{
			max=num[i]-min;
		}
		if(min>num[i])
		{
			min=num[i];
		}
	}
	cout<<max<<endl;
	return 0;
 } 


Measured memory_bytes: 3876
#include<cstdio>
#include<queue>
#include<string>
#include<iostream>
#include<map>
#include<algorithm>
#include<set>
using namespace std;

int main(){
  string worm;
  cin>>worm;
  
  while(worm != "0"){
    queue<pair<string,int> >que;
    que.push(make_pair(worm,0));
    set<string> done_str;
    
    int ans = -1;
    
    while(!que.empty()){
      string s = que.front().first;
      int count = que.front().second;
      que.pop();

      string cmp_strR,cmp_strG,cmp_strB;

      cmp_strR.append(worm.size(), 'r');
      cmp_strG.append(worm.size(), 'g');
      cmp_strB.append(worm.size(), 'b');
      
      if(s == cmp_strR || s == cmp_strG || s == cmp_strB ){
	ans = count;
	break;
      }else if(done_str.find(s) != done_str.end()){
	continue;
      }else{
	done_str.insert(s);
      }

      for(int i=0;i<s.size()-1;i++){
	if(s.at(i) != s.at(i+1)){
	  if(s.at(i) != 'r' && s.at(i+1)!='r'){
	    string tmp = s;
	    que.push(make_pair(tmp.replace(i,2,2,'r'),count+1));

	  }else if(s.at(i) != 'g' && s.at(i+1)!='g'){
	    string tmp = s;
	    que.push(make_pair(tmp.replace(i,2,2,'g'),count+1));

	  }else if(s.at(i) != 'b' && s.at(i+1)!='b'){
	    string tmp = s;
	    que.push(make_pair(tmp.replace(i,2,2,'b'),count+1));
	  }
	}
      }
    }

    if(ans < 0){
      cout<<"NA"<<endl;
    }else{
      cout<<ans<<endl;
    }
    
    cin>>worm;
  }

  return 0;
}

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

#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define FILL(v,p) memset(v,p,sizeof v)
#define FIO ios::sync_with_stdio(NULL); cin.tie(NULL)
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define PI acos(-1.0)

const ll MOD = 1000000007;
const ll INF = 2000000000000000001LL;
const ld EPS = 1e-9;

int main()
{
    FIO;
    
    ll n, k;
    cin >> n >> k;
    
    ll c=0;
    while(n) n/=k, c++;
    
    cout << c << endl;
    
    return 0;
}


Measured memory_bytes: 256
/* Stay hungry, stay foolish. */
/* Copyright by HenryLi */
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<sstream>
#include<stack>
#include<ctime>
#include<cmath>
#include<cctype>
#include<climits>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<complex>
using namespace std;
template <class _T> inline void read(_T &_x) {
	int _t; bool _flag=false;
	while((_t=getchar())!='-'&&(_t<'0'||_t>'9')) ;
	if(_t=='-') _flag=true,_t=getchar(); _x=_t-'0';
	while((_t=getchar())>='0'&&_t<='9') _x=_x*10+_t-'0';
	if(_flag) _x=-_x;
}
typedef long long LL;
const int maxk = 100010;
int k;
LL a[maxk];
int main() {
	//freopen("B.in","r",stdin);
	//freopen("B.out","w",stdout);
	read(k);
	for (int i = 1; i <= k; ++i) {
		read(a[i]);
	}
	if (a[k] != 2) {
		puts("-1");
		return 0;
	}
	LL mn = 2, mx = 2;
	for (int i = k - 1; i >= 1; --i) {
		mn = (mn + a[i] - 1) / a[i] * a[i];
		mx = (mx + a[i + 1] - 1) / a[i] * a[i];
		if (mx < mn) {
			puts("-1");
			return 0;
		}
	}
	mx += a[1] - 1;
	cout << mn << ' ' << mx << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		int minDiff = Integer.MAX_VALUE;

		for(int i = 0; i + 2 < s.length(); i++){
			int tmp = Integer.parseInt(s.substring(i, i + 3));
//			System.out.println(tmp);

			minDiff = Math.min(minDiff, Math.abs(753 - tmp));
		}

		System.out.println(minDiff);

	}

}


Measured memory_bytes: 23252
N, X, Y = map(int, input().split())
dis = [0] * (N - 1)

for i in range(1, N):
	for j in range(i + 1, N + 1):
		cmb = min(j - i, abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
		dis[cmb - 1] += 1

[print(i) for i in dis]

Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <climits>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
using namespace std;
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define fi first
#define se second
#define ii pair<int, int>
#define ll long long
#define endl "\n"

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	//freopen("Test.inp", "r", stdin);
	//freopen("Test.out", "w", stdout);
	int n;
	cin >> n;
	vector <int> a(n + 1);
	rep(i, 2, n) {
		int x;
		cin >> x;
		a[x]++;
	}
	rep(i, 1, n) cout << a[i] << endl;
	return 0;
}

Measured memory_bytes: 3984
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
   int s;
   cin>>s;
   int cnt=0;
   if(s==1|s==2) {
     cout<<4;
   }
   else{
     while(s!=4){
      if(s%2==0) s=s/2;
      else s=3*s+1;
      cnt++;
     }
      cout<<cnt+4;
   }
}


Measured memory_bytes: 256
/*  Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+10;

int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N];
int32_t main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+k+1);
    if(k==1||n>=(k))
    {
        cout<<"0"<<endl;
        return 0;
    }
    vector<int>vp;
    for(int i=2;i<=k;i++)
    {
        vp.pb(a[i]-a[i-1]);
    }
    sort(all(vp));
    int sum=0;
    for(int i=0;i<k-n;i++)
    {
        sum+=vp[i];
    }
    cout<<sum<<endl;



    


}

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

using namespace std;

int n;
int k;
vector<int> d;

bool xd(int s)
{
    while(s!=0)
    {
        int t=s%10;
        s/=10;
        for(int i=0;i<k;i++)
        {
            if(t==d[i]) return false;
        }
    }
    return true;
}

int main()
{
    cin>>n>>k;
    for(int i=0;i<k;i++)
    {
        int x; cin>>x;
        d.push_back(x);
    }
    while(1)
    {
        bool ok = xd(n);
        if(ok)
        {
            cout<<n; return 0;
        }
        else n++;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
int h[100010];
long long dp[100010];
int main() {
	int N; cin >> N;
	int K; cin >> K;
	for (int i =0 ; i < N; i++) cin >> h[i];
	for (int i = 0; i < N; i++) dp[i] = INF;
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		int j = 1;
		while(j <= K && i + j < N) {
			chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
			j++;
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<>());
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int ans;
vector<int> a,b,c,d;
int n,m,q;

void cal(vector<int> &A){
  int now=0;
  rep(i,q){
    if(A[b[i]]-A[a[i]]==c[i]) now+=d[i];
  }
  ans=max(ans,now);
}

void dfs(int i, vector<int> A){
  if(A.size()==n+1){
    cal(A); return;
  }
  for(int j=i; j<=m; j++){
    A.push_back(j);
    dfs(j,A);
    A.pop_back();
  }
}

int main(){
  cin>>n>>m>>q;
  a.resize(q);
  b.resize(q);
  c.resize(q);
  d.resize(q);
  rep(i,q) cin>>a[i]>>b[i]>>c[i]>>d[i];
  ans=0;
  vector<int> A;
  A.push_back(1);
  dfs(1,A);
  cout<<ans<<endl;
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int n, m, q, ans;

int main(){
    cin >> n >> m >> q;
    vector<int> v[501];
    for (int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        v[x].push_back(y);
    }
    for (int i = 1; i <= n; i++) sort(v[i].begin(), v[i].end());
    
    for (int i = 0; i < q; i++){
        ans = 0;
        int x, y;
        cin >> x >> y;
        for (int j = x; j <= y; j++){
            int tmp = upper_bound(v[j].begin(), v[j].end(), y) - v[j].begin();
            ans += tmp;
        }
        cout << ans << endl;
    } 
}

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

 ll mod_pow(ll a, ll x) {
   if (x == 0) return 1;
   else if (x % 2 == 1) return a * mod_pow(a, x - 1) % MOD;
   else return mod_pow(a * a % MOD, x / 2) % MOD;
 }

 ll comb(ll n, ll m) {
   ll k = 1, l = 1;
   for (ll i = n - m + 1; i <= n; i++) k = k * i % MOD;
   for (ll i = 1; i <= m; i++) l = l * i % MOD;
   l = mod_pow(l, MOD - 2);
   return k * l % MOD;
 }

 int main() {
   ll X, Y, a, b, ans;
   cin >> X >> Y;

   if ((2 * X - Y) % 3 != 0 || (2 * Y - X) % 3 != 0 || 2 * X - Y < 0 || 2 * Y - X < 0) ans = 0;
   else {
     a = (X + Y) / 3;
     b = min((2 * X - Y) / 3, (2 * Y - X) / 3);
     ans = comb(a, b);
   }

   cout << ans << endl;
 }


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

using namespace std;

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

    vector<int> T(N);

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

    int M;
    cin >> M;

    vector<int> ans(M);
    for (int i = 0; i < M; i++){
        int p, x;
        cin >> p >> x;

        ans[i] = sum - T[p - 1] + x;
    }

    for (int i = 0; i < M; i++){
        cout << ans[i] << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
// She is Pretty pretty!
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6 + 100;
ll dp[N], n, h[N], a[N], t[N];
struct BIT {
#define lowbit(x) x&(-x)
    void update(int x, ll y) {
        for (; x <= n; x += lowbit(x)) {
            t[x] = max(t[x], y);
        }
    }
    ll query(int x) {
        ll res = 0;
        for (; x; x -= lowbit(x)) {
            res = max(res, t[x]);
        }
        return res;
    }
} bit;
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> h[i];
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
        dp[i] = bit.query(h[i]) + a[i];
        bit.update(h[i], dp[i]);
    }
    cout << bit.query(n) << endl;
    return 0;
}

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

int main() {
	int n;
	string s;
	cin >> n >> s;

	int ans = 0;
	for (int i = 2; i < n; i++) {
		if (s.at(i - 2) == 'A') {
			if (s.at(i - 1) == 'B') {
				if (s.at(i) == 'C') {
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;
vector<P> v[30];
int n,m;

int bfs(int s, int t) {
  int d[n+1];
  fill(d,d+n+1,MAX);
  d[s]=0;
  priority_queue<P,vector<P>,greater<P> > que;
  que.push(P(0,s));
  while(!que.empty()) {
    int cost=que.top().F,x=que.top().S;que.pop();
    //PR(cost,x);
    //if(x==t) break;
    for(int i=0; i<v[x].size(); i++) {
      int y=v[x][i].F,c=v[x][i].S;
      if(d[y]<cost+c) continue;
      d[y]=min(d[y],cost+c);
      que.push(P(d[y],y));
    }
  }
  return d[t];
}

int main() {
  cin >> n >> m;
  rep(i,m) {
    int a,b,c,d;
    scanf("%d%*c%d%*c%d%*c%d",&a,&b,&c,&d);
    v[a].pb(P(b,c));
    v[b].pb(P(a,d));
  }
  int s,t,sum,z;
  scanf("%d%*c%d%*c%d%*c%d",&s,&t,&sum,&z);
  sum-=z;
  sum-=bfs(s,t);  sum-=bfs(t,s);
  pr(sum);
  return 0;
}


Measured memory_bytes: 1244
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(a[K-1])

Measured memory_bytes: 3060
while(1):
    try:
        a = [i for i in input().split()]
        stack = []
        l = len(stack)
        for i in a:
            if i == "+":
                x = stack[l-2]
                y = stack[l-1]
                stack.pop()
                stack.pop()
                stack.append(x+y)
            elif i == "-":
                x = stack[l-2]
                y = stack[l-1]
                stack.pop()
                stack.pop()
                stack.append(x-y)
            elif i == "*":
                x = stack[l-2]
                y = stack[l-1]
                stack.pop()
                stack.pop()
                stack.append(x*y)
            elif i == "/":
                x = stack[l-2]
                y = stack[l-1]
                stack.pop()
                stack.pop()
                stack.append(x/y)
            else:
                stack.append(float(i))
        print("{:.6f}".format(stack[0]))
    except EOFError:
        break


Measured memory_bytes: 5600
var input=`
5
MASHIKE
RUMOI
OBIRA
HABORO
HOROKANAI
`;
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n").map(v=> v.trim()).reverse();
var n=arr.pop()-0;
var obj={M:0,A:0,R:0,C:0,H:0}
arr.forEach(v=>{
   if(obj.hasOwnProperty(v[0]))obj[v[0]]++;
});
var ary=[];
for(var k in obj){
   ary.push(obj[k]);  
}
var sum=0;
for(var i=0;i<5;i++){
    for(var j=i+1;j<5;j++){
       for(var k=j+1;k<5;k++){
          sum+=ary[i]*ary[j]*ary[k];
       }
    }
 }
 console.log(sum);

Measured memory_bytes: 17100
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t N, A, B, ans = 0;
    cin >> N >> A >> B;
    ans += N / (A + B) * A;
    N %= (A + B);
    if (N > A){
        ans += A;
    }
    else {
        ans += N;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long int li;


int main(void){
    ll ans=0;
    int s;
    cin >> s;
    int a[1000001];
    a[0]=s;
    for(li i=1;i<=1000000;i++){
        if(a[i-1]%2==0)a[i]=a[i-1]/2;
        if(a[i-1]%2==1)a[i]=a[i-1]*3+1;
    }
    int x=0;
    for(li i=0;i<=1000000;i++)if(a[i]==4){x++;if(x==2){ans = i;break;}}
    if(s==1)ans=3;
    if(s==2)ans=3;
    cout << ans+1 << endl;
    return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    ll x; cin >> x;
    ll y; cin >> y;
    vector <vector<ll>> G(n, vector<ll>());
    REP(i, n-1){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    G[x-1].push_back(y-1);
    G[y-1].push_back(x-1);
    vector<ll> cnt(n, 0);
    REP(i, n){
        vector<ll> distance(n, -1);
        queue<ll> q;
        q.push(i);
        distance[i] = 0;
        while(!q.empty()){
            ll now = q.front();
            q.pop();
            for(auto next: G[now]){
                if (distance[next] != -1){
                    continue;
                }
                distance[next] = distance[now] + 1;
                cnt[distance[next]]++;
                q.push(next);
            }
        }
    }
    REP(i, n-1){
        cout << cnt[i+1]/2 << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=y;i>=x;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
//	ios::sync_with_stdio(false);
//	cin.tie(0);
const int maxx = 2e5+7;
const int maxn = 1e9+7;
typedef long long ll;
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
ll t,n;
int main(){
		ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	ll sum=0;
	rept(i,1,n){
		rept(j,1,n){
			rept(k,1,n){
				sum+=__gcd(i,__gcd(j,k));
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}


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

int main(){

  int K;
  cin >> K;
  
  if(K % 2 == 0){
    cout << (K/2)*(K/2) << endl;
  }
  
  else if(K % 2 == 1){
	cout << (K-1)*(K+1)/4 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int i;
	int k=0;
	int t;
char a;
char b;
scanf("%c%*c%c",&a,&b);
if((a=='H'&&b=='H')||(a=='D'&&b=='D')){
	
	printf("H\n");
	
}else{
	
	printf("D\n");
}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
	int n,m,l,i,t;
	while(1){
		l=0;
		m = 0;
		scanf("%d",&n);
			if(n==0){
				return 0;
			}
			for(t=1;t<=n/2;t++){
				m=0;
				for(i=t;i<n;i++){
					m += i;
					if(m==n){
						l++;
						break;
					}

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

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

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

int main()
{
  int N, A, B;
  string s;

  cin >> N >> A >> B;
  cin >> s;
  int cnt_A = 0, cnt_B = 0, cnt__ = 0;
  rep(i, N)
    {
      if(s[i] == 'c')
	{
	  cout << "No" << endl;
	  continue;
	}
      if(s[i] == 'a')
	{
	  cnt_A++;
	  if(cnt__ < A + B)
	    {
	      cnt__++;
	      cout << "Yes" << endl;
	    }
	  else
	    {
	      cout << "No" << endl;
	    }
	}
      if(s[i] == 'b')
	{
	  cnt_B++;
	  if(cnt__ < A + B && cnt_B <= B)
	    {
	      cnt__++;
	      cout << "Yes" << endl;
	    }
	  else
	    {
	      cout << "No" << endl;
	    }
	}
      
    }
  
  return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL) ; 
	string s ; 
	cin >> s ; 
	if(s.back() != 's')
		s += 's' ; 
	else 
		s += "es" ; 
	cout << s ; 
	return 0 ; 
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int V,E,r; //vertex,edge

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>V>>E>>r;

    WeightedGraph<int> g(V);
    REP(i,E){
        int s,t,d;
        cin>>s>>t>>d;
        g[s].emplace_back(t,d);
    }

    vi dist = dijkstra<int>(g,r);

    REP(i,V){
        if(dist[i]==INT_MAX) cout<<"INF"<<endl;
        else cout<<dist[i]<<endl;
        
    }
    //DEBUG_VEC(dist);
    return 0;
}


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

int main(){
  int p,q,r;
  cin >> p >> q >> r;
  int min = p;
  if(min > q) min = q;
  if(min > r) min = r;

  int a,b;
  if(min == p){
    a = min + q;
    b = min + r;
  }
  else if(min == q){
    a = min + p;
    b = min + r;
  }
  else if(min == r){
    a = min + p;
    b = min + q;
  }

  if(a < b){
    cout << a << endl;
  }
  else{
    cout << b << endl;  
  }

}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int L;
	int a,i;
	
	while(scanf("%d",&L)!=EOF){
		a=1;
		for(i=1;i<=L;i++){
			a+=i;
		}
		printf("%d\n",a);
	}
	return 0 ;
}

Measured memory_bytes: 596
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a =sc.nextInt();
        int b =sc.nextInt();

        if(a==1 && b!=1){
            System.out.println("Alice");
        }else if(b==1 && a!=1){
            System.out.println("Bob");
        }else if(a>b){
            System.out.println("Alice");
        }else if(a==b){
            System.out.println("Draw");
        }else{
            System.out.println("Bob");
        }
    }
}


Measured memory_bytes: 21844
N = int(input())
p = [int(i) for i in input().split()]

cnt = 0
for i in range(N):
  for j in range(i+1,N):
    temp = 0
    good = True
    for k in range(N):
      if k == i:
        if temp > p[j]:
          good = False
          break
        else:
          temp = p[j]
      elif k == j:
        if temp > p[i]:
          good = False
          break
        else:
          temp = p[i]
      else:
        if temp > p[k]:
          good = False
          break
        else:
          temp = p[k]
    if good:
      break
  if good:
    break

temp = 0
good2 = True
for k in range(N):
    if temp > p[k]:
      good2 = False
      break
    else:
      temp = p[k]
    
if good or good2:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 9220
#include <iostream>
#include <algorithm>
#include <array>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vsort(x) sort(x.begin(),x.end())

using int64 = ll;

using namespace std;

int main() {
	int n;
	int cnt;
	cin >> n;
	int a[201][3] = {};
	int ans[201] = {};
	rep(i, 0, n)
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	rep(i, 0, 3){
		rep(j, 0, n){
			cnt = 0;
			rep(k, 0, n){
				if (a[j][i] == a[k][i])
					cnt++;
			}
			if (cnt == 1){
				ans[j] += a[j][i];
			}
		}
	}
	rep(i, 0, n)
		cout << ans[i] << endl;
	return 0;
}

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

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


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    for(int i = 100;i>=0;--i){
        int cnt = 0;
        rep(j,n)if(a[j]>=i)++cnt;
        if(cnt>=i){
            cout<<i<<endl;
            return 0;
        }
    }   
}


Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;

using static System.Console;
using static System.Math;
using System.Numerics;
class MainClass
{
    static void Main()
    {
        SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        Solve();
        Out.Flush();
    }
    //ここにプログラムを入力
    static void Solve()
    {
        var N = long.Parse(Console.ReadLine());
        var n = N;
        int count = 0;
        for (long i = 2; i < Sqrt(N) + 1; i++)
        {
            int c = 0;
            while (n % i == 0)
            {
                n /= i;
                c++;
            }
            count += calc(c);
        }
        if (n != 1) count++;
        WriteLine(count);
    }
    static int calc(int c)
    {
        int ans = 0;
        int n = 1;
        while (c-n >= 0)
        {
            c -= n;
            ans++;
            n++;
        }
        return ans;
    }
}


Measured memory_bytes: 27448
//対角に並べるのが本質
#include <iostream>
#include <string>
#include <vector>
#include <cassert>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int num[10][10];
int row[10];
int col[10];

bool check(int n, int c) {
	int i;
	rep(i, n) if (row[i] != c) return false;
	rep(i, n) if (col[i] != c) return false;
	return true;
}

bool dfs(int n, int y, int x, int c, int id) {
	if (y == n) {
		if (!check(n, c)) return false;
		return true;
	}
	if (x == n) {
		if (row[y] != c) return false;
		return dfs(n, y + 1, 0, c, id);
	}
	bool res = dfs(n, y, x + 1, c, id);
	if (res) return true;
	
	if (x + 1 < n && num[y][x] == 0 && num[y][x + 1] == 0) {
		num[y][x] = id;
		num[y][x + 1] = id;
		row[y]++; col[x]++; col[x + 1]++;
		res = dfs(n, y, x + 1, c, id + 1);
		if (res) return true;
		num[y][x] = 0;
		num[y][x + 1] = 0;
		row[y]--; col[x]--; col[x + 1]--;
	}
	if (y + 1 < n && num[y][x] == 0 && num[y + 1][x] == 0) {
		num[y][x] = id;
		num[y + 1][x] = id;
		row[y]++; row[y + 1]++; col[x]++;
		res = dfs(n, y, x + 1, c, id + 1);
		if (res) return true;
		num[y][x] = 0;
		num[y + 1][x] = 0;
		row[y]--; row[y + 1]--; col[x]--;
	}
	return false;
}

void init(int n) {
	int i, j;
	rep(i, n) {
		rep(j, n) {
			num[i][j] = 0;
		}
		row[i] = 0;
		col[i] = 0;
	}
}

void print(vector<string> pat) {
	int i, j;
	rep(i, pat.size()) cout << pat[i] << endl;
}

vector<string> make(int n) {
	int i, j;
	vector<string> ret(n);
	
	rep(i, n) {
		rep(j, n) {
			if (num[i][j] == 0) ret[i] += ".";
			else ret[i] += (char)('a' + num[i][j] - 1);
		}
	}
	return ret;
}

int main() {
	int n;
	int i, j, k;
	
	cin >> n;
	
	vector<string> pat3, pat4, pat5, pat7;
	dfs(3, 0, 0, 1, 1); pat3 = make(3); init(3);
	dfs(4, 0, 0, 3, 1); pat4 = make(4); init(4);
	dfs(5, 0, 0, 3, 1); pat5 = make(5); init(5);
	dfs(7, 0, 0, 3, 1); pat7 = make(7); init(7);
	
	if (n <= 2) { cout << -1 << endl; }
	else if (n == 3) { print(pat3); }
	else if (n == 6) {
		vector<string> pat(n);
		rep(i, n) {
			rep(j, n) pat[i] += ".";
		}
		rep(i, 2) {
			rep(j, 3) rep(k, 3) pat[3*i + j][3*i + k] = pat3[j][k];
		}
		print(pat);
	}
	else if (n == 7) { print(pat7); }
	else if (n == 11) {
		vector<string> pat(n);
		rep(i, n) {
			rep(j, n) pat[i] += ".";
		}
		rep(i, 4) rep(j, 4) pat[i][j] = pat4[i][j];
		rep(i, 7) rep(j, 7) pat[4+i][4+j] = pat7[i][j];
		print(pat);
	}
	else {
		rep(i, n) {
			if (4 * i > n) break;
			if ((n - 4 * i) % 5 == 0) break;
		}
		if (4 * i > n) assert(0);
		
		int I = i;
		int J = (n - 4 * i) / 5;
		
		vector<string> pat(n);
		rep(i, n) {
			rep(j, n) pat[i] += ".";
		}
		
		rep(i, I) {
			rep(j, 4) rep(k, 4) pat[4*i + j][4*i + k] = pat4[j][k];
		}
		rep(i, J) {
			rep(j, 5) rep(k, 5) pat[4*I + 5*i + j][4*I + 5*i + k] = pat5[j][k];
		}
		print(pat);
	}
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,X;cin>>N>>M>>X;
  vector<vector<int>>V(N,vector<int>(M));
  vector<int>D(N);
  for(int L=0;L<N;L++){
    cin>>D[L];
    for(int R=0;R<M;R++){
      cin>>V[L][R];
    }
  }
  int P=10000000;bool bre=false;
  for (int bit = 0; bit < (1 << N); bit++) {
    long long sum = 0;bool K=true;
    vector<int>E(M);
    for (int i = 0; i < N; i++) {
      if ((bit>>i)&1){
        sum += D[i];
        for(int L=0;L<M;L++)E[L]+=V[i][L];
      }
    }
    for(int L=0;L<M;L++){
      if(E[L]<X){
        K=false;break;
      }
    }
    if(K&&P>sum){
      P=sum;bre=true;
    }
  }
  if(bre)cout<<P<<endl;
  else cout<<-1<<endl;
}


Measured memory_bytes: 3616
#include <stdio.h>

int main() 
{
    int a,b,c = 0;
    scanf("%d %d %d",&a,&b,&c);
    if (a<=b && b<=c)
    {
    printf("%d %d %d\n",a,b,c);
    }
    else if (a<=c && c<=b)
    {
        printf("%d %d %d\n",a,c,b);
    }
    else if (b<=a && a<=c)
    {
       printf("%d %d %d\n",b,a,c);
    }
    else if (b<=c && c<=a)
    {
        printf("%d %d %d\n",b,c,a);
    }
    else if (c<=a && a<=b)
    {
        printf("%d %d %d\n",c,a,b);
    }
    else if (c<=a && b<=a)
    {
        printf("%d %d %d\n",c,b,a);
    }
}


Measured memory_bytes: 2108
module Main where

import Data.Functor

main :: IO ()
main = do
  { [a,b,c] <- getInts
  ; print (sum [ 1 | x <- [a .. b], mod c x == 0])
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

done :: IO ()
done = return ()

Measured memory_bytes: 4128
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void){
  int n;
  cin >> n;
  int a[n], b[n], c[n];
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];

  sort(a, a + n);
  sort(b, b + n);
  sort(c, c + n);

  ll ans = 0;
  rep(i, n) {
    ans += (lower_bound(a, a + n, b[i]) - a)*(n-(upper_bound(c, c+n, b[i])-c));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	m := make(map[int]int, 0)
	for i := 0; i < N; i++ {
		m[nextInt(sc)]++
	}
	if len(m) == N {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 12672
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};


void solve(){ 
    
    ll n,a;
    vector < ll > v;
    cin >> n;
    f1(n) cin >> a, v.pb(a);
	sort(v.begin() , v.end());
	ll ans = 1;
	for(ll i = 0; i < v.size(); i++){
		if( (ll)(1e18)/ans  < v[i]){
			cout << "-1\n";
			return;
		}
		ans *= v[i];
		if(ans == 0){
			cout << "0";
			return;
		}
	} 
    cout << ans;
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 4208
import java.util.Scanner;

public class Main {
	private static long[] a;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		a = new long[n + 1];
		long answer = 0;
		for (int i = 2; i <= n; i++) {
			int t = i;
			for (int j = 2; j <= t; j++) {
				while (t % j == 0) {
					a[j]++;
					t /= j;
				}
			}
		}
		answer += count(74);
		answer += count(24) * (count(2) - 1);
		answer += count(14) * (count(4) - 1);
		answer += count(4) * (count(4) - 1) * (count(2) - 2) / 2;

		System.out.println(answer);
	}

	private static long count(int n) {
		long answer = 0;
		for (int i = 2; i < a.length; i++) {
			if (a[i] >= n) answer++;
		}

		return answer;
	}
}


Measured memory_bytes: 25172