akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
int c[3];
int main() {
	int n; int p[100]; int a, b;
	cin >> n >> a >> b;
	rep(i, n)cin >> p[i];
	rep(i, n) {
		if (p[i] <= a)c[0]++;
		else if (p[i] > b)c[2]++;
		else c[1]++;
	}
	cout << min({ c[0],c[1],c[2] }) << endl;
	//stop
		return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  ll x = 0;
  REP(i, n) x ^= a[i];
  REP(i, n) cout << (x ^ a[i]) << " \n"[i + 1 == n];
  return 0;
}


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

int main(){
    int n; cin >> n;
    int k = 0;
    int cnt=0;
    string c[3] = {"3", "5", "7"};
    bool flag = false;

    rep(keta,9){
        rep(i,pow(3, (keta+1))){
            string s = "";
            bool count357[3] = {false};
            int j = i;
            while(s.size()<keta+1){
                s = c[j%3] + s;
                count357[j%3] = true;
                j /= 3;
            }
            if(stoi(s)>n){
                flag = true;
            }
            if(flag) break;

            if(count357[0]==true && count357[1]==true && count357[2]==true){
                cnt++;
            }

        }
        if(flag) break;
    }
    cout << cnt << endl;
    return 0;
}

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

int main() {
    std::string S;
    std::cin >> S;
    if(S.compare(0, 4, "YAKI") == 0){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

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


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> weights;
    for(int i = 0; i < N; ++i)
    {
        int w;
        cin >> w;
        weights.push_back(w);
    }

    vector<int> diffs;
    int sum = std::accumulate(weights.begin(), weights.end(), 0);
    for(int i = 0; i < N - 1; ++i)
    {
        int s1 = std::accumulate(weights.begin(), weights.begin() + i + 1, 0);
        int s2 = sum - s1;
        int d = abs(s1 - s2);
        diffs.push_back(d);
    }
    cout << *min_element(diffs.begin(), diffs.end());
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
void Main()
{
    ll n;
    cin >> n;
    vector<ll> A(n);
    rep(i, n) cin >> A[i];

    vector<ll> S(*max_element(all(A)) + 1);
    rep(i, n) S[A[i]]++;

    ll total = 0;
    rep(i, S.size()) {
        total += S[i] * (S[i] - 1) / 2;
    }

    rep(i, n) {
        ll m = S[A[i]];
        ll res = total - m * (m - 1) / 2 + (m-1) * (m - 2) / 2;
        put(res);
    }

}
signed main(){ Main();return 0;}

Measured memory_bytes: 6428
n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
   
for i in range(n):
  a[i] = list(map(int, input().split()))
   
for i in range(m):
  b[i] = list(map(int, input().split()))
   
for i in range(n):
  line = []
    
  for j in range(l):
    c = 0
      
    for k in range(m):
      c += a[i][k]*b[k][j]
      
    line.append(str(c))
  
  print(' '.join(line))


Measured memory_bytes: 6248
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

#define ll long long
#define rr register

#define inf 1e9
#define MAXN 1010

using namespace std;

inline int read() {
	int s = 0, f = 0;
	char ch = getchar();
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

void print(int x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) print(x / 10);
	putchar(x % 10 + 48);
}

int n, k, ans;

int a[MAXN];

signed main() {
	n = read();
	k = read();
	for (rr int i = 1; i <= n; i++) a[i] = read();
	sort(a + 1, a + 1 + n);
	for (rr int i = 1; i <= k; i++)
		ans += a[i];
	cout << ans << "\n"; 
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int a, b, k;
  cin >> a >> b >> k;
  for (int i = a; i <= b; i++) {
    if (i - a < k || b - i < k) cout << i << endl;
  }
}

Measured memory_bytes: 256
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
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;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
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 end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll A, P;
    in >> A >> P;
 
    out << (3*A+P)/2 << endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	char S[3]={'\0'};

	scanf("%c%c%c\n",&S[0],&S[1],&S[2]);
	if(S[0]==S[1]&&S[1]==S[2]){
		printf("No\n");
	}else{
		printf("Yes\n");
	}

	return 0;
}


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

using namespace std;

void doc()
{
    freopen("solve.inp","r",stdin);
    freopen("solve.out","w",stdout);
}

long long TatBit(long long x, int i) {
    return x ^ (1LL << i);
}
long long GetBit(long long x, int i) {
    return (x >> i) & 1;
}
void solve() {
    int n;
    cin >> n;
    long long a[n];
    long long AllXor = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        AllXor ^= a[i];
    }
    int cnt[100];
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < 60; i++) {
        for (int j = 0; j < n; j++) cnt[i] += GetBit(a[j], i);
    }
    for (int i = 0; i < 60; i++) {
        if (cnt[i] % 2 == 1) {
            for (int j = 0; j < n; j++) {
                int bit = GetBit(a[j], i);
                if (bit) a[j] = TatBit(a[j], i);
            }
        }
    }
    vector <int> used(n, false);
    for (int id = 59; id >= 0; id--) {
        int Pos = -1;
        for (int i = 0; i < n; i++) {
            if (used[i]) continue;
            int bit = GetBit(a[i], id);
            if (bit) {
                Pos = i;
                break;
            }
        }
        if (Pos == -1) continue;
        used[Pos] = true;
        for (int i = 0; i < n; i++) {
            if (i == Pos) continue;
            int bit = GetBit(a[i], id);
            if (bit) {
                a[i] ^= a[Pos];
            }
        }
    }
    long long S = 0;
    for (int i = 0; i < n; i++) S ^= a[i];
    cout << AllXor + 2 * S;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    //doc();
    solve();
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

struct edge{
  int to;
  int cost;
};

void dfs(const vector<vector<edge>> &g, int v, int par, int dist, vector<int> &out){
  out[v] = dist;
  for(edge next_v : g[v]){
    if(next_v.to == par) continue;
    dfs(g, next_v.to, v, dist + next_v.cost, out);
  }
}

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

  int n;
  cin >> n;

  vector<vector<edge>> g(n);
  REP(i, n - 1){
    int a,b,c;
    cin >> a >> b >> c;
    a--; b--;
    g[a].push_back({b, c});
    g[b].push_back({a, c});
  }

  int q,k;
  cin >> q >> k;
  k--;
  vec x(q), y(q);
  REP(i, q){
    cin >> x[i] >> y[i];
    x[i]--; y[i]--;
  }

  vector<int> dist_to_k(n);
  dfs(g, k, -1, 0, dist_to_k);

  REP(i, q){
    cout << dist_to_k[x[i]] + dist_to_k[y[i]] << endl;
  }

  return 0;
}

Measured memory_bytes: 19072
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string str;
  cin >> str;
  bool flag = str.size() == 6 && (str[2] == str[3] && str[4] == str[5]);
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n;
	bool prime[123456 * 2+1];
	prime[0] = prime[1] = false;
	for (int i = 2; i <= 123456 * 2; ++i) prime[i] = true;
	for (int i = 2; i*i <= 123456 * 2; ++i)
		if (prime[i])
			for (int j = 2; i*j <= 123456 * 2; ++j)
				prime[i*j] = false;
	while (cin >> n && n) {
		int cnt = 0;
		for (int i = n + 1; i <= 2 * n; ++i)
			if (prime[i]) ++cnt;
		cout << cnt << endl;
	}
	return 0;
}


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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

int n, sum;

vector<pair<int, ii>> ans;

priority_queue<int> pq;

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++) {
        int h, p;
        cin >> h >> p;
        ans.pb({h + p, {h, p}});
    }
    sort(ans.begin(), ans.end());
    for(int i = 0; i < ans.size(); i++) {
        pq.push(ans[i].se.se);
        sum += ans[i].se.se;
        if(sum > ans[i].fi) {
            while(!pq.empty() && sum > ans[i].fi) {
                sum -= pq.top();
                pq.pop();
            }
        }
    }
    cout << pq.size();
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

// 1 点更新区間取得

// T, E はそれぞれ要素, 作用素の型
// f, g, h はそれぞれ要素のマージ、作用素を作用させる、作用素のマージ用のラムダ式
// d1, d0 はそれぞれ要素、作用素の単位元
// ti は要素の初期値, 渡さない場合は単位元で埋められる
// p は区間に対して作用素を作用させる回数が長さに応じて変化する場合用のラムダ式

// dat は要素を保持しておくための配列
// laz は作用素を保持しておくための配列
// init(), では要素数に応じて動的に配列を確保
// build() では初期値が与えられた場合に O(N) で構築

template <typename T, typename E>
struct SegmentTree{
    using F = function<T(T, T)>;
    int n;
    F f;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f, T ti, const vector<int> &v):f(f),ti(ti){
        int sz = v.size();
        n = 1;
        while(n < sz) n <<= 1;
        dat.assign(2 * n - 1, ti);
        for(int i = 0; i < sz; i++) dat[n - 1 + i] = v[i];
        for(int i = n - 2; i >= 0; i--) dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
    }

    // x 番目(0 - indexed) の要素を val に更新
    void update(int x, T val){
        x += (n - 1);
        dat[x] = val;
        while(x > 0){
            x = (x - 1) / 2;
            dat[x] = f(dat[2 * x + 1], dat[2 * x + 2]);
        }
    }

    // 区間[a, b)を取得する
    T get(int a, int b, int k, int l, int r){
        if(r <= a || b <= l) return ti;
        if(a <= l && r <= b) return dat[k];
        T vl = get(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = get(a, b, k * 2 + 2, (l + r) / 2, r);
        return f(vl, vr);
    }
    
    T get(int  a, int b){
        return get(a, b, 0, 0, n);
    }
};


signed main(){

    int n, q; cin >> n >> q;
    int ti = 2147483647LL;
    vector<int> v(n, ti);
    SegmentTree<int, int> rmq([](int a, int b){return min(a, b);}, ti, v);
    
    for(int i = 0; i < q; i++){
        int c, x, y; cin >> c >> x >> y;
        if(c) cout << rmq.get(x, y + 1) << endl;
        else rmq.update(x, y);
    }

    return 0;
}




Measured memory_bytes: 5740
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

#define MAXN 100005

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(time(0));

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int num_nodes,M;
ll dp[MAXN],ans[MAXN],res;
vector<int> connections[MAXN];

ll dfs(int node, int prev){
	dp[node] = 1;
	for(int check:connections[node]){
		if(check == prev) continue;
		dp[node] = (dp[node]*(dfs(check,node)+1))%M;
	}
	return dp[node];
}

ll solve(int node, int prev){
	ans[node] = dp[node];
	ll pref[connections[node].size()+2];
	ll suff[connections[node].size()+2];
	pref[0] = suff[connections[node].size()+1] = 1;

	for(int i=1; i<=connections[node].size(); i++){
		int check = connections[node][i-1];
//		if(check == prev) continue;
		pref[i] = (pref[i-1]*(dp[check]+1))%M;
	}
	for(int i=(int)connections[node].size(); i>=1; i--){
		int check = connections[node][i-1];
//		if(check == prev) continue;
		suff[i] = (suff[i+1]*(dp[check]+1))%M;
	}
	ll ov1 = dp[node];
	for(int i=1; i<=connections[node].size(); i++){
		int check = connections[node][i-1];
		if(check == prev) continue;
		ll o_v = dp[check];

		ll n_v = (pref[i-1]*suff[i+1])%M;
		dp[node] = n_v;

		n_v = ((n_v+1)*dp[check])%M;
		dp[check] = n_v;

		solve(check,node);
		dp[check] = o_v;
		dp[node] = ov1;
	}
}

int main(){
	scanf("%d %d",&num_nodes,&M);
	for(int i=1; i<num_nodes; i++){
		int a,b; scanf(" %d %d",&a,&b);
		connections[a].pb(b);
		connections[b].pb(a);
	}
	dfs(1,-1);
	solve(1,-1);
	for(int i=1; i<=num_nodes; i++)
		printf("%lld\n",ans[i]);
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

ll modbit(string S, ll n)
{
    ll N = SZ(S);
    ll d = 1, m = 0;
    REP(i,0,N) {
        m = (m + d * (S[N-i-1] - '0')) % n;
        d = (d * 2) % n;
    }
    return m;
}

vec modbit2(ll N, ll n)
{
    vec A(N, 0);
    ll d = 1;
    REP(i,0,N) {
        A[i] = d;
        d = (d * 2) % n;
    }
    return A;
}

ll popcount(ll n)
{
    ll cnt = 0;
    REP(i,0,20) {
        if((n >> i) & 1 == 1) ++cnt;
    }
    return cnt;
}

int main()
{
    ll N;
    string S;
    cin >> N >> S;
    
    ll n0 = 0;
    REP(i,0,N) {
        if(S[i] == '1') ++n0;
    }

    if(n0 > 1) {
        ll X0 = modbit(S, n0 + 1);
        ll X1 = modbit(S, n0 - 1);
        vec Y0 = modbit2(N, n0 + 1);
        vec Y1 = modbit2(N, n0 - 1);
        REV(Y0); REV(Y1);

        ll cnt, n;
        REP(i,0,N) {
            if(S[i] == '0') {
                n = (X0 + Y0[i]) % (n0 + 1);
            }
            else {
                n = (X1 - Y1[i]) % (n0 - 1);
                n = (n < 0 ? n + n0 - 1 : n);
            }
            cnt = 1;
            while(n > 0) {
                n = n % popcount(n);
                ++cnt;
            }
            PR(cnt);
        }
    }
    else {
        ll X0 = modbit(S, n0 + 1);
        vec Y0 = modbit2(N, n0 + 1);
        REV(Y0); 

        ll cnt, n;
        REP(i,0,N) {
            if(S[i] == '0') {
                n = (X0 + Y0[i]) % (n0 + 1);
                cnt = 1;
            }
            else {
                n = 0;
                cnt = 0;
            }
            while(n > 0) {
                n = n % popcount(n);
                ++cnt;
            }
            PR(cnt);
        }
    }

    return 0;
}

/*



*/

Measured memory_bytes: 6824
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int a, b;

int main() {
	while(~scanf("%d %d", &a, &b)) {
		int m = a * b;
		if(m % 2 == 0) puts("Even");
		else puts("Odd");
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int ara[125];
int main()
{
    int i;
    string str;
    cin>>str;
    for(i=0;str[i];i++)
    {
        ara[str[i]]++;
    }
    for(i=97;i<=122;i++)
    {
        if(ara[i]%2==1)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

ll extGCD(ll a,ll b, ll &x,ll &y){
  if(b==0){
    x=1;
    y=0;
    return a;
  }
  ll d=extGCD(b,a%b,y,x);
  y -= a/b*x;
  return d;
}

int main(){
  ll a,b;
  cin >> a >> b;
  ll x=a;
  ll y=b;
  extGCD(a,b,x,y);
  cout << x << " " << y << endl;
  return 0;
}



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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{
    int N, R;
    cin >> N >> R;

    if(N >= 10){
        cout << R << endl;
    }
    else{
        cout << R + 100 * (10- N) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		long x=sc.nextLong();

		long ans=x/11*2;

		if(x%11!=0 && x%11<=6) {
			ans++;
		}else if(x%11!=0){
			ans+=2;
		}

		System.out.println(ans);
	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 22868
import bisect

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = [0]
for i in range(n):
    sa.append(sa[-1] + a[i])
sb = [0]
for i in range(m):
    sb.append(sb[-1] + b[i])
ans = 0
for i, s in enumerate(sa):
    if s > k:
        break
    ans = max(ans, i + max(0, bisect.bisect_left(sb, k - s + 1) - 1))
print(ans)


Measured memory_bytes: 47556
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, A[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	int max = 1;
	long long ans = A[1] - 1;
	for (i = 2; i <= N; i++) {
		if (A[i] <= max) continue;
		else if (A[i] == max + 1) max++;
		else ans += (A[i] - 1) / (max + 1);
	}
	
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 2084
from sys import stdin
import math
def input():
	return stdin.readline()[:-1]

def intput():
	return int(input().rstrip())

def sinput():
	return input().rstrip().split()

def intsput():
	return map(int, sinput())

def main():
	n = intput()
	ls = list(intsput())
	min_score = 10**30
	for i in range(1, 101):
		score = 0
		for j in ls:
			score += (j-i)**2
		if score < min_score:
			min_score = score
	print(min_score)



if __name__ == '__main__':
	main()

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

int main() {
  int N,i;
  string S;
  cin>>N>>S;
  vector<int> R(N+1,0);
  for (i=0;i<N;i++)
    R[i+1]=R[i]+(S[i]=='R'?1:0);
  cout<<R[N]-R[R[N]]<<endl;
  return 0;
}


Measured memory_bytes: 4028
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()

using namespace std;

const int N = 1e5 + 100;

int s[N];	
int n, m;
int x, y;
int ok[N];

int main() {		
	scanf ("%d%d", &n, &m);
	ok[1] = 1;
	rep(i, 1, n) s[i] = 1;
	rep(i, 1, m) {
		scanf ("%d%d", &x, &y);
		if (ok[x] == 0) ;
		else if (ok[x] == 1 && s[x] == 1) {
			ok[x] = 0;
			ok[y] = 1;
		}
		else {
			ok[y] = 1;
		}
		s[x]--;
		s[y]++;
	}
	int ans = 0;
	rep(i, 1, n) ans += ok[i];
	printf ("%d ", ans);
	
	return 0;
}


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

int main(){
    int i, n;
    double tmp, s = 0;
    vector<double> x, y;
    cin >> n;
    for (i = 0; i < n; i++){
        cin >> tmp;
        x.push_back(tmp);
    }
    for (i = 0;i < n; i++){
        cin >> tmp;
        y.push_back(tmp);
    }

    for (i = 0; i < n; i++){ 
        s += abs(x[i] - y[i]);
    }
    cout << fixed << s << endl;

    s = 0;
    for (i = 0; i < n; i++){ 
        s += pow(x[i] - y[i], 2);
    }
    cout << fixed << sqrt(s) << endl;

    s = 0;
    for (i = 0;i < n; i++){ 
        s += pow(abs(x[i] - y[i]), 3);
    }
    cout << fixed << pow(s, 1.0/3.0) << endl;

    s = 0;
    for (i=0;i<n;i++){ 
        s = max(s, abs(x[i] - y[i]));
    }
    cout << fixed << s << endl;
}


Measured memory_bytes: 3480
import java.util.Scanner;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int a = scn.nextInt();
		int b = scn.nextInt();
		if(a>=1 && a<=9) {
			if(b>=1 && b<=9) {
				System.out.println(a*b);
			}
			else {
				System.out.println(-1);
			}
		}
		else {
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 27088
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int A[9],N,b;
    bool a[9];
    rep(i,9){
        a[i] = false;
        cin>>A[i];
    }
    cin>>N;
    rep(i,N){
        cin>>b;
        rep(j,9){
            a[j] = (a[j] || (A[j]==b));    
        }
    }
    bool ans;
    ans = (a[0]&&a[1]&&a[2])||(a[3]&&a[4]&&a[5])||(a[6]&&a[7]&&a[8])||(a[0]&&a[3]&&a[6])||(a[1]&&a[4]&&a[7])||(a[2]&&a[5]&&a[8])||(a[0]&&a[4]&&a[8])||(a[2]&&a[4]&&a[6]);
    if(ans) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    // rep(i,3){
    //     rep(j,3){
    //         cout<<a[i]<<" ";
    //     }cout<<endl;
    // }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static class unionfind{
		int[] parent;
		int[] number;
		public unionfind(int n){
			this.parent = new int[n+1];
			this.number = new int[n+1];
			for(int i = 1; i <= n; i++) set(i);
		}
		public void set(int i) {
			parent[i] = i;
			number[i] = 1;
		}
		public int find(int i) {
			if (i == parent[i])
				return parent[i];
			else
				return parent[i] = find(parent[i]);
			
		}
		public boolean same(int x, int y){
			return find(x) == find(y);
		}
		public void unite(int x, int y) {
			int xroot = find(x);
			int yroot = find(y);
			if(xroot == yroot)
				return;
			else {
				parent[yroot] = xroot;
				number[xroot] += number[yroot];
			}
		}
		public int getnumber(int i) {
			return number[find(i)];
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] A = new int[m];
		int[] B = new int[m];
		for(int i = 0; i < m; i++) {
			A[i] = sc.nextInt();
			B[i] = sc.nextInt();
		}
		unionfind u = new unionfind(n);
		long[] ans = new long[m+1];
		ans[m] = (long)n*(n-1)/2;
		if(m != 1) {
			for(int i = m-1; i >= 0; i--) {
				if(u.same(A[i], B[i])) {
					ans[i] = ans[i+1];
				}
				else{
					ans[i] = ans[i+1] - u.getnumber(A[i])*u.getnumber(B[i]);
					u.unite(A[i], B[i]);
				}
			}
		}
		for(int i = 1; i <= m; i++) {
			System.out.println(ans[i]);
		}
	}
}


Measured memory_bytes: 97164
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
typedef long long ll;
using namespace std;

int N, A[200000];
ll p[1000001], res;

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1) {
			a = a*x%mod998;
		}
		x = x*x%mod998;
		y /= 2;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod998 - 2);
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		for (int j = 1; j*j <= A[i]; j++) {
			if (A[i] % j == 0) {
				p[j] += A[i];
				if (j*j != A[i]) {
					p[A[i] / j] += A[i];
				}
			}
		}
	}
	for (int i = 1000000; i; i--) {
		p[i] %= mod998;
		p[i] = p[i] * p[i] % mod998;
		for (int j = i + i; j <= 1000000; j += i) {
			p[i] -= p[j];
			p[i] += mod998;
			p[i] %= mod998;
		}
		res += p[i] * modinv(i);
		res %= mod998;
	}
	for (int i = 0; i < N; ++i) {
		res -= A[i];
		res += mod998;
		res %= mod998;
	}
	cout << res * modinv(2) % mod998 << endl;
}

Measured memory_bytes: 8832
#include<iostream>
#include<string>
using namespace std;
char C[63] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int convert(int p, string S) {
	int power[20]; power[0] = 1; for (int i = 1; i <= S.size(); i++)power[i] = power[i - 1] * p;
	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < p; j++) {
			if (C[j] != S[i])continue;
			cnt += power[S.size() - 1 - i] * j;
		}
	}
	return cnt;
}
int main() {
	int n; cin >> n; int W = 0;
	for (int i = 0; i < n; i++) {
		string U; int a; cin >> a >> U; a = convert(a, U);
		W ^= a;
	}
	if (W == 0)cout << "lose" << endl;
	else cout << "win" << endl;
	return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n;
  cin >> n;
  map<ll, ll> mp;
  for (int i = 1; i <= n; i++) {
    ll tmp = i;
    for (int j = 2; j <= i; j++) {
      while (tmp%j == 0) {
	mp[j]++;
	tmp /= j;
      }
    }
  }
  ll ans = 1;
  ll mod = 1e9+7;
  for (int i = 2; i <= n; i++) {
    ans *= mp[i]+1;
    ans %= mod;
  }
  dump(ans);					\
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 100005
#define X first
#define Y second
#define mod 1000000007
#define inf 1e18
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
ll n,i,j,k;

int main()
{
    fastio;
    cin>>n;
    if(n%2==0){
        ll ans=0;
        ll a=10;
        while(n/a){
            ans+=(n/a);
            a*=5;
        }
        cout<<ans<<endl;
    }
    else{
        cout<<"0"<<endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define int long long
int n;
int x[100005];
int dx[100005];
int a[100005];
vector<int>b;
vector<int> f(vector<int>x, ll k){
    if(k==0){
        vector<int>res(n-1);
        rep(i,n-1)res[i] = i;
        return res;
    }
    if(k==1)return x;
    auto res = f(x,k/2);
    auto res2 = res;
    if(k%2){
        rep(i,n-1){
            res2[i] = res[x[i]];
        }
    }
    vector<int>temp(n-1);
    rep(i,n-1)temp[i] = res[res2[i]];
    return temp;
}
signed main(){
    cin >> n;
    rep(i,n){
        cin >> x[i];
    }
    rep(i,n-1){
        dx[i] = x[i+1] - x[i];
//        show(dx[i]);
    }
    int m;
    ll k;
    cin >> m >> k;
    rep(i,n-1){
        b.push_back(i);
    }
    rep(i,m){
        cin >> a[i];
        a[i]--;
        swap(b[a[i]-1],b[a[i]]);
    }
    rep(i,n-1){
//        show(b[i]);
    }
    auto c = f(b,k);
    rep(i,n-1){
//        show(c[i]);
    }
    int ans = x[0];
    rep(i,n){
        cout << ans << endl;
        if(i!=n-1){
            ans += dx[c[i]];
        }
    }
}

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

int main(){
  string s;
  cin>>s;
  int cnt=0;
  int n=s.size();
  rep(i,n-1){
    if(s[i]==s[i+1]&& s[i]=='1'){
      s[i+1]='0';
      cnt++;
    }
    else if(s[i]==s[i+1]&& s[i]=='0'){
      s[i+1]='1';
      cnt++;
    }else if(s[i]!=s[i+1])continue;
  }
    cout<<cnt<<endl;
}

Measured memory_bytes: 512
n = int(input())
p = list(map(int, input().split()))
ref = list(range(1, n + 1))
res = 0

for i in range(0, n):
    if p[i] != ref[i]:
        res += 1

if res == 0 or res == 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
using System;
using System.Linq;
using System.Collections.Generic;

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var text = Console.ReadLine();

            var maru = 0;
            var batsu = 0;
            for(int i = 0; i < text.Length; i++){
                if (text.Substring(i, 1) == "o"){
                    maru++;
                }
                if (text.Substring(i, 1) == "x"){
                    batsu++;
                }
            }

            var remain = 15 - (maru + batsu);
            var total = maru + remain;

            if (total >= 8){
                Console.WriteLine("YES");
            }
            else{
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	int A,B;
	cin >> A>>B;
	if(B%A==0){
		cout<<A+B;
	}else{
		cout <<B-A;
	}
	return 0;
}


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

int main(){
    ll n;
    string s;
    cin >> n >> s;
    for(ll i=0;i<2;i++){
        for(ll j=0;j<2;j++){
            string t="";
            if(i==0) t+='S';
            else t+='W';
            if(j==0) t+='S';
            else t+='W';
            for(ll k=1;k<n-1;k++){
                if(s[k]=='o'&&t[k]=='S'&&t[k-1]=='S') t+='S';
                else if(s[k]=='o'&&t[k]=='S'&&t[k-1]=='W') t+='W';
                else if(s[k]=='o'&&t[k]=='W'&&t[k-1]=='S') t+='W';
                else if(s[k]=='o'&&t[k]=='W'&&t[k-1]=='W') t+='S';
                else if(s[k]=='x'&&t[k]=='S'&&t[k-1]=='S') t+='W';
                else if(s[k]=='x'&&t[k]=='S'&&t[k-1]=='W') t+='S';
                else if(s[k]=='x'&&t[k]=='W'&&t[k-1]=='W') t+='W';
                else if(s[k]=='x'&&t[k]=='W'&&t[k-1]=='S') t+='S';
            }
            bool flag=true;
            if(t[0]=='S'&&s[0]=='o'&&t[1]!=t[n-1]) flag=false;
            else if(t[0]=='S'&&s[0]=='x'&&t[1]==t[n-1]) flag=false;
            else if(t[0]=='W'&&s[0]=='o'&&t[1]==t[n-1]) flag=false;
            else if(t[0]=='W'&&s[0]=='x'&&t[1]!=t[n-1]) flag=false;
            for(ll k=1;k<n-1;k++){
                if(t[k]=='S'&&s[k]=='o'&&t[k-1]!=t[k+1]) flag=false;
                else if(t[k]=='S'&&s[k]=='x'&&t[k-1]==t[k+1]) flag=false;
                else if(t[k]=='W'&&s[k]=='o'&&t[k-1]==t[k+1]) flag=false;
                else if(t[k]=='W'&&s[k]=='x'&&t[k-1]!=t[k+1]) flag=false;
            }
            if(t[n-1]=='S'&&s[n-1]=='o'&&t[0]!=t[n-2]) flag=false;
            else if(t[n-1]=='S'&&s[n-1]=='x'&&t[0]==t[n-2]) flag=false;
            else if(t[n-1]=='W'&&s[n-1]=='o'&&t[0]==t[n-2]) flag=false;
            else if(t[n-1]=='W'&&s[n-1]=='x'&&t[0]!=t[n-2]) flag=false;
            if(flag){
                cout << t << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3744
def main():
    s = list(map(int, input().split("/")))
    if s[0] > 2019:
        print("TBD")
        return
    
    if s[1] > 4:
        print("TBD")
        return

    # 必要??
    if s[2] > 30:
        print("TBD")
        return

    print("Heisei")

if __name__ == "__main__":
    main()


Measured memory_bytes: 9000
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        while(true)
        {
            var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var n = line[0];
            var x = line[1];
            
            var count = 0;

            if(n == 0 && x == 0){
                break;
            }
            
            for(int i = 1; i <= n-2; i++){
                for(int l = i+1; l <= n-1; l++){
                    var tmp = x - (i+l);
                    
                    if(tmp > l && tmp <= n){
                        count++;
                    }
                }
            }
            
            Console.WriteLine(count);
        }
    }
}


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

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  vector<int> h(n);
  for(int i=0; i<n; i++) 
    cin >> h.at(i);
  
  double min = fabs(a - (t - h.at(0) * 0.006));
  int ans = 1;
  
  for(int i=0; i<n; i++) {
    double temp = fabs(a - (t - h.at(i) * 0.006));
    if(temp < min) {
      min = temp;
      ans = i + 1;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, X, Y = lr()
dis = [[0] * (N+1) for _ in range(N+1)]
for i in range(1, N):
    for j in range(i+1, N+1):
        dis[i][j] = dis[j][i] = j - i

answer = [0] * (N)
for i in range(1, N):
    for j in range(i+1, N+1):
        d = min(dis[i][j], dis[i][X] + 1 + dis[Y][j])
        answer[d] += 1

print('\n'.join(map(str, answer[1:])))


Measured memory_bytes: 73308
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
        return x;
    else
        return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
        if(m%2)
            r=(r*n)%p;
        n=(n*n)%p;
        m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    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;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/	
   int a,b;
   cin>>a>>b;
   if(a+b==15)
   	cout<<"+";
   else if(a*b==15)
   	cout<<"*";
   else
   	cout<<"x";
} 	

Measured memory_bytes: 256
using System;
using static System.Console;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            int R = int.Parse(ReadLine());
            if(R < 1200)
            {
                WriteLine("ABC");
            }
            else if(R < 2800)
            {
                WriteLine("ARC");
            }
            else
            {
                WriteLine("AGC");
            }
        }
    }
}

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

int main() {
  int N , K;
  cin >> N >> K;
  vector <int> l(N);
  for(int i = 0; i < N; i++){
    cin >> l.at(i);
  }
  sort(l.begin() , l.end());
  reverse(l.begin() , l.end());
  int answer = 0;
  for(int i = 0; i < K; i++){
    answer+=l.at(i);
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

using namespace std;

int partition(int A[],int p,int r){
  int x=0,i=0,j=0,tmp=0;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      tmp=A[j];
      A[j]=A[i];
      A[i]=tmp;
    }
  }
  tmp=A[r];
  A[r]=A[i+1];
  A[i+1]=tmp;
  return i+1;
}

int main(){
  int n=0;
  int A[1001000]={};
  int Par=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  Par=partition(A,0,n-1);
  //cout<<Par<<endl;
  for(int i=0;i<n;i++){
    if(i!=0)cout<<" ";
    if(i==Par)cout<<"[";
    cout<<A[i];
    if(i==Par)cout<<"]";
    
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 7008
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string[] str=Console.ReadLine().Split(' ');
 	int A=int.Parse(str[0]);
    int B=int.Parse(str[1]);
      if(A>=(2*B)){
        Console.WriteLine(A-(2*B));
      }else{
        Console.WriteLine(0);
      }
        
      
     
    }
    
  }

}


Measured memory_bytes: 27400
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = pow(10, 5)+1;//+1しないとREになる(out of rangeになるんかな?? )


int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  for(int i=0; i<N; i++) cin >> P[i];
  
  //for(int i=0; i<N; i++) cout << P[i] << " " ;
  //cout << endl;
  
  int ans = 1;
  int now_num = P[0];
  for(int i=1; i<N; i++){
    if(P[i] > P[i-1]) continue;
    if(P[i] > now_num) continue;
    ans++;
    now_num = P[i];
    //cout << "i : " << i << endl;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1152
#include<iostream>
using namespace std;
int n,a[101],b[101],ans;
int main()
{
    cin>>n;
    for(int i=1;i<n;++i)
    {
        cin>>b[i];
    }
    a[1]=b[1];
    ans+=a[1];
    for(int i=2;i<n;++i)
    {
        a[i]=min(b[i-1],b[i]);
        ans+=a[i];
    }
    a[n]=b[n-1];
    ans+=a[n];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define vi vector<int>
#define vll vector<lli>
#define maxn 300005
#define mod 998244353
#define inf 1000000


int main()
{
    fastio;
    int x;
    cin>>x;
    if(x>=30) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
long long best;
void pr3(long long a, long long b, long long c)
{
    //cout << a << " " << b << " " << c << endl;
    long long minn = a, maxx = a;
    if(b < minn) minn = b;
    if(b > maxx) maxx = b;
    if(c < minn) minn = c;
    if(c > maxx) maxx = c;
    best = min(best, maxx - minn);
}
void commit2(long long eval, long long H, long long W)
{
    //cout << eval << " " << H << " " << W << endl;
    for(long long lef = max(0ll, H/2 - 10); lef <= min(H, H/2 + 10); lef++)
    {
        long long l_part = lef * W;
        long long r_part = H * W - l_part;
        pr3(eval, l_part, r_part);
    }
}
void commit3(long long H, long long W)
{
    for(long long lef = max(0ll, H/3 - 10); lef <= min(H, H/3 + 10); lef++)
    {
        long long suf_left = lef * W;
        commit2(suf_left, H - lef, W);
        commit2(suf_left, W, H - lef);
    }
}
int main()
{
    long long H, W;
    cin >> H >> W;
    best = H * W;
    commit3(H, W);
    commit3(W, H);
    cout << best << endl;
    return 0;
}


Measured memory_bytes: 256