akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005


int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int n;
        cin >> n;
        string s;
        map<string,int>mp;
        int m=0;
        for(int i=1; i<=n; i++){
            cin >> s;
            mp[s]++;
            m=max(mp[s],m); 
        }
        for(auto i : mp){
            if(i.second==m){
                cout << i.first << '\n';
            }
        }
        

}

Measured memory_bytes: 23808
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;


#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

ll GCD(ll a, ll b){
    if(b==0) return a;
    return GCD(b, a%b);
}


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];
int s[100010];
int main(void) {
    int N; cin >> N;
    REP(i, N) {
        int a; cin >>a; a--;
        s[i] = a;
    }
    s[N]=0;
    int cnt=0;
    for(int i=0; i<N; ++i){
        if(s[i]==i){
            swap(s[i], s[i+1]);
            cnt++;
        }
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 5376
# 問題：https://atcoder.jp/contests/abc137/tasks/abc137_c

n = int(input())
s_dict = {}
res = 0
for i in range(n):
    word = ''.join(sorted(input()))
    if word in s_dict.keys():
        res += s_dict[word]
        s_dict[word] += 1
    else:
        s_dict[word] = 1

print(res)



Measured memory_bytes: 22068
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
map<string,int> kuji;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        string s; cin >> s;
        kuji[s]++;
    }
    

}

int solve(){
    cout << kuji.size() <<endl;
    return 0;
}   

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


Measured memory_bytes: 19256
def main():
    import sys
    n,*d=map(int,sys.stdin.buffer.read().split())
    e=[0]*n
    for i in d:
        e[i]+=1
    a=1 if d[0]<1 else 0
    for i in d[1:]:a=a*e[i-1]%998244353
    print(a)
main()


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    int h1, m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
    m2 -= k;
    while(m2 < 0){
        m2 += 60;
        h2 -= 1;
    }
    int ans = (h2-h1)*60 + (m2-m1);
    out(ans);
}

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

int main(void) {
    int n,m,t;
    (void)scanf("%d %d",&n,&m);
    while(m){
        (void)scanf("%d",&t);
        n-=t;
        m--;
    }
    if(n<0)n=-1;
    printf("%d\n",n);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <string>
using namespace std;
#define REP(i, a, n) for (int i = ((int)a); i < ((int)n); i++)
#define lli long long int
#define MOD 1'000'000'007
enum
{
    A = 0,
    C = 1,
    G = 2,
    T = 3
};
/*
方針:
アウトになるのは
?AG+C
?GA+C
A?G+C
AG?+C
?AC+G
の5パターン
->最後4文字から考える
*/
int N;
int ans = 0;
int memo[101][4][4][4];

int solve()
{
    REP(j, 0, 4)
    REP(k, 0, 4)
    REP(l, 0, 4)
    {
        //AGC
        if (j == A && k == G && l == C)
            continue;
        //GAC
        if (j == G && k == A && l == C)
            continue;
        //ACG
        if (j == A && k == C && l == G)
            continue;
        memo[3][j][k][l] = 1;
    }
    REP(length, 3, N)
    REP(i, 0, 4)
    REP(j, 0, 4)
    REP(k, 0, 4)
    REP(l, 0, 4)
    {
        //?AGC
        if (j == A && k == G && l == C)
            continue;
        //A?GC
        if (i == A && k == G && l == C)
            continue;
        //GA?C
        if (j == G && k == A && l == C)
            continue;
        //?ACG
        if (j == A && k == C && l == G)
            continue;
        //AG?C
        if (i == A && j == G && l == C)
            continue;
        memo[length + 1][j][k][l] += memo[length][i][j][k];
        memo[length + 1][j][k][l] %= MOD;
    }
    REP(i, 0, 4)
    REP(j, 0, 4)
    REP(k, 0, 4)
    {
        ans += memo[N][i][j][k];
        ans %= MOD;
    }
}
int main()
{
    cin >> N;
    solve();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
#define N 100000
#define M 62
lint a[N+10],b[N+10],c[N+10],u[N+10];
bool ret[N+10];
int r[M+10],as[M+10];
int n;
void maxxor(void){
	memset(ret,false,sizeof(ret));
	memset(c,0,sizeof(c));
	memset(u,-1,sizeof(u));
	int j,rank=0;lint all=0;
	for(int i=M-1;i>=0;i--){
		r[i]=-1;lint cur=(1LL<<i);
		for(j=0;j<n;j++){if(u[j]<0 && (b[j]&cur)) break;}
		if(j>=n) continue;
		u[j]=i;r[i]=j;as[rank++]=j;c[j]^=cur;
		REP(k,j+1,n){
			if(u[k]<0 && (b[k]&cur)){
				b[k]^=b[j];c[k]^=c[j];
			}
		}
	}
	for(int i=rank-1;i>=0;i--){
		j=as[i];
		rep(k,M){
			if((b[j]&(1LL<<k)) && u[j]!=k && r[k]>=0){
				b[j]^=b[r[k]];c[j]^=c[r[k]];
			}
		}
		all^=c[j];
	}
	rep(i,n){
		if(u[i]>=0 && (all&(1LL<<u[i]))) ret[i]=true;
	}
	return;
}
int main()
{
	lint xo=0,mxo=0;
	cin>>n;
	rep(i,n){
		cin>>a[i];xo^=a[i];
	}
	rep(i,n){
		a[i]|=xo;a[i]-=xo;b[i]=a[i];
	}
	maxxor();
	rep(i,n){
		//cout<<a[i]<<' '<<ret[i]<<endl;
		if(ret[i]) mxo^=a[i];
	}
	cout<<xo+mxo*2<<endl;
}


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

int main()
{
	std::cout << std::fixed << std::setprecision(15);

	ll W, H, x, y;
	cin >> W >> H >> x >> y;

	double size = (double)W * (double)H / 2.0;
	int isMany = ((double)x == (double)W / 2.0 && (double)y == (double)H / 2) ? 1 : 0;

	cout << size << " " << isMany << endl;
	return 0;
}


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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    vector<u_int64_t> a(n);

    for (auto &e: a) cin >> e;

    u_int64_t tmp = 0;
    u_int64_t sum = 0;

    for (int i = n-1; i >= 1; --i) {
        tmp = (tmp + a[i]) % (1000000007);
        sum = (sum + tmp*a[i-1]) % (1000000007);
    }

    cout << sum;

    return 0;
}


Measured memory_bytes: 4344
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  cin >> a;
  rep(i, n) a.eb(k + a[i]);
  ll ans = INF;
  rep(i, n) {
    chmin(ans, a[i + n - 1] - a[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1804
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	mp := make(map[int]int)
	for i := 0; i < n; i++ {
		var k int
		fmt.Scan(&k)
		for i := 0; i < k; i++ {
			var tmp int
			fmt.Scan(&tmp)
			v, ok := mp[tmp]
			if ok {
				mp[tmp] = v + 1
			} else {
				mp[tmp] = 1
			}
		}
	}
	count := 0
	for _, v := range mp {
		if v == n {
			count++
		}
	}
	fmt.Println(count)
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int a, b,ans;
  char op;
  cin >> a >> op >> b;

  if (op == '+') ans = a + b;
  else
    ans = a - b;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	long long a[n];
	for(long long i=0;i<n;i++)
	cin>>a[i];
	long long sum=1,jilu=0;
	for(long long i=0;i<n;i++)
	{
		if(a[i]==0)
		jilu=1;
	}
	if(jilu==1)
	cout<<0;
	else
	{
	for(long long i=0;i<n;i++)
	{
		if((1000000000000000000/a[i])<sum)
		{
			sum=-1;
			break;
		}
	sum*=a[i];
	}
	cout<<sum;
		}
} 

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

int main(){
    const double pi = 3.1415926535;
    double r; cin >> r;
    printf("%.3lf\n", 2*pi*r);

    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int x, ta = 0;

signed main() {
	cin >> x;
	if (x % 11 == 0)cout << x / 11 * 2 << endl;
	else if (x % 11 <= 6)cout << x/11 * 2 + 1 << endl;
	else cout << x / 11 * 2 + 2 << endl;
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
    R int res=1;
    for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
    return res;
}
const int N=5005,M=5e6+5;
int f[N][N],fac[M],ifac[M],n,k;
inline int C(R int n,R int m){return m>n?0:1ll*fac[n]*ifac[m]%P*ifac[n-m]%P;}
inline void init(R int n=5e6){
	fac[0]=ifac[0]=1;fp(i,1,n)fac[i]=mul(fac[i-1],i);
	ifac[n]=ksm(fac[n],P-2);fd(i,n-1,1)ifac[i]=mul(ifac[i+1],i+1);
}
int main(){
	scanf("%d%d",&n,&k),--k;
	if(!k)return puts("1"),0;
	init();
	f[0][0]=1;
	fp(i,0,(n<<1)-1)fp(j,0,min(i,n))if(f[i][j]){
//		printf("%d %d %d\n",i,j,f[i][j]);
		if(j+1<=n)upd(f[i+1][j+1],mul(n-j,mul(f[i][j],C(i+j*(k-1)+k-1,k-1))));
		if((i+1-j)<=j)upd(f[i+1][j],f[i][j]);
	}
	printf("%d\n",f[n<<1][n]);
	return 0;
}

Measured memory_bytes: 119040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  if (a==1)a+=13;
  if (b==1)b+=13;
  if (a>b){
    cout << "Alice" << endl;
  }else if(a==b){
    cout << "Draw" << endl;
  }else{
    cout << "Bob" << endl;
  }

}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

// bit op
int popcnt(uint x) { return __builtin_popcount(x); }
int popcnt(ull x) { return __builtin_popcountll(x); }
int bsr(uint x) { return 31 - __builtin_clz(x); }
int bsr(ull x) { return 63 - __builtin_clzll(x); }
int bsf(uint x) { return __builtin_ctz(x); }
int bsf(ull x) { return __builtin_ctzll(x); }

//binary gcd
ll gcd(ll _a, ll _b) {
    ull a = abs(_a), b = abs(_b);
    if (a == 0) return b;
    if (b == 0) return a;
    int shift = bsf(a|b);
    a >>= bsf(a);
    do {
        b >>= bsf(b);
        if (a > b) swap(a, b);
        b -= a;
    } while (b);
    return (a << shift);
}


template<class T, class U>
T pow_mod(T x, U n, T md) {
    T r = 1 % md;
    while (n) {
        if (n & 1) r = (r * x) % md;
        x = (x * x) % md;
        n >>= 1;
    }
    return r;
}

bool is_prime(ll n) {
    if (n <= 1) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
    ll d = n - 1;
    while (d % 2 == 0) d /= 2;
    // Michal Forisek, Jakub Jancina, Fast Primality Testing for Integers That Fit into a Machine Word
    V<ll> alist{2, 325, 9375, 28178, 450775, 9780504, 1795265022};  // n < 2^64
    for (ll a : alist) {
        if (n <= a) break;
        ll t = d;
        ll y = pow_mod<__int128_t>(a, t, n);  // over
        while (t != n - 1 && y != 1 && y != n - 1) {
            y = __int128_t(y) * y % n;  // flow
            t <<= 1;
        }
        if (y != n - 1 && t % 2 == 0) {
            return false;
        }
    }
    return true;
}
ll pollard_single(ll n) {
    auto f = [&](ll x) { return (__int128_t(x) * x + 1) % n; };
    if (is_prime(n)) return n;
    if (n % 2 == 0) return 2;
    ll st = 0;
    while (true) {
        st++;
        ll x = st, y = f(x);
        while (true) {
            ll p = gcd((y - x + n), n);
            if (p == 0 || p == n) break;
            if (p != 1) return p;
            x = f(x);
            y = f(f(y));
        }
    }
}

V<ll> pollard(ll n) {
    if (n == 1) return {};
    ll x = pollard_single(n);
    if (x == n) return {x};
    V<ll> le = pollard(x);
    V<ll> ri = pollard(n / x);
    le.insert(end(le), begin(ri), end(ri));
    return le;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, p;
    cin >> n >> p;
    auto pl = pollard(p);
    map<ll, int> mp;
    for (auto d: pl) mp[d]++;
    ll ans = 1;
    for (auto pa: mp) {
        ll c = pa.second / n;
        for (ll i = 0; i < c; i++) {
            ans *= pa.first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

int main(){
  int n; cin >>n;
  vector<int>v(n); int x=0;
  for(int i=0; i<n; i++){
    cin >>v[i];
    x^=v[i];
  }
  for(int i=0; i<n; i++) cout <<(x^v[i])<<" ";
return 0;}

Measured memory_bytes: 3948
#include  <stdio.h>
int main(void){
    int a,b,n;
    int max,min;
    
    if( scanf("%d%d%d",&n,&a,&b) < 3 ){
        return -1;
    }

    min = 0;
    if( (a+b) <= n ){
        if( a < b ){
            max = a;
        }else{
            max = b;
        }
    }else{
        min = (a+b) - n;
        if( a < b ){
            max = a;
        }else{
            max = b;
        }
    }
    printf("%d %d\n", max, min);
    return 0;
}

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

int odd[100010],even[100010];

int main(){
    int N; cin>>N;
    for(int i=0;i<N;i++){
        int a; cin>>a;
        if(i%2==0)even[a]++;
        else odd[a]++;
    }
    int o1=0,o2=0,e1=0,e2=0;
    for(int i=1;i<=100000;i++){
        if(odd[i]>odd[o1]){
            o2=o1;
            o1=i;
        }else if(odd[i]>odd[o2]){
            o2=i;
        }
        if(even[i]>even[e1]){
            e2=e1;
            e1=i;
        }else if(even[i]>even[e2]){
            e2=i;
        }
    }
    if(o1!=e1){
        cout<<N-odd[o1]-even[e1]<<endl;
    }else{
        cout<<min(N-odd[o1]-even[e2],N-odd[o2]-even[e1])<<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
def make_prime():
	prime=[0 for i in range(10**6)]
	used=[0 for i in range(10**6)]
	for i in range(2,10**6):
		if used[i]==1:
			prime[i]=prime[i-1]
			continue
		prime[i]=prime[i-1]+1;
		for j in range(i,10**6,i):
			used[j]=1
	return prime

def main():
	prime=make_prime()
	while True:
		try: n=int(input())
		except EOFError: break
		print(prime[n])

if __name__=="__main__":
	main()



Measured memory_bytes: 23568
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
vector<int>g[mx];
vector<int>tree[mx];
int deg[mx];
void collapse(int u,int pu,int a){
  vector<int>ch;
  for(int v:g[u])if(v!=pu)ch.push_back(v);
  if(deg[u]==2)collapse(ch.back(),u,a);
  else{
    if(a!=u){
      tree[a].push_back(u);
      tree[u].push_back(a);
//      cout<<a<<"->"<<u<<endl;
    }
    for(int v:ch)collapse(v,u,u);
  }
}
int solve(int u,int pu){
  int l=0;
  int ans=0;
  for(int v:tree[u])if(v!=pu){
    if(tree[v].size()==1)l++;
    else ans+=solve(v,u);
  }
  if(l>0)ans+=l-1;
  return ans;
}
int main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<n-1;i++){
    int u,v;
    scanf("%d %d",&u,&v);
    g[u].push_back(v);
    g[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  for(int i=0;i<n;i++)if(deg[i]==1){
    collapse(i,i,i);
    int ans=-1;
    for(int u=0;u<n;u++){
      int l=0;
      for(int v:tree[u])l+=(tree[v].size()==1);
      if(l>=2){
//        cout<<"solve at "<<u<<endl;
        ans=solve(u,u);
        break;
      }
    }
    ans=max(ans,1);
    printf("%d\n",ans);
    break;
  }
  return 0;
}


Measured memory_bytes: 20992
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10 ** 8)


def 関数(n):
	pas = 200 
	mon_min = 400
	toit = 1999
	kyuu = 8
	
	x = (n - 400) // 200
	return kyuu - x		 

def çözmek():
	N = int(input())
	print(関数(N)) 



if __name__ == "__main__":
    çözmek()



Measured memory_bytes: 9244
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<(x)<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Mat = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5+10;


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

    ll ans = b/x - (a-1)/x;
    if(a==0) ans = b/x +1;
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n, a, b, c;
    scan(n, a, b, c);
    auto x = iota(n).map!(i => readln.chomp.to!int).array;

    long ans = inf6;

    foreach (s ; 1 .. 1 << n) {
        long tmp;

        int la;
        foreach (j ; 0 .. n) {
            if (s & (1 << j)) {
                la += x[j];
                tmp += 10;
            }
        }
        tmp -= 10;

        foreach (t ; 1 .. 1 << n) {
            auto ttmp = tmp;
            int lb;
            if (s & t) continue;
            foreach (k ; 0 .. n) {
                if (t & (1 << k)) {
                    lb += x[k];
                    ttmp += 10;
                }
            }
            ttmp -= 10;

            foreach (u ; 1 .. 1 << n) {
                if ((s | t) & u) continue;
                auto tttmp = ttmp;
                int lc;
                foreach (e ; 0 .. n) {
                    if (u & (1 << e)) {
                        lc += x[e];
                        tttmp += 10;
                    }
                }
                tttmp -= 10;
                tttmp += abs(la - a) + abs(lb - b) + abs(lc - c);
                ans = min(ans, tttmp);
            }
        }
    }

    writeln(ans);
}




int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {writeln(b ? "Yes" : "No");}
void YES(bool b) {writeln(b ? "YES" : "NO");}
T[] readArr(T)() {return readln.split.to!(T[]);}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
ans = 0
tmp = 0
for now_h, next_h in zip(H, H[1:]):
  if now_h < next_h:
    ans = max(ans, tmp)
    tmp = 0
  else:
    tmp += 1
print(max(ans, tmp))


Measured memory_bytes: 14228
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  int X = 0;
  std::cin >> N >> X;
  std::vector<int> M(N, 0);
  int answer = 0;
  for (int i = 0; i < M.size(); i++) {
    int a = 0;
    std::cin >> a;
    M[i] = a;
  }
  std::sort(M.begin(), M.end());
  int sum = std::accumulate(M.begin(), M.end(), 0);
  int tmp_X = X;
  int sum_counter = 0;

  if (tmp_X - sum >= 0) {
    tmp_X -= sum;
    sum_counter = 1;
  }
  int counter = 0;
  while (tmp_X > 0) {
    if (tmp_X - M[0] >= 0) {
      tmp_X -= M[0];
      counter++;
    } else {
      break;
    }
  }
  std::cout << counter + sum_counter * M.size() << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG




int main() {
  ll a, b;
  cin >> a >> b;
  //vector<ll> a(N);
  //vector<vector<int>> data(3, vector<int>(4));
  if (a <= b){
    for(ll i=0; i< b;i++){
      cout << a;
    }
    cout << endl;
  }else{
    for(ll i=0; i< a;i++){
      cout << b;
    }
    cout << endl;
  }
  
  return 0;
}


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

int main()
{
    string S,T;
    cin >> S;
    cin >> T;
    int length = S.length();
    int diff = 0;
    for(int i=0;i<length;i++){
        if(S.at(i) != T.at(i)) diff++;
    }
    cout << diff;
    return 0;
}

Measured memory_bytes: 3888
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll arr[100001],dp[100001]={0};
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        dp[arr[i]]++;
    }
    int flag=0,count=0;
    for(int i=0;i<n;i++)
    {
        if(dp[i]>2){
            flag=1;
            break;
        }
        else if(dp[i]==2)
        {
            count++;
        }
        //else if(dp[i]==1)
        //{
          //  flag=1;
            //break;
        //}
    }
    //cout<<count;
    int sar=0;
    if(n&1)
    {
        if(dp[0]!=1)
            sar=1;
    }
 
    if(sar||flag)
        cout<<"0"<<endl;
    else
    {
        ll ans=1;
        for(int i=0;i<count;i++)
        {
            ans=(ans%MOD)*2;
        }
        cout<<ans%MOD;
    }
 
    return 0;
}

Measured memory_bytes: 1792
#AtCorder Beginer Contest 166 B - Trick or Treat
N,K= map(int, input().split())
Sunuke={}
for i in range(K):
    dn = int(input())
    Having_List =list(map(int,input().split()))
    for Having in Having_List:
        if Having not in Sunuke:
            Sunuke[Having]=1 
    
print(N-len(Sunuke))

Measured memory_bytes: 9188
def solve():
    N = int(input())
    S = input()
    white = [0] * (N+1)
    black = [0] * (N+1)
    for i in range(1,N+1):
        if S[i-1] == '.':
            white[i] = white[i-1] + 1
            black[i] = black[i-1]
        else:
            black[i] = black[i-1] + 1
            white[i] = white[i-1]
    
    ans = float('inf')
    for i in range(N+1):
        tmp = black[i] + white[-1] - white[i]
        ans = min(ans, tmp)
    
    print(ans)
    
if __name__ == '__main__':
    solve()

Measured memory_bytes: 44016
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	long long a[4];
	for (int i=0;i<3;++i)
	    cin>>a[i];
	    sort(a,a+3);
	int sum,ans=0;
	sum=(a[1]-a[0])/2;
	ans+=sum;
	a[2]=a[2]-sum*2;
	a[1]=a[1]-sum*2;
	ans=(a[2]-a[0])+ans+(a[1]-a[0]);
   cout<<ans<<endl;	
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    ll H,A;
    cin >> H >> A;
    if(H%A==0) cout << H/A << endl;
    else cout << H/A+1 << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import fractions

def beki(k):
    tmp = 0
    while k % (2 ** tmp) == 0: tmp += 1
    return tmp - 1

n, m = map(int, input().split())
a = set(map(int, input().split()))

g = 0
mx = 0
for i in a:
    mx = max(mx, beki(i))
    g = fractions.gcd(g, i)

if beki(g) != mx:
    print(0)
else:
    prod = 1
    lcm = 1
    for i in a:
        lcm = (lcm * (i // 2)) // fractions.gcd(lcm, i // 2)
    print((m // lcm + 1) // 2)



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

int main() {
 int A,B;
  cin >> A >> B;
  int C = 0;
  for (int i=A ; i <= B; i++){
    if ( i/10000 == i%10 ){
      if ( i%10000/1000 == i%100/10 ){
        C = C + 1;
      }
    }
  }
  cout << C << endl;
}


Measured memory_bytes: 3524
#include <stdio.h>

int main(void){

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

for(int i=1;;i++){
        if(i*b>=c){
                printf("Yes\n");
                break;
        }else if(i*d>=a){
                printf("No\n");
                break;
        }   
}

return 0;
}

Measured memory_bytes: 1644
def main():

    import collections

    N = int(input())
    A_s = list(map(int, input().split()))

    max_A = max(A_s)

    # CNT_A = collections.Counter(A_s)
    CNT_A = collections.Counter(A_s).most_common()
    CNT_A.sort()

    NG_list = [True for i in range(max_A)]
    cnt = 0

    
    for i in range(len(CNT_A)):
        counter = CNT_A[i][1]
        num = CNT_A[i][0]
        # num = A_s[i]

        index_num = num - 1

        if (counter > 1):
            NG_list[index_num] = False
            # continue

        if (NG_list[index_num] == True):
            cnt += 1
            NG_list[index_num] = False

        coef = 1
        while (True):
            coef += 1
            tmp_num = coef * num
            
            if (tmp_num <= max_A):
                NG_list[tmp_num - 1] = False
            else:
                break

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 44664
#include <cstdio>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

#define MOD 1000000007

typedef long long ll;

int main() {
    ll n, k, s;
    scanf("%lld%lld", &n, &k);
    vector<ll> a(n + 1);
    vector< vector<ll> > dp(n + 1, vector<ll>(k + 1, 0));
    for (ll i = 1; i <= n; ++i) scanf("%lld", a.begin() + i);
    dp.at(0).at(0) = 1;
    for (ll i = 1; i <= n; ++i) {
        s = 0;
        for (ll j = 0; j <= k; ++j) {
            s += dp.at(i - 1).at(j);
            if (j > a.at(i)) s -= dp.at(i - 1).at(j - a.at(i) - 1);
            dp.at(i).at(j) = s % MOD;
        }
    }
    printf("%lld\n", dp.back().back());
    return 0;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y,S=0;
  cin>>X;
  Y=X;
  while(X!=0){
    S+=X%10;
    X/=10;
  }
  if(Y%S==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

#define int long long

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    cout << a * b / __gcd(a, b) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

double r,menseki=0,enshu=0,M_PI=3.14159265359;

scanf("%lf",&r);

menseki=r*r*M_PI;

enshu=r*2.0*M_PI;

printf("%f %f\n",menseki,enshu);

return 0;

}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(9);
    rep(i,9) b[i] = 0;
    rep(i,n){
        cin >> a[i];
        int x = a[i]/400;
        if(x >= 8){
            x = 8;
        }
        b[x]++;
    }
    int sum = 0;
    rep(i,8){
        if(b[i] != 0){
            sum++;
        }
    }
    if(sum == 0){
        cout << 1 << ' ' << b[8] << endl;
    }else{
        cout << sum << ' ' << sum+b[8] << endl;
    }
}

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

using namespace std;

int main(void){

	int n;
	double t,a;

	cin >> n >> t >> a;

	double h[n];
	double hh[n];

	int m = 0;

	for(int i = 0; i < n; i++){
		cin >> h[i];
		hh[i] = t - h[i]*0.006;
		hh[i] = abs(a- hh[i]);
		if(hh[i] <= hh[m]){
			m = i;
		}
	}

	cout << m+1 <<endl;

	return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
    ll x = 0,f = 1;char ch = getchar();
    while(ch < '0' || ch > '9'){if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x*10+ch-'0';ch = getchar();}
    return x*f;
}

const int N = 500005;
int n,k;
int a[N],b[N];
int Mi[N<<2];
int head[N],nxt[N*2],to[N*2],cnt;
int ru[N],m;

inline void insert(int x,int y){
	to[++cnt] = y; nxt[cnt] = head[x]; head[x] = cnt;
}

int query(int num,int l,int r,int x,int y){
	if(x <= l && r <= y) return Mi[num];
	int mid = (l+r)>>1,ans = 1e9;
	if(x <= mid) ans = query(num<<1,l,mid,x,y);
	if(y > mid) ans = min(ans,query(num<<1|1,mid+1,r,x,y));
	return ans;
}

void change(int num,int l,int r,int x,int y){
	Mi[num] = min(Mi[num],y);
	if(l == r) return;
	int mid = (l+r)>>1;
	if(x <= mid) change(num<<1,l,mid,x,y);
	else change(num<<1|1,mid+1,r,x,y);
}

void toposort(){
	priority_queue<int,vector<int>,greater<int> > Q;
	for(int i = 1;i <= n;++i)
		if(ru[i] == 0) Q.push(i);
	while(!Q.empty()){
		int x = Q.top(); Q.pop();
		b[x] = ++m;
		for(int i = head[x];i;i = nxt[i]){
			--ru[to[i]];
			if(ru[to[i]] == 0) Q.push(to[i]);
		}
	}
}

signed main(){
	n = read(); k = read();
	for(int i = 1;i <= n;++i){ int x = read(); a[x] = i; }
	memset(Mi,0x3f,sizeof Mi);
	for(int i = n;i >= 1;--i){
		int x;
		if(a[i] < n){
			x = query(1,1,n,a[i]+1,min(a[i]+k-1,n));
			if(x >= 1 && x <= n) insert(a[i],a[x]),++ru[a[x]];
		}
		if(a[i] > 1){
			x = query(1,1,n,max(a[i]-k+1,1),a[i]-1);
			if(x >= 1 && x <= n) insert(a[i],a[x]),++ru[a[x]];
		}
		change(1,1,n,a[i],i);
	}
	toposort();
	for(int i = 1;i <= n;++i) printf("%d\n",b[i]);
	return 0;
}

Measured memory_bytes: 27184
MOD=10**9+7
N,K=map(int,input().split())
alist=list(map(int,input().split()))

b1list=alist
b2list=alist+alist

ans_k1=0
for i in range(N):
  for j in range(i+1,N):
    if b1list[i]>b1list[j]:
      ans_k1+=1
ans_k2=0
for i in range(2*N):
  for j in range(i+1,2*N):
    if b2list[i]>b2list[j]:
      ans_k2+=1      

diff_k12=ans_k2-2*ans_k1
#print(ans_k1,ans_k2,diff_k12)

answer=ans_k1*K+diff_k12*K*(K-1)//2
answer%=MOD
print(answer)

Measured memory_bytes: 9256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#define mem(a,b) memset((a),(b),sizeof(a))
using namespace std;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-12;
const int MAX=100000+10;
const int EDGE=100000+10;//边的条数
typedef long long ll;
const ll mod=1000000000+7;
int main()
{
	ll i,j,flag[1111],n,cnt,a[1111],b[1111],t,sum,temp;
	mem(flag,0);
	for(i=2;i<=1000/2;i++)
	{
		if(!flag[i])
		{
			for(j=i+i;j<=1000;j+=i)
			{
				flag[j]=1;
			}
		}
	}
	mem(a,0);
	cnt=0;
	for(i=2;i<=1000;i++)
	{
		if(!flag[i]) a[cnt++]=i;
	}
//	cout<<cnt<<endl;
	while(~scanf("%lld",&n))
	{
		mem(b,0);
		for(i=2;i<=n;i++)
		{
			for(j=0;j<cnt;j++)
			{
				if(a[j]>i) break;
				t=0;
				temp=i;
				while(temp%a[j]==0)
				{
					temp/=a[j];
					t++;
				}
				b[j]+=t;
			}
		}
		sum=1;
		for(i=0;i<cnt;i++)
		{
			if(b[i]) sum=sum%mod*(b[i]+1)%mod;
		}
		printf("%lld\n",sum);
	}
	return 0;
}
//720 2 2 2 2 3 3 5  5*3*2


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1<<10;
int n;
char s[N];
int p[N];
vector<pair<int,int> > solve(int S,int now)
{
	cerr<<"Solve"<<S<<" "<<now<<"\n";
	vector<pair<int,int> >res;
	for(int i=now+1;i<n;i++)
		if(S&(1<<i))
		{
			vector<pair<int,int> > t=solve(S,i);
			for(int j=now;j<=i-1;j++)
				res.push_back(make_pair(j,1));
			for(auto [x,y]:t)
				res.push_back(make_pair(x,y));
			for(int j=i;j>=now;j--)
				res.push_back(make_pair(j,1));
			res.push_back(make_pair(now,0));
			res.push_back(make_pair(now+1,0));
			for(int j=now+1;j<=i;j++)
				res.push_back(make_pair(j,1));
			reverse(t.begin(),t.end());
			for(auto [x,y]:t)
				res.push_back(make_pair(x,y));
			for(int j=i-1;j>=now+1;j--)
				res.push_back(make_pair(j,1));
			res.push_back(make_pair(now+1,0));
			res.push_back(make_pair(now,0));
			return res;
		}
	res.push_back(make_pair(now,1));
	res.push_back(make_pair(now+1,1)); 
	res.push_back(make_pair(now+1,0));
	res.push_back(make_pair(now,0));
	return res;
}
int main()
{
	scanf("%d",&n);
	scanf("%s",s);
	for(int i=0;i<(1<<n);i++)
		p[i]=s[i]-'0';
	if(p[0]==0)
	{
		printf("Impossible");
		return 0;
	}
	for(int s=0;s<(1<<n);s++)
		if(p[s]==1)
			for(int i=s;i;i=(i-1)&s)
				if(p[i]==0)
				{
					printf("Impossible");
					return 0;
				}
	vector<pair<int,int> >ans;
	ans.push_back(make_pair(0,0));
	for(int s=1;s<(1<<n);s++)
		if(p[s]==0)
		{
			bool flag=true;
			for(int i=(s-1)&s;i;i=(i-1)&s)
				if(p[i]==0)
				{
					flag=false;
					break;
				}
			if(!flag) continue;
			vector<pair<int,int> >res;
			vector<pair<int,int> >t;
			int u=0;
			for(u=0;u<n;u++)
				if(s&(1<<u))
				{
					t=solve(s,u);
//					cerr<<"res"<<"\n";
//					for(auto [x,y]:t)
//						cerr<<x<<" "<<y<<"\n";
//					cerr<<"EOF";
					break;
				}
			if(ans.back()!=make_pair(0,0)) res.push_back(make_pair(0,0));
			for(int i=0;i<=u-1;i++)
				res.push_back(make_pair(i,1));
			for(auto [x,y]:t)
				res.push_back(make_pair(x,y));
			for(int i=u;i>=0;i--)
				res.push_back(make_pair(i,1));
			res.push_back(make_pair(0,0));
			for(auto [x,y]:res)
				ans.push_back(make_pair(x,y));
		}
	printf("Possible\n");
	int len=ans.size()-1;
	printf("%d\n",len);
	for(auto [x,y]:ans)
		printf("%d %d\n",x,y);
	return 0;
}

Measured memory_bytes: 3816
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main(){
		int n;
		int x[100],y[100];
		long H;
		long h[100];

		scanf("%d",&n);
		for(int i=0 ; i<n ; ++i){
				scanf("%d %d %ld",&x[i],&y[i],&h[i]);
		}

		for(int i=0 ; i<=100 ; ++i){
				for(int j=0 ; j<=100 ; ++j){
						H = 0;
						for(int k=0 ; k<n ; ++k){
										if(H == 0){
												if(h[k] != 0){
														H = h[k] + abs(x[k] - i) + abs(y[k] - j);
												}
										}
						}
						for(int k=0 ; k<n ; ++k){
												if(h[k] != max(H - abs(x[k] - i) - abs(y[k] - j),0L)) break;
												if(k == n-1){
														printf("%d %d %ld\n",i,j,H);
														return 0;
												}
						}




				}
		}

}

Measured memory_bytes: 128
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   cin>>n;
   vi a(n);
   rep(i,0,n)cin>>a[i];
   int ans=0;
   for(int i=1;i<n;i++)
   {   int diff=max(0LL,a[i-1]-a[i]);
       ans+=diff;
       a[i]+=diff;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
int g[101][101];
using namespace std;

int  main(){
  const int INF=1e5;
  int N,Ma,Mb;
  cin>>N>>Ma>>Mb;
  std::vector<int> a(N),b(N),c(N);
  for(int i=0;i<N;i++)cin>>a[i]>>b[i]>>c[i];
  for(int i=0;i<101;i++)for(int j=0;j<101;j++)g[i][j]=INF*(i+j);
  for(int k=0;k<N;k++)for(int i=100;i>=0;i--)for(int j=100;j>=0;j--)if(i+a[k]<101&&j+b[k]<101)g[i+a[k]][j+b[k]]=min(g[i+a[k]][j+b[k]],g[i][j]+c[k]);
  int ans=INF;
  for(int i=1;i<101;i++)for(int j=1;j<101;j++)if(i*Mb==j*Ma)ans=min(ans,g[i][j]);
  if(ans>=INF)cout<<-1<<endl;
  else cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.math.*;
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
	  Scanner in=new Scanner(System.in);
    BigInteger b=in.nextBigInteger();
    if(b.isProbablePrime(70)==true)
    {
      System.out.println(b);
    }
    else
    {
      System.out.println(b.nextProbablePrime());
    }
  }
}

Measured memory_bytes: 36532
use std::io::Read;

pub fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();
    let s = iter.next().unwrap().chars().collect::<Vec<char>>();

    let mut acs = vec![false;n];
    for i in 0..(n-1) {
        if s[i] == 'A' && s[i+1] == 'C' {
            acs[i] = true;
        }
    }
    let mut csum = vec![0;n+1];
    for i in 0..n {
        csum[i+1] = csum[i] + (acs[i] as u32);
    }

    for _ in 0..q {
        let left: usize = iter.next().unwrap().parse().unwrap();
        let right: usize = iter.next().unwrap().parse().unwrap();
        println!("{}", csum[right - 1] - csum[left - 1]);
    }
}


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

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

double cross(complex<double> a, complex<double> b){
	return (a.real() * b.imag() - a.imag() * b.real());
}

int is_parallel(complex<double> a1, complex<double> a2, complex<double> b1, complex<double> b2){
	return EQ(cross(a1 - a2, b1 - b2), 0.0);
}

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

	int n;
	cin >> n;

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while(n > 0){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		complex<double> a(x1, y1);
		complex<double> b(x2, y2);
		complex<double> c(x3, y3);
		complex<double> d(x4, y4);

		cout << (is_parallel(a, b, c, d) ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

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

int main(){
  int n;
  cin >>n;
  vector<char> S(n),T(n);
  
   for(int i = 0; i<n; ++i){
    cin >> S.at(i);}

   for(int i = 0; i<n; ++i){
    cin >> T.at(i);}
  
  for(int i=0; i<n; ++i){
  cout << S.at(i) << T.at(i);}
  cout << endl;
}

Measured memory_bytes: 256