akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max();
constexpr auto llinf = numeric_limits<ll>().max();

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << endl;
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << endl;
}

template<typename T>
void debug(initializer_list<T> list) {
  for (auto el : list) {
    cout << el << " ";
  }
  cout << endl;
}

void solve() {
  ll n;
  cin >> n;
  string ans{};
  while (n > 0LL) {
    --n;
    ans += 'a' + n % 26LL;
    n /= 26LL;
  }
  reverse(all(ans));
  cout << ans;
  cout << "\n";
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


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

typedef long long ll;

//#define DMY_IN


int main() {
  ll N, M;
  vector< pair<ll,ll> > ABC;

//  std::chrono::system_clock::time_point  start, end; // 型は auto で可
//  start = std::chrono::system_clock::now(); // 計測開始時間

#ifdef DMY_IN
#else
  cin >> N >> M;
  REP(i,N) {
    ll ain;
    cin >> ain;
    ABC.emplace_back( ain, 1 ) ;
  }
  REP(i,M) {
    ll bi, ci;
    cin >> bi >> ci;
    ABC.emplace_back( ci, bi ) ;
  }
#endif

  sort( ABC.begin(), ABC.end(), greater< pair<ll,ll> >() );

//  REP(i,N+M)
//    cout << ABC[i].first << " " << ABC[i].second << endl;

  ll ans = 0;
  ll idx = 0;
  ll cnt = 0;
  REP(i,N) {
    ans += ABC[idx].first * ABC[idx].second;
    cnt += ABC[idx].second;
    if ( cnt >= N ) {
      ans -= (cnt-N) * ABC[idx].first;
      break;
    }
    idx++;
  }

  cout << ans << endl;
  

//  end = std::chrono::system_clock::now();  // 計測終了時間
//  double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count(); //処理に要した時間をミリ秒に変換
//  std::cout << elapsed << " ms" << std::endl;
  
}




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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {

int x;
cin >> x;
cout << x*x*x << endl;
return 0;
}


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

struct SegmentTree{
private:
    int n;
    std::vector<int> node;
 
public:
    explicit SegmentTree(int sz){
        n=1;
        while(n<sz)n=n*2;
        node.resize(static_cast<unsigned int>(2 * n - 1), 0);
        for (int i = 0; i <sz ; ++i) node[i+n-1]=0;
        for (int i = n-2; i >= 0 ; --i) node[i]=node[2*i+1]+node[2*i+2];
    }
 
    void update(int x, int val){//x:0-indexed
        x+=n-1;
        node[x]+=val;
        while(x>0){
            x=(x-1)/2;
            node[x]=node[2*x+1]+node[2*x+2];
        }
    }
 
    int getsum(int p,int q,int k=0,int l=0,int r=-1){//[p,q):0-indexed
        if(r<0)r=n;
        if(r<=p||l>=q)return 0;
        if(p<=l&&r<=q)return node[k];
 
        return getsum(p,q,2*k+1,l,(l+r)/2)+getsum(p,q,2*k+2,(l+r)/2,r);
    }
};

void solve(){
    int n,q;
    std::cin>>n>>q;
    SegmentTree st(n);
    for(size_t i = 0; i < q; i++)
    {
        int com,x,y;
        std::cin>>com>>x>>y;
        if(com==0)//add
        {
            st.update(x-1,y);
        }
        else //getsum
        {
            std::cout<<st.getsum(x-1,y)<<std::endl;
        }
    }
}

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


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

using namespace std;

int main(){
	double a,b,n;
	scanf("%lf%lf%lf",&a,&b,&n);
	printf("%.0lf\n",floor(a*((n<b?n:b-1)/b-floor((n<b?n:b-1)/b))));
}

Measured memory_bytes: 3764
N, K = map(int, input().split())
P = list(map(lambda x: int(x) - 1, input().split()))
C = list(map(int,input().split()))

ans = 10**20 * -1
for si in range(N):
    x = si
    s = []
    tot = 0
    while True:
        x = P[x]
        s.append(C[x])
        tot += C[x]
        if x == si:
            break
    l = len(s)
    t = 0
    for i in range(l):
        t += s[i]
        if i+1 > K:
            break

        now = t
        if tot > 0:
            e = (K - (i + 1)) // l
            now += tot * e
        ans = max(ans, now)
print(ans)



Measured memory_bytes: 80972
#include <iostream>

using namespace std;

int main(){
  int a, b, c, ans = 0;
  int color[101] = {0};

  cin >> a >> b >> c;

  color[a] = a;
  color[b] = b;
  color[c] = c;

  for(int i = 0;i < 101;i++){
    if(color[i] != 0){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

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

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

const int N = 1000007, inf = 0x3f3f3f3f;

ll v[N];
vector<ll> neg;
vector<ll> pos;
ll cnt0;

int n;
ll k;

ll menor(vector<ll> & vec, ll x) {
    return upper_bound(vec.begin(), vec.end(), x) - vec.begin();
}

ll maior(vector<ll> & vec, ll x) {
    return vec.end() - lower_bound(vec.begin(), vec.end(), x);
}

// quantos menores ou iguais a cur
ll count(ll cur) {
    ll sum = 0;
    for(int i = 0; i < n; ++i) {
        ll x = v[i];
        if(cur > 0) {
            if(x > 0) sum += neg.size() + cnt0 + menor(pos, cur/x);
            else if(x < 0) sum += pos.size() + cnt0 + menor(neg, cur/(-x));
            else sum += n;
        } else if(cur == 0) {
            if(x > 0) sum += neg.size() + cnt0;
            else if(x < 0) sum += pos.size() + cnt0;
            else sum += n;
        } else {
            if(x > 0) sum += maior(neg, (-cur + x - 1)/x);
            else if(x < 0) sum += maior(pos, (-cur + (-x) - 1)/(-x));
        }
        if(x * x <= cur) sum --;
    }

    return sum/2;
}

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

    cin >> n >> k;

    for(int i = 0; i  < n; ++i) {
        cin >> v[i];
        if(v[i] < 0) neg.pb(-v[i]);
        else if(v[i] == 0) cnt0++;
        else pos.pb(v[i]);
    }

    sort(v, v + n);
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());

    ll l = -1000000000000000000ll, r = 1000000000000000000ll;
    ll ans;
    while(l <= r) {
        ll mid = l + (r - l)/2;
        if(count(mid) >= k) {
            ans = mid;
            r = mid-1;
        } else{
            l = mid+1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int main(){    
    string s ;
    cin >> s;
    for (size_t i = 0; i < s.size(); i++)
    {
        s.at(i) = 'x' ;
    }
    cout << s << endl ;
}

Measured memory_bytes: 256
base = gets.split(' ').map {|i| i.to_i}
n = base[0]
d = base[1]
coordinates = []
success = 0
n.times do
  coordinates <<  r = gets.split(' ').map {|i| i.to_i}
end

coordinates.combination(2) {|s, f|
  #puts "s: #{s}, f: #{f}"
  _dist = 0
  0.upto(d-1) do |i|
    _dist += (s[i] - f[i]) ** 2
  end
  dist = Math.sqrt(_dist)
  if dist % 1 == 0
    #puts "Integer #{dist}"
    success += 1
  else
    #puts "Float #{dist}"
  end
}

puts success


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	ll N;cin >> N;
	string ans;
	int cnt = 0;
	--N;
	while (N > -1) {
		int x = N % 26;
		char ch = 'a';
		ch += x;
		ans.push_back(ch);
		N /= 26;
		--N;
	}
	reverse(all(ans));
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(long long)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
long long fact[1000000];
void makef() {
    fact[0] = 1;
    for (long long i = 1; i < 1000000; i++) {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
}

signed main(){
    makef();
    long long n,m;
    cin>>n>>m;
    if(abs(n-m)>1){
        cout<<0<<endl;
        return 0;
    }
    long long res = fact[n];
    res *= fact[m];
    res %= mod;
    if(n==m){
        res*=2;
        res%=mod;
    }
    cout<<res<<endl;

    

}

Measured memory_bytes: 8064
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    # ab = [MII() for _ in range(n)]
    # ab.sort(key=lambda x: (x[0], x[1]))
    aa = []
    bb = []
    for _ in range(n):
        a, b = MII()
        aa.append(a)
        bb.append(b)
    aa.sort()
    bb.sort()
    if n%2==1:
        l1, r1 = aa[n//2], bb[n//2]
        print(r1-l1+1)
    else:
        l1, l2 = aa[n//2-1], aa[n//2]
        r1, r2 = bb[n//2-1], bb[n//2]
        print((r1+r2)-(l1+l2)+1)
    # if n%2==1:
        # l1, r1 = ab[n//2][0], ab[n//2][-1]
        # print(r1-l1+1)
    # else:
        # l1, r1 = ab[(n//2)-1][0], ab[(n//2)-1][-1]
        # l2, r2 = ab[(n//2)][0], ab[(n//2)][-1]
        # print((r1+r2)-(l1+l2)+1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 25432
k = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[k - 1])

Measured memory_bytes: 9164
#include<cstdio>
using namespace std;
typedef long long ll;
int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    int m = n/k;
    ll ans = 1ll*m*m*m;
    if(k%2 == 0){
        int h = n/(k/2);
        if(h&1){
            m = (h+1)/2;
        }
        else{
            m = h/2;
        }
        ans += 1ll*m*m*m;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 128
import math
x1, y1, r1 = map(float, raw_input().split())
x2, y2, r2 = map(float, raw_input().split())

vx, vy = x2 - x1, y2 - y1
norm = vx * vx + vy * vy
add = math.sqrt(norm)
dec = (r1 * r1 - r2 * r2) / add
p = (add + dec) / 2 
cx = p * vx / add + x1
cy = p * vy / add + y1
q = math.sqrt(max(0, r1 * r1 - p * p))
dx = q * vy / add
dy = -q * vx / add
ans = sorted([(cx + dx, cy + dy), (cx - dx, cy - dy)])
print "%.10f %.10f %.10f %.10f" % (ans[0][0], ans[0][1], ans[1][0], ans[1][1])



Measured memory_bytes: 4768
n = int(input())
room = [[[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]],
        [[0 for i in range(10)],[0 for i in range(10)],[0 for i in range(10)]]]
for i in range(n):
    b, f, r, v = map(int, input().split())
    room[b-1][f-1][r-1] = room[b-1][f-1][r-1] + v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ",end="")
            print(room[i][j][k], end="")
        print("")
    if i != 3:
        for l in range(20):
            print("#",end="")
        print("")


Measured memory_bytes: 5652
#include <stdio.h>

void print_int_array(int *data, int cnt){
	int i;

	for(i=0; i<cnt; i++){
		if( i < cnt-1 ){
			printf("%d ",data[i]);
		} else {
			printf("%d\n",data[i]);
		}
	}
}

int main(int argc, char** argv){
	int n,a[100];
	int i,j;
	int v;

	// Input
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",a+i);
	}

	// Output
	print_int_array(a,n);

	// Sort
	for(i=1;i<n;i++){
		v = a[i];

		j = i-1;
		while(j>=0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;

		// Output
		print_int_array(a,n);
	}

	return 0;
}

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

using namespace std;

double solve(int *z, int p, int n) {
	double d;

	d = 0;
	for (int i = 0; i < n; ++i) {
		d += pow(z[i], p);
	}
	return pow(d, 1.0 / p);
}

int main() {
	int n;
	int x[100], y[100], z[100];
	double d[4];

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	for (int i = 0; i < n; ++i) {
		cin >> y[i];
		z[i] = abs(x[i] - y[i]);
	}
	d[3] = *max_element(z, z + n);
	for (int i = 0; i < 3; ++i) {
		d[i] = solve(z, i + 1, n);
	}

	for (int i = 0; i < 4; ++i) {
		cout << fixed << setprecision(6) << d[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3484
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
using LL = long long;
using Graph = vector<vector<int>>;
#define NUM 1000000007

LL pow_l(LL x, LL n) {
	LL ans = 1;
	LL x_n = x;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x_n % NUM;
		}
		n = n >> 1;
		x_n = x_n * x_n % NUM;
	}
	return ans;
}



int main() {
	LL X, Y;
	cin >> X >> Y;
	if ((2 * Y - X) % 3 != 0 || (2 * X - Y) % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	LL a = (2 * Y - X) / 3;
	LL b = (2 * X - Y) / 3;
	if (a < 0 || b < 0) {
		cout << 0 << endl;
		return 0;
	}
	vector<LL>  kaijo(3e6 + 10), inv_kaijo(3e6 + 10), inv(3e6 + 10);
	kaijo[1] = 1;
	inv_kaijo[1] = 1;
	inv[1] = 1;
	kaijo[0] = 1;
	inv_kaijo[0] = 1;
	inv[0] = 1;
	for (int i = 2; i <= 2e6; i++) {
		kaijo[i] = kaijo[i - 1] * i % NUM;
		inv[i] = NUM - inv[NUM % i] * (NUM / i) % NUM;
		inv_kaijo[i] = inv_kaijo[i - 1] * inv[i] % NUM;
		//inv_kaijo[i] = inv_kaijo[i - 1] * pow_l(i, NUM - 2) % NUM;
	}

	LL ans = kaijo[a + b] * inv_kaijo[a] % NUM * inv_kaijo[b] % NUM;
	cout << ans << endl;
	return 0;






}

Measured memory_bytes: 73480
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

const INF: i64 = -1 * (1 << 60);

fn dp(vs: &Vec<i64>, memo: &mut Vec<Vec<Vec<Option<i64>>>>, l: usize, r: usize, k: i64) -> i64 {
    if k < 0 || l > r {
        return INF
    }
    if k == 0 {
        return 0;
    }
    if l == r {
        return max(0, vs[l])
    }

    if let Some(v) = memo[l][r][k as usize] {
        return v
    }
    let l1 = dp(vs, memo, l+1, r, k-1) + vs[l];
    let l2 = dp(vs, memo, l+1, r, k-2);
    let r1 = dp(vs, memo, l, r-1, k-1) + vs[r];
    let r2 = dp(vs, memo, l, r-1, k-2);

    let k = k as usize;
    memo[l][r][k] = Some(max(max(l1, max(max(l2, r1), r2)), 0));
    memo[l][r][k].unwrap()
}

fn main() {
    input!{
      n: usize,
      k: usize,
      vs: [i64; n],
    }
    let mut memo = vec![vec![vec![None; k+1]; n]; n];
    let ans = dp(&vs, &mut memo, 0, n-1, k as _);
    println!("{}", ans);
}


Measured memory_bytes: 8444
import java.util.*;

import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    public List<Integer> getPrimeList(int max){
		LinkedList<Integer> primes=new LinkedList<Integer>();

		PLoop:for(int i=2;i<max;i++){
			for(int prime:primes){
				if(i%prime==0){
					continue PLoop;
				}
				if( prime*prime>i){
					break;
				}
			}
			primes.add(i);
		}
		return primes;
	}

    public void run() {
    	while(true){
    		int m=sc.nextInt(),a=sc.nextInt(),b=sc.nextInt();
    		if(m==0 && a==0 && b==0)return;
    		List<Integer> primes=new ArrayList<Integer>(getPrimeList(100000));

    		int max=0,pres=-1,qres=-1;
    		for(int i=0;i<primes.size();i++){
    			int p=primes.get(i);
    			int j1=Collections.binarySearch(primes,m/p);
    			int j2=Collections.binarySearch(primes,b*p/a);
    			if(j1<0)j1=~j1-1;
    			if(j2<0)j2=~j2-1;
    			int j=Math.min(j1,j2);
    			if(i<=j){
	    			int q=primes.get(j);
	    			if(max<p*q){
	    				max=p*q;
	    				pres=p;
	    				qres=q;
	    			}
    			}
    		}

    		ln(pres +" "+qres);
    	}
    }
    public static void main(String[] args) {
        new Main().run();
    }

    public int[] nextIntArray(int n){
        int[] res=new int[n];
        for(int i=0;i<n;i++){
            res[i]=sc.nextInt();
        }
        return res;
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

Measured memory_bytes: 60600
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
map<string,int> M;
int n,a[55555];
string s;
LL ans;
int main(){
	cin>>n;
	FOR(i,1,n){
		cin>>s>>a[i];
		M[s]=i;
	}
	cin>>s;
	for (int i=M[s]+1;i<=n;++i) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

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

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

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}


   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

string s, t;
const ll MAX_str = 3e3;
ll dp[MAX_str + 1][MAX_str + 1] = {};

int main(){
  cin >> s >> t;
  REP(i, s.size()){
    REP(j, t.size()) {
      dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      if (s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
    }
  }
  ll i = s.size() - 1, j = t.size() - 1;
  string ans;
  while (i >= 0 && j >= 0){
    if (dp[i + 1][j + 1] == dp[i][j + 1]) i--;
    else if (dp[i + 1][j + 1] == dp[i + 1][j]) j--;
    else {
      ans.insert(ans.begin(), s[i]); 
      i--;
      j--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 70656
$n = <>; chomp $n; @x = split / /, <>;

@sorted = sort { $a <=> $b } @x;
$l = scalar @x;
$center = $sorted[$l/2-1];

for my $index (0..$#x) {
    print $x[$index] <= $center ? $sorted[($l+1)/2] : $sorted[$l/2-1];
    print "\n";
}


Measured memory_bytes: 46896
n,k=map(int,input().split())
cnt=0
j=17
for i in range(1,n+1):
    if i>=k:
        cnt+=1
    else:
        while i*(2**j)>=k:
            j-=1
        cnt+=1/2**(j+1)
print(format(cnt/n,'.12f'))


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

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

	int i = 0;
	int j = s.size() - 1;
	int ans = 0;
	while (i != j && i < j) {
		if (s.at(i) != s.at(j)) ans++;
		i++;
		j--;
	}

	cout << ans << endl;

 	return 0;
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define loop(i, a, b) for(int i=a; i<b; i++)
#define loopb(i, a, b) for(int i=a; i>=b; i--)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli power(lli x, lli y){
    lli res = 1;
    x = x ;
    while (y > 0) {
        if (y & 1)
            res = (res*x) ;
        y = y>>1;
        x = (x*x);
    }
    return res;
}
lli solve(){
	lli n, k;
	cin>>n>>k;
	vll h(n), dp(n, 1e10);
	loop(i, 0, n)	cin>>h[i];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	loop(i, 2, n){
		for(int j=1; j<=k && i-j >= 0; j++)
			dp[i] = min(dp[i-j] + abs(h[i] - h[i-j]), dp[i]);
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}
int main(){
	fastio;
	lli t;
//	cin>>t;
	t = 1;
	while(t>0){
		t--;
		solve();
	}
}

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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; ++i) cin >> A[i];
    sort(A.begin(), A.end(), greater<long long>());

    vector<long long> S(N);
    S[N - 1] = A[N - 1];
    for(int i=N-2; i>=0; --i) S[i] = A[i] + S[i + 1];

    int res = 1;
    for( ; res < N; ++res) {
        if(A[res - 1] > 2LL * S[res]) break;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };



int main() {
	int n;
	cin >> n;
	map<llint, llint> Z;
	hei(llint) w(n),s(n);
	rep(i, 0, n) {
		llint a;
		cin >> a;
		w[i] = a + i + 1;
		s[i] = i + 1 - a;
		Z[s[i]]++;
	}
	llint ans = 0;
	rep(i, 0, n) {
		ans += Z[w[i]];
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 29140
#include <stdio.h>
#include <string.h>

/* 配列の要素を交換する */
void Swap(int x[ ], int i, int j)
{
    int temp;
    
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

/* クイックソートを行う */
void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;
    
    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */
    
    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */
    
    while (1) {                    /* 無限ループ */
        
        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */
        
        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */
        
        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    //ShowData(x, 10);               /* 途中経過を表示 */
    
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

int main(void){
  int n, i, result=0;
  int a[200001];
  
  scanf("%d", &n);
  
  for(i=0;i<n;i++) scanf("%d", &a[i]);
  
  QSort(a, 0, n-1);
  
  for(i=0;i<n-1;i++){
    if(a[i] == a[i+1]){
      result = 1;
      break;
    }
  }
  
  if(result == 0) printf("YES");
  else printf("NO");
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n, k, l;
    bool b;
    b = true;
    string price;
    cin >> n >> k;
    vector<int> d(k);
    for(int i=0; i<k; ++i){
        cin >> d[i];
    }
    for(int i=n; i<100000; ++i){
        price = to_string(i);
        l = price.length();
        b = true;
        for(int j=0; j<l; ++j){
            for(int u=0; u<k; ++u){
                if(price[j] - '0' == d[u]){
                    b = false;
                }
            }
        }
        if(b){
            cout << price << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	int n,a,b,c;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a >> b >> c;
		puts(((a * a + b * b == c * c)||(a * a + c * c == b * b)||(b * b + c * c == a * a))?"YES":"NO");
	}
}

Measured memory_bytes: 1116
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

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

amari = N - sum(A)
if amari < 0:
    print(-1)
else:
    print(amari)




Measured memory_bytes: 10428
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long double PI = (acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}
int main()
{
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i, n)
    {
        cin >> vec[i];
    }
    sort(vec.begin(), vec.end());
    queue<int> Q;
    rep(i, n)
    {
        Q.push(vec[i]);
    }
    float cook = Q.front();
    Q.pop();
    for (int i = 1; i < n; i++)
    {
        float cook1 = Q.front();
        Q.pop();
        cook = (cook + cook1) / 2;
    }
    cout << cook << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNextInt())
		{
			int a = sc.nextInt();
			int b = sc.nextInt();
			int n = sc.nextInt();
			String f = Double.toString((double) a / b);
			int sum = 0;
			for (int i = f.indexOf(".") + 1; i < f.length() && i < f.indexOf(".") + n + 1; i++)
			{
				sum += f.charAt(i) - '0';
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

int main(void){
    int x,i,v;
    scanf("%d",&x);
    int a[x+1];
    for(i=0;i<=x;i++){
        a[i]=0;
    }
    a[1]=1;
    for(i=2;i<=x;i++){
        int v=i*i;
        while(v<=x){
            a[v]=1;
            v*=i;
        }
    }
    /*for(i=0;i<x;i++){
        printf("%d ",a[i]);
    }*/
    for(i=x;i>=1;i--){
        if(a[i]){
            printf("%d\n",i);
            return 0;
        }
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
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; }

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
typedef long long ll;
const int mod = 1e9 + 7;

int main()
{
  string s, t;
  cin >> s >> t;
  int n = s.size();
  vector<int> a(27), b(27);
  for (int i = 0; i < n; i++)
  {
    a[s[i] - 'a']++;
    b[t[i] - 'a']++;
  }
  
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  for (int i = 0; i < 26; i++)
  {
    if(a[i] != b[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  

}


Measured memory_bytes: 776
//gcc -std=gnu11 -O2 -o a.out Main.c -lm

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void)
{
	
	int count[26];
	int i, ans;
	char w[101];
	int ret;
	
	ret = scanf("%s", w);
	memset(count, 0, sizeof(count));
	
	for(i = 0 ; i < strlen(w) ; i++){
		count[w[i]-'a']++;
	}
	
	ans = 0;
	for(i = 0 ; i < 26 ; i++){
		ans |= count[i];
	}
	
	if(ans & 1){
		printf("No\n");
	} else {
		printf("Yes\n");
	}
	
	return 0;
}


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

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

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N, K; cin >> N >> K;
  ll result = min(N%K,K-N%K);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if (a+b==15){
        printf("+\n");
    } else if (a*b==15){
        printf("*\n");
    } else {
        printf("x\n");
    }
	return 0 ;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> v(n, 0);
	unordered_map<int, int> um;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		um[v[i] + i]++;
	}
	long long int res = 0;
	for (int i = 0; i < n; i++) {
		res += um[i - v[i]];
		if (i - v[i] == i + v[i]) res--;
	}
	cout << res << endl;
}


Measured memory_bytes: 19424
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string str;
    cin >>str;
    int q,i;
    cin >>q;
    string a1,a2;
    int a,b;
    for(i=0;i<q;i++){
        cin >>a1 >>a >>b;
        if(a1=="print"){
            cout << str.substr(a,b-a+1) << endl;
        }else if(a1=="reverse"){
            string a3=str.substr(a,b-a+1);
            reverse(a3.begin(),a3.end());
            str=str.substr(0,a)+a3+str.substr(b+1,str.size()-a-1);
        }else{
            cin >>a2;
            str=str.substr(0,a)+a2+str.substr(b+1,str.size()-a-1);
        }
    }
    return 0;
}


Measured memory_bytes: 3220
// @prefix atcoder
// @description atcoder template

#include <bits/stdc++.h>
using namespace std;
#define int long long

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'

int k;
int a, b;

signed main() {
    cin >> k >> a >> b;

    REP(i, 10000) {
        int f = k * i;
        if (a <= f && f <= b) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}


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


int main(){
   ll n , t , k ;

   cin >> n >> t >> k ;

   if (n>=k){
        cout << n-k << ' '<< t << endl ;
   }
   else{
        cout << 0<< ' ' <<max(0LL,t- (k-n)) << endl ;
   }

}


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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // 	freopen("in.txt","r",stdin);
    // 	freopen("out.txt","w",stdout);
    // #endif
    string a;
    cin>>a;
    int n=a.size();
    int ans1=0,ans2=0;
    f1(i,0,n)
    {
    	if(i%2)
    	{
			if(a[i]=='0')
    		ans1++;
    		else
    		ans2++;
    	}
    	if(i%2==0)
    	{
    		if(a[i]=='1')
    		ans1++;
    		else
    		ans2++;
    	}
    }
    //cout<<ans1<<gp<<ans2<<endl;
    cout<<min(ans1,ans2);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <string>
#include <vector>
/* 変数i を n回繰り返すマクロ */
#define rep(i,n) for (int i = 0;i < (n);i++)
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main()
{
    cout << fixed << setprecision(10);//小数点以下10桁出力
    int n;
    cin >> n ;
    vector<int> p(n),q(n);
    vector<int> tmp(n);

    rep(i,n){
        int in;
        cin >> in;
        p.at(i) = in;
    }

    rep(i,n){
        int in;
        cin >> in;
        q.at(i) = in;
    }

    rep(i,n){
        tmp.at(i) = i + 1;
    }
    map<vector<int>,int> mp;
    do{
        mp[tmp] = mp.size();
    }while(next_permutation(tmp.begin(),tmp.end()));

    int ans = abs(mp[p] - mp[q]);

    cout << ans << endl;


    
    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <map>
#include <utility>
#include<math.h>
#include <iomanip>
#include<vector>
#define ll long long
#define ull unsigned long long
#include<numeric>
#include <map>
using namespace std;
int n;
#define maxSiz 1000
int is_prime[maxSiz+5];
vector <int> primes;
void sieve(int siz=maxSiz){
    primes.clear();
    memset(is_prime,true,sizeof is_prime);
    is_prime[0]=is_prime[1]=false;
    for(int i=4;i<=siz;i+=2) is_prime[i]=false;
    for(int i=3;i*i<=siz;i+=2) if(is_prime[i]) for(int j=i*2;j<=siz;j+=i) is_prime[j]=false;
    for(int i=0;i<=siz;i++)if(is_prime[i]) primes.push_back(i);
}

int factN_pow(int n,long long p){
    int prime=p;
    int cnt=0;
    while(p<=n){
        cnt+=(n/p);
        p*=prime;
    }
    return cnt;
}

vector <pair<int,int> > num_fact;
void numFact(int m){
    num_fact.clear();
    int cnt=0;
    for(int i=0;i<primes.size() && primes[i]*primes[i]<=m;i++){
        if(m%primes[i]==0){
            cnt=0;
            while(m%primes[i]==0){
                cnt++;
                m/=primes[i];
            }
            num_fact.push_back(make_pair(primes[i],cnt));
        }
    }
    if(m>1) num_fact.push_back(make_pair(m,1));

}
int factPrimePower(int prime,int n){
    int ret=0;
    for(int i=prime;i<=n;i*=prime) ret+=n/i;
    return ret;
}

vector <pair<int,int> >fact_factorization;
int arr_fact[1000];
void factFactorization(int num){
    memset(arr_fact,-1,sizeof arr_fact);
    fact_factorization.clear();
    int temp;
    for(int i=0;i<primes.size() && primes[i]<=num;i++){
        temp=factPrimePower(primes[i],num);
        if(temp) arr_fact[primes[i]]=fact_factorization.size(),fact_factorization.push_back(make_pair(primes[i],temp));
    }

}


int main()
{
    std::ios::sync_with_stdio(false);
    cin>>n;
    sieve();
    factFactorization(n);
    long long ans=1;

    for(int i=0;i<fact_factorization.size();i++){
        ans=(ans*(fact_factorization[i].second+1))%(1000000000+7);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  vec b(n);
  loop(i,n)cin>>a[i];
  loop(i,n)cin>>b[i];
  if(sum(a)<sum(b))putout(-1);
  else{
    ll ans=0;
    ll shortage=0;
    vec d(n);
    loop(i,n){
      if(a[i]<b[i]){
        ans++;
        shortage+=b[i]-a[i];
      }
      else d[i]=(a[i]-b[i]);
    }
    sort(all(d));
    reverse(all(d));
    if(shortage!=0){
    loop(i,n){
      ans++;
      shortage-=d[i];
      if(shortage<=0)break;
    }
    }
    putout(ans);
  }
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  string a,b,c;
  cin>>a>>b>>c;
  cout<<'A'<<b[0]<<'C'<<endl;
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<bool> used(n);
    vector<vector<int> > graph(n);
    int s, t;
    rep (i, m) {
        int a, b; cin >> a >> b; a--; b--;
        if (i == 0) {s = a; t = b;}
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    used[s] = used[t] = true;
    vector<int> ss{s}, tt{t};
    int now = s;
    while (true) {
        if (all_of(all(graph[now]), [&](int x){return used[x];})) break;
        for (int i : graph[now]) {
            if (!used[i]) {
                ss.push_back(i); now = i; used[now] = true;
                break;
            }
        }
    }
    now = t;
    while (true) {
        if (all_of(all(graph[now]), [&](int x){return used[x];})) break;
        for (int i : graph[now]) {
            if (!used[i]) {
                tt.push_back(i); now = i; used[now] = true;
                break;
            }
        }
    }
    reverse(all(ss));
    cout << ss.size() + tt.size() << '\n';
    for (int i : ss) cout << i + 1 << ' ';
    for (int i : tt) cout << i + 1 << ' ';
    cout << '\n';
    return 0;
}

Measured memory_bytes: 6904