akhauriyash/Code-Regression huggingface dataset:
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

n = int(input())
if n == 1:
    print(0)
    exit()

facts = factorization(n)
cnt = 0
for fact in facts:
    for i in range(1, 100000):
        if (fact[1] - i) < 0:
            break
        fact[1] -= i
        cnt += 1
print(cnt)

Measured memory_bytes: 63424
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

vector<int> seen;
int graph[8][8];

ll dfs(int current, int n) {
  if(accumulate(all(seen), 0) == n) {
    return 1;
  }
  ll ans = 0;
  REP(i, n) {
    if(graph[current][i] == 1 && seen[i] == 0) {
      seen[i] = 1;
      ans += dfs(i, n);
      seen[i] = 0;
    }
  }
  return ans;
}


signed main() {
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  seen = vector<int>(n, 0);
  REP(i, m) {
    int x, y;
    cin >> x >> y;
    x--;y--;
    graph[x][y] = 1;
    graph[y][x] = 1;
  }
  seen[0] = 1;
  cout << dfs(0, n) << endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  int mi=1e9;
  int ma=-1e9;
  long long int sum=0;
  int a;
  for(int i=0;i<n;i++){
    cin>>a;
    sum+=a;
    ma=max(ma,a);
    mi=min(mi,a);
  }
  cout<<mi<<" "<<ma<<" "<<sum<<endl;
}



Measured memory_bytes: 3096
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
#define F first
#define S second
#define pb push_back
#define p push
using namespace std;
using ll = long long;
const ll maxn=5e5+5,inf = 1e18+18;
ll n,ans,x;
vector <ll> R;
string s;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0 ) ,cout.tie(0);
	cin>>n>>s;
	for(int i=n-1;i>=0;i--){
		if(s[i]=='R')R.pb(i);
	}
	R.pb(-1);
	for(int i=0;i<n;i++){
		if(R[x]==-1 || R[x]<i)break;
		if(s[i]=='W' && R[x]>i){
			swap(s[i],s[R[x]]);
			ans++;
			x++;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 5456
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <deque>
#include <array>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
#define pb push_back

map<string,int> latoi;

struct edge {
    int from,to,cost;
    string sto;
};
vector<edge> E;
array<int,101> d;
int n;

int main(){
    cin>>n;
    rep(i,n){
        string ope;
        cin>>ope;
        if(ope=="goto"){
            string sto;cin>>sto;
            sto.back()=':';
            E.pb({i,-1,0,sto});
            E.pb({i,i+1,1,""});
        } else {
            latoi[ope]=i;
            E.pb({i,i+1,0,""});
        }
    }
    rep(i,E.size()){
        if(E[i].to==-1) E[i].to=latoi[E[i].sto];
    }
    d.fill(1<<30);
    d[0]=0;
    while(1){
        bool f=0;
        for(const edge &e:E){
            if(d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                f=1;
            }
        }
        if(!f) break;
    }
    cout<<d[n]<<endl;
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>

typedef long long ll;
using namespace std;

int main(){
  ll k,a,b;
  string s;
  cin >> s >> k;
  a=s.length();
  b=min(a,k);
  for(int i=0;i<b;i++){
  	if(s[i]!='1'){
  		cout << s[i] << endl;
  		return 0;
  	}
  }
  cout << 1 << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 522222
#define LL long long

using namespace std;

vector <LL> loop;

LL pn,to[N],tims;
bool is_v[N],is_in[N];

int main(){
  ios_base::sync_with_stdio(0);
  cin>>pn>>tims;
  for(int i=1;i<=pn;i++){
    cin>>to[i];
  }
  int nat=1;
  while(is_v[nat]==0 && tims!=0){
    tims--;
    is_v[nat]=1;
    nat=to[nat];
  }
  if(tims==0) cout<<nat<<endl;
  else{
    while(is_in[nat]==0){
      loop.push_back(nat);
      is_in[nat]=1;
      nat=to[nat];
    }
  	cout<<loop[tims%loop.size()]<<endl;
  }
}

Measured memory_bytes: 6180
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

    int cnt = 0;
    rep(i, s.size()){
        if(i==0 && s[i]=='L' || i==s.size()-1 && s[i] == 'R')
            continue;
        if(s[i] == 'R' && s[i+1] == 'R' || s[i] == 'L' && s[i-1] == 'L')
            cnt++;
    }
    int res = min((int)s.size()-1, cnt + k * 2);
    cout << res << ln;
}

Measured memory_bytes: 3740
#include<stdio.h>

int main(void){
  unsigned long long a , b , c , k;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
  
  if(a+b >= k){
    if(a < k){
    printf("%lld\n",a);
  }
    else if(a >= k){
     printf("%lld\n",k);
   } 
  }
   
  else{
    printf("%lld\n",2*a + b -k);
  }
  
  return 0;
}

  

Measured memory_bytes: 1736
N,K = map(int,input().split())
A = list(map(int,input().split()))
cums = [0]
for a in A:
    cums.append(cums[-1] + a)

vs = []
for l in range(N):
    for r in range(l+1,N+1):
        vs.append(cums[r] - cums[l])
vs.sort(reverse=True)

for i in range(100,-1,-1):
    tmps = []
    for v in vs:
        if v&(1<<i):
            tmps.append(v)
    if len(tmps) >= K:
        vs = tmps

if len(vs) < K:
    print(0)
else:
    ans = vs[0]
    for v in vs[1:K]:
        ans &= v
    print(ans)

Measured memory_bytes: 71036
package main

import "fmt"

func main() {
	var x, y string
	fmt.Scan(&x, &y)
	hex := map[string]int{"A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15}
	switch {
	case hex[x] > hex[y]:
		fmt.Println(">")
	case hex[x] < hex[y]:
		fmt.Println("<")
	case hex[x] == hex[y]:
		fmt.Println("=")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>          
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)	make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long MOD = 1000000007;

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

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	rep(i,n){
		if(s[i] == '9') cout << '1';
		else cout << '9';
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define REPEACH(i,k) for(auto& i:k)
#define FOR(a, b) for (ll i = a; i < b + 1; i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
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;}


signed main(){
    int n,k;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;
    string t;
    cin >> t;
    int ans=0;
    for(int i=0;i!=t.size();i++){
        if(i<k){
            if(t[i]=='r'){
                ans+=p;
            }
            else if(t[i]=='s'){
                ans+=r;
            }
            else{
                ans+=s;
            }
        }
        else{
            if(t[i]==t[i-k]){
                t[i]='0';
                continue;
            }
            if (t[i] == 'r')
            {
                ans += p;
            }
            else if (t[i] == 's')
            {
                ans += r;
            }
            else
            {
                ans += s;
            }
        }
    }
    cout << ans << endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int64 n,m,v,p;
    cin >> n >> m >> v >> p;
    vector<int64> a(n);
    REP(i,n)cin >> a[i];
    sort(ALL(a),greater<int64>());
    int64 l = p - 1, r = n;
    while(r - l > 1){
        int64 mid = (l + r) / 2;
        bool flg = true;
        if(mid < p){
            flg = true;
        }else if(a[p-1] > a[mid] + m){
            flg = false;
        }else{
            int64 sum = (n - mid) * m + (p - 1) * m;
            FOR(i,p-1,mid){
                sum += min<int64>(m, a[mid] + m - a[i]);
            }
            flg = (sum >= m * v);
        }
        if(flg){
            l = mid;
        }else{
            r = mid;
        }
    }
    ANS(l + 1);
    return 0;
}

Measured memory_bytes: 1024
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

// End of template.


int main(){
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int64 n;
    cin >> n;

    for (int64 i = sqrt(n); i >= 0; --i) {
        if (n % i == 0) {
            print(i + n / i - 2);
            return 0;
        }
    }


    return 0;
}



Measured memory_bytes: 256
from itertools import combinations
from fractions import gcd
import math


n = int(input())
mx = 55555
ans = []
primes = [2]
for i in range(3, mx, 2):
    if all(i % p != 0 for p in primes):
        primes.append(i)
        if i % 5 == 1:
            ans.append(i)
        if len(ans) == n:
            break
print(*ans)


Measured memory_bytes: 5564
#include<bits/stdc++.h>
using namespace std;
#define ll long long
	
signed main(){
	ll n, i, j, val, temp, k;
	cin >> n >> k;
	ll cost[n+1];
	for( i = 1 ; i <= n ; i++ )
		cin >> cost[i];
	ll dp[n+1];
	dp[0] = dp[1] = 0;
	temp = INT_MAX;
	for( i = 2 ; i <= n ; i++ ){
		temp = INT_MAX;
		for( j = i-1 , val = 1 ; j >= 1 && val <= k ; j--, val++ ){
			temp = min( temp , dp[j] + abs(cost[i]-cost[j]) );
		}
		dp[i] = temp;
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



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

int m, n;
string str;

int main() {
    while (cin >> m >> n) {
        if (m == 0) break;
        
        int x = 1, y = 1, dir = 1;
        while (getline(cin,str)) {
            if (str == "STOP") {
                cout << x << " " << y << endl;
                break;
            }
            else if (str == "LEFT") dir = (dir + 1) % 4;
            else if (str == "RIGHT") dir = (dir + 3) % 4;
            else {
                string sub; int num;
                istringstream sin(str);
                sin >> sub >> num;
                if (sub == "FORWARD") {
                    for (int i = 0; i < num; ++i) {
                        int nx = x + dx[dir], ny = y + dy[dir];
                        if (nx <= 0 || nx > m || ny <= 0 || ny > n) break;
                        x = nx, y = ny;
                    }
                }
                else {
                    for (int i = 0; i < num; ++i) {
                        int nx = x - dx[dir], ny = y - dy[dir];
                        if (nx <= 0 || nx > m || ny <= 0 || ny > n) break;
                        x = nx, y = ny;
                    }
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 1228
// finish date: 2019/2/28

#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)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


//足し算
int add(int a, int b) {
    return (int) (((ll) a + b + bigmod) % bigmod);
}

//引き算
int sub(int a, int b) {
    return (int) (((ll) a - b + bigmod) % bigmod);
}

int main() {
    string K;
    int D;
    cin >> K >> D;
    vvvi dp(K.length(), vvi(2, vi(D, 0)));
    rep(i, K[0] - '0') dp[0][0][i % D] += 1;
    dp[0][1][(K[0] - '0') % D] += 1;

    rep(i, K.length() - 1) {
        //dp[][0][]の場合
        rep(k, D) {
            rep(j, 10) {
                dp[i + 1][0][(k + j) % D] = add(dp[i + 1][0][(k + j) % D], dp[i][0][k]);
            }
        }

        //dp[][1][]の場合
        rep(k, D) {
            rep(j, K[i + 1] - '0') {
                dp[i + 1][0][(k + j) % D] = add(dp[i + 1][0][(k + j) % D], dp[i][1][k]);
            }
            dp[i + 1][1][(k + (K[i + 1] - '0')) % D] = add(dp[i + 1][1][(k + (K[i + 1] - '0')) % D], dp[i][1][k]);
        }
    }

    cout << sub(add(dp[K.length()-1][0][0], dp[K.length()-1][1][0]), 1) << endl;

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

int main() {
    int n;
    int sum = 0;
    cin >> n;
    vector<int> b(n);
    for(int i = 1;i<n;i++) {
        cin >> b[i];
    }
    sum += b[1];
    for(int i = 2;i<n;i++) {
       sum += min(b[i-1],b[i]);
    }
    sum+= b[n-1];
    cout << sum << endl;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000") 
#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
const ll hax = 1e6 + 7;

int cnt[15];
void solve()
{
	repp(i, 1, 3)
	{
		sa(cnt[i]);
	}
	sort(cnt + 1, cnt + 3 + 1);
	if (cnt[1] == 5 && cnt[2] == 5 && cnt[3] == 7)
	{
		puts("YES");
	}
	else
	{
		puts("NO");
	}
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;


void solve() {
	ll x,y; cin >> x >> y;
	rep(i,0,x+1) {
		if (2*i + 4*(x-i) == y) {
			cout << "Yes";
			return;
		}
	}
	cout << "No";
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:\\Users\\Fish_Brother\\Desktop\\in", "r", stdin);
	//freopen("C:\\Users\\Fish_Brother\\Desktop\\out", "w", stdout);
#endif
	//int t; cin >> t; while(t--)
	solve();

	return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner
import math.sqrt

object Main extends App {
  def readALine(c:Int, ac:List[Int]):List[Int] =
    if (c > 0) readALine(c-1, sc.nextInt::ac) else ac.reverse
  def readLines(r:Int, c:Int, ac:List[List[Int]]):List[List[Int]] =
    if (r > 0) readLines(r-1, c, readALine(c, Nil)::ac) else ac.reverse
  val sc = new Scanner(System.in)
  val N = sc.nextLong

  def factorize(n:Long):List[(Long, Long)] = {
    def makePrimeLike():(()=>Long) = {
      val primes:Array[Long] = Array(2,3,5,7,11,13,17,19,23,29)
      var num = 0
      () => {
        if (num < 10) { num +=1; primes(num-1)}
        else if ((num & 1) == 1) { num +=1; (num>>1)*6 -1} else {num +=1; (num>>1)*6 +1} 
      }      
    }
    val generator = makePrimeLike()

    def iter(n:Long, ac:List[(Long, Long)]):List[(Long, Long)] = {
      def isDivided(n:Long, d:Long):Boolean = n == (n/d)*d
      def iterDev(n:Long, d:Long, c:Long):(Long, Long, Long) =
        if (isDivided(n, d)) iterDev(n/d, d, c+1) else (n, d, c)
      
      val div = generator()

      if (n == 1) ac
      else if (n < div*div) (n, 1L)::ac 
      else {
        val (q, d, c) = iterDev(n, div, 0)
        if (c > 0) iter(q, (d, c)::ac) else iter(q, ac)
      }
    }
    iter(n, Nil)    
  }

  def solver(n:Long):Long = {
    val factor = factorize(n)
    factor.map((t) => t match { case (a, x) => ((sqrt(8*x+1)-1)/2).toLong }).sum 
  }

  println(solver(N))

}

Measured memory_bytes: 57008
#include <bits/stdc++.h>
using namespace std;
int l,r;
int main() {
    scanf("%d %d",&l,&r);
    if (r-l+1>=2019) printf("0");
    else {
        int minn=2020;
        for (int i=l; i<r; i++) {
            for (int j=i+1; j<=r; j++) {
                minn = min(minn,((i%2019)*(j%2019))%2019);
            }
        }
        printf("%d",minn);
    }
}


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

int main(void) {
  int a, i;
  char c[10], d[10];
  scanf("%s", c);
  scanf("%s", d);
  //printf("%s %s\n", c, d);
  int t = strlen(c);
  for(i = t; i < t + strlen(d); ++i)
    c[i] = d[i - t];
  c[t + strlen(d)] = '\0';
  a = atoi(c);
  //printf("%s\n", c);
  //printf("%d\n", a);
  if(sqrt(a) == (int)sqrt(a)) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n; 
ll k; 
int get_center(int int_lower, int int_upper){
    return int_lower+(int_upper-int_lower)/2;
}

bool can_cut(ll A[], ll X){
    ll count = 0;
    for(int i=0; i<n; i++) count += (A[i]-1)/X;
    if(count <= k){
        return true;
    }else{
        return false;
    }
}

int main(){
    cin >> n >> k;
    ll a[n]; 
    ll max_a = 0;
    for(int i=0; i<n; i++){
        cin >> a[i];
        max_a = max(max_a, a[i]);
    }
    ll lower = 0;
    ll upper = max_a;
    while(upper-lower>1){
        ll x = (lower+upper)/2;
        bool bool_can_cut = can_cut(a, x);
        if(bool_can_cut){
            upper = x;
        }else{
            lower = x;
        }
    }

    cout << upper << "\n";
}

Measured memory_bytes: 5176
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int ans;
string s;
int main(){
	ios::sync_with_stdio(0);
	cin>>s;
	rep(i,sz(s)){
		int now=0;
		forn(j,i,sz(s)){
			if(s[j]!='A'&&s[j]!='C'&&s[j]!='G'&&s[j]!='T')
			break;
			now++;
		}
		ans=max(now,ans);
	}
	cout<<ans;
	re 0;
}


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

void printVector(vector<int> v) {
    for (auto x : v) {
        cout << x << ' ';
    }
    cout << '\n';
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(m + 1);
    //printVector(v);
    for (int i = 0; i <= n - 1; i++) {
        int k;
        cin >> k;
        for (int j = 0; j <= k - 1; j++) {
            //cout << j << '\n';
            int a;
            cin >> a;
            v[a]++;
            //printVector(v);
        }
    }
    //printVector(v);
    int count = 0;
    for (int i = 0; i <= m; i++) {
        //cout << v[i] << '\n';
        if (v[i] == n) count++;
    }
    cout << count << '\n';
    return 0;
}

Measured memory_bytes: 3612
#include <stdio.h>
int main(void)
{
	int vertical, horizonal, work;
	
	fscanf(stdin, "%d %d", &vertical, &horizonal);
	while (vertical && horizonal) {
		while (vertical--) {
			work = horizonal;
			while (work--) fputc('#', stdout);
			fputc('\n', stdout);
		}
		fputc('\n', stdout);
	fscanf(stdin, "%d %d", &vertical, &horizonal);
	}
	
	return 0;
}

Measured memory_bytes: 576
#include<iostream>
    #include<cstdio>
    using namespace std;
     
    long gcd(long x,long y){
      long temp,tmp,temped,r;
     
      if(x<=y){
        temp = x;
        x = y;
        y = temp;
      }
     
      if(x%y==0){
        return y;
      }
     
      while(y != 0){
        tmp = y;
        y = x%y;
        //x = tmp;
        x = tmp;
      }
     
      return x;
    }
     
    long lcm(long x,long y){
      return y/gcd(x,y)*x;
    }
     
    int main(){
      long N,a,b,ans;
      cin>>N;
      cin>>a;
      ans = a;
      for(int i=1;i<N;i++){
        cin>>b;
        ans = lcm(ans,b);
        }
     
      cout<<ans<<endl;
     
      return 0;
    }

Measured memory_bytes: 256
// Bismillahirrahmanirrahim
// AgriCoder IPB
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <cctype>
#include <cstdlib>
#include <utility>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <sstream>
#include <clocale>
#include <ctime>
#include <climits>
#include <cassert>
//#include <unordered_map>
using namespace std;

#define FOR(i, agri, coder) for (int i = (int)agri; i <= (int)coder; i++)
#define REP(agri,coder) for (int agri = 0; agri < (int)coder; agri++)
#define FOREACH(i,agricoder) for (typeof((agricoder).end()) i = (agricoder).begin(); i != (agricoder).end(); ++i)
//for (auto& it: agricoder)
#define RESET(agri,coder) memset(agri, coder, sizeof(agri))
#define pb push_back
#define mp make_pair
#define NL printf("==========================\n")
#define getchar_unlocked getchar // for codeforces

int arahbar[8] = {0,1,0,-1,1,1,-1,-1};
int arahkol[8] = {1,0,-1,0,1,-1,-1,1};
int kudabar[8] = {-2,-1,1,2, 2,1 , -1 ,-2};
int kudakol[8] = {1 ,2 ,2,1,-1,-2 , -2,-1};

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef unsigned int UNi;

template<typename T>
T getNum() {
   T res=0;
   char c;
   while(1)
   {
      c=getchar_unlocked();
      if(c==' ' || c=='\n') continue;
      else break;
   }
   bool negatif;
   if (c=='-') {
       negatif = true;
       res = 0;
   }
   else {
       res=c-'0';
       negatif = false;
   }
   while(1)
   {
      c=getchar_unlocked();
      if('0'<=c && c<='9') res=res*10 + c-'0';
      else break;
   }
   if (negatif) res*=-1;
   return res;
}

inline void boost() { //dont use with cstdio, dont use in interactives
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
}
//freopen("badmilk.in", "r", stdin);
//freopen("badmilk.out", "w", stdout);
//fclose(stdin);
//fclose(stdout);
#define INF 1000000000
#define EPS 1e-9
#define MAX_N 100005
// ================================  TEMPLATE ENDS HERE ================================================== //

int main() {
	//(A * k == C) MOD B
	int A,B,C;
	cin >> A >> B >> C;
	bool ada = false;
	FOR(k,1,1000000) {
		if ( (A*k)%B == C ) ada = true;
	}
	
	if (ada) printf("YES\n");
	else printf("NO\n");
	return 0;
}
//Alhamdulillahirabbilalamin


Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func scanInt() int {
	scanner.Scan()
	a, err := strconv.Atoi(scanner.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := scanInt()
	k := scanInt()

	sum := float64(0.0)
	for i := 1; i <= n; i++ {
		if i >= k {
			sum += 1.0 / float64(n)
			continue
		}
		cnt := 1
		f := 2
		for f*i < k {
			cnt++
			f *= 2
		}
		sum += 1.0 / float64(n) * (1.0 / math.Pow(2, float64(cnt)))
	}

	fmt.Println(sum)
}


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

int main()
{
	int r,a,b;
	cin>>r;
	if(r==1) cout<<"Hello World"<<endl;
	if(r==2)
	{
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0002
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> sumList = new List<string>();
            string str;
            while ((str = Console.ReadLine()) != null)
            {
                string[] str1 = str.Split(' ');
                int a = int.Parse(str1[0]);
                int b = int.Parse(str1[1]);
                sumList.Add((a + b).ToString());
            }
            for (int i = 0; i < sumList.Count; ++i)
            {
                Console.WriteLine(Measure(sumList, i));
            }

        }
        static int Measure(List<string> sumList,int i)
        {
            return sumList[i].Length;
        }

    }
}



Measured memory_bytes: 13864
#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)
typedef long long ll;
int main(){

	int n,a,b;
	int p;

	cin >> n>>a>>b;
	int c1=0,c2=0,c3=0;

	rep(i, n) {
		cin >> p;
		if (p <= a) {
			c1++;
		} else if (p >= b+1) {
			c3++;
		} else {
			c2++;
		}
 	}
 	int mi = min(c1,c2);	
 	cout << min(mi, c3) << endl;
 	return 0;
 }



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

int main() {
  int a,b;cin>>a>>b;
  if (a%3==0 || b%3==0 || (a+b)%3==0) cout << "Possible";
  else cout << "Impossible";
}


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

using namespace std;

int main(){

 int n;
 cin>>n;
 int num[4][3][10] = {};
 for(int i=0;i<n;i++){
  int b, f, r, v;
  cin>>b>>f>>r>>v;
  num[b-1][f-1][r-1] += v;
 }

 for(int i=0;i<4;i++){
   if(i) cout<<"####################"<<endl;

   for(int j=0;j<3;j++){
     for(int k=0;k<10;k++){
       cout<<" "<<num[i][j][k];
     }
      cout<<endl;
    }
   }
}


Measured memory_bytes: 3088
package main
     
    import ("fmt")
     
    func main(){
    	var a, b int
     
    	fmt.Scan(&a, &b)
     
    	if a < b{
    		for i := 0 ; i < b ; i++{
    			fmt.Print(a)
    		}
    	}else {
    		for i := 0 ; i < a ; i++{
    			fmt.Print(b)
    		}
    	}
    	fmt.Println()
     
    }

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<ll> A(X), B(Y), C(Z);
  for(int i = 0; i < X; i++) cin >> A[i];
  for(int i = 0; i < Y; i++) cin >> B[i];
  for(int i = 0; i < Z; i++) cin >> C[i];
  vector<ll> data;
  for(int i = 0; i < X; i++){
    for(int j = 0; j < Y; j++){
      data.push_back(A[i] + B[j]);
    }
  }
  sort(all(data), greater<ll>());
  vector<ll> data2;
  int size = min(5000, (int)data.size());
  for(int i = 0; i < size; i++){
    for(int j = 0; j < Z; j++){
      // //cerr << "debug: " << data[i] + C[j] << endl;
      data2.push_back(data[i] + C[j]);
    }
  }
  sort(all(data2), greater<ll>());
  for(int i = 0; i < K; i++) cout << data2[i] << endl;
  return 0;
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

int main(){

    string s; cin >> s;

    cout << s.substr(0,3) << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    bool maki=false;
    for(int i=0;i<n;i++){
        if(c*(n-1)<=b-a+i*(c+d) && b-a+i*(c+d)<=d*(n-1))maki=true;
    }
    cout <<((maki)?"YES":"NO")<<endl;
    return 0;
}



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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 2147483647;
const ll INFL = 9223372036854775807;
const ll mod = 1000000007;







int main() {
	int n;
	cin >> n;
	VVI a(n, VI(2)), b(n, VI(2)), c(n, VI(2));
	REP(i, n) {
		cin >> a[i][0] >> b[i][0];
		a[i][1] = b[i][1] = c[i][1] = i;
		c[i][0] = a[i][0] + b[i][0];

	}
	sort(ALL(c));
	reverse(ALL(c));

	ll ans = 0;
	REP(i, n) {
		if (i % 2 == 0)ans += a[c[i][1]][0];
		else ans -= b[c[i][1]][0];
	}

	cout << ans << endl;



}

Measured memory_bytes: 16640
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <limits>
#include <bitset>
#include <functional>
#include <type_traits>
#include <queue>
#include <stack>
#include <array>
#include <random>
#include <utility>
#include <cstdlib>
#include <ctime>

using namespace std;

#define rep(i, n) for (int i=0; i < (int)n; i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)
#define n (20)
int main()
{
    int N,M;
    cin>>N>>M;
    priority_queue<int> q;
    rep(i,N){
        int a;
        cin>>a;
        q.push(a);
    }
    rep(i,M){
        int a=q.top();q.pop();
        q.push(a/2);
    }
    int64_t sum=0;
    rep(i,N){
    sum+=q.top();q.pop();
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 892
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""

from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def floor(a, b):
    """floor(a/b) 整数値を返す"""
    c = (a - a % b)/b
    return int(c)


def main():

    def dfs(x):
        lunlun.append(x)
        d = x % 10
        if len(str(x)) == 11:
            return

        for v in [d+1, d, d-1]:
            if 0 <= v <= 9:
                dfs(x*10+v)

    K = int(input())
    cnt = 0
    lunlun = []

    for i in range(1, 10):
        dfs(i)

    lunlun.sort()
    print(lunlun[K-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 100316
N,W = map(int, input().split())

INF = 10**9+1
M = 10**5+1
dp = [INF]*M #dp[i]:価値の総和がiになるときの重さの総和の最小値
dp[0] = 0

for _ in range(N):
    w, v = map(int, input().split())
    for i in range(M-1, v-1, -1):
        dp[i] = min(dp[i], dp[i-v]+w)
        
for i in range(M-1, -1, -1):
    if dp[i] <= W:
        print(i)
        break

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

using namespace std;
typedef long long ll;

int main() {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    cout << (c * 60 + d) - (a * 60 + b) - k << endl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
			Scanner scanner = new Scanner(System.in);
			String s = scanner.next();
			String ans = s.contains("a") && s.contains("b") && s.contains("c") ? "Yes" : "No";
			System.out.println(ans);
	}

}

Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>
#include <sstream>
#include <iomanip>
#include <unordered_map>

using namespace std;
typedef long long ll;


ll ans, mx, mn, flag, sum, cnt;

int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int y=s.size();
	int t=min(y,n);
	for(ll i=0; i<t; i++){
		cout<<s[i];
	}
	if(s.size() > n) cout<<"...";
}


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

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



Measured memory_bytes: 3096
s = input()
s = s.replace('BC','D')
a_cnt = 0
before_s = 'A'
ans = 0
for i in range(len(s)):

    if s[i] == 'A':
        a_cnt += 1
        before_s = s[i]
    elif (s[i]=='D'):
        ans +=a_cnt
        before_s = 'A'
    else:
        a_cnt = 0
        before_s = s[i]

print(ans)

Measured memory_bytes: 73720
from operator import or_
from functools import reduce
import sys
readline = sys.stdin.readline

def check(a, l, r):
    if (reduce(or_, [r*(1<<k) for k in range(K) if l & (1<<k)])&filt).bit_length() + a > K:
        return True
    else:
        return False

N, K = map(int, readline().split())
A = list(map(int, readline().split()))
A = [a for a in A if a < K]
A.sort()
filt = (1<<K) - 1
M = len(A)
A = [None]+A
dpl = [0]*(M+2)
dpr = [0]*(M+2)
dpl[0] = 1
dpr[M+1] = 1

for i in range(1, M+1):
    dpl[i] = dpl[i-1]*(1<<A[i])&filt |dpl[i-1]

for i in range(M, 0, -1):
    dpr[i] = dpr[i+1]*(1<<A[i])&filt |dpr[i+1]
    
ok = M+1
ng = 0
while abs(ok - ng) > 1:
    med = (ok+ng)//2
    if check(A[med], dpl[med-1], dpr[med+1]):
        ok = med
    else:
        ng = med
print(ng)


Measured memory_bytes: 77660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll N, X, Y;
  cin >> N >> X >> Y;
  X--;
  Y--;
  vector<ll> ans(N, 0);
  rep(i, N){
    rep2(j, i+1, N){
      ll d = 0;
      if(j < X){
        d = j-i;
      }
      else if(i < X && X <= j && j <= Y){
        d = min(j-i, X-i+1+Y-j);
      }
      else if(i < X && Y < j){
        d = X-i+1+j-Y;
      }
      else if(X <= i && j <= Y){
        d = min(j-i, i-X+1+Y-j);
      }
      else if(X <= i && i <= Y && Y < j){
        d = min(j-i, i-X+1+j-Y);
      }
      else{
        d = j-i;
      }
      ans.at(d)++;
    }
  }
  rep(i, N-1){
    cout << ans.at(i+1) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

int gcd(int a,int b)
{
  if(a>b)swap(a,b);
  if(a==0){return b;}
  else return gcd(b%a,a);
}
map<ll,ll>prime_factor(int m)
{
  map<ll,ll>res;
  ll sqrm=sqrt(m)+1;
  for(int i=2;i<sqrm+1;i++)
  {
    while(m%i==0){res[i]++;m/=i;}
    if(m==1)break;
  }
  if(m>1)res[m]++;
  return res;
}

struct sieve{
  int p=0;
  vector<bool> furui;
  sieve(int n){
    furui.resize(n,1);
    furui[0]=0;
    furui[1]=0;
    for(int i=2;i<n;i++)if(furui[i])for(int j=i*2;j<n;j+=i)furui[j]=0;
  }
  bool isprime(int m){return furui[m];}
};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int a;
  cin>>n;
  cin>>a;
  vector<ll>b(n+1);
  b[n]=a;
  a=abs(a);
  rep(i,n){cin>>b[n-1-i];}
  rep(i,n+1)
  {
    if(b[i]!=0)
    {
      if(a==0)
      {
        a=abs(b[i]);
      }
      else a=gcd(a,abs(b[i]));
    }
  }
  auto ma=prime_factor(a);
  auto ma2=prime_factor(abs(b[0]));
  sieve si(n+10);
  set<int>ans;
  
  if(b[0]==0)
  {
    rep(p,n+2)
    {
      if(!si.isprime(p))continue;
      vector<ll>tb(p-1,0);
      bool f=1;
      rep(i,p-1)
      {
        for(int j=i;j<=n;j+=p-1)tb[i]+=b[j];
        if(tb[i]%p!=0){f=0;break;}
      }
      if(f)
      {
        ans.insert(p);
      }
    }
  }
  else 
  {
    for(auto tp:ma2)
    {
      int p=tp.first;
      if(p-1>n)continue;
      vector<ll>tb(p-1,0);
      bool f=1;
      rep(i,p-1)
      {
        for(int j=i;j<=n;j+=p-1)tb[i]+=b[j];
        if(tb[i]%p!=0){f=0;break;}
      }
      if(f)
      {
        ans.insert(p);
      }
    }
  } 
  for(auto tp:ma)
  {
    ans.insert(tp.first);
  }
  for(auto tp:ans)
  {
    cout<<tp<<"\n";
  }


  return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int mo=1e9+7;
const int N=1e5+10;
int n,k,ans;
int L[N],R[N],val[N],pos[N],cnt,sum[2][N];
int main(){
	scanf("%d%d",&k,&n);
	for (int l=1,r;l<=k;l=r+1){
		r=k/(k/l);
		L[++cnt]=l,R[cnt]=r,val[cnt]=k/l;
	}
	for (int i=1;i<=cnt;i++){
		sum[0][i]=1;
		pos[i]=upper_bound(L+1,L+cnt+1,val[i])-L-1;
	}
	int cur=1;
	for (int i=1;i<=n;i++,cur^=1)
		for (int j=1;j<=cnt;j++) sum[cur][j]=(sum[cur][j-1]+sum[cur^1][pos[j]]*1ll*(R[j]-L[j]+1)%mo)%mo;
	cout<<sum[cur^1][cnt];
	return 0;
}

Measured memory_bytes: 1792
n, m = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float('inf') for i in range(n+1)]
dp[0] = 0
for i in range(n):
    for coin in coins:
        if coin <= i+1:
            dp[i+1] = min(dp[i+1 - coin] + 1, dp[i+1])
print(dp[n])



Measured memory_bytes: 7388
#include <iostream>

using namespace std;

int main() {
  while (true) {
    int r, w, c, r_;
    cin >> r >> w >> c >> r_;
    if (r == 0) break;
    
    int x = 0, y = 0;
    while (r + x * r_ < c * w + c * y) {
      x++;
    }
    
    cout << x << endl;
  }
}


Measured memory_bytes: 3012
#include<iostream>
using namespace std;
#define N 105
#define inf 0x3f3f3f3f
int x[N];
int y[N];
int h[N];
int cx,cy,H;
int n;
bool judge(int temp_h,int cx,int cy)
{
    int temp;
    for(int i=1;i<=n;i++)
    {
        temp=max(temp_h-abs(cx-x[i])-abs(cy-y[i]),0);
        if(temp!=h[i]) return false;
    }
    return true;
}
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        for(int i=1;i<=n;i++) cin>>x[i]>>y[i]>>h[i];
        bool flag=false;
        for(int i=0;i<=100;i++)
        {
            for(int j=0;j<=100;j++)
            {
                int temp_h;
                for(int k=1;k<=n;k++)
                {
                    if(h[k]!=0)
                    {
                        temp_h=h[k]+abs(i-x[k])+abs(j-y[k]);
                        break;
                    }
                }
                if(judge(temp_h,i,j))
                {
                    flag=true;
                    H=temp_h;
                    cx=i;cy=j;
                    break;
                }
            }
            if(flag) break;
        }
        cout<<cx<<" "<<cy<<" "<<H<<endl;
    }
}

Measured memory_bytes: 256