akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<stdbool.h>
using namespace std;

int main(){
    int s;
    int a[1000000];
    bool z[1000000];
    for(int i = 0;i < 1000000 ; i++){
        z[i] = false;
    }
    int buf;
    cin >> s;
    a[0] = s;
    z[s] = true;
    for(int i = 1;i < 1000000 ; i++){
        if(a[i-1]%2==0){
            a[i] = a[i-1] /2;
        }else{
            a[i] = 3*a[i-1] + 1;
        }
        buf = a[i];
		if (z[buf] == true) {
			cout << i+1 << endl;
			return 0;
		}
		else {
			z[buf] = true;
		}
       //cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll a, b, ab, an, bn;
	cin >> a >> b >> ab >> an >> bn;

	ll res{0};
	if (a + b < ab*2)
		res = an*a + bn*b;
	else
	{
		ll abn = min(an, bn);
		//std::cout << "abn : " << abn*2 << std::endl;
		res += abn*ab*2;

		an -= abn, bn -= abn;
		if (an != 0)
		{
			//	std::cout << "an : " << an << std::endl;
			res += min(a*an, ab*2*an);
		}
		else
		{
			res += min(b*bn, ab*2*bn);
		}
		}
	std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<set>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>

using namespace std;

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

const int MX = 100005;

vector<pii> D;

int main()
{
	int N, a;
	scanf("%d", &N);
		for(int j = 1; j <= 3; j++){
	for(int i = 1; i <= N; i++){
			scanf("%d", &a);
			D.emplace_back(a, j);
		}
	}
	sort(D.begin(), D.end());
	ll ans[4] = {};
	ans[0] = 1;
	for(int i = 0, j = 0; i < D.size(); i = j){
		ll tmp[4] = {};
		for(int k = 0; k <= 3; k++) tmp[k] = ans[k];
		for(; j < D.size() && D[i].first == D[j].first; j++){
			int d = D[j].second;
			tmp[d] += ans[d-1];
		}
		for(int k = 0; k <= 3; k++) ans[k] = tmp[k];
	}
	printf("%lld\n", ans[3]);
}


Measured memory_bytes: 6512
i = 1
while True:
    x, y = map(int, input().split())
    if x >= 0 and x <= 10000:
        if y >= 0 and y <= 10000:
            if x == 0 and y == 0:
                break
            if i > 3000:
                break
            if x > y:
                z = x
                x = y 
                y = z
            print('{0} {1}' .format(x, y))
    i += 1


Measured memory_bytes: 5612
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        int n = Integer.parseInt(sc.next());
        
        int max = Integer.parseInt(sc.next());
        long ans = 0;
        for(int i = 0; i < n-1; i++){
            int a = Integer.parseInt(sc.next());
            ans += Math.max(max - a, 0);
            max = Math.max(a, max);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 57732
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    string s;
    int r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<unordered_map>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
ll ans = 0;

int main() {
	string S;
	cin >> N;
	int cN = N;
	int sum = 0;
	while (N != 0) {
		sum += N % 10;
		N /= 10;
	}
	if (!(cN%sum))cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 03/29/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll pow(ll x, ll p, ll MOD) {
  ll t = 1;
  ll u = x;
  while (p) {
    if (p & 1)
      (t *= u)%=MOD;
    (u *= u)%=MOD;
    p >>= 1;
  }
  return t;
}

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

  int N,P; cin>>N>>P;
  string S;cin>>S;
  if (P == 2 or P == 5) {
    ll ans = 0;
    for (int i = 0; i < N; i++) {
      int k = S[i]-'0';
      if (k%P==0)
        ans += (i+1);
    }
    cout << ans << endl;
  } else {
    vector<ll> mods(P);
    mods[0] = 1;
    ll pw = 1;
    ll t = 0;
    ll ans = 0;
    for (int i = N-1; i >= 0; i--) {
      int k = S[i]-'0';
      (t += pw*k)%=P;
      ans += mods[t];
      mods[t]++;
      (pw *= 10)%=P;
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 720
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<u32>()[0];
    let mut m = n;
    let mut s = 0;

    while m > 0{
        s += m%10;
        m/=10;
    }

    if n%s == 0{
        println!("Yes");
    }else{
        println!("No");
    }

}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
bool has3(int x){
    while(x){
        if(x%10==3){
            return true;
        }
        x /= 10;
    }
    return false;
}

void call(int n){
    for(int i=1; i<=n; i++){
        if(i % 3 ==0 || has3(i)){
            cout << " " << i;
        }
    }
    cout << endl;
}

int main(){
    int num;
    cin >> num;
    
    call(num);
    
    return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
int dist(int a, int b, int c, int d) {
	return abs(a-c)+abs(b-d);
}
int main () {
	long long n;
	cin >> n;
	int t[100000];
	int x[100000];
	int y[100000];
	t[0] = 0;
	x[0] = 0;
	y[0] = 0;
	for (int i=1; i<=n; i++) {
		cin >> t[i] >> x[i] >> y[i];
		int a, b, c;
		a = t[i] - t[i-1];
		b = dist(x[i], y[i], x[i-1], y[i-1]);
		if (a%b!=0) {cout << "No"; return 0;}
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 4804
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	string s;
    cin>>s;
    if(s=="ABC"){
        cout<<"ARC";
    }else{
        cout<<"ABC";
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
#define ll long long
#define OK puts("ok");
 
using namespace std;
 
const int N = (int)1e5 + 7;
 
struct edge {
  int u, v, w;
  edge() {}
  edge(int _u, int _v, int _w) {
    u = _u;
    v = _v;
    w = _w;
  }
};
 
int roll[N];
pair <int, int> asd[N];
int cnt = 0;
 
struct DSU {
  int par[N], siz[N];
  ll sum[N];
  DSU() {
    iota(par, par + N, 0);
    fill(siz, siz + N, 1);
  }
  int getpar(int a) {
    if (par[a] == a) return a;
    return getpar(par[a]);
  }
  void connect(int a, int b) {
    a = getpar(a);
    b = getpar(b);
    if (a != b) {
      if (siz[a] > siz[b]) swap(a, b);
      asd[cnt] = {a, b};
      roll[cnt++] = par[a];
      par[a] = b;
      sum[b] += sum[a];
      siz[b] += siz[a];
    }
  }
  void rollback() {
    int a = asd[cnt].first;
    int b = asd[cnt].second;
    siz[b] -= siz[a];
    sum[b] -= sum[a];
    par[a] = roll[cnt];
  }
};
DSU dsu;
 
int n, m;
vector <edge> vec;
 
main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &dsu.sum[i]);
  }
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    vec.push_back({u, v, w});
  }
  sort(vec.begin(), vec.end(), [&](const edge &A, const edge &B) {
    return A.w < B.w;
  });
  vector <int> ind;
  {
    int i = 0;
    for (auto to : vec) {
      int a, b;
      a = to.u;
      b = to.v;
      if (dsu.getpar(a) != dsu.getpar(b)) {
        ind.push_back(i);
        dsu.connect(a, b);
      }
      i++;
    }
  }
  reverse(ind.begin(), ind.end());
  for (int i = 0; i < ind.size(); i++) {
    cnt--;
    if (vec[ind[i]].w > dsu.sum[dsu.getpar(vec[ind[i]].u)]) {
      dsu.rollback();
    }
  }
  int ans = 0;
  for (auto to : vec) {
    if (dsu.getpar(to.v) != dsu.getpar(to.u) || to.w > dsu.sum[dsu.getpar(to.u)]) {
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 5108
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
k=int(input())
a=list(map(int,input().split()))
min_num=2
max_num=3
for i in range(1,k):
    min_num=((min_num-1)//a[-i-1]+1)*a[-i-1]
    max_num=(max_num//a[-i-1]+1)*a[-i-1]-1

tmp=min_num
for i in range(k):
    tmp-=tmp%a[i]
if tmp!=2:
    print(-1)
    quit()

print(min_num)
print(max_num)

Measured memory_bytes: 63984
import math
n,d = map(int,input().split())
lis = []
for i in range(n):
  lis.append(list(map(int,input().split())))
r = 1
res = 0
#print(lis)
for i in range(n):
  for j in range(r,n):
    tmp = 0
    for k in range(d):
      tmp += abs(lis[i][k]-lis[j][k])**2
    rtmp = math.sqrt(tmp)
    #print(rtmp)
    if rtmp.is_integer():
      res += 1
  r+=1
print(res)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>

using namespace std;

long long t, a, b, c, d, x, pos;

int main () {
	cin >> t;
	for (int i=0; i<t; i++) {
		cin >> a >> b >> c >> d;
		if (a%b > c || d < b) {
			cout << "No" << endl;
			continue;
		}
		x = d-b;
		if (a <= c && a - b < 0) {
			cout << "No" << endl;
			continue;
		}
		if (x == 0) {
			cout << "Yes" << endl;
			continue;
		}
		c++;
		if (a >= c) {
			pos = a-(a-c)/b*b;
		} else {
			pos = a+x*(c-a + x-1)/x;
		}
		if (b <= c) {
			cout << "Yes" << endl;
		} else {
			long long g = __gcd(x, b);
			if ((pos - c) % g < b-c) {
				cout << "No" << endl;
			} else {
				cout << "Yes" << endl;
			}
		}
	}
	return 0;
}

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

int main() {
    ll N;
    cin >> N;
    vector<pair<ll, ll>> A(N);
    for (int i = 0; i < N; i++) cin >> A[i].first, A[i].second = i;
    sort(A.begin(), A.end(), greater<pair<ll, ll>>());
    vector<vector<ll>> dp(N, vector<ll>(N + 1, 0));
    dp[0][1] = A[0].first * A[0].second;
    dp[0][0] = A[0].first * (N - 1 - A[0].second);
    for (int i = 1; i < N; i++)
        for (int x = 0; x <= i + 1; x++) {
            ll j = A[i].second;
            ll a = A[i].first;
            auto dl = [&](ll x0) { return abs(j - x0); };
            auto dr = [&](ll y0) { return abs(N - 1 - j - y0); };
            if (x == 0)  // 全部右
                dp[i][0] = dp[i - 1][0] + dr(i) * a;
            else if (x == i + 1)  // 全部左
                dp[i][x] = dp[i - 1][x - 1] + dl(i) * a;
            else
                dp[i][x] = max(dp[i - 1][x - 1] + dl(x - 1) * a, dp[i - 1][x] + dr(i - x) * a);
        }
    ll ans = 0;
    for (int x = 0; x <= N; x++) ans = max(ans, dp[N - 1][x]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34676
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;


int main(){
	while(1){
		string str;
		getline(cin,str);
		if(str==".") break;

		int i=0;
		int sum = 0;
		vector<int> inkakko;
		while(1){
			if(str[i]=='('){
				inkakko.push_back(1);
				sum++;
			}else if(str[i]==')'){
				if(inkakko.size()){
					if(inkakko[inkakko.size()-1]==1){
						inkakko.pop_back();
						sum--;
					}else{
						cout << "no" << endl;
						break;
					}
				}else{
					cout << "no" << endl;
					break;
				}
			}else if(str[i]=='['){
				inkakko.push_back(2);
				sum++;
			}else if(str[i]==']'){
				if(inkakko.size()){
					if(inkakko[inkakko.size()-1]==2){
						inkakko.pop_back();
						sum--;
					}else{
						cout << "no" << endl;
						break;
					}
				}else{
					cout << "no" << endl;
					break;
				}
			}else if(str[i]=='.'){
				if(inkakko.size()){
					cout << "no" << endl;
				}else{
					cout << "yes" << endl;
				}
				break;
			}
			i++;
		}
	}
}

Measured memory_bytes: 1200
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x=sc.nextInt();
	int y=sc.nextInt();
	if(x>y){
	    System.out.println("a > b");
	}else if(x<y){
	    System.out.println("a < b");
	}else System.out.println("a == b");
    }
}



Measured memory_bytes: 26148
use std::io;
use std::cmp;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    return buf
}

fn main() {
    let line = gets();
    let mut it = line.trim().split_whitespace().map(|n| n.parse::<usize>().unwrap());
    let (n, k) = (it.next().unwrap(), it.next().unwrap());
    let mut px = vec![0; n];
    let mut py = vec![0; n];
    let mut pxx = vec![0; n];
    let mut pyy = vec![0; n];
    for i in 0..n {
        let line = gets();
        let mut it = line.trim().split_whitespace().map(|n| n.parse::<i64>().unwrap());
        let (x, y) = (it.next().unwrap(), it.next().unwrap());
        px[i] = x;
        py[i] = y;
        pxx[i] = x;
        pyy[i] = y;
    }
    pxx.sort();
    pyy.sort();

    let mut ans = (pxx[n-1] - pxx[0]) * (pyy[n-1] - pyy[0]);
    for xi in 0..n {
        for xj in (xi + 1)..n {
            for yi in 0..n {
                for yj in (yi + 1)..n {
                    let lx = pxx[xi];
                    let rx = pxx[xj];
                    let by = pyy[yi];
                    let uy = pyy[yj];
                    let mut num = 0;
                    for i in 0..n {
                        if lx <= px[i] && rx >= px[i] && by <= py[i] && uy >= py[i] {
                            num += 1;
                        }
                    }
                    if num >= k {
                        let area = (rx - lx) * (uy - by);
                        ans = cmp::min(ans, area);
                    }
                } 
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4476
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int C = sc.nextInt();
        int[] B = new int[M];
        for (int i = 0; i < M; i++) {
            B[i] = sc.nextInt();
        }
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sum = 0;
            for (int j = 0; j < M; j++) {
                int a = sc.nextInt();
                sum += a * B[j];
            }
            if(sum +C > 0) ans++;
        }

        System.out.println(ans);
        sc.close();
    }

}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  if(n %2 == 0)
    cout << n << endl;
  else
    cout << n*2 << endl;
  
  
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
    //~ freopen("file.in", "r", stdin);
    int n,k;
    scanf("%d%d",&n,&k);
    vector<int>a,b;
    for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if(x<0)
			a.pb(x);
		else if(x>0)
			b.pb(x);
		else
			k--;
	}
	if(!k){
		puts("0");
		return 0;
	}
	int res=INF;
	if((int)b.size()>=k)
		res=b[k-1];
	for(int i=(int)a.size()-1;i>=0;i--){
		if((int)a.size()-i>k)
			break;
		if(k==((int)a.size()-i))	
			umin(res,abs(a[i]));
		else if(k-(a.size()-i)<=b.size())
			umin(res,min(2*abs(a[i])+b[k-(a.size()-i)-1],abs(a[i])+2*b[k-(a.size()-i)-1]));
	}
	printf("%d\n",res);		
	return 0;
}


Measured memory_bytes: 1020
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin >> a>>b>>c>>d;
	


	if( abs(a-c) <=d
		|| (
			abs(a-b) <=d  
			&& abs(b-c) <=d
		)
	 ) cout << "Yes\n" ;
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){

    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    
    if(a>b){
        
        d=a;
        a=b;
        b=d;
        
    }
    
    if(b>c){
        
        d=b;
        b=c;
        c=d;
        
    }
    
    if(a>b){
        
        d=a;
        a=b;
        b=d;
        
    }
    
    printf("%d %d %d\n",a,b,c);
    
    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int num = b - a - 2;
		int snow = (num + 1) * (num + 2) / 2 - a;
		System.out.println(snow);
	}

}


Measured memory_bytes: 20948
import java.util.Scanner;

public class Main {

  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);

    int H = sc.nextInt();
    int A = sc.nextInt();

    int cnt = 0;
    while ( H > 0 ){
      cnt++;
      H -= A;
    }

    System.out.println(cnt);

  }
}


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

vector<pair<ll, int>> prime_factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i*i <= n; i++){
        if(n % i)continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

int main()
{
    ll n, p; cin >> n >> p;
    auto v = prime_factorize(p);
    ll ans = 1;
    for(auto x : v){
        if(x.second >= n){
            if(x.second >= n){
                int t = x.second/n;
                for(int i = 0; i < t; i++){
                    ans *= x.first;
                }
            }
        }
    }
    cout << ans << endl;

    system("pause");
}


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

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define TRAV(a, x) for(const auto& a : x)
#define ALL(x) x.begin(), x.end()
#define NEXT_PERM(x) while(next_permutation(ALL(x))) // 순열 알고리즘(오름)
#define PREV_PERM(x) while(prev_permutation(ALL(x))) // 순열 알고리즘(내림)
#define PRINT(x) cout << x
#define PRINT_LN(x) cout << x << endl;
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

typedef long long int ll;
typedef string s;
typedef int i;
typedef char c;
typedef vector<int> vi;
typedef vector
 vs;

int gcd(int a, int b);
int lcm(int a, int b);


void solve() {
  int n,k;
  cin >> n >> k;
  bool flag = true;
  int i = 0;
  while(flag){
    if(n < pow(k, i)){
        flag = false;
    } else {
        i++;
    }
  }
  cout << i << endl;
}


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

int gcd(int a, int b){
	while(b!=0){
		int r = a%b;
		a= b;
		b= r;
	}
	return a;
}

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


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

#define MAX 1000002
typedef unsigned char byte;
byte mask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};

int Lv[MAX];
int n, k;

bool cmp_Lv(const int i, const int j){ return Lv[i] < Lv[j]; }

bool cmp(const int i, const int j){
    if(Lv[i] != Lv[j]){ return Lv[i] < Lv[j]; }
    int L_i = (i + k >= n ? -1 : Lv[i + k]);
    int L_j = (j + k >= n ? -1 : Lv[j + k]);

    return L_i < L_j;
}

int main()
{
    int A[MAX];
    char c[MAX];
    scanf("%s", c);
    std::string T = std::string(c);
    n = T.size();
    byte *t;
    t = new byte [(n >> 3) + 1];
	bool act;
	int l, r;

    int i;
    for(i = 0; i < n; i++){ A[i] = i; }
    for(i = 0; i < n; i++){ Lv[i] = T[i]; }
    std::sort(A, A + n, cmp_Lv);

    for(i = 1; i < n; i++){
        t[i >> 3] = (Lv[A[i]] != Lv[A[i - 1]] ? t[i >> 3] | mask[i & 7] : t[i >> 3] & ~mask[i & 7]);
    }
    t[n >> 3] = t[n >> 3] | mask[n & 7];

    Lv[A[0]] = 0;
    for(i = 1; i < n; i++){
        Lv[A[i]] = Lv[A[i - 1]] + !!(mask[i & 7] & t[i >> 3]);
    }

    k = 1;
    while(1){
        if(k > n) break;

        act = true;
        for(i = 1; i <= n; i++){
            if(act){
                if(!!(mask[i & 7] & t[i >> 3])){ continue; }
                else{ l = i - 1; act = false; }
            }else{
                if(!!(mask[i & 7] & t[i >> 3])){
                    r = i; std::sort(A + l, A + r, cmp); act = true; }
                    else{ continue; }
            }
        }

        for(i = 1; i < n; i++){
            t[i >> 3] = (cmp(A[i - 1], A[i]) ? t[i >> 3] | mask[i & 7] : t[i >> 3] & ~mask[i & 7]);
        }
        t[n >> 3] = t[n >> 3] | mask[n & 7];

        Lv[A[0]] = 0;
        for(i = 1; i < n; i++){
            Lv[A[i]] = Lv[A[i - 1]] + !!(mask[i & 7] & t[i >> 3]);
        }

        if(Lv[A[n - 1]] == n - 1) break;
        k <<= 1;
    };

    char p[1000];
    int q, left, right, mid, crit;
    bool exist;
    scanf("%d", &q);

    A[n] = n;

    while(q){
        scanf("%s", p);
        std::string P = std::string(p);
        left = 0, right = n, exist = false;
        while(left < right){

            if(n < P.size()){ exist = false; break; }

            mid = (left + right) / 2;
            crit = T.compare(A[mid], P.size(), P);

            if(crit > 0){ right = mid; }
            else if(crit < 0){ left = mid + 1; }
            else{ exist = true; break; }
        };
        if(T.compare(A[right], P.size(), P) == 0) exist = true;
        if(exist){ printf("1\n"); }else{ printf("0\n"); }
        q--;
    }
    return 0;
}

Measured memory_bytes: 11044
#include <cstdio>
#include <iostream>
using namespace std;
int N, a[110];
void Read(int &x) {
	scanf("%d", &x);
}
int xx[1000], yy[1000], num;
void Add(int x, int y) {
	a[y] += a[x];
	num++; xx[num] = x; yy[num] = y;
}
void Solve1() {
	for (int i = 2; i <= N; i++)
		if (a[i] < a[i - 1]) Add(i - 1, i);
}
void Solve2() {
	for (int i = N; i > 1; i--) {
		if (a[i] < a[i - 1]) Add(i, i - 1);
	}
}
int main() {
	int i, j;
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	Read(N);
	int Mxp = 1, Mnp = 1, Mx = -1000010, Mn = 1000010;
	for (i = 1; i <= N; i++) {
		Read(a[i]);
		if (a[i] > Mx) Mx = a[i], Mxp = i;
		if (a[i] < Mn) Mn = a[i], Mnp = i;
	}
	if (Mn >= 0) Solve1();
	else if (Mx <= 0) Solve2();
	else if (Mx + Mn > 0) {
		for (i = 1; i <= N; i++) Add(Mxp, i);
		Solve1();
	}
	else {
		for (i = 1; i <= N; i++) Add(Mnp, i);
		Solve2();
	}
	printf("%d\n", num);
	for (i = 1; i <= num; i++) printf("%d %d\n", xx[i], yy[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair
using namespace std;

int inf = 1e18;
const int N = 5e5+5;

int mod = 1e9+7;
//int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}


signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
        int n,m;
        cin>>n>>m;
        string s1 = "",s2 = "";
        char ch = n+'0',ch1 = m+'0';
        rep(i,0,m)
        s1+= ch;
        rep(i,0,n)
        s2+= ch1;
        cout<<min(s1,s2)<<el;

    }


        return 0;
    }


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


void main() {
    int n;
    scan(n);

    foreach (k ; 1 .. n + 1) {
        int s = k * (k + 1) / 2;

        if (n <= s) {
            int x = s - n;

            foreach (j ; 1 .. k + 1) {
                if (j == x) continue;
                writeln(j);
            }

            return;
        }
    }
}



struct Stack(T) {
private:
    int N, peek;
    T[] data;

public:
    this(int size) 
    {
        N = size;
        data = new T[](N);
    }

    bool empty() @property
    {
        return peek == 0;
    }

    bool full() @property
    {
        return peek == N;
    }

    void push(T x) @property
    {
        assert(!full);
        data[peek++] = x;
    }

    void pop() @property
    {
        assert(!empty);
        --peek;
    }

    T top() @property
    {
        return data[peek - 1];
    }

    void clear() @property
    {
        peek = 0;
    }

    int length() @property
    {
        return peek;
    }

}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    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
#include<bits/stdc++.h>
using namespace std;
void optimize_cpp_stdio() {
    std::ios::sync_with_stdio(false);
    std::cout.tie(NULL);
    std::cin.tie(NULL);
}
int main(){
	optimize_cpp_stdio();
	long long N, K;
	while(cin >> N >> K){
		int M = N / K;
		int cnt = 1;
		while(M){
			cnt++;
			M /= K;
		}
		cout << cnt << endl;
	}
	return 0;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
 
public class Main
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
 
        int[] readArray(int n, int size){
            int[] a = new int[size];
            for(int i = 0; i < n; i++) {
                a[i] = this.nextInt();
            }
 
            return a;
        }
 
        long[] readLongArray(int n, int size){
            long[] a = new long[size];
            for(int i = 0; i < n; i++) {
                a[i] = this.nextLong();
            }
            return a;
        }
    }
 
 
 
    public static void main(String[] args) {
        FastReader s=new FastReader();
        String input = s.next();
 
        int count = 0;
        int result = count;
        for(int i = 0; i < input.length(); i++) {
 
            if(input.charAt(i) == 'R') count++;
            else {
                count = 0;
            }
 
            result = Math.max(result,count);
        }
        System.out.println(result);
    }
}

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

int main(){
 long long ans,N,u;
  cin>>N;
  u=N;
  vector<int>b(N),c(N);
    for(int i=0;i<N;i++){
   cin>>b[i];
  }
  for(int i=0;i<N;i++){
    for(int j=N-1;j>=0;j--){
      
      if(b[j]==u){
        b[j]=0;
        c[i]=u;
        u=N-i-1;
        break;
      }
      else if(b[j]==0&&j!=0){
        continue;
      }
      else if(j!=0&&b[j]!=0){
        u--;
        continue;
      }
      else{
        cout<<-1<<endl;
        return 0;
      }
  }
  }
  reverse(c.begin(),c.end());
  for(int i=0;i<N;i++){
    if(c[i]==0){
      cout<<-1<<endl;
      return 0;
    }
  }
      for(int i=0;i<N;i++){
    cout<<c[i]<<endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

double dp[2][101];
double kake[101];

int main(){
    int n;
    kake[1]=1;
    for(int i=2;i<=100;i++){
        kake[i]=kake[i-1]/2;
    }
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        for(int i=0;i<2;i++){
            for(int j=0;j<=100;j++){
                dp[i][j]=0;
            }
        }
        double sum=0;
        dp[1][1]=1;
        sum+=1;
        for(int i=2;i<=n;i++){
            for(int j=1;j<=100;j++){
                dp[i%2][j]=kake[j]*dp[(i+1)%2][j-1];
            }
            dp[i%2][0]=0;
            for(int j=1;j<=100;j++){
                dp[i%2][0]+=(1-kake[j])*dp[(i+1)%2][j-1];
            }
            for(int j=1;j<=100;j++){
                sum+=dp[i%2][j];
            }
        }
        printf("%f\n",sum);
    }
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  string co;
  int C = 0;
  rep(i, N) {
    cin >> co;
    if(co == "Y") {
      C += 0;
    }
    else {
      C++;
    }
  }
  if(C == N) {
    cout << "Three" << endl;
  }
  else {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define vbi vector<bool> 
#define mod 1000000007
#define INF 1000000000
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define ms(x,v)    memset(x, v, sizeof x)
#define endl '\n'
#define cnl cout<<endl;
#define fr(i,b) for(ll i=0; i<b;i++)
#define frr(i,a,b) for(ll i=a;i<=b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define pi  3.141592653589793238
ll i,j;
int main(){
 
ll n ; cin>>n;
vl v(n);
for(i=0;i<n;i++) cin>>v[i];
  ll cnt=0;
ll max=0;
for(i=1;i<n;i++){
  if(v[i]<=v[i-1]) cnt++;
  else {
    if(cnt>max) max=cnt;
    cnt=0;
  }
}
if(cnt>max) max=cnt;
cout<<max<<endl;
  
return 0;
}
 

Measured memory_bytes: 1024
#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define mi(x,y) (x<y?x:y)
#define N 100010

int main() {
	int n, h[N] = { 0 }, dp[N] = { 0 };
	scanf("%d", &n);
	rep(i, n)scanf("%d", &h[i+1]);
	dp[0] = N;
	Rep(i,2,n+1)dp[i]=mi(dp[i-2]+abs(h[i]-h[i-2]),dp[i-1]+abs(h[i]-h[i-1]));
	printf("%d", dp[n]);
}

Measured memory_bytes: 896
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };

    let t: usize = sc.read();
    for _ in 0..t {
        let a: i64 = sc.read();
        let b: i64 = sc.read();
        let c: i64 = sc.read();
        let d: i64 = sc.read();
        let ans = if d < b || a < b {
            "No"
        } else if c >= b {
            "Yes"
        } else {
            // b - a - 1 >= bx + dy >= c - a + 1
            let g = gcd(b, d);
            let left = b - a - 1;
            let right = c - a + 1;
            if left >= 0 {
                if left / g * g >= right {
                    "No"
                } else {
                    "Yes"
                }
            } else if right <= 0 {
                if right.abs() / g * g * (-1) <= left {
                    "No"
                } else {
                    "Yes"
                }
            } else {
                "No"
            }
        };
        println!("{}", ans);
    }
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;

long long int n,m,sum=0,res=0;
long long int a[200005],b[200005]={};

//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
long long int rui(long long int a, long long int b, long long mod) {
	int memo[65] = {};
	long long int A[65] = {};
	long long int tmp = 1;
	for (int i = 0; i < 65; i++) {
		memo[i] = b % 2;
		b /= 2;
	}

	A[0] = a;
	A[0] %= mod;

	for (int i = 1; i < 65; i++) {
		A[i] = A[i - 1] * A[i - 1];
		A[i] %= mod;
	}
	for (int i = 0; i < 65; i++) {
		if (memo[i] == 1) {
			tmp *= A[i];
			tmp %= mod;
		}
	}
	tmp %= mod;
	return tmp;
}

int main() {
	cout << fixed << setprecision(10);
    cin>>n;
    res=1;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[a[i]]++;
        sum=max(sum,a[i]);
    }
    for(int i=0;i<=n-1;i++){
        if(b[i]==0&&b[i+1]!=0||b[0]!=1||a[1]!=0){
            cout<<0<<endl;
            return 0;
        }
    }
    for(int i=1;i<sum;i++){
        res*=rui(b[i],b[i+1],mod);
        res%=mod;
    }
    cout<<res;
} 


Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int n, m;
vector<vector<int> > cand;

void dfs(vector<int> vec, int num) {
  vec.push_back(num);
  if (vec.size() == n) {
    cand.push_back(vec);
    return;
  }
  for (int i = vec.back(); i <= m; ++i) {
    dfs(vec, i);
  }
}

int main() {
  int q;
  cin >> n >> m >> q;
  vector<int> a(q), b(q), c(q), d(q);
  for (int i = 0; i < q; ++i) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }
  for (int i = 1; i <= m; ++i) {
    vector<int> a;
    dfs(a, i);
  }
  int ans = 0;
  for (int i = 0; i < cand.size(); ++i) {
    vector<int> vec = cand[i];
    int res = 0;
    for (int j = 0; j < q; ++j) {
      if (vec[b[j]] - vec[a[j]] == c[j]) {
        res += d[j];
      }
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9800
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  ll ans;
  string s,t;
  bool yoko;
  cin>>N>>s>>t;
  int i=1;
  if(s[0]==t[0]){
    yoko=false;
    ans=3ll;
  }else{
    yoko=true;
    ans=6ll;
    i++;
  }
  for(i;i<N;i++){
    if(yoko){
      if(s[i]==t[i]){
        yoko=false;
      }else{
        ans*=3;
        ans%=MOD;
        i++;
      }
    }else{
      if(s[i]==t[i]){
        ans*=2;
        ans%=MOD;
      }else{
        ans*=2;
        ans%=MOD;
        yoko=true;
        i++;
      }
    }
  }
  cout<<ans<<endl;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,x,now;
deque<pair<int,int>> v,vv,vvv;
vector<int> ans;
bool ok[501];

signed main() {
    cin >> n;
    rep1(i,n) {
        cin >> x;
        v.pb(mp(x,i));
    }
    ok[1]=true;
    sort(all(v));
    for(auto i : v) if (i.se > 1) vv.pb(mp(i.se, i.se-1));
    for(auto i : v) {
        int b=i.fi-ans.size()-1;
        while(b && vv.size()) {
            rep(j,min(b,vv.front().se)) ans.pb(vv.front().fi);
            if (vv.front().se <= b) {
                ok[vv.front().fi] = true;
                b -= vv.front().se;
                vv.pop_front();
            } else {
                vv.front().se -= b;
                b = 0;
            }
        }
        while(b && vvv.size()) {
            rep(j,min(b,vvv.front().se)) ans.pb(vvv.front().fi);
            if (vvv.front().se <= b) {
                b -= vvv.front().se;
                vvv.pop_front();
            } else {
                vvv.front().se -= b;
                b = 0;
            }
        }
        if (b || !ok[i.se]) {
            cout << "No" << endl;
            return 0;
        }
        ans.pb(i.se);
        vvv.pb(mp(i.se, n-i.se));
    }
    for(auto i : vvv) rep(j,i.se) ans.pb(i.fi);
    cout << "Yes" << endl;
    for(auto i : ans) cout << i << " ";cout << endl;
}





Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>/*toupperとかが入っている*/
#include<vector>/*可変長配列vectorのインクルード*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int A,B,T;

int main(void) {
  cin >> A >> B >> T;
  
  int sum=0;
  
  for(int t=A; t<T+0.5; t=t+A){
    sum=sum+B;
  }

  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)

int main() {
	bool p[50001];
	p[0] = p[1] = 0;
	rep2(i,2,50001) {
		p[i] = 1;
	}
	rep(i,50001) {
		if(p[i]) {
			for(int j = 2; i * j <= 50000; j++) {
				p[i * j] = 0;
			}
		}
	}

	int n;
	while(cin >> n && n) {
		int cnt = 0;
		rep(i,n / 2 + 1) {
			if(p[i] && p[n - i]) cnt++;
		}
		cout << cnt << endl;	
	}
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(all(a));
    sort(all(b));
    int l, r;
    if (n % 2 == 1) {
        l = a[n / 2];
        r = b[n / 2];
    }
    else {
        l = a[n / 2] + a[n / 2 - 1];
        r = b[n / 2] + b[n / 2 - 1];
    }
    cout << r - l + 1 << '\n';
}


Measured memory_bytes: 4820
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    vector<ll> A(N);   
    REP(i,N)cin>>A[i];
    ll ans=0;
    REP(i,60){
        ll a=0;
        REP(j,N){
            if(A[j]>>i&1){
                a++;
            }
        }
        ll now=a*(N-a)%MOD;
        REP(j,i){
            now=now*2%MOD;
        }
        ans=(ans+now)%MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2560