akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
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<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int n = size(s);
    int m = size(t);
    drepn(i, n-m) {
        bool flag = true;
        rep(j, m) {
            if(s[i+j] == '?') continue;
            if(s[i+j] != t[j]) {
                flag = false;
                break;
            }
        }
        if(flag) {
            string ans = s;
            rep(j, m) {
                ans[i+j] = t[j];
            }
            rep(j, n) {
                if(ans[j] == '?') ans[j] = 'a';
            }
            cout << ans << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
}

Measured memory_bytes: 3596
n = int(input())
a = [int(item) for item in input().split()]
b = [int(item) for item in input().split()]

asubb = []
for aa, bb in zip(a, b):
    asubb.append(aa - bb)
asubb.sort(reverse=True)

if sum(asubb) < 0:
    print(-1)
    exit()

minus_sum = 0
ans = 0
for item in asubb[::-1]:
    if item >= 0:
        break
    minus_sum += item
    ans += 1

for item in asubb:
    if minus_sum >= 0:
        break
    minus_sum += item
    ans += 1

print(ans)

Measured memory_bytes: 18420
/*
Railway Connection(https://onlinejudge.u-aizu.ac.jp/problems/1182)
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const int MOD = 1000000007;


void solve(void){
	int N, M, C, S, G;

	while (cin >> N >> M >> C >> S >> G) {
		if (!N) break;
		S--, G--;

		//dis[c][x][y] := cを使ってxからyに行く時の最短経路
		vector <mat> dis(C, mat (N, vec (N, INF)));

		rep(M, i)
		{
			int x, y, d, c;
			cin >> x >> y >> d >> c;
			x--, y--, c--;
			dis[c][x][y] = dis[c][y][x] = min(dis[c][x][y], d);
		}

		rep(C, c)
		{
			//各Cの距離についてWF
			rep(N, k) rep(N, i) rep(N, j)
			{
				dis[c][i][j] = min(dis[c][i][j], dis[c][i][k] + dis[c][k][j]);
			}
		}

		vec ps(C);
		rep(C, i) cin >> ps[i];

		//cost[x][y] := xからyに行く時の最低コスト
		mat cost(N, vec(N, INF));

		rep(C, c)
		{
			vec qs(ps[c]+1, 0), rs(ps[c]);
			//qs[0] = 0, qs[ps[i]] = INF
			qs[ps[c]] = INF;
			rep(ps[c]-1, j) cin >> qs[j+1];
			rep(ps[c], j) cin >> rs[j];

			rep(N, x) rep(N, y)
			{
				int d = dis[c][x][y];
				if (d == INF)
				{
					continue;
				}

				int fare = 0;
				rep(ps[c]+1, p)
				{
					if (d > qs[p])
					{
						fare += min(qs[p+1]-qs[p], d-qs[p]) * rs[p];
					}
				}

				cost[x][y] = min(cost[x][y], fare);

			}

		}

		//コストについてWF
		rep(N, k) rep(N, i) rep(N, j)
		{
			cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
		}

		if (cost[S][G] == INF)
		{
			cout << -1 << endl;
		}
		else
		{
			cout << cost[S][G]  << endl;
		}

	}

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3668
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
constexpr int R=5e6+69, INF=2e9+6969;

int qq;

int main()
{
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5]) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3572
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll x; cin >> x;
    for (ll i = 0; i <= 1000; i++) {
        for (ll j = 0; j <= 1000; j++) {
            ll a = i*i*i*i*i, b = j*j*j*j*j;
            if (a-b == x) {
                cout << i << " " << j << endl;
                return 0;
            } else if ((-1ll*a)-b == x) {
                cout << -1ll*i << " " << j << endl;
                return 0;
            } else if (a-(-1ll*b) == x) {
                cout << i << " " << -1ll*j << endl;
                return 0;
            } else if ((-1ll*a)-(-1ll*b) == x) {
                cout << -1ll*i << " " << -1ll*j << endl;
                return 0;
            }

        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

int A,B;

int main(){
    cin>>A>>B;
    if(A+B>=10){
        out("error");
    }else{
        out(A+B);
    }
}

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

int main() {
	int n;
	string s;
	cin >> n >> s;

	vector<int> w(n);
	vector<int> e(n);

	for (int i = 0; i < n; i++) {
		if (s[i] == 'E') {
			e[i]++;
		}
		if (i) e[i] += e[i-1];
		if (s[n-i-1] == 'W') {
			w[n-i-1]++;
		}
		if (n-i<n) w[n-i-1] += w[n-i]; 
	}

	int ans = 1 << 28;
	for (int i = 0; i < n; i++) {
		int tmp = 1;
		if (i) tmp += e[i-1];
		if (i+1<n) tmp += w[i+1];

		ans = min(ans, n - tmp);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;
    int tmp = 0;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                tmp = 0;
                tmp =i*500+j*100+k*50;
                if(tmp == x){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


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

int main()
{
    int W, H, x, y, r, up, right, down, left;
    cin >> W >> H >> x >> y >> r;
    up = y + r;
    right = x + r;
    down = y - r;
    left = x - r;
    if (up <= H && right <= W && down >= 0 && left >= 0 ) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


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

int n, m, s, t;
vector<int>adjl[100002];
int dist[100002][3]; 
queue<pair<int,int> >bfs;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	memset(dist,-1,sizeof dist);
	cin >> n >> m;
	for (int i=0;i<m;i++){
		int u, v;
		cin >> u >> v;
		adjl[u].push_back(v);
	}
	cin >> s >> t;
	bfs.push({s,0});
	while (!bfs.empty()){
		int now=bfs.front().first;
		int distnow=bfs.front().second;
		bfs.pop();
		if (dist[now][distnow%3]!=-1) continue;
		dist[now][distnow%3]=distnow;
		for (int next : adjl[now]) bfs.push({next,distnow+1});
	}
	cout << (dist[t][0]==-1 ? -1 : dist[t][0]/3)  << "\n";
}

Measured memory_bytes: 6912
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;


int main(int argc, const char * argv[]) {
    
    int n, ans = 0;
    
    cin >> n;
    
    int x[n];
    float ave = 0;
    
    for(int i=0; i<n; i++)
    {
        cin >> x[i];
        ave += x[i];
    }
    
    ave = round(ave / n);
    
    //cout << ave << endl;
    
    for(int i=0; i<n; i++)
    {
        ans += pow(x[i] - ave, 2);
    }
    
    cout << ans << endl;
    
    return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    priority_queue<ll,vector<ll>,greater<ll>> aka;
    priority_queue<ll> ao;
    ll a[300005],s[200005],t[200005];
    cin>>n;
    rep(i,3*n){
        cin>>a[i];
    }
    s[0]=0;
    t[0]=0;
    for(int i=0;i<n;i++){
        s[i+1]=a[i]+s[i];
        aka.push(a[i]);
    }
    for(int i=n;i<=2*n;i++){
        ll mini=aka.top();
        if(mini<a[i]){
            aka.pop();
            s[i+1]=s[i]-mini+a[i];
            aka.push(a[i]);
        }
        else s[i+1]=s[i];
    }

    for(int i=0;i<n;i++){
        t[i+1]=a[3*n-1-i]+t[i];
            ao.push(a[3*n-1-i]);
    }
    for(int i=n;i<2*n;i++){
        ll maxi=ao.top();
        if(maxi>a[3*n-i-1]){
            ao.pop();
            t[i+1]=t[i]-maxi+a[3*n-i-1];
            ao.push(a[3*n-i-1]);
        }
        else t[i+1]=t[i];
    }

    
    ll res=s[n]-t[2*n];
    for(int i=0;i<=n;i++){
        ll k=s[n+i]-t[2*n-i];
        if(k>res)res=k;
    }
    cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 8052
X = int(input())

beki = [1]
for b in range(2,32):
    for p in range(2,1000):
        if b**p <= 1000:
            beki.append(b**p)
        else:
            break

beki.sort()
beki = beki[::-1]

for a in beki:
    if a <= X:
        print(a)
        break

Measured memory_bytes: 3060
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

int a[100], b[100], c[100], d[100];
signed main(void)
{
	int n, m;
	cin >> n >> m;
	REP(i, n) cin >> a[i] >> b[i];
	REP(i, m) cin >> c[i] >> d[i];

	REP(i, n) {
		int ret = INF, idx;
		REP(j, m) {
			if(ret > abs(a[i]-c[j]) + abs(b[i]-d[j])) {
				ret = abs(a[i]-c[j]) + abs(b[i]-d[j]);
				idx = j;
			}
		}
		cout << idx+1 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define double long double
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> V;
const long long MOD=1000000007;
const long long INF = 1e18;
vector <ll> dp;

void solve(long long A, long long B, long long C, long long X){
    ll cnt=0;
    for (ll i = 0; i <= A; i++) {
        for (ll j = 0; j <= B; j++) {
            for (ll k = 0; k <= C; k++) {
                ll sum = 500*i + 100*j + 50*k;
                if (sum==X) cnt++;
            }
        }
    }
    cout << cnt << "\n";
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long X;
    scanf("%lld",&X);
    solve(A, B, C, X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int ans = 0;
    rep(i, n) {
        if (i%2==0 && a[i]%2==1) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/
int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    std::vector<double> x(n),y(n);
    rep(i,n)std::cin >> x[i]>>y[i];
    rep(i,n){
        a[i]=i;
    }
    double ans=0.0;
    do{
        rep(i,n-1){
            ans+=sqrt(pow((x[a[i+1]]-x[a[i]]),2)+pow((y[a[i+1]]-y[a[i]]),2));
        }
    }while(next_permutation(all(a)));
    double kai=1;
    rep(i,n){
        kai*=(i+1);
    }
    ans/=kai;
    std::cout<<keta(10)<< ans << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i64 n;
  cin >> n;
  vi32 a(n);
  rep(i, n) cin >> a[i];
  i64 sum = 0;
  rep(i, n) sum += a[i];
  if (sum % (n * (n + 1) / 2) != 0) {
    cout << "NO" << endl;
    return 0;
  }
  i64 C = sum / (n * (n + 1) / 2);
  i64 kyokai = 0, futsu = 0;
  rep(i, n) {
    int prev = i, next = i + 1;
    if (next >= n) next = 0;
    i64 D = a[next] - a[prev];
    if ((C - D) % n != 0) {
      cout << "NO" << endl;
      return 0;
    }
    if (D > C || D < (1 - n) * C) {
      cout << "NO" << endl;
      return 0;
    }
    i64 c = (C - D) / n;
    if (c > C || c < 0) {
      cout << "NO" << endl;
      return 0;
    }
    kyokai += c;
    futsu += C - c;
  }
  if (kyokai == C && futsu == (n - 1) * C) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;


int main() {
   

    ll a,b,c;
    cin >> a >> b >> c;
    if(b/a > c){
        cout << c << endl;
    }else{
        cout << b/a << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int t = 0;
  int ans = 0;
  for (char c : s) {
    t = (c == 'R' ? t + 1 : 0);
    ans = max(ans, t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define che
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long LL;

const int maxn= 200000 + 10;

char s[maxn];
LL cnt[ maxn];
int main(){
	
	scanf("%s", s);
	LL N= strlen(s), res= N*(N+1)/2 ;
	for (int i=0; i<N; i++) cnt[ s[i]-'a']++;
	for (int i=0; i<26; i++) res -= cnt[i]*(cnt[i]+1)/2;
	cout<<res+1;
	return 0;
}



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


int main(){
	string s;
	cin >> s;
	int A, Z;
	rep(i, s.size()){
		if(s[i] == 'A') {
			A = i;
			break;
		}
	}
	for(int i = s.size()-1;i>=0;i--){
		if(s[i] == 'Z'){
			Z = i;
			break;
		}
	}
	cout << Z - A + 1 << endl;
}	













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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;

#define FIX(a) ((a)%MOD+MOD)%MOD

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    ll n,m;
    cin>>n>>m;

    vector<pii> bridges(m);
    REP(i,m){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        bridges[i] = pii(a,b);
    }

    UnionFind uf(n);
    vl ans(m);
    ll now = (n*(n-1))/2;

    FORR(i,0,m){
        pii p = bridges[i];

        ans[i] = now;

        if(uf.find(p.first) != uf.find(p.second)){
            now -= uf.size(p.first) * uf.size(p.second);
        }

        uf.unite(p.first, p.second);  
    }

    REP(i,m){
        cout << ans[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;

int main(){
      int p[3];
      rep0(i,3) cin>>p[i];
      sort(p,p+3);
      cout<<p[0]+p[1]<<endl;

      return 0;
}

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

using namespace std;

int main(){
	
	int a,b,c,x,y;
	
	cin >> a >> b >> c >> x >> y;
	
	int res = 0;
	int inst = 0;
	
	res = a*x+b*y;
	
	if(x<y){
		inst = 2*c*x + b*(y-x);
	}
	else{
		inst = 2*c*y + a*(x-y);
	}
	if(inst < res) res = inst;
	
	if(x<y){
		inst = 2*c*y;
	}
	else{
		inst = 2*c*x;
	}
	if(inst < res) res = inst;
	
	
	cout << res << endl;
	
}


Measured memory_bytes: 256
<?php

$input = explode(' ', trim(fgets(STDIN)));
$a = intval($input[0]);
$b = intval($input[1]);
$k = intval($input[2]);

$result = [];

$i = 0;
while ($i < $k) {
    // 対象はA以上B以下のみ
    if ($a <= $a + $i && $b >= $a + $i) {
        $result[] = $a + $i;
    }
    if ($a <= $b - $i && $b >= $b - $i) {
        $result[] = $b - $i;
    }
    $i++;
}
$result = array_unique($result);
asort($result);
foreach ($result as $value) {
    echo "$value\n";
}

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

using namespace std;
typedef long long ll;

int main(){
    ll N;
    while(cin>>N){
        ll L0 = 2;
        ll L1 = 1;
        if(N == 0){
            printf("2\n");
            continue;
        }
        else if(N == 1){
            printf("1\n");
            continue;
        }
        ll LN;
        for(ll i=2 ; i<=N ; i++){
            LN = L0+L1;
            L0 = L1;
            L1 = LN;
        }
        printf("%lld\n",LN);
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef pair<ul, ul> P;

const int INF = 1e9;
const int MOD =1e9+7;
const ll LINF = 1e18;

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

    while (N != 1)
    {
        bool flag = false;
        int now = N;
        while (now % 2 != 1)
        {
            if(now == 2) {
                flag = true;
                break; 
            }
            now /= 2;
        }
        
        if(flag){
            break;
        }else
        {
            N--;
        }
        
    }
    
    std::cout << N << endl;
} 

Measured memory_bytes: 256
import math
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
a = [int(_) for _ in input().split()]
for i in range(k):
    pre = [0] * (n + 1)
    for j in range(n):
        pre[max(0, j - a[j])] += 1
        pre[min(n, j + a[j] + 1)] -= 1
    total = 0
    good = True
    for j in range(n):
        total += pre[j]
        a[j] = total
        if a[j] != n:
            good = False
    if good:
        break
print(' '.join(map(str, a)))
    


Measured memory_bytes: 155612
#include<stdio.h>
 
int main() {
  int N, X;
  scanf("%d %d", &N, &X);
  int D = 0, count = 1, L;
  for (int i = 0; i < N; i++) {
    scanf("%d", &L);
    D = D + L;
    if (D <= X) {
      count++;
    } else {
      break;
    }
  }
  printf("%d\n", count);
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int dice[100][6]={};
    for(int j=0;j<n;j++){
        for(int i=0;i<6;i++){
            scanf("%d",&dice[j][i]);
        }
    }
    int dicepos[6][6]={{1,6,2,3,5,4},{2,5,6,3,1,4},{3,4,2,6,5,1},{4,3,2,1,5,6},{5,2,1,3,6,4},{6,1,2,4,5,3}};
    int dice1[6]={};
    int dice2[6]={};
    for(int j=0;j<n;j++){
        for(int k=j+1;k<n;k++){
            for(int l=0;l<6;l++){
                dice1[l]=dice[j][l];
                dice2[l]=dice[k][l];
            }
            for(int i=0;i<6;i++){
                if((dice1[dicepos[0][0]-1]==dice2[dicepos[i][0]-1])&&(dice1[dicepos[0][1]-1]==dice2[dicepos[i][1]-1])){
                    if(dice1[dicepos[0][2]-1]==dice2[dicepos[i][2]-1]
                        &&dice1[dicepos[0][3]-1]==dice2[dicepos[i][3]-1]
                        &&dice1[dicepos[0][4]-1]==dice2[dicepos[i][4]-1]
                        &&dice1[dicepos[0][5]-1]==dice2[dicepos[i][5]-1]){
                        printf("No\n");
                        return 0;
                    }else if(dice1[dicepos[0][3]-1]==dice2[dicepos[i][2]-1]
                            &&dice1[dicepos[0][4]-1]==dice2[dicepos[i][3]-1]
                            &&dice1[dicepos[0][5]-1]==dice2[dicepos[i][4]-1]
                            &&dice1[dicepos[0][2]-1]==dice2[dicepos[i][5]-1]){
                        printf("No\n");
                        return 0;
                    }else if(dice1[dicepos[0][4]-1]==dice2[dicepos[i][2]-1]
                            &&dice1[dicepos[0][5]-1]==dice2[dicepos[i][3]-1]
                            &&dice1[dicepos[0][2]-1]==dice2[dicepos[i][4]-1]
                            &&dice1[dicepos[0][3]-1]==dice2[dicepos[i][5]-1]){
                        printf("No\n");
                        return 0;
                    }else if(dice1[dicepos[0][5]-1]==dice2[dicepos[i][2]-1]
                            &&dice1[dicepos[0][2]-1]==dice2[dicepos[i][3]-1]
                            &&dice1[dicepos[0][3]-1]==dice2[dicepos[i][4]-1]
                            &&dice1[dicepos[0][4]-1]==dice2[dicepos[i][5]-1]){
                        printf("No\n");
                        return 0;
                    }
                }
            }
        }
    }
    printf("Yes\n");
    return 0;
}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    set<int> se;
    for(int i=1;i<10;++i){
        for(int j=1;j<10;++j)se.insert(i*j);
    }
    if(se.find(N)!=se.end()){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	while (1) {
		int a, b,c(-1);
		vector<int>v(101, 0); int m = 0;
		while (cin >> a >> b, a || b) {
			v[a]++; v[b]++;
			m = max(m, a);
			m = max(m, b);
			c = 1;
		}
		if (c == -1)return 0;
		bool f(true);
		rep(i, 3, m + 1) {
			if (v[i] & 1)f = false;
		}
		if (v[1] & 1 && v[2] & 1 && f)cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}

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

using namespace std;

int digit_sum(int x) {
  int sum = 0;
  while (x != 0) {
    sum += x % 10;
    x /= 10;
  }

  return sum;
}

int main(int argc, char* argv[]) {
  int N, A, B;
  cin >> N >> A >> B;

  int ret = 0;
  for (int i = 1; i <= N; i++) {
    int sum = digit_sum(i);
    if (A <= sum && sum <= B) {
      ret += i;
    }
  }

  cout << ret << endl;

  return 0;
}


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

int main()
{
    string s;
    string p;
    string sss;

    cin >> s;
    cin >> p;
    sss = s + s +s;
    int i = sss.find(p);
    if (i == -1) cout << "No" << endl;
    else cout << "Yes" <<endl;
    
    return 0;
}


Measured memory_bytes: 3220
n = input()
c1 = c2 = 0
l = len(n)
c1 = l - len([i for i in n[0::2] if i == "0"]) - len([i for i in n[1::2] if i == "1"])
c2 = l - len([i for i in n[0::2] if i == "1"]) - len([i for i in n[1::2] if i == "0"])

print(min(c1,c2))
                                                                 

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

int main(void)
{
    char s[201];
    char sc[201];
    char p[101];

    scanf("%s", s);
    scanf("%s", p);

    strcpy(sc, s);
    strcat(s, sc);

    if (strstr(s, p)) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 540
import math
a,b = map(int, input().split())
start = 0
if a < b:
    start = math.ceil(a * 12.5)
else:
    start = math.ceil(b * 10)

flg = False
for i in range(start, 1009):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        flg = True
        print(i)
        break

if not flg:
    print(-1)

Measured memory_bytes: 3064
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import math

N = int(input())
a = [int(i) for i in input().split()]

a.sort()

counts = {}
for i in range(N):
    if a[i] in counts.keys():
        counts[a[i]] += 1
    else:
        counts[a[i]] = 1

counts_list = []
tmp = 0
for num in range(max(a)+1):
    try:
        tmp += counts[num]
        # counts_list.append(tmp)
    except:
        pass

    counts_list.append(tmp)

ans = 0
for i in range(len(counts_list)-3):
    ans = max(ans,counts_list[i+3]-counts_list[i])
    # print(ans)

if len(counts_list) <= 3:
    ans = max(ans,max(counts_list))

print(ans)


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

# 壊れている床
a = [-1]
for i in range(M):
  a.append(int(input()))
  # 連続して壊れていたら辿り着けない
  if a[i + 1] - a[i] == 1:
    print(0)
    exit()

# フィボナッチ数列
def fib(n):
  a, b = 0, 1
  if n == 1:
    return a
  elif n == 2:
    return b
  else:
    for i in range(n-2):
      a, b = b, a + b
    return b

# 階段を登る組み合わせ
combi = 1

for i in range(len(a) - 1):
  # 次の穴との距離
  dis = a[i+1] - a[i]
  #print(dis)
  combi *= fib(dis)
  #print(a[i])
    
dis = N+1 - a[-1]
#print(dis)
combi *= fib(dis)
 
print(combi % 1000000007)

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


int main(){
  int n;
  cin >> n;
  int l[n];
  for(int i = 0;i < n;i++){
    cin >> l[i];
  }
  sort(l,l+n);
  int sum = 0;
  for(int i = 0;i < n-1;i++){
    sum += l[i];
  }
  if(l[n-1] < sum){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

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

  vector<pair<ll,ll> > p(n);
  rep(i,n) {
    cin >> p[i].first >> p[i].second;
  }

  sorti(p);

  ll ans = 0, remain = m;

  for (int i = 0; i < n; ++i) {
    if (remain - p[i].second >= 0) {
      ans += p[i].first * p[i].second;
      remain -= p[i].second;
    } else {
      ans += p[i].first * remain;
      break;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<algorithm>

using namespace std;

int N, h[100000];

void input(){
  scanf("%d", &N);
  for(int i=0; i<N; i++){
    scanf("%d", &h[i]);
  }
}

int main(){
  input();
  int DP[100001];
  DP[1] = max(h[1]-h[0], h[0]-h[1]);
  for(int i=2; i<N; i++){
    DP[i] = DP[i-2] + max(h[i]-h[i-2], h[i-2]-h[i]);
    DP[i] = min(DP[i], DP[i-1] + max(h[i]-h[i-1], h[i-1]-h[i]));
  }
  printf("%d", DP[N-1]);
}

Measured memory_bytes: 896
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;

LL n,m,k;
LL a[500005];

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	while(m --){
		cin >> k;
		n -= k;
	}
	cout << (n <= 0 ? "Yes" : "No") << endl;
	return 0;
}

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

int main() {
    string s, t;
    int count = 0;
    cin >> s;

    while (true) {
        cin >> t;
        if(t=="END_OF_TEXT"){
            cout << count << endl;
            break;
        }
        for (int i = 0; i< t.length(); i++) {
            t[i] = tolower(t[i]);
        }
        if (t==s) {
            count ++ ;
        }
    }
    return 0;
}



Measured memory_bytes: 3164
import java.util.*;

public class Main {
    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int [] num = new int[4];
        for(int i=0; i<4; i++){
            num[i] = Character.getNumericValue(S.charAt(i));
        }
        int a = num[0];
        int b = num[1];
        int c = num[2];
        int d = num[3];
        
        if(a+b+c+d == 7){
            System.out.println(a+"+"+b+"+"+c+"+"+d+"=7");
        }else if(a+b+c-d == 7){
            System.out.println(a+"+"+b+"+"+c+"-"+d+"=7");
        }else if(a+b-c+d == 7){
            System.out.println(a+"+"+b+"-"+c+"+"+d+"=7");
        }else if(a-b+c+d == 7){
            System.out.println(a+"-"+b+"+"+c+"+"+d+"=7");
        }else if(a+b-c-d == 7){
            System.out.println(a+"+"+b+"-"+c+"-"+d+"=7");
        }else if(a-b+c-d == 7){
            System.out.println(a+"-"+b+"+"+c+"-"+d+"=7");
        }else if(a-b-c+d == 7){
            System.out.println(a+"-"+b+"-"+c+"+"+d+"=7");
        }else{
            System.out.println(a+"-"+b+"-"+c+"-"+d+"=7");
        }

    }
}


Measured memory_bytes: 39376
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> v(n);
  for(int i=0; i<n; i++){
    cin>>v.at(i);
  }
  sort(v.begin(),v.end());
  double ans=v.at(0);
  for(int i=1; i<n; i++){
    ans=(ans+v.at(i))/2;
  }
  cout<<ans<<endl;
}


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

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


int main() {
ll h, w;
ll sx, sy, gx, gy;
vector<string> maze;
  cin >> h >> w >> sy >> sx >> gy >> gx;
  --sx, --sy, --gx, --gy;
  maze.resize(h);
  rep(i, h) cin >> maze[i];

  deque<pair<ll, ll>> q;
  q.push_back({sy, sx});
  vector<ll> d(h * w, -1);
  d[sy * w + sx] = 0;

  while (q.size()) {
    ll y = q.front().first;
    ll x = q.front().second;
    q.pop_front();

    rep(i, 4) {
      ll ny = y + dy[i], nx = x + dx[i];
      if (ny >= 0 && ny < h && nx >= 0 && nx < w && maze[ny][nx] == '.')
        if (d[ny * w + nx] == -1 || d[ny * w + nx] > d[y * w + x])
          d[ny * w + nx] = d[y * w + x], q.push_front({ny, nx});
    }

    for (ll ny = y - 2; ny <= y + 2; ++ny)
      for (ll nx = x - 2; nx <= x + 2; ++nx)
        if (ny >= 0 && ny < h && nx >= 0 && nx < w && maze[ny][nx] == '.')
          if (d[ny * w + nx] == -1 || d[ny * w + nx] > d[y * w + x] + 1)
            d[ny * w + nx] = d[y * w + x] + 1, q.push_back({ny, nx});
  }

  cout << d[gy * w + gx] << endl;
  return 0;
}

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

int n, k, h[100000], ans = 1e9;

int main() {
    cin >> n >> k;
    rep(i, n) cin >> h[i];
    sort(h, h + n);
    REP(i, k - 1, n) {
        ans = min(ans, h[i] - h[i-k+1]);
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int H, W, K, ans=0; cin >> H >> W >> K; string c[H];
REP(i, H){ cin >> c[i]; }
int h=(1<<H), w=(1<<W);
REP(i, h){ REP(j, w){ 
  int k=0;
  REP(a, H){ REP(b, W){ 
  if(c[a][b]=='#'){ if(((i&(1<<a))==0)&&((j&(1<<b))==0)){ k++; } }
  }}
  if(K==k){ ans++; }
}}
cout << ans << "\n";
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using pll = pair<long long, long long>;

int main() {
    int N; cin >> N;
    vector<pll> v(N);
    for (int i = 0; i < N; ++i) {
        long long a, l;
        cin >> a >> l;
        v[i] = {a - l, a + l};
    }

    // 区間を右端の小さい順にソート
    sort(v.begin(), v.end(), [](pll a, pll b) {
            return a.second < b.second;});

    // cur := 現在選んでいる区間のうち、最も右にあるやつの右端
    int res = 0;
    long long cur = -(1LL<<60);
    for (int i = 0; i < N; ++i) {
        if (cur > v[i].first) continue; // 被るやつは飛ばす
        ++res;
        cur = v[i].second;
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
A,B,C,D=map(int,input().split())
if C//B+bool(C%B)*1<=A//D+bool(A%D)*1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 72768
A, B, C, D = map(int, list(input()))
for i in range(2):
    for j in range(2):
        for k in range(2):
            x = A
            ans = str(A)
            if i:
                x += B
                ans += "+"
            else:
                x -= B
                ans += "-"
            ans += str(B)
            if j:
                x += C
                ans += "+"
            else:
                x -= C
                ans += "-"
            ans += str(C)
            if k:
                x += D
                ans += "+"
            else:
                x -= D
                ans += "-"
            ans += str(D)
            ans += "=7"
            if x == 7:
                print(ans)
                import sys
                sys.exit()


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll a = 3*(ll)1e5, b=2*(ll)1e5, c=(ll)1e5;
    ll x, y; cin>>x>>y;
    ll res = 0;
    if(x==1 and y==1) res = 2*a+ 4*(ll)1e5;
    else{
        switch(x){
            case 1: res+=a;
                    break;
            case 2: res+=b;
            break;
            case 3: res+=c;
            break;
            default: break;
        }
        switch(y){
            case 1: res+=a;
                    break;
            case 2: res+=b;
            break;
            case 3: res+=c;
            break;
            default: break;
        }
    }
    cout << res << endl; 
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

const ll mod = 1000000007; 


//a^pを求める
ll f(ll a, ll p){

  if (p == 0){
    return 1;
  }

  if(p % 2){
    ll t = f(a, (p - 1) / 2);
    t = (t * t) % mod;
    return (a * t) % mod;
  }else{
    ll t = f(a, p/2);
    return (t * t) % mod;
  }

}

int main(void){
  int x, y;
  cin >> x >> y;

  if(y < x) swap(x, y);


  ll ans = 0;
  for(int i = x % 2; i <= x; i += 2){
    int j = (x - i) / 2;
    if(2 * i + j == y){
      ll a = 1, b = 1, c = 1;
      for(int k = i + j; k > i; k--) a = (a * k) % mod;
      for(int k = j; k > 0; k--) b = (b * k) % mod;
      ans = (a * f(b, mod-2)) % mod;
      cout << ans << endl;
      return 0;
    }
  }

  cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
const int mod = 1e9 + 7;

int main(){
    int n, l;
    cin >> n >> l;
    vector<int> x(n), a(n);
    for(int i = 0; i < n; i++)  cin >> x[n-1-i];
    for(int i = 0; i < n; i++)  cin >> a[n-1-i];
    vector<vector<int>> dp(2, vector<int>(l+1, 0));
    for(int j = x[0]; j < l; j += a[0]){
        dp[0][j] = 1;
        if(a[0] == 0)   break;
    }
    for(int j = l-1; j >= 0; j--)  dp[0][j] = (dp[0][j] + dp[0][j+1])%mod;
    for(int i = 1; i < n; i++){
        fill(dp[i%2].begin(), dp[i%2].end(), 0);
        for(int j = x[i]; j < l; j += a[i]){
            dp[i%2][j] = dp[(i+1)%2][j+1];
            if(a[i] == 0)   break;
        } 
        for(int j = l-1; j >= 0; j--)   dp[i%2][j] = (dp[i%2][j] + dp[i%2][j+1])%mod;
    }
    cout << dp[(n+1)%2][0] << endl;
    return 0;
}


Measured memory_bytes: 3244
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <cstring>

int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n), b(n), c(n);
  for (int i = n - 1; i >= 0; --i)
    std::cin >> a[i] >> b[i] >> c[i];
  std::vector<std::array<int, 3>> dp(n);
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for (int i = 1; i < n; ++i) {
    dp[i][0] = std::max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
    dp[i][1] = std::max(dp[i - 1][2] + b[i], dp[i - 1][0] + b[i]);
    dp[i][2] = std::max(dp[i - 1][0] + c[i], dp[i - 1][1] + c[i]);
  }
  std::cout << std::max(std::max(dp[n - 1][0],
                                 dp[n - 1][1]),
                        dp[n - 1][2]) << std::endl;
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

void thisIsMain() {
	ll a, b, c, d;
	cin>>a>>b>>c>>d;
	cout<<max(a * c, max(a * d, max(b * c, b * d)))<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

double n;
int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    cin >> n;
    cout << fixed << setprecision(10) << (n / 3) * (n / 3) * (n / 3) << "\n";
}


Measured memory_bytes: 256