akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  int n;
  cin>>n;
  vector<pair<long,long>> v(n);
  rep(i,n) cin>>v[i].first>>v[i].second;

  sort(all(v), [](auto &l, auto &r){
    return l.first+l.second > r.first+r.second;
  });

  long ans = 0;
  rep(i,n){
    if(i%2==0) ans += v[i].first;
    else ans -= v[i].second;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cstring>
#define FIN freopen("inputs.txt", "r", stdin)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define f first
#define s second
int h, n;
int weight[1009], value[1009];
//dp[i][j]:使用前i个法术，打j点HP的怪物所需的最少MP
//转移方程：
//dp[i][j] = min(dp[i][j-value[i]] + weight[i], dp[i-1][j]);
//初始条件：dp[0][0] = INF;
//优化为滚动数组：dp[2][j]
int dp[1009][10009];
void solve(){
    int ans = 0x7fffffff;
    memset(dp, 127, sizeof(dp));
    for (int i = 0; i <= n; i++)
    {
        dp[i][0] = 0;
    }
    for (int i = 1; i <= n; i++)
    {

        for (int j = 1; j <= h; j++)
        {
            if(j-value[i]>0)
            {
            dp[i][j]=min(
                dp[i][j - value[i]] + weight[i],
                dp[i-1][j]
            );
            }
            else dp[i][j]=min(dp[i-1][j],weight[i]);
        }
    }
    ans=dp[n][h];
    printf("%d\n", ans);
}
int main(){
//FIN;
    ios::sync_with_stdio(false);
    cin>>h>>n;
    for (int i = 1; i <= n; i++)
    {
        cin>>value[i]>>weight[i];
    }
    solve();
    return 0;
}


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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  int n; cin >> n;
  deque<int> que;

  rep(i, n) {
    int a; cin >> a;
    if (i % 2 == 0) que.push_back(a);
    else que.push_front(a);
  }

  if (n % 2) reverse(all(que));

  rep(i, n) {
    if (i) cout << " ";
    cout << que.front();
    que.pop_front();
  }
  cout << endl;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
 
int s[N],per[N][N],is[N][N];
 
inline int cal(int x){
	int res = 0;
	while(x){
		x -= (x&(-x));
		res++;
	}
	return res;
}
 
int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;++i){
		scanf("%d",&s[i]);
		for(int j = 1;j <= s[i];++j){
			scanf("%d%d",&per[i][j],&is[i][j]);
		}
	}
	
	int ans = 0;
	for(int i = 0;i < (1<<n);++i){
		bool f = 1;
		for(int j = 1;j <= n;++j){
			if(i & (1 << (j-1))){
				for(int k = 1;k <= s[j];++k){
					if(is[j][k] && !(i & (1 << per[j][k]-1))) f = 0;
					if(!is[j][k] && (i & (1 << per[j][k]-1))) f = 0;
					if(!f) break; 
				}
			}
			if(!f) break;
		}
		if(f) ans = max(ans,cal(i));
	}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

long long mod = 1000000007;
int main(void)
{
    int n;
    cin >> n;
    int a[n];
    map<int, int> mp;
    REP(i, n)
    {
        cin >> a[i];
        mp[a[i]]++;
    }
    long long ans = 1;
    // 1 2 3 4 5 6
    // 5 3 1 1 3 5
    // 1,3,5 (n-1)
    if (n % 2 == 0)
    {
        for (auto i : mp)
        {
            if (i.first % 2 == 0 or i.second != 2)
            {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % mod;
        }
    }
    // 1 2 3 4 5
    // 4 2 0 2 4
    // 0(1ko), 2, 4 (n-1)
    else
    {
        for (auto i : mp)
        {
            if (i.first == 0)
            {
                if (i.second != 1)
                {
                    cout << "0" << endl;
                    return 0;
                }
                continue;
            }
            else if (i.first % 2 == 1 or i.second != 2)
            {
                cout << "0" << endl;
                return 0;
            }
            ans = (ans * 2) % mod;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<iostream>
#include<string>
using namespace std;
int main(){
  int a,b,c;
  string ret;
  cin >> a >> b >> c;
  if(a <= c && c <= b){
    ret = "Yes";
  }else{
    ret = "No";
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
S = list(input())
N = len(S)
start = 0
end = 0
rl = 0
is_rl_block = False
l_count = 0
ans = [0 for _ in range(N)]
for i in range(1, N):       
    if S[i-1] == 'R' and S[i] == 'L':
        rl = i-1
        is_rl_block = True
        count = i - start +1
        ans[rl] = count//2
        ans[rl+1] = count//2
        if count %2 == 1 and rl %2 == start %2:
            ans[rl] += 1
        elif count %2 == 1 and rl %2 != start %2:
            ans[rl+1] += 1
    elif is_rl_block and S[i] == 'L':
        l_count += 1
    elif is_rl_block and S[i] == 'R':
        is_rl_block = False
        ans[rl] += l_count//2
        ans[rl+1] += l_count//2
        if l_count%2 ==1:
            ans[rl] += 1
        l_count = 0
        start = i
    if is_rl_block and i == N-1:
        is_rl_block = False
        ans[rl] += l_count//2
        ans[rl+1] += l_count//2
        if l_count%2 ==1:
            ans[rl] += 1
        l_count = 0
        start = i
for x in ans:
    print(x, end=' ')


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

using namespace std;

int main()
{
	int n, d[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> d[i];
	sort(d, d + n);
	cout << unique(d, d + n) - d << endl;
	return 0;
}


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

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define DIVUP(x, y) (((x) + ((y) - 1)) / (y))
#define DIVOFF(x, y) (((x) + ((y) / 2)) / (y))
#define REMAINDER(x, y) ((x) % (y))

int main() {
  int K, S; scanf("%d%d", &K, &S);

  int num{0};
  for (int i{0}; i <= K; ++i) {
    if (i > S) break;
    for (int j{0}; j <= K; ++j) {
      if (i + j <= S && S - i - j <= K) ++num;
    }
  }

  printf("%d\n", num);
  return 0;
}


Measured memory_bytes: 256
// /*
// power code taken from geeks for geeks
// */

#include <bits/stdc++.h>
#define MODD 1000000007LL
#define MAX_SIZE 100000000
#define MAX_N 200001
using namespace std;
typedef long long ll;
typedef long double ld;

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}


struct p_str{
    ll x, y;
};

bool comp(p_str  &a, p_str &b){
    if(a.x==b.x){
        return a.y>b.y;
    }
    return a.x<b.x;
}

void swap(ll& s1, ll &s2){
    ll temp=s1;
    s1=s2;
    s2=temp;
}
ll gcd(ll a, ll b){
    if(b==0){
        return a;
    }
    return gcd(b, a%b);
}

void solve(){
    string s, t;
    cin>>s>>t;
    // cout<<s<<endl;
    string a=t.substr(0, s.length());
    // cout<<"a "<<a<<endl;
    if(a==s){
        if(t.length()==s.length()+1){
            cout<<"Yes"<<endl;
            return;
        }
    }
    cout<<"No"<<endl;
    
}


int main(){




    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll t=1;

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


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
using priority_queue_small = priority_queue<int, vector<int>, greater<int> >;
template<class T>using vv = vector<T>;
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>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};
vector<int> makePrimes(int n) {
  vector<int> res, pr(n + 1, 1);
  pr[0] = pr[1] = 0;
  rep(p, 2, sqrt(n) + 2) 
    if (pr[p]) 
    for (int x = p * 2; x <= n; x += p) pr[x] = 0;
  rep(p, 2, n + 1) 
    if (pr[p]) 
      res.push_back(p);
  return res;
}

ll n;
int main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> n;
  auto primes = makePrimes(n);
  vii cnt(primes.size());
  erep(i, 2, n) {
    int t = i;
    rep(j, 0, primes.size()) {
      int counter = 0;
      while (t % primes[j] == 0) t /= primes[j], counter++; 
      cnt[j] += counter;
    }
  }
  ll ans = 1LL;
  rep(i, 0, cnt.size()) {
    ans = (ans * (cnt[i] + 1)) % MOD;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

ll N;
ll bit[1000010];

void bit_init(vector<ll> v){
	if(!v.empty()){
		N=v.size();
		for(ll x=1; x <= N; ++x) bit[x] = v[x];
		for(ll x=1; x < N; ++x) bit[x+(x&-x)] += bit[x];
	}
}
void bit_add(ll a, ll w){
		for(ll x=a; x <= N; x+=x&-x)bit[x]+=w;
}
ll bit_sum(ll a){
	ll ret=0;
	for(ll x=a;x>0;x-=x&-x) ret+=bit[x];
	return ret;
}
int main(){
  ll n,m,x;cin>>n>>m>>x;
  vector<ll> a(n+1);
  vector<ll> b(n+1);
  rep(i,m){
    cin>>a[i+1];
    b[a[i+1]]=1;
  }
  bit_init(b);
  cout<<min(bit_sum(x),bit_sum(n)-bit_sum(x))<<endl;
  return 0;
}

Measured memory_bytes: 256
/*input
10
5 3
5 7
8 9
1 9
9 10
8 4
7 4
6 10
7 2
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
 
using namespace std; 
 
int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;
 
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	ll ans=0;
	repl(i, 1, n+1) ans+=i*(n-i+1);
	rep(i, n-1) {
		ll u,v;
		cin >> u >> v;
		if(u>v) swap(u, v);
		ans-=u*(n-v+1);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
const int  N = 2e5 + 314;
void foo(){
    int n, m;
    cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
}
int main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)foo();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
bool used[100001]={};
vector<int> hen[100001];
vector<pair<int,int>> ans1,ans2;
void dfs(int a,vector<pair<int,int>>& ans){
  used[a]=true;
 
  for(int i=0;i<hen[a].size();i++){
    if(!used[hen[a][i]]){
      ans.push_back(make_pair(a,hen[a][i]));
      cerr<<a<<' '<<hen[a][i]<<endl;
      dfs(hen[a][i],ans);
      break;
    }
  }
  return ;
}
signed main() {
int n,m;
cin>>n>>m;
int a,b;
for(int i=0;i<m;i++){
  cin>>a>>b;a--;b--;
  hen[a].push_back(b);
  hen[b].push_back(a);
}
dfs(0,ans1);dfs(0,ans2);
cout<<ans1.size()+ans2.size()+1<<endl;
for(int i=ans1.size()-1;i>=0;i--){
  cout<<1+ans1[i].second<<' ';
}
cout<<1+ans1[0].first<<' ';
for(int i=0;i<ans2.size();i++){
  cout<<1+ans2[i].second<<' ';
}


return 0;
}


Measured memory_bytes: 15344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var strs = Console.ReadLine().Split(' ');
            var result = new List<char>();

            for (var i = 0; i < n; i++)
            {
                result.Add(strs[0][i]);
                result.Add(strs[1][i]);
            }

            Console.WriteLine(new string(result.ToArray()));
        }
    }
}

Measured memory_bytes: 27816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vll v(n);
    vll c1(100001, 0);
    vll c2(100001, 0);
    rep(i, n){
        cin >> v[i];
        if(i&1) c1[v[i]]++;
        else c2[v[i]]++;
    }
    ll cm1 = 0, cm2 = 0;
    ll mode1 = 0, mode2 = 0;
    repr(i, 1, 100001){
        if(chmax(cm1, c1[i])) mode1 = i;
        if(chmax(cm2, c2[i])) mode2 = i;
    }
    ll ans;
    if(mode1 != mode2){
        ans = n-cm1-cm2;
    }else{
        ll _cm1 = 0, _cm2 = 0;
        ll _mode1 = 0, _mode2 = 0;
        repr(i, 1, 100001){
            if(i == mode1) continue;
            if(chmax(_cm1, c1[i])) _mode1 = i;
            if(chmax(_cm2, c2[i])) _mode2 = i;
        }
        ans = min(n-_cm1-cm2, n-cm1-_cm2);
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    char a;
    cin >> a;
    if (a >= 'A' && a <= 'Z')
    {
        cout << "A\n";
    }
    else
    {
        cout << "a\n";
    }
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>

int cards[256];
int buf[2][256];
int n;

void print(){
	int i;
	for( i = 0; i < 2*n; i++ ){ printf("%d\n", cards[i]); }
	return;
}

void input(){
	int i;
	scanf("%d", &n);
	for( i = 0; i < 2*n; i++ ){ cards[i] = i+1; }
	return;
}

void riffle(){
	int i;
	for( i = 0; i < n; i++ ){
		buf[0][i] = cards[i];
		buf[1][i] = cards[n+i];
	}
	for( i = 0; i < n; i++ ){
		cards[2*i] = buf[0][i];
		cards[2*i+1] = buf[1][i];
	}
	return;
}

void cut(int k){
	int i;
	for( i = 0; i < k; i++ ){
		buf[0][i] = cards[i];
	}
	for( i = 0; i < 2*n-k; i++ ){
		buf[1][i] = cards[i+k];
	}
	for( i = 0; i < 2*n-k; i++ ){
		cards[i] = buf[1][i];
	}
	for( i = 2*n-k; i < 2*n; i++ ){
		cards[i] = buf[0][i+k-2*n];
	}
	return;
}

void run(){
	int i, k, m;
	scanf("%d", &m);
	for( i = 0; i < m; i++ ){
		scanf("%d", &k);
		if( k == 0 ){ riffle(); }
		if( k > 0 ){ cut(k); }
	}
	return;
}

int main(){
	input();
	run();
	print();
	return 0;
}

Measured memory_bytes: 2588
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//using ll = long long;
using P = pair<int,int>;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int d;
	cin >> d;
	cout << "Christmas";
	for(int i = 0;i < 25 - d;i++) cout << " Eve";
	cout << endl;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    
    vector<int> v[20], p(m);
    for (int i = 0; i < m; i++){
        int k, s;
        cin >> k;
        for (int j = 0; j < k; j++){
            cin >> s;
            v[i].push_back(--s);
        }
    }

    for (int i = 0; i < m; i++)
        cin >> p[i];
    
    int ans = 0;
    for (int i = 0; i < (1 << n); i++){
        vector<int> status(n, 0);

        int b = i, idx = 0;
        while(b){
            if (b & 1)
                status[idx] = 1;
            b >>= 1;
            idx += 1;
        }
        
        bool ok = true;
        for (int j = 0; j < m; j++){
            int cnt = 0;
            for (int k = 0; k < (int) v[j].size(); k++){
                if (status[v[j][k]])
                    cnt += 1;
            }

            if (cnt % 2 != p[j]){
                ok = false;
                break;
            }
        }

        if (ok)
            ans += 1;
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
import bisect
N = int(input())
S = input()
X = [[] for i in range(10)]
for i in range(len(S)):
    S_tmp = int(S[i])
    X[S_tmp].append(i)
ans = 0
for i in range(1000):
    i_tmp = i+1000
    p = [0]*3
    for j in range(3):
        p[j] = int(str(i_tmp)[j+1])
    if len(X[p[0]]) != 0:
        x1 = X[p[0]][0]
        if len(X[p[1]]) != 0:
            x2 = bisect.bisect_right(X[p[1]],x1)
            if x2 != len(X[p[1]]):
                x2 = X[p[1]][x2]
                if len(X[p[2]]) != 0:
                    x3 = X[p[2]][-1]
                    if x3 > x2 and x3 > x1:
                        ans += 1
print(ans)


Measured memory_bytes: 4456
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
using namespace std;

const int MAXN=500005;
const long MOD=(long)(1e9+7);
vector<int> adj[MAXN];
vector<pair<int,int>> G[MAXN];

Int N,M,K;
Int B,C,H,W;
Int X,Y,Z;
vector<Int> A;

Int ceilS(Int x,Int y){
    return (x+y-1)/y;
}
using D=long double;

Int perform(Int x){
    return (x*(x+1))/2LL;
}

D getExpectation(D x) {
   return perform(x)/x;
}

int main()
{
    cin>>N>>K;
    A.resize(N);
    
    for(auto &x:A) cin>>x;
    sort(A.begin(),A.end());
    multiset<Int> m;
    Int best=1e13;
    for(int i=0;i<K;++i){
        m.insert(A[i]);
    }
    best=min(best,*m.rbegin()-*m.begin());
    for(int i=K;i<N;++i){
        m.insert(A[i]);
        m.erase(m.find(A[i-K]));
        best=min(best,*m.rbegin()-*m.begin());
    }
    cout<<best<<"\n";
    
}

Measured memory_bytes: 32112
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	n := getInt()
	vs := make([]float64, n)
	for i := range vs {
		vs[i] = getFloat()
	}
	sort.Float64s(vs)

	a := (vs[0] + vs[1]) / 2
	for i := 2; i < n; i++ {
		a = (a + vs[i]) / 2
	}

	fmt.Println(a)
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getFloat() float64 {
	f, err := strconv.ParseFloat(getString(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


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

typedef long long ll;

int main() {
    ll n;
    cin >> n;
    double ans = 0;
    int a;
    for (int i = 0; i < n; i++) {
        cin >> a;
        ans += (double)1 / a; 
    }
    ans = (double)1 / ans;
    cout << fixed << setprecision(6) << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int inf=1000000000;

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0); cin.tie(0);
  int n; cin>>n;
  string a[n]; for (int i=0; i<n; i++) cin>>a[i]; sort(a,a+n);
  int permutation_a[10000];
  for (int i=0; i<10000; i++) permutation_a[i]=inf;
  int index=0;
  for (int i=0; i<n && index<10000; i++) {
    for (int j=0; j<n && index<10000; j++) {
      if (i==j) continue;
      permutation_a[index]=atoi((a[i]+a[j]).c_str());
      index++;
    }
  }
  sort(permutation_a,permutation_a+index);
  cout<<permutation_a[2]<<endl;
  return 0;
}





Measured memory_bytes: 3672
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int k = Integer.parseInt(sc.next());
		
		long sum = 0;
		
		for(int i = 1 ; i < k+1; ++i) {
		    for(int j = 1; j < k+1; ++j) {
		        for(int l = 1; l < k+1; ++l) {
		            int tmp = gcd(i, gcd(j, l));
		            sum += tmp;
		        }
		    }
		} 
		
		System.out.println(sum);
	}
	
	public static int gcd(int num1,int num2) {
    if(num2==0) return num1;
    else return gcd(num2,num1%num2);
	}
   
}

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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);

  int longest = a.at(0) + (k - a.at(n - 1));
  rep(i, n - 1) {
    int x = a.at(i + 1) - a.at(i);
    longest = max(longest, x);
  }

  cout << k - longest << endl;
  return 0;
}

Measured memory_bytes: 4028
h, w = map(int, input().split(" "))
s = []
for row in range(h):
    line = input()
    tmp = []
    for column in range(w):
        tmp.append(line[column])
    s.append(tmp)

sx = [-1, 0, 0, 1]
sy = [0, 1, -1, 0]

res = True
for row in range(h):
    for column in range(w):
        if s[row][column] == "#":
            count = 0
            for i in range(len(sx)):
                if row + sx[i] < 0 or len(s) <= row + sx[i]:
                    continue
                if column + sy[i] < 0 or len(s[row]) <= column + sy[i]:
                    continue
                if s[row + sx[i]][column + sy[i]] == "#":
                    count += 1
            if count == 0:
                res = False

print("Yes" if res == True else "No")


Measured memory_bytes: 3064
S = str(input())

dp = [[0]*13 for _ in range(100001)]  # [桁数][あまりの数] = 個数

dp[0][0] = 1

for i in range(len(S)):  # Sへのアクセスは0-index
    for remain in range(13):  # あまりのパターン
        if S[i] == '?':
            for j in range(10):  # ?の取り方を全通り試す
                next_remain = (remain*10 + j) % 13
                # dpの遷移
                dp[i+1][next_remain] += dp[i][remain]
                dp[i+1][next_remain] %= 1000000007
        else:  # 今見ている桁が?ではなく数字であれば
            next_remain = (remain*10 + int(S[i])) % 13
            # dpの遷移
            dp[i+1][next_remain] += dp[i][remain]
            dp[i+1][next_remain] %= 1000000007

print(dp[len(S)][5])


Measured memory_bytes: 61788
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <regex>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((((c - b <= d) && !(c - b < 0)) && ((b - a <= d) && !(b - a < 0))) || (((c - a <= d) && !(c - a < 0)))){
        cout << "Yes" << endl;
    } else if ((((b - c <= d) && !(b - c < 0)) && ((a - b <= d) && !(a - b < 0))) || (((a - c <= d) && !(a - c < 0)))){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef ll li;
typedef pair<int,int> PI;
#define EPS (1e-10L)
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};


int n,m,k;

void solve(){
  if(m==1){
    cout << max(1,n*m-k) << endl;
    return;
  }

  double dp[2][n*m+1];
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  rep(i,n){
    int cu=i&1;
    int ne=(i+1)&1;
    memset(dp[ne],0,sizeof(dp[ne]));
    rep(j,m*(i+1)+1) if(dp[cu][j]) rep(k,m) dp[ne][j+k+1] += dp[cu][j]/m;
  }
  double ans=0;
  rep(j,n*m+1) ans += max(j-k,1)*dp[n&1][j];
  printf("%.8f\n",ans);
}

int main(int argc, char *argv[])
{
  while(cin >> n >> m >> k && n) solve();
  return 0;
}

Measured memory_bytes: 1352
#include <cstdio>
#include <vector>

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  std::vector<int> B(M, 1);
  for (size_t i = 0; i < N; ++i) {
    size_t K;
    scanf("%zu", &K);

    std::vector<size_t> A(M, 0);
    for (size_t i = 0; i < K; ++i) {
      size_t a;
      scanf("%zu", &a);
      --a;
      A[a] = 1;
    }
    for (size_t i = 0; i < M; ++i)
      if (A[i] == 0) B[i] = 0;
  }

  int res = 0;
  for (size_t i = 0; i < M; ++i)
    if (B[i]) ++res;

  printf("%d\n", res);
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

	int x;
	int h;
	while(cin>>x>>h&&!(x==0&&h==0)){
		double S=x*x;
		S+=2*x*sqrt(h*h+(double)x*x/4);
		printf("%.10f\n",S);
	}

	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int cnt=0;
    char s[3];
    
    scanf("%s", s);
    
    rep(i, 3){
        if (s[i]=='1') {
            cnt++;
        }
    }
    
    printf("%d", cnt);
    
    return 0;
}



Measured memory_bytes: 1700
#include<iostream>
#include<bits/stdc++.h>
#define LL long long int
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
	
		LL n;
		cin>>n;
		map<string,LL>m;
		while(n--)
		{
			string s;
			cin>>s;
			m[s]++;
		}
		cout<<"AC x "<<m["AC"]<<"\n";
		cout<<"WA x "<<m["WA"]<<"\n";
		cout<<"TLE x "<<m["TLE"]<<"\n";
		cout<<"RE x "<<m["RE"]<<"\n";
	
	

}


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

int main() {
    int n;
    string s;
    cin >> n >> s;
    int diff = 0;
    for(char c : s){
        if (c == 'R') diff++;
        else
            diff--;
    }
    if (diff > 0) puts("Yes");
    else
        puts("No");
}

Measured memory_bytes: 3600
#  --*-coding:utf-8-*--

def f(n, m):
    return (1800*m + 100*n)*2**m

def test():
    assert f(1,1) == 3800
    assert f(10, 2) == 18400
    assert f(100, 5) == 608000

def main():
    n, m = map(int, input().split())
    print(f(n,m))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int w, n;
	int change[30][2];
	int line[30];
	cin >> w >> n;
	for (int i = 0; i < n; ++i) {
		scanf("%d,%d", &change[i][0], &change[i][1]);
	}
	
	for (int i = 0; i < w; ++i) {
		line[i] = i + 1;
	}
	for (int i = 0; i < n; ++i) {
		swap(line[change[i][0] - 1], line[change[i][1] - 1]);
		//for (int i = 0; i < w; ++i) {
		//	cout << line[i] << " ";
		//}
		//cout << endl;
		//cout << "--------------------------" << endl;
	}
	for (int i = 0; i < w; ++i) {
		cout << line[i] << endl;;
	}
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b;
    cin >> a >> b;
    cout << max(a - 2*b, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

if S == 'SUN':
    print('7')
elif S == 'MON':
    print('6')
elif S == 'TUE':
    print('5')
elif S == 'WED':
    print('4')
elif S == 'THU':
    print('3')
elif S == 'FRI':
    print('2')
elif S == 'SAT':
    print('1')

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    
    int a;
    int count=0;
    
    for (int i = 1; i <= N; ++i){
        cin >> a;
        if(i%2 == 1){
            if(a%2 == 1){
                count += 1;
            }
        }
    }
    
    cout << count;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <iostream>
#include <vector>
#include <tuple>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#define FORI(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define DEBUG if(false)

const int INF = 2000000000;

template <typename T>
int indexOf(vector<T> v, T elem)
{
  auto iter = find(v.begin(), v.end(), elem);
  size_t idx = distance(v.begin(), iter);
  if (idx == v.size()) return -1;
  return idx;
}

const int MAX_N=100000;
int n;
struct city {
  int i,x,y;
};

struct edge {
  int from, to, cost;
};

vector<city> cities;
vector<edge> v;//全ての辺の集合
vector<edge> f;//最小全域木

// * begin union find
int tree[MAX_N],//木を管理する配列，インデックスがノード，値が木のID
    tree_rank[MAX_N]={};//木の高さを管理する配列，インデックスが木のID，値が高さ

void init()
{
  // 最初は全ての要素が別の木に属する
  FORI(n){
    tree[i]=i;
  }
}

//木の根を探す関数
int root(int i)//i:ノードID
{
  if(tree[i]==i)return i;//根
  else return tree[i]=root(tree[i]);//親ノードを探す&経路圧縮
}

//ノードが同じ木に属するか否か
bool sameTree(int i,int j)//i,j:ノードID
{
  return root(i)==root(j);
}

// 木を統合
void unite(int i,int j)
{
  i=root(i);j=root(j);
  if(i==j)return;
  if(tree_rank[i]<tree_rank[j]){
    tree[i]=j;
  }else{
    tree[j]=i;
    if(tree_rank[i]==tree_rank[j])tree_rank[i]++;
  }
}
// * end union_find

int main(int, char const*[])
{
  cin>>n;
  cities=vector<city>(n);
  FORI(n){
    int x,y;
    cin>>x>>y;
    cities[i]=city{i,x,y};
  }

  //グラフ構築
  sort(cities.begin(), cities.end(), [](city lhr, city rhr) {
      return lhr.x<rhr.x;
      });
  for(int j=0;j<n-1;j++){
    v.push_back(edge{cities[j].i,cities[j+1].i,cities[j+1].x-cities[j].x});
  }
  sort(cities.begin(),cities.end(), [](city l,city r){
      return l.y<r.y;
      });
  for(int j=0;j<n-1;j++){
    v.push_back(edge{cities[j].i,cities[j+1].i,cities[j+1].y-cities[j].y});
  }

  //クラスカル法
  sort(v.begin(), v.end(), [](edge l,edge r){
      return l.cost<r.cost;
  });
  init();//union find初期化
  for(edge e:v){
    if(sameTree(e.from, e.to)){
      continue;//点が既に繋がっていたら辺を捨てる
    }
    f.push_back(e);
    unite(e.from, e.to);
  }

  DEBUG for(edge e:f)cout<<e.from<<"->"<<e.to<<":"<<e.cost<<endl;

  vector<int> costs(f.size());
  transform(f.begin(),f.end(),costs.begin(),[](edge e){
      return e.cost;
    });
  int cost=accumulate(costs.begin(),costs.end(),0);

  cout<<cost<<endl;

  return 0;
}


Measured memory_bytes: 7920
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;



int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> G(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        G[a-1].emplace_back(b-1);
    }

    int ans = INF<int>;
    for (int i = 0; i < n; ++i) {
        vector<int> d(n, INF<int>), visited(n, 0);
        queue<int> Q;
        for (auto &&l : G[i]) {
            d[l] = 1;
            Q.emplace(l);
            visited[l] = 1;
        }
        while(!Q.empty()){
            int j = Q.front(); Q.pop();
            for (auto &&k : G[j]) {
                if(!visited[k]){
                    visited[k] = 1;
                    d[k] = d[j]+1;
                    Q.emplace(k);
                }
            }
        }
        ans = min(ans, d[i]);
    }
    if(ans == INF<int>) {
        puts("-1");
        return 0;
    }
    for (int i = 0; i < n; ++i) {
        vector<int> d(n, INF<int>), visited(n, 0), par(n, 0);
        queue<int> Q;
        for (auto &&l : G[i]) {
            d[l] = 1;
            Q.emplace(l);
            visited[l] = 1;
        }
        while(!Q.empty()){
            int j = Q.front(); Q.pop();
            for (auto &&k : G[j]) {
                if(!visited[k]){
                    visited[k] = 1;
                    d[k] = d[j]+1;
                    Q.emplace(k);
                    par[k] = j;
                }
            }
        }
        if(ans == d[i]){
            vector<int> ret{i};
            int cur = i;
            while(par[cur] != 0){
                ret.emplace_back(par[cur]);
                cur = par[cur];
            }
            cout << ret.size() << "\n";
            for (auto &&j : ret) cout << j+1 << "\n";
            return 0;
        }
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <vector>

using namespace std;

int main()
{
	int n;
	while(scanf("%d",&n)!=EOF){
		vector<int> v;
		for(int i=512;1<=i;i/=2){
			if(n<i) continue;
			n-=i;
			v.push_back(i);
			if(n<=0)break;
		}
		for(int i=v.size()-1;0<=i;i--){
			printf("%d",v[i]);
			if(i==0)printf("\n");
			else printf(" ");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<vector>

int main() {
int N,A,B;
    std::cin >> N;
    std::cin >> A;
    std::cin >> B;

int M=0;
    M=std::min(A,B);

int Mi=0;
    if(A+B>N)Mi=A+B-N;

    std::cout << std::to_string(M) +" "+ std::to_string(Mi);


    return 0;
}


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

char m[53][53];

int main(){
    int h,w; cin >> h >> w;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> m[i][j];
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(m[i][j]=='#'){
                cout << '#'; continue;
            }
            m[i][j]='0';
            for(int k=-1;k<=1;k++){
                for(int l=-1;l<=1;l++){
                    if(k==0 && l==0) continue;
                    if(m[i+k][j+l]=='#'){
                        m[i][j]++;
                    }
                }
            }
            cout << m[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def getinputdata():

    # 配列初期化
    array_result = []    
    data = input()
    array_result.append(data.split(" "))

    flg = True

    try:
        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False
    finally:

        return array_result

arr_data = getinputdata()

a = int(arr_data[0][0])
b = int(arr_data[0][1])
c = int(arr_data[0][2])
d = int(arr_data[0][3])


if abs(c-a)<=d or (abs(b-a)<=d and abs(b-c)<=d):
    
    print("Yes")
    
else:
    
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <string>
#include <queue>
using namespace std;

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

int W,H,T;
string field[1000];
bool reached[1000][1000];
int bx[1000], by[1000];

bool bfs(int sx, int sy){

	queue<pair<int, int> > q;
	q.push(make_pair(sx,sy));

	while(!q.empty()){
		pair<int, int> pos = q.front(); q.pop();
		int x = pos.first;
		int y = pos.second;


		if(reached[x][y]) continue;
		reached[x][y] = true;

		if(field[y][x] == 't') return true;

		for(int i=0; i<4; i++) {
			int tx = x + dx[i];
			int ty = y + dy[i];

			if(tx<0||ty<0||tx>=W||ty>=H) continue;
			if(field[ty][tx] == '#') continue;
			if(reached[tx][ty]) continue;

			q.push(make_pair(tx,ty));
		}
	}

	return false;
}

int solve()
{
	int res = 0;

	memset(reached, 0, sizeof(reached));
	if(bfs(0,0)) return 0;

	for(int j=0; j<T; j++)
	{
		res++;
		if(field[by[j]][bx[j]] == '.') continue;
		field[by[j]][bx[j]] = '.';

		for(int i=0; i<4; i++) {
			int tx = bx[j] + dx[i];
			int ty = by[j] + dy[i];

			if(tx<0||ty<0||tx>=W||ty>=H) continue;
			if(reached[tx][ty]) {
				if(bfs(bx[j],by[j])) return res;

				break;
			}
		}
	}

	return -1;
}

int main()
{
	cin >> W >> H;
	for(int i=0; i<H; i++)
		cin >>  field[i];

	cin >> T;
	for(int i=0; i<T; i++)
		cin >> bx[i] >> by[i];

	cout << solve() << endl;
}

Measured memory_bytes: 0
//atcoder

using System;
 
namespace abc158A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
	    	bool flag = true;
            string A = Console.ReadLine();
        /*
            for(int i=0; i < A.Length ; i+=2){
	            if(A.Substring(i, 2) != "hi"){
	            	flag = false;
	            }
	        }
	        */

	        switch(A){
	        	case "hi":
	        	case "hihi":
	        	case "hihihi":
	        	case "hihihihi":
	        	case "hihihihihi":
	        		flag = true;
	        	break;
	        	default:
	        		flag = false;
	        		break;
	        }





            if (!flag || A.Length < 1)
            {
                Console.WriteLine("No");
            }
            else
                Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,sum,ten;
	cin >> n;
	int p[n];
	for(int i=0;i<n;i++){
		cin >> p[i];
	}
	for(int i=1;i<=100;i++){
		sum=0;
		for(int j=0;j<n;j++){
			if(p[j]>=i){
				sum++;
			}
		}
		if(sum>=i){
			ten=i;
		}		
	}
	cout << ten << endl;
}		


Measured memory_bytes: 3096
#include <stdio.h>
int main(void){
  int A,B,C;
  int f = 0; 
  scanf("%d %d %d",&A,&B,&C);
  if(A+B+C==17){
  	if((A=7&&B==5)||(A=5&&B==7)||(A=5&&B==5)){
    	f=1;
    }
  }
  if(f==1){
    printf("YES");
  }else{
    printf("NO");
  }
}

Measured memory_bytes: 128
#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 pair<ll,ll> pll;

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 DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  ll s,c;
  cin>>s>>c;
  ll ans = 0;
  // min(s,c/2)
  ll use = min(s,c/2);
  ans += use;
  s -= use;
  c -= 2*use;
  if(s==0){
    ans += c/4;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<long double> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    if (A.at(0) == 0) {
        cout << 0 << endl;
        return 0;
    }
    long double ans = 1;
    for (int i = 0; i < N; i++) {
        if (ans / 1000000000000000000 * A.at(i) > 1) {
            cout << -1 << endl;
            return 0;
        }
        ans *= A.at(i);
    }
    long long ans2 = ans;
    cout << ans2 << endl;
}

Measured memory_bytes: 4840
#include <cstdio>

int main() {
  char c;
  scanf("%c", &c);
  switch(c) {
  case 'a':
  case 'e':
  case 'i':
  case 'o':
  case 'u':
    printf("vowel\n");
    break;
  default:
    printf("consonant\n");
  }
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main (void) {
    string A, B, C;

    cin >> A >> B >> C;

    if (A[A.length() - 1] == B[0] && B[B.length() - 1] == C[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    if (X / D >= K) {
        cout << X - K * D << "\n";
        return 0;
    }
    ll t = X / D;
    ll A = X - t * D;
    ll B = (t + 1) * D - X;
    if (A <= B) {
        if ((K - t) % 2 == 0) {
            cout << A << "\n";
        } else {
            cout << B << "\n";
        }
    } else {
        if ((K - t - 1) % 2 == 0) {
            cout << B << "\n";
        } else {
            cout << A << "\n";
        }
    }

    
    return 0;
}


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

const int N = 123456;

int n, d[N];
vector<int> money;

int dp(int num) {
    if (num == 0) return 0;
    int& ans = d[num];
    if (ans) return ans;

    ans = 1000000;
    for (int i = 0; i < money.size(); i++) {
        if (money[i] > num) break;
        ans = min(ans, dp(num - money[i]) + 1);
    }
    return ans;
}

int main() {
    money.push_back(1);
    int cur = 6;
    while (cur <= 100000) {
        money.push_back(cur);
        cur *= 6;
    }
    cur = 9;
    while (cur <= 100000) {
        money.push_back(cur);
        cur *= 9;
    }
    sort(money.begin(), money.end());

    cin >> n;
    cout << dp(n) << '\n';

    return 0;
}

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

#define REP(i, n) for ( int i = 0; i < (n); i++ )
const int INF = 1e9;

const int con_type = 26;
int D = 365;
int C[con_type];
int S[365][con_type];
int ans[con_type];
int last[con_type];

void solve() {
  REP(d, D) {
    int ma = -INF;
    int id = 0;
    REP(i, con_type) {
      if ( ma < S[d][i]+(d-last[i])*C[i] ) {
        ma = S[d][i]+(d-last[i])*C[i];
        id = i;
      }
    }

    ans[d] = id;
    last[id] = d;
  }
}

void input() {
  cin >> D;
  REP(i, con_type) {
    cin >> C[i];
    last[i] = -1;
  }
  REP(i, D) REP(j, con_type) cin >> S[i][j];
}

void output() {
  REP(i, D) cout << ans[i]+1 << endl;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  input();
  solve();
  output();

  return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
 
#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)


ll combinationValue( ll n, ll k, ll mod )
{
	vector<ll> fac( n+1, 1 ), inv( n+1, 1 ), facInv( n+1, 1 );
	for( ll i = 2; i <= n; ++i )
	{
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * ( mod / i ) % mod; // 逆元計算
		facInv[i] = facInv[i - 1] * inv[i] % mod;
 	}

	if( n < k  || n < 0 || k < 0) return 0;
	return fac[n] * ( facInv[k] * facInv[n - k] % mod ) % mod;
 }
 
int main()
{
	ll n,m,k;cin>>n>>m>>k;
	ll comb = 0;
	
	REP(i,n) comb = ( comb + (i * (n-i)%cMOD) * (m * m%cMOD) ) % cMOD;
	REP(i,m) comb = ( comb + (i * (m-i)%cMOD) * (n * n%cMOD) ) % cMOD;
	
	comb = comb * combinationValue( n * m - 2, k-2, cMOD ) % cMOD;

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

Measured memory_bytes: 4992