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

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i < (int)vec.size(); ++i) {
        os << vec[i] << (i + 1 == (int)vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
void dump_func() {
    cerr << "\n";
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
    cerr << head;
    if (sizeof...(Tail) == 0) {
        cerr << " ";
    } else {
        cerr << ", ";
    }
    dump_func(std::move(tail)...);
}
#define dump(...) cerr << "[" << to_string(__LINE__) << "]"        \
                       << "    " << string(#__VA_ARGS__) << " = ", \
                  dump_func(__VA_ARGS__)

using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<double>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using PI = pair<int, int>;
using PL = pair<ll, ll>;
using VPI = vector<PI>;
using VPL = vector<PL>;
using VS = vector<string>;

#define ln '\n'
#define REP(t, n) for (int t = 0; t < (n); ++t)
#define FOR(t, a, b) for (int t = (a); t <= (b); ++t)
#define FORR(t, a, b) for (int t = (a); t >= (b); --t)
#define ALL(c) (c).begin(), (c).end()
#define CAUTO const auto&

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

    int n, d;
    cin >> n >> d;
    VVI point(n);
    REP(i, n) {
        VI temp(d);
        REP(j, d)
        cin >> temp[j];
        point[i] = temp;
    }
    int ans = 0;
    FOR(i, 0, n - 2) {
        FOR(j, i + 1, n - 1) {
            int doublediff = 0;
            REP(k, d) {
                doublediff += pow(point[i][k] - point[j][k], 2);
            }
            if (pow((int)sqrt(doublediff), 2) == doublediff) ans++;
        }
    }
    cout << ans << ln;

    return 0;
}


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

using namespace std;

#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"
#define dump(x) cerr << "~ " << #x << " = " << x << endl

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

int d[1003][1003];
char mat[1003][1003];

int main() {

	fast_cin;

    int n,m,sr,sc,er,ec;
    string s;
    queue< pair<int,int> > q1,q2;
    pair<int,int> r;

    cin >> n >> m;

    cin >> sr >> sc;
    cin >> er >> ec;

    for(int i = 1; i <= n; i++) {
        cin >> s;
        for(int j = 0; j < m; j++) {
            mat[i][j+1] = s[j];
        }
    }
	
    memset(d,-1,sizeof(d));
    d[sr][sc] = 0;

    q1.push(make_pair(sr,sc));

    int x,y,a,b;

    while(1) {
        if(q1.empty() and q2.empty()) {
            break;
        }

        while(!q1.empty()) {

            r = q1.front(); q1.pop();
            x = r.first; y = r.second;

            q2.push(make_pair(x,y));

            if(x == er and y == ec) {
                cout << d[x][y] << endl;
                return 0;
            }

            for(int i = 1; i <= 4; i++) {
                a = x+dx[i];
                b = y+dy[i];

                if(a < 1 or a > n or b < 1 or b > m) continue;
                if(mat[a][b] == '#') continue;

                if(d[a][b] == -1) {
                    d[a][b] = d[x][y];
                    q1.push(make_pair(a,b));
                }
            }
        }

        while(!q2.empty()) {

            r = q2.front(); q2.pop();
            x = r.first; y = r.second;

            if(x == er and y == ec) {
                cout << d[x][y] << endl;
                return 0;
            }

            for(int i = -2; i <= 2; i++) {
                for(int j = -2; j <= 2; j++) {
                    a = x+i;
                    b = y+j;

                    if(a >= 1 and a <= n and b >= 1 and b <= m) {
                        if(mat[a][b] == '#') continue;
                        if(d[a][b] != -1) continue;

                        d[a][b] = d[x][y] + 1;
                        q1.push(make_pair(a,b));
                    }
                }
            }
        }
    }

    

	cout << -1 << endl;
	
	return 0;
}

Measured memory_bytes: 8536
import sys, math

readline = sys.stdin.readline

N, D = map(int, readline().split())

X = [list(map(int, readline().split())) for i in range(N)]

count = 0
for i in range(0, N):
    for j in range(i + 1, N):
        l2 = sum([(x - y) ** 2 for x,y in zip(X[i], X[j])])
        l_floor = math.floor(l2 ** 0.5)
        if l2 == l_floor ** 2:
            count += 1

print(count)


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


using namespace std;






int main() {
    int n;
    cin>>n;
    if(n%10==3) cout<<"bon";
    else if(n%10==0||n%10==1||n%10==6||n%10==8) cout<<"pon";
    else cout<<"hon";




















    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int main(){
  int a;
  cin >> a;
  cout<<a*a<<endl;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 998244353;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;
const int MAX_V = 110;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);	
	int n; cin >> n;
	int x; cin >> x;
	VE a(n); rep(i, n)cin >> a[i];
	int ans = 0;
	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}
	rep(i, n - 1) {
		if (a[i] + a[i + 1] > x) {
			int tmp = a[i] + a[i + 1] - x;
			ans += tmp;
			if (a[i + 1] >= tmp) {
				a[i + 1] -= tmp;
			}
			else {
				a[i + 1] = 0;
				tmp -= a[i + 1];
				a[i] -= tmp;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 1024

int a[N];

int main()
{
    int n, k;
    scanf("%d%d", &n,&k);
    for(int i=0;i<n;++i)
        scanf("%d", &a[i]);
    std::nth_element(a,a+k-1,a+n);
    int ans = 0;
    for(int i=0;i<k;++i)ans += a[i];
    printf("%d\n", ans);
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int ans=0;
  for(int i=1;i<S.size();i++){
    if(S.at(i)!=S.at(i-1)){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) cin >> l[i];
    sort(l, l + n);

    int sum = 0;
    for (int i = 0; i < n - 1; i++) {
        sum += l[i];
    }

    if (sum > l[n - 1]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

const long long MOD = 1000000007LL;
const long long INF = 1e18;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long mult_mod(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    int k, x; cin >> k >> x;

    for(int i = x - k + 1; i < x + k; ++i)
        cout << i << " ";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>
#include<cstdint>
#include<bits/stdc++.h>
using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}

int atcoder(){
    string s,t="keyence";
    cin>>s;
    bool ans=false;
    REP(i,0,s.length()-6) if(t==s.substr(i,7)) ans=true;
    REP(i,1,t.length()) if(s.substr(0,i)==t.substr(0,i) && s.substr(s.length()-t.length()+i)==t.substr(i)) ans=true;
    YESNO(ans);
    return 0;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A = list(map(int, input().split()))
#print(A)
count=0
count2=0

for i in range(len(A)-1):
    #print(A[i])
    if A[i]>A[i+1]:
        count=A[i]-A[i+1]
        #print(count)
        A[i+1]=A[i]
        count2+=count

print(count2)


Measured memory_bytes: 32276
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)

#include <iostream>
#include <vector>
using namespace std;

//重複順列
vector<ll> buf;
void permutation(ll i, const ll size, const ll range_start, const ll range_end)
{
    if (i == size) {
      // ここで所望の作業を行う
      for(ll itr:buf){
        cout << itr;
      }
    }
    else{
        for(ll j = range_start; j <= range_end; ++j){
            buf[i] = j;
            permutation(i + 1, size, range_start, range_end);
        }
    }
}

int main(void)
{
 ll n, k;
 cin >> n >> k;
 vector<ll> A(n+1);
 FOR(i,1,n+1){
   cin >> A[i];
 }
 map<ll, ll> mp;
 ll key = 1, loop_size, start_key, start, ans;
 mp[1] = 0;
 FOR(i,1,n+1){
   if(mp.find(A[key]) == mp.end()){
     mp[A[key]] = i;
     key = A[key];
   }else{
     loop_size = i - mp[A[key]];
     start_key = A[key];
     start = mp[A[key]];
     break;
   }
 }
 if(k<start){
   ans = 1;
 }else{
   k = k-start;
   k = k%loop_size;
   ans = start_key;
 }

 RAP(i,k){
   ans = A[ans];
 }
 cout << ans << endl;
 return 0;
}


Measured memory_bytes: 17180
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};




signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    
    ll n,m,a,b;
    cin>>n>>m>>a>>b;
    ll x[120],y[120];
    rep(i,n) cin>>x[i];
    rep(i,m) cin>>y[i];

    rep2(i,a+1,b+1){
        bool ok=true;
        rep(j,n){
            if(x[j]>=i) ok=false;
        }
        rep(j,m){
            if(y[j]<i) ok=false;
        }
        if(ok){
            cout<<"No War"<<endl;
            return 0;
        }
    }
    cout<<"War"<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  map<ll,ll> cnt;
  for(ll i=a;i<=min(a+k-1,b);i++) cnt[i]++;
  for(ll i=b;i>=max(b-k+1,a);i--) cnt[i]++;
  for(auto p:cnt) cout << p.first << endl;
}

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

using namespace std;

const int MOD = 1000000007;
const int columns[] = {1, 10, 100, 1000, 10000, 100000};

int main() {
    char s[100000];
    cin >> s;
    int n = strlen(s);
    /*
    while(s[n] != '¥0') {
        n++;
    }
    */

    int dp[100001][13];
    for(int i = 0; i < n + 1; i++) {
        for(int j = 0; j < 13; j++) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 13; j++) {
            char c = s[n - i - 1];
            if('0' <= c && c <= '9') {
                int x = c - '0';
                int r = (j + x * columns[i % 6]) % 13;
                dp[i + 1][r] = (dp[i + 1][r] + dp[i][j]) % MOD;
            }else {
                for(int k = 0; k < 10; k++) {
                    int r = (j + k * columns[i % 6]) % 13;
                    dp[i + 1][r] = (dp[i + 1][r] + dp[i][j]) % MOD;
                }
            }
        }
    }

    cout << dp[n][5] << endl;

     return 0;
}

Measured memory_bytes: 5376
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;


int main(int argc, char *argv[])
{
	//init
	string s;
	cin >> s;


	//calc
	string ans = "";
	for (int i = 0; i < s.length(); i++){
		ans.append("x");
	}

	//ans
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, raw_input().split())

def hoge(a, b, c):
    a, b, c = (b + c) / 2, (a + c) / 2, (a + b) / 2
    return a, b, c

for i in xrange(108000):
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print i
        exit()
    a, b, c = hoge(a, b, c)

print -1

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

int main() {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if ((A + B) > (C + D)) {
		cout << "Left" << endl;
	}
	else if ((A + B) == (C + D)) {
		cout << "Balanced" << endl;
	}
	else {
		cout << "Right" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long int ll;
using namespace std;

int main()
{
    int m1, m2, d1, d2; cin >> m1 >> d1 >> m2 >> d2;
    int ans = 0;
    if(m1 != m2) ans = 1;
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 256
// AOJ 2934 Round-trip String
// 2018.3.13 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void ins(char *s)
{
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

#define MIN(a,b) ((a)<=(b)?(a):(b))
int N;
char a[1000005];
int r[1000005];

void calc(char *s)
{
	int i = 0, j = 0, k;

	while (i < N) {
		while (i >= j && i+j < N && a[i-j] == a[i+j]) j++;
		r[i] = j;
		k = 1;
		while (i >= k && i+k < N && k+r[i-k] < j) r[i+k] = r[i-k], k++;
		i += k, j -= k;
	}
}

int main()
{
	int i, j, ii, ans;

	N = in();
	ins(a);
	calc(a);
	ans = N; for (i = 2; i < N; i++) {
		ii = i-1; for (j = ii; ; j += ii) {
			if (j >= N) { ans = i, i = N; break; }
			if (r[j] != MIN(j+1, N-j)) break;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 6648
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;

void dfs(int node, vector<vector<int>> & adj, vector<int> & dp){
    if(adj[node].size() == 0){
        dp[node] = 1;
        return;
    }

    if(dp[node] != 0)
        return;

    for(int x : adj[node]){
        dfs(x, adj, dp);
        dp[node] = max(dp[node], dp[x] + 1);
    }
}

int solve(vector<vector<int>> & adj, int n){
    vector<int> dp(n);

    for(int i = 0; i < n; i++)
        if(dp[i] == 0)
            dfs(i, adj, dp);

    return (*max_element(all(dp)))-1;
}

int main(){
    int n, m, x, y;
    cin>>n>>m;

    vector<vector<int>> adj(n);

    for(int i = 0; i < m; i++){
        cin>>x>>y;
        x--, y--;
        adj[x].push_back(y);
    }

    cout<<solve(adj, n);

    return 0;
}

Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(double x){
  printf("%.15f",x);
}
int D, M, N;
int main(){
  double res;
  rd(N);
  rd(M);
  rd(D);
  res = 2.0 * (N-D) * (M-1) / N / N;
  if(D==0){
    res /= 2;
  }
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20180707-1 [beta]

// --- original code ---
// int N, M, D;
// {
//   double res;
//   rd(N,M,D);
//   res = 2.0 * (N-D) * (M-1) / N / N;
//   if(D==0) res /= 2;
//   wt(res);
// }


Measured memory_bytes: 256
///spaesk

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define pi acos(-1)
#define int long long int
#define ld long double
#define ar array
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<int> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const int ths = 1LL << 40;
const int NN = 5e3 + 6;

const int maxN = 500007;

///
///

void solve()
{

    int n, k;
    cin>>n>>k;
    int a[n];
    for(int i = 0; i < n; i ++) {
        cin>>a[i];
    }
    int s = 1;
    for(int i = 0; i < k; i ++) {
        s *= a[i];
    }
    int p = s;
    for(int i = k; i < n; i ++) {
        if(a[i] <= a[i - k])
            cout<<"No\n";
        else
            cout<<"Yes\n";
    }
    cout<<"\n";
    return ;
}

/*
*/

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


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

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.size() <= k) {
    cout << s << endl;
  }
  else {
    for (int i = 0; i < k; i++) {
      cout << s.at(i);
    }
    cout << "..." << endl;
  }
  
}

Measured memory_bytes: 3632
#include<stdio.h>
#define A 200000 

int main(){
 int n, i, maxv, minv;
 int R[A];
 scanf("%d" , &n);
 
 for(i=0; i<n; i++){
  scanf("%d" , &R[i]);
  }
  
  for(i=0; i<n-1; i++){
   if(i==0 || minv>R[i]){
     minv=R[i];
     }
  if(i==0 || maxv<R[i+1]-minv){
     maxv=R[i+1]-minv;
     }
 }
  
 printf("%d\n" , maxv);
 
 return 0;
 }


Measured memory_bytes: 2520
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int mod = 1000000007;
const int INF = 1001001001;

ll f(ll x){
    if(x == 1) return 1;
    return (2 * f(x/2)) + 1;
}

int main(){
    ll h; cin >> h;
    cout << f(h) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstring>
#include <iostream>
#define pie acos(-1)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sl(a) scanf("%lld",&a)
#define sll(a,b) scanf("%lld %lld",&a,&b)
#define slll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define ss(st) scanf("%s",st)
#define sch(ch) scanf("%ch",&ch)
#define ps(a) printf("%s",a)
#define newLine() printf("\n")
#define pi(a) printf("%d",a)
#define pii(a,b) printf("%d %d",a,b)
#define piii(a,b,c) printf("%d %d %d",a,b,c)
#define pl(a) printf("%lld",a)
#define pll(a,b) printf("%lld %lld",a,b)
#define plll(a,b,c) printf("%lld %lld %lld",a,b,c)
#define pd(a) printf("%lf",a)
#define pdd(a,b) printf("%lf %lf",a,b)
#define pddd(a,b,c) printf("%lf %lf %lf",a,b,c)
#define pch(c) printf("%ch",c)
#define debug1(str,a) printf("%s=%d\n",str,a)
#define debug2(str1,str2,a,b) printf("%s=%d %s=%d\n",str1,a,str2,b)
#define debug3(str1,str2,str3,a,b,c) printf("%s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c)
#define debug4(str1,str2,str3,str4,a,b,c,d) printf("%s=%d %s=%d %s=%d %s=%d\n",str1,a,str2,b,str3,c,str4,d)
#define for0(i,n) for(i=0;i<n;i++)
#define for1(i,n) for(i=1;i<=n;i++)
#define forab(i,a,b) for(i=a;i<=b;i++)
#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
#define NL puts("")
#define sd(a) scanf("%lf",&a)
#define sdd(a,b) scanf("%lf %lf",&a,&b)
#define sddd(a,b,c) scanf("%lf %lf %lf",&a,&b,&c)
#define SP printf(" ")
#define LL long long int
#define ULL unsigned long long int
#define MOD 1000000007
#define pub(x) push_back(x)
#define pob(x) pop_back(x)
#define mem(ara,value) memset(ara,value,sizeof(ara))
#define INF INT_MAX
#define eps 1e-8
#define checkbit(n, pos) (n & (1<<pos))
#define setbit(n, pos) (n | (1<<pos))
#define para(a,b,ara)\
for(int i=a;i<=b;i++){\
    if(i!=0){printf(" ");}\
    printf("%d",ara[i]);\
}\
printf("\n");
#define pvec(vec)\
for(int i=0;i<vec.size();i++){\
    if(i!=0){printf(" ");}\
    printf("%d",vec[i]);\
}\
printf("\n");
#define ppara(n,m,ara)\
for(int i=0;i<n;i++){\
    for(int j=0;j<m;j++){\
        if(j!=0){printf(" ");}\
        printf("%d",ara[i][j]);\
    }\
    printf("\n");\
}
#define ppvec(n,vec)\
for(int i=0;i<n;i++){\
    for(int j=0;j<vec[i].size();j++){\
        if(j!=0){printf(" ");}\
        printf("%d",vec[i][j]);\
    }\
    printf("\n");\
}
#define sara(a,b,ara)\
for(int i=a;i<=b;i++){\
    scanf("%d",&ara[i]);\
}
using namespace std;
int n,ara[2][110];
int dp[2][110];
void input(){
    int i,j;
    si(n);
    for0(i,2){
        for0(j,n){
            si(ara[i][j]);
        }
    }
}
int re(int x,int y){
    if(x==2||y==n){return 0;}
    if(dp[x][y]!=-1){return dp[x][y];}
    int s1=-1,s2=-1;
    s1=ara[x][y]+re(x+1,y);
    s2=ara[x][y]+re(x,y+1);
    return dp[x][y]=max(s1,s2);
}
void solve(){
    mem(dp,-1);
    int i,j,s=re(0,0);
    pi(s);NL;
}
int main(){
//    freopen("input.txt","r",stdin);
    input();
    solve();
    return 0;
}


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


int path[10][10];
int cost[10][10];
int maximum = 0;
int current = 0;
vector<int> pa;
vector<int> mapa;
int n,m;
int dfs(int x){
	pa.push_back(x);
	if( current > maximum ){
		maximum = current;
		mapa = pa;
	}
	for(int i = 0 ; i < n ; i++){
		if( path[x][i] || !cost[i][x] ) continue;
		path[x][i] = path[i][x] = true;
		current += cost[x][i];
		dfs(i);
		path[x][i] = path[i][x] = false;
		current -= cost[x][i];
	}
	pa.pop_back();
}
int main(){
	while( cin >> n >> m && n){
		memset(cost,0,sizeof(cost));
		for(int i = 0 ; i < m ; i++){
			int a,b,c;
			cin >> a >> b >> c;
			a--,b--;
			cost[a][b] = cost[b][a] = c;
		}
		maximum = 0;
		
		for(int i = 0 ; i < n ; i++){
			dfs(i);
		}
		cout << maximum << endl;
		for(int i = 0 ; i < mapa.size() ; i++) cout << mapa[i] + 1 << (i==mapa.size()-1?"\n":" ");
	}
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <stack>

using namespace std;

static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[N][N];
int color[N], d[N], f[N], tt;
int nt[N]; //それぞれの頂点でどの値まで調べたか格納（毎回ゼロから探さなくて良くなり速度向上）

//uに隣接するvを順番に取得
int next(int u){
    for(int v = nt[u]; v < n; v++){
        nt[u] = v + 1;
        if(M[u][v]) {
            return v;
        }
    }
    return -1;
}

void dfs_visit(int r){
    for(int i=0;i<n;i++){
        nt[i] = 0;
    }

    stack<int> S;
    S.push(r);
    color[r] = GRAY;
    d[r] = ++tt;

    while(!S.empty()) {
        int u = S.top();
        int v = next(u);
        if (v != -1) {
            if (color[v] == WHITE) {
                color[v] = GRAY;
                d[v] = ++tt;
                S.push(v);
            }
        } else {
            S.pop();
            color[u] = BLACK;
            f[u] = ++tt;
        }
    }
}

void dfs(){
    //初期化
    for(int i=0;i<n;i++){
        color[i] = WHITE;
        nt[i] = 0;
    }
    tt = 0;

    //未訪問のuを始点として深さ優先探索
    for(int u=0; u<n; u++){
        if(color[u] == WHITE){
            dfs_visit(u); //グラフが連結でない可能性があるため
        }
    }

    for(int i=0; i<n; i++){
        cout<< i+1 << " " << d[i] << " " << f[i] <<"\n";
    }

}

int main() {

    int u, k, v;

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

    for(int i=0; i<n; i++){
        cin >> u >> k;
        u--;
        for(int j=0; j<k; j++){
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    dfs();

    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int n,a,b,c,i,max,p,q;
  cin >> n >> a >> b >> c;
  int h[n];
  i = n;
  while(i--)
    cin >> h[i];
  sort(h,h+n);
  p=a;
  q=c;
  max = floor(q/p);
  for(i=0; i<n; i++){
    p=a+(i+1)*b;
    q+=h[n-i-1];
    if(max>floor(q/p))
      break;
    else
      max = floor(q/p);
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int l=0, r=100;
	while(l!=r){
		int mid = (l+r)/2;
		int aux = (mid-1)*(a-1)+a;
		if(aux<b)l=mid+1;
		else r=mid;
	}
	cout<<l<<endl;
}


Measured memory_bytes: 764
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  int N; cin >> N; int a[N]; int cnt[101010] = {};
  rep(i, N){
    cin >> a[i]; a[i]--; cnt[a[i]]++;
  }
  int gusu = 0, ans = 0;
  rep(i, 101010){
    if(cnt[i]==0) continue;
    ans++;
    if(cnt[i]%2==0) gusu++;
  }
  if(gusu!=0 && gusu%2) ans--;
  cout << ans << endl;
}

Measured memory_bytes: 1024
import numpy as np
N=int(input())

#dp=np.zeros(N+1,4,4,4)
dp=[[[[0]*4 for i in range(4)] for j in range(4)] for k in range(N+1)]

dp[0][3][3][3]=1

for len in range(N):
    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                if(dp[len][c1][c2][c3]==0):
                    continue
                for a in range(4):
                    if(a==2 and c1==1 and c2==0):
                        continue
                    if(a==2 and c1==0 and c2==1):
                        continue
                    if(a==1 and c1==2 and c2==0):
                        continue
                    if(a==2 and c1==1 and c3==0):
                        continue
                    if(a==2 and c2==1 and c3==0):
                        continue
                    dp[len+1][a][c1][c2]+=dp[len][c1][c2][c3]
                    dp[len+1][a][c1][c2]%=10**9+7

                    

ans=0
for c1 in range(4):
    for c2 in range(4):
        for c3 in range(4):
            ans+=dp[N][c1][c2][c3]
            ans%=10**9+7
print(ans)




Measured memory_bytes: 12488
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int H = sc.nextInt();
        int W = sc.nextInt();
        
        int ans = 0;
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < N; j++) {
        		if (H+i <= N && W+j <= N) {
        			ans++;
        		}
        	}
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 22740
#include <stdio.h>
int n, a, c[10007];
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a), c[a]++;
	for(int i = 0; i < 10001; i++) {
		for(int j = 0; j < c[i]; j++) {
			printf(--n ? "%d " : "%d\n", i);
		}
	}
}

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

using namespace std;

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

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

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, D;
	cin >> N >> D;

	cout << (N + 2 * D) / (2 * D + 1) << endl;;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N;

  std::cin >> N;

  std::cout << N * N * N << std::endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
#define lo long
const int lmax=1999999999;
const long long lmx=1999999999999999999;
int n,a[100003];
int ans;
int main(){std::ios::sync_with_stdio(false);
cin>>n;
for(int i=1;i<=n;i++){
	cin>>a[i];
}
sort(a+1,a+n+1);
for(int i=1;i<=n;i++){
	if((a[i])&1)
		ans^=(n-i+1);
}
if(ans!=0){
	cout<<"first"<<endl;
	return 0;
}
cout<<"second"<<endl;

}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
               *       * *       *
               *        *        *
                *               *
                 *             *
                  *           *
                   *         *
                    *       *
                     *     *
                      *   *
                       * *
                        *



*/





Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

char map[64][32];

class Trl
{
public:
	int lx, ly, rx, ry, c;
	bool n;
	Trl(int lx, int ly, int rx, int ry, int c, bool n)
		: lx(lx), ly(ly), rx(rx), ry(ry), c(c), n(n) {}
	bool operator<(const Trl& t) const
	{
		return c > t.c;
	}
};

bool v[60][30][60][30][2];
int dx[] = { 1, 1, 1, 1, 1, 2, 2, 2, 3 };
int dy[] = { -2, -1, 0, 1, 2, -1, 0, 1, 0 };

int main()
{
	int W, H;
	while (cin >> W >> H, W||H)
	{
		for (int y=0; y<H; y++)
		for (int x=0; x<W; x++)
			cin >> map[y][x];

		memset(v, 0, sizeof(v));
		priority_queue<Trl> q;
		
		for (int y=0; y<H; y++)
		for (int x=0; x<W; x++)
			if (map[y][x] == 'S')
			{
				q.push(Trl(x, y, x, y, 0, 1));
				q.push(Trl(x, y, x, y, 0, 0));
			}
		bool f = 0;

		while (!q.empty())
		{
			Trl t = q.top(); q.pop();

			if (v[t.ly][t.lx][t.ry][t.rx][t.n]) continue;
			v[t.ly][t.lx][t.ry][t.rx][t.n] = 1;

			if (map[t.ly][t.lx]=='T' || map[t.ry][t.rx]=='T')
			{
				cout << t.c << endl;
				f = 1;
				break;
			}
			
			for (int i=0; i<9; i++)
			{
				int nx, ny;
				Trl ne = t;
				if (t.n)
				{
					nx = t.lx + dx[i];
					ny = t.ly + dy[i];
					ne.rx = nx;
					ne.ry = ny;
				}
				else
				{
					nx = t.rx - dx[i];
					ny = t.ry - dy[i];
					ne.lx = nx;
					ne.ly = ny;
				}

				if (nx<0||nx>=W||ny<0||ny>=H) continue;
				if (map[ny][nx] == 'X') continue;

				if (map[ny][nx] != 'T' && map[ny][nx] != 'S')
					ne.c += map[ny][nx] - '0';
				
				ne.n = !ne.n;
				if (v[ne.ly][ne.lx][ne.ry][ne.rx][ne.n]) continue;
				q.push(ne);
			}
		}

		if (!f)
			cout << -1 << endl;

	}

	return 0;
}

Measured memory_bytes: 7932
#include<bits/stdc++.h>
#include<map>
using namespace std;
typedef long long int lli;
typedef long long ll;
#define mod 10000000007
int main()
{
  ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   lli t1,c0=0,c1=0,c2=0,c3=0;
   cin>>t1;
   while(t1--)
   {
       string s;
       cin>>s;
       if(s=="AC")
        c0++;
       if(s=="WA")
        c1++;
       if(s=="TLE")
        c2++;
       if(s=="RE")
        c3++;
   }
   cout<<"AC"<<" "<<"x"<<" "<<c0<<"\n";
   cout<<"WA"<<" "<<"x"<<" "<<c1<<"\n";
   cout<<"TLE"<<" "<<"x"<<" "<<c2<<"\n";
   cout<<"RE"<<" "<<"x"<<" "<<c3<<"\n";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,k,pw=1;
    cin>>n>>k;
    double p;
    p=max((ll)0,n-k+1);
    for(ll i=k;;i=(i+1)/2,pw++){
        if((i+1)/2<=n) p+=(min(i,n+1)-(i+1)/2)*pow(0.5,pw);
        if(i==1) break;
    }
    cout<<fixed<<setprecision(9)<<p/n<<endl;
    return 0;
}

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

int main() {
  int A , B , C , D;
  cin >> A >> B >> C >> D;
  
  if ( A + B > C + D ) {
    cout << "Left" << endl;
  }
  else if ( A + B == C + D ) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

int main() {
    int a,b;
    cin >> a >> b;
    for (int i = 0; i < b; i++) {
        int x;
        cin >> x;
        a -= x;
    }
    cout << max(a, -1) << endl;
}

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

#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()

typedef long long ll;

const int maxn = 1e6 + 10;

bool factor[maxn];
bool prime[maxn];
int large[maxn];

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();
	fill(prime, prime + maxn, 1);
	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++) cin >> arr[i];
	int G = arr[0];
	for (int i = 1; i < n; i++) G = myGcd(G, arr[i]);
	for (int i = 2; i < maxn; i++) {
		if (!prime[i]) continue;
		large[i] = i;
		for (int j = 2; j * i < maxn; j++) {
			large[i * j] = i;
			prime[i * j] = false;
		}
	}
	bool fir = true;
	for (int i = n - 1; i > -1 && fir; i--) {
		int x = arr[i];
		unordered_set<int> fact;
		while (x > 1) {
			fact.insert(large[x]);
			x /= large[x];
		}
		for (int i : fact) {
			if (factor[i]) {
				fir = false;
				break;
			}
			factor[i] = true;
		}
	}
	if (fir) return cout << "pairwise coprime", 0;
	if (G == 1) return cout << "setwise coprime", 0;
	cout << "not coprime";
	return 0;
}


Measured memory_bytes: 12388
#include<iostream>
using namespace std;
int main(){
  int n,rcnt=0,bcnt=0;
  char c;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> c;
    if(c=='R'){
      rcnt++;
    }else{
      bcnt++;
    }
  }
  if(rcnt>bcnt) cout << "Yes"<<endl;
  else cout << "No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		for(int i = 0; i < Math.pow(2, n); i++) {
			int temp = i;
			System.out.print(i + ":");
			for(int j = 0; temp > 0; j++) {
				if(temp % 2 == 1) System.out.print(" " + j);
				temp /= 2;
			}
			System.out.println();
		}
	}
}


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

int main()
{
    ll w , h,n;
    cin>>w>>h>>n;
    ll lx = 0  , ux = w , ly = 0 , uy = h;
    for(int i=0;i<n;i++)
    {
        ll x,y,a;
        cin>>x>>y>>a;
        if( a == 1)
        {
            lx = max( lx , x);
        }
        if( a== 2)
            ux = min( ux , x);
        if( a== 3)
            ly = max( ly , y);
        if( a== 4 )
        {
            uy = min( uy , y);
        }
    }
    ll ans =0;
    if( lx >= ux || ly>= uy )
    {
        cout<<0;
    } else
    {
        ans =( uy - ly )* (ux - lx );
        cout<<ans;
    }
}

Measured memory_bytes: 3576
N = 44
F = [0]*(N+1)

def dynamic(n):
    if n == 0 or n == 1:
        return 1
    if F[n] != 0:
        return F[n]
    F[n] = dynamic(n - 1) + dynamic(n - 2)
    return F[n]

if __name__ == '__main__':
    n = int(raw_input())
    print(dynamic(n))

Measured memory_bytes: 6364
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;

    char xx;
    cin>>xx;
    if(xx>=65&&xx<=90)
    {
        cout<<'A'<<endl;
    }
    else
    {
        cout<<'a'<<endl;
    }
}


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

int main(){
	//入力機構
	size_t w;//intは1000を表せるのでこれを保存
	std::string s;
	std::cin>>s>>w;

	//処理機構
	//s[w*i](i=0,1,2,...)を繋げていけば良い
	std::string out;
	size_t size=s.size();
	out.reserve(size/w+1);//高速化のため
	for(size_t i=0;w*i<size;i++){
		out.push_back(s[w*i]);
	}

	//出力機構
	std::cout<<out<<std::endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int farm[101][101];
int h,w;
 
void che(int k,int a,int b){
    if(a<0 | a>w | b<0 | b>h)return;
    farm[a][b]=0;
    if(k==farm[a-1][b])che(farm[a-1][b],a-1,b);
    if(k==farm[a+1][b])che(farm[a+1][b],a+1,b);
    if(k==farm[a][b-1])che(farm[a][b-1],a,b-1);
    if(k==farm[a][b+1])che(farm[a][b+1],a,b+1);
     
}
int main(void){
    char c[101][101];
    int a,b;
    int ans=0;
    while(1){
        ans=0;
        for(b=0;b<101;b++){
            for(a=0;a<101;a++){
                farm[a][b]=0;
            }
        }
        scanf("%d %d",&h,&w);
        if(h==0 && w==0)break;
        for(b=0;b<h;b++){
            scanf("%s",c[b]);   
            for(a=0;a<w;a++){
                if(c[b][a]=='@')farm[a][b]=1;
                if(c[b][a]=='#')farm[a][b]=2;
                if(c[b][a]=='*')farm[a][b]=3;
                 
            }
        }
        for(b=0;b<h;b++){
            for(a=0;a<w;a++){
                if(farm[a][b]==0);
                else{
                    ans++;
                    che(farm[a][b],a,b); 
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


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

long long nRyukaNumber(int n) {
    //int RyukaNumber = 0;
    vector<long long> v(n+1);
    v[0] = 2;
    v[1] = 1;
    for (int i = 2; i <= n; i++) {
        v[i] = v[i-1] + v[i-2];
    }
    
    return v[n];
}

int main() {
    int n; cin >> n;
    cout << nRyukaNumber(n) << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n+2, 0);
    ll sum = 0;
    rep(i,n){
        cin >> a[i+1];
        sum += abs(a[i] - a[i+1]);
    }
    sum += abs(a[n] - a[n+1]);
    for(int i = 1; i <= n; ++i){
        ll ans = sum - abs(a[i] - a[i-1]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1]);
        cout << ans << endl;
    }
	return 0;
}

Measured memory_bytes: 2048