akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <string>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <vector>
#include <functional>
#include <map>
#include <stack>
#include <unordered_map>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REPD(i, n) for(int i = (int)(n) - 1; i >= 0; i--)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define PB(e) push_back(e)
#define FOREACH(i, c) for(auto i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define BIT(n, m) (((n) >> (m)) & 1)

typedef long long ll;
typedef pair<ll, ll> PI;

template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) {
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) {
  out << "[";
  REP(i, v.size()){
    if (i > 0) out << ", ";
    out << v[i];
  }
  out << "]";
  return out;
}

const ll INF = 1e18 + 7;

int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  
  vector<vector<PI>> G(N + 1);
  vector<ll> D(N + 1, INF);

  REP(i, M) {
    int l, r, c;
    scanf("%d %d %d", &l, &r, &c);
    G[l].push_back(PI(r, c));
  }
  
  REP2(i, 1, N) {
    G[i + 1].push_back(PI(i, 0));
  }
  
  D[1] = 0;
  priority_queue<PI, vector<PI>, greater<PI>> que;
  que.push(PI(0, 1));
  
  while (!que.empty()) {
    PI p = que.top();
    que.pop();
    // cout << p << endl;
    if (p.second == N) {
      break;
    }

    if (p.first > D[p.second]) {
      continue;
    }

    for (const auto &w: G[p.second]) {
      if (D[w.first] > D[p.second] + w.second) {
        D[w.first] = D[p.second] + w.second;
        que.push(PI(D[w.first], w.first));
      }
    }
  }

  if (D[N] < INF) {
    cout << D[N] << endl;
  } else {
    cout  << -1 << endl;
  }
  
  return 0;
}



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

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


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
int n=0,a[100001],f[100001],s[100001],mo=100000,cnt,ans;
int lowbit(int k)
{
	return k&-k;
}
int main() 
{
	cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>a[i];
    	s[i]=a[i];
    }	
    sort(s+1,s+n+1);
	cnt=unique(s+1,s+n+1)-s-1;
	for(int i=1;i<=n;i++)
	a[i]=lower_bound(s+1,s+cnt+1,a[i])-s;
    for(int i=1;i<=n;i++)
    {
    	int mx=0;
		for(int j=a[i];j<=mo;j+=lowbit(j))
			mx=max(mx,f[j]);
		mx++;
		for(int j=a[i];j>=1;j-=lowbit(j))
			f[j]=max(f[j],mx);
		ans=max(ans,mx);
	}
    cout<<ans<<endl;
}

Measured memory_bytes: 1408
import sys
from collections import defaultdict
readline = sys.stdin.readline

def main():
    H, W, M = map(int, readline().rstrip().split())
    HB = [0] * H
    WB = [0] * W
    HW = defaultdict(lambda : False)
    for _ in range(M):
        h, w = map(int, readline().rstrip().split())
        h -= 1
        w -= 1
        HW[(h,w)] = True
        HB[h] += 1
        WB[w] += 1
    hb = max(HB)
    max_h = [i for i, x in enumerate(HB) if x == hb]
    wb = max(WB)
    max_w = [i for i, x in enumerate(WB) if x == wb]
    
    ans = hb + wb
    for mh in max_h:
        for mw in max_w:
            if HW[(mh, mw)] == False:
                print(ans)
                sys.exit(0)
    print(ans - 1)

if __name__ == "__main__":
    main()


Measured memory_bytes: 184888
#include <stdio.h>

int main() {
    int num[5] = {}, buf, i, j;

    for(i=0; i<5; i++) scanf("%d", &num[i]);

    for (i=0; i<5; i++) {
        for (j=i+1; j<5; j++) {
            if ( num[i] < num[j] ) {
                buf = num[i];
                num[i] = num[j];
                num[j] = buf;
            }
        }
    }

    printf("%d %d %d %d %d\n", num[0], num[1], num[2], num[3], num[4]);

    return 0;
}


Measured memory_bytes: 2052
/***********************
*  Author: xuziyuan    * 
***********************/
 
#include <bits/stdc++.h>
 
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))
 
using namespace std;
 
const LL MOD=1e9+7;
 
int n,m,a[20],now=0;
string s[10010][2],ret,ans="",dp[10010];//dp[火柴数]=串 
int num[]={0,2,5,5,4,5,6,3,7,6};
 
inline string ts(int c)
{
	ret="";
	ret.pb(c+'0');
	return ret;
}
 
inline string MAX(string a,string b)
{
	if(a.size()>b.size()) return a;
	if(b.size()>a.size()) return b;
	return max(a,b);
}
 
int main()
{
	cin>>n>>m;
	rep(i,m) cin>>a[i];
	dp[0]=" ";
	repn(i,n)
	{
		rep(j,m)
		{
			if(i-num[a[j]]<0||dp[i-num[a[j]]]=="") continue;
			dp[i]=MAX(dp[i],dp[i-num[a[j]]]+ts(a[j]));
			//cout<<i<<' '<<dp[i]<<' '<<i-num[a[j]]<<' '<<dp[i-num[a[j]]]<<endl;
		}
	}
	cout<<dp[n].substr(1,dp[n].size()-1)<<endl;
	rt0;
}

Measured memory_bytes: 32128
/*痛みを受け取れ，痛みを知れ*/
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 5e5 + 5;

int main()
{
	//freopen("in.txt", "r", stdin);
	string s;
	while (cin >> s)
	{
		int ans = 0,num=0;
		for (auto i : s)
		{
			if (i == 'R')num++;
			else
			{
				if (num)ans = max(ans, num);
				num = 0;
			}
		}
		if (num)ans = max(num, ans);
		cout << ans << endl;
	}
	return 0;
};

Measured memory_bytes: 3596
#include <stdio.h>

int main(void) {
	int n, m, l;
	scanf("%d %d %d", &n, &m, &l);
	int a[n][m], b[m][l];
	long c[n][l];
	for(int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for(int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			scanf("%d", &b[i][j]);
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			c[i][j] = 0L;
			for (int k = 0; k < m; k++) {
				c[i][j] += (long)a[i][k] * (long)b[k][j];
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			printf("%ld", c[i][j]);
			if (j < l - 1) {
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define frone(i,n) for(int i=1;i<=n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    double w,h,x,y;
	cin >> w>>h>>x>>y;
    cout<<w*h/2<<endl;
    if(x*2==w&&y*2==h)cout<< 1<<endl;
    else cout<< 0<<endl;
}


Measured memory_bytes: 256
def getGCD(a, b): # ユークリッドの互除法
    if a < b:
        a, b = b, a
    c = a % b
    if c == 0:
        return b
    else:
        return getGCD(b, c)

x, y = map(int, input().split())
print(getGCD(x, y))



Measured memory_bytes: 5596
n=int(input())
r=list([i+1, list(map(str, input().split(" ")))] for i in range(n))
for i in r:
    i[1][1] = int(i[1][1])

_r=sorted(r, key=lambda x: (x[1][0], x[1][1]), reverse=True)
for __r in sorted(_r, key=lambda x: x[1][0]):
    print(__r[0])


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

int N;
map<int,int> m;

int main() {
    ios::sync_with_stdio(false);
    cin>>N;
    for(int i = 0; i < N; ++i) {
    	int a;
    	cin>>a;
    	m[a]++;
    }
    ll ans =0;
    for(pair<int,int> p:m) {
    	if(p.first!=p.second) {
    		if(p.second>p.first) {
    			ans += p.second-p.first;
    		} else {
    			ans += p.second;
    		}
    	}
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(v) v.begin(), v.end()
using namespace std;

ll n,a[200010],ans,x;
map< ll , ll > f;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for(ll i=1; i<=n; i++){
        cin >> a[i];
        x = i-a[i];
        if( f.count( x ) ){
            ans+=f[ x ];
        }
        f[ i+a[i] ]++;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 17532
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1 10");
            WillReturn.Add("3 5");
            //3
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2 10");
            WillReturn.Add("3 5");
            WillReturn.Add("2 6");
            //2
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("4 1000000000");
            WillReturn.Add("1 1");
            WillReturn.Add("1 10000000");
            WillReturn.Add("1 30000000");
            WillReturn.Add("1 99999999");
            //860000004
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("5 500");
            WillReturn.Add("35 44");
            WillReturn.Add("28 83");
            WillReturn.Add("46 62");
            WillReturn.Add("31 79");
            WillReturn.Add("40 43");
            //9
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    struct ABInfoDef
    {
        internal int A;
        internal int B;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        SplitAct(InputList[0]);
        int H = wkArr[1];

        var ABList = new List<ABInfoDef>();
        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            ABInfoDef WillAdd;
            WillAdd.A = wkArr[0];
            WillAdd.B = wkArr[1];
            ABList.Add(WillAdd);
        }

        int MaxA = ABList.Max(X => X.A);
        int RestHP = H;
        int Answer = 0;

        foreach (ABInfoDef EachABInfo in ABList.OrderByDescending(X => X.B)) {
            if (EachABInfo.B <= MaxA) break;

            RestHP -= EachABInfo.B;
            Answer++;
            if (RestHP <= 0) break;
        }
        if (RestHP > 0) {
            if (RestHP % MaxA > 0) {
                Answer += RestHP / MaxA + 1;
            }
            else {
                Answer += RestHP / MaxA;
            }
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 29104
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<pll>::iterator itr;
#define MP make_pair
#define PB push_back
#define ALL(a) a.begin(), a.end()
#define LAR(a, b) ((a)=max((a), (b)))
#define SML(a, b) ((a)=min((a), (b)))
#define DEBUG(...) 
#define L 25
ll *rmq[L];
// ll src(int a, int b, int c){
// 	int p=b/(1<<a), q=c/(1<<a);
// 	ll ret=LLONG_MIN;
// 	if(b<c){
// 		FOR(i, p+(a>0), q){
// 			LAR(ret, rmq[a][i]);
// 		}
// 		if(a){
// 			if(p==q){
// 				LAR(ret, src(a-1, b, c));
// 			}else{
// 				LAR(ret, src(a-1, b, (p+1)*(1<<a)));
// 				LAR(ret, src(a-1, q*(1<<a), c));
// 			}
// 		}
// 	}
// 	return ret;
// }

vector<pll> u, v;
ll x[30], y[30];
int main(){
	REP(i, L){
		int j=1<<(L-i-1);
		rmq[i]=new ll[j];
		fill(rmq[i], rmq[i]+j, LLONG_MIN);
	}
	int n;
	ll d;
	scanf("%d%lld", &n, &d);
	REP(i, n) scanf("%lld%lld", x+i, y+i);

	int k=n/2, m=n-k;
	int f;

	f=1; REP(i, k) f*=3;
	REP(i, f){
		ll p=0, q=0;
		int l=i;
		REP(j, k){
			if(l%3==0){ //Anna
				p+=x[j];
				q-=y[j];
			}else if(l%3==1){ //Bruno
				p-=x[j];
				q+=y[j];
			}
			l/=3;
		}
		u.PB(MP(p, q));
	}

	f=1; REP(i, m) f*=3;
	REP(i, f){
		ll p=0, q=0;
		int l=i;
		REP(j, m){
			if(l%3==0){ //Anna
				p+=x[k+j];
				q-=y[k+j];
			}else if(l%3==1){ //Bruno
				p-=x[k+j];
				q+=y[k+j];
			}
			l/=3;
		}
		v.PB(MP(p, q));
	}

	sort(u.begin(), u.end());
	sort(v.begin(), v.end());
	// REP(i, u.size()) printf("%2d %5lld %5lld\n", i, u[i].first, u[i].second);
	// REP(i, v.size()) printf("%2d %5lld %5lld\n", i, v[i].first, v[i].second);
	REP(i, v.size()){
		ll a=v[i].second;
		REP(j, L){
			LAR(rmq[j][i>>j], a);
		}
	}
	ll ans=0;
	int r=v.size(), s=v.size();

	for(pll &pr:u){
		ll &p=pr.first, &q=pr.second;
		while(r && v[r-1].first>=-d-p) r--;
		while(s && v[s-1].first>d-p) s--;
		// printf("[%d, %d)\n", r, s);
		if(r==s) continue;
		// printf("(%lld, %lld)->[%lld, %lld]=[%d, %d)\n", p, q, -d-p, d-p, r, s);
		ll ret=LLONG_MIN;
		//ret=src(L-1, r, s);
		REP(a, L){
			int x=(r+(1<<a)-1)>>a, y=s>>a;
			if(((x+1)<<a)<=s){
				// printf(" a[%d, %d)\n", x<<a, (x+1)<<a);
				LAR(ret, rmq[a][x]);
			}
			if(r<=((y-1)<<a)){
				// printf(" b[%d, %d)\n", (y-1)<<a, y<<a);
				LAR(ret, rmq[a][y-1]);
			}
		}
		LAR(ans, q+ret);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 751384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int a,b,k;
int main(){
    cin>>a>>b>>k;
    for(int i=min(a,b);i>=0;i--){
        if(a%i==0 && b%i==0){k--;}
        if(k==0){cout<<i<<endl;break;}
    }
}


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

int main()
{	
	int x = -1, i = 1;
	START:
	if(x != 0){
		cin >> x;
		if(x == 0)
			goto END;
		cout << "Case " << i++ << ": " << x << endl;
		goto START;
		
	}
	END:
	
	return 0;
}



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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

int N;
double c, t;
struct inf
{
  string L;
  double P, A, B, C, D, E, F, S, M;
  double cost;
};

inline bool operator > (const inf& x, const inf& y)
{
  return x.cost != y.cost ? x.cost > y.cost : x.L < y.L;
}

int main()
{
  while(cin >> N, N){
    vector<inf> data(N);
    rep(i, N){
      cin >> data[i].L >> data[i].P >> data[i].A >> data[i].B >> data[i].C >> data[i].D >> data[i].E >> data[i].F >> data[i].S >> data[i].M;

      c = data[i].M * data[i].F;
      t = data[i].A + data[i].B + data[i].C;
      t += data[i].M * (data[i].D + data[i].E);
      data[i].cost = (c * data[i].S - data[i].P) / t;
    }

    sort(ALL(data), greater<inf>());

    vrep(v, data) cout << v->L << endl;
    cout << '#' << endl;
  }

  return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  vector<ll> sum(n + 1, 0);
  REP(i, n) {
    ll a;
    cin >> a;
    sum[i + 1] = sum[i] + a;
  }
  ll ans = 1e18;
  FOR(i, 1, n) {
    ll t = abs(sum[i] - (sum[n] - sum[i]));
    ans = min(ans, t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
 
  int i,j,k,l,m;
  int n,e,s,w,un,up;
  int a[7];
int t;
 
 
void input() {
 for(i=0;i<6;i++){
   
    scanf("%d",&a[i+1]);
   
  }
}
 
 void N() {
   t = a[1];
   a[1] = a[2];
   a[2] = a[6];
   a[6] = a[5];
   a[5] = t;
 }
 
 void S() {
   t = a[1];
   a[1] = a[5];
   a[5] = a[6];
   a[6] = a[2];
   a[2] = t;
}
 
 void E() {
   t = a[1];
   a[1] = a[4];
   a[4] = a[6];
   a[6] = a[3];
   a[3] = t;
 }
 
 void W() {
   t = a[1];
   a[1] = a[3];
   a[3] = a[6];
   a[6] = a[4];
   a[4] = t;
 }
 
int main() {
 
  input();
  //  strlen(?) 文字の長さ(数)を表示
 char str[110];  
 scanf("%s",str);
 
 for(i=0;i<strlen(str);i++) {
 
   if(str[i] == 'N') {
     N();
   } else if(str[i] == 'S') {
     S();
   } else if(str[i] == 'W') {
     W();
   } else if(str[i] == 'E') {
     E();
   }
 }
 
 printf("%d\n",a[1]);
 
 return 0;
}


Measured memory_bytes: 2148
from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
ans = 0

ctr = Counter()

for s in S : 
    a = ''.join(sorted(list(s)))
    if ctr[a] != 0 : 
        ans += ctr[a]
    ctr[a] += 1
print(ans)

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

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

ll lcm(ll a, ll b)
{
	return a/gcd(a,b)*b;
}

int main()
{
	ll a,b;
	cin>>a>>b;
	cout<<lcm(a,b);
	return 0;
}

Measured memory_bytes: 256
s = input("")
s = (int(s)) % 10
if s == 2 or s == 4 or s == 5 or s == 7 or s == 9 :
    print("hon")
elif s == 0 or s ==1 or s == 6 or s == 8 :
    print("pon")
elif s == 3 :
    print("bon")


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

typedef long long ll;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < vl > vvl;
typedef vector < vi > vvi;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < pll > vpll;
typedef vector < pii > vpii;
typedef vector < vpll > vvpll;
typedef vector < vpii > vvpii;

#define pb push_back
#define pf push_front
#define all(c) (c).begin(), (c).end()
#define ff first
#define ss second
#define mp(x,y) make_pair((x), (y))
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)

const ll INF = 1e18;

ll solve(){
    
    int n; cin >> n;
    ll p = 1;
    int flg = 0;
    for(int i = 0; i < n; i++){
        ll x; cin >> x;
        if(x == 0)
            return 0;
        if(p > INF / x)
            flg = 1;
        else
          	p *= x;
    }
  	if(flg)
      	return -1;
    return p;
}


int main(){
	boost;
	int t = 1;
// 	cin >> t;
	
	while(t--){
		cout << solve() << '\n';
	}
	
	return 0;
}


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

#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define rev(v) reverse(v.begin(), v.end());
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
#define check cout<<"?\n";
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    ll n; cin >> n;
    ll mxd = 1;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i == 0){
            mxd = max(mxd, i);
        }
    }
    ll sed = n/mxd;
    cout << sed + mxd - 2 << '\n';
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i,k) for(i=0;i<k;i++)
#define P pair<ll,ll>
int s[2005];
int t[2005],u[200];

ll i, a, b, c,n,m, z=0;
int day[1005], pos[1005];
vector<int> ss;
vector<int> tt[100000];
int main() {
	cin >> n;
	a = 100005;
	rep(i, n - 1) {
		cin >> b;
		z += min(a, b);
		a = b;
	}
	z += b;
	cout << z;
}

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

namespace Atc_0035
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            string result = "";

            for (int i = 0; i < s.Length; i++)
            {
                if (s.Substring(i, 1) == "1")
                {
                    result += "9";
                }
                else
                {
                    result += "1";
                }
            }

            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 25676
import java.io.*;
import java.util.*;

class Dice{
    int top;
    int bottom;
    int S;
    int W;
    int E;
    int N;
    
    Dice(int a,int b, int c,int d,int e,int f){
        this.top = a;
        this.bottom = b;
        this.S = c;
        this.W = d;
        this.E = e;
        this.N = f;
    }

    

    public void RollS(){
        //W = W;
        //E = E; 
        int tmp = this.bottom;
        this.bottom = this.S;
        this.S = this.top;
        this.top = this.N;
        this.N = tmp;
    }

    public void RollW(){
        //this.S = S;
        //this.N = N;
        int tmp =this.top;
        this.top = this.E;
        this.E = this.bottom;
        this.bottom = this.W;
        this.W = tmp;
    }
   
    public void RollE(){
        int tmp = this.top;
        this.top = this.W;
        this.W = this.bottom;
        this.bottom = this.E;
        this.E = tmp;
   }

   public void RollN(){
        int tmp = this.top;
        this.top = this.S;
        this.S = this.bottom;
        this.bottom = this.N;
        this.N = tmp;
   }

    public int showF(int a,int b){
        if(a == this.top){
        //nothing
        }else if(a == this.bottom){
            RollS();
            RollS();
        }else if(a == this.S){
            RollN();
        }else if(a == this.E){
            RollW();
        }else if(a == this.W){
            RollE();
        }else if(a == this.N){
            RollS();
        }
        //ans
        if(b == this.S){
            return this.E;
        }else if(b == this.W){
            return this.S;
        }else if( b == this.N){
            return this.W;
        }else{
            return this.N;
        }
    }

}

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
                    
        str = br.readLine();
        String[] nums = str.split("\\s");
        int[] temp = new int[6];
        for(int i=0;i<6;i++){
            temp[i] = Integer.parseInt(nums[i]);
        }

        Dice D = new Dice(temp[0],temp[5],temp[1],temp[3],temp[2],temp[4]);
        str = br.readLine();
        int count = Integer.parseInt(str);
        for(int i = 0;i < count; i++){
            str = br.readLine();
            String[] te = str.split("\\s");
            int ans = D.showF(Integer.parseInt(te[0]),Integer.parseInt(te[1]));
            System.out.println(ans);
        }

        br.close();
    }
}


Measured memory_bytes: 24504
#include<stdio.h>
int main(void)
{
	int date[10],i,j,a,fir,sec,thi;
	for(i=0; i<=9; i++) {
		scanf("%d",&date[i]);
	}
	for(i=0; i<9; i++) {
		for(j=i+1; j<10; j++) {
			if(date[i] < date[j]) {
				a=date[i];
				date[i]=date[j];
				date[j]=a;
			}
		}
	}
	for(i=0; i<3; i++) {
		printf("%d\n",date[i]);
	}
	
	return 0;
}

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

using namespace std;
#define int int64_t
#define rep(i,a,n) for(int i=(a); i<(n); ++i)
#define reps(i,a,n) for(int i=(a); i>(n); --i)
#define all(x) (x).begin(),(x).end()
#define gsort(x, n) sort((x), (x + n) greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed(n) fixed << setprecision(n)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long mod = 1e9 + 7;

signed main()
{
	cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n,m,cnt=0;
    cin>>n>>m;
    vector<int> x(m);

    rep(i,0,m){
        cin>>x[i];
        cnt+=x[i];
    }

    if(cnt > n){
        cout<<-1<<'\n';
    }else{
        cout<<n-cnt<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3704
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)

left, right = -1, a[-1] * f[0]

while right - left > 1:
    mid = (left + right) // 2
    ck = 0
    for i in range(n): ck += max(0, a[i] - mid // f[i])
    if ck <= k: right = mid
    else: left = mid

print(right)


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

bool solve() {
  int N; cin >> N;
  vector<string> W(N);
  rep(i, 0, N) cin >> W[i];
  map<string, int> mp;
  rep(i, 0, N) {
    if(mp[W[i]]) return false;
    mp[W[i]]++;
  }
  rep(i, 0, N - 1) {
    if(W[i].back() != W[i+1].front()) return false;
  }
  return true;
}

int main() {
  cout << (solve() ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int gcd(int x,int y){
  int tmp,ans;
  if(y>x){
    tmp=x;
    x=y;
    y=tmp;
  }
  while(1){
    if(x%y==0){
      ans=y;
      break;
    }else{
      tmp=x;
      x=y;
      y=tmp%y;
    }
  }
  return ans;
}

int main(){
  int x,y,big,ans=1;
  std::cin>>x>>y;

  ans=gcd(x,y);
  std::cout<<ans<<"\n";

  return 0;
}


Measured memory_bytes: 3116
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

const int MAX_N = 55;

int n;
ld v[MAX_N];

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> v[i];
	sort(v, v + n);

	for (int i = 1; i < n; i++)
		v[i] = (v[i - 1] + v[i]) / 2.0L;
	cout << setprecision(10) << fixed << v[n - 1] << endl;
}

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

using namespace std;

class Dice {
    public:
        int value[6];
        Dice(){};
        Dice(int* num) {
            for (int i = 0; i < 6; i++) {
                Dice::value[i] = num[i];
            }
        }
        void rotate(char direction) {
            int tmp;
            switch(direction) {
                case 'N':
                    tmp = Dice::value[0];
                    Dice::value[0] = Dice::value[1];
                    Dice::value[1] = Dice::value[5];
                    Dice::value[5] = Dice::value[4];
                    Dice::value[4] = tmp;
                    break;

                case 'S':
                    for(int i = 0; i < 3; i++) Dice::rotate('N');
                    break;

                case 'W':
                    tmp = Dice::value[0];
                    Dice::value[0] = Dice::value[2];
                    Dice::value[2] = Dice::value[5];
                    Dice::value[5] = Dice::value[3];
                    Dice::value[3] = tmp;
                    break;

                case 'E':
                    for(int i = 0; i < 3; i++) Dice::rotate('W');
                    break;

                case 'R':
                    tmp = Dice::value[1];
                    Dice::value[1] = Dice::value[3];
                    Dice::value[3] = Dice::value[4];
                    Dice::value[4] = Dice::value[2];
                    Dice::value[2] = tmp;
                    break;

                default:
                ;
            }
        }
};

int main() {
    int q, a, b;
    int num[6] = {};
    char direction[2] = {'N', 'W'};
    for(int i = 0; i < 6; i++) cin >> num[i]; 
    Dice dice = Dice(num);
    cin >> q;
    for(int i = 0; i < q; i++) {
        cin >> a >> b;
        if(dice.value[3] == a) dice.rotate('E');
        if(dice.value[2] == a) dice.rotate('W');
        while(dice.value[0] != a) dice.rotate('N');
        while(dice.value[1] != b) dice.rotate('R');
        cout << dice.value[2] << endl;
    }
    return 0;
}


Measured memory_bytes: 3076
function Main(input){
  var inp = input.split('\n');
  var A = parseInt(inp[0].trim());
  var B = parseInt(inp[1].trim());
  var C = parseInt(inp[2].trim());
  var X = parseInt(inp[3].trim());

  var count = 0;
  for(var i = 0; i <= A; i++){
    for(var j = 0; j <= B; j++){
      for(var k = 0; k <= C; k++){
        if((500 * i) + (100 * j) + (50 * k) === X){
          count++;
        }
      }
    }
  }
  console.log(count);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 11468
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main{

	public static void main(String[] args) {

		List<Integer> array = new ArrayList<>();


		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B  = scan.nextInt();
		
		int x = A+B;
		int y= A-B;
		int z = A*B;
		System.out.println(Math.max(Math.max(x, y), z));

		
	}
}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define md 1000000007


int main() 
{ 
    ll n,k,x,h,l,r=0;
    cin>>n;
    map<string,ll> m;
    string s;
    for(ll i=0;i<n;i++)
    {
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    
    for(auto it=m.begin();it!=m.end();it++)
    {
        k=it->second;
        if(k>1)
        {
            x=(k*(k-1))/2;
            r+=x;
        }
    }
    
    cout<<r;
    
    return 0;
} 


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

using namespace std;

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

  int res = S.size();
  for (int k = 0; k < 2; k++) {
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
      if ((i % 2 == 0) ^ (S[i] == (char)(k + '0'))) cnt++;
    }
    res = min(res, cnt);
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,x, nums[109];
    cin>>n>>x;
    
    ll sum=0;
    rep(i,n) cin>>nums[i];
    rep(i,n) sum+=nums[i];
    
    if(x>=sum){
        if(x>sum) n--;
        cout1(n);
    }else{
        sort(nums,nums+n);
        int cnt=0;
        rep(i,n){
            if(nums[i]>x){
                break;
            }else{
                cnt++;
                x-=nums[i];
            }
        }
        cout1(cnt);
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void)
{
	double x1,x2,y1,y2,kyori;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	kyori=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
	kyori=sqrt(kyori);
	printf("%f\n",kyori);
	return 0;
}

Measured memory_bytes: 652
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
int main(){
    int h,w;
    cin >> h >> w;
    string s;
    rep(i, h){
        cin >> s;
        cout << s << endl;
        cout << s << endl;
    }
}

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

ll N, K;
ll R, S, P;
string seq;

ll solve(string s){
  vector<vector<ll>> dp(s.size()+1, vector<ll>(3));
  for(ll i=0;i<s.size();i++){
    // i -> i + 1
    dp[i+1][0] = max(dp[i+1][0], max(dp[i][1], dp[i][2]) + ((s[i]=='s') ? R : 0LL) );
    dp[i+1][1] = max(dp[i+1][1], max(dp[i][0], dp[i][2]) + ((s[i]=='p') ? S : 0LL) );
    dp[i+1][2] = max(dp[i+1][2], max(dp[i][0], dp[i][1]) + ((s[i]=='r') ? P : 0LL) );
  }
  return *max_element(dp[s.size()].begin(), dp[s.size()].end()); 
}


int main(){
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> seq;
  vector<string> subseq(K);
  for(int i=0;i<N;i++) subseq[i%K] += seq[i];
  ll ans = 0;
  for(int i=0;i<K;i++) ans += solve(subseq[i]);
  cout << ans << endl;  
  return 0;
}




Measured memory_bytes: 6016
#include <iostream>
#include <queue>
#include <cmath>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

struct state {
  int p, c, n;
  float d;
  bool operator<(const state &s) const { return d > s.d; }
};

int N, X[20], Y[20];
float R, Theta;
float d[20][20];
bool angle[20][20][20];
float dp[20][20][10000];

float theta(int i, int j, int k) {
  int x1 = X[k] - X[j], y1 = Y[k] - Y[j];
  int x2 = X[j] - X[i], y2 = Y[j] - Y[i];
  float l1 = sqrt(x1 * x1 + y1 * y1);
  float l2 = sqrt(x2 * x2 + y2 * y2);
  float iprod = x1 * x2 + y1 * y2;
  float rad = acos(iprod / l1 / l2);
  return rad * 180 / M_PI;
}

int main(void) {
  cin >> N >> R >> Theta;
  REP(i, 0, N) cin >> X[i] >> Y[i];

  REP(i, 0, N) REP(j, 0, N) {
    d[i][j] = sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]));
  }
  REP(i, 0, N) REP(j, 0, N) REP(k, 0, N) {
    if(i == j || j == k || k == i) angle[i][j][k] = false;
    else angle[i][j][k] = theta(i, j, k) <= Theta + 10e-8;
  }

  REP(i, 0, N) REP(j, 0, N) REP(k, 0, 10000) dp[i][j][k] = 1e10;

  priority_queue<state> q;
  REP(i, 1, N) if(d[0][i] <= R + 1e-8) q.push((state) { 0, i, 1, d[0][i] });

  int ans = 0;
  while(q.size()) {
    state c = q.top();
    q.pop();

    if(dp[c.p][c.c][c.n] <= c.d) continue;
    dp[c.p][c.c][c.n] = c.d;

    ans = max(ans, c.n);

    REP(i, 0, N) if(angle[c.p][c.c][i]) {
      float nd = c.d + d[c.c][i];
      if(dp[c.c][i][c.n + 1] <= nd) continue;
      if(nd <= R + 1e-8) q.push((state) { c.c, i, c.n + 1, nd });
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 19216
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#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()
{
    long long int n,m,l;
    scanf("%lld%lld%lld",&n,&m,&l);
    long long int A[n][m]={0},B[m][l]={0},C[n][l]={0};
    REP(i,n)REP(j,l) C[i][j]=0;
    REP(i,n)REP(j,m) scanf("%lld",&A[i][j]);
    REP(i,m)REP(j,l) scanf("%lld",&B[i][j]);
    REP(i,n)REP(j,l)REP(k,m) C[i][j]+=A[i][k]*B[k][j];
    REP(i,n){
        REP(j,l){
            if(j==0)printf("%lld",C[i][j]);
            else printf(" %lld",C[i][j]);
        }
        printf("\n");
    }
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool flag = false;
    while (a > 0 && c > 0) {
        if (flag)
            a -= d;
        else
            c -= b;
        flag = !flag;
    }
    if (c <= 0) cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3584
/*input
13 17
BBABBBAABABBA
7 1
7 9
11 12
3 9
11 9
2 1
11 5
12 11
10 8
1 11
1 8
7 7
9 10
8 8
8 12
6 2
13 11

13 23
ABAAAABBBBAAB
7 1
10 6
1 11
2 10
2 8
2 11
11 12
8 3
7 12
11 2
13 13
11 9
4 1
9 7
9 6
8 13
8 6
4 10
8 7
4 3
2 1
8 12
6 9

4 3
ABAB
1 2
2 3
3 1

2 3
AB
1 1
1 2
2 2
*/
#define db(x) cout<<#x<<"="<<(x)<<" "
#define el cout<<endl
#include <bits/stdc++.h>
using namespace std;
const int MXN = 200010;

int N, M;
char s[MXN];
vector<int> e[MXN];
int cnt[2][MXN], flag[MXN];
int main() {
	scanf("%d %d\n", &N, &M);
	scanf("%s", s + 1);
	for (int i = 1; i <= M; ++i)
	{
		int x, y, k;
		scanf("%d %d", &x, &y);
		e[x].push_back(y);
		e[y].push_back(x);
		cnt[s[x] - 'A'][y]++;
		cnt[s[y] - 'A'][x]++;
	}
	stack<int> S;
	//db(cnt[1][1]),el;
	for (int i = 1; i <= N; ++i)
	{
		if (!cnt[0][i]) {
			S.push(i);
			flag[i] = 1;
		} else
		if (!cnt[1][i]) {
			S.push(i);
			flag[i] = 1;
		}
	}
	while (!S.empty())
	{
		int u = S.top();
		S.pop();
		for (int v : e[u]) {
			cnt[s[u] - 'A'][v]--;
			if (!cnt[s[u] - 'A'][v] && !flag[v]) {
				S.push(v);
				flag[v] = 1;
			}
		}
	}
	for (int i = 1; i <= N; ++i)
	{
		if (cnt[0][i] && cnt[1][i]) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


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

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;

map<llong, llong> soinsuBunkai(llong n){
	map<llong, llong> ret;
	while(n % 2 == 0){
		ret[2]++;
		n /= 2;
	}
	for(llong i = 3; i*i <= n; i += 2){
		while(n%i == 0){
			ret[i]++;
			n /= i;
		}
	}
	ret[n]++;

	return ret;
}


int main(){
	llong N, p;
	cin >> N >> p;
	auto soinsu = soinsuBunkai(p);
	llong ans = 1;
	for(auto it = soinsu.begin(); it != soinsu.end(); it++){
		cerr << it->first << " " << it->second << endl;
		for(int i = 0; i < it->second/N; i++)
			ans *= it->first;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{

    int h, w;
    cin >> h >> w;
    string wall = "";
    rep(i, w) wall += "#";
    vector<string> g(h + 2, "");
    g[0] = wall;
    g[h + 1] = wall;
    vector<vector<int>> lastw(h + 2);
    vector<vector<int>> lasth(w + 2);
    rep(i, h) cin >> g[i + 1];
    rep(j, w) lasth[j].push_back(h);

    rep(i, h + 2)
    {
        g[i] = "#" + g[i] + "#";
    }
    rep(i, h + 2)
    {
        rep(j, w + 2)
        {
            if (g[i][j] == '#')
            {
                lasth[j].push_back(i);
                lastw[i].push_back(j);
            }
        }
    }
    rep(i, h + 2)
    {
        cerr << g[i] << endl;
    }
    int ans = -1;
    rep(i, 1, h + 1)
    {
        rep(j, 1, w + 1)
        {
            if (g[i][j] == '#')
                continue;
            int hsize = (*lower_bound(ALL(lasth[j]), i)) - (*(lower_bound(ALL(lasth[j]), i) - 1));
            int wsize = (*lower_bound(ALL(lastw[i]), j)) - (*(lower_bound(ALL(lastw[i]), j) - 1));
            //cerr << i << " " << j << " " << hsize << " " << wsize << endl;
            ans = max(ans, hsize + wsize - 3);
        }
    }
    cout << ans << endl;
    return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

const int maxN = 101;
int N;
int ans = LONG_MIN;
int F[maxN][10];
int P[maxN][11];

void check(int isWork[]) {
  int cnt0 = 0;
  REP(i, 10) {
    if (isWork[i] == 0)
      cnt0++;
  }
  if (cnt0 == 10)
    return;
  int tmp = 0;
  REP(i, N) {
    int cnt = 0;
    REP(j, 10) {
      if (F[i][j] == isWork[j] && isWork[j] == 1)
        cnt++;
    }
    tmp += P[i][cnt];
  }
  chmax(ans, tmp);
}

void dfs(int isWork[], int n) {
  if (n == 10) {
    check(isWork);
    return;
  }
  isWork[n] = 0;
  dfs(isWork, n + 1);
  isWork[n] = 1;
  dfs(isWork, n + 1);
}

signed main() {
  int isWork[10];
  std::cin >> N;
  REP(i, N) REP(j, 10) { F[i][j] = read(); }
  REP(i, N) REP(j, 11) { P[i][j] = read(); }
  dfs(isWork, 0);
  print(ans);
}


Measured memory_bytes: 256
//abc168_c.cpp
//Sun May 17 20:36:55 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

int main(){
	static const double pi = 3.141592653589793;
	double a,b,h,m;
	cin >> a >> b >> h >> m;

	if (b>a){
		double tmp = b;
		b = a;
		a = tmp;
	}

	double l = m*pi/30;
	double s = h*pi/6+m*pi/360;

	double ceta = abs(l-s);
	ceta = min(abs(2*pi-ceta),ceta);

	double ans = 0;
	if (ceta<=pi/2){
		double tmp = a*cos(ceta)-b;
		ans = pow(a*sin(ceta),2)+pow(tmp,2);
		ans = pow(ans,0.5);
	}else {
		double tmp = a+b*cos(pi-ceta);
		ans = pow(tmp,2)+pow(b*sin(pi-ceta),2);
		ans = pow(ans,0.5);
	}

	printf("%.10f\n",ans);
}

Measured memory_bytes: 4292
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef struct D
{
    int h,w;
    bool f;
} D;
typedef pair<int,D>PP;
vector<vector<int>>C;


D ind(int _h,int _w,bool _f)
{
    D d;
    d.h=_h;
    d.w=_w;
    d.f=_f;
    return d;
}

int main()
{
    auto cmp=[](PP a,PP b) { return a.first<b.first; };
    priority_queue<PP,vector<PP>,decltype(cmp)>Q(cmp);
    int H,W;
    cin>>H>>W;
    vector<string>M;
    for(int i=0;i<H;i++)
    {
        vector<int>r(W,1000000);
        C.push_back(r);
    }
    for(int i=0;i<H;i++)
    {
        string t;
        cin>>t;
        M.push_back(t);
    }
    Q.push(make_pair(M[0][0]=='#'?1:0,ind(0,0,M[0][0]=='#'?true:false)));
    int res=1000000;
    while(!Q.empty())
    {
        PP n=Q.top();Q.pop();
        D p=n.second;
        if(p.h==H-1&&p.w==W-1)
        {
            res=min(res,n.first);
        }
        if(p.h<H-1)
        {
            int nc;
            bool nf;
            if(M[p.h+1][p.w]=='#')
            {
                nc=p.f?n.first:n.first+1;
                nf=true;
            }
            else
            {
                nc=n.first;
                nf=false;
            }
            D np=ind(p.h+1,p.w,nf);
            if(C[np.h][np.w]>nc)
            {
                C[np.h][np.w]=nc;
                Q.push(make_pair(nc,np));
            }
        }
        if(p.w<W-1)
        {
            int nc;
            bool nf;
            if(M[p.h][p.w+1]=='#')
            {
                nc=p.f?n.first:n.first+1;
                nf=true;
            }
            else
            {
                nc=n.first;
                nf=false;
            }
            D np=ind(p.h,p.w+1,nf);
            if(C[np.h][np.w]>nc)
            {
                C[np.h][np.w]=nc;
                Q.push(make_pair(nc,np));
            }
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long ll;
int n,d,A;
struct node
{
    int x,h;
    bool operator<(const node&o)const
    {
        return x<o.x;
    }
}a[N];
queue<pair<int,int> >q;
int main()
{
    scanf("%d%d%d",&n,&d,&A);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&a[i].x,&a[i].h);
        a[i].h=a[i].h/A+(a[i].h%A?1:0);
    }
    sort(a+1,a+1+n);
    ll ans=0,res=0;
    d*=2;
    for(int i=1;i<=n;i++)
    {
        while(!q.empty()&&q.front().first<a[i].x-d)
        {
            res-=q.front().second;q.pop();
        }
        if(a[i].h>res)
        {
            q.push({a[i].x,a[i].h-res});
            ans+=a[i].h-res;
            res+=a[i].h-res;
        }
    }
    printf("%lld\n",ans);
}


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


int main() {

    int a, b;
    cin >> a >> b;
    for (int c = 1; c < 4; ++c) {
        if (a*b*c % 2 != 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256