akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


ll n, a[N];

void solve()
{
    cin >> n;
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a,a+n);
    ll ans=a[n-1];
    ll cnt=1;
    for (int i=n-2; i>=0; i--) {
        if (cnt==n-1) break;
        ans += a[i]; cnt++;
        if (cnt==n-1) break;
        ans += a[i]; cnt++;
    }nout(ans);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5200
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main(){
    int a1,b1,a2,b2;
    cin >> a1;
    cin >> a2;
    cin >> b1;
    cin >> b2;
    if(a1+1 == b1)cout << "1" << endl;
    else cout << "0" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n; cin >> n;
  map<int,int> m;

  rep2(i, 2, sqrt(n)) {
    while (n % i == 0) {
      ++m[i];
      n /= i;
    }
  }

  if (n != 1) ++m[n];

  int ans = 0;
  for (auto e : m) {
    int cnt = 1;

    while (e.se - cnt >= 0) {
      e.se -= cnt;
      ++cnt; ++ans;
    }
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3676
module placticeB
  sub main
    dim input_n as integer
    dim input_str as string
    
    input_n = console.readline()
    input_str = console.readline()
    
    dim input_a() = input_str.split(" ")
    
    dim sum as double = 0.0
    dim count as integer = 0
    while(count < input_n)
      sum += 1/input_a(count) 
      count += 1
    end while
    
    dim result as double = 1/sum
    console.writeline(result)
    
  end sub
end module

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

template <typename T>
struct SegmentTree{
private:
    int n;
    T init;
    std::vector<T> node;

public:
    explicit SegmentTree(int sz,T initv=0){
        n=1;
        init=initv;
        while(n<sz)n=n*2;
        node.resize(static_cast<unsigned int>(2 * n - 1), init);
        for (int i = 0; i <sz ; ++i) node[i+n-1]=init;
        for (int i = n-2; i >= 0 ; --i) node[i]=std::max(node[2*i+1],node[2*i+2]);
    }

    void update(int x, T val){//x:0-indexed
        x+=n-1;
        node[x]=val;
        while(x>0){
            x=(x-1)/2;
            node[x]=std::max(node[2*x+1],node[2*x+2]);
        }
    }

    T getmax(int p,int q,int k=0,int l=0,int r=-1){//[p,q):0-indexed
        if(r<0)r=n;
        if(r<=p||l>=q)return init;//out of range
        if(p<=l&&r<=q)return node[k];

        return std::max(getmax(p,q,2*k+1,l,(l+r)/2),getmax(p,q,2*k+2,(l+r)/2,r));
    }
};

using namespace std;
using ll = long long;

int main() {
    int n,k;
    cin>>n>>k;
    SegmentTree<int> st(300001+k);
    for(int i = 0;i < n;++i) {
        int a;
        cin>>a;
        int t=st.getmax(max(0,a-k),a+k+1);
//cerr<<st.query(0,300001+k)<<endl;
//cerr<<t<<endl;
        st.update(a,t+1);
    }
    cout<<st.getmax(0,300001+k)<<endl;
    return 0;
}


Measured memory_bytes: 11416
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=100005;
int x[MAX_N];
int g[MAX_N];
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>x[i];
	}
	sort(x,x+m);
	for(int i=1;i<m;i++)g[i]=x[i]-x[i-1];
	sort(g+1,g+m);
	int ans=0;
	for(int i=1;i<=m-n;i++)ans+=g[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
///...................SUBHASHIS MOLLICK...................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///....................SESSION-(14-15)....................///
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pf(a) printf("%d",a)
#define pf2(a,b) printf("%d %d",a,b)
#define pf3(a,b,c) printf("%d %d %d",a,b,c)
#define sfl(a) scanf("%lld",&a)
#define sfl2(a,b) scanf("%lld %lld",&a,&b)
#define sfl3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pfl(a) printf("%lld",a)
#define pfl2(a,b) printf("%lld %lld",a,b)
#define pfl3(a,b,c) printf("%lld %lld %lld",a,b,c)
#define nl printf("\n")
#define   timesave              ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define MPI map<int,int>mp;
#define fr(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define frl(i,a,b) for(i=a;i<=b;i++)
#define tz 100000
#define clr0(a) memset(a,0,sizeof(a))
#define clr1(a) memset(a,-1,sizeof(a))
/*primes in range 1 - n
1 - 100(1e2) -> 25 pimes
1 - 1000(1e3) -> 168 primes
1 - 10000(1e4) -> 1229 primes
1 - 100000(1e5) -> 9592 primes
1 - 1000000(1e6) -> 78498 primes
1 - 10000000(1e7) -> 664579 primes
large primes ->
104729 1299709 15485863 179424673 2147483647 32416190071 112272535095293 48112959837082048697
*/
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
main()
{
    timesave;
    ll x,i,xx=100;
    cin>>x;
    for(i=1;;i++)
    {
        xx=xx+(xx/100);
        if(xx>=x)
            break;
    }
    cout<<i<<endl;
}






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

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

    int n;
    cin >> n;
    vector<vector<int>> g(n);
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        --a;
        --b;

        g[a].push_back(b);
        g[b].push_back(a);
    }

    const int INF = 1001001001;
    vector<int> distf(n, INF);
    distf[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int v = q.front();
        q.pop();

        for(int nv: g[v]){
            if(distf[nv] != INF) continue;

            distf[nv] = distf[v] + 1;
            q.push(nv);
        }
    }

    vector<int> dists(n, INF);
    dists[n-1] = 0;
    q.push(n-1);
    while(!q.empty()){
        int v = q.front();
        q.pop();

        for(int nv: g[v]){
            if(dists[nv] != INF) continue;

            dists[nv] = dists[v] + 1;
            q.push(nv);
        }
    }

    // rep(i, n) cout << distf[i] << " ";
    // cout << endl;
    // rep(i, n) cout << dists[i] << " ";
    // cout << endl;

    int fennec = 0;
    int snuke = 0;
    rep(i, n){
        if(distf[i] <= dists[i]) ++fennec;
        else ++snuke;
    }

    if(fennec == snuke) puts("Snuke");
    else if(fennec > snuke) puts("Fennec");
    else puts("Snuke");
    
    return 0;
}

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

int main() {
  int n, maxv = -2000000000, minv;
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  std::cin >> n;
  int rt[n];
  for (int i = 0; i < n; ++i) {
    std::cin >> rt[i];
  }
  minv = rt[0];
  for (int i = 1; i < n; ++i) {
    maxv = std::max(maxv, rt[i] - minv);
    minv = std::min(minv, rt[i]);
  }
  std::cout << maxv << '\n';
}



Measured memory_bytes: 3896
#include <iostream>
     
    int main()
    {
      int H,N=0;
      std::cin>>H>>N;
      
      int totalAttack=0;
      int attack=0;
      for(int i=0;i<N;++i)
      {
        std::cin>>attack;
        totalAttack+=attack;
      }
      
      if(H<=totalAttack)
      {
        std::cout<<"Yes"<<std::endl;
      }
      else
      {
        std::cout<<"No"<<std::endl;
      }
      
      return 0;
    }

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef long double LD;
typedef pair<LD, int> PLDI;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
const LL MOD = 1e9+7;
const LL INF = (1e18);
const double EPS=1.0e-9;
const double PI=atan2(0,-1);



int main()
{
    string s,s2="CODEFESTIVAL2016";
    cin>>s;
    int cnt=0;
    REP(i,s2.size())
    {
        if(s[i]!=s2[i])
            cnt++;
    }
    cout<<cnt<<endl;
}


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

int main() {
	int l;
	long double a, b, c;
	cin >> l;
	a = l / 3.0;
	b = l / 3.0;
	c = l - a - b;

	printf("%.10llf\n", a * b * c);

}


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

Measured memory_bytes: 652
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <utility>
#include <map>
#include <queue>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

ll gcd(ll a, ll b)
{return b?gcd(b,a%b):a;}

int main()
{
    ll a,b,g,h;
    ll cnt=0;
    cin>>a>>b;
    g=gcd(a,b);
    h=g;
    for(ll i=2;i*i<=h;i++)
    {
        if(g%i==0)
        { cnt++;
        while(g%i==0)
            g/=i;}
    }

if(g>1)
cnt++;
cnt++;
cout<<cnt;
return 0;}



Measured memory_bytes: 384
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines.shift().trim().split(/\s/)[0] - 0;
    let S = lines.shift().trim().split(''); 
    let r = S.reduce((ac, v) => ac + (v == 'R' ? 1 : 0), 0);
    let b = N - r;
    let ans = r > b;
    console.log(ans ? "Yes" : "No");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
x,n=map(int,input().split())
d=[0]*n
if n != 0:
    a=[0]*n
    a=list(map(int,input().split()))

    for i in range(n):
        d[i]=x-int(a[i])

#d=sorted(d)
#print(d)
    for i in range(100):
        #print(i)
        if not (i in d and i*-1 in d):
            if i in d:
                b= i + x
            else:
                b= x - i
        #for j in range(n):
        #if i+1 < d[j]:
        #b=x-(i+1)
            break

    print(b)

else:
    print(x)




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

using namespace std;

int const NMAX = 1e5;
int v[1 + NMAX];

int main() {

  int n, pos = 1, p, ans = 1;
  string GUIDO;
  cin >> n >> p;
  ans *= p;
  for(int i = 1;i < n;i++){
    ans *= (p - 1);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl

void cout_vector(vector<int> vec, int n) {
    rep(i,n-1) {
        cout << vec.at(i) << " ";
    }
    ct(vec.at(n-1));
}

void bubbleSort(vector<int> vec, int n) {
    int count=0;
    bool flag=true;
    int i=0;
    while (flag) {
        flag = false;
        for (int j=n-1; j>i; j--) {
            if (vec.at(j) < vec.at(j-1)) {
                swap(vec.at(j), vec.at(j-1));
                flag = true;
                count++;
            }
        }
        i++;
    }
    cout_vector(vec, n);
    ct(count);
}

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i,n) cin >> vec.at(i);
    bubbleSort(vec, n);

}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}


int main(void){
    ll a;
    long double b;
    cin >> a >> b;
    cout << (a * (int)((b + 0.000000001) * 100)) / 100 << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    if(a+b==15) cout << '+' << endl;
    else if(a*b==15) cout << '*' << endl;
    else cout << 'x' << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> a;
  int n,q,b,e,t;

  cin >> n;

  a.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }
  
  cin >> q;
  int pos1,pos2,tmp;
  for(ii=0;ii<q;ii++){

    cin >> b >> e >> t;

    for(jj=0;jj<e - b;jj++){
      pos1 = b + jj;
      pos2 = t + jj;
      tmp = a[pos1];
      a[pos1] = a[pos2];
      a[pos2] = tmp;
    }
    
  }

    vector<int>::iterator it = a.begin();

  while(it != a.end()){
    cout << *it;
    it++;
    if(it != a.end()){
      cout << " ";
    }
    else{
      cout << endl;
    }
  }
  
  return 0;
}



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

int main()

{
	char a[1000], b[1000], c[1000];
	scanf("%s%s%s", a, b, c);
	int l1 = strlen(a);
	int l2 = strlen(b);
	if(a[l1-1] == b[0] && b[l2-1] == c[0])
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
		
	}
	return 0;
}



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

struct UnionFind{

    vector<int> par;
    vector<int> sizes;

    UnionFind(int n):par(n),sizes(n,1){
        for(int i=0;i<n;i++){
            par[i]=i;
        }
    }
    
    int find(int x) { //xの根を得る
        if (x == par[x]) return x;
        return par[x] = find(par[x]); //根を張り替えながら再帰的に根ノードを探す
    }

    void unite(int x, int y) { //xとyの集合を併合
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int size(int x) {
        return sizes[find(x)];
    }
};

int main(){
    int N,M,K; cin >> N >> M >> K;
    int cnt_f[N]={};
    int cnt_b[N]={};
    UnionFind uf(N);
    for(int i=0;i<M;i++){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
        cnt_f[a]++; cnt_f[b]++;
    }
    for(int i=0;i<K;i++){
        int c,d; cin >> c >> d;
        c--; d--;
        if(!uf.same(c,d)) continue;
        cnt_b[c]++; cnt_b[d]++;
    }
    long long ans[N];
    for(int i=0;i<N;i++){
        ans[i]=uf.size(i)-(cnt_f[i]+cnt_b[i]+1);
    }
    for(int i=0;i<N;i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;
int n,m;
bool edge[51][51];
bool used[51];
void dfs(int node=0)
{
  used[node]=1;
  rep(i,n)
  {
    if(edge[node][i] && !used[i])
    {
      dfs(i);
    }
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n>>m;
  vector<int>a(m),b(m);
  rep(i,m)
  {
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    edge[a[i]][b[i]]=1;
    edge[b[i]][a[i]]=1;
  }
  int cnt=m;
  rep(i,m)
  {
    rep(i,n)used[i]=0;
    edge[a[i]][b[i]]=0;
    edge[b[i]][a[i]]=0;
    bool t=1;
    dfs();
    rep(i,n)t&=used[i];
    edge[a[i]][b[i]]=1;
    edge[b[i]][a[i]]=1;

    if(t)cnt--;
  }
  cout<<cnt<<endl;
  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 repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}
//https://scrapbox.io/pocala-kyopro/%E8%BB%A2%E5%80%92%E6%95%B0
struct BIT {
 private:
  vector<int> bit;
  int N;

 public:
  BIT(int size) {
    N = size;
    bit.resize(N + 1);
  }

  // 一点更新です
  void add(int a, int w) {
    for (int x = a; x <= N; x += x & -x) bit[x] += w;
  }

  // 1~Nまでの和を求める。
  int sum(int a) {
    int ret = 0;
    for (int x = a; x > 0; x -= x & -x) ret += bit[x];
    return ret;
  }
};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin >> n;
  int k = (n+1)/2;
  vl aa,bb;
  vl a, b;
  rep(i,n){
    ll tmp;cin >> tmp;
    aa.push_back(tmp);
  }
  rep(i,n){
    ll tmp;cin >> tmp;
    bb.push_back(tmp);
  }
  rep(i,n){
    if(i%2==0){
      a.push_back(aa[i]);
      b.push_back(bb[i]);
    }else{
      a.push_back(bb[i]);
      b.push_back(aa[i]);
    }
  }
  ll ans = LINF;
  int bit = (1<<k)-1;
  for(;bit<(1<<n); bit = next_combination(bit)){
    vector<P> d,e;
    //cerr << "bit " << bit <<endl;
    rep(i,n){
      if((bit>>i)&1){
        d.push_back(mp(a[i],i+1));
      }else{
        e.push_back(mp(b[i],i+1));
      }
    }
    sort(d.begin(), d.end());
    sort(e.begin(), e.end());
    
    e.push_back(mp(LINF,LINF));
    bool ok = true;
    rep(i,(n+1)/2){
      if(d[i].first>e[i].first)ok = false;
      if(i>0){
        if(e[i-1].first>d[i].first)ok=false;
      }
    }
    vl v;
    rep(i,n){
      if(i%2==0){
        v.push_back(d[i/2].second);
      }else{
        v.push_back(e[i/2].second);
      }
    }
    if(ok){
      BIT B(n);
      ll tmp =0;
      rep(i,n){
        tmp += i - B.sum(v[i]);
        B.add(v[i],1);
      }
      ans = min(ans,tmp);
    }
  }
  if(ans == LINF)ans = -1;
  cout << ans << endl;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
dim, ans = [0] * 51, [0] * 51
dim[0], ans[0] = 1, 1
for i in range(1, 51):
    dim[i] = 2 * dim[i - 1] + 3
    ans[i] = 2 ** (i + 1) - 1
def paty(n, x):
    if n == 0: return x
    elif x == 0: return 0
    else:
        if x == dim[n]: return ans[n]
        elif x == dim[n - 1] + 2: return ans[n - 1] + 1
        elif x <= dim[n - 1] + 1: return paty(n - 1, x - 1)
        else: return ans[n - 1] + 1 + paty(n - 1, x - (dim[n - 1] + 2))
print(paty(N, X))

Measured memory_bytes: 38384
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,m,a[55],b[55],v[55][55],ans;
bool u[55];
void dfs(int x)
{
	u[x]=true;
	for(int j=1;j<=n;j++)
		if(v[x][j]&&!u[j])
			dfs(j);
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>a[i]>>b[i],v[a[i]][b[i]]=v[b[i]][a[i]]=true;
	for(int i=1;i<=m;i++)
	{
		v[a[i]][b[i]]=v[b[i]][a[i]]=false;
		for(int j=1;j<=n;j++)
			u[j]=false;
		dfs(1);
		for(int j=1;j<=n;j++)
			if(!u[j])
			{
				ans++;
				break;
			}
		v[a[i]][b[i]]=v[b[i]][a[i]]=true;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;
 
int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	int n = s.length();
	string ss ;
	int diff =INT_MAX;
	f(i,0,n-2){
		ss = s.substr(i,3);
		reverse(all(ss));
		int num = 0;
		f(j,0,3){
			num = num + (ss[j]-'0')*pow(10,j);
		}
		// cout << num << ' ' <<ss<< '\n';
		diff = min(diff,abs(753-num));
	}
	cout << diff << '\n';
	return 0;
} 

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String c1 = sc.nextLine();
        String c2 = sc.nextLine();
        String c3 = sc.nextLine();
        sc.close();

        System.out.println("" + c1.charAt(0) + c2.charAt(1) + c3.charAt(2));
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, int> pli;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 1000010;

bool is_prime[MAX];

void sieve(){
        rep(i, MAX) is_prime[i]=true;
        is_prime[0]=is_prime[1]=false;
        For(i, 2, MAX)if(is_prime[i]){
                for(int j=2; i*j<MAX; ++j) is_prime[i*j]=false;
        }
}

int main(){
        sieve();
        int a, d, n;
        while(scanf("%d%d%d", &a, &d, &n) && a){
                int cnt=0;
                while(true){
                        if(is_prime[a]) ++cnt;
                        if(cnt==n) break;
                        a+=d;
                }
                printf("%d\n", a);
        }
}


Measured memory_bytes: 4112
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c,a1,b1,p,min,max;
	while(cin>>a>>b)
	{
		if(a<b){p=a;a=b;b=p;}
		a1=a;b1=b;
		while(a%b!=0)
		{
           c=a%b;
           a=b;
           b=c;
       }
		min=b;
		max=a1*b1/min;
		cout<<min<<" "<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 3124
#include <iostream>

int main(void)
{
    int a, b, c, d, e, sum, min = 11, flag = 0;
    std::cin >> a >> b >> c >> d >> e;
    if (a % 10 == 0)
    {
        flag++;
    }
    if (b % 10 == 0)
    {
        flag++;
    }
    if (c % 10 == 0)
    {
        flag++;
    }
    if (d % 10 == 0)
    {
        flag++;
    }
    if (e % 10 == 0)
    {
        flag++;
    }
    if (flag == 5)
    {
        flag--;
    }
    flag = 40 - flag * 10;
    //    std::cout << flag;
    if (a % 10 > b % 10 && b % 10 != 0)
    {
        min = b % 10;
    }
    else if (a % 10 != 0)
    {
        min = a % 10;
    }
    if (min > c % 10 && c % 10 != 0)
    {
        min = c % 10;
    }
    if (min > d % 10 && d % 10 != 0)
    {
        min = d % 10;
    }
    if (min > e % 10 && e % 10 != 0)
    {
        min = e % 10;
    }
    if (min == 11)
    {
        min = 0;
    }
    std::cout << a - a % 10 + b - b % 10 + c - c % 10 + d - d % 10 + e - e % 10 + flag + min << std::endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.IO;

namespace AOJ2
{
    class Program
    {
        private static StreamScanner sc = new StreamScanner(Console.OpenStandardInput());
        static void Main()
        {
            for (int i = 0; i < 3; i++)
            {
                var ihour = int.Parse(sc.Scan());
                var imin = int.Parse(sc.Scan());
                var isec = int.Parse(sc.Scan());
                var ohour = int.Parse(sc.Scan());
                var omin = int.Parse(sc.Scan());
                var osec = int.Parse(sc.Scan());
                var inTime = new DateTime(2000, 1, 1, ihour, imin, isec);
                var outTime = new DateTime(2000, 1, 1, ohour, omin, osec);
                var dur = outTime - inTime;
                Console.WriteLine(dur.Hours + " " + dur.Minutes + " " + dur.Seconds);
            }


        }

    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        private readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private byte read()
        {
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    return 0;
                }
            }
            return buf[ptr++];
        }
        public char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
    }
}

Measured memory_bytes: 5664
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
const double PI=3.14159265358979323846;
#define DIV 1000000007
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long R;
    cin >> R;
    cout << fixed << setprecision(10) << 2*PI*R << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
long long N = pow(10, 9);
int main(){
  long long a, v, b, w, t;
  scanf("%lld %lld", &a, &v);
  scanf("%lld %lld", &b, &w);
  scanf("%lld", &t);
 
  long long d = (v - w) * t;
  long long l = abs(a - b);
  if(d < l) printf("NO");
  else printf("YES");
}

Measured memory_bytes: 3692
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++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(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

int main()
{
  ll a,b,n;
  cin >> a >> b >> n;
  ll s,t,p;
  if(b-1 <= n){
  p = a*(b-1);
  s = p/b;
  t = (b-1) / b;

  cout << s - a * t << endl;
  }

  else{
      p = a*n;
      s = p/b;
      t = n/b;

      cout << s - a*t << endl;
  }
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
int solve(vector<int> &data, int x) {
    int ret = 0;
    for (auto &v : data)
        ret += (v - x) * (v - x);
    return ret;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, sum = 0; cin >> n;
    vector<int> data(n);
    for (auto &v : data)
        cin >> v, sum += v;
    cout << min(solve(data, sum / n), solve(data, sum / n + 1)) << '\n';
}


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

int main(){
  int n[1000], x[1000],c ,end;
  for (int i=0;i<1000;i++){
    cin>>n[i]>>x[i];
    if (n[i]==0 && x[i]==0){
      end = i;
      break;
    }
  }
  for (int i=0;i<end;i++){
    c = 0;
    for(int j=1;j<n[i]-1;j++){
      for(int k=j+1;k<n[i];k++){
        if(x[i]-j-k>k && x[i]-j-k<=n[i]){
	  c += 1;
	}
        else if(x[i]-j-k>n[i]) continue;
        else break;
      }
    }
    cout<<c<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include "bits/stdc++.h"

#define sz(x) (int)x.size()
#define ld long double
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

const ll d = 64;

ll tt, sz = 0;
ll basis[d]; // basis[i] keeps the mask of the vector whose f value is i
void insertVector(ll mask) {
	for (int i = 0; i < d; i++) {
		if ((mask & 1LL << i) == 0) continue; // continue if i != f(mask)
		if (!basis[i]) { // If there is no basis vector with the i'th bit set, then insert this vector into the basis
			basis[i] = mask;
			++sz;
			return;
		}
		mask ^= basis[i]; // Otherwise subtract the basis vector from this vector
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> tt;
    while(tt--){
        ll n;
        string s;
        vector<ll> v;
        cin >> n;
        v.assign(n, 0);
        for(int i = 0; i < n; ++i){
            cin >> v[i];
        }
        cin >> s;
        for(int i = 0; i < n; ++i){
            if(s[i] == '0') continue;
            sz = 0;
            memset(basis, 0, sizeof(basis));
            for(int j = i + 1; j < n; ++j){
                if(s[j] == '0') insertVector(v[j]);
            }
            int cc = sz;
            insertVector(v[i]);
            if(cc != sz){
                cout << 1 << "\n";
                goto nxt;
            }
        }
        cout << 0 << "\n";
        nxt:;
    }
    return 0;
}

Measured memory_bytes: 3656
/*
    author: masab hasnain
*/

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

const double PI  = 3.141592653589793238463;

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

    double r;
    cin >> r;
    r = 2.0 * PI * r;
    cout <<setprecision(30)<< r << endl;
}


Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define DEBUG cout<<"shllhs"<<endl;
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 20
#define INF 100000000000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-10
#define pi acos(-1.0)
using namespace std;
int a[N],b[N];
vector<int>v[2];
vector<int>e;
void update(int p)
{
    while(p>0)
    {
        b[p]++;
        p-=p&-p;
    }
}
int query(int p)
{
    int ret = 0;
    while(p<N)
    {
        ret+=b[p];
        p+=p&-p;
    }
    return ret;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin>>n)
    {
        v[0].clear();
        v[1].clear();
        e.clear();
        MST(b,0);
        FOR(i,1,n)
        {
            cin>>a[i];
            if(i&1)v[0].PB(a[i]);
            else v[1].PB(a[i]);
            e.PB(a[i]);
        }
        sort(e.begin(),e.end());
        sort(v[0].begin(),v[0].end());
        sort(v[1].begin(),v[1].end());
        int i = 1;
        for(auto u:v[0])
        {
            a[i] = u;
            i+=2;
        }
        i = 2;
        for(auto u:v[1])
        {
            a[i] = u;
            i+=2;
        }
        int sz = unique(e.begin(),e.end())-e.begin();
        e.resize(sz);
        FOR(i,1,n)a[i] = lower_bound(e.begin(),e.end(),a[i])-e.begin()+1;
        //FOR(i,1,n)cout<<a[i]<<endl;
        int ans = 0;
        for(int i = 1;i<=n;i+=2)
        {
            if(a[i]%2 == 0)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

int main(){
  int A;
  vector<int> a(2);
  cin>>a.at(0)>>a.at(1);
  sort(a.begin(),a.end());
  if(a.at(0)!=a.at(1)){A=a.at(1)+a.at(1)-1;}
  else{A=a.at(0)*2;}
  cout<<A<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
string u, s, t;
int a, b;

int main(){
	IOS
	int c, d;
	cin >> s >> t >> a >> b >> u;
	c=a, d=b;
	if(u==s){
		c--;
	}
	if(u==t){
		d--;
	}
	cout << c << ' ' << d << '\n';
}

Measured memory_bytes: 3648
line = readlines.map(&:chomp)

line[0] = line[0].split(" ")
line[1] = line[1].split(" ")
line[2] = line[2].split(" ")


red_nums = line[1][0].to_i
blue_nums = line[1][1].to_i

choice = line[2]

if choice[0] == line[0][0]
  red_nums -= 1
else
  blue_nums -= 1
end

puts "#{red_nums} #{blue_nums}"


Measured memory_bytes: 1788
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var s = o.m(n,1);
  for(var i = 0; i < n; i++){
    s[i][1] = +s[i][1];
    s[i][2] = i;
  }
  s.sort((a,b)=>a[0]===b[0]?b[1]-a[1]:a[0]>b[0]?1:-1);
  var ans = [];
  for(var i = 0; i < n; i++){
    ans.push(s[i][2]+1);
  }
  return ans.join("\n");
}

Measured memory_bytes: 7500
using System;

namespace ITP1_9_B
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                string cards = Console.ReadLine();
                if (cards == "-")
                    break;

                string str1 = Console.ReadLine();
                int num = int.Parse(str1);
                for (int i = 0; i < num; ++i)
                {
                    string str2 = Console.ReadLine();
                    int h = int.Parse(str2);
                    cards = Shuffle(cards, h);
                }
                Console.WriteLine("{0}", cards);
            }
        }

        static string Shuffle(string str,int h)
        {
            string front, back, ans;
            back = str.Substring(h,str.Length-h);
            front = str.Substring(0, h);
            ans = front.Insert(0, back);
            return ans;
        }
    }
}

Measured memory_bytes: 17588
#include <iostream>
#include <vector>
#define inf 1000000000

using namespace std;

// range-add, range-min query

struct SegTree{
	int size;
	vector<int> seg, delay;
	
	SegTree(){}
	SegTree(int size){
		this->size = size;
		seg.resize(1<<(size+1));
		delay.resize(1<<(size+1));
	}
	
	void init()
	{
		for(int i = 0; i < (1<<(size+1)); i++){
			seg[i] = -inf;
			delay[i] = 0;
		}
	}
	
	void eval(int l, int r, int k)
	{
		if(delay[k]){
			seg[k] += delay[k];
			if(l < r){
				delay[k*2] += delay[k];
				delay[k*2+1] += delay[k];
			}
			delay[k] = 0;
		}
	}
	
	void update(int i, int val)
	{
		i += (1 << size);
		seg[i] = val;
		while(i > 1){
			i /= 2;
			seg[i] = max(seg[i*2], seg[i*2+1]);
		}
	}
	
	void add(int a, int b, int k, int l, int r, int val)
	{
		eval(l, r, k);
		
		if(b < l || r < a) return;
		if(a <= l && r <= b){
			delay[k] += val;
			eval(l, r, k);
			return;
		}
		add(a, b, k*2, l, (l+r)/2, val);
		add(a, b, k*2+1, (l+r)/2+1, r, val);
		seg[k] = max(seg[k*2], seg[k*2+1]);
	}
	void add(int a, int b, int val){
		if(a > b) return;
		add(a, b, 1, 0, (1<<size)-1, val);
	}

	int query(int a, int b, int k, int l, int r)
	{
		eval(l, r, k);
		
		if(b < l || r < a) return -inf;
		if(a <= l && r <= b) return seg[k];
		int lval = query(a, b, k*2, l, (l+r)/2);
		int rval = query(a, b, k*2+1, (l+r)/2+1, r);
		return max(lval, rval);
	}
	int query(int a, int b)
	{
		return query(a, b, 1, 0, (1<<size)-1);
	}
};

int n, m;
int l[200005], r[200005];
vector<int> vec[200005];
SegTree seg(18);

int main(void)
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) cin >> l[i] >> r[i];
	for(int i = 1; i <= n; i++) vec[r[i]].push_back(l[i]);
	
	seg.init();
	for(int i = 0; i <= m; i++) seg.add(i, i, inf-i);
	
	int L = 0, R = m+1;
	for(int i = 1; i <= n; i++) L = max(L, l[i]), R = min(R, r[i]);
	
	int ans = max(0, n - min(m, L+(m+1-R)));
	for(int i = m+1; i >= 1; i--){
		for(int j = 0; j < vec[i].size(); j++) seg.add(vec[i][j], m, 1);
		ans = max(ans, seg.query(0, i-1) - (m+1-i));
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 14208
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N; cin >> N;
    vector<int64> vL(86+1); vL[0]=2; vL[1]=1;
    for(uint i=2; i<vL.size(); ++i){ vL[i] = vL[i-2]+vL[i-1]; }
    
    cout << vL[N] << endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e9+10;
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
ll pow(ll a, ll b){ll res = 1;for(int i = 1; i<=b; ++i) res *= a;return res;}
ll isPrime(ll n){for(ll i=2; i<=sqrt(n); i++){if(n%i==0) return 0;}return 1;}
ll fact(ll n){if(n==0 || n==1) return 1; else return n*fact(n-1);}
ll gcd (ll a, ll b) {return b ? gcd (b, a % b) : a;}
int a[18]={2,3,5,7,11,13,13,17,19,23,29,31,37,41,43,47,53,59};
void Sieve(ll n, ll prime[]){for(int p=2; p*p<=n; p++){if(prime[p] == true){for(int i=p*2; i<=n; i += p)prime[i] = false;}}for(int p=2; p<=n; p++)if(prime[p])cout << p << " ";}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m,X,Y;
	cin >> n >> m >> X >> Y;
	ll x[n],y[m];
	for(ll i=0; i<n; i++){
        cin >> x[i];
	}
	for(ll j=0; j<m; j++){
        cin >> y[j];
	}
	sort(x,x+n);
	sort(y,y+m);
	if(X>Y){
        cout << "War";
        return 0;
	}
	else{
        for(ll i=X+1; i<=Y; i++){
            if(i>x[n-1] && i<=y[0]){
                cout << "No War";
                return 0;
            }
        }
	}
	cout << "War";
	return 0;
}
/* The judge is never wrong! Your code is buggy 😈
   Look for:
 * * an easier and alternate approach
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())

ans = 10**14

ans = min(ans, A*X+B*Y)
ans = min(ans, C*max(X, Y)*2)
if X > Y:
    ans = min(ans, C*min(X, Y)*2 + A*(X-Y))
else:
    ans = min(ans, C*min(X, Y)*2 + B*(Y-X))

print(ans)

Measured memory_bytes: 3064
s = input()
s2 = s.split('eraser')
s3 = ''.join(s2).split('erase')
s4 = ''.join(s3).split('dreamer')
s5 = ''.join(s4).split('dream')
s5 = list(set(s5))
if len(s5) == 1 and s5[0] == '':
  print("YES")
else:
  print("NO")

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

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i )
#define mem(a) memset ( (a), 0, sizeof ( a ) )
#define str(a) strlen ( a )
typedef long long LL;
template<class T> int maxx(T a, T b) { return a > b ? a : b; }
template<class T> int minn(T a, T b) { return a < b ? a : b; }
template<class T> int abss(T a) { return a > 0 ? a : -a; }
#define max maxx
#define min minn
#define abs abss
const int maxn = 400010;

int main()
{
    char s[110];
    scanf("%s", s + 1);
    int n = str(s + 1);
    REP(i, 1, n)
    {
        if ( s[i] == 'U' || s[i] == 'D' ) continue ;
        if ( s[i] == 'L' && i % 2 == 1 ) { puts("No"); return 0; }
        if ( s[i] == 'R' && i % 2 == 0 ) { puts("No"); return 0; }
    }
    puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring> 
using namespace std;
int main()
{
	char as[11],bu[11],test[11];
	int a,b;
	cin>>as>>bu;
	cin>>a>>b;
	cin>>test;
	if (strcmp(as,test)==0)
		a--;
	else
		b--;
	cout<<a<<' '<<b<<endl;
	return 0;
} 

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

#define ll long long
#define ull unsigned long long
#define ld long double

#define tiii tuple < int, int, int >
#define pii pair < int, int >
#define pll pair < ll, ll >
#define pci pair < char, int >
#define psi pair < string, int >
#define pis pair < int, string >

#define vi vector < int >
#define vd vector < double >
#define vld vector < ld >
#define vll vector < ll >
#define vs vector < string >
#define vc vector < char >
#define vpi vector < pii >
#define vpll vector < pll >
#define vpis vector < pis >

#define pb push_back
#define mt make_tuple
#define gt0 get < 0 >
#define gt1 get < 1 >
#define gt2 get < 2 >

#define pi acos(-1)

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;

ll n, w;
ll weight[105], value[105];
ll dp[105][maxn];

ll fnc(ll pos, ll baki)
{
    if(pos > n) return 0;

    if(dp[pos][baki]) return dp[pos][baki];

    ll p = 0, q = 0;

    if(baki >= weight[pos]) p = fnc(pos + 1, baki - weight[pos]) + value[pos];

    q = fnc(pos + 1, baki);

    return dp[pos][baki] = max(p, q);
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fast;

    cin >> n >> w;

    for(ll i = 1; i <= n; i++) cin >> weight[i] >> value[i];

    cout << fnc(1LL, w) << endl;

    return 0;
}

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

using namespace std;

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        char s;
        cin>>s;
        if(s>='a' && s<='z'){
            cout<<"a";
        }
        else{
            cout<<"A";
        }
    return 0;
}

Measured memory_bytes: 3616
from itertools import accumulate

n = int(input())
a = tuple(map(int, input().split()))

if n == 0:
    if a[0] == 1:
        print(1)
        exit(0)
    else:
        print(-1)
        exit(0)

if a[0] != 0:
    print(-1)
    exit(0)

cs = list(accumulate(a[::-1]))[::-1]

s = 1
l = 1
for i in range(1, n+1):
    l = l * 2
    s = s + min(cs[i], l)
    l = l - a[i]
    if l < 0:
        print(-1)
        exit(0)
print(s)


Measured memory_bytes: 20888
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n, q;
        cin >> n >> q;
        if(n == 0)
            return 0;

        vector<string> name(n);
        vector<int> base(n), western(n);
        for(int i=0; i<n; ++i)
            cin >> name[i] >> base[i] >> western[i];

        for(int i=0; i<q; ++i){
            int a;
            cin >> a;
            bool unknown = true;
            for(int j=0; j<n; ++j){
                if(western[j] - base[j] + 1 <= a && a <= western[j]){
                    cout << name[j] << ' ' << (a - (western[j] - base[j])) << endl;
                    unknown = false;
                }
            }

            if(unknown)
                cout << "Unknown" << endl;
        }
    }
}

Measured memory_bytes: 0
import math
S = list(map(int, open(0).read().split()))
i = 0
while i < len(S):
    n = S[i]
    if n == 0:
        break
    s = S[i+1:i+1+n]
    i+=(1+n)
    avg = sum(s) / n
    a2 = sum([(avg - x)**2 for x in s]) / n
    a = math.sqrt(a2)
    print("{:.8f}".format(a))



Measured memory_bytes: 5788