akhauriyash/Code-Regression huggingface dataset:
// Standard Stuff
#include <bits/stdc++.h>
using namespace std;

// Macros
#define F  first
#define S  second
#define PB push_back
#define MP make_pair
#define ALL(container)   container.begin(),container.end()
#define RALL(container)  container.rbegin(),container.rend()
#define MAKE_UNIQUE(vec) vec.erase(unique(ALL(vec)),vec.end())

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = std::pair <int,int>;

// Random
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/* [a,b] */ template<class T> T rnd_IntType(T a, T b){ return uniform_int_distribution<T>(a, b)(rng); }
/* [a,b) */ template<class T> T rnd_RealType(T a, T b){ return uniform_real_distribution<T>(a,b)(rng); }

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m, y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// Helpers
vector<pii> moves_grid = { {0,1} , {0,-1} , {1,0} , {-1,0} };
// vec.assign() GOOD; vec.resize() BAD
// comparator, <

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const set<T> &v)    { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T,S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T,S> &v)  { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef VOID_d1097589d5c8e3676b0fd9e08281f3d4
	#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); d__f(_it, args); }
	void d__f(__attribute__((unused)) istream_iterator<string> it) {}
	template<typename Head, typename... Tail> void d__f(istream_iterator<string> it, Head H, Tail... T) { cerr << *it << " <=> [" << H << "]\n"; d__f(++it, T...); }
#else
	#define trace(args...)
#endif


void solve(){
	int x, n;
	cin >> x >> n;

	vector<int> p(n);
	for(auto &i: p) cin >> i;

	set<int> s(ALL(p));

	for(int d = 0; ; ++d){
		for(auto y: {-d, d})
			if(s.count(x + y) == 0){
				cout << x + y << "\n";
				return;
			}
	}
}

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

	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


Measured memory_bytes: 3660
import java.util.Scanner;

class problemA{

  void solve(){
    int c1x=0, c1y=0, c1r=0;
    int c2x=0, c2y=0, c2r=0;
    int length = 0;//length of between center coordinate of c1 and c2
    int large = 0, small = 0;

    Scanner scan = new Scanner(System.in);
    c1x = scan.nextInt();
    c1y = scan.nextInt();
    c1r = scan.nextInt();

    c2x = scan.nextInt();
    c2y = scan.nextInt();
    c2r = scan.nextInt();

    large = c1r;
    small = c2r;
    if(large < small){
      large = c2r;
      small = c1r;
    }

    length = (int)(Math.sqrt((c2x-c1x)*(c2x-c1x) + (c2y-c1y)*(c2y-c1y)));

    if(length > (c1r + c2r)) System.out.println("4");
    else if (length < (c1r + c2r)){
        if(large == (length + small)) System.out.println("1");
        else if(large > (length + small))System.out.println("0");
        else System.out.println("2");
    }
    else System.out.println("3");
  }
}

public class Main{
  public static void main(String[] args){
    new problemA().solve();
  }
}



Measured memory_bytes: 26316
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

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


Measured memory_bytes: 256
n = int(input())
s_count = {}

for c in range(n):
    s = input()
    if s not in s_count:
        s_count[s] = 0
    s_count[s] += 1

# print(s_count)

max_count = 0

for word, count in s_count.items():
    max_count = max(count, max_count)

# print(max_count)
res = []
for word, count in s_count.items():
    if count == max_count:
        res.append(word)
# print(word)
for word in sorted(res):
    print(word)

Measured memory_bytes: 32984
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    string s; cin >> s;
    if (s[1] == 'B') {
        cout << "ARC" << endl;
    }
    else cout << "ABC" << endl;


    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

using VL = vector<long long>;
using VVL = vector<VL>;

const long long inf = 1e18;

int n;
VL a;
VVL memo; // [i, j)な範囲の合成に必要なコスト

void show() {
	for (int i = 0; i < memo.size(); i++) {
		printf("%2d: ", i);
		for (auto x: memo[i]) {
			if (x == inf) {
				printf(" %4s", "inf");
			} else {
				printf(" %4lld", x);
			}
		}
		printf("\n");
	}
}

long long dfs(int l, int r) {
	if (memo[l][r] != inf) {
		return memo[l][r];
	}

	if (r - l == 1) {
		memo[l][r] = 0;
		return 0;
	}

	long long mini = inf;
	int mid = -1;
	long long sum = a[l];
	for (int m = l + 1; m < r; m++) {
		sum += a[m];

		auto val1 = dfs(l, m);
		auto val2 = dfs(m, r);

		long long tmp = val1 + val2;
		if (tmp < mini) {
			mini = tmp;
			mid = m;
		}
	}

	memo[l][r] = mini + sum;
	return memo[l][r];
}

int main() {
	cin >> n;

	a.assign(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	memo.assign(n+1, VL(n+1, inf));
	auto ans = dfs(0, n);
	cout << ans << endl;

	// show();
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main() {
    ll n,k; cin >> n >> k;
    vector<ll> a(n); rep(i,n) cin >> a[i];

    ll p1 = 0;
    rep(i,n){
        for(ll j= i+1; j<n; j++){
            if(a[i] > a[j]){
                p1++;
            }
        }
    }

    ll p2 = 0;
    rep(i,n){
        rep(j,n){
            if(a[i] > a[j]) p2++;
        }
    }

    ll ans = 0;
    ans += p1 * k;
    ans %= 1000000007;
    ans += (k*(k-1)/2)% 1000000007 * p2 %1000000007;
    ans %= 1000000007;

    cout << ans << endl;
}

Measured memory_bytes: 256
get = input().split()
h = input().split()
N = int(get[0])
K = int(get[1])
n = 0
for i in range(len(h)):
    h[i] = int(h[i])
for i in range(len(h)):
    if h[i] >= K:
        n += 1
        
print(n)

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




//-----------------------------------------------------------------
#define rrep(i,a,b) for(int i=a;i>=b;i--)
vector<int> mul9(vector<int> s) {
	int n = s.size(), carry = 0;
	vector<int> ret;
	rrep(i, n - 1, 0) {
		int c = s[i] * 9 + carry;
		carry = c / 10;
		c %= 10;
		ret.push_back(c);
	}
	while (0 < carry) {
		ret.push_back(carry % 10);
		carry /= 10;
	}
	reverse(ret.begin(), ret.end());
	return ret;
}
vector<int> add(vector<int> s, int x) {
	int n = s.size(), carry = x;
	vector<int> ret;
	rrep(i, n - 1, 0) {
		int c = s[i] + carry;
		carry = c / 10;
		c %= 10;
		ret.push_back(c);
	}
	while (0 < carry) {
		ret.push_back(carry % 10);
		carry /= 10;
	}

	return ret;
}
//-----------------------------------------------------------------
vector<int> S;
bool chk(int k) {
	auto s = add(S, k);
	int cnt = 0;
	for (int c : s) cnt += c;

	return cnt <= k;
}
//-----------------------------------------------------------------
int main() {
	string _S; cin >> _S;
	for (char c : _S) S.push_back(c - '0');

	S = mul9(S);

	int lo = 0, hi = 4501010;
	while (lo + 1 != hi) {
		int mi = (lo + hi) / 2;
		if (chk(mi)) hi = mi;
		else lo = mi;
	}
	int ans = hi / 9;
	if (hi % 9) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 8832
_N, *_SP = open(0).read().split()
N = int(_N)

SP = {}

for i in range(N):
    SP[i+1] = [_SP[2*i], int(_SP[2*i+1])]

sorted_by_P = sorted(SP.items(), key = lambda x: x[1][1], reverse=True)
sorted_by_S = sorted(sorted_by_P, key = lambda x: x[1][0])

print(*[x[0] for x in sorted_by_S], sep="\n")

Measured memory_bytes: 3064
n, m = map(int, input().split())

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = map(int, input().split())

num = 0
t = 0
s2 = [0]*n
if n>1:
	s2[0] = 1

if s == 1:
    for i in range(m):
      for j in range(m):
        if c[i] != c[j] :
            print(-1)
            break
    print(c[0])
    
 
else:
    if len(set(s)) != len(s):
  
        for i in range(m):
          for j in range(m):
            if s[i] == s[j] and c[i] != c[j] and i !=j:
                #print(-1)
                t = 1
                break
        
    for i in range(m):
        s2[s[i]-1] = c[i]
          
        
    for i in range(n):
        
        
        num += 10**(n-(i+1))*s2[i]
        
    if t == 0 and num >= 10**(n-1)-1 :
        
    	print(num)
    else :
        print(-1)

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a > b) swap(a,b);
    for(int i = a; i <= b; ++i){
        if(abs(a - i) == abs(b - i)){
            cout << i << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    sort(all(v));
    
    int sum = 0;
    rep(i,n)sum+=v[i];

    int x=sum;
    rep(i,n){
        if(v[i]%10!=0){
            x = v[i];
            break;
        }
    }
    
    
    if(sum%10!=0){
        cout<<sum<<endl;
    }else{
        cout<<sum-x<<endl;
    }
}

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

using namespace std;
typedef long long ll;

int Judge(int tag, vector<ll> &d) {
	ll i, x = 0;
	for (i = 0; i <= tag; i++)
		x += d[i];
	for (; i < d.size(); i++) {
		if ((x << 1) < d[i])
			return false;
		x += d[i];
	}
	return true;
}

int Search(vector<ll> &d, int l, int r) {
	if (l == r)
		return l;
	int tag = (l + r) >> 1;
	if (Judge(tag, d))
		return Search(d, l, tag);
	else
		return Search(d, tag + 1, r);
}

int main(void) {
	int num, i;
	cin >> num;
	vector<ll> d(num);
	for (i = 0; i < num; i++)
		scanf("%lld", &d[i]);
	sort(d.begin(), d.end());
	i = Search(d, 0, num - 1);
	cout << num - i << "\n";
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x%y) : x;  /*yが0でなければgcd、1であればxをかえす*/
}

int main(){
	ll a, b;
	cin >> a >> b;
	ll x= gcd(a, b);
	ll ans = 0;
	ll c = 2;
	while (x >= c*c){
		if (x % c == 0) {
			while (x%c == 0){
				x = x / c;
			}
			ans++;
		}
		c++;
	}

	if (x != 1) {
		ans++;
	}
	cout << ans+1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string G(string s) {
	for (int a=1; a<26; ++a) {
		for (int b=0; b<26; ++b) {
			string t = s;
			for (int i=0; i<t.size(); ++i) {
				if (islower(t[i])) {
					t[i] = 'a' + (a * (s[i] - 'a' + b)) % 26;
				}
			}
			if (t.find("this") != -1 || t.find("that") != -1) {
				return t;
			}
		}
	}
}
int main() {
	int n;
	cin >> n;
	cin.ignore();
	string s;
	while (n--, getline(cin, s)) {
		cout << G(s) << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] T = new int[N + 1];
        int[] X = new int[N + 1];
        int[] Y = new int[N + 1];        
        
        T[0] = 0;
        X[0] = 0;
        Y[0] = 0;
        
        for(int i = 1 ; i < N + 1 ; i++){
            T[i] = sc.nextInt();
            X[i] = sc.nextInt();
            Y[i] = sc.nextInt();
        }
        
        for(int i = N  ; i > 0 ; i--){
            int needT = T[i] - T[i - 1];
            int needP = Math.abs(X[i] - X[i - 1]) + Math.abs(Y[i] - Y[i - 1]);
            //時間が余っていなければアウト
            if(needT < needP){
                break;
            }
            //つぶせる時間は偶数である
            if((needT - needP) % 2 == 1){
                break;
            }
            System.out.println("Yes");
            return;
            
        }
        System.out.println("No");
        
    }
}


Measured memory_bytes: 91360
x ={}
n = int(input())
for i in range(n):
    k,v = input().split()
    if k in x:
        x[k] += int(v)
    else:
        x[k] = int(v)
p=list(x.items())
p.sort(key=lambda x: x[0])
p.sort(key=lambda x: len(x[0]))
for i in p:
    print(i[0],i[1])


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

int n;
string s;
list<char> ls;

int main(){
	cin >> n;
	for(int I = 0; I < n; I++){
		cin >> s;
		ls = list<char>();
		ls.push_back(s[0]);
		list<char>::iterator itr = ls.begin();
		for(int i = 3; i < s.size(); i+=3){
			if(s[i-1] == '-'){
				if(itr == ls.begin()){
					ls.push_front(s[i]);
				}
				itr--;
			}
			else{

				if(++itr == ls.end()){
					ls.push_back(s[i]);
					itr = ls.end();
					itr--;
				}
			}
		}
		for(list<char>::iterator i = ls.begin(); i != ls.end(); i++){
			cout << *i;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n))
        self.rank = [0] * n
        self.size = [1] * n

    def find(self, id):
        if id != self.parent[id]:
            self.parent[id] = self.find(self.parent[id])
        return self.parent[id]

    def union(self, id1, id2):
        par1, par2 = self.find(id1), self.find(id2)
        if par1 == par2:
            return 0
        ret = self.size[par1] * self.size[par2]
        if self.rank[par1] > self.rank[par2]:
            self.parent[par2] = par1
            self.size[par1] += self.size[par2]
        else:
            self.parent[par1] = par2
            if self.rank[par1] == self.rank[par2]:
                self.rank[par2] += 1
            self.size[par2] += self.size[par1]
        return ret

nVertices, nEdges = map(int, input().split())
edges = [tuple(map(lambda v: int(v) - 1, input().split())) for _ in range(nEdges)]
parent = list(range(nVertices))
rank = [0] * nVertices
size = [1] * nVertices
count = [0] * (nEdges - 1) + [nVertices * (nVertices - 1) // 2]
unionFind = UnionFind(nVertices)
for i in range(nEdges - 2, -1, -1):
    u, v = edges[i + 1]
    count[i] = count[i + 1] - unionFind.union(u, v)
print('\n'.join(map(str, count)))

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

int main(){
  int i,j;
  string s;
  cin >> s;
  for(i=0; i<s.size(); i++){
    if(s[i]=='C'){
      for(j=i+1; j<s.size(); j++){
        if(s[j]=='F'){
          cout << "Yes"; return 0;
        }
      }
      cout << "No"; return 0;
    }
  }
  cout << "No"; return 0;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n,m;
    cin2(n,m);
    string s;
    cin1(s);

    vlli ans;
    lli cur = n;
    while (true) {
        bool is_ng = true;
        REPE_R(j,m,1) {
            if (cur-j <= 0) {
                ans.push_back(cur);
                goto OK;
            }
            if (s[cur-j] == '0') {
                // これで良い
                ans.push_back(j);
                cur -= j;
                is_ng = false;
                break;
            }
        }
        if(is_ng)
            goto NG;
    }

OK:
    REPE_R(i,ans.size()-1, 0) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
NG:
    cout << -1 << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int H, W; cin >> H >> W;
  vstr S(H); cin >> S;
  vector<vi32> xsums(H + 2, vi32(W + 2));
  vector<vi32> ysums(H + 2, vi32(W + 2));
  reps(i, H) reps(j, W) {
    if (S[i - 1][j - 1] == '#') continue;
    xsums[i][j] = xsums[i][j - 1] + 1;
    ysums[i][j] = ysums[i - 1][j] + 1;
  }
  rreps(i, H) rreps(j, W) {
    if (S[i - 1][j - 1] == '#') continue;
    amax(xsums[i][j], xsums[i][j + 1]);
    amax(ysums[i][j], ysums[i + 1][j]);
  }
  int ans = 1;
  reps(i, H) reps(j, W) {
    amax(ans, xsums[i][j] + ysums[i][j] - 1);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 35968
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll x;
    cin >> x;
    ll n = x/11;
    n *= 2;
    x %= 11;
    if(0 < x && x <= 6) n++;
    elif(x >= 7) n += 2;
    cout << n << endl;
}

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

ll choose(ll n, ll k){
    ll ret = 1;
    REP(i, k){
        ret *= (n - i);
    }
    REP(i, k){
        ret /= (i + 1);
    }
    return ret;
}

ll pow(ll x, ll y){
    if(y == 0){
        return 1;
    }else{
        return x * pow(x, y - 1);
    }
}

ll solve(const string& n, ll k, ll pos, ll state){
    const ll nd = n.size() - pos;
    if(k > 0 && nd == 0){
        return 0;
    }
    if(k == 0){
        return 1;
    }
    if(state == 1){
        return choose(nd, k) * pow(9, k);
    }
    assert(state == 0);
    const ll d = static_cast<ll>(n.at(pos) - '0');
    ll ret = 0;
    if(d > 0){
        ret += solve(n, k - 1, pos + 1, 0); // ちょうど d
    }
    if(d > 1){
        ret += (d - 1 ) * solve(n, k - 1, pos + 1, 1); // 0 より大きく d より小さい
    }
    ret += solve(n, k, pos + 1, d > 0); // ちょうど 0
    return ret;
}

int main(){
    string n;
    cin >> n;
    ll k;
    cin >> k;

    ll ans = solve(n, k, 0, 0);
    cout << ans << endl;
    return 0;
}


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

int main () {
  string s, p;
  getline(cin, s);
  getline(cin, p);
 
  s += s;
 
  int a = s.find(p);
 
  if (a == -1) cout << "No" << endl;
  else  cout << "Yes" << endl;
 
  return 0;
}

Measured memory_bytes: 1184
/*
 * atcoder/abc148/e.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

ll g(ll n, ll p) {
  if (n<p) return 0;
  return n/p + g(n/p, p);
}

ll h(ll n, ll p) {
  if (n%2==1) {
    return g(n, p) - h(n-1, p);
  }

  ll res = g(n/2, p);
  if (p==2) res += n/2;
  return res;
}

void solve() {
  ll n;
  cin >> n;
  cout << min(h(n, 2), h(n, 5)) << endl;
}


Measured memory_bytes: 256
import sys
x,n = map(int,input().split())
p = list(map(int,input().split()))
s = 100
min_i = -1

if x not in p:
    print(x)
    sys.exit()

for i in range(-1,102):
    if i not in p and abs(i-x) < s:
        s = abs(i-x)
        min_i = i

        
print(min_i)


Measured memory_bytes: 9096
from collections import deque

H,W=map(int,input().split())
s=[]

cnt=0
for i in range(H):
    temp=list(input())
    cnt+=temp.count(".")
    s.append(temp)

d=deque([[0,0]])
c=[[10000]*W for i in range(H)]
step=[[-1,0],[0,-1],[1,0],[0,1]]
c[0][0]=1

while d:
    h0,w0=d.popleft()
    for h1,w1 in step:
        h = h0 + h1
        w = w0 + w1
        if h<0 or h>=H or w<0 or w>=W or s[h][w]=="#" or c[h][w]!=10000:
            continue
        if h==H-1 and w==W-1:
            ans = cnt - c[h0][w0]-1
            print(ans)
            exit()
        c[h][w]=c[h0][w0]+1
        d.append([h,w])
print(-1)

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;
ll gcd(ll a, ll b)
{
    return (b ? gcd(b, a % b) : a);
}
int main()
{
    speed;
    cout << fixed << setprecision(10);
    /*start*/
    int r, g;
    cin >> r >> g;
    int ans = 2 * g - r;
    c(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  bool yellow = false;
 
  for ( int i = 0; i < N ; i++ ) {
    string S;
    cin >> S;
    
    if ( S == "Y" ) {
      yellow = true;
      break;
    }
  }
  
  if ( yellow ) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 100000000000
#define int long long int
#define hell 1000000007

using namespace std;

void solve(){
    int n,k,ans;
    cin>>n>>k;
    ans=0;
    int totsum=(n*(n+1))/2;
    for(int i=k;i<=n+1;i++){
        int minsum=(i*(i-1))/2;
        int msum=totsum-((n-i)*(n-i+1))/2;
        ans+=msum-minsum+1;
        ans%=hell;
    }
    cout<<ans;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	if(a==b && a!=c)
	{
		cout<<"Yes";
	}
	else if(a==c && a!=b)
	{
		cout<<"Yes";
	}
	else if(b==c && a!=c)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



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

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

typedef long long ll;

using namespace std;

template <class Monoid>
class SegmentTree
{
public:
  using Func = function<Monoid(Monoid, Monoid)>;
  const Func F;
  const Monoid M1;
  int sz;
  vector<Monoid> seg;

  SegmentTree(int n,const Func fu, const Monoid &m1): F(fu) , M1(m1) {init(n);}
  void init(int n)
  {
      sz= 1;
      while (sz < n) sz *= 2;
      seg.assign(sz * 2, M1);
  }
  void update(int k,const Monoid &x)
  {
    k+=sz;
    seg[k]+=x;
    while(k>>=1)
    {
      seg[k]=F(seg[k*2],seg[k*2+1]);
    }
  }
  Monoid query(int l,int r)
  {
    Monoid L=M1,R=M1;
    l+=sz;r+=sz;
    for(;l<r;l>>=1,r>>=1)
    {
      if(l&1)L=F(L,seg[l++]);
      if(r&1)R=F(seg[--r],R);
    }
    return F(L,R);
  }
};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll ng=0,ok=1e9;
  auto check=[&](ll num){
    auto b=a;
    rep(i,n){
      if(a[i]<=num)b[i]=1;
      else b[i]=-1;
    }
    vector<ll>sb(n+1,0);
    sb[0]=n;
    rep(i,n)sb[i+1]=sb[i]+b[i];
    SegmentTree<ll> st(2*n,[](ll a,ll b){return a+b;},0LL);
    ll su=0;
    repi(i,0,n+1){
      //cout<<"sb "<<sb[i]<<endl;
      su+=st.query(0,sb[i]);
      st.update(sb[i],1);
      //cout<<"su "<<su<<endl;

    }
  //  cout<<num<<endl;
  //  cout<<su<<" "<<n*(n+1)/4<<endl;
    return su>n*(n+1)/4;

  };
  while(ok-ng>1){
    ll nn=(ok+ng)/2;
    if(check(nn))ok=nn;
    else ng=nn;
  }
  cout<<ok<<endl;
  return 0;

}


Measured memory_bytes: 6756
using System.Collections.Generic;
using System.Linq;
using static System.Console;
namespace A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            SolveA();
        }

        static void SolveA()
        {
            var input = ReadLine().Split(' ').Select(int.Parse).OrderBy(x =>x);
            var searchTarget = new List<int> {5, 5, 7}.OrderBy(x=>x);
            WriteLine(input.SequenceEqual(searchTarget)?"YES":"NO");
        }
    }
}

Measured memory_bytes: 28160
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ds = readLine()!!.split(" ").take(n).map { it.toInt() }.sorted().toIntArray()

    var count = 0
    for (ai in (0 until ds.size - 2)) {
        for (bi in (ai + 1 until ds.size - 1)) {
            count += search(ds, ds[ai] + ds[bi], (bi + 1), ds.size - 1)
        }
    }

    print(count)
}

fun search(array: IntArray, key: Int, from: Int, to: Int): Int {
    var low = from
    var high = to
    if (array[from] >= key) {
        return 0
    }

    while (low < high) {
        val mid = (low + high) / 2 + 1
        val midVal = array[mid]

        if (midVal < key)
            low = mid
        else if (midVal >= key)
            high = mid - 1

    }
    return low - from + 1

}

Measured memory_bytes: 37904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int sum = 0;
int f(ll x){
  int sum = 0;
  REP(i, 2, sqrt(x)){
    if(x%i == 0){
      sum += f(x/i);
    }
    else if(x%i == 1) sum++;
  }
  return sum;
}


int main(){
  ll n;
  cin >> n;

  int sum = 0;
  REP(i, 2, sqrt(n)){
    if(n%i == 0){
      ll nn = n;
      while(nn%i == 0 && nn >= i){
        nn /= i;
      } 
      if(nn%i == 1) sum++;
    }
  }
  sum++;
  n--;
  REP(i, 1, sqrt(n)){
    if(n%i == 0) sum += 2;
  }
  sum--;
  if(n == (ll)sqrt(n) * (ll)sqrt(n)) sum--;

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s;
    cin >> s;
    int x = 0;
    int n = len(s);
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s.back()) {
            x++;
        }

        s.pop_back();
    }
    cout << x;

    return 0;
}


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

using namespace std;

int main()
{
    string ch1, ch2;
    cin >> ch1 >> ch2;
    int ct = 0, i;
    for(i = 0; i < 3; i++)
    {
        if(ch1[i] == ch2[i]) ct++;
    }
    cout << ct << endl;
    return 0;
}


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

int d[40000];

int main(){
	d[0]=2;
	d[1]=3;
	int count=2;
	for(int i=4;i<=40000;i++){
		bool flag = true;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				flag = false;
				break;
			}
		}
		if(flag){
			d[count] = i;
			count++;
		}
	}
	d[count] = 9999;

	int n;
	while(cin >> n){
		if(n==0){
			break;
		}
		int ans = 0;
		for(int i=0;d[i+1]<n;i++){
			for(int j=i;d[j]<n;j++){
				if(d[i]+d[j] == n){
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 884
N, X, Y = [int(_) for _ in input().split()]
X -= 1
Y -= 1

V = [0 for _ in range(N)]
for i in range(N):
    for j in range(i+1, N):
        v1 = j - i
        v2 = abs(i - X) + abs(j - Y) + 1
        V[min(v1, v2)] += 1
        
for v in V[1:]:
    print(v)


Measured memory_bytes: 9240
#include <iostream>

struct card {
    char suit;
    char value;
};

void BubbleSort(card A[], int N) {
    for (int i=0; i<N; i++) {
        for (int j=N-1; j>i; j--) {
            if (A[j].value < A[j-1].value) {
                card temp = A[j];
                A[j] = A[j-1];
                A[j-1] = temp;
            }
        }
    }
}

void SelectionSort(card A[], int N) {
    int j;
    for (int i=0; i<N; i++) {
        int minj = i;
        for (j=i; j<N; j++) {
            if (A[minj].value > A[j].value)
                minj = j;
        }
        card temp = A[i];
        A[i] = A[minj];
        A[minj] = temp;
    }
}

void showCards(card A[], int N) {
    for (int i=0; i<N; i++) {
        std::cout << A[i].suit << A[i].value;
        if (i==N-1) {
            std::cout << std::endl;
        } else {
            std::cout << " ";
        }
    }
}

void isStable(card A1[], card A2[], int N) {
    for (int i=0; i<N; i++) {
        if (A1[i].suit != A2[i].suit || A1[i].value != A2[i].value) {
            std::cout << "Not stable" << std::endl;
            return;
        }
    }
    std::cout << "Stable" << std::endl;
}

int main() {
    card A1[36], A2[36];
    int N;

    std::cin >> N;
    for (int i=0; i<N; i++) {
        std::cin >> A1[i].suit >> A1[i].value;
        A2[i] = A1[i];
    }

    BubbleSort(A1, N);
    showCards(A1, N);
    isStable(A1, A1, N);
    SelectionSort(A2, N);
    showCards(A2, N);
    isStable(A2, A1, N);
}



Measured memory_bytes: 3120
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(var,init,end) for(int var=init;var<end;var++)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
int facctorialMethod(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

int main() {
	long long n;
	cin >> n;

	vector<long long> a(n);
	FOR(i, 0, n)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	cout << a[n - 1] - a[0];

	return 0;
}

Measured memory_bytes: 256
n = int(input())
 
cities = []
for i in range(1, n+1):
    a,b = input().split()
    b = int(b)
    cities.append([i, a, b])
    
cities = sorted(cities, key=lambda x : x[2])
#print(cities)
cities.reverse()
#print(cities)
cities = sorted(cities, key=lambda x: x[1])
#print(cities)
for i in cities:
    print(i[0])

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

typedef struct{
  int num;
  int i;
  string ans;
} Data;

int main(){
  int n;
  cin >> n;
  queue<Data> que;

  Data d;
  d.num = n;
  d.i = 0;
  d.ans = "";

  que.push(d);

  Data tmp;

  while(1){
    d = que.front();
    que.pop();
    if(d.num == 0){
      cout << d.ans << endl;
      return 0;
    }
    d.i++;

    tmp = d;
    tmp.num += pow((double)3,(double)d.i-1);
    tmp.ans = "-" + tmp.ans;
    que.push(tmp);

    tmp = d;
    tmp.num -= pow((double)3,(double)d.i-1);
    tmp.ans = "+" + tmp.ans;
    que.push(tmp);

    tmp = d;
    tmp.ans = "0" + tmp.ans;
    que.push(tmp);
  }
}




Measured memory_bytes: 96592
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007LL
#define inf 1000000000000000000ll
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;

#define endl '\n'
#define int ll

struct node {
	vector<int> v,w;
};



signed main() {
	fast;
	int s = 0;
	vector<int> v(5);
	for(int i=0;i<5;i++) cin>>v[i], s+= v[i];

	cout<<15-s;

}

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

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

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int[] a=new int[3];
    for(int i=0;i<3;i++){
      a[i]=sc.nextInt();
    }
    Arrays.sort(a);
    if(a[0]==a[1] && a[1]!=a[2]){
      System.out.println("Yes");
    }else if(a[2]==a[1] && a[1]!=a[0]){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 22484
S = list(input())

cnt = 0
Bseq = 0
for i in range(len(S)-1):
    if S[i] == 'B':
        Bseq += 1
    else:
        Bseq = 0

    if S[i] == 'B' and S[i+1] == 'W':
        S[i] = 'W'
        S[i+1] = 'B'
        cnt += Bseq
        Bseq = Bseq-1

ans = cnt
print(ans)



Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fast() ios_base::sync_with_stdio(false);cin.tie(NULL);
int main()
{
     Fast();
     ll n,t,x,y,i,j,k,mini=LONG_LONG_MAX,maxi=LONG_LONG_MIN,flag =0 ,sum=0,mul=1;
     vector<ll>vi;
     string s,s1="";
    cin>>n;
    for(i = 0 ;i<n ;i++)
    {
        cin>>x;
        maxi=max(maxi,x);
        sum+=x;
    }
    sum-=maxi;
    if(sum>maxi)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


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

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

void solve(std::string S){
	if (S[2] == S[3] && S[4] ==S[5]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

int main(){
	std::vector<int> H_list;
	std::vector<int> W_list;
	int H, W;
	std::cin >> H >> W;
	while((H!=0) && (W!=0)){
		H_list.push_back(H);
		W_list.push_back(W);
		std::cin >> H >> W;
	}
	for (int i = 0; i < H_list.size(); i++){
		for (int j = 0; j < H_list[i]; j++){
			for (int k = 0; k < W_list[i]; k++){
				std::cout << "#";
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3156
Sp = input()
Sp_list = list(Sp)
N = len(Sp)
T = input()
n = len(T)

def check(s, t):
  for si, ti in zip(s, t):
    if si == '?':
      continue
    if si != ti:
      return False
  return True

ans = []
for i in range(N-n+1):
  if check(Sp[i:i+n], T):
    ans.append(''.join(Sp_list[:i] + list(T) + Sp_list[i+n:]).replace('?', 'a'))
    
if ans:
  ans.sort()
  print(ans[0])
else:
  print('UNRESTORABLE')

Measured memory_bytes: 3064
//
//  CPlibrary
//
//  Created by Tanmay Singh on 3/03/2020.
// INDIAN INSTITUTE OF TECHNOLOGY (BHU) , VARANASI
//  Copyright © 2020 Tanmay Singh. All rights reserved.
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
 
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
 
#define FAST(); ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
typedef long long int  bigint ;
typedef std::vector< int > vi;
typedef std::vector< long long int > vll;
typedef std::vector< vi > vvi;
 
using namespace std;

int main(){
    FAST() ;
    string A , B ; cin >> A >> B ;
    sort( A.begin() , A.end() ) ;
    sort( B.rbegin() , B.rend() ) ;
    if( A < B )
        cout << "Yes" << endl ;
    else
        cout << "No" << endl ;
    return 0 ;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    ll X = c - a - b;
    if(X > 0 && 4 * a * b < X * X) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}
// sqrt(a) + sqrt(b) < sqrt(c)
// (A + B)^2 < C^2
// A^2 + 2AB + B^2 < C^2
// a + 2AB + b < c
// 2AB < c - a - b
// 4ab < ()

Measured memory_bytes: 3652
# include "bits/stdc++.h"
using namespace std;
int n, d[101010], dp[101010];
const int INF = INT_MAX; 
int main(){
    cin >> n;
    for(int i = 1;i <= n;i++)cin >> d[i];
    for(int i = 2;i <= n;i++){
        if(i == 2)dp[i] = dp[i - 1] + abs(d[i - 1] - d[i]);
        else dp[i] = min(dp[i - 1] + abs(d[i - 1] - d[i]), dp[i - 2] + abs(d[i - 2] - d[i]));
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
  int W, H, N;
  int x, y, a, xe, ye;
  int xs = 0, ys = 0;

  cin >> W >> H >> N;
  xe = W;
  ye = H;

  for(int i = 0;i < N;i++){
    cin >> x >> y >> a;
    if(a == 1 && xs < x){
      xs = x;
    }else if(a == 2 && xe > x){
      xe = x;
    }else if(a == 3 && ys < y){
      ys = y;
    }else if(a == 4 && ye > y){
      ye = y;
    }
  }
  
  if((xe-xs) <= 0 || (ye-ys) <= 0){
    cout << 0 << endl;
  }else{
    cout << (xe - xs) * (ye - ys) << endl;
  }

  return 0;

}


Measured memory_bytes: 256
S = input()

if 'N' in S or 'S' in S:
    if 'S' not in S or 'N' not in S:
        print('No')
        exit()

if 'E' in S or 'W' in S:
    if 'W' not in S or 'E' not in S:
        print('No')
        exit()

print('Yes')

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int a, b, c, d; cin >> a >> b >> c >> d;
    if( a + b < c + d ){
        cout << "Right" << endl;
    }else if( a + b > c + d ){
        cout << "Left" << endl;
    }else{
        cout << "Balanced" << endl; 
    }
}

Measured memory_bytes: 256