akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	int w, a, b;
	cin >> w >> a >> b;

	if (a + w < b)
		cout << b - (a + w) << endl;
	else if (b + w < a)
		cout << a - (b + w) << endl;
	else
		cout << 0 << endl;

}


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

vector<int64_t> puni(int64_t lim) {
	vector<int64_t> p(lim + 1, 0), r(lim + 1, 0);
	p[2] = 1;
	for (int64_t i = 3; i <= lim; i += 2) {
		for (int64_t j = 2; j * j <= i; j++) {
			if (i % j == 0) {
				goto next;
			}
		}
		p[i] = 1;
		next:;
	}
	for (int64_t i = 3; i <= lim; i += 2) {
		if (p[i] && p[(i + 1) / 2]) {
			r[i] = 1;
		}
	}
	for (int64_t i = 1; i <= lim; i++) {
		r[i] += r[i - 1];
	}
	return r;
}

int main() {
	auto imos = puni(100000);
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		cout << imos[r] - imos[l - 1] << endl;
	}
	return 0;
}

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

using namespace std;

int n;
int ans = 0;
vector<int> l;

int main(){
  cin >> n;
  vector<int> l(n);
  int k = 0;
  vector<int>::iterator p;
  vector<int>::iterator pp;

  for(int i = 0; i < n; i++) cin >> l[i];
  sort(l.begin(),l.end());

  for(int i=2; i < n; i++){
    for(int j =1; j < i; j++){
      k = l[i] - l[j]+1;
      p = lower_bound(l.begin(),l.end(),k);
      int dis = distance(p,l.end());
      dis -= (n-j);
      if(dis<=0) continue;;
      ans += dis;
    }
  }

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

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;

int main() {
  //
  int n, t;
  cin >> n >> t;
  vl tm(n);
  rep(i, n) cin >> tm[i];
  ll start = tm[0];
  ll end = tm[0] + t;
  ll ans = 0;
  REP(i, 1, n) {
    if (tm[i] <= end) {
      end = tm[i] + t;
    } else {
      ans += end - start;
      start = tm[i];
      end = tm[i] + t;
    }
  }
  ans += end - start;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

ans = ( N // min(A, B, C, D, E)) + 4


x = min(A, B, C, D, E)

if N % x == 0:
	ans += 0
		
else:
	ans += 1
		
	
print(ans)

Measured memory_bytes: 3064
def main():
    m,d = map(int,input().split())
    if d < 22 or m < 4:
        print(0)
        exit(0)
    cnt = 0
    for i in range(2,d//10+1):
        for j in range(2,10):
            if i*10 + j > d:
                break
            if i * j <= m:
                cnt += 1
    print(cnt)

if __name__ =="__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
int main(){
  ll n,xx;
  cin >>n>>xx;
  ll x[n+1];
  x[0]=xx;
  for(ll i=1;i<n+1;i++) cin >>x[i];
  sort(x,x+n+1);
  ll xd[n];
  for(ll i=0;i<n;i++) xd[i]=abs(x[i+1]-x[i]);
  ll ans=xd[0];
  for(ll i=1;i<n;i++){
      ans=gcd(ans,xd[i]);
  }
  cout <<ans<<endl;
}


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

int main()
{
	ll h,w;
	cin >> h >> w;
	vector<string> s(h);
	for(auto &i:s)cin >> i;
	vector<vector<ll>> dis(h,vector<ll>(w,1e9));

	for(int i = 0;i<h;i++)
	{
		for(int j = 0;j<w;j++)
		{
			if(s[i][j]=='#')dis[i][j]=0;
		}
	}

	for(int i = 0;i<h;i++)
	{
		for(int j = 1;j<w;j++)
		{
			dis[i][j] = min(dis[i][j],dis[i][j-1]+1);
		}
	}

	for(int i = 0;i<h;i++)
	{
		for(int j = w-2;j>=0;j--)
		{
			dis[i][j] = min(dis[i][j],dis[i][j+1]+1);
		}
	}
	for(int i = 1;i<h;i++)
	{
		for(int j = 0;j<w;j++)
		{
			dis[i][j] = min(dis[i][j],dis[i-1][j]+1);
		}
	}

	for(int i = h-2;i>=0;i--)
	{
		for(int j = 0;j<w;j++)
		{
			dis[i][j] = min(dis[i][j],dis[i+1][j]+1);
		}
	}
	ll ans = 0;
	for(int i = 0;i<h;i++)for(int j = 0;j<w;j++)ans = max(ans,dis[i][j]);
	cout << ans << endl;

	
}


Measured memory_bytes: 13008
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
    double A,B,H,M;
    cin>>A>>B>>H>>M;
    double l_rad=(60*H+M)*M_PI/360;
    double s_rad=M_PI*M/30;
    double c_rad=abs(l_rad-s_rad);
    double C=sqrt(A*A+B*B-2*A*B*cos(c_rad));
    printf("%.11f\n",C);
    return 0;
}

Measured memory_bytes: 4224
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <cctype>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;

int main(){
    char a,b;
    cin >> a >> b;
    if(a==b)cout << "H" << endl;
    else cout << "D" << endl;
}


Measured memory_bytes: 256
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


N = int(input())

while True:
    if is_prime(N):
        print(N)
        exit()
    N += 1


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

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long int ll;
typedef vector<ii> vii;

int n, m, i, j;
char nyan;
char c;
int main() {
	cin >> n >> m;
	char v[n][m];
	memset(v, 0, sizeof(v[0][0]) * m * n);
	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			cin >> c;
			if(c == '.') v[i][j] = '0';
			else v[i][j] = c;
		}
	}

	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			nyan = '0';
			if(v[i][j] == '0') {
				if(i - 1 >= 0 && v[i-1][j] == '#') nyan++;
				if(i + 1 < n && v[i+1][j] == '#') nyan ++;
				if(j - 1 >= 0 && v[i][j-1] == '#') nyan++;
				if(j + 1 < m && v[i][j+1]=='#') nyan++;

				if(i - 1 >= 0 && (j - 1 >= 0) && (v[i-1][j-1] == '#')) nyan++;
				if(i - 1 >= 0 && (j + 1 < m) && (v[i-1][j+1] == '#')) nyan++;
				if(i + 1 < n && (j + 1 < m) && (v[i+1][j+1] == '#')) nyan++;
				if(i + 1 < n && (j - 1 >= 0) && (v[i+1][j-1] == '#')) nyan++;
				v[i][j] = max(nyan, v[i][j]);
			}
			// cout << v[i][j] << endl;
		}
	}

	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			cout << v[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int ms = 1e5+9;
int vet[ms];
int main(){
	int maxi = 0, n,soma =1,s=1;
 	cin >> n;
  	for(int i =0 ;i<n;i++) cin >> vet[i];
  for(int i = 1;i<n;i++){
  	if(vet[i] >= vet[i-1])
      	s++;
   	vet[i] = max(vet[i],vet[i-1]);
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include <queue>
#include <cstring>

#define mp make_pair
#define pb push_back
#define p push

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"
#define sag (sol|1)
//#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE  ( int)(1e9 + 7)
#define MAXN (ll) ((1e5+5))
#define K 25
#define  ALPHABET_SIZE  26
#define N (int)(1e5+10)
//#define int ll
using namespace std;

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;



int n, C;

signed main() {

  int a,b;
  cin >>a>>b;
  vl vec(a);
    for (int i = 0; i <a ; ++i) {
        cin>>vec[i];
    }
    sort(BEND(vec));
    for (int j = 0; j <b ; ++j) {
        vec.pop_back();
        if(!vec.size())break;
    }
    ll res =0;
    if(!vec.size()){
        cout << 0 ;
        return 0;
    }
    for (int k = 0; k <vec.size() ; ++k) {
        res +=(vec[k]);

    }
    cout << res;
    return 0;

}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
string s,p;
int main(){ //srand((unsigned)time(NULL));
  cin >> s >> p;
  bool ans = false;
  for (int i = 0; i < s.length(); i++) {
    if(i < s.length()-p.length()){
      if(s.substr(i,p.length()) == p)ans = true;
    }else{
      if(s.substr(i,s.length()-i)+s.substr(0,p.length()-(s.length()-i)) == p)ans = true;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
}




Measured memory_bytes: 3208
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)
typedef pair < int, int> P;
ll gcd(ll a, ll b) {//最大公約数を求める///最大公倍数a*b/gcd(a,b)
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcd(ll a, ll b) {//最小公倍数を求める　b=0のときaを返す
	if (b == 0) return a;
	return (a / gcd(a, b)) * b;
}
vector<int> divnum(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}
int digiter(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p.size();
}
vector<int> convert(string s) {
	vector<int> d;
	ll n = s.size();
	rep(i, n) {
		d.push_back(s[i] - '0');
	}
	return d;
}

string S;
int main()
{
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5])cout << "Yes" << endl;
	else cout << "No" << endl;



}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const 
#define fr first 
#define se second
#define ls (now<<1)
#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 2e6 + 1;
cs int inf = 1e9 + 1;
cs int base = 2333;
cs int mod = 1e9 + 7;

int A[ff][2], h, w, m, x[ff], y[ff], mx1, mx2, s1, s2, s;
signed main()
{
	cin >> h >> w >> m;
	rep(i, 1, m) cin >> x[i] >> y[i], A[x[i]][1] ++, A[y[i]][2] ++;
	rep(i, 1, max(h, w)) if(A[mx1][1] < A[i][1]) mx1 = i;
	rep(i, 1, max(h, w)) if(A[mx2][2] < A[i][2]) mx2 = i; 
	rep(i, 1, h) if(A[mx1][1] == A[i][1]) s1 ++;
	rep(i, 1, w) if(A[mx2][2] == A[i][2]) s2 ++;
	rep(i, 1, m) if(A[x[i]][1] == A[mx1][1] && A[y[i]][2] == A[mx2][2]) s ++;
	cout << A[mx1][1] + A[mx2][2] - (s1 * s2 == s);
}

Measured memory_bytes: 13024
n=int(input())
a=[input() for i in range(n)]
if len(a)!=len(set(a)):
    print("No")
else:
    b=[c for c in a[0]]
    for i in range(1,n):
        d=[c for c in a[i]]
        if b[-1]!=d[0]:
            print("No")
            break
        else:
            b=d
    else:
        print("Yes")

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

inline bool check(map<li, li>& cnt) {
    if (cnt.size() == 1) {
        return (cnt.begin()->first == 0);
    }
    vector<PI> nums;
    for (auto && item : cnt) {
        //p2(item.F, item.S);
        nums.push_back({item.F, item.S});
    }
    if (sz(nums) > 3) {
        return false;
    }
    if (sz(nums) == 2) {
        // x,x,0,x,x,0,...
        if (nums[0].F == 0) {
            return nums[0].S * 2 == nums[1].S;
        } else {
            // nums[1].F=0
            return nums[0].S == nums[1].S * 2;
        }
        return false;
    }
    if ((nums[0].S != nums[1].S) ||
            (nums[1].S != nums[2].S)) {
        return false;
    }
    if (((nums[0].F ^ nums[1].F) != nums[2].F) ||
            ((nums[1].F ^ nums[2].F) != nums[0].F) ||
            ((nums[2].F ^ nums[0].F) != nums[1].F)) {
        return false;
    }
    return true;
}

int main() {
    li n;
    cin >> n;
    map<li, li> cnt;
    rin{
        li a;
        cin >> a;
        cnt[a]++;
    }
    cout << (check(cnt) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 7284
/*  In the name of ALLAH */

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif



int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    string s;
    cin>>s;
    map<char,int>m;
    m['A']=1;
    m['T']=1;
    m['G']=1;
    m['C']=1;
    for(int i = 0 ; i <s.size();i++){
        if(m[s[i]])s[i]='1';
        else s[i]='0';
    }
    // see(s);
    int res = 0;
    int cnt = 0;
    for(int i = 0 ; i <s.size();i++){
        if(s[i]=='1')res++;
        else{
            // see(res);
            cnt = max(cnt,res);
            res = 0;

        }
    }  
    cout<<max(cnt,res)<<endl;

 
    
 
    return 0;
}


Measured memory_bytes: 256
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]
ans=-10**10
for status in range(1,2**10):
    c=[0]*n
    cur=0
    for t in range(10):
        for i in range(n):
            if (status>>t)&1==1 and f[i][t]==1:
                c[i]+=1
    
    for i in range(n):
        cur+=p[i][c[i]]
    
    ans=max(ans,cur)

print(ans)


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

#define N 1002
#define MAX 1000000

typedef struct {
	int x, y;
	int cost;
} QUEUE;

int main(void)
{
	int h, w, n;
	int i, j;
	int dx[] = {-1, 0, 1, 0};
	int dy[] = {0, 1, 0, -1};
	int qp = 0;			//	デキューする場所(最初)を指す
	int ep = 0;			//	エンキューする場所(最後)を指す
	int fp = 0;			//	find変数の添え字を指す
	int cost;							//	かかった歩数
	static char map[N][N];				//	マップ
	static char used[N][N];				//	通った点
	static char find[] = "123456789";	//	見つける文字
	static QUEUE que[MAX];
	
	memset(que, -1, sizeof(que));
	memset(used, 0, sizeof(used));
	
	scanf("%d%d%d", &h, &w, &n);
	
	for (i = 0; i < h; i++){
		scanf("%s", map[i]);
		
		for (j = 0; j < w; j++){
			if (map[i][j] == 'S'){
				map[i][j] = '.';
				que[qp].x = j;
				que[qp].y = i;
				que[qp].cost = 0;
				used[i][j] = 1;
				ep++;
			}
		}
	}
	while (qp != ep){
		
		//	デキュー
		int x = que[qp].x;
		int y = que[qp].y;
		cost = que[qp].cost;
		qp = (qp + 1) % MAX;
		
		//	チーズ（文字）見つけたら
		if (map[y][x] == find[fp]){
			fp++;
			
			//	すべてなら終了
			if (fp == n){
				break;
			}
			
			//	まだあるならリセット
			else {
				memset(used, 0, sizeof(used));
				memset(que, 0, sizeof(que));
				qp = 0;
				que[qp].x = x;
				que[qp].y = y;
				que[qp].cost = cost;
				ep = 1;
			}
		}
		else {
			//	次に進めるか確認
			for (i = 0; i < 4; i++){
				int nx = x + dx[i];
				int ny = y + dy[i];
				
				//	通ってなくて、壁でもないならエンキュー
				if (used[ny][nx] == 0 && map[ny][nx] != 'X'){
					if (nx >= 0 && nx < w && ny >= 0 && ny < h){
						que[ep].x = nx;
						que[ep].y = ny;
						que[ep].cost = cost + 1;
						used[ny][nx] = 1;
						ep = (ep + 1) % MAX;
					}
				}
			}
		}
	}
	printf("%d\n", cost);
	
	return (0);
}

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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if(b<=a){
    cout<<"delicious"<<endl;
  }
  else if(b<=a+x){
    cout<<"safe"<<endl;
  }else{
    cout<<"dangerous"<<endl;
  }
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	map<string,int> ct;
	for (int i=0; i<n; i++) {
		string s; cin>>s;
		ct[s]++;
	}	
	vector<string> key={"AC","WA","TLE","RE"};
	for (auto x:key)
	cout<<x<<" "<<"x"<<" "<<ct[x]<<endl;
	return 0;
}


Measured memory_bytes: 3656
N = gets.to_i

F = lambda{|x,y,z| x*x+y*y+z*z+x*y+y*z+z*x }
Fn = [0]*(N+1)

x=y=z=1
until N < n=F[x,x,x]
	Fn[n] += 1
	z = x+1
	until N < n=F[x,x,z]
		Fn[n] += 3
		z += 1
	end
	y = x+1
	until N < n=F[x,y,y]
		Fn[n] += 3
		z = y+1
		until N < n=F[x,y,z]
			Fn[n] += 6
			z += 1
		end
		y += 1
	end
	x += 1
end

puts Fn.drop 1


Measured memory_bytes: 14268
fun main(args: Array<String>) {
    val (n,a,b,c,d) = readLine()!!.split(" ").map { it.toInt()-1 }
    val s = readLine()!!

    if(c<d) {
        if("##" !in s.slice(a..d)){
            println("Yes")
        } else {
            println("No")
        }
    } else {
        if("##" !in s.slice(a..c) && "..." in s.slice((b-1)..(d+1))){
            println("Yes")
        } else {
            println("No")
        }

    }
}

Measured memory_bytes: 41356
#include<iostream>
using namespace std;
typedef long long ll;

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

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

int main(){
    int n;
    cin >> n;
    ll ans, t;
    cin >> ans;
    for(int i = 1; i < n; i++){
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // 貪欲法で求める。
  // 振るよりも大きいダメージを与えることが可能な刀は最終的に全て投げつける（最大値を出したあとに個数と和を求める）。
  // 投げつけて与えるダメージが振るダメージが最大のもの以下であれば要なし(使わない）。
  // 振るダメージについては、最大の刀だけ必要でそれ以外は全て要なし（入力する際に最大値を求めておく）。
  // 投げつけて与えるダメージを引いたものを最大振るダメージで割る。余りがあれば+1。
  // 刀の数は10^5以下
  ll N, H, MaxA = 0, ans;
  cin >> N >> H;
  vector<ll> b(N);
  REP(i, N){
    ll a;
    cin >> a >> b.at(i);
    MaxA = max(MaxA, a);
  }
  ll SumB = 0, cnt = 0;
  sort(b.begin(), b.end(), greater<int>());
  REP(i, N){
    if(b.at(i) > MaxA){
      SumB += b.at(i);
      cnt++;
    }
    if(SumB >= H) break; // SumBがH以上となった時点で打ち止め
  }
  if(H-SumB <= 0){
    cout << cnt << endl;
  }else if((H-SumB)%MaxA == 0){
    cout << (H-SumB)/MaxA + cnt << endl;
  }else{
    cout << (H-SumB)/MaxA + cnt + 1 << endl;
  }
}

Measured memory_bytes: 1024
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n, m;
    cin >> n >> m;
    cout << ( n==m ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
aaa = [int(input()) for i in range(n)]
max_l = [0] * (n - 1)
max_r = [0] * (n - 1)
max_l[0] = aaa[0]
for i in range(1, n - 1):
    max_l[i] = max(aaa[i], max_l[i - 1])
max_l = [1] + max_l

aaa.reverse()
max_r[0] = aaa[0]
for i in range(1, n - 1):
    max_r[i] = max(aaa[i], max_r[i - 1])
max_r = [1] + max_r
max_r.reverse()

for i in range(n):
    print(max(max_l[i], max_r[i]))

Measured memory_bytes: 15660
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<3000;i++){
        	String items[]=reader.readLine().split(" ");
        	int num1=Integer.parseInt(items[0]);
        	int num2=Integer.parseInt(items[1]);
            if(num1==0 && num2==0){
            	break;
            }
        	if(num1<num2){
            	sb.append(num1 + " " + num2).append("\n");
        	}else{
            	sb.append(num2 + " " + num1).append("\n");;
        	}
        }
        System.out.print(sb);
	}
}

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

int main(void){
    int n;
    cin >> n;
    
    char input;
    int ary[101] = {0};
    int ab[26] = {0};
    
    int i;
    for(i = 1; i <= n; i++){
        cin >> input;
        if(ab[input - 'a']){
            ary[ab[input - 'a']]++;
            ary[i]--;
        }
        ab[input - 'a'] = i;
    }
    
    int cnt = 0, max = 0;
    for(i = 1; i <= n; i++){
        cnt += ary[i];
        if(cnt > max){
            max = cnt;
        }
    }
    
    cout << max << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,pair<int,int> > P;
typedef unsigned long long int ull;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXH=500;
const int MAXW=500;
const ll INF=1e9;

struct edge{
    int to;
    ll cost;
};

int main(){
    int h,w;cin>>h>>w;
    vector<vector<int> > c(10,vector<int>(10));
    vector<vector<int> > a(h,vector<int>(w));
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            cin>>c[i][j];
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]==-1) continue;
            ans+=c[a[i][j]][1];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define mp make_pair
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll n,m,mod=1e9+7;
signed main() {
    cin>>n;
    cout<<180*(n-2)<<endl;
}

Measured memory_bytes: 256
from sys import stdin
il = lambda func=int: list(map(func, stdin.readline().rstrip().split()))
ils = lambda n, s="int(input())": [eval(s) for _ in range(n)]

n, t = il()
l = ils(n, "il()")
l.sort(key=lambda x:x[1])
ans = 100000
for a, b in l:
    if b > t:
        break
    ans = min(ans, a)
print("TLE" if ans == 100000 else ans)

Measured memory_bytes: 3064
#include<stdio.h>
#define N 100
#define INF 2000000
#define WHITE 1
#define BLACK 2

int n,array[N][N];
void dijkstra(void);

int main(){
    int i,j,u,k,v,c;
    scanf("%d",&n);

    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            array[i][j] = INF;
        }
    }

    for(i=0;i<n;i++){
        scanf("%d%d",&u,&k);
        for(j=0;j<k;j++){
            scanf("%d%d",&v,&c);
            array[u][v] = c;
        }
    }

    dijkstra();

    return 0;
}
void dijkstra(){
    int mincost,i,j,u,v;
    int d[N],color[N],p[N];

    for(i=0;i<n;i++){
        d[i] = INF;
        color[i] = WHITE;
        p[i] = -1;
    }

    d[0] = 0;
    while(1){
        mincost = INF;
        for(i=0;i<n;i++){
            if(color[i] != BLACK && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }
        if(mincost == INF) break;
        color[u] = BLACK;
        
        for(v=0;v<n;v++){
            if(color[v] != BLACK && d[u]+array[u][v] < d[v]){
                p[v] = u;
                d[v] = d[u] + array[u][v];
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d %d\n",i,d[i]);
    }
}


Measured memory_bytes: 2056
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define sort(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())

using namespace std;

int main() {
	string a;
	cin >> a;
	if (a[0] == 'S') {
		cout << "Cloudy" << endl;
	}
	if (a[0] == 'C') {
		cout << "Rainy" << endl;
	}
	if (a[0] == 'R') {
		cout << "Sunny" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        boolean judge = true;
        if(T.length() != S.length() + 1){
            judge = false;
        }
        
        for(int i =0; i<S.length(); i++){
            if(S.charAt(i) != T.charAt(i)){
                judge = false;
                break;
            }
        }
        
        if(judge == false){
            System.out.println("No");
        }
        else{
            System.out.println("Yes");
        }
    }
}

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

const int inf = 1<<29;
int n;
vector<pair<int, int>> G[110];
vector<int> d(110, inf);

void dijkstra(int s){
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> qu;
    d[s] = 0;
    qu.push(make_pair(0, s));

    while(!qu.empty()){
        pair<int, int> p = qu.top(); qu.pop();
        if(d[p.second] < p.first) continue;
        for(auto e:G[p.second]){
            if(d[e.second] > p.first+e.first){
                d[e.second] = p.first+e.first;
                qu.push(make_pair(d[e.second], e.second));
            }
        }
    }
}

int main(){
    cin >> n;
    for(int i=0; i<n; ++i){
        int u, k; cin >> u >> k;
        for(int j=0; j<k; ++j){
            int v, w; cin >> v >> w;
            G[u].push_back(make_pair(w, v));
        }
    }

    dijkstra(0);
    for(int i=0; i<n; ++i){
        cout << i << ' ' << d[i] << '\n';
    }

    return 0;

}


Measured memory_bytes: 3156
#include <iostream>
#include <stdio.h>
using namespace std;

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

	int panjang = s.length();
	int firstA = 0, lastZ = panjang - 1;


	while (s[firstA] != 'A'){
        firstA++;
	}

	while (s[lastZ] != 'Z'){
        lastZ--;
	}

	printf("%d\n", lastZ - firstA + 1);
}


Measured memory_bytes: 3844
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int r, D, x2000;
  cin >> r >> D >> x2000;
  
  int x = x2000;
  repi(i,2001,2010) {
    x = r*x - D;
    cout << x << endl;
  }
}

Measured memory_bytes: 256
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define inf 5000
const int maxnodes=1005;
#define ll long long
#define N 31
#define EPS 0.01
#define ld long double






int32_t main()
{
    IOS;

    int n;
    cin >> n;
    int k;
    cin >> k;
    vector<int> v(n);
    for(int i = 0;i < n;i++)
        cin >> v[i];
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        int frnt = 0;
        int bck = 0;
        for(int j = i + 1;j < n;j++)
        {
            if(v[i] > v[j])
                frnt++;
        }
        for(int j = i - 1;j >= 0;j--)
        {
            if(v[i] > v[j])
                bck++;
        }
        int l1 = (k * (k+1)) / 2;
        l1 %= mod;
        l1 = (l1 * frnt) % mod;
        int l2 = (k * (k-1)) / 2;
        l2 %= mod;
        l2 = (l2 * bck) % mod;
        ans = (ans + l1 +l2)%mod; 
    }
    cout << ans;

}
    
 
 
 
 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a[3][3], n, b;
bool vis[3][3];
set<int> st;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            cin >> a[i][j];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> b;
        st.insert(b);
    }
    bool ok = false;
    for (int i = 0; i < 3; i++) {
        bool flag = true;
        for (int j = 0; j < 3; j++) {
            if (st.count(a[i][j]) == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ok = true;
            break;
        }
    }
    for (int i = 0; i < 3; i++) {
        bool flag = true;
        for (int j = 0; j < 3; j++) {
            if (st.count(a[j][i]) == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ok = true;
            break;
        }
    }
    if (st.count(a[0][0]) && st.count(a[1][1]) && st.count(a[2][2])) ok = true;
    if (st.count(a[0][2]) && st.count(a[1][1]) && st.count(a[2][0])) ok = true;
    if (ok) cout << "Yes" << E;
    else cout << "No" << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>

int main(){
    using namespace std;
    int a, b;
    char op;//string can not run
    while (op != '?'){
        cin >> a >> op >> b;
        switch(op){
            case '+':cout << a+b <<endl; break;
            case '-':cout << a-b <<endl; break;
            case '*':cout << a*b <<endl; break;
            case '/':cout << static_cast<double>(a/b) <<endl; break;
            //default:cout << "this symbol is not defined" << endl;break;
        }
    }
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define FOR(itr, v) for (auto itr = (v).begin(); itr != (v).end(); ++itr)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int a, b, c, d; cin >> a >> b >> c >> d;
    string ans;
    if ((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3536
using System;
using System.Collections.Generic;

class Program
    {
        static void Main(string[] args)
        {
            //?????°??????
            string[] card; //1???????????????
            var card_list = new List<int>();//???????????????
            var nocard_list = new List<int>();//???????????????
            int card_id = 0, card_rank = 0, x = 0, get_count =0 ;
            int count = int.Parse(Console.ReadLine());//??????????????°

            //?????¨?????????????????????
            for (int num = 0; num < count; num++)
            {
                card = Console.ReadLine().Split();
                card_rank = int.Parse(card[1]);
                card_id = GetId(card[0],card_rank);
                card_list.Add(card_id);
            }
            //????????????????????????????????????
            card_list.Sort();
            for (int num = 1; num <= 52; num++)
            {               
                if (card_list[x] != num)
                {
                    nocard_list.Add(num);
                }
                else
                {
                    get_count++;
                    if (get_count<count) {
                        x++;
                    }
                }
            }

            foreach (int i in nocard_list)
            {
                card = GetCard(i);
                Console.WriteLine("{0} {1}",card[0],card[1]);
            }
            Console.Read();
        }

        public static int GetId(string mark, int no)
        {
            int id = 0;
            switch (mark)
            {
                case "S":
                    break;
                case "H":
                    id += 13;
                    break;
                case "C":
                    id += 26;
                    break;
                case "D":
                    id += 39;
                    break;
            }
            id += no;
            return id;
        }

        public static string[] GetCard(int card_id)
        {
            string[] card = new string[2];
            if (card_id <= 13)
            {
                card[0] = "S";
                card[1] = card_id.ToString();
            }
            if (card_id > 13 && card_id<=26)
            {
                card[0] = "H";
                card[1] = (card_id - 13).ToString();
            }
            if (card_id > 26 && card_id <= 39)
            {
                card[0] = "C";
                card[1] = (card_id - 26).ToString();
            }
            if (card_id > 39)
            {
                card[0] = "D";
                card[1] = (card_id - 39).ToString();
            }

            return card;
        }
    }

Measured memory_bytes: 9460
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef struct _data {
	int x;
	int y;
} data;

int  main()
{
	long n[3];
	int k;
	cin >> n[0] >> n[1] >> n[2] >> k;
	int max  =0;
	int idx = 0;
	int ans = 0;
	rep(i, 3)
	{
		if (max <= n[i])
		{
			max = n[i];
			idx = i;
		}
	}
	rep (i, k)
		max *= 2;
	rep(i, 3)
	{
		if (i != idx)
			ans += n[i];
		if (i == idx)
			ans += max;
	}
	cout << ans << endl;
	return (0);
}


Measured memory_bytes: 256
n, m = gets.chomp.split.map{|x| x.to_i}

nodes = {}

m.times {
	x, y = gets.chomp.split.map{|x| x.to_i}
	if nodes[x] == nil then
		nodes[x] = [y]
	else
		nodes[x] << y
	end
}

from, to = gets.chomp.split.map{|x| x.to_i}

zeros = {from => 0}
ones = {}
twoes = {}

is_detected = false

tmp_zeros = {from => 0}
tmp_ones = {}
tmp_twoes = {}

while tmp_zeros.keys.size + tmp_ones.keys.size + tmp_twoes.keys.size > 0 do
	tmp_tmp_zeros = {}
	tmp_tmp_ones = {}
	tmp_tmp_twoes = {}
	

	tmp_zeros.keys.each{ |k|
		nodes[k] && nodes[k].each{ |x|
			if ones[x] == nil then
				ones[x] = tmp_zeros[k]
				tmp_tmp_ones[x] = tmp_zeros[k]
			end
		}
	}

	tmp_ones.keys.each{ |k|
		nodes[k] && nodes[k].each{ |x|
			if twoes[x] == nil then
				twoes[x] = tmp_ones[k]
				tmp_tmp_twoes[x] = tmp_ones[k]
			end
		}
	}

	tmp_twoes.keys.each{ |k|
		nodes[k] && nodes[k].each{ |x|
			if zeros[x] == nil then
				zeros[x] = tmp_twoes[k] + 1
				tmp_tmp_zeros[x] = tmp_twoes[k] + 1
			end
		}
	}

	tmp_zeros = tmp_tmp_zeros
	tmp_ones = tmp_tmp_ones
	tmp_twoes = tmp_tmp_twoes

	if zeros[to] then
		puts zeros[to]
		is_detected = true
		break
	end
end

if ! is_detected then
	puts '-1'
end

STDOUT.flush


Measured memory_bytes: 44156
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func main() {
	list := getStdinArr()
	N, _ := strconv.Atoi(list[0])
	M, _ := strconv.ParseFloat(list[1], 64)
	n := N
	m := int(math.Round(M * 100))
	fmt.Printf("%d\n", (n*m)/100)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinArr() []string {
	str := getStdin()
	list := strings.Split(str, " ")
	return list
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


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

int main()
{
	int a, b;
	cin >> a >> b;
	int n = -1;
	for (int i = 0; i < 1100; i++) {
		if ((floor((double)i * 0.08) == a) && (floor((double)i * 0.10) == b)) {
			n = i;
			break;
		}
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,a,b;
	cin>>n;
	for (long long int i=sqrt(n);i>=0;i--)
	{
	    if (n%i==0)
	    {
	        a=i;
	        b=n/i;
	        break;
	    }
	}
	if (a<b)
	swap(a,b);
	long long int ans = 2*(b-1)+a-b;
	cout<<ans;
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int r;
    cin >> r;
    if(r < 1200){
        cout << "ABC" << endl;
    }else if(r < 2800){
        cout << "ARC" << endl;
    }else{
        cout << "AGC" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#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<bits/stdc++.h> 
using namespace std; 

int main() 
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    long long int a, b;
    cin>>a>>b;
    cout<<(a*b)/__gcd(a, b)<<endl;
    
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
   int n; cin>>n;
   //文字列として扱って、長さを測る
   int ans=0;
   for(int i=1;i<=n;i++){
      if(to_string(i).length()%2==1) ans++;
   }
   cout<<ans<<endl;
   return 0;
}

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

int main()
{
    long H;
    cin >> H;
    int sum = 0;
    while(H != 0)
    {
        H /= 2;
        sum ++;
    }
    long res = pow(2,sum);
    cout << res  - 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define N 1001001
bool used[N];

int main() {
    int s;
    cin >> s;
    for(int i=0; i<N; ++i) used[i] = false;
    int prev = s;
    used[s] = true;
    int cur;
    for(int i=2; i<=N; ++i) {
        if(prev % 2) cur = 3 * prev + 1;
        else cur = prev / 2;
        if(used[cur]) {
            cout << i << endl;
            break;
        } else {
            used[cur] = true;
            prev = cur;
        }
    }
}

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

using namespace std;

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

int a, b, c;
int main(){
  scanf("%d %d %d", &a, &b, &c);

  if(a == b+c || b == c+a || c == a + b) printf("Yes\n");
  else printf("No\n");
  
}


Measured memory_bytes: 764
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto s = readln.chomp.split;
  if (s[0][$-1] == s[1][0] && s[1][$-1] == s[2][0]) {
    writeln("YES");
  } else {
    writeln("NO");
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N,i,S;
  int A[100],B[100];
  scanf("%d\n",&N);
  for(i=0;i<=N-2;i++){
    scanf("%d",&B[i]);
  }
  A[0]=B[0];
  A[N-1]=B[N-2];
  for(i=1;i<=N-2;i++){
    if(B[i-1]>B[i]){
      A[i]=B[i];
    }else{
      A[i]=B[i-1];
    }
  }
  
  S=0;
  for(i=0;i<=N-1;i++){
    S=S+A[i];
  }
  
  printf("%d",S);
  
  return 0;
}

Measured memory_bytes: 128