akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
 
using namespace std;
 
#define ll long long
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pii pair<int,pi>
#define X first
#define Y second
#define pb push_back
#define ab(x) ((x)<0?(-(x)):(x))
#define xx(x) ((x)*(x))
#define mp make_pair
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vpi vector<pi>
#define vpll vector<pll>
#define ALL(x) (x).begin(),(x).end()
#define Max (1<<30)
#define LLMax (1ll<<60)
template<class T>string ToString(T t){stringstream s;s<<t;return s.str();}
template<class T>void ToOther(T&t,string a){stringstream s(a);s>>t;}



int N,M,C,S,G;



struct node{
	int n,c,cost;
	node(int A,int B,int D){
		n=A;	c=B;	cost=D;
	}
	node(){}
	bool operator < (const node& t )const {
		return cost > t.cost;
	}
};

int p[155];
int q[155];
int di[155];
int Cost[22][12222];
int dif[22];
int d[102][22];


int gg[22][105][105];

int Get(int c,int d){
	if(d<=10000)return Cost[c][d];
	return Cost[c][10000]+dif[c]*(d-10000);
}

void make(int c){
	
	for(int k=1;k<=N;k++)for(int i=1;i<=N;i++)for(int j=1;j<=N;j++){
		gg[c][i][j]=min(gg[c][i][k]+gg[c][k][j],gg[c][i][j]);
	}
}
int main(){
//	freopen("output.txt","w",stdout);
	while(cin>>N>>M>>C>>S>>G,N){
		memset(p,0,sizeof(p));
		memset(dif,0,sizeof(dif));
		memset(q,0,sizeof(q));
		memset(dif,0,sizeof(dif));
		memset(gg,63,sizeof(gg));
		memset(d,63,sizeof(d));
		int MMM=gg[0][0][0];
		memset(Cost,0,sizeof(Cost));

		for(int i=1;i<=N;i++)for(int k=1;k<=C;k++)gg[k][i][i]=0;
		while(M--){
			int _S,_E,_D,_C;
			scanf("%d%d%d%d",&_S,&_E,&_D,&_C);
			gg[_C][_S][_E]=min(gg[_C][_S][_E],_D);
			gg[_C][_E][_S]=min(gg[_C][_E][_S],_D);
		}
		for(int i=1;i<=C;i++)scanf("%d",&p[i]);

		for(int i=1;i<=C;i++){
			Cost[i][0]=0;
			for(int k=1;k<p[i];k++)scanf("%d",&q[k]);
			for(int k=0;k<p[i];k++)scanf("%d",&di[k]);
			q[p[i]]=Max;
			int pos=0;
			int now=0;
			dif[i]=di[p[i]-1];
			for(int k=1;k<=10000;k++){
				now+=di[pos];
				Cost[i][k]=now;
				if(q[ pos+1 ]==k)pos++;
			}
		}
		for(int i=1;i<=C;i++)make(i);
		priority_queue< node > q;
	
		q.push(node(S,1,0));
		d[S][1]=0;
//	int n,c,dis,cost;
// 	int e,d,c;
		int r=Max;

		while(q.size()){
			int k=q.top().n;
			int c=q.top().c;
			int cost=q.top().cost;
			
		
			q.pop();
			if(k==G)r=min(r,cost);

	
			if(d[k][c]<cost)continue;

			for(int i=1;i<=N;i++)for(int nc=1;nc<=C;nc++)if(gg[nc][k][i]!=MMM){
				if(i==k)continue;
				int t=i;
				int w=gg[nc][k][i];
				;
				int nxt_cost=cost;
		
				nxt_cost+=Get(nc,w);
				

#define T1 t][nc

				if(d[T1]>nxt_cost ){
					d[T1]=nxt_cost;
					q.push( node(t,nc,nxt_cost) );
				}
			}
		}
		if(r==Max)r=-1;
		cout<<r<<endl;
	}
}

Measured memory_bytes: 4824
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits> 
#include <time.h>

int main(void){
    long N;
    std::cin >> N;
    long A[100000+1]={};
    for(long i=0; i<=N; i++){
        std::cin >> A[i];
    }

    long notnew_node[100000+1]={};
    notnew_node[0]=1;
    long lim=100000000;
    for(long i=1; i<N; i++){
        if(notnew_node[i-1]<LONG_MAX/2){
            notnew_node[i]=notnew_node[i-1]*2-A[i];
        }else{
            notnew_node[i]=LONG_MAX;
        }
        if(notnew_node[i]<0){
            for(long j=i+1; j<N; j++){
                notnew_node[j]=-1;
            }
            break;
        }
    }

    long result=A[N];
    long under_node=A[N];
    bool flag=1;
    if(A[0]!=0){
        flag=0;
    }
    for(long i=N-1; i>=0; i--){
        if(notnew_node[i]>=under_node){
            result+=under_node;
            under_node = under_node+A[i];
        }else if(notnew_node[i]>=(under_node/2+under_node%2)){
            result+=notnew_node[i];
            under_node = notnew_node[i]+A[i];
        }else{
            flag=0;
            break;
        }
        result+=A[i];
    }
    if(flag){
        std::cout << result << std::endl;
    }else if(N==0 && A[0]==1){
        std::cout << 1 << std::endl;
    }else{
        std::cout << -1 << std::endl;
    }
    return 0;
}

Measured memory_bytes: 5160
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <list>
#include <cmath>
#include <stack>
#include <queue>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int main()
{
	int n;
	cin >> n;
	int a[20];
	int b[20];
	int c[20];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
	for (int i = 0; i < n - 1; i++)
	{
		cin >> c[i];
	}

	int point = 0;
	for (int i = 0; i < n; i++)
	{
		int meal = a[i];
		int before = -1;
		if (i != 0)
		{
			before = a[i - 1];
		}
		point += b[meal - 1];
		if (meal - before == 1)
		{
			point += c[before - 1];
		}
	}
	cout << point;
}


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

void print(int a[], int n) {
	for (int i = 0; i < n; i++) {
		if (i > 0) cout << " ";
		cout << a[i];
	}
	cout << endl;
}

void bubbleSort(int a[],int n) {
	int c = 0;
	bool flag = true;
	for (int i = 0; flag; i++) {
		flag = false;
		for (int j = n - 1; j >= i+1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j-1]);
				flag = true;
				c++;
			}
		}
	}
	print(a, n);
	cout << c << endl;
}

int main() {
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	bubbleSort(a, n);

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll X,N;
unordered_set<ll> us;

int main(){
    cin >> X >> N;
    for(int i=0;i<N;i++){
        ll a;
        cin >> a;
        us.insert(a);
    }
    ll ans = 1e9;
    ll diff = 1e9;
    for(int i=-10;i<110;i++){
        if(us.find(i) != us.end()) continue;
        if(diff < abs(X-i)) continue;
        if(diff == abs(X-i) && i > ans) continue;
        ans = i;
        diff = abs(X-i);
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

#define endl '\n'
#define ff first
#define ss second
#define sz(v) (int)v.size()
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=1e5+5,mod=1e9+7,bit=20;

//If divides N then remove all the powers of that divisor
//If not then rem = 1 + k*x , divisors of rem

set<ll> ans,d,dn;

signed main()
{
    fast;

    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        f(i,1,sqrt(n))
        {
            if(n%i==0)
            {
                d.insert(i);
                d.insert(n/i);
            }
        }
        d.erase(1);
        for(auto x:d)
        {
            ll curr=n;
            while(curr%x==0)
            {
                curr/=x;
            }
            if((curr-1)%x==0)
            {
                ans.insert(x);
            }
        }
        ll nn=n;
        n--;
        f(i,1,sqrt(n))
        {
            if(n%i==0)
            {
                dn.insert(i);
                dn.insert(n/i);
            }
        }
        dn.erase(1);
        n=nn;
        for(auto x:dn)
        {
            if(d.find(x)==d.end())
            {
                ans.insert(x);
            }
        }
        d1((int)ans.size());
    }
    return 0;
}


















Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;


int n;
vector<vector<int>> tree;

vector<int> dis(int origin) {
	vector<int> d(n,n);
	d[origin] = 0;
	priority_queue<pii, vector<pii>, greater<pii>>pq;
	vector<bool> isChecked(n);
	pq.push(make_pair(0,origin));
	while (!pq.empty()) {
		int v = pq.top().second;
		pq.pop();
		if (!isChecked[v]) {
			for (auto it = tree[v].begin(); it != tree[v].end();it++) {
				if (d[*it] > d[v] + 1) {
					d[*it] = d[v] + 1;
					pq.push(make_pair(d[*it], *it));
				}
			}

			isChecked[v] = true;
		}
	}
	return d;
}

int main() {

	
	cin >> n;
	tree = vector<vector<int>>(n);
	for (int i = 0; i < n - 1;i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		tree[a].emplace_back(b);
		tree[b].emplace_back(a);
	}

	
	vector<int> fd = dis(0);
	vector<int> sd = dis(n - 1);

	int cntS = 0;
	int cntF = 0;
	for (int i = 0; i < n; i++) {
		if (fd[i] > sd[i]) {
			cntS++;
		}
		else {
			cntF++;
		}
	}

	cout << (cntF > cntS ? "Fennec" : "Snuke") << endl;

}


Measured memory_bytes: 6884
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	string s,t;
	cin >> s >> t;
	int ans = 0;
	rep(i,0,s.length())ans += s[i] != t[i] ? 1 : 0;
	cout << ans << '\n';
}


Measured memory_bytes: 3800
#include <iostream>
using namespace std;
int main(void){
    int i,n,sum,cnt;
    int a[10000];
    
    while(1){
        cin >> n ;
        if(n == 0) break;
        
        sum = 0;
        
        for(i = 0;i < n;i++){
            cin >> a[i];
            sum += a[i];
        }
       // cout << sum;
        sum = sum / n;
        //cout << " " << sum << " ";
        cnt = 0;
        for(i = 0;i< n;i++){
            if(a[i] <= sum) cnt++;
        }
        
        cout << cnt << endl;
    }
}



Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli mod = 1e9+7;

lli ExGCD(lli a, lli b, lli &x, lli &y){
    lli d=a;
    x=1; y=0;
    if(b!=0){ d=ExGCD(b, a%b, y, x); y-=a/b*x; }
    return d;
}
lli inverse(lli a){
    lli x,y;
    ExGCD(a, mod, x, y);
    return x>0? x: mod+x;
}

lli fact[300001];
void maketable(){
    fact[0] = 1;
    for(int i=0; i<300000; i++){
        fact[i+1] = fact[i]*(i+1) %mod;
    }
}
lli combination(lli n, lli r){
    return fact[n] *inverse(fact[n-r]) %mod *inverse(fact[r]) %mod;
}

int main(){
    maketable();
    int n;
    cin >> n;
    vector<int> parent(n, -1);
    vector<vector<int>> childs(n);
    for(int i=0; i<n-1; i++){
        int a,b;
        cin >> a >> b;
        parent[b] = a;
        childs[a].push_back(b);
    }
    int root = -1;
    for(int i=0; i<n; i++){
        if(parent[i] == -1){
            root = i;
            break;
        }
    }

    // dp[i][j] = (頂点iを根とする部分木で、高さの種類がjの時の通り数）
    vector<vector<lli>> dp(n, vector<lli>(n+1, 0));
    auto dfs = [&](auto dfs, int v) -> void {
        if(childs[v].empty()){
            dp[v][1] = 1;
            return;
        }
        dp[v][0] = 1;
        for(int nv: childs[v]){
            dfs(dfs, nv);
            vector<lli> ndp(n+1, 0);
            // 部分木をマージ
            for(int i=0; i<=n; i++){
                if(dp[v][i] == 0) continue;
                for(int j=0; j<=n; j++){
                    if(dp[nv][j] == 0) continue;
                    if(i <= j){
                        for(int k=0; k<=i; k++){
                            ndp[i+j-k] += dp[v][i] *dp[nv][j] %mod *combination(j, k) %mod *combination(i-k+j, j) %mod;
                            ndp[i+j-k] %= mod;
                        }
                    }else{
                        for(int k=0; k<=j; k++){
                            ndp[i+j-k] += dp[v][i] *dp[nv][j] %mod *combination(i, k) %mod *combination(j-k+i, i) %mod;
                            ndp[i+j-k] %= mod;
                        }
                    }
                }
            }
            dp[v] = move(ndp);
        }
        // 親の頂点1個分スライド
        for(int i=n; i>0; i--){
            dp[v][i] = dp[v][i-1];
        }
    };
    dfs(dfs, root);
    lli ans = 0;
    for(int i=0; i<=n; i++){
        ans += dp[root][i];
    }
    ans %= mod;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 5644
#include<bits/stdc++.h>
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define LSOne(i) (i&(-i))
#define rep(i,a,b) for(int(i)=(a);(i)<(b);i++)
#define BUG(x) {cout<<#x<<" = "<<x<<endl;}
#define left(x) (x<<1)
#define right(x) ((x<<1) +1)
#define middle(s,e)(s+(e-s)/2)
#define size_tree(n) 2*(int)pow(2,ceil(log2(n)))
#define CL(A,I) (memset(A,I,sizeof(A)))
#define endl '\n'
#define PHAS(_n) (pbits[(_n)>>5] & (1u << ((_n) & 0x1f)))
#define PSET(_n) (pbits[(_n)>>5] |= (1u << ((_n) & 0x1f)))
//unsigned int pbits[200000000/32+1];
 
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const long double epsilon = 1e-15;
static const long double pi = acos((long double) -1);
using namespace std;
inline void init_io(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef long long ll;
const int MAX_N = 300001;
 
/*
struct data{
  int l,r,c;
  data():l(0), r(0),c(0){};
  data(int w, int i, int c_) : l(w),r(i),c(c_){};
  bool operator < (data other) const {
	if(l==other.l)
		return r<other.r;
    return l < other.l;
  }
};
*/
 
 
 
int arr[MAX_N];
int alph[27];
 
int main()
{
 
        string s; 
        cin>>s;
        int a = (s[0]-'0')*10 + s[1]-'0';
        int b = (s[2]-'0')*10+s[3]-'0';
        if(a>0 && a<13 && b>0 && b<13)
            cout << "AMBIGUOUS"<<endl;
        else if(a>0 && a<13)
            cout<<"MMYY"<<endl;
        else if(b>0 && b<13)
            cout<<"YYMM"<<endl;
        else
            cout<<"NA"<<endl;
        return 0;
}


Measured memory_bytes: 256
from sys import stdin

def main():

    input = stdin.readline

    N,M = map(int,input().split())
    A = list(map(int,input().split()))

    A.sort(reverse=True)

    sum_num = sum(A)

    for i in range(M):
        if A[i] * 4 * M < sum_num:
            print("No")
            return
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
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;}

const int NM = 2*1e5;
vector<int> graph[NM]; 
vector<int> Count(NM);
int n, q; 
void dfs(int now, int pre) {
    for(auto to : graph[now]) {
        if(to == pre) continue;
        Count[to] += Count[now];
        dfs(to, now);
    }
}
int main(){
    cin >> n >> q;
    for(int i=0; i<n-1;i++) {
        int a, b; cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    Count.resize(n);
    rep(i, q) {
        int p, x; cin>>p>> x;
        p--;
        Count[p] += x;
    }
    dfs(0, -1);
    rep(i, n) {
        cout << Count[i] << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 23424
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
char a,b;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>a>>b;
	if(a==b)
	cout<<"H";
	else
	cout<<"D";
	return 0;
}


Measured memory_bytes: 256
function main(input) {
  const inputs = input.trim().split('\n');
  var K = inputs[0] - 0;
  var S = inputs[1];

  if (S.length <= K) {
    console.log(S);
  } else {
    console.log(S.slice(0, K) + '...');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29624
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vpii = vector<pair<int, int>>;

int main()
{
  string s;
  cin >> s;
  ll num = 0;
  int a=s.size();

  for (int i = 0; i < a; i++)
  {
int j = s[i] - '0';
    num+=j;
  }
  if (a!=1){
  if(num%9==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
  else {
  if(s=="0"||s=="9"){
  cout<<"Yes"<<endl;
  }
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=1; i<=(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M;
    cin>>N>>M;
    int a=1;
    rep(i,M) a*=2;
    int b=1900*M+100*(N-M);
    cout<<a*b<<endl;
}

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

int main(void) {
  int A, B;
  cin >> A >> B;
  
  if (A > 9 || B > 9) {
    cout << -1 << endl;
    return 0;
  }

  cout << A * B << endl;
 
  return 0;
}

Measured memory_bytes: 256
import statistics


if __name__ == '__main__':
    N = int(input())
    d_list = list(map(int, input().split()))

    med_low = statistics.median_low(d_list)
    med_high = statistics.median_high(d_list)

    if med_high == med_low:
        answer = 0
    else:
        answer = med_high - med_low

    print(answer)

Measured memory_bytes: 16024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<vector<pair<int, int> > > graph(n);
  REP(i, n - 1) {
    int a, b; cin >> a >> b; --a; --b;
    graph[a].emplace_back(b, i);
    graph[b].emplace_back(a, i);
  }
  int m; cin >> m;
  vector<int> u(m), v(m);
  vector<vector<int> > edges(m);
  REP(i, m) {
    cin >> u[i] >> v[i], --u[i], --v[i];
    function<bool(int, int)> dfs = [&](int par, int ver) {
      if (ver == v[i]) return true;
      for (auto pr : graph[ver]) {
        if (pr.first != par) {
          edges[i].emplace_back(pr.second);
          if (dfs(ver, pr.first)) return true;
          edges[i].pop_back();
        }
      }
      return false;
    };
    dfs(-1, u[i]);
  }
  vector<ll> beki(n, 1);
  FOR(i, 1, n) beki[i] = beki[i - 1] * 2;
  ll ans = beki[n - 1];
  FOR(i, 1, 1 << m) {
    vector<bool> white(n - 1, false);
    REP(j, m) if (i >> j & 1) {
      for (int e : edges[j]) white[e] = true;
    }
    int cnt = 0;
    REP(j, n - 1) cnt += white[j];
    if (__builtin_popcount(i) & 1) {
      ans -= beki[n - 1 - cnt];
    } else {
      ans += beki[n - 1 - cnt];
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  long long int a[87]={};
  a[0]=2;
  a[1]=1;
  for(int i=2;i<=86;i++){
    a[i]=a[i-1]+a[i-2];
  }
  int n;
  cin>>n;
  cout<<a[n]<<endl;
  return 0;
}


Measured memory_bytes: 256
n,m,k=map(int,input().split())
par=[-1]*n

def find(x):
  if par[x]<0:
    return x
  else:
    par[x]=find(par[x])
    return par[x]

def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return False
  else:
    if par[x]>par[y]:
      x,y=y,x
    par[x]+=par[y]
    par[y]=x
    return True

def same(x,y):
  return find(x)==find(y)

def size(x):
  return -par[find(x)]

F=[-1]*n
l = [] 
for _ in range(m):
  a,b=map(int,input().split())
  l.append([a-1,b-1])
  unite(a-1,b-1)
for _ in range(k):
  a,b=map(int,input().split())
  if same(a-1,b-1):
    F[a-1]-=1
    F[b-1]-=1
for i,j in l:
    if same(i,j):
        F[i]-=1
        F[j]-=1
for i in range(n):
  F[i]+=size(i)
# print(par)
print(*F)


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

int changeNum(char c){
	switch (c){
	case 'S':
		return 0;
	case 'H':
		return 1;
	case 'C':
		return 2;
	case 'D':
		return 3;
	}
}

int main(void){
	int n, suit, num;
	bool card[4][13];
	cin >> n;

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			card[i][j] = false;
		}
	}

	char c;
	for (int i = 0; i < n; i++){
		cin >> c >> num;
		card[changeNum(c)][num-1] = true;
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 13; j++){
			if (!card[i][j]){
				switch (i){
				case 0:
					cout << "S " << j+1;
					break;
				case 1:
					cout << "H " << j+1;
					break;
				case 2:
					cout << "C " << j+1;
					break;
				case 3:
					cout << "D " << j+1;
				}
				cout << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1160
N  = int(input())
def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list
counter = 0

for i in range(1,N+1):
    if i % 2 == 1 and len(divisor(i)) == 8:
        counter += 1
        
print(counter)

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


int main() {
  
  int N,A;
  cin >> N;
  
  int num, minnum =40;

  rep(i, N){
    cin >> A;
    
    num=0;
    
    while(!(A%2)){
      num++;
      A /=2;
    }
    
    if(minnum>num)
      minnum = num;
    
  }
    cout << minnum << endl;
}

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

fun questionC(n: Int, k: Int, q: Int) {
    val points = Array(n) { k - q }

    for (i in 1..q) {
        val answer = readLine()!!.toInt() - 1
        points[answer]++
    }

    points.forEach {
        if(it > 0)
            println("Yes")
        else
            println("No")
    }
}

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

using namespace std;

int main(){
  int n;
  bool f = false;
  vector<int> money = {10, 50, 100, 500};
  while(std::cin >> n, n){
    if(f) std::cout << std::endl;
    f = true;
    vector<int> a(4);
    for (int i = 0; i < 4; i++) std::cin >> a[i];
    int sum = -n;
    for (int i = 0; i < 4; i++) sum += a[i]*money[i];
    for (int i = 3; i >= 0; i--) {
      if(sum >= money[i]){
        a[i] -= sum/money[i];
        sum %= money[i];        
      }
    }
    for (int i = 0; i < 4; i++) {
      if(a[i] > 0){
        std::cout << money[i] << " " << a[i] << std::endl; 
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2924
#include<cstdio>
using namespace std;
int main()
{
    int n,t,x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&t,&x,&y);
        if(x+y>t){printf("No\n");return 0;}
        if(((x+y)%2)==0&&(t%2)==1){printf("No\n");return 0;}
        if(((x+y)%2)==1&&(t%2)==0){printf("No\n");return 0;}
    }
    printf("Yes\n");
    return 0;
}

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

int main(){
  int M, N, K, n;
  int t = 0;
  cin >> M >> N >> K >> n;
/*
  vector<char> S(N);
  for(int i = 0; i < N; i++)
    cin >> S.at(i);
*/
  for(int i = 0; M*i <= n; i++){
    for(int j = 0; N*j <= n; j++){
      int k = 0;
      while(M*i+N*j+K*k<n){
        k++;
      }
      if(M*i+N*j+K*k==n) t++;
    }
  }
  
  cout << t << endl;
}

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

const int N = 10;

int n, m, u, v, ans;
vector<int> adj[N];

void dfs(int u, int state) {
  // cout << u << ' ' << state << endl;
  int new_state = state | (1<<u);
  if (new_state == (1<<n)-1) ans++;
  else {
    for (int v : adj[u]) {
      if (((1<<v) & new_state) == 0) dfs(v,new_state);
    }  
  }
}

int main () {
  ans = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--; v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(0,0);
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define ll long long
#define N 405
#define mod 1000000007
using namespace std;
int n,c,a[N],b[N],sum[N][N],f[2][N];
void upd(int &x,int y){ x+=y; if (x>=mod) x-=mod; }
void pre(){
	rep (i,1,N-1){//sum[i][j]=1^j+2^j+3^j+...+i^j;
		sum[i][0]=1;
		rep (j,1,N-1) sum[i][j]=(ll)sum[i][j-1]*i%mod;//i^j
		rep (j,0,N-1) upd(sum[i][j],sum[i-1][j]);
	}
}
int main(){
	scanf("%d%d",&n,&c);
	pre();
	rep (i,1,n) scanf("%d",&a[i]);
	rep (i,1,n) scanf("%d",&b[i]);
	int nk=0,k=1;
	f[0][0]=1;//f[i][j]表示前i个小朋友分了j颗糖
	rep (i,0,n-1){
		k^=1; nk^=1; memset(f[nk],0,sizeof(f[nk]));
		rep (j,0,c) for (int t=0; t+j<=c; t++)//这一轮分了t颗糖
			upd(f[nk][t+j],(ll)f[k][j]*(sum[b[i+1]][t]+mod-sum[a[i+1]-1][t])%mod);
	}
	printf("%d\n",f[nk][c]);
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
#include<set>
using namespace std;
set<int>data;
int main(){
	data.insert(2);
	for(int i=3;i<60000;i++){
		for(int j=2;j*j<=i;j++){
			if(i%j==0)goto fail;
		}
		data.insert(i);
		fail:;
	}
	
	int x;
	while(cin>>x){
		set<int>::iterator itr=data.lower_bound(x);
		cout<<*(--itr)<<" ";
		if(*(++itr)==x)itr++;
		cout<<*itr<<endl;
	}
}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vec<ll> pow10(16,1);
    for(int i=1;i<=15;i++) pow10[i] = pow10[i-1]*10;
    vec<ll> ans;
    for(int i=1;i<10;i++) ans.push_back(i);
    ll now = 9;

    auto digit = [](ll x){
        int res = 0;
        while(x){
            res += x%10;
            x /= 10;
        }
        return res;
    };
    
    int K;
    cin >> K;
    while((int) ans.size()<K){
        vec<pair<double,ll>> A;
        for(int i=0;i<16;i++){
            ll val = now+pow10[i];
            A.emplace_back(1.0*val/digit(val),val);
        }
        ll val = 10*now+9;
        A.emplace_back(1.0*val/digit(val),val);
        sort(A.begin(),A.end());
        ans.push_back(A[0].second);
        now = A[0].second;
    }
    for(int i=0;i<K;i++) cout << ans[i] << "\n";   
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cis(s);
    string ans = "";
    rep(i, s.length()){
        ans += "x";
    }
    co(ans);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 101
#define WHITE -1
#define BLACK 1
#define GRAY 0
int color[N], n, G[N][N];
int d[N], f[N];
int time = 0;

void DFSvisit(int u){
  int i;
  color[u] = GRAY;
  d[u] = ++time;
  for(i = 1; i <= n; i++){
      if(G[u][i] == 1){
        if(color[i] == WHITE) DFSvisit(i);
      }
  }
  color[u] = BLACK;
  f[u] = ++time;
}
 
void DFS(void){
  int i, j;
  for(i = 1; i <= n; i++){
        color[i] = WHITE;
        time = 0;
  }
  for(i = 1; i <= n; i++){
        if(color[i] == WHITE) DFSvisit(i);
  }
}
 

int main() {
    int i, j;
    int u, v, k;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d%d", &u, &k);
        for (j = 0; j < k; j++) {
            scanf("%d", &v);
            G[u][v] = 1;
        }
    }

    DFS();

    for (i = 1; i <= n; i++) {
        printf("%d %d %d\n", i, d[i], f[i]);
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define ld double
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

ll gcd(ll a, ll b) {return (b == 0) ? a : gcd(b, a % b);}

ld dp[301][301][301];
ld prob[301][301][301];

int main() {
#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
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	vl a(n);
	vl cnt(4, 0);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	prob[cnt[1]][cnt[2]][cnt[3]] = 1;
	for (ll k = n; k >= 0; k--) {
		for (ll j = n; j >= 0; j--) {
			for (ll i = n; i >= 0; i--) {
				if (i + j + k == 0 || i + j + k > n)
					continue;
				ld was = (n - i - j - k) * 1.0 / n;
				was = was / (1 - was);
				ld move = (was + 1) * prob[i][j][k];
				dp[i][j][k] += move;
				if (i) {
					prob[i - 1][j][k] += prob[i][j][k] * (i * 1.0 / (i + j + k));
					dp[i - 1][j][k] += dp[i][j][k] * (i * 1.0 / (i + k + j));
				}
				if (j) {
					prob[i + 1][j - 1][k] += prob[i][j][k] * (j * 1.0 / (i + j + k));
					dp[i + 1][j - 1][k] += dp[i][j][k] * (j * 1.0 / (i + k + j));
				}
				if (k) {
					prob[i][j + 1][k - 1] += prob[i][j][k] * (k * 1.0 / (i + j + k));
					dp[i][j + 1][k - 1] += dp[i][j][k] * (k * 1.0 / (i + k + j));
				}
			}

		}
	}
	printf("%0.10lf\n", dp[0][0][0]);
}


Measured memory_bytes: 218536
#include<iostream>
using namespace std;
//バブルソート　in:配列、要素数 out:ソート回数
int bubble_sort(int *A,int N){ 
    int sw=0;
    int i,j;
    bool flag=1;

    for(i=0;flag;i++){
        flag=0;
        for(j=N-1;j>=i+1;j--){                                        
            if(A[j]<A[j-1]){
                swap(A[j],A[j-1]);
                flag=1;
                sw++;
            }            
        }       
    }       
    return sw;
}

int main(void){
    int A[100],i,j,N,sw;

    cin>>N;
    for(i=0;i<N;i++)
        cin>>A[i];

    sw=bubble_sort(A,N);

    for(i=0;i<N;i++){
        if(i)
            cout<<" ";                                     
        cout<<A[i];
    }       
    cout<<endl;
    cout<<sw<<endl;

    return 0;
}


Measured memory_bytes: 3120
#include <stdio.h>
#include <string.h>
int main(){
	char s[100], s2[100], p[100];
	scanf("%s%s",s, p);
	strcpy(s2,s);
	strcat(s,s2);
	if(strstr(s,p)!=0){
		printf("Yes\n");
	} else{
		printf("No\n");
	}
	return 0;
	}

Measured memory_bytes: 1768
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long a = Long.parseLong(in.next());
            long v = Long.parseLong(in.next());
            long b = Long.parseLong(in.next());
            long w = Long.parseLong(in.next());
            long t = Long.parseLong(in.next());

            long dist = Math.abs(a - b);
            long dist2 = (v - w) * t;

            boolean ok = false;

            if (dist <= dist2) ok = true;

            out.println(ok ? "YES" : "NO");

        }

    }
}



Measured memory_bytes: 35796
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,s,ans=INT_MAX,a[100005],b[100005];
main(){
cin>>n>>m>>s;
int f1=INT_MAX,f2=INT_MAX;
for(int k=1;k<=n;k++){
    cin>>a[k];
    f1=min(f1,a[k]);
}
for(int k=1;k<=m;k++){
    cin>>b[k];
    f2=min(f2,b[k]);
}
ans=f1+f2;
for(int k=1;k<=s;k++){
    int x,y,c;
    cin>>x>>y>>c;
    ans=min(ans,((a[x]+b[y])-c));
}
cout<<ans;
return 0;
}


Measured memory_bytes: 1792
import math

N,M,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A.append(math.inf)
B.append(math.inf)

best = 0
i = j = 0

while K >= A[i]:
    K -= A[i]
    i += 1

while True:
    while K >= B[j]:
        K -= B[j]
        j += 1

    best = max(best, i+j)

    if i == 0: break

    i -= 1
    K += A[i]

print(best)


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

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    ll a[n];
    
    int count4 = 0;
    int count2 = 0;
    int count = 0;
    rep(i,n){
        cin >> a[i];
        
        if(a[i] % 4 == 0){
            count4++;
        }
        else if(a[i] % 2 == 0){
            count2++;
        }else{
            count++;
        }
    }
    
    string ans = "No";
    count += count2 % 2;
    if(count - count4 <= 1){
        ans = "Yes";
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main() {
  int i,j,n,num,tmp;
  int count=0;
  int array[50],array2[50];
  cin >> n ;
  for(i=0;i<n;i++){
    cin >> num;
    array[i] = num;
    array2[i] = num;
  }
  for(i=0;i<n;i++){
   for(j=i+1;j<n;j++){
   if(array2[i]>array2[j]){
     tmp =  array2[i];
     array2[i] = array2[j];
     array2[j] = tmp;
   }
  }
  }
    for(i=0;i<n;i++){
      if(array[i]!=array2[i]){
        count++;
        if(count>2){
          break;
        }
      }
    }
    if(count<3){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <algorithm>
#include <array>
#include <string.h>
#include <vector>



int main() {
	int a, b, c;

	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);

	std::vector<int> vec;
	vec.push_back(a);
	vec.push_back(b);
	vec.push_back(c);
	std::sort(vec.begin(), vec.end());
	a = vec[0]; b = vec[1]; c = vec[2];

	int ctn = 0;
	while (1)
	{
		if (b == c) break;
		a++; b++;
		ctn++;
	}
	while (1)
	{
		if (a >= b) break;
		a++; a++;
		ctn++;
	}
	
	if (a != b) {
		b++; c++;
		ctn++;
	}

	printf("%d", ctn);




	return 0;
}

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

const int MOD = (int)1e9+7;

long long gcd(long long A,long long B){
	if(B==0)	return A;
	return gcd(B,A%B);
}

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

	long long x=gcd(A,B);
	//cout << x << endl;
	long long ans=0;
	long long now=2;
	bool flag=false;
	while(x!=1){
		if(x%now==0){
			if(flag==false){
				flag=true;
				ans++;
			}
			x/=now;
		}
		else{
			flag=false;
			now++;
			if(now*now>x)	break;
		}
	}
	if(x==1)	cout << ans+1 << endl;
	else	cout << ans+2 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	string s;
	cin >> s;

	int k = s.size();

	int won = 0;
	for (int i = 0; i < k; ++i) {
		if (s[i] == 'o') {
			++won;
		}
	}

	if (won + (15 - k) >= 8) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}

	return 0;

}

Measured memory_bytes: 256
h, w, n = gets.split.map(&:to_i)

sr, sc = gets.split.map(&:to_i)

s = gets.chomp.chars
t = gets.chomp.chars

x = sc
x2 = sc
y = sr
y2 = sr

0.upto(n-1) do |i|
  si = s[i]
  ti = t[i]

  if si == 'L'
    x -= 1
  end
  if x < 1
    puts "NO"
    exit
  end
  if ti == 'R'
    x = [x + 1, w].min
  end

  if si == 'R'
    x2 += 1
  end
  if x2 > w
    puts "NO"
    exit
  end
  if ti == 'L'
    x2 = [x2 - 1, 1].max
  end

  if si == 'U'
    y -= 1
  end
  if y < 1
    puts "NO"
    exit
  end
  if ti == 'D'
    y = [y + 1, h].min
  end

  if si == 'D'
    y2 += 1
  end
  if y2 > h
    puts "NO"
    exit
  end
  if ti == 'U'
    y2 = [y2 - 1, 1].max
  end
end

puts "YES"


Measured memory_bytes: 42620
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
 using namespace std;
ll n,t,m,c1,c2,c,x,y,sum,mn=999999999,avg,pos,dif,j,dis,mx,xi,yi,q;
vector<ll>v;
set<string>s;
map<string , ll >mp;
bool PE(int x)
{
for (int i=2;i*i<=x;i++)
if (x%i==0)
return false;
return true;
}
bool PR(string s)
{
int n=s.length();
for(int i=0;i<n/2;i++)
if(s[i]!=s[n-i-1])
return false;
return true;
}

int main(void)
{ SpeeD;
string s;
cin>>s;
for (int i = 0 ;i < s.length();i++){
if (s[i]=='?')
s[i]='D';
cout<<s[i];}


}

Measured memory_bytes: 3776
#include<iostream>
#include<cstdio>
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;

int n, M[101][101];
int color[101], count1[101], count2[101], t;

void dfs_visit(int u) {
	int v;
	color[u] = GRAY;
	t++;
	count1[u] = t;
	for (v = 1; v <= n; v++) {
		if (M[u][v] == 0) {
			continue;
		}

		if (color[v] == WHITE) {
			dfs_visit(v);
		}
	}
	color[u] = BLACK;
	t++;
	count2[u] = t;
}

void dfs() {
	int u;
	for (u = 1; u <= n; u++) {
		color[u] = WHITE;
		t = 0;
	}
	for (u = 1; u <= n; u++) {
		if (color[u] == WHITE) {
			dfs_visit(u);
		}
	}
	for (u = 1; u <= n; u++) {
		printf("%d %d %d\n", u, count1[u], count2[u]);
	}
}

int main() {
	int u, v, k, i, j;
	cin >> n;

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

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (j = 0; j < k; j++) {
			cin >> v;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}

/*
6
1 2 2 3
2 2 3 4
3 1 5
4 1 6
5 1 6
6 0
*/


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

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int m, n;
bool ice[100][100];
int dfs(int x, int y)
{
	if (x < 0 || x >= m || y < 0 || y >= n
		|| !ice[y][x])
		return 0;

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

	ice[y][x] = false;
	int res = 0;
	for (int i = 0; i < 4; ++i)
		max_swap(res, dfs(x + dx[i], y + dy[i]));
	ice[y][x] = true;

	return res + 1;
}
int main()
{
	while (scanf("%d%d", &m, &n), m | n)
	{
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < m; ++j)
			{
				int t;
				scanf("%d", &t);
				ice[i][j] = t;
			}
		}
		int res = 0;
		for (int y = 0; y < n; ++y)
			for (int x = 0; x < m; ++x)
				max_swap(res, dfs(x, y));
		printf("%d\n", res);
	}
}

Measured memory_bytes: 0
import sys
def input(): return sys.stdin.readline().strip()
import math
def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    a=l[0]
    l.pop(0)
    bnum=0
    bmax=0
    for i in l:
        bb=min(i,a-i)
        if bmax<bb:
            bnum=i
            bmax=bb
    print(a,bnum)
resolve()

Measured memory_bytes: 14436
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(int i=0;i<N;i++)
typedef long long ll;
const ll MOD=1000000007;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin>>N;
    vector<int>A(N+1);
    vector<int>B(N);
    REP(i,N+1)cin>>A[i];
    REP(i,N)cin>>B[i];

    ll count=0;
    //Nかいめだけ別処理
    REP(i,N-1){
        count+=min(A[i],B[i]);
        B[i]-=min(A[i],B[i]);
        count+=min(A[i+1],B[i]);
        A[i+1]-=min(A[i+1],B[i]);
    }
    count+=min(B[N-1],A[N]+A[N-1]);
    cout<<count<<endl;
}

Measured memory_bytes: 1024
N = int(input())
A = [a-i-1 for i, a in enumerate(list(map(int, input().split())))]

A.sort()

if N % 2 != 0:
    T = A[N//2]
else:
    T = (A[N//2-1] + A[N//2])//2

ans = 0
for a in A:
    ans += abs(a-T)
print(ans)

Measured memory_bytes: 26708
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge {
    ll from;
    ll to;
    ll cost;
};

ll V, E, d[1010];
edge es[2010];


bool find_negative_loop() {
    for (ll i = 0; i < V; i++) {
        for (ll j = 0; j < E; j++) {
            edge e = es[j];
            if (d[e.from]!=INF&&d[e.to] > d[e.from] + e.cost) {
                d[e.to] = d[e.from] + e.cost;
                if (e.to== V - 1) {
                    return true;
                }
            }
        }
    }
    return false;
}
void shortest_path(ll s){
  rep(i,V)d[i]=INF;
  d[s]=0;
  rep(j,V){
    bool update=false;
    rep(i,E){
      edge e=es[i];
      if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        update=true;
      }
    }
    if(!update)break;
    return;
  }
}
int main(){
  cin>>V>>E;
  rep(i,E){
    ll f,t,c;
    cin>>f>>t>>c;
    es[i].from=f-1;
    es[i].to=t-1;
    es[i].cost=-c;
  }
  shortest_path(0);
  if(find_negative_loop()){
    cout<<"inf"<<endl;
    return 0;
  }
  rep(j,V){
        rep(i,E){
            edge e=es[i];
            if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                if(i==V-1){
                    cout<<"inf"<<endl;
                    return 0;
                }
            }
        }
    }
  //shortest_path(0);
  cout<<-d[V-1]<<endl;
  
}
  


Measured memory_bytes: 256