akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( 1e9 + 7 )


int main()
{
	int r, D, x;
	cin >> r >> D >> x;

	rep( i, 10 )
	{
		x = r * x - D;
		cout << x << endl;
	}

	return ( 0 );
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  //input
  int N;
  cin >> N;
  vector <int> L(N);
  rep(i,N) cin >> L[i];

  //solve
  sort(all(L));
  if (L[N - 1] < accumulate(all(L), 0) - L[N - 1]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3616
#include<cstdio>
#include<algorithm>
using namespace std;const int N=3*1e6+10;typedef long long ll;const ll mod=998244353;
inline ll po(ll a,ll p){ll r=1;for(;p;p>>=1,a=a*a%mod)if(p&1)r=r*a%mod;return r;}
int n;int m;ll fac[N];ll ifac[N];
inline ll c(int a,int b){return fac[a]*ifac[b]%mod*ifac[a-b]%mod;}
int main()
{
	scanf("%d%d",&n,&m);if(n<m)swap(n,m);
	fac[0]=1;for(int i=1;i<=n+m;i++)fac[i]=fac[i-1]*i%mod;ifac[0]=ifac[1]=1;
	for(int i=2;i<=n+m;i++)ifac[i]=(mod-mod/i)*ifac[mod%i]%mod;
	for(int i=1;i<=n+m;i++)(ifac[i]*=ifac[i-1])%=mod;
	ll tans=0;for(int i=1;i<=m;i++)
		(tans+=c(i+i-1,i)*c(n+m-i-i,n-i))%=mod;
	tans=(mod-tans)%mod;(tans+=(n-m)*c(m+n,m-1))%=mod;
	if(m!=n)
	{
		for(int i=1;i<=m;i++)
			(tans+=c(m+i,i)*i%mod*c(n-i-1,m-i))%=mod;	
	}else (tans+=c(n+m,m)*m)%=mod;
	tans=tans*po(c(n+m,m),mod-2)%mod;
	tans=(n+m+mod-tans)%mod;
	printf("%lld\n",tans);return 0;
}

Measured memory_bytes: 18560
S = input()
k = int(input())

prev = S[0]
cnt = 0
for i in range(1,len(S)):
    if prev == S[i]:
        cnt += 1
        prev = "$"
        continue
    prev = S[i]

ans = k*cnt

if S[0] == S[-1]:
    m = 0
    for s in S:
        if s == S[0]:
            m += 1
        else:
            break
    a = 0
    for s in S[::-1]:
        if s == S[-1]:
            a += 1
        else:
            break
    if a%2 and m%2:
        ans += k-1
if len(set(S)) == 1:
    ans = (len(S)*k//2)
print(ans)

Measured memory_bytes: 61800
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	int s, w;
	cin >> s >> w;
	if(w >= s) cout << "unsafe";
	else cout << "safe";
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  vector<ll> C(N-1, 0);
  vector<ll> S(N-1, 0);
  vector<ll> F(N-1, 0);
  REP(i, N-1){
    cin >> C[i] >> S[i] >> F[i];
  }
  REP(i, N-1){
    ll ans = 0;
    for(int j = i; j < N -1; j++){
      ans += C[j] + (S[j] >= ans ? S[j] - ans : (ans - S[j])%F[j] == 0 ? 0 : F[j] - (ans - S[j])%F[j]);
    }
    cout << ans << endl;
  }
  cout << 0 << endl;
}

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

fn main() {
    let N: usize = read_line()[0];
    let mut X_N: Vec<usize> = read_line();
    let M: usize = read_line()[0];
    let A_M: Vec<usize> = read_line();
    
    for i in 0..M {
        if (X_N[A_M[i]-1] != 2019) && ((A_M[i] == N) || (X_N[A_M[i]] != X_N[A_M[i]-1] + 1)) {
            X_N[A_M[i]-1] += 1;
        }
    }
    for i in 0..N {
        println!("{}", X_N[i]);
    }
}



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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

const int MOD = 998244353;


int main()
{
    int N;
    cin >> N;
    vector<int> D(N);
    REP(i, N) cin >> D[i];

    vector<int> count(N);
    REP(i, N) ++count[D[i]];

    if(D[0] != 0 or count[0] != 1){
        cout << 0 << endl;
        return 0;
    }

    long long ans = 1;
    FOR(i, 1, N){
        REP(_, count[i]){
            ans *= count[i-1];
            ans %= MOD;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
n = int(input())
h_list = list(map(int, input().split()))

ans = 0
pos = 0

while pos <= n:
    cnt = 0

    for i in range(pos, n-1):
        if h_list[i] >= h_list[i+1]:
            cnt += 1
        else:
            break
    
    if cnt > ans:
        ans = cnt

    pos += (cnt+1)

print(ans)

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

typedef long long lli;
const lli INF = 1LL<<60LL;

typedef lli T;
class SegmentTree {
private:
  int n;
  vector<T> dat_min, lazy_add;

public:
  SegmentTree() {}

  SegmentTree(int _n) {
    n = 1;
    while (n < _n) n *= 2;
    dat_min = lazy_add = vector<T>(n*2-1, 0);
  }

  inline void evaluation(int k, int l, int r) {
    dat_min[k] += lazy_add[k];
    if (k < n-1) {
      lazy_add[k*2+1] += lazy_add[k];
      lazy_add[k*2+2] += lazy_add[k];
    }
    lazy_add[k] = 0;
  }

  void add(int a, int b, T x, int k = 0, int l = 0, int r = -1) {
    if (r == -1) r = n;
    evaluation(k, l, r);
    if (r <= a || b <= l) return;
    if (a <= l && r <= b) {
      lazy_add[k] += x;
      evaluation(k, l, r);
      return;
    }
    add(a, b, x, k*2+1, l, (l+r)/2);
    add(a, b, x, k*2+2, (l+r)/2, r);
    dat_min[k] = min(dat_min[k*2+1], dat_min[k*2+2]);
  }

  T mini(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r == -1) r = n;
    evaluation(k, l, r);
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat_min[k];
    T v1 = mini(a, b, k*2+1, l, (l+r)/2);
    T v2 = mini(a, b, k*2+2, (l+r)/2, r);
    return min(v1, v2);
  }
};


int main() {
  lli N;
  while (cin >> N) {
    vector<lli> S(N);
    for (lli i = 0; i < N; ++i) {
      cin >> S[i];
    }
    SegmentTree a(N/2), b(N/2);
    for (lli i = 0; i < N/2; ++i) {
      lli x = S[i] - S[N-i-1];
      a.add(i, i + 1, x);
      b.add(i, i + 1, -x);
    }
    const lli m = N/2;
    lli Q;
    cin >> Q;
    while (Q--) {
      lli l, r, x;
      cin >> l >> r >> x;
      --l; --r;
      if (l < m) {
        a.add(l, min(r+1, m), x);
        b.add(l, min(r+1, m), -x);
        //cout << "+[" << l << "," << min(r+1, m) << "] ";
      }
      if (m <= r) {
        a.add(N - r - 1, min(N/2, N - l), -x);
        b.add(N - r - 1, min(N/2, N - l), x);
        //cout << "-[" << N-r-1 << "," << min(N/2, N - l) << "]";
      }
      //cout << endl;
      if (a.mini(0, m) == 0 && b.mini(0, m) == 0) {
        cout << 1 << endl;
      } else {
        cout<<  0 << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 25448
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n; cin >> n;
    int a, b;
    if (n == 2) {
        cin >> a >> b;
        cout << a+b << endl;
    }
    else {
        cout << "Hello World" << endl;
    }
}

Measured memory_bytes: 256
#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() {
  int k, n;
  cin >> k >> n;
  int a[n+1];
  rep(i,n) cin >> a[i];
  a[n] = a[0]+k;

  int dis = 0; 
  int ans;
  rep(i,n) {
    dis = max(dis, a[i+1] - a[i]);
  }
  ans = k - dis;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
S = input()

cnt1=0
cnt0=0
for i in range(len(S)):
    if S[i]=='0':
        cnt0+=1
    elif S[i]=='1':
        cnt1+=1
if cnt1 == 0 or cnt0 == 0:
    print(0)
else:
    if cnt1>cnt0:
        print(cnt0*2)
    else:
        print(cnt1*2)


Measured memory_bytes: 3188
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> vs(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> vs[i];
    }

    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (vs[vs[i]] == i)
        {
            count++;
        }
    }
    cout << (count / 2) << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
bool t=1;
int main()
{

    cin>>n>>a>>b;
    while(1)
    {
        if(a==(b-1))break;
        if(t)
        {
            a++;
            t=0;
        }
        else
        {
            b--;
            t=1;

        }
    }
    if(!t)
    {
        cout<<"Alice\n";
    }
    else
        cout<<"Borys\n";



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e;
	if (a == 0)
	{
		f = 1;
	}
	else if (b == 0)
	{
		f = 2;
	}
	else if (c == 0)
	{
		f = 3;
	}
	else if (d == 0)
	{
		f = 4;
	}
	else if (e == 0)
	{
		f = 5;
	}
	cout << f <<"\n";
	return 0;
}

Measured memory_bytes: 3608
#pragma GCC optimize("03")
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ll long long int
using namespace std;

#define N 1000001
const ll mod = 1000000007;

int lpf[N], mobius[N];

void least_prime_factor()
{
	for (int i = 2; i < N; i++)
		if (!lpf[i])
			for (int j = i; j < N; j += i)
				if (!lpf[j])
					lpf[j] = i;
}

void Mobius()
{
	for (int i = 1; i < N; i++) {
		if (i == 1)
			mobius[i] = 1;
		else {

			if (lpf[i / lpf[i]] == lpf[i])
				mobius[i] = 0;

			else
				mobius[i] = -1 * mobius[i / lpf[i]];
		}
	}
}

int gcd_pairs(int a[], int n)
{
	int maxi = 0;

	int fre[N] = { 0 };

	for (int i = 0; i < n; i++) {
		fre[a[i]]++;
		maxi = max(a[i], maxi);
	}

	int ans = 0;
	for (int i = 1; i <= maxi; i++) {
		if (!mobius[i])
			continue;

		int temp = 0;
		for (int j = i; j <= maxi; j += i)
			temp += fre[j];

		ans += (temp * (temp - 1)) / (2 * mobius[i]);
	}

	return ans;
}

void solve() {
	least_prime_factor();
	Mobius();
	int n; cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	int s = a[0];
	for (int i = 1; i < n; i++) s = __gcd(s, a[i]);
	if (gcd_pairs(a, n) == n * (n - 1) / 2) {
		cout << "pairwise coprime";
	}
	else if (s == 1) {
		cout << "setwise coprime";
	}
	else {
		cout << "not coprime";
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin >> t;
	t = 1;
	while (t--) {
		solve();
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 19156
#include <iostream>
#include <string>
#include <set>
#include <cmath>
#include <algorithm>
#define llint long long
#define eps 1e-9
#define inf 1e18
#define PI 3.14159265358979323846264

using namespace std;

struct vec2d{
	double x, y;
	vec2d(){}
	vec2d(double x, double y){
		this->x = x, this->y = y;
	}
	double add(double a, double b){
		if(fabs(a+b) < eps * (fabs(a) + fabs(b))) return 0.0;
		return a+b;
	}
	vec2d operator+(vec2d ope){
		return vec2d(add(x, ope.x), add(y, ope.y));
	}
	vec2d operator-(vec2d ope){
		return vec2d(add(x, -ope.x), add(y, -ope.y));
	}
	vec2d operator*(double t){
		return vec2d(x*t, y*t);
	}
	vec2d operator/(double t){
		return vec2d(x/t, y/t);
	}
	double dot(vec2d ope){
		return add(x*ope.x, y*ope.y);
	}
	double cross(vec2d ope){
		return add(x*ope.y, -y*ope.x);
	}
	double norm(){
		double d2 = dot(*this);
		if(d2 > 0) return sqrt(d2);
		return 0.0;
	}
};

llint n;
double r, th;
vec2d p[25];
double dp[10005][20][20];
double dist[25][25];
bool can[25][25][25];

int main(void)
{
	cin >> n;
	cin >> r >> th;
	for(int i = 0; i < n; i++) cin >> p[i].x >> p[i].y;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i == j) continue;
			for(int k = 0; k < n; k++){
				if(i == k) continue;
				vec2d u = p[i]-p[j], v = p[k]-p[i];
				double ang = acos(u.dot(v)/(u.norm()*v.norm()));
				if(ang * 180 / PI <= th + eps){
					can[i][j][k] = true;
					//cout << j << " " << i << " " << k << endl;
				}
			}
			dist[i][j] = (p[i]-p[j]).norm();
		}
	}
	
	for(int i = 0; i <= 10000; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < n; k++){
				dp[i][j][k] = inf;
			}
		}
	}
	dp[0][0][0] = 0;
	for(int i = 0; i < 10000; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < n; k++){
				for(int l = 0; l < n; l++){
					if(j == l) continue;
					if(i != 0 && !can[j][k][l]) continue;
					dp[i+1][l][j] = min(dp[i+1][l][j], dp[i][j][k] + dist[j][l]);
				}
			}
		}
	}
	
	llint ans = 0;
	for(int i = 0; i <= 10000; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < n; k++){
				if(dp[i][j][k] <= r + eps) ans = i;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 34836
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N, L;
    io.read(N, L);
    auto S = io.read_vec<string>(N);
    sort(S.begin(), S.end());
    for(int i = 0; i < N; i++){
        cout << S[i];
    }
    return 0;
}

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

const int INF = 1e9+7;

struct L {
  int a, b, c;
  L(int a=0, int b=0, int c=0): a(a), b(b), c(c) {}
};
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int main() {
  int n, m; cin >> n >> m;
  map<int, int> xmp, ymp;
  xmp[0] = 0, ymp[0] = 0;

  vector<L> lh, lv;
  rep(i,n) {
    int a, b, c;
    cin >> a >> b >> c;
    xmp[a] = 0;
    xmp[b] = 0;
    ymp[c] = 0;
    lv.emplace_back(a,b,c);
  }
  rep(i,m) {
    int a, b, c;
    cin >> c >> a >> b;
    ymp[a] = 0;
    ymp[b] = 0;
    xmp[c] = 0;
    lh.emplace_back(a,b,c);
  }

  vec xs, ys;
  for (auto& p: xmp) {
    p.second = xs.size();
    xs.push_back(p.first);
  }
  for (auto& p: ymp) {
    p.second = ys.size();
    ys.push_back(p.first);
  }

  int h = xs.size()*2;
  int w = ys.size()*2;

  vector<vec> d(h, vec(w));
  rep(i,n) {
    int a = xmp[lv[i].a]*2;
    int b = xmp[lv[i].b]*2;
    int c = ymp[lv[i].c]*2;
    for (int x = a; x <= b; x++) d[x][c] = -1;
  }
  rep(i,m) {
    int a = ymp[lh[i].a]*2;
    int b = ymp[lh[i].b]*2;
    int c = xmp[lh[i].c]*2;
    for (int y = a; y <= b; y++) d[c][y] = -1;
  }

  // bfs
  queue<P> q;
  int sx = xmp[0]*2, sy = ymp[0]*2;
  d[sx][sy] = 1;
  q.emplace(sx,sy);
  while (!q.empty()) {
    P p = q.front(); q.pop();
    int x = p.first, y = p.second;
    rep(v,4) {
      int nx = x+dx[v], ny = y+dy[v];
      if (nx >= 0 && nx < h && ny >= 0 && ny < w && d[nx][ny] == 0) {
        q.emplace(nx, ny);
        d[nx][ny] = 1;
      }
    }
  }

  ll ans = 0;
  rep(x,h) rep(y,w) {
    if (d[x][y] != 1) continue;
    if (x == 0 || x == h-1 || y == 0 || y == w-1) {
      cout << "INF" << endl;
      return 0;
    }
    if (x%2 == 0 || y%2 == 0) continue;
    ll ex = xs[x/2+1] - xs[x/2];
    ll ey = ys[y/2+1] - ys[y/2];
    ans += ex*ey;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 144376
open Num

let () =
  let rec read x ls =
    if x = 0 then ls
    else
      let t = read_line () in
      read (x-1) (num_of_string t :: ls) in
  let rec gcd x y =
    if y =/ (num_of_int 0) then x
    else gcd y (mod_num x y) in
  let lcm x y =
    let d = gcd x y in quo_num (x */ y) d in
  let n = read_int () in
  let ls = read n [] in
  List.fold_left lcm (num_of_int 1) ls |> string_of_num |> print_endline


Measured memory_bytes: 2432
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
#include<vector>
#include<algorithm>
#include<string>
typedef long long ll;
using namespace std;

int main(void) {
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(x - a) >= abs(x - b))cout << "B" << endl;
	else cout << "A" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,i,j,tct=0,ct=0;
    scanf("%d\n",&n);
    char arr[n+1];
    scanf("%s",arr);
    i=0;
    j=n-1;
    while(1)
    {
        if(arr[i]=='W') 
        {
            ct++;
            if(arr[i+1]=='R')
            {
                while(ct>0)
                {
                    if(arr[j]=='R')
                    {
                        ct--;
                        tct++;
                    }
                    j--;
                    if(j==i) goto end;
                }
            }
        }
        i++;
        if(j==i) goto end;
    }
    end:
    {
        printf("%d",tct);
    }
    return 0;
}

Measured memory_bytes: 1924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){
    ll n;cin>>n;
    ll s[n];
    rep(i,0,n-1){
        cin>>s[i];
    }
    bool dp[n+1][10010];
    rep(i,0,n){
        rep(j,0,10001){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    rep(i,0,n-1){
        rep(j,0,10001){
            if(dp[i][j]){
                dp[i+1][j]=1;
                dp[i+1][j+s[i]]=1;
            }
        }
    }
    ll ans=0;
    rep(i,0,10001){
        if(dp[n][i]){
            if(i%10==0){
                
            }else{
                ans=max(ans,i);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1280
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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 mut $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:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n:usize,
        a:[usize;n],
        q:usize,
        bcs:[(usize,usize);q],
    }
    let mut count_map = HashMap::<usize, usize>::with_capacity(n);

    for ai in a.iter() {
        count_map.insert(*ai, count_map.get(ai).unwrap_or(&0) + 1);
    }

    let mut s = Vec::with_capacity(q + 1);
    s.push(
        count_map
            .iter()
            .fold(0 as u64, |s, (k, v)| s + (k * v) as u64),
    );
    for (b, c) in bcs.iter() {
        if let Some(aic) = count_map.get(b) {
            let aic = aic.clone();
            let cc = (*c * aic) as u64;
            let bc = (*b * aic) as u64;
            let current = *s.last().unwrap();
            s.push(current + cc - bc);
            count_map.insert(*c, count_map.get(c).unwrap_or(&0) + aic);
            count_map.remove(b);
        } else {
            s.push(*s.last().unwrap());
        }
    }

    s[1..]
        .iter()
        .fold(String::with_capacity(q * 2), |mut s, v| {
            s.push_str(&format!("{}\n", v));
            s
        })
}
test! {
    include_str!("d1_in.txt") => include_str!("d1_out.txt"),
    include_str!("d2_in.txt") => include_str!("d2_out.txt"),
    include_str!("d3_in.txt") => include_str!("d3_out.txt")
}


Measured memory_bytes: 10348
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecpll vector<pll>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

int main(){
    cout<<in()*in()<<endl;
}

Measured memory_bytes: 3692
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;

    static int N;
    static int[] A;
    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
        A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = cin.nextInt() - i - 1;
        }
    }
    static void solve()
    {
        input();
        Array.Sort(A);
        long ans = 0;
        for(int i = 0; i < N; i++)
        {
            ans += Abs(A[i] - A[N / 2]);
        }
        WriteLine(ans);
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 35972
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  int p;
  vector<int> win;
  vector<int> penalty;
  win.assign(n+1,0);
  penalty.assign(n+1,0);
  string s;
  int i;
  for(i=0;i<m;i++)
  {
    cin>>p>>s;
    if(win[p]!=1)
    {
    	if(s=="WA")
          penalty[p]++;
      	else if(s=="AC")
          win[p]=1;
    }
  }
  int c=0,pe=0;
  for(i=1;i<=n;i++)
  {
    if(win[i]==1)
    {
    	pe+=penalty[i];
    }
    c+=win[i];
  }
  cout<<c<<" "<<pe;
  return 0;
}
  


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;

vector<int> odd;
vector<int> like2017;
int q;
int ir[100002][2];

void oddmaker(){
odd.push_back(2);
for (int i = 2; i < 100000; i++){
  bool flag = true;
  int sq = sqrt(i);
  sq = max(sq,2);
  for (int k = 2; k <= sq; k++){
    if(i%k == 0){
      flag = false;
      break;
    }
  }
  if(flag) odd.push_back(i);

}
int t = -1;
while(true){
  t++;
  if(odd[t] > 50001) break;
  auto itr = find(odd.begin(), odd.end(), 2*odd[t]-1);
  if( itr != odd.end() ) { like2017.push_back(2*odd[t]-1);

  }
}





}







int main(){

oddmaker();
like2017.push_back(100001);
//  for(auto itr = like2017.begin(); itr != like2017.end(); ++itr) {
//    cout << *itr << endl;
//  }


//cout << like2017.size() << endl;



cin >> q;
for (int i = 0; i < q; i++){
  cin >> ir[i][0] >> ir[i][1];
}

for (int i = 0; i < q; i++){
  int s = 0;
  int e = 0;
  int count = 0;
  for(auto itr = like2017.begin(); itr != like2017.end(); ++itr) {
    count++;
    if (s == 0 && *itr >= ir[i][0]) s = count;
    if (*itr > ir[i][1]){
      e = count;
      break;
    }
  }


cout << e-s << endl;


}

return 0;
}


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

int main(){

    int n,mid;
    cin>>n;
    vector<int> x(n);
    vector<int> cp(n);

    for(int i=0; i<n; i++){
        cin>>x[i];
        cp[i] = x[i];
    }

    sort(x.begin(),x.end());
    mid = x[n/2];

    for(int i=0; i<n; i++){
        if(cp[i] < mid) cout<<mid<<endl;
        else cout<<x[n/2-1]<<endl;
    }

    return 0;
}


Measured memory_bytes: 3712
#

import sys
input=sys.stdin.readline

def main():
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    cnt=0
    suma=sum(A)
    for i in range(n):
        if A[i]>=suma/(4*m):
            cnt+=1
    if cnt>=m:
        print("Yes")
    else:
        print("No")
    
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 61952
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int maxn=200005;

int n,m,ans;
int a[maxn],fa[maxn];

int find(int x)
{
	if (fa[x]==x) return x;
	return fa[x]=find(fa[x]);
}

int main()
{
	
	scanf("%d%d",&n,&m);
	for (int i=1; i<=n; i++)
	{
		scanf("%d",&a[i]);
		fa[i]=i;
	}
	int x,y,fx,fy;
	for (int i=1; i<=m; i++)
	{
		scanf("%d%d",&x,&y);
		fx=find(x),fy=find(y);
		if (fx!=fy)
			fa[fx]=fy;
	}
	
	ans=0;
	for (int i=1; i<=n; i++)
	{
		if (find(i)==find(a[i]))
			ans++;
	}
	printf("%d\n",ans);
	
	return 0;
}

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

using namespace std;

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

int data[100];
inline int root(int x) {
  return data[x] < 0 ? x : data[x] = root(data[x]);
}

void unite(int x, int y) {
  x = root(x), y = root(y);
  if(x != y) {
    if(data[y] < data[x]) swap(x, y);
    data[x] += data[y]; data[y] = x;
  }
}
  
inline bool same(int x, int y) {
  return root(x) == root(y);
}

typedef pair<int, pair<int, int> > edges;

int const INF = 1<<29;

int main() {
  
  int N, M;
  while(cin >> N >> M && (N|M)) {
    vector<edges> es;
    rep(i, M) {
      int a, b, c;
      cin >> a >> b >> c; a--, b--;
      es.push_back(make_pair(c, make_pair(a, b)));
    }
    sort(es.begin(), es.end());
    int ret = INF;
    
    for(; (int)es.size() >= N-1;) {
      memset(data, -1, sizeof data);
      int last = -1;
      int s = 0;
      rep(i, es.size()) {
	if(!same(es[i].second.first, es[i].second.second)) {
	  unite(es[i].second.first, es[i].second.second);
	  last = i;
	  s++;
	  if(s == N-1) break;
	}
      }
      rep(i, N) REP(j, i+1, N) {
	if(!same(i, j)) { goto exit; }
      }
      ret = min(ret, es[last].first-es[0].first);
      es.erase(es.begin());
    }
    
  exit:;
    cout << (ret < INF ? ret : -1) << endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1328
#include<iostream>
#include<vector>
#define INF 10000000
#define MAX 400
using namespace std;
int main(){
  int n,ma,mb,min_c=INF,ta,tb;
  cin >> n >> ma >> mb;
  int a[n],b[n],c[n];
  vector<vector<int>> dp[41];
  for(int i=0;i<41;i++){
    dp[i] = vector<vector<int> >(MAX+1,vector<int>(MAX+1,INF));
  }
  for(int i=0;i<n;i++){
    dp[i][0][0]=0;
    cin >> a[i] >> b[i] >> c[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=MAX;j++){
      for(int k=0;k<=MAX;k++){
        dp[i+1][j][k]=dp[i][j][k];
        if(j-a[i]>=0&&k-b[i]>=0){
          dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j-a[i]][k-b[i]]+c[i]);
        }
      }
    }
  }
  for(int i=1;i*ma<=MAX&&i*mb<=MAX;i++){
    ta = i*ma;
    tb = i*mb;
    min_c = min(dp[n][ta][tb],min_c);
  }
  if(min_c==INF) cout <<"-1\n";
  else cout << min_c<<endl;
}


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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    string line;
    while (cin >> line) {
        if (line == "#") break;
        vb NW;
        for (int i = 0; i < (int)line.length(); i++) {
            assert(line[i] == 'n' || line[i] == 'w');
            if (line[i] == 'n') {
                NW.push_back(true);
                i += 4;
            } else {
                NW.push_back(false);
                i += 3;
            }
        }
        if (NW.size() == 1) {
            if (NW[0]) {
                cout << 0 << endl;
            } else {
                cout << 90 << endl;
            }
        } else {
            int a = 90, b = 2;
            NW.pop_back();
            NW.pop_back();
            for (int i = NW.size()-1; i >= 0; i--) {
                b *= 2;
                a = a * 2 + (NW[i] ? -90 : 90);
            }
            while (a % 2 == 0) {
                a /= 2;
                b /= 2;
            }
            if (b == 1) {
                cout << a << endl;
            } else {
                cout << a << '/' << b << endl;
            }
        }
    }
}

Measured memory_bytes: 3084
#include <iostream>

using namespace std;

int main()
{
	int n, m, x, a;
	int r=0, l=0;

	cin >> n >> m >> x;

	for(int i = 0; i < m; i++)
	{
		cin >> a;

		if(a < x) l++;
		else r++;
	}

	if(l > r) cout << r << endl;
	else cout << l << endl;

	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

now = 1
visited = []
visited_set = set()

for i in range(1, N+1):
    visited.append(now)
    visited_set.add(now)
    now = A[now]
    if now in visited_set:
        loop_start = visited.index(now)
        loop_length = i - loop_start
        break

if K >= loop_start:
    print(visited[loop_start + (K - loop_start) % loop_length])
else:
    print(visited[K])


Measured memory_bytes: 133192
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
int read(){
	register int x = 0;
	register char f = 1, ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = 0;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
	return f ? x : -x;
}
int n;
struct node{
	int val, id;
	bool operator < (const node &b) const {
		return val > b.val || val == b.val && id < b.id;
	}
}a[100005];
long long ans[100005];
int main(){
	n = read();
	for (register int i = 1; i <= n; ++i) a[i] = (node){read(), i};
	std :: sort(a + 1, a + 1 + n);
	for (register int i = 1, j, k = 0x3f3f3f3f; i <= n; i = j){
		for (j = i; j <= n && a[j].val == a[i].val; ++j) ;
		k = std :: min(k, a[i].id);
		ans[k] += 1ll * (j - 1) * (a[i].val - a[j].val);
	}
	for (register int i = 1; i <= n; ++i) printf("%lld\n", ans[i]);
}

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

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0)cout << "Zero" << endl;
	else if (b < 0) {
		if ((abs(a) - abs(b)) % 2 == 0)
			cout << "Negative" << endl;
		else
			cout << "Positive" << endl;
	}
	else
		cout << "Positive" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long h, w;
  cin >> h >> w;
  
  if(h == 1 || w == 1){
    cout << 1 << endl;
  }else{
    cout << (h * w + 1) /2 << endl;
  }
  
}

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

const long long MOD = 1e9 + 7;

long long fast_pow(long long a, long long b, long long p){
    long long ans = 1LL;
    long long base = a % p;
    b = b % (p - 1);
    while (b){
        if (b & 1){
            ans = (ans * base) % p;
        }

        b >>= 1;
        base = (base * base) % p;
    }

    return ans;
}

long long inv(long long a, long long p){
    return fast_pow(a, p - 2, p);
}

long long C(long long n, long long m, long long p){
    if (n < m)
        return 0;

    m = min(m, n - m);
    long long nom = 1, den = 1;
    for (long long i = 1; i <= m; i++){
        nom = (nom * (n - i + 1)) % p;
        den = (den * i) % p;
    }

    return (nom * inv(den, p)) % p;
}

long long lucas(long long n, long long m, long long p){
    if (m == 0)
        return 1LL;
    return C(n % p, m % p, p) * lucas(n / p, m / p, p) % p;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long x, y;
    cin >> x >> y;
    
    long long ans = 0;
    for (long long i = 0; i <= x; i++){
        long long rem_x = x - i, rel_y = 2 * i, rem_y = y - rel_y;
        
        if (rem_x % 2 != 0)
            continue;
        else
            rem_x /= 2;

        if (rem_y != rem_x)
            continue;

        ans += lucas(rem_x + i, rem_x, MOD);
        ans %= MOD;
        
    }

    cout << ans << '\n';

    return 0;
}


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

int bottle[1000];

int main(){
	int N,R,T;
	cin >> N >> R >>T;
	
	vector<int> ps;
	for(int i = 0 ; i < N ; i++){
		int p;
		cin >> p;
		ps.push_back(p);
	}
	sort(ps.begin(),ps.end());
	for(int i = 1 ; i <= T ; i++){
		for(int j = 0 ; j < N ; j++){
			if( i == 1 ){
				bottle[(ps[j] * i) % R] = 0;
			}else{
				if( bottle[(ps[j] * i) % R] == 0 ){
					bottle[(ps[j] * i) % R]++;
				}
				bottle[(ps[j] * i) % R]--;
			}
		}
		for(int j = 0 ; j < N ; j++){
			if( i != 1 ){
				bottle[(ps[j] * i) % R]++;
			}
		}
	}
	int btls = 0;
	for(int i = 0 ; i < R ; i++){
		btls += bottle[i];
	}
	cout << N+btls << endl;
	
	
	

}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int64_t> l(n+1);
  l.at(0)=2LL;
  l.at(1)=1LL;
  for (int i=2;i<=n;i++){
    l.at(i)=l.at(i-1)+l.at(i-2);
  }
  cout << l.at(n) << endl;
}

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

Measured memory_bytes: 596
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vi isprime(999983+1,true);
	isprime[0]=isprime[1]=false;
	repi(i,2,isprime.size())
		for(int j=i+i;j<isprime.size();j+=i)
			isprime[j]=false;
	vi primes;
	rep(i,isprime.size())
		if(isprime[i])
			primes.push_back(i);
	
	for(int n;cin>>n,n;){
		int res=0;
		rep(i,n){
			int p,m; cin>>p>>m;
			int x=upper_bound(allof(primes),p+m)-lower_bound(allof(primes),p-m);
			res+=x-1;
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 4688
object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val a, b = sc.nextInt
    val result = (a,b) match {
      case (n, _) if n > 9 => -1
      case (_, n) if n > 9 => -1
      case (x,y) => x*y
    }
    println(result)
  }
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    vector<int> A;
    char prev = S[0];
    int cnt = 0;
    REP(i, N) {
        if (prev == S[i]) {
            cnt++;
        } else {
            A.push_back(cnt);
            prev = S[i];
            cnt = 1;
        }
    }
    A.push_back(cnt);

    int ans = 0;
    REP(i, A.size()) {
        if (A[i] > 1) ans += A[i] - 1;
    }
    print(min(N-1, ans + 2 * K));
}

signed main() {
    solve();
}


Measured memory_bytes: 1020
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,k = [int(i) for i in readline().split()]

def Base_10_to_k(n, k):
    if int(n/k): return Base_10_to_k(int(n/k), k)+str(n%k)
    return str(n%k)

print(len(Base_10_to_k(n, k)))

Measured memory_bytes: 3060
'use strict';
(function(stdin) {
  // define function
  var f = function(a, b, c) {
    if (a < b &&  b < c) {
      return 'Yes';
    }
    return 'No';
  };
  // declare variable
  var inputs = stdin.toString().trim().split('\n');
  var cols = inputs[0].split(' ').map(Number);
  var a = cols[0];
  var b = cols[1];
  var c = cols[2];
  // main
  console.log(f(a, b, c));
  // display

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

int main() {
  int n,a = 0,b = 0;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());
  for(int i = 0;i < n;i += 2){
    a += data.at(i);
  }
  for(int i = 1;i < n;i += 2){
    b += data.at(i);
  }
  cout << a-b << endl;
}


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

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

class dijkstra{
public:
  vector<vector<pii>> G;
  vector<ll> dist;
  vector<ll> prev;

  dijkstra(ll s,ll t,const vector<vector<pii>> &_G):G(_G){ // sからtへの最短経路
    dist.resize(G.size(),1ll << 59);
    //prev.resize(G.size(),-1);
  
    priority_queue<pii,vector<pii>,greater<pii>> que;
    que.emplace(dist[s] = 0,s);
    
    while(!que.empty()){
      ll v, d; tie(d,v) = que.top();
      que.pop();
      if(v == t) break;
      rep(i, G[v].size()){
	ll tmp = d + G[v][i].second;
	if(dist[G[v][i].first] > tmp){
	  dist[G[v][i].first] = tmp;
	  //prev[G[v][i].first] = v;
	  que.emplace(tmp, G[v][i].first);
	}
      }
    }
  }

  vector<ll> getpath(ll t){ // tへの最短経路を返す
    vector<ll> path;
    while(t != -1){
      path.push_back(t);
      t = prev[t];
    }
    reverse(path.begin(), path.end());
    return path;
  }
};

int main(){
#define int ll
  ll k; cin >> k;
  vector<vector<pii>> g(k,vector<pii>(2));
  rep(i,k){
    g[i][0] = pii((i+1)%k,1);
    g[i][1] = pii((i*10)%k,0);
  }
  dijkstra d(1,0,g);
  cout << d.dist[0]+1 << endl;
}

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


typedef long long ll;

using namespace std;



int main(){
    int N;
    string s;
    
    cin>>N;
    cin>>s;
    
    ll count=0;
/*
for(int i=0;i<4000;++i){
        int x=0+(int)(rand()*(2-0+1.0)/(1.0+RAND_MAX));
        if(x==0)s+='R';
        else if(x==1)s+='G';
        else if(x==2)s+='B';
    }
*/
    

    for(int i=0;i<N;++i){
        for(int j=i+1;2*j-i<N;++j){
            int k=j+j-i;
            if(s[i]==s[j])continue;
            if(s[j]==s[k])continue;
            if(s[k]==s[i])continue;
                ++count;
            
        }
    }
    vector<ll> vec(3,0);
    for(int i=0;i<N;++i){
        if(s[i]=='R'){
            ++vec[0];
        }else if(s[i]=='G'){
            ++vec[1];
        }else{
            ++vec[2];
        }
    }

   // cout<<count<<endl;

    if(N<=2){
        cout<<0<<endl;
    }else{
        cout<<vec[0]*vec[1]*vec[2]-count<<endl;
    }

    
}


Measured memory_bytes: 3596