akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

typedef long long LL;

int n;
std::map <std::pair <int, int>, int> mp;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		double x; scanf("%lf", &x);
		LL QAQ = llround(x * 1e9);
		int _2 = 0, _5 = 0;
		while (QAQ % 2 == 0) QAQ /= 2, ++_2;
		while (QAQ % 5 == 0) QAQ /= 5, ++_5;
		++mp[std::make_pair(_2, _5)];
	}
	LL ans = 0;
	for (auto x: mp) for (auto y: mp) if (x.first.first + y.first.first >= 18 && x.first.second + y.first.second >= 18)
		if (x.first == y.first) ans += 1LL * x.second * (x.second - 1) / 2;
		else if (x.first < y.first) ans += 1LL * x.second * y.second;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3884
#include <iostream>
#include <vector>
using namespace std;
int N;
void space(vector<int> &a){
  for(int i = 0; i < N; i++){
    if(i > 0){
      cout << " ";
    }
    cout << a[i];
  }
  cout << endl;
}
void bublesort(vector<int> &a){
  bool flag = true;
  int count = 0;
  for(int i = 0; flag; i++){
    flag = false;
    for(int j = N - 1; j >= i+1; j--){
      if(a[j] < a[j-1]){
        swap(a[j],a[j-1]);
        flag = true;
        count++;
      }
    }
  }
  space(a);
  cout << count << endl;
}

int main(){
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

  bublesort(a);

  return 0;
}


Measured memory_bytes: 3140
///
// File:  a.cpp
// Author: ymiyamoto
//
// Created on Tue Nov 21 21:52:48 2017
//

#include <cstdint>
#include <iostream>
#include <string>
using namespace std;

int32_t main()
{
  string str;
  cin >> str;

  bool is_good = false;
  if ((str[0] == str[1] && str[1] == str[2]) || (str[1] == str[2] && str[2] == str[3])) {
    is_good = true;
  }

  if (is_good) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

// #LIB#

using namespace std;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  vector<ll> p(n);
  rep(i, n) cin >> s[i] >> p[i];
  vector<tuple<string, ll, ll>> rs(n);
  rep(i, n) rs[i] = {s[i], -p[i], i};
  sort(rs.begin(), rs.end());
  itr(x, rs) cout << get<2>(x) + 1 << endl;
}


Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf 1000000000
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second
#define vll vector <ll>

ll dfs(ll x,bool b[],vll v[],ll ans[])
{
    b[x]=1;
    ll temp=0;
    for(ll i=0;i<v[x].size();i++)
    {
        if(!b[v[x][i]])
        {
            temp=max(temp,dfs(v[x][i],b,v,ans));
        }
        else
            temp=max(temp,ans[v[x][i]]);
    }
    return ans[x]=1+temp;
}

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


    ll n,m;
    cin>>n>>m;
    vll v[n+1];
    while(m--)
    {
        ll x,y;
        cin>>x>>y;
        v[x].pb(y);
    }
    ll ans[n+1];
    memset(ans,0,sizeof ans);
    bool b[n+1];
    memset(b,0,sizeof b);
    for(ll i=1;i<=n;i++)
        if(!b[i])
            ans[i]=dfs(i,b,v,ans);
    ll mx=0;
    for(ll i=1;i<=n;i++)
        mx=max(mx,ans[i]);
    cout<<mx-1<<'\n';
}   


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

int main(){
	int N, count = 0;
	cin >> N;
	int *arr = new int[N];
	for(int i = 0; i < N; i++){
		cin >> arr[i];
	}
	
	for(int i = 0; i < N-1; i++){
		for(int j = N-1; j >= i+1; j--){
			if(arr[j-1] > arr[j]){
				int tmp;
				tmp = arr[j-1];
				arr[j-1] = arr[j];
				arr[j] = tmp;
				count++;
			}
		}
	}

	for(int i = 0; i < N; i++){
		cout << arr[i];
		if(i != N-1) cout << " ";
	}

	cout << endl;
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1192
const Debug = function () {
    const stdin = function (text) {
        return '123 6';

    };

    return stdin;
};


const Release = function () {
    const fs = require('fs');
    const stdin = function (text) {
        if (text) console.log(text);
        return fs.readFileSync('/dev/stdin', 'utf8');
    }
    return stdin;
};


const debug = false;

const stdin = debug ? Debug() : Release();
const input = stdin().split(' ').map(x => parseInt(x));

const X = input[0];
const Y = input[1];

const primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29];//, 31, 37];//, 41, 43, 47];
if (X % Y === 0) console.log(-1);
else {
    var h = true;
    for (var i = 0; i < primes.length; i++) {
        var x = X * primes[i];
        if (x > 1000000000000000000) {
            console.log(-1);
            h = false;
            break;
        } else {
            if (x % Y !== 0) {
                console.log(x);
                h = false;
                break;
            }
        }
    }
    if (h) console.log(-1);
}

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

 bool checker(string s){
	int L=s.size();
	int cont=0;
	int lcont=0;

	if(s[0]!='A') return false;
	for(int t=2;t<L-1;t++){
		if(s[t]=='C') cont++;
	}

	for(int m=0;m<L;m++){
		if('A'<=s[m]&&s[m]<='Z') lcont++;
	}
	if(cont==1&&lcont==2) return true;

	return false;
}

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

	if(checker(s)){
		cout<<"AC"<<"\n";
	}else{
		cout<<"WA"<<"\n";
	}

	return 0;
}

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

int main() {
	int n;
	int a[3300];
	int sum = 0;


	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i] - 1;
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

template<typename T>
vector<T> DIVISOR(T n) {
    vector<T> v;
    for (T i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            v.push_back(i);
            if (i != n / i) {
                v.push_back(n / i);
            }
        }
    }
    sort(v.begin(), v.end());
    return v;
}

ll dp[1010][5000];

int main() {
    int N, M; cin >> N >> M;
    vector<ll>cost(M+1, 0LL);
    vector<ll> key(M+1, 0LL);

    vector<ll> dp(5000, INF);
    dp[0]=0LL;

    rep(i,M){
        int a, b, c; cin >> a >> b;
        cost[i+1]=a;

        rep(j, b){
            cin >> c;
            key[i+1] |= (1LL << (c-1));
        }
    }

    for(int i=1; i<=M; i++){
        for(int j=0; j<(1<<N); j++){
            dp[j|key[i]]=min(dp[(j|key[i])], dp[j]+ cost[i]);
        }
    }

    if(dp[(1<<N)-1]==INF){
        cout << -1 << endl;
        return 0;
    }
    cout << dp[(1<<N)-1] << endl;
    return 0;
}

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

int main(){

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

    bool flag = true;

    //存在判定

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = 0; k < n; k++){
                if(a[i][j] > a[i][k] + a[k][j]){
                    flag = false;
                    break;
                }
            }

            if(!flag) break;
        }
        if(!flag) break;
    }


    if(!flag) cout << -1 << endl;
    else{

        long long ans = 0;

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

                bool flag = false;
                //(i, j)を取り除いてもいいですか？
                for(int k = 0; k < n; k++){
                    if(k == i || k == j) continue;


                    if(a[i][j] == a[i][k] + a[k][j]){
                        flag = true;
                        break;
                    }
                }

                if(!flag) ans += (long long)a[i][j];

            }
        }
    
        cout << ans << endl;
    }

    //cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
N = int(input())
w = [input()]
flg = 0
pre = list(w[0])[-1]
for i in range(N-1):
    s = input()
    if s in w or pre != list(s)[0]:
        flg = 1
    pre = list(s)[-1]
    w.append(s)
if flg:
    print('No')
else:
    print('Yes')

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

int main() {
  long long int x;
  cin >> x;
  long long int t = (x / 11) * 2 + 2;
  if (x % 11 == 0) t -= 2;
  else if (x % 11 < 7) t--;

  cout << t << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  char vec[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> vec[i][j];
    }
  }
  
  int64_t ans[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      ans[i][j] = 0;
    }
  }
  
  ans[0][0] = 1;
  int64_t MOD = 1000000007;
  
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(vec[i][j] == '#'){
        continue;
      }
      if(i != 0){
        ans[i][j] += ans[i-1][j];
        ans[i][j] %= MOD;
      }
      if(j != 0){
        ans[i][j] += ans[i][j-1];
        ans[i][j] %= MOD;
      }
    }
  }
  cout << ans[H-1][W-1] << endl;
} 

Measured memory_bytes: 9088
#N件の仕事
#仕事i 作業時間 Ai 締切はBi
#終了時刻がはやいものから取り組む
#２次元配列のソートに使う
from operator import itemgetter
N = int(input())
work = []

ans = True

#現在の時刻
t = 0
for i in range(N):
    Ai,Bi = map(int,input().split())
    work.append([Ai,Bi])
#workを終了時刻のはやいもの順にソート
sorted_work=sorted(work, key=itemgetter(1))
#時間を加算していく
for jikan,shimekiri in sorted_work:
    t += jikan
    if t > shimekiri:
        print('No')
        exit()

print('Yes')




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

using namespace std;
int mp[111];

void answer(bool isPossible) {
    cout << (isPossible ? "Possible" : "Impossible");
    exit(0);
}

int main () {
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;

    int mx = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;

        mp[x]++;
        mx = max(mx, x);
    }

    for (int i = mx; i > mx / 2; --i) {
        //mp[i] -= 2;
        if (mp[i] < 2)
            answer(false);
    }

    for (int i = 0; i < mx / 2; ++i) {
        if (mp[i] > 0)
            answer(false);
    }

    if (mx % 2 == 0 && mp[mx / 2] != 1)
        answer(false);

    if (mx % 2 == 1 && mp[(mx + 1) / 2] != 2)
        answer(false);

    answer(true);
    return 0;
}


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

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

	int a[7];
	for (int i = 0; i < 8; i++){
		a[i] = pow(2, i);
		if(a[i] > N){
			cout << a[i-1] << endl;
			break;
		}
	}
  	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl;
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
#define FOR(i, n) for(ll i = 0; i < n; i++)
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);    
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> subod(N, 0);
    vector<ll> a(N-1);
    for(int i = 0; i < a.size(); i++){
        cin >> a[i];
        subod[a[i]-1]++;
    }
    for(auto &i : subod) cout << i << "\n";
}

Measured memory_bytes: 6364
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int key) {
    Node *y = NIL;
    Node *x = root;
    Node *z = (Node *)malloc(sizeof(Node));

    z->key = key;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    };

    z->parent = y;

    if (y == NIL) {
        root = z;
        return;
    }

    if (key <= y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
};

void preorder(Node *node) {
    if (node == NIL) return;
    cout << " " << node->key;
    preorder(node->left);
    preorder(node->right);
}

void inorder(Node *node) {
    if (node == NIL) return;
    inorder(node->left);
    cout << " " << node->key;
    inorder(node->right);
}

int main() {
    int n, x;
    string op;
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> op;
        if (op == "insert") {
            cin >> x;
            insert(x);
            continue;
        } else {
            inorder(root); cout << endl;
            preorder(root); cout << endl;
            continue;
        }
    }


    return 0;
}












































Measured memory_bytes: 26472
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val k = readLine()!!.split(" ").map { it.toInt() }.sorted()

    var r = 0

    (0 until n).forEach { a ->
        (a + 1 until n).forEach { b ->
            val index = binarySearch(k, k[a] + k[b])
            r += Math.max(0, (index - b))
        }
    }
    println(r)
}

fun binarySearch(list: List<Int>, k: Int): Int {
    var begin = 0
    var end = list.size - 1
    while (begin < end) {
        val mid = (begin + end) / 2 + 1
        if (list[mid] >= k) end = mid - 1
        else begin = mid
    }
    return end
}


Measured memory_bytes: 38720
def main():
    n = int(input())
    a_s = list(map(int, input().split(' ')))

    count = 0
    ans = 0
    _min = 10**9

    for a in a_s:
        if a <= 0:
            count += 1
        ans += abs(a)
        _min = min(_min, abs(a))
    if count % 2 == 1:
        ans -= 2*_min
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 14252
import java.lang.Math

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    var result = Long.MAX_VALUE
    for (i in 1..Math.sqrt(n.toDouble()).toLong()) {
        val j = n / i

        if (n % j == 0L && i + j - 2L < result) {
            result = i + j - 2L
        }
    }

    println(result)
}

Measured memory_bytes: 31660
import re
n = input()
m = re.search('(\d+)\s(\d+)', n)
a = int(m.group(1))
b = int(m.group(2))
i = 0
if a < b:
    i += b
    b -= 1
    if a < b:
        i += b
        print(i)
    else:
        i += a
        print(i)
else:
    i += a
    a -= 1
    if a < b:
        i += b
        print(i)
    else:
        i += a
        print(i)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define COUT(x) cout<<x<<"\n"

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SIZE(v); i++) {a = lcm(a, v[i]);} return a;}


void Main()
{
	ll a,b,c;
	ll result=2;
	string S;
	cin>>a>>b>>c;
	result=min(c,b/a);
	
	cout << result << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
public class Main {
    public static void main (String[] srgs){

        // ??????????????????????????????.
        // ?????????????????? int ?????¨??????????????????.
        java.util.Scanner sc = new java.util.Scanner(System.in);
        int n = sc.nextInt();

        //
        for (int i = 1; i <= n; i ++) {
            if (i % 3 == 0) { System.out.print(" " + i); }
            else {
                if (i % 10 == 3) { System.out.print(" " + i); }
                else {
                    int a = i;
                    while (a > 0) {
                        if (a % 10 == 3) { System.out.print(" " + i); break; }
                        a /= 10;
                    }
                }
            }
        }
        System.out.print("\n");
    }
}

Measured memory_bytes: 28808
import math

def combinations_count(n, r):
    if n == 1 or n == 0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N, M = [int(i.strip()) for i in input().split(' ')]


print(combinations_count(N,2) + combinations_count(M,2))

Measured memory_bytes: 3060
from collections import *


def factors(n):
    div = 2
    l = []
    while div * div <= n:
        if n % div == 0:
            l.append(div)
            n //= div
        else:
            div += 1
    if n != 1:
        l.append(n)
    return Counter(l)


l = factors(int(input()))
z = 0
for k, v in l.items():
    i = 1
    while v >= i:
        z += 1
        v -= i
        i += 1
print(z)

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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var List = new List<string>();
            string end = "-1 -1 -1";
            while (true)
            {
                string s = Console.ReadLine();
                if (s == end)
                {
                    break;
                }
                List.Add(s);
            }

            string seiseki = null;

            for (int i = 0; i < List.Count; i++)
            {

                string[] inputNum = List[i].Split();

                int tyuukan = int.Parse(inputNum[0]);
                int kimatsu = int.Parse(inputNum[1]);
                int saisiken = int.Parse(inputNum[2]);

                int kesseki = -1;
                int sumTK = tyuukan + kimatsu;

                if (tyuukan == kesseki || kimatsu == kesseki)
                {
                    seiseki = "F";
                }
                else if (80 <= sumTK)
                {
                    seiseki = "A";
                }
                else if (65 <= sumTK && sumTK < 80)
                {
                    seiseki = "B";
                }
                else if (50 <= sumTK && sumTK < 65)
                {
                    seiseki = "C";
                }else if (30 <= sumTK && sumTK < 50)
                {
                    if(50 <= saisiken)
                    {
                        seiseki = "C";
                    }
                    else
                    {
                        seiseki = "D";
                    }
                }else if (sumTK < 30)
                {
                    seiseki = "F";
                }
                Console.WriteLine(seiseki);
            }
        }
    }
}


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


public class Main{
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		if(0==(a*b)%2) {
		System.out.println("Even");
		}else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    int n;
    cin >> n;
    if (n == 1)
    {
        cout << "Hello World" << endl;
        return 0;
    }
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
x,y = LI()
f = [0,1,2,1,3,1,3,1,1,3,1,3,1]
if f[x] == f[y]:
    print("Yes")
else:
    print("No")
#B

#C
"""
h,w = LI()
ans = float("inf")
x = w//2
y = h//2
if not w%2:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        ans = min(ans,abs(w*i-x*(h-i)))
else:
    for i in range(1,h):
        if (h-i)%2 == 0:
            ans = min(ans,abs(w*i-w*(h-i)//2))
        if w*i < x*(h-i):
            ans = min(ans,abs(w*i-(x+1)*(h-i)))
        elif w*i < (x+1)*(h-i):
            ans = min(ans,h-i)
        else:
            ans = min(ans,abs(w*i-x*(h-i)))
if not h%2:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        ans = min(ans,abs(h*i-y*(w-i)))
else:
    for i in range(1,w):
        if (w-i)%2 == 0:
            ans = min(ans,abs(h*i-h*(w-i)//2))
        if h*i < y*(w-i):
            ans = min(ans,abs(h*i-(y+1)*(w-i)))
        elif h*i < (y+1)*(w-i):
            ans = min(ans,w-i)
        else:
            ans = min(ans,abs(h*i-y*(w-i)))
print(ans)
"""

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


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

int main() {
    int n, m;
    cin >> n >> m;
    pi edge[m];
    vector<int> to[n];
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edge[i] = make_pair(a, b);
        to[a].push_back(b);
        to[b].push_back(a);
    }

    int ans = 0;
    for (int i = 0; i < m; i++) {
        int f = edge[i].first;
        int s = edge[i].second;
        bool check[n];
        for (int j = 0; j < n; j++) check[j] = false;
        check[0] = true;
        queue<int> que;
        que.push(0);
        while (que.size() > 0) {
            int p = que.front();
            que.pop();
            for (int np : to[p]) {
                if (check[np]) continue;
                if (p == f && np == s || p == s && np == f) continue;
                check[np] = true;
                que.push(np);
            }
        }
        bool conn = true;
        for (int j = 0; j < n; j++) {
            if (!check[j]) conn = false;
        }
        if (!conn) ans++;
    }

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {
	char S[3];
	scanf("%s", S);
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == '1')ans++;
	}
	printf("%d", ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string s, t;
  cin >> s;
  cin >> t;

  rep(i,N+1){
    string tmp = s + t.substr(N-i,i+1);
    bool flg = true;
    rep(j,N){
      if(tmp[j] != s[j]) flg = false;
      if(tmp[tmp.size()-1-j] != t[N-1-j]) flg = false;
    }
    if(flg){
      cout << tmp.length() << endl;
      break;
    }
  }

  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> dp(100010);
    int INF = 100000;
    for(int i = 0; i < 100010; i++)
    {
        dp[i] = INF;
    }
    dp[0] = 0;

    for(int i = 0; i <= n; i++)
    {
        for(int j = 1; i + j <= n; j *= 6)
        {
            dp[i+j] = min(dp[i+j], dp[i] + 1);
        }
        for(int j = 1; i + j <= n; j *= 9)
        {
            dp[i+j] = min(dp[i+j], dp[i] + 1);
        }
    }
    cout << dp[n] << endl;
}


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

using namespace std;

constexpr int MAX_N = 200200;
constexpr int MOD = 1000000007;

int n;
int arr[MAX_N];
int dp[MAX_N];
int last[MAX_N];

int main() {
    memset(last, -1, sizeof(last));

    scanf(" %d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf(" %d", &arr[i]);
    }

    dp[0] = 1;
    for (int i = 1; i <= n; ++i) {
        dp[i] = dp[i-1];
        if (last[arr[i]] != -1 && last[arr[i]] != i-1)
            dp[i] = (dp[i] + dp[last[arr[i]]]) % MOD;

        last[arr[i]] = i;
    }

    printf("%d\n", dp[n]);

    return 0;
}


Measured memory_bytes: 2560
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

const int MOD = 100000;

LL  n, m, s;
LL dp[50][4005];

int main() {
	while ((cin >> n >> m >> s) && (n || m || s)){
	n *= n;
	for (int i = 0; i < 50; i++)for (int j = 0; j < 4005; j++)dp[i][j] = 0;
	dp[0][0] = 1;
	for (int i = 1; i <= m; i++) {
		for (LL j = n; j >= 1; j--) {
			for (int k = i; k <= s; k++) {
				(dp[j][k] += dp[j - 1][k - i]) %= MOD;
			}
		}
	}
	cout << dp[n][s] << endl;
}
}

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

int main(){
  string s;
  cin >> s;
  int cnt=0;
  if(s[0]=='+')cnt++;
  else cnt--;
  if(s[1]=='+')cnt++;
  else cnt--;
  if(s[2]=='+')cnt++;
  else cnt--;
  if(s[3]=='+')cnt++;
  else cnt--;
  cout << cnt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define MAX 100005
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


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


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a[5], n, res, t;

signed main() {
	cin >> n;
	rep(i,5) cin >> a[i];
	t = *min_element(a,a+5);
	rep(i,5) if (a[i]==t) {
		res = (n+a[i]-1)/a[i] + 4;
		break;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> 
// using namespace __gnu_pbds;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MaX 300005
using namespace std;

 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
// typedef tree<int, null_type, less<int>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//     new_data_set; 
bool isprime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}

bool check(int r,int g,int b)
{
	if(r<g and g<b)
	{
		return true;
	}
	return false;
}

int main() 
{
	fast();
	int k,r,g,b;
	cin>>r>>g>>b>>k;
	if(r<g and g<b)
	{
		cout<<"Yes";
		exit(0);
	}
	while(k--)
	{
		if(r>=g){
			g*=2;
			continue;
		}
		if(g>=b)
		{
			b*=2;
		}
				
	}
	if(check(r,g,b))
		cout<<"Yes";
	else
	cout<<"No";

	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n, m, i, c = 0;
	cin >> n;
	vector<long> vN(n, 0);
	for(i = 0; i < n; ++i) cin >> vN[i];
	cin >> m;
	vector<long> vM(m, 0);
	for(i = 0; i < m; ++i) cin >> vM[i];
	std::sort(vN.begin(), vN.end());
	for(i = 0; i < m; ++i){
		if(std::binary_search(vN.begin(), vN.end(), vM[i]))
			++c;
	}

	cout << c << "\n";

	return 0;
}

Measured memory_bytes: 1292
#include<bits/stdc++.h>
using namespace std;
int main(){
	int z,a,b,flag=0;
	cin>>z>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%z==0){
			flag=1;
			cout<<"OK"<<endl;
			break;
		}
	}
	if(flag==0) cout<<"NG"<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

#define MOD 998244353
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);


ll arr[100001];
bool vis[100001];
ll lvl[100001];



ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll pow(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }

return ans;
}


/*const int N=200000;

ll fac[N+1];
ll inv[N+1];
ll p=998244353;

ll c(ll a, ll b,ll m)
{
  if(a<b)return 0;
  return (fac[a]*inv[b]%m)*(inv[a-b])%m;
}

void fill()
{
inv[0]=1;
fac[0]=1;

for(int i=1;i<=N;i++)
{
  fac[i]=fac[i-1]*i%p;
  inv[i]=powM(fac[i],p-2,p);
}

}
*/
//ld dp[2001][2001];


ll f(ll x)
{
  ll cnt=0;
  while(x)
  {
    x/=10;
    cnt++;
  }
  return 0;
}

int main()
{  fast


ld n;cin>>n;


vector<ld>a(n);
ld ans=1;
ll cnt=0;

for(ld i=0;i<n;i++)
{
  cin>>a[i];
  if(!a[i])
  {
    cout<<0;
    return 0;
  }
}



for(ld i=0;i<n;i++)
{
 // cin>>a[i];
  ans*=a[i];
  if(ans>1e18)break;
}

if(ans>1e18)cout<<-1;
else cout<<(ll)ans<<"\n";



 return 0;

}


Measured memory_bytes: 4876
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define deb(X) std::cerr << ">>> deb(" << __LINE__ << \") " << #X << " = " << (X) << std::endl
//#undef deb
//#define deb(X) (void)0
int32_t main()
{
	fast();
	int t=1;
//	cin>>t;
	while(t--)
	{
		int l,r,d;
		cin>>l>>r>>d;
		cout<<r/d-(l-1)/d<<endl;
		
	}
}







Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace  std;
#define mp make_pair
#define pb push_back
const long double pi=3.1415926535897932384626433832;
const long long mod=1e9+7;
//long long primeset[5000000]={};
typedef complex<double> cd;
typedef long long ll;
//#define For(i,0,n) for(int i = 0 ; i<n ;i++) 
cd fast_exp(cd a, long long b)
{
	if (b == 0)
		return 1;
	
	cd res = fast_exp(a, b / 2);
	
	res = res * res;
	
	if (b % 2 == 1)
		res = res * a;
	
	return res;
}
int b[6000][6000];
long long fastexpon(long long a,long long b,long long mod)
{
	if(b==0)
		return 1;
	
	long long res=fastexpon(a,b/2,mod);
	
	res=(res*res)%mod;
	if(b%2==1)
		res= (res * a)%mod;

	return res;
}
//long long freq[(long long)1e7*3]={};
int a[(int)1e5][3];
ll dp[(int)1e5][3];
int k,n;

ll maxcost(int x, int ch)
{
	if(x==n)
		return 0;
	if(dp[x][ch]>-1)
		return dp[x][ch];
	else
	{
		ll maxim= (ll)0;
		int cur;
		for(int i=0;i<=2 ;i++)
		{
			if(i != ch)
			{
				cur=maxcost(x+1,i)+a[x][i];
				if(maxim<cur)
				{
					maxim=cur;

				}
			}
		}

		dp[x][ch]=maxim;
		return dp[x][ch];	

	}
}
int main()
{
	//memset(ncandidate,0,sizeof(ncandidate));	
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 memset(dp,-1,sizeof(dp));
	
	cin>>n;
	for(int i=0;i<n;i++)
		{
			cin>>a[i][0]>>a[i][1]>>a[i][2];
			//cout<<dp[i][0]<<'\n';
		}	
	cout<<max(maxcost(1,2)+a[0][2],max(a[0][0]+maxcost(1,0),a[0][1]+maxcost(1,1)));

	 

	 	//	cerr<<'\n'<<"time elapsed: "<<clock()*1000.0 / CLOCKS_PER_SEC<<" ms"<<'\n';
	return 0;
}

Measured memory_bytes: 10624
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>

using namespace std;
typedef long long ll;

ll N, a[10001] = {}, b[10001] = {}, c[10001] = {}, num[10001] = {}, ans1 = 0, ans2[10001] = {}, box = 1;
vector<vector<ll>> neighbor(10001);
bool visited[10001] = {};

void DFS(ll curent) {
	for (int i = 0; i < neighbor[curent].size(); i++) {
		visited[curent] = true;
		if (!visited[neighbor[curent][i]]) {
			ans1 += min(ans2[curent], ans2[neighbor[curent][i]]);
			DFS(neighbor[curent][i]);
		}
	}
}

int main() {
	cin >> N;
	for (int i = 1; i < N; i++) {
		cin >> a[i] >> b[i];
		num[a[i]]++;
		num[b[i]]++;
		neighbor[a[i]].push_back(b[i]);
		neighbor[b[i]].push_back(a[i]);
	}
	for (int i = 1; i <= N; i++)cin >> c[i];
	stable_sort(c, c + N + 1);
	while (1) {
		bool flag = false;
		vector<ll>vec;
		for (int i = 1; i <= N; i++) {
			if (num[i] == 1 || num[i] == 0) {
				vec.push_back(i);
				flag = true;
			}
		}
		if (!flag)break;
		for (int i = 0; i < vec.size(); i++) {
			ans2[vec[i]] = c[box];
			num[vec[i]] = -1;
			for (int j = 0; j < neighbor[vec[i]].size(); j++)num[neighbor[vec[i]][j]]--;
			box++;
		}
	}
	DFS(1);
	cout << ans1 << endl;
	for (int i = 1; i < N; i++)cout << ans2[i] << " ";
	cout << ans2[N] << endl;
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,temp;
	while(1){
		cin >> n;
		if(n==0) break;
		int a[n],sa[n-1],min=1000000;
		for(int i=0;i<n;i++){
			cin >> a[i];
		}
		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				if(a[i]>a[j]){
					temp=a[i];
					a[i]=a[j];
					a[j]=temp;
				}
			}
		}
		for(int i=1;i<n;i++){
			if(a[i]>a[i-1]){
				sa[i]=a[i]-a[i-1];
			}else{
				sa[i]=a[i-1]-a[i];
			}
			if(min>sa[i]){
				min=sa[i];
			}
		}
		cout << min << endl;
	}
}
		


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll a,b,c; cin>>a>>b>>c;
    if(a+b+c==17) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 3560
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n↑入力 ↓出力');
  Main();
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var s = next();
  var N = s.length;
  var dp0 = new Array(N + 1).fill(0);
  var dp1 = new Array(N + 1).fill(0);
  dp0[0] = 1;
  var mod = 1000000007;
  for(var i = 1; i <= N; i++){
    if(s[i - 1] == "1"){
        dp0[i] = dp0[i - 1] * 2 % mod;
        dp1[i] = (dp0[i - 1] + dp1[i - 1] * 3) % mod;
      }else{
        dp0[i] = dp0[i - 1];
        dp1[i] = (dp1[i - 1] * 3) % mod;
      }
  }
  var output = dp0[N] + dp1[N];
  myout(output % mod);
}


Measured memory_bytes: 36604
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    var N = parseInt(input[0]);
    var a = Math.ceil(N/2);
    console.log(a);
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  int N, flag=0;
  cin >> N;
  
  string S[N];
  for(int i=0;i<N;i++) {
    cin >> S[i];
    if(S[i] == "Y") {
      flag = 1;
      break;
    }
  }
  
  if(flag == 0) {
    cout << "Three" << endl;
  }
  else if (flag == 1) {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b, c;
    int d = 3;
    std::cin >> a >> b >> c;
    if (a != b && a != c && b != c)
    {
        cout << d << endl;
    }
    else if (a == b && a == c)
    {
        cout << d-2 << endl;
    }
    else
    {
        cout << d-1 << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	LL K,A,B;
	cin>>K>>A>>B;
	LL ans = 1;
	if(K<=A){
		cout << ans << endl;
		return;
	}
	if(A-B <= 0 ){
		cout << -1 << endl;
		return;
	}
	
	//ans = (K-A+A-B-1)/(A-B);
	ans = (K-B-1)/(A-B);
	cout << ans*2 + 1 << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
from math import gcd 

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

Bc = B // C
Bd = B // D

G = gcd(C,D)
L = int(C*D/G)

Bl = B//L

RangeB = B-(Bc+Bd-Bl)

Ac = (A-1) // C
Ad = (A-1) // D
Al = (A-1) // L

RangeA = (A-1)-(Ac+Ad-Al)

print(RangeB-RangeA)

Measured memory_bytes: 62116