akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

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

	vector<bool> deg(10, true);
	for (int i = 0; i < K; i++) {
		int d;
		cin >> d;
		deg[d] = false;
	}

	int ans;
	bool flag = false;
	for (ans = N; !flag; ans++) {
		int temp = ans;
		flag = true;
		while (temp > 0) {
			if (!deg[temp % 10]) {
				flag = false;
				break;
			}
			temp /= 10;
		}
	}

	cout << ans-1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> P2;

int main(){
	int H,W,D;
	scanf("%d %d %d",&H,&W,&D);

	vector<P2> vec[D];
	
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			int A;
			scanf("%d",&A);
			vec[A%D].push_back(make_pair(A,make_pair(i,j)));
		}
	}

	int len[D][500000/D];
	for(int i=0;i<D;i++){
		sort(vec[i].begin(),vec[i].end());
		
		len[i][0] = 0;
		for(int j=1;j<vec[i].size();j++){
			len[i][j] = abs(vec[i][j].second.first-vec[i][j-1].second.first) + abs(vec[i][j].second.second-vec[i][j-1].second.second);
		}
		for(int j=1;j<vec[i].size();j++){
			len[i][j] += len[i][j-1];
		}
	}

	int Q;
	scanf("%d",&Q);
	for(int i=0;i<Q;i++){
		int L,R;
		scanf("%d %d",&L,&R);
		int d = 0;
		if(L%D==0) d = 1;
		printf("%d\n",len[R%D][R/D-d]-len[L%D][L/D-d]);
	}


	return 0;
}


Measured memory_bytes: 7168
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (size_t i = 0; i < size_t(n); i++)
#define forn1(i,n) for (size_t i = 1; i <= size_t(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

template <long long mod>
long long mod_pow(long long a, long long b) {
    if (b == 0) return 1;
    long long ret = mod_pow<mod>(a, b / 2);
    ret = ret * ret % mod;
    if (b % 2 == 1) ret = a * ret % mod;
    return ret;
}

const int MAX_N = 300000;
const ll MOD = TEN(9) + 7;
int n;
ll a[MAX_N];

int main() {
    fastio();

    cin >> n;
    forn(i, n) cin >> a[i];

    ll ans = 0;
    ll prev = 0;
    for (int i = 0; i <= 61; i++) {
        ll f = 0;
        for (int j = 0; j < n; j++) {
            f += (a[j] >> i) & 1LL;
        }

        ll temp = f * (n - f);
        ll cur = temp + prev;
        //printf("%d %lld\n", i, cur);
        if (cur & 1LL) {
            ans = (ans + mod_pow<MOD>(2LL, i)) % MOD;
        }

        // cout << cur << endl;

        prev = cur >> 1;
    }
    int i = 62;
    while (prev) {
        if (prev & 1) {
            ans = (ans + mod_pow<MOD>(2LL, i)) % MOD;
        }
        prev >>= 1;
        i++;
    }

    cout << ans % MOD << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>

constexpr int primeMax = 1000000;

bool isPrime[primeMax + 1];
std::vector<int> primeNumbers;

void erat(){
	primeNumbers.reserve(primeMax + 1);
	std::fill(isPrime, isPrime + primeMax + 1, true);
	isPrime[1] = false;
	for(int i = 2; i <= primeMax; ++i){
		if(isPrime[i]){
			primeNumbers.emplace_back(i);
			for(int j = i * 2; j <= primeMax; j += i){
				isPrime[j] = false;
			}
		}
	}
}

int main(){
	erat();

	int a, d, n;
	while(std::cin >> a >> d >> n, a + d + n){
		int cnt = 0;
		for(auto&& p : primeNumbers){
			if(p >= a && (p - a) % d == 0){
				++cnt;

				if(cnt == n){
					std::cout << p << std::endl;
				}
			}
		}
	}
}

Measured memory_bytes: 4364
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int main() {
	long long int A, B, N;
	cin >> A >> B >> N;
	long long int x = 0;
	int k = 1;
	if (N >= B-1) {
		x = B - 1;

	}
	else {
		x = N;


	}
	long long int ans;
	ans = floor((A*x / B)) - A * floor(x / B);
	cout << ans;

}

Measured memory_bytes: 3620
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a <= 9 && b <= 9) {
            System.out.println(a*b);
        } else {
            System.out.println(-1);
        }
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>
#include <utility>
#include <queue>
#include <cmath>
#include <vector>

using namespace std;

const int MAX_N=3000;
const int INF=100000000;

struct edge{
	int to,cost;
};

int N,M,K;
vector<edge> G[MAX_N];	//??????

int d[MAX_N];	//???????????¢

typedef pair<int,int> P;

void dijkstra(int s){
	d[s]=0;
	priority_queue<P,vector<P>,greater<P> > q;
	q.push(P(0,s));
	while (!q.empty()){
		P p=q.top();
		int v=p.second,dist=p.first;
		q.pop();
		if (dist>d[v]) continue;
		for (int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if (d[v]+e.cost<d[e.to]){
				d[e.to]=d[v]+e.cost;
				q.push(P(d[e.to],e.to));
			}
		}
	}
}

int main(){
	scanf("%d %d %d",&N,&M,&K);
	for (int i=0;i<M;i++){
		int a,b,l;
		scanf("%d %d %d",&a,&b,&l);
		edge e={b-1,l};
		G[a-1].push_back(e);
		e={a-1,l};
		G[b-1].push_back(e);
	}
	fill(d,d+N,INF);
	for (int i=0;i<K;i++){
		int s;
		scanf("%d",&s);
		dijkstra(s-1);
	}
	int res=0;
	for (int v=0;v<N;v++){
		for (int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			if (d[v]-e.cost==d[e.to]) continue;
			if (d[v]+e.cost==d[e.to]){
				res=max(res,d[e.to]);
			}
			else{
				res=max(res,(int)round((d[v]+d[e.to]+e.cost)/2.0));
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 4056
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N, a, b, sum, min=100000;
	
	cin >> N;
	
	for(int i=1; i<N; i++){
		sum = 0;
		a = i;
		b = N-a;
		while(a != 0){
			sum += a%10;
			a /= 10;
		}
		while(b != 0){
			sum += b%10;
			b /= 10;
		}
		if(sum < min){
			min = sum;
		}
	}
	
	cout << min;
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a, b, c, d, e, f;
int ans , Max_1, Max_2;
int main() {
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	for(int i = 0; i <= 100; i++)
		for(int j = 0; j <= 100; j++) {
			int tmp_1 = (i * a + b * j) * 100;
			if(tmp_1 <= f) {
				for(int k = 0; k <= 100; k++)
					for(int x = 0; x <= 100; x++) {
						int tmp_2 = k * c + x * d;
						if(tmp_2 * 100 <= tmp_1 * e) {
							if(tmp_2 * e + tmp_1 == 0)continue;
							if(tmp_1 + tmp_2 > f)continue;
							int tmp = tmp_2 * 10000 / (tmp_2 + tmp_1);
							if(Max_1 == 0 && Max_2 == 0)Max_1 = tmp_1 + tmp_2, Max_2 = tmp_2;
							if(tmp > ans){
								ans = tmp, Max_1 = tmp_2 + tmp_1, Max_2 = tmp_2;
							}
						}
					}
			}
		}
		printf("%d %d\n", Max_1, Max_2);
		return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
const int MaxN = 1e5 + 5;

char s[MaxN], t[MaxN];
int l[MaxN], presum[MaxN];

int main() {
	int k;
	scanf("%s %d", t, &k); 
	int len = strlen(t);
	for(int i = 0; i < len; i++) s[i+1] = t[i];
	for(int i = 1; i <= len; i++) {
		if(s[i] == 'a') l[i] = 0;
		else l[i] = 'z' - s[i] + 1;
		presum[i] = presum[i-1] + l[i];
	}

	int flag = -1;
	if(presum[len] == 0) flag = len;
	for(int i = 1; i <= len; i++)
		if(presum[i] > k) { flag = i; break;}

	int d = k - presum[flag-1];
	for(int i = 1; i < flag; i++) s[i] = 'a';
	for(int i = flag; i <= len; i++) {
		if(l[i] != 0) {
			if(i == len) {
				if(d < l[i]) s[i] += d;
				else if(l[i] == d) s[i] = 'a';
				else {
					if(d < l[i]) s[i] += d;
					else if(d == l[i]) s[i] = 'a';
					else s[i] = 'a' + (d - l[i]) % 26;
				}
			}
			else if(l[i] <= d) { s[i] = 'a'; d -= l[i]; }
		}else {
			if(i == len) s[i] += d % 26;
			else continue;
		}
	}
	for(int i = 1; i <= len; i++) printf("%c", s[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 1280
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> v;
int a[55];

int main(void)
{
	int n, k, i, j, p, q, ans = 0;

	scanf("%d %d" ,&n, &k);
	for (i = 0; i < n; i++)
		scanf("%d" ,&a[i]);

	for (i = 0; i <= min(n, k); i++)
		for (j = 0; i + j <= min(n, k); j++)
		{
			v.clear();
			for (p = 0; p < i; p++)
				v.push_back(a[p]);
			for (q = 0; q < j; q++)
				v.push_back(a[n - q - 1]);

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

			int sum = 0;
			for (p = 0; p < v.size(); p++)
				sum += v[p];

			for (p = 0; p < min(k - i - j, (int)v.size()); p++)
				if (v[p] < 0)
					sum -= v[p];

			ans = max(ans, sum);
		}

	printf("%d" ,ans);
	return 0;
}

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

const int INF = 1 << 30;

int main(void)
{
	int maxValue = INF << 1;
	int minNow = (INF - 1) * 2;
	int n, R;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> R;
		maxValue = max(maxValue, R - minNow);
		minNow = min(minNow, R);
	}
	cout << maxValue << endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

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

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n, k, s;
    cin >> n >> k >> s;
    vector< int > v;
    for( int i = 0; i < k; ++i ) {
        v.pb(s);

    }

    for( int i = 0; i < n - k; ++i ) {
        if(s != 1000000000 ) {
            v.pb(s + 1);

        } else {
            v.pb(1);

        }
    }
    for( int i = 0; i < v.size(); ++i ) cout << v[i] << " ";
    cout << endl;
    return 0;
}



Measured memory_bytes: 1912
#include<iostream>
using namespace std;
int main()
{
    int h, w;
    char c;
    cin >> h >> w;
    for(int i = 0; i < w+2; i++){
        cout << '#';
    }
    cout << endl;
    for(int i = 0; i < h; i++){
        cout << '#';
        for(int j = 0; j < w; j++){
            cin >> c;
            cout << c;
        }
        cout << '#' << endl;
    }
    for(int i = 0; i < w+2; i++){
        cout << '#';
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    W, a, b = map(int, input().split())

    if a == b:
        print(0)
    elif a < b:
        if b-a > W:
            print(b-a-W)
        else:
            print(0)
    else:
        if a-b > W:
            print(a-b-W)
        else:
            print(0)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    int N,M,A[10007],i,sum=0,r;
    scanf("%d%d",&N,&M);
    for(i=0;i<M;i++)
    {
        scanf("%d",&A[i]);
        sum=sum+A[i];


    }
    if(N>=sum)
    {
        r=N-sum;
    }
    else r=-1;
    printf("%d",r);


}



Measured memory_bytes: 1748
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#define REP(i, N) for(int i=0; i<N; i++)
using namespace std;

//#include "atcoder.hpp"

long long gcd(long long a, long long b) {
    if (a>b) swap(a,b);
    
    auto r = b % a;
    
    return (r ? gcd(r, a) : a);
}

int main() {
    int N, B, T;
    
    cin >> N>>B>>T;

    cout << (T / N * B) << endl;
    
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;

struct UnionFind {
	VI par, s;
	UnionFind(int N) :par(N), s(N) {
		REP(i, N)par[i] = i;
		REP(i, N)s[i] = 1;
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		if (!(same(x, y)))s[ry] += s[rx];
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
	int size(int x) {
		return s[root(x)];
	}
};

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

	int N, Q;
	cin >> N >> Q;
	UnionFind uni(N);
	while (Q--) {
		int t, u, v; cin >> t >> u >> v;
		if (t)cout << uni.same(u, v) << endl;
		else uni.unite(u, v);
	}

	return 0;
}



Measured memory_bytes: 6116
#include <stdio.h>

int		main(void)
{
  	int		N;
  	int		R;
  	int		num;
  
  	num = scanf("%d %d", &N, &R);
  	if (num != 2)
    {
      	return (0);
    }
  
  	if (N < 10 && N > 0)
      	printf("%d", R + 100 * (10 - N));
  	else
      	printf("%d", R);
  	return (0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,k,n) for(int i = k; i <= n; i++) 
#define per(i,k,n) for(int i = k; i >= n; i--)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii; 
typedef vector<ii> vii;
typedef vector<char> vchar;
typedef vector<int> vi;
#define ff first
#define ss second

#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));

#define INF 1000000000
#define mod 998244353
//#define mod 1000000007
#define endl "\n"


   //=\/=\/=\/=\/=\/=\/=\/=\/=\/=\        Jai Hind Dosto        /=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\
  //=\/=\/=\/=\       RETARDED     ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿      NISHAN                 /=\/=\/=\/=\\
 //=\/=\/=\/=\         APE                                           SINGH                   /=\/=\/=\/=\\
//=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\


int modPow(int a, int b);
void solve(){


    int a,b;
    cin >> a >>b;
    cout << a*b<<endl;









}






signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(2);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
   // int test=1; cin >> test;
   // while(test--)
    solve();
}


int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int N,Y;
    cin >> N >> Y;
    int Y1=0,Y5=0,Y10=0;
    Y10 = Y/10000;
    Y5 = (Y-Y10*10000)/5000;
    Y1 =(Y-Y10*10000-Y5*5000)/1000;
    while(true){
        if(Y1 + Y5 + Y10 == N){
            cout << Y10 << ' ' << Y5 << ' ' << Y1;
            return 0;
        }else if(Y1 + Y5 + Y10 > N){
            cout << -1 << ' ' << -1 << ' ' << -1;
            return 0;
        }
        if(Y5 != 0 && Y1 + Y5 + Y10 + 4 <= N){
            Y5--;
            Y1+=5;
        }else if(Y10 != 0){
            Y10--;
            Y5+=2;
        }else{
            cout << -1 << ' ' << -1 << ' ' << -1;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;

const long long MAX = 1000100;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2;i < MAX;i++){
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
long long COM(int n, int k){
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

	map<int,int> mp;
	for(int i = 2;i * i <= m;i++){
		while(m % i == 0){
			mp[i]++;
			m /= i;
		}
	}

	if(m != 1)mp[m]++;

	ll ans = 1;

	for(auto p:mp){
		ll com = COM(p.second+n-1,p.second);
		ans *= com;
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 27056
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b;
}

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

  /* code */


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  int l[n];
  for(int i=0;i<n;i++)
  {
    cin>>l[i];
  }
  sort(l,l+n);
  int diff=l[n/2]-l[n/2-1];
  cout<<diff<<'\n';
  return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 26 22:43:32 2020

@author: liang
"""

from math import gcd

N = int(input())
T = [int(input()) for i in range(N)]
ans = 1

for i in range(N):
    ans = ans*T[i]//gcd(ans,T[i])

print(ans)

Measured memory_bytes: 9024
#include<stdio.h>

char *era; 
int year;

void translate(int ad, int month, int day);

int main(void)
{
    int ad, month, day;
    while((scanf("%d %d %d", &ad, &month, &day)) != EOF) {
        if (ad <= 1867) {
            printf("pre-meiji\n");
        } else if (ad == 1868 && month <= 8) {
            printf("pre-meiji\n");
        } else if (ad == 1868 && month == 9 && day <= 7) {
            printf("pre-meiji\n");
        } else {
        translate(ad, month, day);
            printf("%s %d %d %d\n", era, year, month, day);
        }
   }
   return 0;
}

void translate(int ad, int month, int day)
{
    if ((ad <= 1911) || (ad == 1912 && month <= 6) || (ad == 1912 && month == 7 && day <= 29)) {
        era = "meiji";
        year = ad - 1868 + 1;
    } else if ((ad <= 1925) || (ad == 1926 && month <= 11) || (ad == 1926 && month == 12 && day <= 24)) {
        era = "taisho";
        year = ad - 1912 + 1;
    } else if ((ad <= 1988) || (ad == 1989 && month == 1 && day <= 7)) {
        era  = "showa";
        year = ad - 1925;
    } else {
        era = "heisei";
        year = ad -1988;
    }
}
        
        
    

Measured memory_bytes: 1036
n = int(input())
v = [int(i) for i in input().split()]
MAX_V = 100001
even = [[i, 0] for i in range(MAX_V)]
odd = [[i, 0] for i in range(MAX_V)]
for ni in range(n//2):
    even[v[ni*2]][1] += 1
    odd[v[ni*2+1]][1] += 1
even.sort(key=lambda x: x[1], reverse=True)
odd.sort(key=lambda x: x[1], reverse=True)

if even[0][0] == odd[0][0]:
    if even[1][1] > odd[1][1]:
        print(n-even[1][1]-odd[0][1])
    else:
        print(n-even[0][1]-odd[1][1])
else:
    print(n - even[0][1] - odd[0][1])

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

int main() {
    int n, q, ans = 0;
    cin >> n;

    vi S(n + 1);
    rep(i, 0, n) { cin >> S[i]; }

    cin >> q;
    rep(i, 0, q) {
        cin >> S[n];
        int j = 0;
        while (S[j] != S[n]) { ++j; }
        if (j != n) { ++ans; }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3144
import numpy as np
A= np.array([list(map(int,input().split())) for I in range (3)])

for I in range (2):
    j,k,l = A[1]-A[0]
    if not (j==k and k==l):
        print ( "No")
        quit()
    j,k,l = A[2]-A[0]
    if not (j==k and k==l):
        print ( "No")
        quit()
print("Yes")


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

int main()
{
    int n,w;
    cin>>n>>w;
    ll wt[n+1],v[n+1];
    for(int i=1;i<=n;i++)
        cin>>wt[i]>>v[i];
    ll dp[n+1][w+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(wt[i]<=j)
                dp[i][j]= max(v[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
            else
                dp[i][j]= dp[i-1][j];
        }
    }
    cout<<dp[n][w]<<endl;
    return 0;
}


Measured memory_bytes: 79104
<?php
  fscanf(STDIN, '%d', $n);
  fscanf(STDIN, '%s', $s);
  
  $first = substr($s, 0, $n/2);
  $last = substr($s, $n/2);
  
  if($first === $last){
      echo 'Yes'.PHP_EOL;
  } else {
      echo 'No'.PHP_EOL;
  }

Measured memory_bytes: 4856
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
//#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 3000000;
int mod = 1e9 + 7;
int s[N], dp[N][2], b[N];
map < int, int > m;
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    s[0] = 0;
    set < int > t;
    for (int i = 1; i <= n; i++){
        int x;
        cin >> x;
        s[i] = (s[i - 1] ^ x);
        t.insert(s[i]);
    }
    t.insert(0);
    int cnt = 0;
    for (auto i: t){
        m[i] = cnt;
        cnt++;
    }
    for (int i = 1; i <= cnt; i++) dp[i][0] = 1;
    int g = 0;
    for (int i = 1; i <= n; i++){
        if (s[i] == 0){
            g++;
        } else{
            int p = m[s[i]];
            if (b[p] < g){
                dp[p][0] = (dp[p][0] + (g - b[p]) * dp[p][1]) % mod;
                b[p] = g;
            }
            dp[p][1] = (dp[p][1] + dp[p][0]) % mod;
        }
    }
    if (s[n] == 0){
        int c = 1;
        for (int i = 1; i < n; i++) if (s[i] == 0) c = (c + c) % mod;
        for (int i = 1; i <= cnt; i++){
            c = (c + dp[i][1]) % mod;
        }
        cout << c << endl;
    }
    else {
        int p = m[s[n]];
        if (b[p] < g)  dp[p][0] = (dp[p][0] + (g - b[p]) * dp[p][1]) % mod;
        cout << dp[p][0];

    };
}


Measured memory_bytes: 48000
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222





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


  cin >> s;
  ll cnt = 0;
  rep(i, s.length()) {
    if (s[i] == 'B') cnt++;
    else ans += cnt;
  }
  cout << ans << endl;




  return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




int main(){
    int n; cin>>n;
    string ans, s="ACL";
    rep(i,n){
        ans+=s;
    }
    cout<< ans <<endl;
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    cout << K / 2 * (K - K / 2) << endl;

    return 0;
}


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

import static java.lang.Integer.parseInt;

public class Main {

	static Map<String, int[]> dirs = new HashMap<String, int[]>() {
		{
			put("North", new int[]{1, 5, 2, 3, 0, 4});
			put("East", new int[]{3, 1, 0, 5, 4, 2});
			put("West", new int[]{2, 1, 5, 0, 4, 3});
			put("South", new int[]{4, 0, 2, 3, 5, 1});
			put("Right", new int[]{0, 2, 4, 1, 3, 5});
			put("Left", new int[]{0, 3, 1, 4, 2, 5});
		}
	};

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null) {
			int n = parseInt(line);
			if (n == 0) break;

			int[] dice = {1, 2, 3, 4, 5, 6};
			int sum = dice[0];
			for (int i = 0; i < n; i++) {
				line = br.readLine();
				int[] temp = new int[6];
				for (int j = 0; j < 6; j++) {
					temp[j] = dice[dirs.get(line)[j]];
				}
				dice = temp;
				sum += dice[0];
			}
			System.out.println(sum);
		}
	}
}

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

ll H,W;
const ll INF = 1e18;

int main()
{
	scanf("%lld%lld",&H,&W);
	ll ans = INF;
	FOR(i,1,H){
		ll x = i * W;
		ll y = (H - i) / 2 * W;
		ll z = (H - i + 1) / 2 * W;
		chmin(ans,max({x,y,z}) - min({x,y,z}));
		y = W / 2 * (H - i);
		z = (W + 1) / 2 * (H - i);
		chmin(ans,max({x,y,z}) - min({x,y,z}));
	}
	FOR(i,1,W){
		ll x = i * H;
		ll y = (W - i) / 2 * H;
		ll z = (W - i + 1) / 2 * H;
		chmin(ans,max({x,y,z}) - min({x,y,z}));
		y = H / 2 * (W - i);
		z = (H + 1) / 2 * (W - i);
		chmin(ans,max({x,y,z}) - min({x,y,z}));
	}

	printf("%lld\n",ans);

	return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7;

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

    if(s == "keyence") {
        cout << "YES" << endl;
        return 0;
    }

    int n = s.size();
    for(int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            string tmp = "";
            for(int k = 0; k < i; k++){
                tmp += s[k];
            }
            for(int k = j; k < n; k++){
                tmp += s[k];
            }
            if(tmp == "keyence") {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;


    return 0;
}


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

int main()
{
  string S, T;
  cin >> S >> T;
  cout << T << S << endl;
}

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

int main() {
	int i, j;
	int n;
	int A[10000];
	int res = 0;
	bool prime;

	scanf("%d", &n);
	for (int i = 0;i < n;i++) {
		scanf("%d", A + i);
	}

	for (i = 0;i < n;i++) {
		prime = true;
		for (j = 2;j <= (int)sqrt(A[i]);j++) {
			if (A[i] % j == 0) {
				prime = false;
				break;
			}
		}
		if (prime)res++;
	}

	printf("%d\n", res);

	return 0;
}

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

int main(){
	int N;
	cin >> N;
	vector<int> ans(N,0);
	for(int i=0;i<N-1;i++){
		int A;
		cin >> A;
		ans[A-1]++;
	}
	for(auto &i:ans)cout << i << endl;
	return 0;
}

Measured memory_bytes: 4052
using static System.Console;

class D
{
	static void Main()
	{
		var n = int.Parse(ReadLine());

		for (var i = 0; i < n; i++)
		{
			for (var j = i + 1; j < n; j++) Write($"{FindDiff(i, j) + 1} ");
			WriteLine();
		}
	}

	static int FindDiff(int x, int y)
	{
		var z = x ^ y;
		for (var i = 0; ; i++) if ((z >>= 1) == 0) return i;
	}
}


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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

const int N = 1e5 + 10;

char S[N], T[N];
int n, m;

int main() {

	scanf("%d%d%s%s", &n, &m, S, T);
	int d = __gcd(n, m);
	for (int i = 0, j = 0; i < n && j < m; i += n / d, j += m / d)
		if (S[i] != T[j]) { puts("-1"); return 0; }
	printf("%lld\n", 1ll * n * m / d);

	return 0;
}

Measured memory_bytes: 384
from collections import defaultdict


def main():
    N = int(input())
    D = defaultdict(int)
    for i in range(1, 150):
        for j in range(1, 150):
            for k in range(1, 150):
                if i**2+j**2+k**2+i*j+j*k+k*i<=2*10**4:
                    D[i**2+j**2+k**2+i*j+j*k+k*i] += 1
                else:
                    break
    for i in range(1, N+1):
        print(D[i])


if __name__ == "__main__":
    main()


Measured memory_bytes: 10380
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

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


class C {
	int N, X;
public:
	void solve()
	{
		vector<int> dx(N);
		int ans, x;
		cin >> x;
		ans = abs(x - X);
		for (int i{ 1 }; i < N; i++)
		{
			cin >> x;
			ans = gcd(ans, abs(x - X));

			if (ans == 1) break;
		}

		cout << ans << endl;
	}
	
	C()
	{
		cin >> N >> X;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

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

using namespace std;

int main() {
  string s;
  cin>>s;
  int k=s.size();
  long long ans=0;
  for(int tmp=0;tmp<pow(2,k-1);tmp++){
     bitset<9> t(tmp);
    long long a=0;
    for(int i=0;i<k;i++){
      
      long long h=s[i];
      h-=48;
      if(t[i]==0){
        a=10*a+h;
      }
      else{
        a=10*a+h;
        ans+=a;
        a=0;
      }
      if(i==k-1){
        ans+=a;
      }
        
    }
    
  }
  
 cout<<ans<<endl;
  
  
}


Measured memory_bytes: 3952
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
#include <queue>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    ll a, b, c, k;
    cin >> a>>b>>c>>k;
    if (k%2==0) cout << a-b << std::endl;
    else cout << b-a << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, M;
  string S;
  cin >> N >> M >> S;

  // dp[i] := i番目のマスからN番目のマスまで行くときに振るサイコロの回数の最小値
  vector<int> dp(N + 1, 0);
  // r := (r <= i+M and dp[r] != -1) をみたす最大の r
  int r = N;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '1') {
      dp[i] = -1;
      continue;
    }
    while (r > i + M) {
      r--;
    }
    while (dp[r] == -1) {
      r--;
    }
    if (i == r) {
      cout << -1 << endl;
      return 0;
    }
    dp[i] = dp[r] + 1;
  }

  vector<int> ans;
  int now = 0;
  for (int i = 0; i <= N; i++) {
    if (dp[i] == -1) {
      continue;
    }
    if (dp[i] != dp[now]) {
      ans.push_back(i - now);
      now = i;
    }
  }
  for (int i = 0; i < (int)ans.size(); i++) {
    cout << ans[i];
    cout << (i == (int)ans.size() - 1 ? "\n" : " ");
  }

  return 0;
}

Measured memory_bytes: 1528
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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 T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}



ll dp[21000];
main(){
    int h=in(),n=in();
    vec a;
    rep(i,n)a.pb(in());
    ll sum=0;
    rep(i,n)sum+=a[i];
    cout<<(sum>=h ? "Yes":"No");
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
 
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

const int INF = (int)1e9;
const int n = 5000;

void solve() {
  ll x;
  cin >> x;
  for (ll a = 0 ; a <= n ; a++) {
    for (ll bb = 0 ; bb <= n ; bb++) {
      ll b = bb;
      ll r = (ll)pow(a - b, 5) + 5 * a * b * ((ll)pow(a, 3) - (ll)pow(b, 3)) + 10 * (ll)pow(a, 2) * (ll)pow(b, 2) * (b - a);
      if (r == x) {
        cout << a << " " << b;
        return;
      }
      b = -bb;
      r = (ll)pow(a - b, 5) + 5 * a * b * ((ll)pow(a, 3) - (ll)pow(b, 3)) + 10 * (ll)pow(a, 2) * (ll)pow(b, 2) * (b - a);
      if (r == x) {
        cout << a << " " << b;
        return;
      }
    }
  }
}
 
int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
 
  return 0;
}

Measured memory_bytes: 4216
# coding: utf-8

# https://atcoder.jp/contests/abc077/tasks/arc084_a
# 16:40-17:19 done


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    A = sorted(A, reverse=True)
    B = sorted(B, reverse=True)
    C = sorted(C, reverse=True)

    n_C_for_B = [0] * N
    c = 0
    for b in range(N):
        if C[-1] > B[b]:
            # c = N
            n_C_for_B[b] = N
        else:
            # c = 0
            while C[c] > B[b]:
                c += 1
            n_C_for_B[b] = c

    n_B_for_A = [0] * N
    b = 0
    for a in range(N):
        if B[-1] > A[a]:
            n_B_for_A[a] = N
        else:
            while B[b] > A[a]:
                b += 1
            n_B_for_A[a] = b
    
    n_B = [0] * N
    i = 0
    for a in range(N):
        if n_B_for_A[a] == 0:
            continue

        while i <= n_B_for_A[a]-1:
            n_B[i] = N-a
            i += 1
    
    ans = 0
    for i in range(N):
        ans += n_B[i] * (n_C_for_B[i])
    
    return ans


print(main())


Measured memory_bytes: 27060
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
bool myComper(int pos, string S, string T) 
{
	REP(i, T.length()) {
		if (S.length() == pos) {
			return false;
		}
 		if ((S[pos] == '?')||(S[pos] == T[i])) {
			pos++;
		} else {
			return false;
		}
	}
	return true;
}

// メイン
int main()
{
	// 入力
	string S, T;
	cin >> S >> T;

	string ans;
	REP(i, S.size()) {
		if (myComper(i, S, T)) {
			string ansTmp = S;
			ansTmp.replace(i, T.length(), T);
			if (ans.size() == 0) {
				ans = ansTmp;
			} else if (ansTmp < ans) {
				ans = ansTmp;
			} else {
				//
			}
		}
	}
	if (ans.size() == 0) {
		cout << "UNRESTORABLE" << endl;
	} else {
		REP(i, ans.size()) {
			if (ans[i] == '?') {
				ans[i] = 'a';
			}
		}
		cout << ans << endl;
	}

	return 0;
}



Measured memory_bytes: 256
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}
func main() {
	var N int
	fmt.Scan(&N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = nextInt(sc)
	}
	ans := 0
	for i := 1; i < len(a); i++ {
		if a[i-1] == a[i] {
			ans++
			// fmt.Println("magic i", i)
			i++
		}
	}
	fmt.Println(ans)
}


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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;

mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a, b;
    cin >> a >> b;
    int cur = 1;
    int ans = 0;
    while(cur < b){
        --cur;
        ans++;
        cur += a;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
  int a;
  cin >> a;
  if(a % 10 == 9 || a / 10 == 9) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#Atcoder 158 class
A,B = list(map(int,input().split()))
z=0
for x in range(int(((25*A)+1)/2),int((25*(A+1)+1)/2)):
    for y in range(int(10*B),int(10*(B+1))):
        if x==y:
            print(x)
            break
        else:
            z += 1
    if x==y:
        break
    
if z==(int((25*(A+1)+1)/2)-int(((25*A)+1)/2))*(int(10*(B+1))-int(10*B)):
    
    print(-1)


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  int ans=1001001001;
  for(int i=-100; i<=100; i++){
    int now_ans=0;
    rep(j,n){
      now_ans+=(a[j]-i)*(a[j]-i);
    }
    ans=min(ans,now_ans);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int n,m,ans;
  ans=0;
  cin>>n>>m;
  long long int num[3];
  num[0]=num[1]=num[2]=10;

  for(int i=0;i<m;i++){
  	int tmp,tmp2;
  	cin>>tmp>>tmp2;
  	tmp=tmp-1;
  	if(num[tmp]==10){
  	  num[tmp]=tmp2;
  	}else if(num[tmp]!=tmp2){
  	  cout<<-1<<endl;
  	  return 0;
  	}
  }
  if(num[0]==10&&n==3){
  	num[0]=1;
  }
  if(num[1]==10&&n==3){
  	num[1]=0;
  }
  if(num[2]==10&&n==3){
  	num[2]=0;
  }  
  if(num[0]==10&&n==2){
  	num[0]=1;
  }
  if(num[1]==10&&n==2){
  	num[1]=0;
  }  
  if(num[0]==10&&n==1){
  	num[0]=0;
  }   
  if(num[0]==0&&n==3){
  	cout<<-1<<endl;
  	return 0;
  }else if(n==3){
  	ans=num[0]*100+num[1]*10+num[2];
  	cout<<ans<<endl;
  	return 0;
  }
  if(num[0]==0&&n==2){
  	cout<<-1<<endl;
  	return 0;
  }else if(n==2){
  	ans+=num[0]*10+num[1];
  	cout<<ans<<endl;
  	return 0;
  }
  if(n==1){
    ans+=num[0];
  	cout<<ans<<endl;
  	return 0;
  }
  
}


Measured memory_bytes: 256