akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

int n,a,b,c;
int l[10];
int g[10];
int tl[3];
int res = inf;

int pm()
{
    int r[6];
    r[0] = abs(a - tl[0]) + abs(b - tl[1]) + abs(c - tl[2]);
    r[1] = abs(a - tl[0]) + abs(c - tl[1]) + abs(b - tl[2]);
    r[2] = abs(b - tl[0]) + abs(a - tl[1]) + abs(c - tl[2]);
    r[3] = abs(b - tl[0]) + abs(c - tl[1]) + abs(a - tl[2]);
    r[4] = abs(c - tl[0]) + abs(a - tl[1]) + abs(b - tl[2]);
    r[5] = abs(c - tl[0]) + abs(b - tl[1]) + abs(a - tl[2]);

    int rr = inf;
    rep(i,6)
    {
        rr = min(rr, r[i]);
    }

    return rr;
}

void calc()
{
    int cand = 0;
    rep(i,3)
    {
        tl[i]=0;
    }

    rep(i,n)
    {
        if(g[i] == 3)
            continue;

        if(tl[g[i]] != 0)
            cand += 10;

        tl[g[i]] += l[i];
    }

    rep(i,3)
    {
        if(tl[i] == 0)
            return;
    }

    cand += pm();

    if(cand < res)
        res = cand;
}

void select(int p)
{
    if(p == n)
    {
        calc();
        return;
    }

    rep(i,4)
    {
        g[p] = i;
        select(p+1);
    }
}


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

    select(0);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PL;
typedef pair<int,int> pint;
const int INF = 1e9;
const int MOD = 998244353;
const vector<int> dy = {-1,0,1,0};
const vector<int> dx = {0,1,0,-1};

int MAXN = 200005;
vector<ll> fac(MAXN + 1);
vector<ll> finv(MAXN  + 1);
vector<ll> inv(MAXN + 1);

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAXN; i ++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nck(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modpow(ll N,ll K,ll mod = MOD) {
    ll ret = 1;
    while (K > 0) {
        if (K&1) {
            ret *= N;
            ret %= mod;
        }
        K >>= 1;
        N *= N;
        N %= mod;
    }
    return ret;
}

int main() {
    COMBinit();
    int N,M,K; cin >> N >> M >> K;
    ll ans = 0;
    rep(i,K + 1){
        ans += M*nck(N - 1,i)%MOD*modpow(M - 1,N - i - 1)%MOD;
        ans %= MOD;
    }
    printf("%ld\n",ans);
}

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

void swap(string& s, long long x, long long y) {
    char tmp = s.at(x);
    s.at(x) = s.at(y);
    s.at(y) = tmp;
}

int main() {
    long long N;
    cin >> N;
    string s;
    cin >> s;
    int l = 0;
    int r = s.size()-1;
    int cnt = 0;
    while (l<=r) {
        if (s.at(l)=='W' && s.at(r)=='R') {
            cnt++;
            swap(s, l, r);
        }
        else if (s.at(l)=='W') r--;
        else if (s.at(r)=='R') l++;
        else {
            l++;
            r--;
        }
    }
    cout << cnt;
}

Measured memory_bytes: 3744
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()

vector<pair<ll, ll>>factor(ll n){
    vector<pair<ll, ll>> prime;
    ll sq = sqrt(n) + 1;
    for(int i = 2; i <= sq; i++){
        sq = sqrt(n) + 1;
        if(n%i == 0){
            prime.push_back(make_pair(i, 0));
            while(n%i == 0){
                n/=i;
                prime[prime.size()-1].second++;
            }
        }
    }
    if(n != 1){
        prime.push_back(make_pair(n, 1));
    }
    return prime;
}
#define MAX 510000
#define MOD 1000000007
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
    ll n, m;
    cin >> n >> m;

    vector<pair<ll, ll>> p = factor(m);

    ll ans =  1;

    rep(i, p.size())ans = (ans*COM(p[i].second+n-1, p[i].second))%MOD;

    cout << ans << endl;
}

Measured memory_bytes: 12160
n = int(input())
b = list(map(int, input().split()))
ans = 0
a = []

for i in range(n-1):
  if i == 0:
    a.append(b[i])
  else:
    a.append(min(b[i], b[i-1]))
    
a.append(b[n-2])
print(sum(a))

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

int main() {
    ll x,y; cin>>x>>y;
    ll ans=0;
    if(x<y){
        if(x>=0){
            ans=abs(y-x);
        }
        else{   //x<0
            if(y>0){   //y>=0>x
                ans=1+abs(y+x);
            }
            else if(y==0)ans=abs(x);
            else{   //0>y>x
                ans=abs(x-y);
            }
        }
    }
    else{   //x>y
        if(y>0){   //x>y>0
            ans=2+abs(x-y);
        }
        else if(y==0)ans=1+abs(x);
        else{   //y<0
            if(x>=0){   //x>0>y
                ans=1+abs(-x-y);
            }
            else{   //0>x>y
                ans=2+abs(abs(y)-abs(x));
            }
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]

x = 0

for i in range(N):
    if i % 2 == 0:
        x += A[i]
    else:
        x -= A[i]

ans = []
ans.append(x)

for i in range(N - 1):
    ans.append((A[i] - (ans[i] // 2)) * 2)

[print(x, end=" ") for x in ans]



Measured memory_bytes: 14092
// inputに入力データ全体が入る
function Main(input) {
  lines = input.split("\n");
  totalThrow = parseInt(lines[0], 10);
  count = 0;
  for (i=1; i<=totalThrow; i++){
    splitpernum = lines[i].split(" ");
    //console.log(splitpernum);
    if (count == 3){

    } else if (count < 3){
    	if (splitpernum[0] == splitpernum[1]){
        count ++;
        } else {
        count = 0;
        }
    }
    

  }
  	//出力
      if (count < 3){
      console.log("No");
    } else if (count == 3){
          console.log("Yes");
    }



}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  
  

Measured memory_bytes: 29592
c11,c12,c13 = list(map(int, input().split()))
c21,c22,c23 = list(map(int, input().split()))
c31,c32,c33 = list(map(int, input().split()))

if (c12-c11 == c22-c21 == c32-c31
) and (c21-c11 == c22-c12 == c23-c13
) and (c31-c11 == c32-c12 == c33-c13):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
from collections import deque
H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]

dxy = [[-1, 0], [0, 1], [1, 0], [0, -1]]

ans = 0
for h in range(H):
  for w in range(W):
    if maze[h][w] == '#':
      continue
    d_maze = [[-1]*W for _ in range(H)]
    d_maze[h][w] = 0
    p = deque([[h, w]])
    while p:
      rh, rw =  p.popleft()
      for i, j in dxy:
        nh = rh + i
        nw = rw + j
        if 0 <= nh < H and 0 <= nw < W and maze[nh][nw] == '.' and d_maze[nh][nw] == -1:
          d_maze[nh][nw] = d_maze[rh][rw] + 1
          p.append([nh, nw])
    ans = max(ans, max([max(l) for l in d_maze]))
print(ans)

Measured memory_bytes: 3316
//Radhe Radhe
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//using namespace boost::multiprecision;
//#include<boost/math/common_factor.hpp>
#include <ext/numeric>
using namespace __gnu_cxx;
using namespace std;
#define int long long
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define array(a,n) int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define loop(i,a,b,x) for(int i=a;i<b;i+=x)
const int MOD = 1000000007;


struct flower
{
    int hi;
    int bty;
};

int solve(vector<flower>& v, int n)
{
    vector<int> dp(n + 1);
    map<int, int> meaningful;
    dp[1] = v[1].bty;
    meaningful[v[1].hi] = dp[1];
    int ans = dp[1];

    for (int i = 2; i <= n; i++)
    {
        dp[i] = v[i].bty;
        auto it = meaningful.lower_bound(v[i].hi + 1);
        if (it != meaningful.begin())
        {
            it--;
            dp[i] += it->second;
        }
        meaningful[v[i].hi] = dp[i];
        it = meaningful.upper_bound(v[i].hi);
        while (it != meaningful.end() && it->second <= dp[i])
        {
            auto temp = it;
            temp++;
            meaningful.erase(it);
            it = temp;
        }
        ans = max(ans, dp[i]);
    }
    return ans;
}

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        int n;
        cin >> n ;
        vector<flower> v(n + 1);
        for (int i = 1; i <= n; i++)
            cin >> v[i].hi;
        for (int i = 1; i <= n; i++)
            cin >> v[i].bty;
        cout << solve(v, n);

    }

    return 0;

}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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 (b<a) { a=b; return true; } return false; }

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    string s;
    cin>>s;
    sort(ALL(s));
    Yes(s=="abc");
    return  0;
}


Measured memory_bytes: 256
// <<<<GOD>>>> lET'S gO

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

typedef long long ll;
const ll N = 1e5 + 100, inF = 1e12;

ll n, x, ans, enemy, b[N], l[N], r[N];

bool ok(ll cnt) {
	ll want = cnt / x;
	cnt %= x;
	if(want >= n)
		return true;
	if(want == 0) {
		ll maxi = 0;
		for (int i = 0; i < n; i++)
			if(cnt >= b[i])
				maxi = max(maxi, cnt * r[i] - b[i] * r[i] + b[i] * l[i]);
			else
				maxi = max(maxi, cnt * l[i]);
		return maxi >= enemy;
	}
	vector<ll> vec;
	for (int i = 0; i < n; i++)
		vec.push_back(x * r[i] - b[i] * r[i] + b[i] * l[i]);
	sort(vec.begin(), vec.end(), greater<ll>());
	ll S = 0, maxi = 0;
	for (int i = 0; i < want; i++)
		S += vec[i];
	for (int i = 0; i < n; i++)
		if(x * r[i] - b[i] * r[i] + b[i] * l[i] < vec[want - 1]) {
			if(cnt >= b[i])
				maxi = max(maxi, S + cnt * r[i] - b[i] * r[i] + b[i] * l[i]);
			else
				maxi = max(maxi, S + cnt * l[i]);
		}
		else {
			ll help = S - (x * r[i] - b[i] * r[i] + b[i] * l[i]) + vec[want];
			if(cnt >= b[i])
				maxi = max(maxi, help + cnt * r[i] - b[i] * r[i] + b[i] * l[i]);
			else
				maxi = max(maxi, help + cnt * l[i]);
		}
	return maxi >= enemy;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> b[i] >> l[i] >> r[i];
		enemy += b[i] * l[i];
	}
	ll s = -1, e = inF;
	while(e - s > 1) {
		ll mid = (s + e) >> 1;
		if(ok(mid))
			e = mid;
		else
			s = mid;
	}
	cout << e;
    return 0;
}

Measured memory_bytes: 4480
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

// 

public class ABC133_A // ←Class名変更！！    Program
{
    public static void Main()
    {
        var ns = Ria();
        var na = ns[0] * ns[1];
        if (na<ns[2])
        {
            WriteLine($"{na}");
        }
        else
        {
            WriteLine($"{ns[2]}");

        }

    } // Main

    public static string Rs() { return ReadLine(); }
    public static char Rc() { var c = ReadLine(); return c[0]; }    //最初の1文字だけ返す
    public static int Ri() { return int.Parse(ReadLine()); }
    public static long Rl() { return long.Parse(ReadLine()); }
    public static char[] Rca() { return ReadLine().ToCharArray(); }
    public static int[] Ria() { return Array.ConvertAll(ReadLine().Split(' '), int.Parse); }
    public static long[] Rla() { return Array.ConvertAll(ReadLine().Split(' '), long.Parse); }
} // Class


Measured memory_bytes: 13140
L,R = map(int,input().split())
ans = 2019

if R*(R-1)<2019:
  print(R*(R-1))
  exit(0)
else:
  if R == L+1:
    print((R*L)%2019)
    exit(0)
  else:
    r =673 - L % 673
    if L+r <= R:
      print("0")
      exit(0)
    else:
      for i in range(L,R+1):
        for j in range(i+1,R+1):
          if (i*j)%2019 < ans:
            ans = (i*j) % 2019
            if ans == 0:
              break
print(ans)

Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18
const int N = 100010;//10^5+10

const int MAX_N = 2000;
int a[MAX_N], n, x;
int f[MAX_N][MAX_N];

int main() {
	

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

	LL ans =INF2;

	//前処理でテーブルを作っておく。
	//スライムiを入手するにはj回の変色で行ける範囲での最小。
	//添字がマイナスになったらn-1にするために+n%nしておく
	for (int i = 0; i < n; i++) {
		f[i][0] = a[i];

		for (int j = 1; j < n; j++) {
			f[i][j] = min(f[i][j - 1], a[(i - j + n) % n]);
		}
	}

	//実際に求めていく。魔法の回数で全探索
	//i回魔法を使うとx*iがベースとしてかかって、
	//あとはそれぞれのスライムを捕まえるためのコストを足していけばいい。
	for (int i = 0; i < n; i++) {
		LL cur = (LL)x*i;

		for (int j = 0; j < n; j++) {
			cur += f[j][i];
		}

		ans = min(ans, cur);
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int N=5;
  
  //注文してから届くまでの時間
  vector<int> Time = {a,b,c,d,e};
  //注文してから次に注文できるまでの時間
  vector<int> nextTime(N);
  for (int i=0;i<N;++i){
    //if (Time[i]%10==0) nextTime[i]=Time[i];
    //else nextTime[i]=Time[i]-Time[i]%10+10;
    
    //14,15行目を1行で書くとこう
    nextTime[i]=(Time[i]+9)/10*10;
  }
  
  int BestTime=100100100;
  //最後に注文するものを全通り計算
  for (int i=0;i<N;++i){
    int SumTime=0;
    for (int j=0;j<N;++j){
      if (i==j){
        //最後の処理
        SumTime+=Time[j];
      }
      else {
        //最後以外の処理
        SumTime+=nextTime[j];
      }
    }
    BestTime=min(BestTime, SumTime);
  }
  cout << BestTime << endl;
}
    

Measured memory_bytes: 256
// ref: https://atcoder.jp/contests/abc093/submissions/13094442

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int A, B, K; cin >> A >> B >> K;
    
    for(int i=A; i<=min(B, A+K-1); ++i){ cout << i << endl; }
    for(int i=max(B-K+1, A+K); i<=B; ++i){ cout << i << endl; }
    /*
    for(int i=A; i<=B; ++i){
        if(i<A+K){ cout << i << endl; continue; }
        if(i>B-K){ cout << i << endl; continue; }
    }
    //*/
    return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
ls = len(s)
lt = len(t)

ans = 10000
for i in range(ls - lt + 1):
    d = 0
    for j in range(lt):
        if s[i + j] != t[j]:
            d += 1
    ans = min(ans, d)

print(ans)

Measured memory_bytes: 9124
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    m1,d1 = LI()
    m2,d2 = LI()
    if d2 == 1:
        return 1

    return 0


print(main())





Measured memory_bytes: 6460
atn = [int(input()) for i in range(5)]
k = int(input())
b = 1
for i in range(4):
    for j in range(4 - i):
        if abs(atn[i] - atn[i + j + 1]) > k:
            b = 0

if b:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;

ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll get_val(vector<ll>&ft,ll index)
{
  ll res=0;
  for(;index>=0;index=(index & (index+1))-1)
    res+=ft[index];
  return res;
}

void update(vector<ll>&ft,ll index,ll val)
{
  for(;index<(ll)ft.size();index|=index+1)
    ft[index]+=val;
}

ll mex(vector<ll>&a, ll n)
{
  ll res=0;
  // set<ll>st;
  vector<ll>b(n+1,0);
  for(auto x:a) b[x]++;
    while(res<n && b[res]>0) res++;
  return res;
}

vector<ll> graph[100005];
ll vis[100005];

void func(ll vertex)
{
  vis[vertex]=1;
  for(auto x:graph[vertex])
  {
    if(!vis[x]) func(x);
  }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //   #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    
    // Sieve();
   ll tests=1;
 // cin>>tests;
  // ll t=1;
    while(tests--)
    {
      ll i,j,n,m,x,y,z;
      cin>>n>>m;
      rep(i,0,n) vis[i]=0;
      rep(i,0,m-1)
      {
        cin>>x>>y>>z;
        graph[x].pb(y);
        graph[y].pb(x);
      }
      ll ans=0;
      rep(i,1,n)
      {
        if(!vis[i])
        {
          ans++;
          func(i);
        }
      }
      cout<<ans;

    }

    return 0;
   }

Measured memory_bytes: 23484
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
#define MOD 1000000007
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N;
	cin >> N ;
	cout << "ABC" << N;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N=1005;
struct Edge{
    int to,nxt;
}e[N<<1];
int n,x[N],head[N],ecnt,f[N],g[2][5005];
void add(int bg,int ed){e[++ecnt].nxt=head[bg];e[ecnt].to=ed;head[bg]=ecnt;}
void dfs(int u) {
    for(int i=head[u];i;i=e[i].nxt) dfs(e[i].to);
    memset(g[0],0x3f,sizeof g[0]);
    int cur=0;
    g[cur][0]=0;
    for(int i=head[u];i;i=e[i].nxt) {
        int v=e[i].to;cur^=1;
        memset(g[cur],0x3f,sizeof g[cur]);
        for(int j=0;j<=x[u];j++) {
            if(j-x[v]>=0) g[cur][j]=min(g[cur^1][j-x[v]]+f[v],g[cur][j]);
            if(j-f[v]>=0) g[cur][j]=min(g[cur^1][j-f[v]]+x[v],g[cur][j]);
        }       
    }
    for(int i=0;i<=x[u];i++) f[u]=min(f[u],g[cur][i]);
}
int main() {
    scanf("%d",&n);
    for(int i=2,p;i<=n;i++) scanf("%d",&p),add(p,i);
    for(int i=1;i<=n;i++) scanf("%d",&x[i]);
    memset(f,0x3f,sizeof f);
    dfs(1);
    if(f[1]<0x3f3f3f3f) puts("POSSIBLE");
    else puts("IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 384
N = int(input())
T = []
X = []
Y = []
for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

before_t = before_x = before_y = 0

for t,x,y in zip(T,X,Y):

    if before_t == 0:
        if t != x + y:
            print('No')
            exit()

    d = abs(x + y - before_x - before_y)

    if t - before_t >= d:
        if (t - before_t) % 2 == 0 and d % 2 == 0:
            pass
        elif (t - before_t) % 2 != 0 and d % 2 != 0:
            pass
        else:
            print('No')
            exit()
    else:
        print('No')
        exit()

    before_t = t
    before_x = x
    before_y = y

else:
    print('Yes')

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;

const string YES = "Yes";
const string NO = "No";

void solve()
{
  ll a;
  scanf("%lld",&a);
  ll b;
  scanf("%lld",&b);
  ll n = a*(pow(10,(int)log10(b)+1))+b;
  for (int i=1; i*i<=n; i++) {
    if (i*i==n) {
      cout << YES << endl;
      return;
    }
  }
  cout << NO << endl;
}

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


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


const int kMod = 1e9+7;
const int kMaxN = 1e5+10;

struct Edge {
	int x, y, c;

	Edge(int x, int y, int c) : x(x), y(y), c(c) {}

	Edge() {}

	bool operator < (const Edge& other) {
		return c < other.c;
	}
};

int p[kMaxN], x[kMaxN], y[kMaxN], vx[kMaxN], vy[kMaxN];

int parent(int a) {
	if (p[a] != 0) {
		return p[a] = parent(p[a]);
	}
	return a;
}

void unite(int a, int b, int c, long long& ans) {
	a = parent(a);
	b = parent(b);

	if (a != b) {
		p[a] = b;
		ans += c;
	}
}

void Solve() {
	int n;
	cin >> n;

	for (int i = 1; i <= n; ++i) {
		p[i] = 0;
	}

	for (int i = 1; i <= n; ++i) {
		cin >> x[i] >> y[i];
		vx[i] = i;
		vy[i] = i;
	}

	auto cmpx = [&](int a, int b) {
		return x[a] < x[b];
	};

	auto cmpy = [&](int a, int b) {
		return y[a] < y[b];
	};

	sort(vx + 1, vx + n + 1, cmpx);
	sort(vy + 1, vy + n + 1, cmpy);

	vector<Edge> edges;

	for (int i = 1; i < n; ++i) {
		edges.emplace_back(vx[i], vx[i+1], x[vx[i+1]] - x[vx[i]]);
	}

	for (int i = 1; i < n; ++i) {
		edges.emplace_back(vy[i], vy[i+1], y[vy[i+1]] - y[vy[i]]);
	}

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

	long long ans = 0;

	for (auto e : edges) {
		unite(e.x, e.y, e.c, ans);
	}

	cout << ans << "\n";
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		Solve();
	}
}

Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
auto modmul = [](auto... modx) {
  ll res = 1;
  for (auto modx_ : {modx...})
  {
    res *= modx_;
    res %= mo;
    res += mo;
    res %= mo;
  }
  return res;
};
ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
const ll MAX = 510000;
const ll MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(ll n, ll k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
vector<ll> factorial(ll n)
{
  vector<ll> fac;
  fac.push_back(1);
  for (ll i = 1; i < n + 10; i++)
  {
    fac.push_back((fac[i - 1] * i) % mo);
  }
  return fac;
}
int main()
{
ll n , k ;
cin >> n >> k ;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
COMinit();
vector<ll> fac = factorial(100000);

ll s=0;
rep(i,k+1)s=mod(s+mypow(-1,k-i)*COM(k,i)*mypow(i,n));

vector<ll> b={1};
rep(i,k)b.push_back(mod(b.back()+(i%2?1:-1)*mypow(fac[i+1],mo-2)));
ll bb=0;
rep(i,k+1)bb=mod(bb+modmul(mypow(i,n),mypow(fac[i],mo-2),b[k-i]));

vector<vector<ll>> p(5000, vector<ll>(5000,0) );
rep(i,5000)p[i][1]=1;
rep(i,5000)rep(j,4998)p[i][j+2]=mod(p[i][j+1]+(i-j-2>=0?p[i-j-2][j+2]:0));
/* 
https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5
ボール      箱	      入れ方に制限なし 箱の中身は1つ以下 箱の中身は1つ以上
区別できる   区別できる  1            2             3
区別できない  区別できる  4            5             6
区別できる   区別できない 7            8             9
区別できない  区別できない 10          11            12
*/
//1
//cout << mypow(k,n) << endl;
//2
//cout << (COM(k,n)*fac[n])%mo << endl;
//3
//cout << t << endl;
//4
//cout << COM(n+k-1,n) << endl;
//5
//cout << COM(k,n) << endl;
//6
//cout << COM(n-1,k-1) << endl;
//7
//cout << bb << endl;
//8,11
//cout << (n>k?0:1) << endl;
//9 漸化式でもできる
//cout << mod(s*mypow(fac[k],mo-2)) << endl;
//10
cout << p[n][k] << endl;
//12
return 0;
}


Measured memory_bytes: 211236
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    char a[100009],b[100009],c[100009];
    int s=0,s1=0;
    scanf("%s",a);
    b[0]='0';
    c[0]='1';
    for(int i=1;i<strlen(a);i++)
    {
        b[i]=i%2==1?'1':'0';
        c[i]=i%2==1?'0':'1';
        //printf("%c%c\n",b[i],c[i]);
    }
    for(int i=0;i<strlen(a);i++)
    {
        if(a[i]!=b[i])
            s++;
        if(a[i]!=c[i])
            s1++;
    }
    printf("%d",min(s,s1));
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll m =  n / (a + b);
    n -= (a + b) * m;
    cout  << (a * m) + min(n, a) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<ll>l(n);
    for(int i=0;i<n;i++) cin >> l[i];
    ll ans = 0;

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]==l[j] || l[k]==l[j] || l[k]==l[i])continue;
                if(max(l[i], max(l[j], l[k])) < l[i]+l[j]+l[k]-max(l[i], max(l[j], l[k]))) ans++;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(){
    char ch[250]={0};
    char a[250]={0};
    int h;
    int i,j,k,m;


    while(1){
        i=0;
        while(1){
            scanf("%c",&ch[i]);
            if(ch[i]=='\n'){    
	            break;
            }
            i++;
        }
        if (i==1 && ch[0]=='-') break;
        scanf("%d",&m);
    
        for(j=0;j<m;j++){
            scanf("%d",&h);
      
            for(k=0;k<i-h;k++){
	            a[k]=ch[h+k];
            }
            for(k=0;k<h;k++){
	            a[i-h+k]=ch[k];
	        }
            for(k=0;k<i;k++){
	            ch[k]=a[k];
            }
        }
        for(k=0;k<i;k++){
            printf("%c",ch[k]);
        }
        printf("\n");
        scanf("%c",&ch[0]);
    }
    return 0;
}


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

const int N = 1e6 + 5 ;
int a[N] ;
int32_t main(){
	int gc = 0 ;
	int n;  cin >> n ;
	for(int i = 0 ; i < n ; i++){
		int x = 0 ; cin >> x ;
		a[x]++ ;
		gc = __gcd(gc , x) ;
	}
	if(gc > 1){
		cout << "not coprime" ;
	} else {
		bool found = true; 
		for(int i = 2 ; i < N ; i++){
			int cnt = 0 ;
			for(int j = i ; j < N ; j += i){
				cnt += a[j] ;
			}
			if(cnt > 1){
				found = false ;
				break ;
			}
		}
		if(!found){
			cout << "setwise coprime" ;
		} else {
			cout << "pairwise coprime" ;
		}
	}
	return 0 ;
}



Measured memory_bytes: 7520
N = int(input())
A = list(map(int, input().split()))
ball = [0]*(N+1)

for i in A:
    ball[i] += 1

normal = 0
for i in ball:
    normal += i*(i-1)//2

for i in range(N):
    m = ball[A[i]]
    print(normal-m*(m-1)//2+(m-1)*(m-2)//2)

Measured memory_bytes: 24748
li = [
    1,2,3,4,5,6,7,8,9,
    4,6,8,10,12,14,16,18,
    9,12,15,18,21,24,27,
    16,20,24,28,32,36,
    25,30,35,40,45,
    36,42,48,54,
    49,56,63,
    64,72,
    81]
n = int(input())
if n in li:
    print('Yes')
else:
    print('No')

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

using namespace std;

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


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

#define int long long

using namespace std;

const int MAXN = 100 * 1000 + 123;









int n, A, B, a[MAXN];

int32_t main() {
    cin >> n >> A >> B;
    A -= B;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int dw = -1, up = 1000 * 1000 * 1000 + 123;
    while (up - dw > 1) {
        int m = (up + dw) / 2, use = 0;
        for (int i = 0; i < n; i++)
            use += max((a[i] - m * B + A - 1) / A, 0ll);
        if (use > m)
            dw = m;
        else
            up = m;
    }
    cout << up;
    return 0;
}

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

#define I inline void 

using namespace std ; 

using ll = long long ; 
using ld = long double ; 

const int N = 2e6 + 7 ; 

// How interesting!

int n , m; 

int sx , sy , tx , ty ; 
int ans[1001][1001] ;
bool vis[1001][1001] ;  

string s[1001] ; 

bool valid(int x , int y){
	return x>=0 && y>=0 && x < n && y < m && s[x][y] == '.' ; 
}

int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ; 
	//freopen("in.in", "r" , stdin) ;
	
	cin >> n >> m;  
	cin >> sx >> sy ; 
	cin >> tx >> ty ; 
	sx -- ; sy-- ; 
	tx-- ; ty-- ; 

	for(int i = 0 ;i < n; i++)
		cin >> s[i] ; 

	deque<pair<int , int> > qu ; 

	vector<pair<int,int>> moves = { {1 , 0} , {0 , 1} , {-1 ,0} , {0 , -1} , {-1,-1} , {1 ,1} , {-1,1},{1,-1} }; 
	memset(ans , -1 , sizeof ans) ; 
	ans[sx][sy] = 0 ; 
	qu.push_front({sx , sy}) ; 
	while(qu.size()){
		int cx = qu.front().first ; 
		int cy = qu.front().second ; 
		qu.pop_front() ; 
		if(vis[cx][cy])
			continue ; 
		vis[cx][cy] = 1; 
		int k = 0 ; 
		for(auto u : moves){
			int nx = cx + u.first ; 
			int ny = cy + u.second ; 
			k++ ; 
			if(valid(nx , ny) && !vis[nx][ny]){
				if(k > 4){
					if(ans[nx][ny] == -1 || (ans[nx][ny] >= 0 && ans[nx][ny] > ans[cx][cy] + 1)){
						ans[nx][ny] = ans[cx][cy] + 1 ; 
						qu.push_back({nx , ny}) ;
					}

				}
				else{
					ans[nx][ny] = ans[cx][cy] ;
					qu.push_front({nx , ny}) ;

				}
			}
		}
		for(int i = -2 ;i <= 2 ;i ++){
			for(int j = -2 ; j<= 2 ;j++){

				if(abs(i) == 2 || abs(j) == 2){
					int nx = cx + i , ny = cy + j ; 	
					if(valid(nx , ny) && !vis[nx][ny] && (ans[nx][ny] == -1 || (ans[nx][ny] >= 0 && ans[nx][ny] > ans[cx][cy] + 1) ) ){
						qu.push_back({nx , ny}) ; 
						ans[nx][ny] = ans[cx][cy] + 1 ; 
					}
				}
			}
		}
	}	
	cout<< ans[tx][ty] ; 
	return 0 ; 
}

Measured memory_bytes: 9572
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
// 型シノニム
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
// 定数
constexpr ll INF   = 1e16;
constexpr ll INM   = 114514;
constexpr ll MOD   = 1e9 + 7;
constexpr ld EPS   = 1e-12;
constexpr ll dx[4] = {1, 0, -1, 0};
constexpr ll dy[4] = {0, 1, 0, -1};
// 便利関数
void IOS() { ios::sync_with_stdio(false), cin.tie(0); }
template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, ll t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll mod) {
	if (a > 0) return a % mod;
	if (a % mod == 0) return 0;
	ll x = -a / mod + 1;
	a += x * mod;
	return a % mod;
}
ll powm(ll a, ll b, ll m) {
	if (b == 0) {
		return 1;
	} else if (b % 2 == 0) {
		ll d = powm(a, b / 2, m);
		return (d * d) % m;
	} else {
		return (powm(a, b - 1, m) * a) % m;
	}
}

// 本体

int main() {
	IOS();
	ll n;
	cin >> n;
	vector<ll> a;
	a.push_back(1);
	ll cnt = 1;
	for (int i = 0; i < 300; i++) {
		cnt++;
		a.push_back(a[i] + cnt);
	}
	map<ll, ll> mp;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			n /= i;
			mp[i]++;
		}
	}
	if (n != 1) {
		mp[n]++;
	}
	ll ans = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		ll unko = (*it).second;
		int tmp = upper_bound(a.begin(), a.end(), unko) - a.begin();
		ans += tmp;
	}
	dump(ans);
}

Measured memory_bytes: 3664
#include<stdio.h>
int main()
{
int x,y;
while(1)
{
  scanf("%d %d",&x,&y);
   if(x==0&&y==0)
  {
    break;
   }
  else
   {  
     if(x>y)
    {
      int tmp;
      tmp=x;x=y;y=tmp;
      printf("%d %d\n",x,y);
       
     }
    else
     {
        printf("%d %d\n",x,y);
     }
    }
 }
}



Measured memory_bytes: 2024
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define endd cout<<'\n';
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
ll mod=1000000007;
const ll N=100005;
int main()
{
fast;
    ll n,k;
    cin>>n>>k;
    ll p=1;
    ll a[n];
    f(i,n)
        cin>>a[i];
    for(ll i=k;i<n;i++)
    {
        if(a[i]>a[i-k])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 5260
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input!{
        n: usize,
        a: [i64;n],
    };

    let mut ret = 0;
    let mut pm = 0;
    for i in 0..n {
        pm += if a[i] < 0 {1} else {0};
        ret += a[i].abs();
    }
    if pm % 2 != 0 {
        ret -= a.iter().map(|x|x.abs()).min().unwrap().clone() * 2;
    }
    print!("{}", ret);

}



Measured memory_bytes: 4352
n,k=map(int,input().split())
h=list(map(int,input().split()))
h=sorted(h)
if n<=k:
    print(0)
else:
    ans=0
    for i in range(n-k):
        ans+=h[i]
    print(ans)


    
        
        
    
    
    
    
        


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

typedef long long int ll;

void dfsDep(ll node, ll cnt, vector<tuple<ll,ll,ll,ll,ll,ll,ll,ll> >&u)
{
    get<6>(u[node]) = cnt;
    if(get<1>(u[node]) != -1){
        dfsDep(get<1>(u[node]), cnt + 1, u);
    }
    if(get<2>(u[node]) != -1){
        dfsDep(get<2>(u[node]), cnt + 1, u);
    }
}

void dfsHei(ll node, ll cnt, vector<tuple<ll,ll,ll,ll,ll,ll,ll,ll> >&u)
{
    get<7>(u[node]) = max(cnt, get<7>(u[node]));
    if(get<3>(u[node]) != -1){
        dfsHei(get<3>(u[node]), cnt + 1, u);
    }
}

int main()
{
    ll n;
    cin >> n;
    vector<tuple<ll,ll,ll,ll,ll,ll,ll,ll> > u(n); //id0 left1 right2 p3 s4 deg5 dep6 hei7 
    for(ll i = 0;i < n;i++){
        cin >> get<0>(u[i]) >> get<1>(u[i]) >> get<2>(u[i]);
    }

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

    for(ll i = 0;i < n;i++){
        if(get<1>(u[i]) != -1){
            get<3>(u[get<1>(u[i])]) = get<0>(u[i]);
            get<4>(u[get<1>(u[i])]) = get<2>(u[i]);
            get<5>(u[i])++;
        }
        if(get<2>(u[i]) != -1){
            get<3>(u[get<2>(u[i])]) = get<0>(u[i]);
            get<4>(u[get<2>(u[i])]) = get<1>(u[i]);
            get<5>(u[i])++;
        }
    }

    for(ll i = 0;i < n;i++){
        if(get<3>(u[i]) == 0 && get<4>(u[i]) == 0){
            get<3>(u[i]) = -1;
            get<4>(u[i]) = -1;
        }
    }

    for(ll i = 0;i < n;i++){
        if(get<3>(u[i]) == -1){
            dfsDep(get<0>(u[i]), 0, u);
            break;
        }
    }

    for(ll i = 0;i < n;i++){
        if(get<5>(u[i]) == 0){
            dfsHei(get<0>(u[i]), 0, u);
        }
    }

    for(ll i = 0;i < n;i++){
        cout << "node " << get<0>(u[i]) << ": parent = " << get<3>(u[i]) << ", sibling = " << get<4>(u[i]) << ", degree = " << get<5>(u[i]) << ", depth = " << get<6>(u[i]) << ", height = " << get<7>(u[i]) << ", ";
        if(get<6>(u[i]) == 0){
            cout << "root\n";
        }
        else if(get<7>(u[i]) == 0){
            cout << "leaf\n";
        }
        else{
            cout << "internal node\n";
        }
    }
 
    return 0;
}



Measured memory_bytes: 3116
def cross3(O, A, B):
    ox, oy = O; ax, ay = A; bx, by = B
    return (ax - ox) * (by - oy) - (bx - ox) * (ay - oy)
def outer(x0, y0, x1, y1):
    return x0*y1 - x1*y0
def is_intersection(P0, P1, Q0, Q1):
    C0 = cross3(P0, P1, Q0)
    C1 = cross3(P0, P1, Q1)
    D0 = cross3(Q0, Q1, P0)
    D1 = cross3(Q0, Q1, P1)
    if C0 == C1 == 0:
        return 0
    return C0 * C1 <= 0 and D0 * D1 <= 0
def cross_point(P0, Q0, P1, Q1):
    x0, y0 = P0; x1, y1 = Q0
    x2, y2 = P1; x3, y3 = Q1
    dx0 = x1 - x0
    dy0 = y1 - y0
    dx1 = x3 - x2
    dy1 = y3 - y2

    s = (y0-y2)*dx1 - (x0-x2)*dy1
    sm = dx0*dy1 - dy0*dx1
    if s < 0:
        s = -s
        sm = -sm
    if s == 0:
        x = x0
        y = y0
    else:
        x = x0 + s*dx0/sm
        y = y0 + s*dy0/sm
    return x, y
while 1:
    x1, y1, x2, y2 = map(int, input().split())
    if x1 == y1 == x2 == y2 == 0:
        break
    P1 = (x1, y1); Q1 = (x2, y2)
    x3, y3, x4, y4 = map(int, input().split())
    P2 = (x3, y3); Q2 = (x4, y4)
    x5, y5, x6, y6 = map(int, input().split())
    P3 = (x5, y5); Q3 = (x6, y6)
    if (not is_intersection(P1, Q1, P2, Q2)
            or not is_intersection(P2, Q2, P3, Q3)
            or not is_intersection(P3, Q3, P1, Q1)):
        print("kyo")
        continue
    p1, q1 = cross_point(P1, Q1, P2, Q2)
    p2, q2 = cross_point(P2, Q2, P3, Q3)
    p3, q3 = cross_point(P3, Q3, P1, Q1)
    S = abs(outer(p2-p1, q2-q1, p3-p1, q3-q1)) / 2.
    if S < 1e-9:
        print("kyo")
    elif S < 100000:
        print("syo-kichi")
    elif S < 1000000:
        print("kichi")
    elif S < 1900000:
        print("chu-kichi")
    else:
        print("dai-kichi")


Measured memory_bytes: 5628
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 5010
#define pa(a, b) (data){a, b}
using namespace std;

struct data{int x; ll y;}d[210][N], last;
int n, m, x, y, len[N];
ll s[N], w[N], f[N], ans;

int main(){
	scanf("%d%d", &n, &m);
	s[1]=0; for(int i=2; i<=n; i++){scanf("%d", &x); s[i]=s[i-1]+x;}
	memset(len, 0, sizeof(len));
	for(int i=1; i<=m; i++)d[i][0]=pa(0, 0);
	ans=0; memset(w, 0, sizeof(w));
	for(int i=1; i<=n; i++){
		memset(f, 0, sizeof(f));
		for(int j=1; j<=m; j++){
			scanf("%d", &x);
			f[d[j][len[j]].x+1]+=x; last.x=d[j][len[j]].x+1; last.y=x;
			while(len[j]&&d[j][len[j]].y<=x){
				y=x-d[j][len[j]].y;
				f[d[j][len[j]-1].x+1]+=y; f[last.x]-=y;
				last.x=d[j][len[j]-1].x+1; last.y=y;
				len[j]--;
			}
			d[j][++len[j]]=pa(i, x);
		}
		for(int j=1; j<=i; j++)f[j]+=f[j-1];
		for(int j=1; j<=i; j++)w[j]+=f[j];
		for(int j=1; j<=i; j++)ans=max(ans, w[j]-s[i]+s[j]);
	}
	printf("%lld", ans);
	return 0;
}

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

int s[100000];

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

    for(int i=0;i<b;i++){
            cin>>c>>d;
            s[c]++;
            s[d]++;
    }
    for(int i=1;i<=a;i++){
        cout<<s[i]<<endl;
    }
}


Measured memory_bytes: 256