akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
const int mod = 998244353, N = 210000, M = 250;

int n, num[500];
pii a[N];

inline int addMod(int a, int b) {
	return (a += b) >= mod ? a - mod : a;
}

inline ll quickpow(ll base, ll pw) {
	ll ret = 1;
	while (pw) {
		if (pw & 1) ret = ret * base % mod;
		base = base * base % mod, pw >>= 1;
	}
	return ret;
}

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

inline pii readFrac() {
	ll x = 0, y = 1;
	char ch = getchar();
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	if (ch == '.') {
		ch = getchar();
		while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), y *= 10, ch = getchar();
	}
	int w2 = 0, w5 = 0;
	while (x % 2 == 0) x /= 2, ++w2;
	while (x % 5 == 0) x /= 5, ++w5;
	while (y % 2 == 0) y /= 2, --w2;
	while (y % 5 == 0) y /= 5, --w5;
	return mp(w2, w5);
}

inline bool cmp(const pii &a, const pii &b) {
	if (abs(a.first) != abs(b.first))
		return abs(a.first) < abs(b.first);
	return a.first < b.first;
}

int main() {
	read(n);
	for (R int i = 1; i <= n; ++i)
		a[i] = readFrac();
	sort(a + 1, a + 1 + n, cmp);
	ll ans = 0;
	for (R int i = 1; i <= n; ++i) {
		++num[a[i].second + M];
		if (a[i].first < 0) continue;
		ans -= a[i].second >= 0;
		for (R int j = M - a[i].second; j <= M + 200; ++j)
			ans += num[j];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5188
#include<stdio.h>
#include<string.h>
int main(){
	int i,a,t=0,h=0;
	char A[201],B[201];
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%s %s",A,B);
		if(strcmp(A,B)>0)t=t+3;
		else if(strcmp(A,B)<0)h=h+3;
		else{
			t++;
			h++;
		}
	}
	printf("%d %d\n",t,h);
	return 0;
}



Measured memory_bytes: 2048
import math
import sys
 
T = list(map(int, input().split()))
S = T[0] * T[1]
 
if ((T[0] % 3 == 0) or (T[1] % 3 == 0)):
    print(0)
    sys.exit()
 
minS = 1000000000000
for i in range(1, math.ceil(T[0]/2)+1):
    A = i * T[1]
    F = math.floor(T[1] / 2) * (T[0] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
    A = i * T[1]
    F = math.floor((T[0] - i) / 2) * T[1]
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
 
for i in range(1, math.ceil(T[1]/2) + 1):
    A = i * T[0]
    F = math.floor(T[0] / 2) * (T[1] - i)
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
    A = i * T[0]
    F = math.floor((T[1] - i) / 2) * T[0]
    C = S - (A + F)
    if (F == C):
        minS = min(minS, abs(A - F))
    else:
        if (A > C):
            minS = min(minS, abs(A - F))
        elif(C >= A and A >= F):
            minS = min(minS, abs(C - F))
        else:
            minS = min(minS, abs(C - A))
 
print(minS)

Measured memory_bytes: 3192
#include <stdio.h>

int main(void)
{
    int H;
    int W;

    while ( 1 ) {
        scanf("%d %d", &H, &W);
        if ( (H == 0) && (W == 0) ) {
            break;
        }
        for ( int i = 0; i < H; i++ ) {
            for ( int j = 0; j < W; j++ ) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
long long N, M, V, P;
vector<long long> A;
bool f(int p) {
	auto s = A[p] + M;
	auto r = M * (V-1);
	for (int i = 0; i < N; ++ i) if (i != p) {
		if (i < P-1) {
			r -= M;
		} else {
			if (A[i] > s) return false;
			r -= min(M, s-A[i]);
		}
	}
	return r <= 0;
}
int main() {
	cin >> N >> M >> V >> P;
	A.resize(N);
	for (auto& x : A) cin >> x;
	sort(A.rbegin(), A.rend());
	int l = P-1, r = N;
	while (r-l >= 2) {
		int m = (l+r)/2;
		if (f(m)) {
			l = m;
		} else {
			r = m;
		}
	}
	cout << l+1 << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main ()
{
    int rcas,rmin;
    int pcas,pmin,kcas,kmin,k;
    cin>>pcas>>pmin>>kcas>>kmin>>k;
    if(kcas>=pcas && kmin>=pmin)
    {
        rcas=kcas-pcas;
        rmin=kmin-pmin;
    }
    if(kcas>=pcas && kmin<pmin)
    {
        rcas=(kcas-1)-pcas;
        rmin=(kmin+60)-pmin;
    }
    if(kcas<pcas && kmin>pmin)
    {
        rcas=(kcas+24)-pcas;
        rmin=kmin-pmin;
    }
    if(kcas<pcas && kmin<pmin)
    {
        rmin=(kmin+60)-pmin;
        rcas=(23+kcas)-pcas;
    }
    int vreme;
    vreme=rcas*60+rmin;
   // cout<<vreme<<endl;
    cout<<vreme-k<<endl;
    return 0;

}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=53;
int ans=0,n;
void dfs(ll num,int flag3,int flag5,int flag7)
{
  if(num>n) return;
  if(flag3 && flag5 &&flag7) ans++;
  dfs(num*10+3,1,flag5,flag7);
  dfs(num*10+5,flag3,1,flag7);
  dfs(num*10+7,flag3,flag5,1);
}
int main()
{
  cin>>n;
  dfs(0,0,0,0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	ll odd = 1;
	ll even = 0;
	rep(i,n){
		int a;
		cin>>a;
		ll x=0;
		ll y=0;
		if(a&1){
			x = even*3 + odd*2;
			y = odd;
		}
		else{
			x = even * 3 + odd;
			y = odd * 2;
		}
		// cout<<x<<" "<<y<<endl;
		odd = y;
		even = x;
	}
	cout<<even<<endl;
}


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

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef  long long ll;
const int MAXN=100;
int b[MAXN],a[MAXN];
int main(){
 int n,ans=0; cin>>n;
 for(int i=0;i<n-1;i++)cin>>b[i];
 a[0]=a[1]=b[0];
 for(int i=1;i<n-1;i++){
     if(a[i]>b[i])
         a[i]=b[i],a[i+1]=b[i];
    else
        a[i+1]=b[i];
 }
 for(int i=0;i<n;i++)ans+=a[i];
 cout<<ans;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	const ll MAX_SIZE = 1000005;

	bool num[MAX_SIZE];
	for(int i = 0; i < MAX_SIZE; ++i)
	{
		num[i] = false;
	}

	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}

	sort(a.begin(), a.end());
	for(int i = 0; i < n - 1; ++i)
	{
		if(a[i] == a[i + 1] && num[a[i]] == false)
		{
			ll prime = 0;
			while(prime += a[i], prime < MAX_SIZE)
			{
				num[prime] = true;
			}
		}
	}

	a.erase(unique(a.begin(), a.end()), a.end());

	int ans = 0;
	for(const auto& v : a)
	{
		if(num[v] == true)
		{
			continue;
		}

		ans++;
		ll prime = 0;
		while(prime += v, prime < MAX_SIZE)
		{
			num[prime] = true;
		}
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 5820
num = int(input())
bangou = list(map(int, input().split()))
manzoku = list(map(int, input().split()))
addit = list(map(int ,input().split()))
a = 0
for i, youso in enumerate(bangou):
    a += manzoku[youso-1]
    if i == 0:
        pass
    else:
        if bangou[i-1] == youso - 1:
            a += addit[bangou[i-1]-1]
print(a)    

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

int main() {
    long long x,a,b;
    cin >> x;
    for (int i = 1;i<200;i++){
        for(int j=-200;j<200;j++){
            long long totyuu=pow(i,5)-pow(j,5);
            if (totyuu == x){
                a=i,b=j;
            }
        }
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 4084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100010;
int n;
ll k;
ll tree[N];
int lowbit(int i) { return i & -i; }
ll query(int x)
{
	ll ret = 0;
	for(int i = x; i; i -= lowbit(i)) ret += tree[i];
	return ret;
}
void update(int pos, ll delta)
{
	for(int i = pos; i <= 100000; i += lowbit(i)) tree[i] += delta;	
}
int main()
{
	scanf("%d%lld", &n, &k);
	for(int i = 1; i <= n; ++i)
	{
		int a; ll b; scanf("%d%lld", &a, &b);
		update(a, b);
	}
	for(int i = 1; i <= 100000; ++i)
	{
		ll x = query(i);
		if(x >= k) { printf("%d\n", i); break; }
	}
	return 0;
} 

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

int N,x,fi,se;
vector<int> be, en;

int main(){
    scanf("%d%d",&N,&x);
    if(x==1||x==2*N-1){
        cout<<"No"<<endl;
        return 0;
    }
    fi = 1;
    se = 2 * N - 1;
    cout<<"Yes"<<endl;
    for(int i = 1; i < N; i++){
        if(i % 2){
            be.push_back(fi);
            en.push_back(se);
            fi++;
            se--;
            if(fi == x){
                fi++;
            }
            if(se == x){
                se--;
            }
        }else{
            be.push_back(se);
            en.push_back(fi);
            fi++;
            se--;
            if(fi == x){
                fi++;
            }
            if(se == x){
                se--;
            }
        }
    }
    reverse(en.begin(), en.end());
    for(int i = 0; i < en.size(); i++){
        cout << en[i] << endl;
    }
    cout << x << endl;
    for(int i = 0; i < be.size(); i++){
        cout << be[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 2548
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

constexpr static int MAXN = 3e5 + 10;
constexpr static int MAXL = 1e5 + 10;
constexpr static int N1 = (1 << 9);

int n;
int v[MAXN], w[MAXN];
vector <pair <int, int>> dp[N1];

void dp_step(const vector <pair <int, int>>& cur,
        vector <pair <int, int>>& nxt, int u, int L) {
    const auto& a = cur;
    vector <pair <int, int>> b;
    for (auto p : cur)
        if (p.first + w[u] <= L)
            b.push_back({p.first + w[u], p.second + v[u]});

    int i = 0, j = 0;
    while (i < a.size() && j < b.size()) {
        if (a[i].first < b[j].first) {
            if (nxt.size() == 0 || a[i].second > nxt.back().second)
                nxt.push_back(a[i]);
            i++;
        }
        else if (a[i].first > b[j].first) {
            if (nxt.size() == 0 || b[j].second > nxt.back().second)
                nxt.push_back(b[j]);
            j++;
        }
        else {
            int vmax = max(a[i].second, b[j].second);
            if (nxt.size() == 0 || vmax > nxt.back().second)
                nxt.push_back({a[i].first, vmax});
            i++, j++;
        }
    }
    while (i < a.size()) {
        if (nxt.size() == 0 || a[i].second > nxt.back().second)
            nxt.push_back(a[i]);
        i++;
    }
    while (j < b.size()) {
        if (nxt.size() == 0 || b[j].second > nxt.back().second)
            nxt.push_back(b[j]);
        j++;
    }
}

void init() {
    dp[0].push_back({0, 0});
    for (int i = 1; i <= n && i < N1; i++)
        dp_step(dp[i >> 1], dp[i], i, MAXL);
}

int query(int u, int L) {
    vector <pair <int, int>> cur, nxt;
    cur.push_back({0, 0});
    while (u >= N1) {
        if (w[u] <= L) {
            dp_step(cur, nxt, u, L);
            cur = nxt;
            nxt.clear();
        }
        u /= 2;
    }

    const auto& a = dp[u];
    const auto& b = cur;
    int j = b.size() - 1;
    int vmax = 0;
    for (int i = 0; i < a.size(); i++) {
        while (j > 0 && a[i].first + b[j].first > L)
            j--;
        if (a[i].first + b[j].first <= L)
            vmax = max(vmax, a[i].second + b[j].second);
    }

    return vmax;
}

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

    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> v[i] >> w[i];

    init();

    int q;
    cin >> q;
    while (q--) {
        int u, L;
        cin >> u >> L;
        cout << query(u, L) << '\n';
    }
}


Measured memory_bytes: 6660
N, K = [int(c) for c in input().split()]
S = input()

nums = []
cnt = 1
if S[0] == "0":
  nums.append(0)
for i in range(N):
  if i == N-1 or S[i] != S[i+1]:
    nums.append(cnt)
    cnt = 1
  else:
    cnt += 1
if S[-1] == "0":
  nums.append(0)

Sum = [0]*(len(nums)+1)
for i in range(1, len(nums)+1):
  Sum[i] = Sum[i-1] + nums[i-1]

ans = 0
if len(nums) <= 2*K+1:
  ans = N
else:
  for i in range(0, len(nums) - 2*K+1, 2):
    ans = max(ans, Sum[i+2*K+1] - Sum[i])

print(ans)

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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


vector<int> dx{0, 1};
vector<int> dy{-1, 0};


struct Data{
    int n;
    vector<int> vx, vy;
    Data(vector<int> vx, vector<int>(vy)) : n(vx.size()), vx(vx), vy(vy){}
    Data(istream& st){
        st >> n;
        for(int i = 0; i < n; ++i){
            int x, y;
            st >> x >> y;
            vx.push_back(x);
            vy.push_back(y);
        }
    }

    vector<Data> get(){
        return vector<Data>{_get(false), _get(true)};
    }

    Data _get(bool inv = false){
        auto x = vx;
        auto y = vy;
        if(inv){
            reverse(x.begin(), x.end());
            reverse(y.begin(), y.end());
        }
        for(int i = n - 1; i >= 0; --i){
            x[i] -= x[0];
            y[i] -= y[0];
        }
        for(int d = 0;; ++d){
            for(int i = 0; i < n; ++i){
                int nx = x[i] * dx[0] + y[i] * dx[1];
                int ny = x[i] * dy[0] + y[i] * dy[1];
                x[i] = nx;
                y[i] = ny;
            }
            if(!x[1] && y[1] > 0)
                break;
        }
        return Data(x, y);
    }

    friend bool operator==(const Data& x, const Data& y){return x.vx == y.vx && x.vy == y.vy;};
};

bool solve(){
    int n;
    cin >> n;
    if(!n)
        return false;
    Data d(cin);
    d = d._get();
    vector<Data> v;
    vector<vector<Data>> w(n);
    for(int i = 0; i < n; ++i){
        v.emplace_back(cin);
        w[i] = v.back().get();
    }
    for(int i = 0; i < n; ++i){
        for(auto& p : w[i])
            if(d == p){
                cout << i + 1 << endl;
                break;
            }
    }
    cout << "+++++\n";
    return true;
}

signed main(){
    while(solve());
}



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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long ll;

int L[MAX/2+2], R[MAX/2+2];

ll merge(int A[], int left, int mid, int right) {
    ll cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) {
        L[i] = A[left+i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = A[mid+i];
    }
    L[n1] = R[n2] = SENTINEL;
    int l = 0; int r = 0;
    for (int i = left; i < right; i++) {
        if (L[l] <= R[r]) {
            A[i] = L[l++];
        } else {
            A[i] = R[r++];
            cnt += n1 - l;
        }
    }
    return cnt;
}

ll merge_sort(int A[], int left, int right) {
    int mid;
    ll v1, v2, v3;
    if (left+1 < right) {
        mid = (left + right) / 2;
        v1 = merge_sort(A, left, mid);
        v2 = merge_sort(A, mid, right);
        v3 = merge(A, left, mid, right);
        return v1 + v2 + v3;
    } else {
        return 0;
    }
}

int main() {
    int A[MAX], N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll ans = merge_sort(A, 0, N);
    cout << ans << endl;
    return 0;
}



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

int main() {
	int n, k; cin >> n >> k;
	long long ans = 0, cnt = 0;
	if (k % 2 == 0) {
		for (int i = 1; i <= n; i++) {
			if (i % k == (k / 2))cnt++;
		}
	}
	ans += cnt * cnt * cnt;
	cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (i % k == 0)cnt++;
	}
	ans += cnt * cnt * cnt;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
Ps = map(int, input().split())
Ps = [(i+1)/2 for i in Ps]

tmp = sum(Ps[:K])
ms = tmp

for i in range(K,N):
  tmp = tmp + Ps[i] - Ps[i-K]
  if ms < tmp:
    ms = tmp
    
print(ms)

Measured memory_bytes: 71792
import numpy as np

N, M, X = map(int, input().split())
CA = np.array([list(map(int, input().split())) for _ in range(N)], dtype=int)
C = CA[:, 0]
A = CA[:, 1:]

def is_ok(mask):
    if not np.any(mask):
        return False
    return np.all(np.sum(A[mask], axis=0)>=X)

ans = np.inf
for bit_mask in range(2**N):
    mask = [bool((bit_mask >> i) & 1) for i in range(N)]
    if is_ok(mask):
        ans = min(ans, sum(C[mask]))
print(ans if ans!=np.inf else -1)



Measured memory_bytes: 27284
#include <stdio.h>
#include <stdlib.h>

int sosu(int);
	 
int main()
{
  int number,answer,count,i,z=0;
  scanf("%d",&count);

  for(i=0;i<count;i++)
    {
      scanf("%d",&number);
      answer=sosu(number);
      if(answer)z++;
    }
  printf("%d\n",z);

  return 0;
}

int sosu(int number)
{
  int i;

  if(number<=3&&number>1)
    {
      return 1;
    }
  else if(number%2==0||number%3==0)
    {
      return 0;
    }
  else
    {
      for(i=5;i*i<=number;i+=6)
	{
	  if(number%i==0||number%(i+2)==0)
	    {
	      return 0;
	    }
	}
    }
  return 1;
}

  

  



Measured memory_bytes: 2064
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memset( x, y, sizeof x )
using namespace std;

typedef long long LL;
typedef pair < int, int > pa;

const int MAXN = 200020;
const int INF = 0x3f3f3f3f;

int n, m, v[22], tot, a[MAXN], d[MAXN];
int f[MAXN][22], g[MAXN][22];
int dpl[MAXN << 2], dpr[MAXN << 2], ans[MAXN];

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%d%d", &n, &m );
	for( int i = 1 ; i <= n ; i++ ) scanf( "%d", &a[ i ] );
	while( m ) v[ tot++ ] = m, m >>= 1;
	v[ tot++ ] = 0;
	d[ 1 ] = d[ n + 1 ] = INF;
	for( int i = 2 ; i <= n ; i++ ) d[ i ] = a[ i ] - a[ i - 1 ];
	for( int j = 0 ; j < tot ; j++ )
	{
		for( int i = 1 ; i <= n ; i++ )
			if( d[ i ] > v[ j ] ) f[ i ][ j ] = i;
			else f[ i ][ j ] = f[ i - 1 ][ j ];
		for( int i = n ; i ; i-- )
			if( d[ i + 1 ] > v[ j ] ) g[ i ][ j ] = i;
			else g[ i ][ j ] = g[ i + 1 ][ j ];
	}
	fill( dpr, 0x3f );
	dpr[ 0 ] = n + 1;
	for( int i = 0 ; i < ( 1 << tot ) ; i++ )
		for( int j = 0 ; j < tot ; j++ ) if( !( i >> j & 1 ) )
		{
			if( dpl[ i ] >= n ) dpl[ i | ( 1 << j ) ] = n;
			else dpl[ i | ( 1 << j ) ] = max( dpl[ i | ( 1 << j ) ], g[ dpl[ i ] + 1 ][ j ] );
			if( dpr[ i ] <= 1 ) dpr[ i | ( 1 << j ) ] = 1;
			else dpr[ i | ( 1 << j ) ] = min( dpr[ i | ( 1 << j ) ], f[ dpr[ i ] - 1 ][ j ] );
		}
	for( int i = 0 ; i < ( 1 << tot ) ; i++ )
	{
		if( i & 1 ) continue;
		int l = dpl[ i ], r = dpr[ ( 1 << tot ) - 1 - i - 1 ];
		if( l + 1 >= r ) ans[ 1 ]++;
		else
		{
			int L = f[ l + 1 ][ 0 ], R = g[ l + 1 ][ 0 ];
			if( R + 1 >= r && L <= R ) ans[ L ]++, ans[ R + 1 ]--;
		}
	}
	for( int i = 1, cur = 0 ; i <= n ; i++ )
	{
		cur += ans[ i ];
		if( cur ) puts( "Possible" );
		else puts( "Impossible" );
	}
}


Measured memory_bytes: 44544
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, k, c, pref[N], suff[N], dp[N], dp2[N];
string s;
main() {
  file("threesum");
  ios;
  cin >> n >> k >> c >> s;
  s = '#' + s;
  int mx = 1;
  fo(i, 1, n, 1) {
    if (s[i] == 'o') {
      dp[i] = 1;
      if (i > c + 1) chmax(dp[i], pref[i - c - 1] + 1);
    } else {
      dp[i] = mx;
    }
    chmax(mx, dp[i]);
    pref[i] = mx;
  }
  mx = 1;
  foo(i, n, 1, 1) {
    if (s[i] == 'o') {
      dp2[i] = 1;
      if (i + c + 1 <= n) chmax(dp2[i], suff[i + c + 1] + 1);
    } else {
      dp2[i] = mx;
    }
    chmax(mx, dp2[i]);
    suff[i] = mx;
  }
//  if (pref[n] < k) return !(cout << "");
  vi ans;
  fo(i, 1, n, 1) {
//    cout << i << " " << pref[i] << " " << suff[i] << " " << pref[max(0, i - c - 1)] << " " << suff[min(n + 1, i + c+1)] << " CH\n";
    if (s[i] == 'o' and pref[i - 1] + suff[i + 1] < k) ans.eb(i);
  }
  for (int it : ans) cout << it << "\n";
  return 0;
}
/**

*/


Measured memory_bytes: 6092
var
n,max,min,i,x:longint;
begin
readln(n);
max:=-maxlongint;
min:=maxlongint;
for i:=1 to n do
  begin
    read(x);
    if x>max then max:=x;
    if x<min then min:=x;
  end;
writeln(max-min);
end.

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

int main() {
	int n,q;
	cin>>n>>q;
	string s;
	cin>>s;
	
	
	vector<int> p(n,0);
	int count=0;
	for(int i=1;i<n;i++){
		if(s[i-1]=='A'&&s[i]=='C')count++;//p[i]はs[i]までのACの数
		p[i]=count;
	}
	
	//rep(i,n)cout<<p[i]<<endl; ok
	
	rep(i,q){
		int l,r;
		cin>>l>>r;
		l--;
		r--;
		
		if(s[l]=='A')cout<<p[r]-p[l-1]<<endl;
		else cout<<p[r]-p[l]<<endl;
		
	}
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll MOD = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);



int main(void)
{
    char a; cin>>a;
    if(isupper(a)) cout<<'A'<<endl;
    else cout<<'a'<<endl;
    return 0;
}

Measured memory_bytes: 3612
import sys
fastinput=sys.stdin.readline
from collections import deque
N=int(input())
a=[int(i) for i in fastinput().split()]
result=deque()
for k,i in enumerate(a):
    if (N-k)%2:
        result.appendleft(i)
    else:result.append(i)
print(" ".join([str(i) for i in result]))

Measured memory_bytes: 29100
import java.util.*;

public class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int A,B,C;
      	A = sc.nextInt();
      	B = sc.nextInt();
      	C = sc.nextInt();
      	if ((A < C && C < B) || (B < C && C < A)) {
            	System.out.print("Yes");
        }  else {
        	System.out.print("No");
        }   
    }
}

Measured memory_bytes: 21204
def main():
    from builtins import int, map, list, print, min
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A,B,C = input_number_list()
    print(min(B//A,C))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
n=int(input())
count=0
li=[0 for i in range(n)]
for i in range(n):
    a=int(input())
    li[i]=a
li.sort()
i=0
x=1
while i<n-1:
    if li[i]==li[i+1]:
        x+=1
        if i+2==n-1:
            count+=1
    else:
        x=1
        if i+1==n-1:
            count+=1
    if x%2==1:
        count+=1
    i+=x
    x=1
print(count)

Measured memory_bytes: 7396
n, m = [int(i) for i in input().split()]

a = [-1] * n
for _ in range(m):
    s, c = [int(i) for i in input().split()]
    s -= 1
    if a[s] != -1 and a[s] != c:
        print(-1)
        exit()
    a[s] = c

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

    if a[0] == -1:
        a[0] = 1

    for i in range(1, n):
        if a[i] == -1:
            a[i] = 0
else:
    if a[0] == -1:
        a[0] = 0

print("".join(map(str, a)))


Measured memory_bytes: 3064
#include <vector>
#include <stack>
#include <string>
#include <cstdio>
using namespace std;
const int S = 2e9;
char buf[S],*H,*T;
inline char Get()
{
    if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
    if(H==T) return -1;return *H++;
}
inline int read()
{
    int x=0;char c=Get();
    while(!isdigit(c)) c=Get();
    while(isdigit(c)) x=(x*10)+c-'0',c=Get();
    return x;
}
inline long long relo()
{
    long long x=0;char c=Get();
    while(!isdigit(c)) c=Get();
    while(isdigit(c)) x=(x*10)+c-'0',c=Get();
    return x;
}
int main(){
    long long marxism = -10000000000000;
    vector<stack<int> > ms;
    vector<long long> cf;
    vector< vector<int> > tickets;
    int shop = read(),tic = read();
    cf.reserve(shop-1);
    tickets.assign(tic,vector<int>());
    ms.assign(tic,stack<int>());
    for (register int i = 1;i<shop;++i)cf.push_back(-relo());
    for (register int i = 0;i<shop;++i)for (register int j = 0;j<tic;++j)tickets[j].push_back(read());
    for (register int i = shop-1;i>=0;--i){
	long long result = 0;
        for (register int j = 0;j<ms.size();++j){
            int cur = tickets[j][i],prev = 0;
            while (!ms[j].empty()){
                if (cur>tickets[j][ms[j].top()]){
                    cf[ms[j].top()-1] -=(tickets[j][ms[j].top()]-prev);
                    prev = tickets[j][ms[j].top()];
                    ms[j].pop();
                }
                else{
                    cf[ms[j].top()-1] -=(cur-prev);
                    break;
                }
            }
	    result += cur;
	    if (i) cf[i-1] +=cur;
            ms[j].push(i);
        }
        marxism = max(marxism,result);
        for (register int j = i;j<shop-1;++j){
            result +=  cf[j];
            marxism = max(marxism,result);
        }
    }
    printf("%lld",marxism);
}


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

int main(){
    int a[3];
    for(int i = 0;i<3;i++)
        cin>>a[i];
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

M_lst = list(map(int, input().split()))

M_lst.sort()

diff_lst = []
for i in range(M-1):
  diff_lst.append(M_lst[i+1] - M_lst[i])

diff_lst.sort()

ans = 0
for i in range(M - N):
  ans += diff_lst[i]
print(ans)

Measured memory_bytes: 56744
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>

#define maxn 100005

using namespace std;

inline long long getint()
{
	long long num=0,flag=1;char c;
	while((c=getchar())<48||c>57)if(c=='-')flag=-1;
	while(c>=48&&c<=57)num=num*10+c-48,c=getchar();
	return num*flag;
}

map<long long,int>M;

long long num[10];
long long H,W,n;
long long a[maxn],b[maxn];

int main()
{
	H=getint(),W=getint(),n=getint();
	num[0]=(H-2)*(W-2);
	for(int i=1;i<=n;i++)
	{
		a[i]=getint(),b[i]=getint();
		for(long long j=a[i]-2;j<=a[i];j++)for(long long k=b[i]-2;k<=b[i];k++)
		{
			if(j<1||k<1||j>H-2||k>W-2)continue;
			M[j*W+k]++;
		}
	}
	map<long long,int>::iterator iter;
	for(iter=M.begin();iter!=M.end();iter++)
	{
		num[iter->second]++;
		num[0]--;
	}
	for(int i=0;i<=9;i++)printf("%lld\n",num[i]);
}

Measured memory_bytes: 58112
n,m = map(int,input().split())
graph = [[float("inf")]*(n+1) for _ in range(n+1)]
for i in range(m):
  a,b,c = map(int,input().split())
  graph[a][b] = c
  graph[b][a] = c

    

def dijkstra(s,cost):
  d = [float("inf")]*(n+1)
  used = [False]*(n+1)
  d[s] = 0
  
  while True:
    v = -1
    for i in range(1,n+1):
      if (not used[i]) and (v == -1):
        v = i
      elif (not used[i]) and d[i] < d[v]:
        v = i
    if v == -1:
      break
    used[v] = True
               
    for j in range(1,n+1):
      d[j] = min(d[j],d[v]+cost[v][j])
  return d

ans = 0
for i in range(1,n):
  d = dijkstra(i,graph)
  for j in range(i+1,n+1):
    if i == j:
      continue
    if graph[i][j] != float("inf") and graph[i][j] > d[j]:
      ans += 1
print(ans)

Measured memory_bytes: 46064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){a%=mod;b%=mod;return a*b%mod;}
inline int power(int a,int b,int MOD){a%=mod;int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     int a,b;
     cin>>a>>b;
     cout<<max(0LL,a-2*b)<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
constexpr int N = 2e5 + 10;

int n, m, k;
ll a[N], b[N];

int main() {
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for (int i = 1; i <= m; i++) {
		cin >> b[i];
		b[i] += b[i - 1];
	}
	int ans = 0;
	for (int i = 0; i <= n; i++)
		if (k >= a[i])
			ans = max(ans, i + int(upper_bound(b, b + m + 1, k - a[i]) - b - 1));
	cout << ans << "\n";
}

Measured memory_bytes: 6672
#include<iostream>
int main(void)
{
    using namespace std;

    int N,K;

    cin >> N >> K;

    if(N%2==1){
        N += 1;
    }
    if(N/2 >= K){
        cout << "YES" <<endl;
    }
    else cout << "NO" << endl;

    return 0;
}


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


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

    int N;
    cin >> N;

    int c[N][3];
    for (int i = 0; i < N; ++i) {
        cin >> c[i][0] >> c[i][1] >> c[i][2];
        if (c[0][2] == 0 && c[i][2] > 0) {
            swap(c[i], c[0]);
        }
    }

    int tmp_h;
    // int res[3] = {};
    for (int X = 0; X <= 100; ++X) {
        for (int Y = 0; Y <= 100; ++Y) {
            tmp_h = 0;
            for (int k = 0; k < N; ++k) {
                int dis = abs(X - c[k][0]) + abs(Y - c[k][1]);
                if (tmp_h == 0) {
                    tmp_h = c[k][2] > 0? c[k][2] + dis : 0;
                }

                if (c[k][2] != max(tmp_h - dis, 0)) break;
                if (k == N - 1) {
                    cout << X << ' ' << Y << ' ' << tmp_h << '\n';
                    return 0;
                }
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n,count=0;
    cin>>n;
    for(int i=9;i<=n;i+=2)
    {
      ll x=i;
      vi v;
      for(int j=1;j<=sqrt(x);j++)
      {
        if(x%j==0)
        {
          if(x/j==j)
            v.pb(j);
          else
          {
            v.pb(x/j);
            v.pb(j);
          }
        }
      }
      if(v.size()==8)
      {
       // cerr<<"x = "<<x<<endl;
        count++;
      }
    }
    cout<<count<<endl;
}
return 0;
}

Measured memory_bytes: 256
#最後の料理には「調理時間の一の位が0以外の最小である料理」をもってくればよい

Dishes_list = [0] * 5
total_list = [0] * 5
one_rank = 10
total_time = 0

for i in range(0, 5):
    Dishes_list[i] = input()

for i in range(0, 5):
    a = int(Dishes_list[i])
    syo = a // 10
    amari = a % 10
    a = syo * 10
    if amari > 0:
        a += 10
    if (amari < one_rank) and (amari != 0):
        one_rank = amari
    total_list[i] = str(a)

for i in range(0, 5):
    total_time += int(total_list[i])

if one_rank != 0:
    total_time -= 10
    total_time += one_rank

print(total_time)

Measured memory_bytes: 3064
import fractions

a,b,c,d=map(int,input().split())

#a以上b以下の数のなかで、cかdで割り切れるものの数を求めて、合計から除く
ans=b-a+1
c_m=b//c-(a-1)//c
d_m=b//d-(a-1)//d
cd=c*d//fractions.gcd(c,d)
cd_m=b//cd-(a-1)//cd
print(ans-c_m-d_m+cd_m)

Measured memory_bytes: 5048
s=input()
init=[1]*len(s)

for k in range(len(s)-2):
    if s[k]=='R' and s[k+1]=='R':
        init[k+2]+=init[k]
        init[k]=0
for k in range(len(s)-1,0,-1):
    if s[k]=='L' and s[k-1]=='L':
        init[k-2]+=init[k]
        init[k]=0
print(*init)

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll A,B,C,K;
    string S;
    cin >> A>>B>>C>>K;

    REP(i,K){
        if(A>=B){
            B *= 2;
        }
        else{
            C *= 2;
        }
    }
    if(A<B&&B<C){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3592
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn canfill(board: &Vec<Vec<char>>, x: usize, y: usize) -> bool {
    use std::cmp;
    let sx = if x == 0 { 0 } else { x - 1 };
    let sy = if y == 0 { 0 } else { y - 1 };
    let ex = cmp::min(x + 2, board.len());
    let ey = cmp::min(y + 2, board[x].len());
    for cx in sx..ex {
        if cx != x && board[cx][y] == '#' {
            return true;
        }
    }
    for cy in sy..ey {
        if cy != y && board[x][cy] == '#' {
            return true;
        }
    }
    return false;
}

fn main() {
    input! {
        h: usize,
        w: usize,
        board: [chars; h]
    }
    let mut x = 0;
    while x != board.len() {
        let mut y = 0;
        while y != board[x].len() {
            if board[x][y] == '#' && !canfill(&board, x, y) {
                print!("No");
                std::process::exit(0);
            }
            y += 1;
        }
        x += 1;
    }
    print!("Yes");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long int
#define ld double
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
int main()
{
	boost;
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
	cout << "Yes\n";
	else
	cout << "No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, T;
  cin >> N >> T;
  vector<ll> A(N);
  for (ll i = 0; i < N; ++i)
  {
    ll a;
    cin >> a;
    A.at(i) = a;
  }
  vector<pll> need_change;
  ll largest = 0;
  ll prof = 0;
  for (ll i = N - 1; i >= 0; --i)
  {
    largest = max(largest, A.at(i));
    ll temp = largest - A.at(i);
    if (temp == 0)
    {
      continue;
    }
    if (temp > prof)
    {
      need_change = {{A.at(i), largest}};
      prof = temp;
    }
    else if (temp == prof)
    {
      need_change.push_back({A.at(i), largest});
    }
  }
  sort(need_change.begin(), need_change.end(), [] (pll a, pll b) {
    return a.first < b.first;
  });
  sort(A.begin(), A.end());
  ll before = -1;
  ll ans = 0;
  for (ll i = 0; i < need_change.size(); ++i)
  {
    if (need_change.at(i).first == before)
    {
      continue;
    }
    else
    {
      ans += min(upper_bound(A.begin(), A.end(), need_change.at(i).first) - lower_bound(A.begin(), A.end(), need_change.at(i).first), upper_bound(A.begin(), A.end(), need_change.at(i).second) - lower_bound(A.begin(), A.end(), need_change.at(i).second));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2168
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
    int a,b;cin>>a>>b;
    int x=(a+b+1)/2;
    cout<<x<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[] aList = ReadLineIntArray();
        if (aList.Contains(1)) {
            int rtn = 0;
            int wk = 1;
            for (int i = 0; i < n; i++) {
                if (aList[i] == wk) {
                    wk++;
                } else {
                    rtn++;
                }
            }
            Console.WriteLine(rtn);
        } else {
            Console.WriteLine(-1);
        }
    }
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 34268
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
#define f(i,n) for(int i=0;i<(int)n;i++)
#define MOD 1000000009

	int d[10][10];
void wars(void){
	for (int k = 0; k < 10; k++){
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
			}
		}
	}
	return;
}

int main(void){
	int n, m;
	int c[10];
	f(i, 10)c[i] = 0;
	int x;
	int ans=0;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			scanf("%d", &d[i][j]);
		}
	}
	wars();
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			scanf("%d", &x);
			if (x != -1)c[x]++;
		}
	}
	f(i, 10)ans += (c[i] * d[i][1]);
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 200000;
int a[MAX_N];

int main() {
    fastio();

    int n;
    cin >> n;
    int x = 0;
    forn(i, n) {
        cin >> a[i];
        x ^= a[i];
    }

    forn(i, n) {
        cout << (x ^ a[i]) << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 12345678901234


int main(){
    ll i,j,k;
    ll n;
    string s;
    cin>>n>>s;
    string t=s;
    ll ans=0;
    ll now=0;
    for(i=0;i<n;i++){
        if(s[i]=='(') now++;
        else now--;
        while(now<0){
            t='('+t;
            now++;
        } 
    }
    for(i=0;i<now;i++) t=t+')';
    cout<<t<<endl;
    
    return 0;
}

Measured memory_bytes: 256