akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int coins; cin >> coins;
	int hap1 = coins/500;
	int rem = coins - (hap1*500);
	int hap2 = rem/5;
	hap1 = hap1 * 1000;
	hap2 = hap2 * 5;
	cout << hap1+hap2 << endl;	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vector<int> v(N);
  rep(i, 0, N) { cin >> v[i]; }
  sort(all(v),greater<int>());
  int a = 0, b = 0;
  rep(i, 0, N) {
    if (i & 1)
      b += v[i];
    else
      a += v[i];
  }
  cout << a - b << endl;

  return 0;
}


Measured memory_bytes: 256
local N, M, X = io.read("*n", "*n", "*n")
local A = {}
for i = 1, M do
    A[i] = io.read("*n")
end

local left = 0
local right = 0
for i = 1, N+1 do
    for j = 1, M do
        if i == A[j] and X < i then
            right = right + 1
        elseif i == A[j] and X > i then
            left = left + 1
        end
    end
end

print(math.min(left, right))

Measured memory_bytes: 888
X, Y = map(int, input().split())
award = [300000, 200000, 100000]
ans = 0

if X <= 3:
    ans += award[X-1]

if Y <= 3:
    ans += award[Y-1]

if X == 1 and Y == 1:
    ans += 400000

print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	lint N, M;
	cin >> N >> M;
	if (N == 1 && M == 1) {
		cout << 1 << endl;
	}
	else if (N == 1) {
		cout << M - 2 << endl;
	}
	else if (M == 1) {
		cout << N - 2 << endl;
	}
	else {
		cout << (N - 2) * (M - 2) << endl;
	}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
struct P {
  int x, y;
  P(int x_, int y_) : x(x_), y(y_) {}
  P() {}
  bool operator ==(const P &other) const {
    return x == other.x && y == other.y;
  }
  bool operator !=(const P &other) const {
    return !(*this == other);
  }
};
ostream &operator <<(ostream &os, const P &p) {
  os << "(" << p.x << "," << p.y << ")";
  return os;
}
int direction(const P &p) {
  if (p.y == 0 && p.x > 0) return 0;
  if (p.y > 0 && p.x == 0) return 3;
  if (p.y == 0 && p.x < 0) return 2;
  return 1;
}
P rot(const P &p, int direction) {
  if (direction == 0) return p;
  if (direction == 1) return P(-p.y, p.x);
  if (direction == 2) return P(-p.x, -p.y);
  return P(p.y, -p.x);
}
bool same(const vector<P> &a, const vector<P> &b) {
  if (a.size() != b.size()) return false;
  int N = a.size();
  vector<P> l(N), r(N);
  REP(i,N) {
    l[i] = P(a[i].x - a[0].x, a[i].y - a[0].y);
    r[i] = P(b[i].x - b[0].x, b[i].y - b[0].y);
  }
  bool ok = true;
  for(int i = 1; i < N; i++) {
    if(rot(l[i], direction(l[1])) != rot(r[i], direction(r[1]))) ok = false;
  }
  // if(ok) {
  //   cerr << "[";
  //   REP(i,N) cerr << l[i];
  //   cerr << "] = [";
  //   REP(i,N) cerr << r[i];
  //   cerr << "]" << endl;
  // }
  if(ok) return true;
  REP(i,N) {
    l[i] = P(a[i].x - a[0].x, a[i].y - a[0].y);
    r[i] = P(b[N - 1 - i].x - b[N - 1].x, b[N - 1 - i].y - b[N - 1].y);
  }
  ok = true;
  for(int i = 1; i < N; i++) {
    if(rot(l[i], direction(l[1])) != rot(r[i], direction(r[1]))) ok = false;
  }
  // if(ok) {
  //   cerr << "[";
  //   REP(i,N) cerr << l[i];
  //   cerr << "] = [";
  //   REP(i,N) cerr << r[i];
  //   cerr << "]" << endl;
  // }
  if(ok) return true;
  return false;
}
signed main() {
  ios::sync_with_stdio(false);
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    vector<vector<P>> DS(N + 1);
    REP(i,N + 1) {
      int M; cin >> M;
      vector<P> D(M);
      REP(j,M) {
        int x, y; cin >> x >> y;
        D[j] = P(x, y);
      }
      DS[i] = D;
    }
    for(int i = 1; i <= N; i++) {
      if(same(DS[0], DS[i])) {
        cout << i << endl;
      }
    }
    cout << "+++++" << endl;
  }
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

unsigned int gcd(unsigned int a, unsigned int b)
{
  if (a == 0)
    return b;
  else if (b == 0)
    return a;
  else if (a > b)
    return gcd(b, a % b);
  else
    return gcd(a, b % a);
}

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

  vector<int> x(N);
  rep(i, N)
  {
    cin >> x[i];
  }

  x.emplace_back(X);

  std::sort(x.begin(), x.end());

  int gcd_ = x[1] - x[0];
  rep(i, x.size() - 1)
  {
    gcd_ = gcd(gcd_, x[i + 1] - x[i]);
  }

  cout << gcd_ << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	int a[1000], b[1000], c[1000], dist[100][100];
	rep(i, m) {
		cin >> a[i] >> b[i] >> c[i]; a[i]--; b[i]--;
	}
	rep(i, n) {
		rep(j, n) {
			if (i == j) {
				dist[i][j] = 0;
			}
			else {
				dist[i][j] = INF;
			}
		}
	}
	rep(i, m) {
		chmin(dist[a[i]][b[i]], c[i]);
		chmin(dist[b[i]][a[i]], c[i]);
	}
	rep(k, n) {
		rep(i, n) {
			rep(j, n) {
				chmin(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	int ans = m;
	rep(i, m) {
		bool shortest = false;
		rep(j, n) {
			if (dist[j][a[i]] + c[i] == dist[j][b[i]])shortest = true;
		}
		if (shortest) {
			ans--;
		}
	}
	COUT(ans);
	return 0;
}

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

using Graph = vector<vector<int>>;

int dfs(const auto& G, auto v) {
  vector<int> height;
  for(auto to: G[v]) height.emplace_back(dfs(G, to));
  sort(begin(height), end(height), greater<int>());
  auto res = 0;
  for(auto i = 0; i < height.size(); ++i) res = max<int>(res, height[i] + i + 1);
  return res;
}

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

  Graph G(N);
  for(auto i = 1; i < N; ++i) {
    int a;
    cin >> a;
    --a;
    G[a].emplace_back(i);
  }

  cout << dfs(G, 0) << endl;
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(void){
    vector<vector<int>>bingo(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin >> bingo[i][j];
        }
    }
    int n; cin >>n;
    for(int i=0;i<n;i++){
        int b; cin >> b;
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(b==bingo[j][k]){
                    bingo[j][k]=-1;
                }
            }
        }
    }

    // for(int i=0;i<3;i++){
    //     for(int j=0;j<3;j++){
    //         cout << bingo[i][j] << ' ';
    //     }cout << endl;
    // }cout << endl;

    bool flag = false;
    for(int i=0;i<3;i++){
        flag=false;
        for(int j=0;j<3;j++){
            if(bingo[i][j]!=-1) flag=true;
        }
        if(flag==true) continue;
        cout << "Yes" << endl;
        return 0;
    }

    for(int i=0;i<3;i++){
        flag=false;
        for(int j=0;j<3;j++){
            if(bingo[j][i]!=-1) flag=true;
        }
        if(flag==true) continue;
        cout << "Yes" << endl;
        return 0;
    }
    flag=false;
    for(int i=0;i<3;i++){
        if(bingo[i][i]!=-1)flag = true;
    }
    if (flag!=true){
        cout << "Yes" << endl;
        return 0;
    } 

    flag=false;
    for(int i=0;i<3;i++){
        if(bingo[i][2-i]!=-1)flag = true;
    }
    if (flag!=true){
        cout << "Yes" << endl;
        return 0;
    } 

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#define ll long long
#define maxn 100010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static int buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10;
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]+'0');
}
inline void writeln(ll x){write(x); putchar('\n');}
inline void writesp(ll x){write(x); putchar(' ');}
int a[maxn];
int n;
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read();
	int mx=-1,mxid=0;
	for(int i=1;i<=n;i++)
		if(std::abs(a[i])>mx)mx=std::abs(a[i]),mxid=i;
	writeln(2*n-2);
	for(int i=1;i<=n;i++)
		if(i!=mxid)printf("%d %d\n",mxid,i);
	if(a[mxid]>0){
		for(int i=1;i<n;i++)
			printf("%d %d\n",i,i+1);
	}
	else{
		for(int i=n-1;i;i--)
			printf("%d %d\n",i+1,i);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for(int i = a; i < b; i++)
#define fastio ios::sync_with_stdio(0); cin.tie(0);

int main() {
	fastio;
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;
	s[k-1] = s[k-1] - 'A' + 'a';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a[26];
int32_t main()
{
    nitro
    string s;cin>>s;
    for(char x:s){
    	if(islower(x)) a[x-'a']++;
    }
    for(auto x:a){
    	if(x%2!=0) return puts("No")*0;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int k,a,b,i;
  scanf("%d%d%d", &k, &a, &b);
  if(a%k==0){
    printf("OK");
  }
  else if(b%k==0){
    printf("OK");
  }
  else if(b/k>a/k){
    printf("OK");
  }
  else{
    printf("NG");
  }
  return 0;
}



Measured memory_bytes: 1728
n = int(input())
A = input().split(' ')

if n == 1:
    ans = A[0]
    print(ans)
    exit()
else:
    A_odd = A[::2]
    A_even = A[1::2]
    if n % 2 == 0:
        ans = A_even[::-1] + A_odd
    else:
        ans = A_odd[::-1] + A_even
    print(' '.join(ans))


Measured memory_bytes: 26948
#include <iostream>                                                  
#include <string>                                                    
using namespace std;                                                 
                                                                     
int main() {                                                         
  string s, p;                                                       
  cin >> s >> p;                                                     
  s+=s;                                                              
  if (s.find(p)!=-1) {                                               
    cout << "Yes" << endl;                                           
  } else {                                                           
    cout << "No" << endl;                                            
  }                                                                  
  return 0;                                                          
}                                                                    
                                                                     
                                                                     
                                                                     
            

Measured memory_bytes: 3184
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>
#include <bitset>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  ll x, y;
  cin >> x >> y;
  if(abs(x - y) <= 1)cout << "Brown" << endl;
  else cout << "Alice" << endl;
	return 0;
}


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

#define Mod 1000000007

typedef struct List {
	struct List *prev, *next;
	long long v;
} list;

int main()
{
	int N, A, B;
	scanf("%d %d %d", &N, &A, &B);
	if (A > B) {
		B += A;
		A = B - A;
		B -= A;
	}
	
	int i, j, k;
	list **head = (list**)malloc(sizeof(list*) * B), **tail = (list**)malloc(sizeof(list*) * B), *d = (list*)malloc(sizeof(list) * B * (A + 1)), *p;
	long long ans = 0, dp[2][5001], tmp[2], pow;
	if (A == 1 || B == 1) {
		for (i = 1, ans = 1; i <= N; i++) ans = ans * 2 % Mod;
	} else if (A == B) {
		for (j = A - 2, dp[A%2][A-1] = 2; j >= 1; j--) dp[A%2][j] = dp[A%2][j+1] * 2 % Mod;
		for (i = A + 1, ans = 2; i <= N; i++) {
			ans = (ans * 2 + dp[1-i%2][A-1]) % Mod;
			for (j = A - 2, dp[i%2][1] = dp[1-i%2][A-1]; j >= 1; j--) {
				dp[i%2][j+1] = dp[1-i%2][j];
				dp[i%2][1] += dp[1-i%2][j];
			}
			dp[i%2][1] %= Mod;
		}
	} else {
		for (j = 0; j <= B - 1; j++) {
			head[j] = &(d[j*(A+1)]);
			tail[j] = &(d[j*(A+1)+A]);
			d[j*(A+1)].v = 0;
			d[j*(A+1)].prev = &(d[j*(A+1)+A]);
			d[j*(A+1)+A].next = &(d[j*(A+1)]);
			for (k = 1; k <= A; k++) {
				d[j*(A+1)+k].v = 0;
				d[j*(A+1)+k].prev = &(d[j*(A+1)+k-1]);
				d[j*(A+1)+k-1].next = &(d[j*(A+1)+k]);
			}
		}
		d[1].v = 1;
		d[A+1].v = 1;
		for (i = 2, pow = 2; i <= N; i++, pow = pow * 2 % Mod) {
			for (j = 0, tmp[0] = 0; j <= B - 1; j++) tmp[0] += head[j]->v + tail[j]->v;
			tmp[0] = (pow - ans - tmp[0] + tail[B-A]->v) % Mod;
			if (tmp[0] < 0) tmp[0] += Mod;
			ans = (ans * 2 + head[B-1]->v + tail[B-A]->prev->v + tail[B-A-1]->v * 2) % Mod;
			
			for (j = B - 1, tmp[1] = head[B-A]->v; j > B - A; j--) {
				tmp[1] += head[j]->v;
				head[j]->v = head[j-1]->v;
				if (j >= A + 1) head[j]->v = (head[j]->v + tail[j-A-1]->v) % Mod;
			}
			head[B-A]->v = tmp[1] % Mod;
			tail[B-A]->v = head[B-A-1]->v;
			if (B - A >= A + 1) tail[B-A]->v += tail[B-A*2-1]->v;
			tail[B-A]->v %= Mod;
			head[B-A] = tail[B-A];
			tail[B-A] = tail[B-A]->prev;
			for (j = B - A - 1; j >= A + 1; j--) {
				tail[j]->prev->v = (tail[j]->prev->v + tail[j-1]->v) % Mod;
				tail[j]->v = (head[j-1]->v + tail[j-A-1]->v) % Mod;
				head[j] = tail[j];
				tail[j] = tail[j]->prev;
			}
			for (; j >= 1; j--) {
				tail[j]->prev->v = (tail[j]->prev->v + tail[j-1]->v) % Mod;
				tail[j]->v = head[j-1]->v;
				head[j] = tail[j];
				tail[j] = tail[j]->prev;
			}
			head[1]->v = tmp[0];
			head[0] = tail[0];
			tail[0] = tail[0]->prev;
			head[0]->v = 0;
		}
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

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

using namespace std;
const int maxN=3e2+100;
int n,m,st,fn;
int cap[maxN][maxN],excess[maxN],height[maxN];
vector<int> g[maxN];
set<pair<int,int> > candidates;

void input()
{
  cin>>n>>m;
  //cin>>st>>fn;
  st=1; fn=n;
  for(int i=1;i<=m;i++)
    {
      int k1,k2,val;
      cin>>k1>>k2>>val;
      k1++;k2++;
      if(cap[k1][k2]==0 && cap[k1][k2]==0){
	g[k1].push_back(k2);
	g[k2].push_back(k1);
      }
      cap[k1][k2]+=val;
    }
}
int findExcessedVertex()
{
  int v=0;
  height[0]=-1;
  for(int i=1;i<=n;i++)
    if(excess[i]>0 && height[i]>height[v] && i!=st && i!=fn)
      v=i;
  return v;
}
bool push(int v)//change to multi push
{
  bool done=false;
  for(auto u :g[v])
    if(cap[v][u]>0 && height[v]==height[u]+1)
      {
	int delta=min(excess[v],cap[v][u]);
	cap[v][u]-=delta;
	cap[u][v]+=delta;
	excess[v]-=delta;
	if(excess[v]==0)
	  candidates.erase({height[v],v});
	if(excess[u]==0)
	  candidates.insert({height[u],u});
	excess[u]+=delta;
	done=true;
	return done;
      }
  return done;
}
void relabel(int v)
{
  height[v]++;
  if(candidates.find({height[v]-1,v})!=candidates.end()){
    candidates.erase({height[v]-1,v});
    candidates.insert({height[v],v});}
}
void GT_init()
{
  height[st]=n;
  height[fn]=0;//not done
  for(auto u:g[st])
    {
      int delta=cap[st][u];
      cap[st][u]-=delta;
      cap[u][st]+=delta;
      excess[st]-=delta;
      if(excess[st]==0)
	candidates.erase({height[st],st});
      if(excess[u]==0)
	candidates.insert({height[u],u});
      excess[u]+=delta;
    }
}
int Goldberg_Tarjan()
{
  GT_init();
  while(int v=findExcessedVertex())
    {
      
      //cout<<"gt"<<v<<endl;
      if(!push(v))
	relabel(v);
    }
  return excess[fn];
}
int main()
{
  input();
  int Maxflow=Goldberg_Tarjan();
  cout<<Maxflow<<endl;
  
  return 0;
}

Measured memory_bytes: 3364
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int

	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	ans := a[0]
	c := 1
	for i := 1; i < n-1; i++ {
		ans += a[c]
		if i%2 == 0 {
			c++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 6500
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))

max_diff = 0

for i in range(len(A)):
    if i == 0:
        max_diff = abs(K - A[-1]) + A[i]
    elif i == len(A) -1:
        break
    else:
        if max_diff < A[i+1] - A[i]:
            max_diff = A[i+1] - A[i]

print(K - max_diff)

Measured memory_bytes: 26444
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll A,B,Q,tp;
int main(){
    cin >> A >> B >> Q;
    vector<ll> s(A+2),t(B+2);
    ll INF = 1e18;
    s.pb(-INF),t.pb(-INF);
    rep(i,A) cin >> tp, s.pb(tp);
    rep(i,B) cin >> tp, t.pb(tp);
    s.pb(INF),t.pb(INF);
    
    ll x;
    rep(i,Q){
        cin >> x;
        auto itrA = lower_bound(ALL(s),x);
        auto itrB = lower_bound(ALL(t),x);
        vector<ll> S,T;
        S.pb(*itrA),S.pb(*(itrA-1)),T.pb(*itrB),T.pb(*(itrB-1));
        
        ll ans = 1e18;
        rep(i,2) rep(j,2){
            if(S[i] > x && T[j] > x) ans = min(ans,max(S[i],T[j])-x);
            else if(S[i] < x && T[j] < x) ans = min(ans,x-min(S[i],T[j]));
            else ans = min(ans,min(abs(S[i]-x),abs(T[j]-x))+abs(S[i]-T[j]));
        }
        pr(ans);
    }
    
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> board(h);
  rep(i, h) cin >> board[i];
  vector<int> dx = {1, 0, -1, 0, 1, -1, -1, 1};
  vector<int> dy = {0, 1, 0, -1, 1, 1, -1, -1};
  
  rep(i, h) rep(j, w) {
    if(board[i][j] == '#') continue;
    int cnt = 0;
    rep(d, 8) {
      int ni = i + dy[d];
      int nj = j + dx[d];
      if(ni < 0 || ni >= h) continue;
      if(nj < 0 || nj >= w) continue;
      
      if(board[ni][nj] == '#') cnt++;
    }
    board[i][j] = char(cnt + '0');
  }
  rep(i, h) {
    cout << board[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
string s;
int k;
vector<string> vt;
int main() {
	int i, j;
	cin>>s>>k;
	for(i=1; i<=min(k, (int)s.size()); i++) for(j=0; j<s.size()-i+1; j++) vt.push_back(s.substr(j, i));
	sort(vt.begin(), vt.end());
	unique(vt.begin(), vt.end());
	cout<<vt[k-1];
	return 0;
}

Measured memory_bytes: 1660
N, M = map(int, input().split())
A = []
B = []
# for _ in range(N):
#     A.append(list(input()))
# for _ in range(M):
#     B.append(list(input()))

for _ in range(N):
    A.append(input())
for _ in range(M):
    B.append(input())

for i in range(N - M + 1):
    for j in range(N - M + 1):
        # match
        flag = True
        for k in range(M):
            for l in range(M):
                if A[i + k][j + l] == B[k][l]:
                    pass
                else:
                    flag = False

        if flag:
            break

    if flag:
        break

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    if (a > b && a > c){
        printf("%d\n", (b*c)/2);
    }
    else if (b > a && b > c){
        printf("%d\n", (a*c)/2);
    }
    else {
        printf("%d\n", (a*b)/2);
    }





return 0;
}


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

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

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;

    ll lcm_cd = c*d/gcd(c,d);
    ll ans = (b/c + b/d - b/lcm_cd) - ((a-1)/c + (a-1)/d - (a-1)/lcm_cd) ; 
    
    cout << b-a+1-ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll n;
vector<ll> v;

int main() {
    int ans = 0;
    cin >> n;
    v.resize(n);
    rep(i, n) cin >> v[i];
    rep(i, n) rep2(j, i + 1, n) rep2(k, j + 1, n) {
        ll sum = v[i] + v[j] + v[k];
        ll mx = max({v[i], v[j], v[k]});
        if ((sum - mx > mx) && v[i] != v[j] && v[j] != v[k] && v[i] != v[k]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define N 200005
#define ll long long
using namespace std;
char s[N];
int a[N],n,cnt;
vector<int>v[30];
vector<int>p[30];
int b[N];
int c[N*2];
void add(int x)
{
	for(int i=x;i<=n;i+=(i&(-i)))c[i]++;
}
int qur(int x)
{
	int ans=0;
	for(int i=x;i;i-=(i&(-i)))ans+=c[i];
	return ans;
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++)
	{
		v[s[i]-'a'+1].push_back(i);
	}
	int tmp=0;
	for(int i=1;i<=26;i++)
	{
		if(v[i].size())
		{
			sort(v[i].begin(),v[i].end());
			if(v[i].size()%2==1)tmp++;
			int t=v[i].size()/2;
			for(int j=0;j<t;j++)
			{
				a[++cnt]=v[i][j];
			}
		}
	}
	if(tmp>=2)
	{
		puts("-1");return 0;
	}
	sort(a+1,a+cnt+1);
	for(int i=1;i<=cnt;i++)
	{
		p[s[a[i]]-'a'+1].push_back(i);
	}
	ll ans=0;
	for(int i=1;i<=26;i++)
	{
		int t=v[i].size()/2;
		for(int j=0;j<t;j++)
		{
			b[v[i][j]]=p[i][j];
			b[v[i][v[i].size()-j-1]]=n-p[i][j]+1;
		}
		if(v[i].size()%2==1)
		{
			b[v[i][t]]=n/2+1;
		}
	}
	for(int i=1;i<=n;i++)
	{
		ans+=qur(n)-qur(b[i]);
		add(b[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4084
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
	ll m,d;
	cin>>m>>d;
	ll ans = 0;
	rep(i,1,m+1){
		rep(j,1,d+1){
			ll a = j%10;
			ll b = (j/10)%10;
			if(a<2||b<2)continue;
			if(i==a*b){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define ull unsigned long long
#define ll long long
#define ld long double
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
 
#define MX LLONG_MAX
#define MN LLONG_MIN
 
const int N=1e2 + 5;
const ll mod=1e9+7;
 
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}          
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

int main()                  
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll x;
    ll a[m]={0};
    for(ll i=0;i<n;i++)
    {
        cin>>x;
        ll ip;
        for(ll j=0;j<x;j++)
        {
            cin>>ip;
            a[ip-1]++;
        }
    }
    ll c=0;
    for(ll i=0;i<m;i++)
    {
        if(a[i]==n)
            c++;
    }
    cout<<c;
    return 0;
}  

Measured memory_bytes: 256
from collections import deque

N, Q = map(int,input().split())
counter = [0]*N
tree = [[] for _ in range(N)]
parent = [-1]*N
for _ in range(N-1):
  a, b = map(int,input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)

  
for _ in range(Q):
  p, x = map(int,input().split())
  counter[p-1] += x

q  = deque()
q.append(0)

while q:
  index = q.pop()
  pindex = parent[index]
  for i in tree[index]:
    if i == pindex: continue
    counter[i] += counter[index]
    parent[i] = index
    q.append(i)
    
print(*counter)


Measured memory_bytes: 56164
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class Task {
        public void solve(int testNumber, InputReader sc, PrintWriter w) {

            int a = sc.nextInt();
            int b = sc.nextInt();

            w.println(2 * b - a);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21460
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#define ll long long
using namespace std;
int n,ans;

inline int read()
{
    int n=0,f=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') f=-1; c=getchar();}
	while(c>='0' && c<='9') {n=n*10+c-'0'; c=getchar();}
	return n*f;
}

int main(void)
{
	n=read();
	ans-=n%1000;
	if(ans<0) ans+=1000;
	cout<<ans;
	return 0;
}


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

int main() {
	long long n, a, b; cin >> n >> a >> b;
	vector<int>x(n); for (auto&& xx : x)cin >> xx;

	long long ans = 0;
	for (int i = 1; i < n; i++) {
		ans += min((x[i] - x[i - 1])*a, b);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import sys
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if a == b:
  print("YES")
else:
  kyori = abs(a-b)
  if w >= v:
    print("NO")
    sys.exit()
  diff = abs(v-w)
  if t*diff >= kyori:
    print("YES")
  else:
    print("NO")
  

Measured memory_bytes: 9184
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

ll dp[40];

int main() {
    int n;
    while (cin >> n, n) {
        memset(dp, 0, sizeof(dp));
        dp[0] = 1;
        rep(i, n) {
            FOR(j, 1, 4) dp[i + j] += dp[i];
        }
        ll day = (dp[n] + 10 - 1) / 10;
        cout << (day + 365 - 1) / 365 << "\n";
    }

    return 0;
}



Measured memory_bytes: 3004
#include<stdio.h>
int main()
{
	int i,n;
	char a[105],b[105],c[205];
	scanf("%d%s%s",&n,a,b);
	for(i=0;i<n;i++)
	  c[i*2]=a[i],c[i*2+1]=b[i];
	c[n*2]='\0';
	printf("%s",c);
	return 0;
}

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

const ll MOD = 1000000007;

class ModuloCombination {
private:
  vector<ll> fact, inv_fact;

  static ll modulo_power(ll a, ll n) {
    if(n == 0) return 1;
    if(n % 2 == 0) return modulo_power((a * a) % MOD, n / 2);
    return (a * modulo_power(a, n - 1)) % MOD;
  }

public:
  ModuloCombination(ll N): fact(N + 1), inv_fact(N + 1) {
    fact[0] = 1;
    REP(i, 1, N + 1) fact[i] = (i * fact[i - 1]) % MOD;
    REP(i, 0, N + 1) inv_fact[i] = modulo_power(fact[i], MOD - 2);
  }

  ll operator()(ll n, ll r) {
    return fact[n] * inv_fact[r] % MOD * inv_fact[n - r] % MOD;
  }
};

int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, 0, N) cin >> A[i];

  ModuloCombination C(N);

#define range(l, r) ((sum[r] - sum[l] + MOD) % MOD)
  vector<ll> sum(N + 1);
  REP(i, 0, N) sum[i + 1] = (sum[i] + A[i]) % MOD;

  vector<ll> fact(N + 1);
  fact[0] = 1;
  REP(i, 1, N + 1) fact[i] = (fact[i - 1] * i) % MOD;

  ll ans = range(0, N) * fact[N] % MOD;
  ll t = 0;
  REP(i, 1, N - 1) {
    ll s = (range(0, i) + range(N - i, N)) % MOD;
    t += range(i - 1, N - (i - 1));
    t %= MOD;
    ans += (t - s + MOD) % MOD * C(N, i + 2) % MOD * fact[i] % MOD * fact[2] % MOD * fact[N - (i + 2)] % MOD;
    ans %= MOD;
  }
  REP(i, 1, N) {
    ll s = (range(0, i) + range(N - i, N)) % MOD;
    ans += s * C(N, i + 1) % MOD * fact[i] % MOD * fact[N - (i + 1)] % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4224
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
    int f1, f2, i, N, P;
    long long A[100010];
    scanf("%d", &N);
    for (i=0;i<N;i++) scanf("%lld", &A[i]);

    P = 1;
    for (i=0;A[i]==A[i+1];i++) {}
    if (A[i] < A[i+1]) f1 = 1;
    else f1 = 2;
    for (i=1;i<N-1;i++) {
        if (A[i] == A[i+1]) continue;
        if (A[i] < A[i+1]) f2 = 1;
        else f2 = 2;
        if (f1 != f2) {
            P++; i++;
            while (A[i]==A[i+1] && i<N-1) i++;
            if (i<N-1) {
                if (A[i] < A[i+1]) f1 = 1;
                else f1 = 2;
            } else break;
        } else f1 = f2;
    }
    printf("%d\n", P);

    return 0;
}

Measured memory_bytes: 896
N = int(input())
T = list(map(int, input().split()))
V = [0] + list(map(int, input().split())) + [0]

Tc = [0, 0] + [sum(T[:i + 1]) for i in range(N)] + [sum(T)]

ans = 0
for i in range(sum(T) * 2):
    t1, t2 = i * 0.5, (i + 1) * 0.5
    maxV1, maxV2 = [], []
    for j in range(N + 2):
        for t, maxV in [(t1, maxV1), (t2, maxV2)]:
            if t <= Tc[j]:
                maxV.append(V[j] + (Tc[j] - t))
            elif Tc[j] < t <= Tc[j + 1]:
                maxV.append(V[j])
            else:
                maxV.append(V[j] + (t - Tc[j + 1]))
    ans += 0.25 * (min(maxV1) + min(maxV2))

print(ans)


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

int main() {
  int A, B;
  cin >> A >> B;

  string result;
  
  if ( A % 500 <= B ) {
	result = "Yes";
  } 
  else {
    result = "No";
  }
  
  cout << result << endl;
}

Measured memory_bytes: 256
X, Y, A, B, C = map(int, input().split())
p = sorted([int(i) for i in input().split()], reverse=True)
q = sorted([int(i) for i in input().split()], reverse=True)
r = sorted([int(i) for i in input().split()])

p = p[:X]
q = q[:Y]
plus_r = []

while r != [] and ((p != [] and r[-1] > p[-1]) or (q != [] and r[-1] > q[-1])):
    if p == []:
        q.pop()
        plus_r.append(r.pop())
        continue
    elif q == []:
        p.pop()
        plus_r.append(r.pop())
        continue

    if p[-1] < q[-1]:
        p.pop()
    else:
        q.pop()
    plus_r.append(r.pop())

print(sum(p) + sum(q) + sum(plus_r))


Measured memory_bytes: 23200
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  if (a == 0) {
    cout << 1 << endl;
    return 0;
  }
  if (b == 0) {
    cout << 2 << endl;
    return 0;
  }
  if (c == 0) {
    cout << 3 << endl;
    return 0;
  }
  if (d == 0) {
    cout << 4 << endl;
    return 0;
  }
  cout << 5 << endl;

  return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	REP(i, N) cin >> A[i];
	
	int sum = accumulate(ALL(A), 0);
	
	int d = (sum + 4*M - 1) / (4*M);
	int ans = 0;
	REP(i, N) if (A[i] >= d) ++ans;
	
	puts([&] {
		return ans >= M;
	}() ? "Yes": "No");
	return 0;
}


Measured memory_bytes: 256
import sys
N = int(input())
if N == 1:
    print(0)
    sys.exit()
    
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

A = factorization(N)
c = 0
for i in range(len(A)):
    j = 2
    while True:
        f = j * (j - 1) / 2
        if A[i][1] < f:
            c += j - 2
            break
        j += 1
print(c)

Measured memory_bytes: 63444
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    PriorityQueue<Integer> queue = new PriorityQueue<>(Comparator.reverseOrder());
    for (int i = 0; i < N; i++) {
      queue.add(sc.nextInt());
    }
    while (M-- > 0) {
      Integer v = queue.poll();
      queue.add(v / 2);
    }
    long ans = 0;
    while (!queue.isEmpty()) {
      ans += queue.poll();
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 63316
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define PB push_back
#define PII pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MAXN = 3e3 + 10 , INF = 8e18 , MOD = 1e9 + 10;
int lcs[MAXN][MAXN];
pair <int , int> parent[MAXN][MAXN];

int main() {
    string a , b;
    cin >> a >> b;
    memset(lcs, 0, sizeof(lcs));
    int n = (int)a.size(), m = (int)b.size();
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            lcs[i][j] = max(lcs[i - 1][j], lcs[i][j - 1]);
            if(a[i - 1] == b[j - 1]) 
                lcs[i][j] = lcs[i - 1][j - 1] + 1;
        }
    }
    vector <char> v;
    while(n && m) {
        if(lcs[n][m] == lcs[n - 1][m]) 
            n--;
        else if(lcs[n][m] == lcs[n][m - 1]) 
            m--;
        else {
            v.push_back(a[n - 1]);
            n--, m--;
        }
        
    }
    reverse(v.begin(), v.end());
    for(auto u : v)
        cout << u;
}


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

int main(){
	int a,b;
	
	cin >> a >> b;
	if(a==b) cout << "Draw";
	else if(a==1) cout << "Alice";
	else if(b==1) cout << "Bob";
	else if(a>b) cout << "Alice";
	else cout << "Bob"; 
}

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

int main()
{
	int m, n;
	
	while (scanf("%d %d", &m, &n), m + n){
		bool flag[2048] = {false};
		int p = 0;
		int cnt = 0;
		for (int i = 1; i <= n; i++){
			char str[128];
			scanf("%s", str);
			
			if (cnt < m - 1){
				char str2[128];
				if (i % 15 == 0){
					strcpy(str2, "FizzBuzz");
				}
				else if (i % 3 == 0){
					strcpy(str2, "Fizz");
				}
				else if (i % 5 == 0){
					strcpy(str2, "Buzz");
				}
				else {
					sprintf(str2, "%d", i);
				}
				
				if (strcmp(str, str2) != 0){
					flag[p % m] = true;
					cnt++;
				}
				while (1){
					p++;
					if (flag[p % m] == false){
						break;
					}
				}
			}
		}
		
		bool f = false;
		for (int i = 0; i < m; i++){
			if (flag[i] == false){
				if (f){
					printf(" ");
				}
				printf("%d", i + 1);
				f = true;
			}
		}
		puts("");
	}
	
	return 0;
}

Measured memory_bytes: 1068
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100100

int main(){
  int i,n,t;
  long long m=0;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> t;
    while (t%2==0){
      t /=2;
      m++;
    }
  }
  printf("%lld",m);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll A, B;
  cin >> A >> B;

  cout << max(0LL, A - 2 * B) << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        String[] sArray = s.split(" ", 0);

        if (sArray.length != 2){
            System.out.println("Input argument error.");
            return;
        }

        int n = Integer.parseInt(sArray[0]);
        int k = Integer.parseInt(sArray[1]);

        int val = 1;
        int count = 1;
        while(val <= n){
            count++;
            val += 2;
        }

        if(count > k){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

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

using namespace std;

int n;
typedef long long ll;
ll dp[90];
int main() {
  cin >> n;
  dp[0] = 2;
  dp[1] = 1;

  for(int i = 2; i <= n; i++) {
    dp[i] = dp[i-1] + dp[i-2];
  }

  cout << dp[n] << endl;
}
  
  


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

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(n) for(int i = 0; i < (n); ++i)
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)

const int INF = 2147483647;
const ll  MOD = 1000000007;

int main() {
  int n; cin >> n;
  vec a(n);
  rep(n) {
    cin >> a[i];
    a[i]--;
  }

  vector<bool> isTouch(n);
  rep(n) isTouch[i] = false;

  int current = 0;
  int ans = 0;

  // cout << endl;
  // cout << current << endl;

  while(current != 1) {
    if(isTouch[current]) {
      cout << -1;
      return 0;
    }

    isTouch[current] = true;
    current = a[current];

    // cout << current << endl;

    ans++;
  }

  cout << ans;
}

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

pair <int, int> mayor(map<int, int> &mapa, int rest){
	pair <int, int> hola = {0, 0};
	for (auto &it:mapa){
		if (it.first != rest && it.second > hola.second){
			hola = make_pair(it.first, it.second);
		}
	}
	return hola;
}

int main (){
	map <int, int> par;
	map <int,int> impar;
	int n,x;
	cin >> n;
	for (int i=0;i<n;i++){
		cin >>x;
		if (i%2==0) {
			if (par.count(x) == 0) par[x] = 1;
			else par[x]++;
		}
		else {
			if (impar.count(x) == 0) impar[x] = 1;
			else impar[x]++;
		}
	}
	/*
	for (auto &it:par){
		cout << it.first << " " << it.second <<endl;
	}
	for (auto &it:impar){
		cout << it.first << " " << it.second <<endl;
	}
	//*/
	
	pair <int, int> max_p1 = mayor(par, -1);
	pair <int, int> max_p2 = mayor(par, max_p1.first);
	pair <int, int> max_i1 = mayor(impar, -1);
	pair <int, int> max_i2 = mayor(impar, max_i1.first);
	
	
	int r = n;
	if (max_p1.first != max_i1.first) {
		r -= (max_p1.second+max_i1.second);
		cout<< r;
	}
	else {
		r = min(r-(max_p1.second+max_i2.second), r-(max_p2.second+max_i1.second));
		cout<< r;
	}
	return 0;
}

Measured memory_bytes: 8120
from collections import deque

k = int(input())
q = deque([])
for i in range(1, 10):
    q.append(i)

cnt = 0
while cnt < k:
    s = q.popleft()
    cnt += 1
    t = s % 10
    if t != 0:
        q.append(10 * s + (t - 1))
    q.append(10 * s + t)
    if t != 9:
        q.append(10 * s + (t + 1))
    
print(s)
        


Measured memory_bytes: 68412
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

int main() {
    // source
    ll a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    string s_a, s_b;
    s_a = s.substr(0, a);
    s_b = s.substr(a + 1, b);

    bool ans = true;
    rep(i, a) {
        if ('0' > s_a[i] || s_a[i] > '9') {
            ans = false;
        }
    }
    rep(i, b) {
        if ('0' > s_b[i] || s_b[i] > '9') {
            ans = false;
        }
    }

    if (s[a] != '-') {
        ans = false;
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int debt = 100000, n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		debt = ((int)(debt * 1.05) + 999) / 1000 * 1000;
	}
	cout << debt << endl;
	return 0;
}

Measured memory_bytes: 1160