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

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define repk(i,n,k) for(ll i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    string s="";
    while(n){
        n--;
        s+=('a'+(n+25/26)%26);
        n/=26;
    }
    reverse(all(s));
    print(s);
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define deb(x) cout << #x <<  " " << x << endl;
#define all(x) x.begin(), x.end()
typedef std::vector<int> vi;
typedef std::vector<vector<int>> vvi;
typedef std::vector<string> vs;
typedef std::vector<bool> vb;
typedef std::pair<int, int> pii;
typedef long long ll;
const int inf = 1e9 + 5;

template <typename T>
void print(T v){ for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(2)<<*i<<" ";cout<<endl; }
template <typename T>
void print_vv(T v, bool same_line=true){
for(auto i= 0; i<v.size(); i++){cout<<"{";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(3)<<v[i][j]<<",";}cout<<"},";if(same_line) cout<<endl;}cout<<endl;}

int main(){
    int n, k;
    while(cin>>n>>k){
        vi h(n);
        vi dp(n, inf);

        for(int i=0; i<n; i++) 
            cin>>h[i];

        dp[0] = 0;
        for(int i=0; i<n; i++){
            for(int j=i+1; j<=i+k; j++){
                if(j<n){
                    dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
                }
            }
        }

        cout<<dp[n-1]<<endl;
    }
    
    return 0;
}

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

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)


const int mod = 1e9 + 7;

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, c, k, ans, bus, limit;
    cin >> n >> c >> k;
    int t[n];
    rep(i, n)
    {
        cin >> t[i];
    }

    sort(t, t + n);
    ans = bus = 0;

    rep(i, n)
    {
        if (!i)
        {
            ans++;
            limit = t[0] + k;
        }
        else
        {
            if (limit < t[i] || bus == c)
            {
                bus = 0;
                ans++;
                limit = t[i] + k;
            }
        }
        if (bus < c)
            bus++;
        // cout << bus << limit << ans << endl;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	string s;
	cin >> s;
	int y = 0;
	for (int i = 0; i < 4; i++) {
		y = y * 10 + (s[i] - '0');
	}

	int m = 0;
	for (int i = 5; i < 7; i++) {
		m = m * 10 + (s[i] - '0');
	}

	int d	 = 0;
	for (int i = 8; i < 19; i++) {
		d = d * 10 + (s[i] - '0');
	}

	bool isHeisei;
	if (y != 2019) {
		isHeisei = y < 2019;
	}
	else {
		if (m != 4) {
			isHeisei = m < 4;
		}
		else {
			isHeisei = d <= 30;
		}
	}

	if (isHeisei) {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}
}


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

using namespace std;

int main() {
    unsigned int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    a.erase(unique(a.begin(), a.end()), a.end());

    for (int i = 0; i < a.size(); ++i) {
        cout << (i ? " " : "") << a[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
int main(void)
{
  int a,b,c,i;
  int t = 0;
  scanf("%d%d%d", &a,&b,&c);
  for(i = a; i <= b; i++){
      if (c%i==0) t += 1;
  }
  printf("%d\n", t);
  return 0;
}
      

Measured memory_bytes: 596
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func floatSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	fmt.Println(n * (n - 1) / 2)
}


Measured memory_bytes: 1772
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

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

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: i32
  }

  puts!("{}\n", (n + 1) / 2);
}


Measured memory_bytes: 4352
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
nmax = 2*10**6+2
mod = 10**9+7
fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod

ncr_pre()
k = ni()
s = input()
n = len(s)
ans= 0
for i in range(k+1):
    ans=(ans+ ncr(n+k-i-1,n-1)*pow(25,k-i,mod)*pow(26,i,mod) )%mod
print(ans)


Measured memory_bytes: 137380
#include <iostream>
using ll = long long;

int main() {
  int N;
  std::cin >> N;
  int max{0};
  int x{0};
  for (int i = 0; i < N; i++) {
    char c;
    std::cin >> c;
    x += (c == 'I') ? 1 : -1;
    max = (x > max) ? x : max;
  }
  std::cout << max << std::endl;
  return 0;
}

Measured memory_bytes: 256
#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 <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 MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

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

int main(){

    int countN = 0;
    int countW = 0;
    int countS = 0;
    int countE = 0;
    string str;

    cin >> str;
    const char* ch = str.c_str();

    FOR(i,0,str.size()){
        if(ch[i] == 'N')countN++;
        else if(ch[i] == 'S')countS++;
        else if(ch[i] == 'E')countE++;
        else countW++;
    }

    if(countN > 0 && countS > 0 && countE > 0 && countW > 0)cout << "Yes";
    else if(countN + countS == 0 && countE > 0 && countW > 0)cout << "Yes";
    else if(countE + countW == 0 && countN > 0 && countS > 0)cout << "Yes";
    else if(countE + countW + countN + countS == 0)cout << "Yes";
    else cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 998244353
inline void add(int &x, int v) { x += v; if (x >= MOD) x -= MOD; }
inline int mul(int x , int y) { return (1LL*x*y)%MOD; }
int modpow(int x, int k) {
  int a = 1;
  while(k) {
    if (k&1)a=mul(a,x);
    x=mul(x,x);
    k>>=1;
  }
  return a;
}
int inv(int x) {
  return modpow(x,MOD-2);
}
int fact[400001];
int nCr(int n, int r) {
  if (r < 0 || r > n) return 0;
  return mul(mul(fact[n], inv(fact[r])),inv(fact[n-r]));
}

int f(int h, int u, int d) {
  if (u == 0 && d == 0) return 1;
  if (h == 0) return 0;
  return nCr(u+d+h-1, h-1);
}

int L[100000];
int R[100000];
int solve(int H, int W, string left, string right, string top, string bottom) {
  rep(i, W) L[i] = R[i] = 0;

  int h = 0, u = 0, d = 0;
  for (char c : right) h += c == '1';
  for (int r=W-1; r>=0; r--) if (top[r]=='1'||bottom[r]=='1') {
    R[r] = f(h, u, d);
    u += top[r]=='1';
    d += bottom[r]=='1';
  }

  h = 0, u = 0, d = 0;
  for (char c : left) h += c == '1';
  for (int l=0; l<W; l++) if (top[l]=='1' || bottom[l]=='1') {
    L[l] = f(h, u, d);
    u += top[l]=='1';
    d += bottom[l]=='1';
  }

  int s = 0, e = 0;
  for (int l=W-1; l>=0; l--) {
    add(e, R[l]);
    if (top[l]=='1'&&bottom[l]=='1') e = mul(2, e);
    add(s, mul(e, L[l]));
  }
  return s;
}

int N, M;
string A, B, C, D;

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  fact[0] = 1;
  for (int i=1; i<=400000; i++) fact[i]=mul(fact[i-1],i);

  cin >> N >> M >> A >> B >> C >> D;
  int one = 0;
  for (char c : A) one += c == '1';
  for (char c : B) one += c == '1';
  for (char c : C) one += c == '1';
  for (char c : D) one += c == '1';
  if (one == 0) {
    cout << 1 << "\n";
    return 0;
  }

  int s = 0;
  add(s, solve(N, M, A, B, C, D));
  add(s, solve(M, N, C, D, B, A));
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 3408
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
//#include "debug.cpp"

int32_t main()
{
	boost;
	
    int h;
    cin>>h;
    int ans=0;
    int cnt=0;
    while(h>0){
    	ans+=(1LL<<cnt);
    	h/=2;
    	cnt++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
vector<int> f(int n) {
    int sqrn = sqrt(n)+1;
    vector<int> res;
    res.resize(1000000);
    repr(x,sqrn) {
        repr(y, sqrn) {
            repr(z, sqrn) {
                res[x*x + y*y + z*z + x*y + y*z + z*x] ++;
            }
        }
    }
    return res;
} 

int main() {
    int n; cin >> n;
    auto v = f(n);
    repr(i,n+1) {
        cout << v[i] << endl;
    }
}

Measured memory_bytes: 7208
#include <stdio.h>
int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    
    if(a==b){
        printf("a == b\n");
    }
    else if(a<b){
        printf("a < b\n");
    }
    else{
        printf("a > b\n");
    }
    return 0;
    
}



Measured memory_bytes: 2048
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N, K;
    cin >> N >> K;
    double prob = 0;
    for(int i = 1; i <= N; i++){
        double prob_m = 1;
        int point = i;
        while(point < K){
            point *= 2;
            prob_m /= 2.0;
        }
        prob += prob_m;
    }
    cout << setprecision(10) << prob / N << endl;
}

Measured memory_bytes: 3776
N = int(input())
D = {}
for i in range(N):
  S = input()
  L = [S[j] for j in range(10)]
  L.sort()
  s = ""
  for j in range(10):
    s = s[:] + L[j]
  if s in D:
    D[s] += 1
  else:
    D[s] = 1
p = 0
for i in D:
  p += (D[i]*(D[i]-1))//2
print(p)

Measured memory_bytes: 17892
N = int(input())
X = list(map(int, input().split()))
X.sort()

ans = 1000*1000
for p_x in range(X[0],X[-1]+1):
    hp = 0
    for i in X:
        hp += (p_x - i)**2
    ans = min(ans,hp)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mpp make_pair

using namespace std;

const int N=3e5+5;
const ll infi=1e18+5;


int main()
{
	ll n;
	cin>>n;

	ll x,y,i;
	pair<ll,ll>a[n+5];
	for(i=1;i<=n;i++)
	{
		cin>>x>>y;
		a[i]=mpp(x-(y),x+(y));
	}
	sort(a+1,a+n+1);

	stack<pair<ll,ll> >s;
	s.push(a[1]);
	for(i=2;i<=n;i++)
	{
		pair<ll,ll>x=s.top();
	//
		if(x.second <= a[i].first ){
			s.push(a[i]);
		}
		else if(x.second > a[i].second)
		{
			x.second=a[i].second;
			s.pop();
			s.push(x);
		}
	}
	cout<<s.size()<<"\n";
}

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

using namespace std;

using int64 = long long;
const int64 INF = 1LL << 60;

int64 normalize(vector< int > &v) {
  int64 ret = INF;
  for(int i = 0; i < 4; i++) {
    rotate(begin(v), begin(v) + 1, end(v));
    int64 val = 0;
    for(int j = 0; j < 4; j++) {
      val = val * 400 + v[j];
    }
    ret = min(ret, val);
  }
  return ret;
}

using int64 = long long;

int main() {
  int N;
  cin >> N;
  vector< vector< int > > C(N, vector< int >(4));
  vector< int64 > normal(N);
  map< int64, int > cnt, mul;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 4; j++) cin >> C[i][j];
    normal[i] = normalize(C[i]);
    if(!mul.count(normal[i])) {
      int beet = 0;
      auto base = C[i];
      for(int j = 0; j < 4; j++) {
        rotate(begin(C[i]), begin(C[i]) + 1, end(C[i]));
        beet += base == C[i];
      }
      mul[normal[i]] = beet;
    }
    cnt[normal[i]]++;
  }

  int64 ret = 0;
  for(int i = 0; i < N; i++) {
    cnt[normal[i]]--;
    for(int j = 0; j < i; j++) {
      cnt[normal[j]]--;
      for(int k = 0; k < 4; k++) {
        vector< int > key1{C[i][1], C[i][0], C[j][1], C[j][0]};
        vector< int > key2{C[i][2], C[i][1], C[j][0], C[j][3]};
        vector< int > key3{C[i][3], C[i][2], C[j][3], C[j][2]};
        vector< int > key4{C[i][0], C[i][3], C[j][2], C[j][1]};
        auto ei1 = normalize(key1);
        auto ei2 = normalize(key2);
        auto ei3 = normalize(key3);
        auto ei4 = normalize(key4);
        int64 latte = 1;
        latte *= 1LL * mul[ei1] * cnt[ei1];
        --cnt[ei1];
        latte *= 1LL * mul[ei2] * cnt[ei2];
        --cnt[ei2];
        latte *= 1LL * mul[ei3] * cnt[ei3];
        --cnt[ei3];
        latte *= 1LL * mul[ei4] * cnt[ei4];
        --cnt[ei4];
        ret += latte;
        ++cnt[ei1];
        ++cnt[ei2];
        ++cnt[ei3];
        ++cnt[ei4];
        rotate(begin(C[j]), begin(C[j]) + 1, end(C[j]));
      }
      cnt[normal[j]]++;
    }
    cnt[normal[i]]++;
  }
  cout << ret / 3 << endl;
}


Measured memory_bytes: 161664
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 998244353
#define SYOU(x) fixed<<setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
using pii=pair<int, int > ;
vector<int> hen[2010];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol n,m,x,y;
  string s,w;
  cin >>n>>x>>y;
  for(int i=2;i<=n;i++){
    hen[i-1].emplace_back(i);
    hen[i].emplace_back(i-1);
  }
  hen[x].emplace_back(y);
  hen[y].emplace_back(x);
  int ans[2010]={};
  for(int i=1;i<n;i++){
    queue<int> q;
    bool vis[2010];
    int dis[2010];
    memset(vis,false,sizeof(vis));
    q.push(i);
    dis[i]=0;
    vis[i]=true;
    while(!q.empty()){
      int g=q.front();
      q.pop();
      for(int j=0;j<hen[g].size();j++){
        int h=hen[g][j];
        if(!vis[h]){
          q.push(h);
          dis[h]=dis[g]+1;
          vis[h]=true;
        }
      }
    }
    for(int j=i+1;j<=n;j++){
      ans[dis[j]]++;
      //cout <<i<<' '<<dis[j]<<'\n';
    }
  }
  for(int i=1;i<n;i++) cout <<ans[i]<<'\n';
             
      
  return (0);
}


Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
  
#define M 1000000
#define L 14
  
char H[M][L];

int Char(char ch);


long long getKey(char str[]);


int h1(int key);
int h2(int key);
int find(char str[]);
void insert(char str[]);

  
int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
    if ( com[0] == 'i' ){
      insert(str);
    } else {
      if (find(str)){
    printf("yes\n");
      } else {
    printf("no\n");
      }
    }
  }
  return 0;
}


int Char(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if( ch == 'T') return 4;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(Char(str[i]));
    p *= 5;
  }
  return sum;
}


int find(char str[]){
  long long trip;
  int i = 0;
  long long sum = getKey(str);
  
  while(1){
    trip = (h1(sum)+ i * h2(sum)) % M;
    if(strcmp(H[trip], str) == 0) return 1;
    if(H[trip][0] == '\0') return 0;
    i++;
  }
  return 0;
}

void insert(char str[]){
  int  i = 0;
  long long ago;
  long long sum = getKey(str);
  
  while(1){
    ago = (h1(sum)+ i * h2(sum)) % M;
    if(H[ago][0] == '\0' || strcmp(H[ago],str) == 0){
      strcpy(H[ago], str);
      break;
    }
    i++;
  }
}
int h1(int key){ return key % M;}
int h2(int key){ return 1 + key % (M - 1);}



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

typedef long long ll;

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

    int n; cin >> n;
    vector<ll> x(n),copy(n);
    for(int i=0;i<n;i++){
        cin >> x[i];
        copy[i] = x[i];
    }
    sort(x.begin(),x.end());
    ll med1 = x[n/2-1];
    ll med2 = x[n/2];
    for(int i=0;i<n;i++){
        if(copy[i]<=med1) cout << med2 << endl;
        else cout << med1 << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] && s[2] == s[3] && s[1] == s[2]) {
        cout << "Yes" << endl;
    }else if(s[0] == s[1] && s[1] == s[2]){
        cout << "Yes" << endl;
    }else if(s[1] == s[2] && s[2] == s[3]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

int main(){
	int N;
	int *A;
	int i,c;
	long int a;
	int min=100000000,max=-100000000;
	scanf("%d",&N);
	A=(int*)malloc(sizeof(int)*N);
	for(i=0;i<N;i++){
		scanf("%d ",&A[i]);
	}
	for(i=0;i<N;i++){
		if(A[i]<0){
			c++;
			if(max<A[i])max=A[i];
			a-=A[i];
		}
		else{
			if(min>A[i])min=A[i];
			a+=A[i];
		}
	}
	if(c%2==0)printf("%ld\n",a);
	else{
		if(min+max<0)printf("%ld\n",a-2*min);
		else printf("%ld\n",a+2*max);
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int a[100000]={0};
int main(){
	int i=0 , n;
	while(1){
		cin>> n;
		if (!n) break;
		a[i++]=n;
	}
	for(int j=0 ; a[j]!=0 ; j++){
		cout << "Case "<< j+1 << ":" << " " << a[j] << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<algorithm>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;
typedef pair<double,int> P;
priority_queue<P,vector<P>,greater<P> >Q;
double x[1010],y[1010],r[1010];
int n;
bool vis[1010];
double D(int a,int b){
	double cnt=(x[a]-x[b])*(x[a]-x[b]);
	cnt+=(y[a]-y[b])*(y[a]-y[b]);
	cnt=(double)sqrt((double)cnt);
	return max(0.0,cnt-r[a]-r[b]);
}
int main(){
	cin>>x[0]>>y[0]>>x[1]>>y[1]>>n;
	for(int i=2;i<n+2;i++)cin>>x[i]>>y[i]>>r[i];
	for(int i=0;i<=n+1;i++)vis[i]=false;
	Q.push(make_pair(0.0,0));
	while(!Q.empty()){
		double a=Q.top().first;int b=Q.top().second;
		Q.pop();
		if(!vis[b]){
			if(b==1){
				cout<<fixed<<setprecision(10)<<a<<endl;
			}
			vis[b]=true;
			for(int i=0;i<n+2;i++){
				if(vis[i]==false){
					Q.push(make_pair(a+D(i,b),i));
				}
			}
		}
	}
	return 0;
}


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

int main()
{
	long n = 0, g = 0, v = 0, cnt = 0, m = 0;

	cin >> n;

	vector <long> a(n);

	for (long i = 0; i < n; i++)
		cin >> a[i];

	cnt = 0;
	if (n < 3)
		m = 1;
	else
		m = (int)(log(n) / log(3));

	vector <long> G(m);		

	for (long k = 0; k < m; k++) {
		G[k] = ((long)pow(3, m - k) - 1) / 2;
		g = G[k];

		for (long i = g; i < n; i++) {

			long j = 0;

			v = a[i];
			j = i - g;

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

			a[j + g] = v;
		}
	}

	cout << m << endl;

	for (long i = 0; i < m - 1; i++)
		cout << G[i] << " ";
	cout << G[m - 1] << endl;

	cout << cnt << endl;

	for (long i = 0; i < n; i++)
		cout << a[i] << endl;	

	return 0;
}

Measured memory_bytes: 10756
#include<stdio.h>
int main(){
	int n,t=0,k=0,m=1,flg=0;
	int a[100000];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	if(a[0]==2)printf("1");
	else { t=a[0];
		while(t!=2){
			k=a[t-1];
			t=k;
			m++;
			if(m>n){
			flg=1;
			break;
			}	
		}
		if(flg==1)printf("-1");
	else  printf("%d",m);
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

bool isOk(int index, int key, vector<int> &a) {
    if (a[index] >= key) {
        return true;
    } else {
        return false;
    }
}

int binary_search(int key, vector<int> &a) {
    int ng = -1;
    int ok = (int)a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOk(mid, key, a)) {
            ok = mid;
        } else {
            ng = mid;
        }
    }

    return ok;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> b[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }

    ll ans = 0;
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());
    for (int i = 0; i < n; ++i) {
        ll upper = binary_search(b[i], a);
        ll lower = n - binary_search(b[i] + 1, c);
        ans += upper * lower;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
import collections
s=input()
t=input()
cnt1=1
cnt2=1
lst1=[]
lst2=[]
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    cnt1+=1
  else:
    lst1.append(cnt1)
for j in range(len(t)-1):
  if t[j]==t[j+1]:
    cnt2+=1
  else:
    lst2.append(cnt2)
S=collections.Counter(s)
T=collections.Counter(t)
S_=list(S.values())
T_=list(T.values())
S_.sort()
T_.sort()
if S_==T_ and lst1==lst2:
  print('Yes')
else:
  print('No')

    

Measured memory_bytes: 9112
package main
import "fmt"
func main() {
  var n int
  var t,a,ti,ai,k int64
  fmt.Scan(&n)
  fmt.Scan(&t,&a)
  for i:=1;i<n;i++ {
    fmt.Scan(&ti,&ai)
    k = max(ceil(t,ti),ceil(a,ai),ceil(t+a,ti+ai))
    t = k*ti
    a = k*ai
  }
  fmt.Println(t+a)
}
func max(nums ...int64) int64 {
  var m int64 = nums[0]
  var n int = len(nums)
  for i:=0;i<n;i++ {
    if m < nums[i] { m = nums[i] }
  }
  return m
}
func ceil(n int64,m int64) int64 {
  if n%m == 0 {
    return n/m
  } else {
    return n/m+1
  }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    ll s;
    cin >> s;
    ll ee = 1e9;
    ll x = (ee-s%ee)%ee;
    cout << "0 0 1000000000 1 " << x << sp << (s+x)/ee << endl;



    return 0;
}


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

const int N = 110;

char s[N];

int main(){
	scanf("%s", s + 1);
	int len = strlen(s + 1);
	int min = INT_MAX;
	for (int i = 0; i < 26; ++ i){
		s[len + 1] = i + 'a';
		int pre = 0, max = 0;
		for (int j = 1; j <= len + 1; ++ j){
			if (s[j] == i + 'a'){
				max = std::max(max, j - pre - 1);
				pre = j;
			}
		}
		min = std::min(min, max);
	}
	return printf("%d\n", min), 0;
}

Measured memory_bytes: 256
///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include<bits/stdc++.h>
using namespace std;
#define MAX 1e6+10
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__  ios_base::sync_with_stdio(false);
using ll=long long int  ;
using dl =double;
const int N = 2e5 + 10;
ll aarray[200000+10];
ll magic[101][101];
vector<ll>primes;
bool prime[1000001];
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    makefast__
    string str;
    ll i,j,n,m,k,t,ans=0,r=0;
    cin>>n;
    cin>>str;
    for(i=0;i<str.length();i++)
    {
        if(str[i]=='R')
            r++;
    }
    for(i=0;i<r;i++)
    {
        if(str[i]=='W')
            ans++;
    }
    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 3780
import java.io.*; 

class Main
{

	public static void main(String[] a) throws IOException
	{
		int x[]=new int[100];
		int k=0;

		BufferedReader d =new BufferedReader(new InputStreamReader(System.in));

		for(int i=0;i<10;i++)
		{
			String str=d.readLine();
			x[i]=Integer.parseInt(str);
		}

		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				if(x[i]>x[j])
				{
					k=x[i];
					x[i]=x[j];
					x[j]=k;
				}
			}
		}

		for(int i=0;i<3;i++)System.out.println(x[i]);
	}
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;

  A*=100;
  B*=100;
  double tmp=-1;
  double lim=(double)E / (100+E);
  int ans_w=0;
  int ans_s=0;
  REP(a,F/A+1)REP(b,(F-a*A)/A+1)REP(c, (F-a*A-b*B)/C+1)REP(d, (F-a*A-b*B-c*C)/D+1){
    if(a+b==0 || a*A+b*B+C*c+D*d > F)continue;

    double s;
    s = (double)(c*C) + (double)(d*D);
    s /= (A*a + B*b + C*c + D*d);

    if(lim<s)continue;
    if(tmp<s){
      ans_w = A*a + B*b;
      ans_s = C*c + D*d;
      tmp=s;
    }

  }
  cout << ans_w + ans_s << " " << ans_s << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,k,a[200050],tag[200050],cnt;
bool vis[200050];
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
		cin>>a[i],a[i]--;
	long long now=0,len=1;
	while(vis[now]!=1)
	{
		vis[now]=1;
		tag[now]=++cnt;
		if(cnt>k)
		{
			cout<<now+1;
			return 0;
		}
		now=a[now];
		len++;
	}
	k-=tag[now];
	k++;
	len=cnt-tag[now]+1;
//	cout<<now<<' '<<len<<' ';
	k%=len;
	for(int i=0;i<k;i++)
	{
		now=a[now];
	}
	cout<<now+1;
	return 0;
}

Measured memory_bytes: 6932
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int num1,num2;
char s[5];
int main()
{
	scanf("%s",s+1);
	for (int i=1;i<=3;i++) if (s[i]=='A') num1++;else num2++;
	if (num1 && num2) printf("Yes\n");else printf("No\n");
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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 ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int n,m;cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
    return 0;
}





Measured memory_bytes: 3604
#include <iostream>
#include <map>
using namespace std;
typedef long long LL;
const int MAXN = 2e5 + 10;
LL nums[MAXN];

LL solve(int n) {
    if (nums[0] != 0) return -1;
    LL ret = 0;
    map<LL, LL> table;
    for (int i = 0; i < n; i++) {
        if (nums[i] == 0) continue;
        LL pos = i - nums[i];
        if (pos < 0) return -1;
        if (nums[i-1]+1 < nums[i]) return -1;
        if (table.find(pos) == table.end()) {
            table[pos] = pos;
        }
        ret += i - table[pos];
        table[pos] = i;
    }
    return ret;

}

int main() {
//    freopen("test.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> nums[i];
    }
    cout << solve(n) << endl;



    return 0;
}

Measured memory_bytes: 13440
program main
    implicit none
    integer(8):: n
    integer(8),allocatable:: a(:), cnt(:), ans(:)
    integer(8):: i,j, tn, csum

    read*, n
    allocate(a(n), cnt(n), ans(n))
    read*, a(:)

    cnt(:) = 0

    do i=1, n
        cnt(a(i)) =cnt(a(i)) + 1
    end do


    csum = sum((cnt(:)*(cnt(:)-1))/2)
    

    do i=1, n
        ans(i) = csum - (cnt(a(i))-1)
    end do

    print*, ans(:)
end program main

Measured memory_bytes: 10112
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	int n, m;
	cin >> n >> m;
	
	int ss[m];
	for (int i = 0; i < m; i++)
	{
		int k;
		cin >> k;
		
		int sm = 0;
		for (int j = 0; j < k; j++)
		{
			int s;
			cin >> s;
			sm |= (1 << (s - 1));
		}
		
		ss[i] = sm;
	}
	
	int ps[m];
	for (int i = 0; i < m; i++)
	{
		int p;
		cin >> p;
		ps[i] = p;
	}
	
	int counter = 0;
	for (int i = 0; i < (1 << n); i++)
	{
		bool flag = true;
		for (int j = 0; j < m; j++)
		{
			if ((__builtin_popcount(ss[j] & i) % 2 ) != ps[j])
			{
				flag = false;
				break;
			}
		}
		
		if (flag == true)
		{
			counter++;
		}
	}
	
	cout << counter << endl;

#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
    int n;
    int k;
    cin >> n >> k;
    int result = 0;
    for(int i = 0; i < n; i++){
        int height;
        cin >> height;
        if(k <= height){
            result++;
        }
    }
    cout << result << endl;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int i;
  for(i = s.length() / 2 - 1; i > 0; i--) {
    string a(i, ' '), b(i, ' ');
    for(int j = 0; j < i; j++) a[j] = s[j], b[j] = s[i + j];
    if(a == b) break;
  }
  cout << i * 2 << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
  vector<int >prob(n,0);
  int sumi=0;
  for(int i=0;i<n;i++){cin>>prob[i];sumi+=prob[i];}
  int m;cin>>m;
  int final = sumi;
  for(int i=0,j,x;i<m;i++){
  	cin>>j>>x;
    cout<<sumi-prob[j-1]+x<<'\n';
  }
}

Measured memory_bytes: 384
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int a[100010], dp[100010];
signed main() {
    int N, M; cin >> N >> M;
    for(int i=0; i<M; i++) {
        int v; cin >> v;
        a[v] = 1;
    }

    dp[0] = 1;
    for(int i=0; i<N; i++) {
        if(a[i]) continue;
        (dp[i+1] += dp[i]) %= MOD;
        (dp[i+2] += dp[i]) %= MOD;
    }
    cout << dp[N] << endl;
    return 0;
}


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

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    if(s[0]=='9' || s[1]=='9')cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

struct angle{
	int x,y,delta;
	bool operator<(const angle &a)const{
		return y*a.x==x*a.y ? delta<a.delta : y*a.x<x*a.y;
	}
};

#define O(i,j) (0<=i && i<h && 0<=j && j<w && B[i][j]=='#')
#define X(i,j) (!O(i,j))

int main(){
	int h,w; scanf("%d%d",&h,&w);
	char B[600][601];
	rep(i,h) scanf("%s",B[i]);

	vector<angle> A;
	rep(i,h+1) rep(j,w+1) {
		if(O(i-1,j-1) && X(i-1,j)
		&& X( i ,j-1) && X( i ,j)) A.push_back((angle){j,h-i,1});
		if(X(i-1,j-1) && O(i-1,j)
		&& O( i ,j-1) && O( i ,j)) A.push_back((angle){j,h-i,1});
		if(O(i-1,j-1) && O(i-1,j)
		&& O( i ,j-1) && X( i ,j)) A.push_back((angle){j,h-i,-1});
		if(X(i-1,j-1) && X(i-1,j)
		&& X( i ,j-1) && O( i ,j)) A.push_back((angle){j,h-i,-1});
	}
	sort(A.begin(),A.end());

	int ans=1,num=1;
	rep(i,A.size()) num+=A[i].delta, ans=max(ans,num);
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;
int MAX_N = (int)1e3 + 1;

vector<int> factorize(int n) {
    vector<int> r(MAX_N);
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            r.at(i)++;
            n /= i;
        }
    }
    if (n != 1)
        r[n] = 1;
    return r;
}

signed main() {
    int n;
    cin >> n;
    vector<int> v(MAX_N);
    for (int i = 2; i < n + 1; i++) {
        vector<int> r = factorize(i);
        for (int j = 2; j < MAX_N; j++) {
            v[j] += r[j];
        }
    }
    int ans = 1;
    for (auto && x : v) {
        ans = (ans * (x + 1)) % MOD;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(void)
{
    int n;
    char sti[21];
    scanf("%s",sti);
    n=strlen(sti);
    for(int i=n-1;i>=0;i--){
        cout<<sti[i];
    }
    cout<<"\n";
}

Measured memory_bytes: 1112
#!/usr/bin/env python3
import sys


def solve(N: int, V: "List[int]", C: "List[int]"):
    total = 0
    for i in range(N):
        if V[i] > C[i]:
            total += V[i] - C[i]
    print(total)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, V, C)

if __name__ == '__main__':
    main()


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

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

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static String[] combi={"ld","mb","mp","nc","nd","ng","nt","nw","ps","qu","cw","ts"};
	static int[][] table;
	public static void main(String[] args) throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		int N=Integer.parseInt(br.readLine());
		table=new int[38][38];
		while(N--!=0){
			String[] s=br.readLine().split(" ");
			for(int i = 0;i<s.length;i++){
				s[i]=s[i]+"   ";
				int before=-1;
				int now=-1;
				for(int j = 0;j<s[i].length();j++){
					if(s[i].charAt(j)==' '){
						break;
					}
					boolean f = false;
					for(int k = 0;k<12;k++){
						if(s[i].substring(j,j+2).equals(combi[k])){
							f=true;
							now=26+k;
							j++;
							break;
						}
					}
					if(!f){
						now=s[i].charAt(j)-'a';
					}
					if(before!=-1){
						table[before][now]++;
//						System.out.println(before+" "+now);
					}
					before=now;
				}
			}
		}
		for(int i = 0;i<38;i++){
			int max=0;
			int maxIdx=0;
			for(int j = 0;j<38;j++){
				if(max<table[i][j]){
					max=table[i][j];
					maxIdx=j;
				}
			}
			if(max!=0){
				System.out.println(out(i)+" "+out(maxIdx)+" "+max);
			}
			else{
				System.out.println(out(i)+" a "+max);
			}
		}
	}
	static String out(int a){
		if(a<26){
			char re = (char)(a+'a');
			//System.out.println("aaaaaaa"+a);
			String rere=String.valueOf(re);
			return rere;
		}
		else{
			a-=26;
			return combi[a];
		}
	}
}

Measured memory_bytes: 11000
def merge(l, r, compare):
    result = []
    i, j = 0, 0
    while i < len(l) and j < len(r):
        if compare(l[i], r[j]):
            result.append(l[i])
            i += 1
        else:
            result.append(r[j])
            j += 1
    while (i < len(l)):
        result.append(l[i])
        i += 1
    while (j < len(r)):
        result.append(r[j])
        j += 1
    return result
def mergesort(L, compare = lambda x, y : x < y):
    if len(L) < 2:
        return L[:]
    else:
        middle = len(L)//2
        l = mergesort(L[:middle], compare)
        r = mergesort(L[middle:], compare)
        return merge(l, r, compare)

N = int(input())
An = list(map(int, input().split()))
for i in range(N):
    An[i] -= i + 1
Bn = mergesort(An)
midN = Bn[N//2]

ans = 0
for i in range(N):
    ans += abs(Bn[i] - midN)

print(ans)


Measured memory_bytes: 26016
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  long long int s=0;
  for(int i=0;i<n-1;i++){
    if(a[i]>a[i+1])
    {
        s=s+abs(a[i+1]-a[i]);
        a[i+1]=a[i];
    }
  }
  cout<<s;
}


Measured memory_bytes: 4432
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
for i in range(n):
    if(i%2==0):
        b.append(a[i])
    else:
        b.appendleft(a[i])

for i in range(n) if n%2==0 else (reversed(range(n))):
    print(b[i],end=' ')

Measured memory_bytes: 25412
// template version 1.13
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,k;cin>>n>>k;
  vector<int> a(n);
  rep(i, n) {
    cin>>a[i];
  }
  sort(all(a));
  reverse(all(a));
  dump(a);

  vector<int> f(n);
  rep(i, n) {
    cin>>f[i];
  }
  sort(all(f));
  dump(f);

  int left = -1;
  int right = 1e12;
  auto isright = [&](int x) {  // k個減らしてx以下に出来るか
    int vk = k;
    rep(i, n){
      int m = x/f[i];
      if (a[i]<=m){
      }
      else{
        vk -= a[i]-m;
      }
    }
    if (vk>=0) return true;
    else return false;
  };
  while (right-left>1){
    int mid = (right+left)/2;
    if (isright(mid)) { right = mid;}
    else{ left = mid; }
  }
  dump(right);

  cout << right << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	int ans = 0;
	for(int i=0;i<N;i++){
		cin >> a[i];
		ans += a[i]-1;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

// USE next_permutation
// REFERENCE: https://drken1215.hatenablog.com/entry/2020/01/12/122100
int main(void)
{
    int N;
    cin >> N;

    vector<int> p(N);
    vector<int> q(N);
    for (int i = 0; i < N; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> q[i];
    }

    map<vector<int>, int> ord;
    int iter = 0;

    vector<int> v(N);
    for (int i = 0; i < N; i++)
    {
        v[i] = i + 1;
    }

    // next_permutaion
    do
    {
        ord[v] = iter;
        iter++;
    } while (next_permutation(v.begin(), v.end()));

    int ans = abs(ord[p] - ord[q]);
    cout << ans << endl;
}

Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
inline ll gcd(ll a, ll b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }



int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int N, M; cin >> N >> M; vector<Point> vec;
    for(int i = 0; i < M; i++) { int a, b; cin >> a >> b; vec.push_back(Point{a, b}); }
    sort(vec.begin(), vec.end(), [](Point a, Point b) { return a.y < b.y; });
    
    int prev = 0;
    int ret = 0;
    
    for(auto v : vec)
    {
        if(v.x <= prev) continue;
        prev = v.y - 1;
        ret += 1;
    }
   
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,a[300010];

int main(){
	cin >> n;
	REP(i,0,3*n) cin >> a[i];
	sort(a,a+3*n); reverse(a,a+3*n);
	
	ll s=0;
	REP(i,0,n) s+=a[i*2+1];
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 1408