akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define N 10000

#define MIN(A,B) (A)<(B)?(A):(B)
#define MAX(A,B) (A)>(B)?(A):(B)

int main(){
  int n, a, b, d, i;
  double tmp;
  char S[N];
  scanf("%d", &n);
  tmp=0.0;
  for (i=1; i<=n; i++){
    scanf("%d", &d);
    tmp+=((double)1.0/d);
  }
  printf("%.10lf\n", (double)1.0/tmp);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int s_len = s.size();
    int t_len = t.size();
    bool flag = false;
    if(s_len<t_len){
        flag = false;
        for(int i=0; i<s.size(); i++){
            if(s[i]==t[i])
                flag = true;
            else{
                flag = false;
                break;
            }
        }
    }

    if(flag==true) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3624
// #include <ext/pb_ds/assoc_container.hpp> 
    // #include <ext/pb_ds/tree_policy.hpp> 
    #include <iostream>
    #include <iomanip>
    #include <sstream>
    #include <cstring>
    #include <vector>
    #include <deque>
    #include <queue>
    #include <set>
    #include <map>
    #include <valarray>
    #include <iterator>
    #include <functional>
    #include <limits>
    #include <algorithm>
    #include <numeric>
    #include <cmath>
    #include <cassert>
    #include <unordered_map>
    #include <unordered_set>
    #include <stack>
    using namespace std;
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define trace(x) cerr << #x << ": " << x << " " << endl;
     
    typedef int64_t ll;
     
    #define endl '\n'
    #define int ll
    ll mod=1e18;
    ll mod1=1e9+5;
     
    ll power(ll a,ll b)
    {
        if(b==0) return 1;
        else if(b%2==0)
            return power((((a%mod)*(a%mod))%mod),b/2)%mod;
        else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
    }
     
    // using namespace __gnu_pbds;
    // #define ordered_set tree<pair<int,pair<int,int>>, null_type,less<pair<int,pair<int,int>>>, rb_tree_tag,tree_order_statistics_node_update>
    //find_by_order(k)  returns iterator to kth element starting from 0;
    //order_of_key(k) returns count of elements strictly smaller than k;
    //erase,insert same as normal set
    
    
    
    int32_t main()
    {
        IOS
      
        
       int n;
       cin>>n;
       vector<string> v;
       vector<string> temp;
       map<string,int> m;
       for(int i=0;i<n;++i)
       {
        string s;
        cin>>s;
        m[s]++;
       }
       int te=0;
       for(auto i:m)
        te=max(te,i.second);
        for(auto i:m)
        {
            if(i.second==te)
                v.push_back(i.first);
        }
        sort(v.begin(),v.end());
        for(auto i:v)
            cout<<i<<endl;

    }       

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

int main(void)
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	long long int n, r;
   cin>>n>>r;
  if (n >= 10)
	cout<<r<<"\n";
  else 
    cout<<(r + 100*(10-n))<<"\n";
  return 0;
}

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

ll h,w; 
const ll INF=-10000;

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

ll si, sj;
ll di, dj;

char maze[20][20];
ll dist[20][20];

int main(){
  cin >> h >> w;
  rep(i,h)rep(j,w){cin >> maze[i][j];}
  ll ans=0;
  rep(si,h)rep(sj,w){{
    if(maze[si][sj]=='#') continue;
    rep(i,h)rep(j,w){{dist[i][j]=INF;}}
    queue<P> q;
    
    auto update = [&](ll i, ll j, ll x){
      if(dist[i][j] != INF) return;
      dist[i][j] = x;
      q.push(P(i,j));
    };
    
    update(si,sj,0);
    while(!q.empty()){
      P p = q.front(); q.pop();
      //cout << p.first << "," << p.second << endl;
      rep(u, 4){
        ll nexti = p.first + dx[u], nextj = p.second + dy[u];
        if(nexti<0||nexti>=h||nextj<0||nextj>=w){continue;}
        
        if(maze[nexti][nextj]=='#'){continue;}
        update(nexti,nextj,dist[p.first][p.second]+1);
        //cout << "si=" << si << ", sj=" << sj << ", i=" << nexti << ", j=" << nextj << ", d=" << dist[nexti][nextj]<<endl; ;
      }
    }
    //rep(i,h)rep(j,w){{cout <<dist[i][j]<< endl ;} }
    rep(i,h)rep(j,w){ ans =max(ans, dist[i][j]);}
  
  }}
  cout << ans;

}


Measured memory_bytes: 256
/* ABC144-C
   Takatan */

#include<stdio.h>
#include<math.h>
int main(void){
    long long int number, min, i, j;
    min = 1000000000000; /* 可能な最大値とする。 */

    scanf( "%lld" , &number);
    for(i=1; i <= sqrt(number); i++){
        if(number%i==0){
            j = number/i; /* マスの位置(i, j)を検出 */
            if(min>i+j-2){
                min = i + j - 2; /* 最小値を更新 */
            }
        }
    }
    
    printf( "%lld\n" , min);
    return 0;
}

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

int main(void){
    // Your code here!
    int N;cin>>N;
    long long m=1000;
    long long h=0;
    vector<int>A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    char x='0';
    for(int i=1;i<N;i++){
        if(x=='0'){
            if(A[i-1]<A[i]){
                x='1';
                h=m/A[i-1];
                m=m%A[i-1];
            }
            else if(A[i-1]>A[i]){
                x='2';//2は減少
            }
        }
        else if(x=='1'){
            if(A[i-1]>A[i]){//売り
                x='2';
                m+=h*A[i-1];
                h=0;
            }
        }
        else if(x=='2'){
            if(A[i-1]<A[i]){//買い
                x='1';
                h=m/A[i-1];
                m=m%A[i-1];
            }
        }
    }
    if(h>=1){
        m+=h*A[N-1];
    }
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 3532
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;

int main() {
  int n;
  vector< vector<int> > card_all;
  vector<int> scores;
  cin >> n;

  for( int i = 0; i < n; i++ ) {
    vector<int> card_p;
    for( int j = 0; j < 3; j++ ) {
      int p;
      cin >> p;
      card_p.push_back( p );
    }
    card_all.push_back( card_p );
    scores.push_back( 0 );
  }

  for( int j = 0; j < 3; j++ ) {
    int hist[ 101 ] = { 0 };
    for( int i = 0; i < n; i++ ) {
      hist[ card_all[ i ][ j ] ]++;
    }
    for( int i = 0; i < n; i++ ) {
      if( hist[ card_all[ i ][ j ] ] == 1 ) {
        scores[ i ] += card_all[ i ][ j ];
      }
    }
  }

  for( int i = 0; i < n; i++ ) {
    cout << scores[ i ] << endl;
  }

  return EXIT_SUCCESS;
}

Measured memory_bytes: 1232
/**
*	created: 19.09.2020 22:04:08
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
using ll = long long;
using P = pair<int,int>;
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
inline void print(P a) {cout << a.first << " " << a.second << endl;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    int n, x, m; cin >> n >> x >> m;
    map<int,int> mp;
    vector<int> v;
    int a = x;
    int t;
    rep(i,m+3) {
        mp[a]++;
        if (mp[a] > 1) {
            t = a;
            break;
        }
        v.push_back(a);
        a = (a * a) % m;
    }
    int st;
    rep(i,v.size()) if (v[i] == t) st = i;
    int rsum = 0;
    rep2(i,st,v.size()) rsum += v[i];
    int fsum = 0;
    rep(i,st) fsum += v[i];
    if (n <= v.size()) {
        int ans = 0;
        rep(i,n) ans += v[i];
        cout << ans << endl;
    }
    else {
        int res = n - st;
        int tim = res / (v.size()-st);
        int lsum = 0;
        rep2(i,st,st + (res % (v.size()-st))) lsum += v[i];
        cout << fsum + rsum * tim + lsum << endl;
    }
    return 0;
}

Measured memory_bytes: 6708
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

#define INFL (1LL << 60)

typedef long long ll;

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    ll n, x, l, last = -INFL, cnt = 0;
    cin >> n;
    vector< pair<ll, ll> > d(n);
    for (ll i = 0; i < n; ++i) {
        cin >> x >> l;
        d.at(i) = make_pair(x - l, x + l);
    }
    sort(d.begin(), d.end(), [](pair<ll, ll> a, pair<ll, ll> b){
        return a.second < b.second || (a.second == b.second && a.first < b.first);
    });
    for (ll i = 0; i < n; ++i) if (last <= d.at(i).first) last = d.at(i).second, ++cnt;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1792
#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>;
 
struct Edge {
  int to, id;
  Edge(int to, int id): to(to), id(id) {}
};
 
vector<Edge> g[55];
 
vector<int> es;
bool dfs(int v, int tv, int p=-1) {
  if (v == tv) return true;
  for (Edge e : g[v]) {
    if (e.to == p) continue;
    if (dfs(e.to, tv, v)) {
      es.push_back(e.id);
      return true;
    }
  }
  return false;
}
 
int main() {
  int n, m;
  cin >> n;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].emplace_back(b, i);
    g[b].emplace_back(a, i);
  }
 
  cin >> m;
  vector<ll> eset(m);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    es = vector<int>();
    dfs(a,b);
    for (int e : es) {
      eset[i] |= 1ll<<e;
    }
  }
 
  ll ans = 0;
  rep(i,1<<m) {
    ll mask = 0;
    rep(j,m) {
      if (i>>j&1) mask |= eset[j];
    }
    int white = __builtin_popcountll(mask);
    ll now = 1ll<<(n-1-white); // 2^(n-1-white)
    if (__builtin_popcountll(i)%2 == 0) ans += now;
    else ans -= now;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<long long> v;
  for(int i=1;i<=n;i++){
    long long h;
    cin>>h;
    v.push_back(h);
  }
  sort(v.begin(),v.end());
  long long ans=0;
  if(n<=k){
    cout<<0<<endl;
  }
  else{
    for(int i=0;i<=n-1-k;i++){
      ans+=v[i];
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2420
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;
int main()
{

	ll a, b = 0, c = 0, d = 0;
	ll l;
	char C[1000][1000] = {};
	long double x[1001] = {}, y[1001] = {}, xhensa[1001] = {}, yhensa[1001] = {}, xave, yave, xkyobun[1001] = {}, ykyobun[1001] = {}, xykyobun[1001] = {}, xkyo = 0, ykyo = 0, xykyo = 0;
	string s, t;
	ll n, h[100001], w[100001];
	cin >> a;
	cin >> b;
	if (a*b%2==1)
	{
		cout <<"Yes" <<endl;

	}
	else
	{
		cout << "No" << endl;

	}
	//cout << sum << endl;
	//cout <<  endl;

	return 0;
}

//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}



Measured memory_bytes: 256
//CODING ME ACCHHA KARNEKA HAI TERKO TO BAS PRACTICE KARTE REH
#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define aisort sort(a,a+n)
#define adsort sort(a,a+n,greater<ll>())
#define PI 2 * acos(0)

typedef pair<ll, ll> pii;
typedef pair<ll, pii> piii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef set<ll> Set;

const ll maxs = 1e5+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
    inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
    inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
    inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
    ll fastpow(ll x,ll y)
    {ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
    ll inv(ll x){ return fastpow(x , mod - 2);}
    
//PRIME
    bool isPrime(ll n) { if (n <= 1)  return false; if (n <= 3)  return true;if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } 

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
    cout<<"Yes";
    else
    cout<<"No";
}




Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int INF=1000000007;
char a[105],b[105];
int f[105]; 
int main()
{
	int n,i,sum,ans;
	scanf("%d",&n);
	scanf("%s",a+1);
	scanf("%s",b+1);
	f[0]=1;
	f[1]=2;
	for(i=2;i<=n;i++)
		f[i]=(long long)f[i-1]*3%INF;
	sum=0;
	ans=3;
	for(i=1;i<=n;i++)
	{
		if(a[i]==b[i])
		{
			sum=sum/2;
			ans=(long long)ans*f[sum]%INF;
			sum=0;
			if(i!=1&&a[i-1]==b[i-1])
			{
				ans=ans*2%INF;
			}
		}
		else
		{
			sum++; 
		}
	}
	sum=sum/2;
	ans=(long long)ans*f[sum]%INF;
	sum=0;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


const int MAX_N = (int) 1e5;
int N, X, x[MAX_N];
int diffs[MAX_N];

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

void solve() {
    int pregcd = 1;
    REP(i, N) {
        pregcd = i == 0 ? diffs[0] : gcd(diffs[i], pregcd);
    }
    cout << pregcd << endl;
}

int main() {
    cin >> N >> X;
    REP(i, N) {
        cin >> x[i];
        diffs[i] = abs(X - x[i]);
    }
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cassert>
using namespace std;

int N, A[100+10];

int W[100+10];

// 半開区間[l,r)の範囲A[l]からA[r-1]を整列すると同時に、区間内の逆転するペアを返す。
int merge_and_count(int l,int r) {
  if (l+1 >= r) {
    return 0; // emptyまたは1個しか要素がない。
  }
  if (l+2 == r) { // A[l]とA[l+1]の2つしか要素がない。
    if (A[l] <= A[l+1]) {
      return 0;
    } else {
      swap(A[l],A[l+1]);
      return 1;
    }
  }
  int m = (l+r)/2;
  int cl = merge_and_count(l,m);
  int cr = merge_and_count(m,r);
  int c = 0; // 右と左を混ぜて逆転数を数える。
  // 答えは cl + cr + c である。
  int i=l, j=m; // i \in [l,m) , j \in [m,r)
  int k=l; // 小さいものからW[k]に書き込む。
  while (i < m && j < r) {
    if (A[i] <= A[j]) {
      W[k] = A[i];
      k++;
      i++;
    } else {
      W[k] = A[j];
      k++;
      j++;
      c += m-i;
    }
  } 
  while (i<m) {
    W[k++] = A[i++];
  }
  while (j<r) {
    W[k++] = A[j++];
  }
  assert (k == r);
  /* assert は 真なら以下の行を実行し、そうでなければそこでストップする関数。デバグにつかう。この段階ではk==rじゃなきゃおかしい。 */
  copy(W+l,W+r,A+l); // W[l]からW[r-1]を、A[l]を起点にしてコピーしていく。
  // 結論としては、A[l]からA[r-1]をソートしたことになる。
  return cl + cr + c;
}

int main() {  
  while (scanf("%d",&N) && N > 0) {
    for (int i=0;i<N;i++) {
      scanf("%d",&A[i]);
    }
    printf("%d\n",merge_and_count(0,N));
  }
}

Measured memory_bytes: 1188
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

n, k = map(int, input().split())
s = input()

for i in range(n):
    if i+1 == k:
        print(s[i].lower(), end="")
    else:
        print(s[i], end="")



Measured memory_bytes: 9100
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7,INF=1e18;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
ll modInv(ll a)
{
    ll res=1;
    ll b=mod-2;
    while(b)
    {
        if(b&1)
        res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    vector<ll> fac(200020,1),facInv(200020,1);
    for(int i=2;i<=200010;i++)
    {
        fac[i]=(i*fac[i-1])%mod;
        facInv[i]=modInv(fac[i]);
    }
    // cin>>t;
    while(t--)
    {
        ll h,w,a,b;
        cin>>h>>w>>a>>b;
        ll ans=0,ans2=0;
        ans2=fac[h+w-2];
        ans2=(ans2*facInv[h-1])%mod;
        ans2=(ans2*facInv[w-1])%mod;
        for(int i=1;i<=a;i++)
        {
            ll res=1,res2=1;
            res2=fac[a-i+w-b-1];
            res2=(res2*facInv[a-i])%mod;
            res2=(res2*facInv[w-b-1])%mod;
            res=fac[h-a+i+b-2];
            res=(res*facInv[h-a+i-1])%mod;
            res=(res*facInv[b-1])%mod;
            res=(res*res2)%mod;
            // cout<<res<<" ";
            ans=(ans+res)%mod;
        }
        ans=((ans2-ans)%mod+mod)%mod;
        cout<<ans<<"\n";
    }
    return 0;
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)




int main()
{
  ll n, c=0;
  cin >> n;
  vecll a(n);
  forll(i, 0, n)
	cin >> a[i];

  map<ll, ll> m;
  forll(i, 1, n+1){
	m[i - a[i-1]]++;
  }
  forll(i, 0, n){
	c += m[a[i]+i+1];
	m[i+1 - a[i]]--;
  }
  cout << c << endl;
   
}


Measured memory_bytes: 27484
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> l(N),r(N);
  for(int i=0;i<N;i++)cin>>l[i]>>r[i];
  std::vector<int> used(N,0);
  typedef pair<int,int> P;
  std::vector<P> ll(N),rr(N);
  for(int i=0;i<N;i++)ll[i]=P(l[i],i);
  for(int i=0;i<N;i++)rr[i]=P(r[i],i);
  sort(ll.rbegin(),ll.rend());
  sort(rr.begin(),rr.end());
  int ans=0;int now=0;
  int nowl=0,nowr=0;
  for(int i=0;i<N;i++){
    if(i%2){
      while(used[ll[nowl].second])nowl++;
      int a=ll[nowl].second;
      if(now<l[a]){ans+=l[a]-now;now=l[a];}
      if(now>r[a]){ans+=now-r[a];now=r[a];}
      used[ll[nowl].second]++;
    }
    else{
      while(used[rr[nowr].second])nowr++;
      int a=rr[nowr].second;
      if(now<l[a]){ans+=l[a]-now;now=l[a];}
      if(now>r[a]){ans+=now-r[a];now=r[a];}
      used[rr[nowr].second]++;
    }
  }
  ans+=abs(now);
  int fans=ans;
  fill(used.begin(),used.end(),0);
  ans=now=nowl=nowr=0;
  for(int i=0;i<N;i++){
    if(i%2==0){
      while(used[ll[nowl].second])nowl++;
      int a=ll[nowl].second;
      if(now<l[a]){ans+=l[a]-now;now=l[a];}
      if(now>r[a]){ans+=now-r[a];now=r[a];}
      used[ll[nowl].second]++;
    }
    else{
      while(used[rr[nowr].second])nowr++;
      int a=rr[nowr].second;
      if(now<l[a]){ans+=l[a]-now;now=l[a];}
      if(now>r[a]){ans+=now-r[a];now=r[a];}
      used[rr[nowr].second]++;
    }
  }
  ans+=abs(now);
  cout<<max(ans,fans)<<endl;
}


Measured memory_bytes: 5760
#!/usr/bin/env python

import sys

line = sys.stdin.readline().strip()
n = int(line)
parts = sys.stdin.readline().strip().split()
nvals = map(int,parts)
nhash = {}

for item in nvals:
    if nhash.has_key(item):
        nhash[item] += 1
    else:
        nhash[item] = 1

line = sys.stdin.readline().strip()
m = int(line)
parts = sys.stdin.readline().strip().split()
mvals = map(int,parts)
mhash = {}

for item in mvals:
    if mhash.has_key(item):
        mhash[item] += 1
    else:
        mhash[item] = 1

for item in mhash.keys():
    if nhash.has_key(item) and mhash[item] <= nhash[item]:
        pass
    else:
        print "NO"
        sys.exit()

print "YES"


Measured memory_bytes: 61512
//q1
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <numeric>
#define pb push_back
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int INF =  2147483647;
const ll INFLL = 9223372036854775807;



int main() {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  int i_a = a, i_b = b, i_c = c;
  int pre_a = a, pre_b = b, pre_c = c;
  int ans = 0;
  while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    a = pre_b / 2 + pre_c / 2;
    b = pre_c / 2 + pre_a / 2;
    c = pre_a / 2 + pre_b / 2;
    if (i_a == a && i_b == b && i_c == c) {
      ans = -1;
      break;
    }
    if (ans == 10000) {
      i_a = a;
      i_b = b;
      i_c = c;
    }
    pre_a = a;
    pre_b = b;
    pre_c = c;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
const int mo=1e9+7;
map<ll,ll> mp;

inline ll f(ll x)
{
    if(mp[x])return mp[x];
    return mp[x]=(f(x/2)+f((x-1)/2)+f((x-2)/2))%mo;
}
main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n;
    cin>>n;
    mp[0]=1;
    mp[1]=2;
    printf("%lld\n",f(n));
    return 0;
}

Measured memory_bytes: 256
import math
N = int(input())

Answer1 = N//1.08
Answer2 = Answer1 + 1

if math.floor(Answer1 * 1.08) == N:
  print(int(Answer1))
elif math.floor(Answer2 * 1.08) == N:
  print(int(Answer2))
else:
  print(":(")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  if (A == 7 && B == 5 && C == 5){
    cout << "YES" << endl;
  }
  else if (A == 5 && B == 7 && C == 5){
    cout << "YES" << endl;
  }
  else if (A == 5 && B == 5 && C == 7){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3596
#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>;

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


ll lcm(ll x, ll y) {
    return (ll)x / gcd(x, y) * y;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i] /= 2;
    ll curlcm=a[0];
    for(int i=1; i<n; ++i){
        ll x = lcm(curlcm, a[i]) / curlcm;
        ll y = lcm(curlcm, a[i]) / a[i];
        if (x % 2 == 0 || y % 2 == 0) {
            cout << 0 << "\n";
            return 0;
        }
        curlcm = lcm(curlcm, a[i]);
        if (curlcm > m) {
            cout << 0 << "\n";
            return 0;
        }
    }
    cout << (m/curlcm+1)/2 << "\n";

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 4e5 + 5, mod = 1e9 + 7;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y;



    return 0;
}


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

int main(void) {
    int n, m, x;
    cin >> n >> m >> x;
    int a[m];
    int cost_left = 0;
    int cost_right = 0;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        if (a[i] < x) cost_left++;
        else cost_right++;
    }
    if (cost_left < cost_right) cout << cost_left << endl;
    else cout << cost_right << endl;
    return 0;
}

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

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

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

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

int main(){
	int n;
	string s;
	map<pair<string,string>,int> mp;
	LL ans=0;
	cin>>n>>s;
	FOR(i,0,(1<<n)){
		string t="",t2="";
		FOR(j,0,n){
			if(i&(1<<j))t+=s[j];
			else t2+=s[j];
		}
		mp[MP(t,t2)]++;
	}
	FOR(i,0,(1<<n)){
		string t="",t2="";
		FOR(j,0,n){
			if(i&(1<<j))t+=s[2*n-1-j];
			else t2+=s[2*n-1-j];
		}
		ans+=mp[MP(t,t2)];
	}
	cout<<ans<<endl;
    return 0;
}


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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define FORE(i,a,b) for (int i=(int)(a);i<=(int)(b);++i)
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)
#define REPE(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VEC;

int main() {
  int H,W;cin>>H>>W;
  char grid[H][W];
  bool w_checker[W];
  bool h_checker[H];
  REP(i,H)REP(j,W) {
    char a;cin>>a;
    grid[i][j] = a;
  }
  REP(i,H) h_checker[i] = false;
  REP(j,W) w_checker[j] = false;
  REP(i,H)REP(j,W) {
    if (grid[i][j] == '#') {
      w_checker[j] = true;
      h_checker[i] = true;
    }
  }
  REP(i,H) {
    if (!h_checker[i]) continue;
    REP(j,W) {
      if (!w_checker[j]) continue;
      cout << grid[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int main()
{
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "wt", stdout);
//#endif
    int n;
    cin>>n;
    vi a(n);
    vpi b;
    forn(i,0,n) {
        cin>>a[i];
        b.pb(mp(a[i], i));
    }
    sort(all(b));
    int ans = 0;
    for(int i=0; i<n; i+=2) {
        if(i%2 != b[i].second % 2) ans++;
    }
    cout<<ans<<endl;
    
    
    
}



Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t
using Graph = vector<vector<int> >;
typedef pair<int, int> P;

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int N; cin >> N;
  vector<int> A(N+1, 0), S(N+1, 0);
  for(int i = 1;i <= N;i++)
    cin >> A[i];
  sort(ALL(A));
  int ans = N, minus = 0;
  for(int i = 1;i <= N;i++){
    S[i] = S[i-1]+A[i];
    if(S[i]*2 < A[i+1]) minus = i;
  }
  cout << ans - minus << endl;
}


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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec)
    is >> x;
  return is;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  int a, b, k;
  cin >> a >> b >> k;

  if (a < b)
    swap(a, b);
  int c = 0;
  while (1) {
    if (a == b) {
      c = a;
      break;
    }

    c = a - b;
    // cout << a << " " << b << " " << c << endl;
    if (a % c == 0 and b % c == 0)
      break;

    a = max(b, c);
    b = min(b, c);
  }

  int cnt = 0;
  int ans = 0;
  for (int i = 100; i >= 1; i--) {
    if (c % i == 0)
      cnt++;
    if (cnt == k) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int Abslute(int z){
    if(z<0)return 0-z;
    else return z;
}
int main(void){
    int N;
    cin>>N;
    vector<vector<int>>data(N+1,vector<int>(3));
    for(int i=1;i<N+1;i++){
        for(int k=0;k<3;k++){
            cin>>data.at(i).at(k);
        }
    }
    data.at(0).at(0)=0;
    data.at(0).at(1)=0;
    data.at(0).at(2)=0;
    //入力と初期位置の設定
    bool ans=true;
    for(int i=0;i<N;i++){
        
            int t=data.at(i+1).at(0)-data.at(i).at(0);
            int x=Abslute(data.at(i+1).at(1)-data.at(i).at(1));
            int y=Abslute(data.at(i+1).at(2)-data.at(i).at(2));
            //t秒目の時点での情報設定
            
            if(t%2==1){
                if(((x%2==1 && y%2==0)||(x%2==0 && y%2==1)) && x+y<=t) continue;
                else {
                    ans=false;
                    break;
                }
            }
            else {
                if(((x%2==0 && y%2==0)||(x%2==1 && y%2==1)) && x+y<=t) continue;
                else{
                    ans=false;
                    break;
                }
                //可能であるための条件とそうでなかったときに抜ける
            }
        
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
}


Measured memory_bytes: 5760
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;} 
int main(void)
{
  char s[11],t[11];
  int sl;
  
  scanf("%s %s",&s,&t);
  sl=strlen(s);
  
  if(strncmp(s,t,sl)==0)
   printf("Yes");
  else
    printf("No");
  
}


Measured memory_bytes: 1752
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  ll n; cin >> n;
  string s;
  set<string> k;
  for(int i=0;i<n;i++) {
    cin >> s;
    k.insert(s);
  }

  cout << k.size() << endl;
}

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

int bubblesort(int a[],int n){
    int sn = 0;
    int flag =1;
    for(int i = 0 ; flag;i++){
        flag = 0;
        for(int j = n - 1;j >= i + 1;j--){
            if(a[j] < a[j - 1]){
                swap(a[j],a[j - 1]);
                sn++;
                flag = 1;
            }
        }
    }
    return sn;
}

int main()
{
    int n;
    int a[105];
    cin >> n;
    for(int i = 0 ; i < n;i++){
        cin >> a[i];
    }
    int sn = bubblesort(a,n);
    for(int i = 0 ; i < n;i++){
        if(i) cout << " ";
        cout << a[i];
    }
    cout << endl << sn << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <stdio.h>
int main()
{
	int N;
	int D;
	int n;
	
	scanf("%d",&N);
	scanf("%d",&D);
	
	if (N%(2*D+1)==0)
	{
		int a = N/(2*D+1);
		printf ("%d",a);
	}	
	else 
	{
		int m = N/(2*D+1)+1;
 		printf("%d",m) ;
	}
}


Measured memory_bytes: 3208
#include<iostream>
#include<algorithm>
#include<iostream>
using namespace std;
int n,a[100010],b[100010],mx=1;
int main()
{
  	cin>>n;
  	for (int i=0;i<n;i++)
      	cin>>a[i];
  	for (int i=0;i<n;i++){
      	b[a[i]+1]++;
      	b[a[i]]++;
      	b[a[i]-1]++;
    }
  	for (int i=0;i<n;i++)
      	mx=max(b[i],mx);
 	cout<<mx;
  	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define FAST_LOG2(x) (sizeof(unsigned long)*8 - 1 - __builtin_clzl((unsigned long)(x)))
#define clog2(x) (((x) - (1 << FAST_LOG2(x))) ? FAST_LOG2(x) + 1 : FAST_LOG2(x))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

int ans=1;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    int n; string str;
    cin >> n >> str;
    for(int i=0; i<n-1; i++){
        if(str[i]!=str[i+1]) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;
vector<int> G[305], revG[305];
vector<int> topo;
bool used[305];
int scc[305];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}
void sccdfs(int v, int id)
{
	used[v] = true;
	scc[v] = id;
	for(int i = 0; i < revG[v].size(); i++){
		if(!used[revG[v][i]]) sccdfs(revG[v][i], id);
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	int u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		G[u].push_back(v);
		revG[v].push_back(u);
	}
	
	for(int i = 1; i <= n; i++) if(!used[i]) tpsort(i);
	reverse(topo.begin(), topo.end());
	
	int id = 0;
	for(int i = 1; i <= n; i++) used[i] = false;
	for(int i = 0; i < topo.size(); i++) if(!used[topo[i]]) sccdfs(topo[i], id++);
	
	for(int i = 1; i <= n; i++){
		vector<int> vec;
		for(int j = 1; j <= n; j++){
			if(scc[i] == scc[j]){
				vec.push_back(j);
			}
		}
		for(int j = 0; j < vec.size(); j++){
			cout << vec[j];
			if(j < (int)vec.size()-1) cout << " ";
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 4380
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {

	int n, k,man = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int h;
		cin >> h;
		if (h >= k) {
			man++;
		}
	}
	cout << man << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define ss(x) scanf("%s",x)
#define mod 1000000007
#define bitcount __builtin_popcountll
#define ll long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pi,int>
#define mp make_pair
vector<pi>v;
map<int,int>m;
int main()
{
	int i,j;
	int k,n;
	sd(n);
	sd(k);
	for(i=1;i<=n;i++)
	{
		sd(j);
		m[j]++;
	}
	if(m.size()<=k){
		printf("0\n");
		return 0;
	}
	int toremove=m.size()-k;
	for(auto it:m)
	{
		pi temp=it;
		swap(temp.first,temp.second);
		v.pb(temp);
	}
	sort(v.begin(), v.end());
	int ans=0;
	for(i=0;i<toremove;i++)
	{
		ans+=v[i].first;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 11768
n = gets.to_i
a = gets.split.map(&:to_i)
cnt = 0
flag = true
while flag == true
    flag = false
    for j in -(n-1)..-1
        if a[-j] < a[-j-1] then
            k = a[-j]
            a[-j] = a[-j-1]
            a[-j-1] = k
            flag = true
            cnt += 1
        end
    end
end
puts a.join(" ")
puts cnt


Measured memory_bytes: 6876
use std::io;
use io_ext::Reader;

fn main() {
    let stdin = io::stdin();
    let mut r = Reader::new(io::BufReader::new(stdin.lock()));
    let s = r.read_line();
    let mut good = true;
    for (i, c) in s.chars().enumerate() {
        if (i + 1) % 2 == 1 && c == 'L' {
            good = false;
            break;
        } else if (i + 1) % 2 == 0 && c == 'R' {
            good = false;
            break;
        }
    }
    if good {
        println!("Yes");
    } else {
        println!("No");
    }
}

/// Extension of io module.
pub mod io_ext {
    use std::io::BufRead;

    pub struct Reader<R> {
        buf: String,
        inner: R,
    }

    impl<R> Reader<R> {
        #[inline]
        pub fn new(inner: R) -> Self {
            Reader { buf: String::new(), inner: inner }
        }

        #[inline]
        pub fn into_inner(self) -> R {
            self.inner
        }
    }

    impl<R: BufRead> Reader<R> {
        #[allow(deprecated)]
        #[inline]
        pub fn read_line(&mut self) -> &str {
            self.buf.clear();
            self.inner.read_line(&mut self.buf).unwrap_or_else(|e| panic!("{}", e));
            self.buf.trim_right()
        }
    }
}

/// Module supporting to parse strings.
pub mod parse {
    use std::str::FromStr;
    use std::borrow::Borrow;

    pub trait ParseNext: Iterator {
        fn parse_next<F: FromStr>(&mut self) -> F;
    }

    impl<'a, S: Borrow<str>, I: Iterator<Item=S>> ParseNext for I {
        fn parse_next<F: FromStr>(&mut self) -> F {
            if let Some(s) = self.next() {
                match s.borrow().parse() {
                    Ok(x) => x,
                    Err(_) => panic!("provided string cannot be parsed")
                }
            } else {
                panic!("iterator has no next element")
            }
        }
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <assert.h>
#include <map>
#include <set>
#include <vector>
#include <functional>
#include <algorithm>
#include <stack>
#include <list>
#include <queue>
#include <bitset>
// #include <iostream>
// #include <iomanip>
// #include <sstream>
using namespace std;
// const int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
// const int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dx[] = {2, 2, -2, -2, 1, 1, -1, -1};
// const int dy[] = {-1, 1, 1, -1, 2, -2, 2, -2};
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define pf printf
#define sf scanf
#define fr(i, a, b) for(int i = a ; i < (int)b ; i++)
#define frr(i, a, b) for(int i = a ; i >= (int)b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str()
#define boost ios_base::sync_with_stdio(false)
#define boost2 cin.tie(NULL)
#define ln puts("")
#define mems(a) memset(a, 0, sizeof(a))
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
ll on_bit(ll x, int pos) {x |= (1ll << pos); return x;}
int off_bit(int x, int pos) {x &= ~(1 << pos); return x;}
bool is_on_bit(ll x, int pos) {return ((x & (1ll << pos)) != 0);}
int flip_bit(int x, int pos) {x ^= (1 << pos); return x;}
int lsb(int x) {return x & (-x);}
int on_bit_all(int x, int pos) {x = (1 << pos)-1; return x;}
const double EPS = 1e-9;
const double PI = 2*acos(0.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int MOD = 1e9+7;
int add(ll a, ll b){return ((a%MOD)+(b%MOD))%MOD;}
int sub(ll a, ll b){return ((a%MOD)-(b%MOD))%MOD;}
int mult(ll a, ll b){return ((a%MOD)*(b%MOD))%MOD;}
ll powmod(ll a,ll b){ll res=1;assert(b>=0);a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

const int N=1e5+10;
int a[N];

int main(){
	int k,n;
	sf("%d%d",&n,&k);
	fr(i,0,n)sf("%d",a+i);
	int res=INF;
	sort(a,a+n);
	fr(i,0,n){
		if(i+k-1<n){
			res=min(res,a[i+k-1]-a[i]);
		}
	}
	pf("%d\n",res);
	return 0;
}

Measured memory_bytes: 512
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << PREC(10) << (double)(n - n / 2) / (double)n << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
A, B, K = map(int, input().split(' '))

if (B - A + 1) / 2 < K:
    for i in range(A, B + 1):
        print(i)
else:
    for i in range(A, A + K):
        print(i)
    for i in range(B - K + 1, B + 1):
        print(i)


Measured memory_bytes: 3060
N, K = gets.split.map{|i|i.to_i}
A = Array.new(N){false}
K.times{|k|
    d = gets.to_i
    a = gets.split.map{|i|i.to_i}
    a.each{|i|
        A[i - 1] = true
    }
}
puts A.count(false)


Measured memory_bytes: 14424
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  using D = double;
  D l;
  cin>>l;
  cout<<(l/3)*(l/3)*(l/3)<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
#define REP(i,n) for (int i=1;i<=n;i++)

int main() {
	int n, m, s[7], c[7];
	bool p = true;
	cin >> n >> m;
	rep(i, m) cin >> s[i] >> c[i];
	int ans[10];
	REP(i, n) ans[i] = 10;
	rep(i, m) {
		if (ans[s[i]] != 10 && ans[s[i]] != c[i]) {
			p = false;
		}
		else {
			ans[s[i]] = c[i];
		}
	}
	if (n != 1) {
		rep(i, m) {
			if (s[i] == 1 && c[i] == 0) p = false;
		}
	}
	if (p) {
		if (n == 1) {
			if (ans[1] == 10) cout << 0 << endl;
			else cout << ans[1] << endl;
		}
		else {
			if (ans[1] == 10) ans[1] = 1;
			REP(i, n) {
				if (ans[i] == 10) cout << 0;
				else cout << ans[i];
			}
			cout << endl;
		}
	}
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
o=->a,n{n<1?1:a**n[0]*o[a,n/2]**2%M}
eval'N,A,B='+`dd`.split*?,
a=o[A*=t=o[A+B,-2+M=10**9+7],N]
b=o[B*=t,N]
[g=k=1,*(1..N-1).map{|i|g=k=k*i%M}].map{|f|$.=($.+o[g*f,M-2]*(a+b)*100*t*k=k*N%M)%M
N+=1
a=a*B%M
b=b*A%M}
p$.

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

int main() {
    int a, b;
    cin >> a >> b;

    if (b % a == 0) cout << a + b << endl;
    else cout << b - a << endl;

    return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, k;
int a[5000];
bitset<5000> b, s, z;

int main() {
    scanf("%d%d", &n, &k);
    forn(i, n) {
        scanf("%d", a + i);
    }
    sort(a, a + n);
    while (n && a[n - 1] >= k) {
        --n;
    }
    z.reset();
    forn(i, k) {
        z.set(i);
    }
    int ans = 0;
    for (int i = 0; i < n; i += 70) {
        int j = min(n, i + 70);
        b.reset();
        b.set(0);
        forn(k, n) if (k < i || k >= j) {
            b |= b << a[k];
        }
        s = b;
        for (int k = i; k < j; ++k) {
            b = s;
            for (int t = i; t < j; ++t) if (t != k) {
                b |= b << a[t];
            }
            b &= z;
            forn(t, 14) {
                b |= b >> (1 << t);
            }
            if (!b.test(::k - a[k])) {
                ++ans;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

int main()
{
	int n, m, c;
	std::cin >> n >> m >> c;
	std::vector<int> b(m);
	for (auto &e : b) std::cin >> e;
	
	std::vector<int> a(m);
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			std::cin >> a[j];
			a[j] *= b[j];
		}
		if (std::accumulate(a.begin(), a.end(), c) > 0) {
			cnt++;
		}
	}
	
	std::cout << cnt << std::endl;
	
	return 0;
}


Measured memory_bytes: 3160