akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int mod=1e9+7;
ll kika[1000006];
struct Combinatorics {
  using int64 = long long;
  int64 mod;
  int64 fact[1000006];
  int64 invfact[1000006];
  Combinatorics(int64 mod):mod(mod) {
    fact[0] = invfact[0] = 1;
    for(int i = 1; i < 1000006; ++i) {
      fact[i] = fact[i-1]*i%mod;
      invfact[i] = minv(fact[i]);
    }
  }
  int64 mpow(int64 x, int64 n) const {
    int64 res = 1;
    while(n > 0) {
      if(n&1) res = res*x%mod;
      x = x*x%mod;
      n >>= 1;
    }
    return res;
  }
  int64 minv(int64 x) const {
    return mpow(x, mod-2);
  }
  int64 mfact(int64 x) const {
    return fact[x];
  }
  int64 C(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[r]%mod*invfact[n-r]%mod;
  }
  int64 P(int64 n, int64 r) const {
    if(r < 0 || n < r) return 0;
    return fact[n]*invfact[n-r]%mod;
  }
};
// ちょうどk回目で全て黒くなる通り数を求めるのは難しい
// k回以下で黒くなっている通り数は求めやすい
// k個になる個数=(k以下の個数-(k-1)以下の個数)テク
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;cin>>N;
  if(N==2){
    cout<<1<<endl;
    return 0;
  }
  Combinatorics COM(mod);
  kika[N-1]=COM.mfact(N-1);
  for(int k=N-2;k>=(N-1)/2;k--){
    kika[k]=(COM.mfact(k)*COM.mfact(N-1-k))%mod;
    kika[k]=(kika[k]*COM.C(k-1,N-k-1))%mod;
  }
  ll ans=0;
  for(int k=N-1;k>=(N-1)/2;k--){
    ans=ans+((kika[k]-kika[k-1]+mod)%mod)*k%mod;
    ans%=mod;
  }
  cout<<ans<<endl;
}

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

void dijkstra(const int start, vector<vector<pair<int, int64_t>>>& g,
              vector<int64_t>& cost){
    priority_queue<pair<int64_t, int>, vector<pair<int64_t, int>>, greater<>> q;
    q.push({0, start}); cost[start] = 0;
    while (not q.empty()) {
        auto from = q.top(); q.pop();
        if (cost[from.second] < from.first) continue;
        for (auto to : g[from.second]) {
            int64_t dist = from.first + to.second;
            if (cost[to.first] > dist) {
                cost[to.first] = dist; q.push({dist, to.first});
            }
        }
    }
}

int main(){
    int n, m, s, t; cin >> n >> m >> s >> t; s--; t--;
    vector<vector<pair<int, int64_t>>> g1(n), g2(n);
    for (auto i = 0; i < m; i++) {
        int u, v, a, b; cin >> u >> v >> a >> b; u--; v--;
        g1[u].push_back({v, a}); g1[v].push_back({u, a});
        g2[u].push_back({v, b}); g2[v].push_back({u, b});
    }

    vector<int64_t> c1(n, 1LL << 60), c2(n, 1LL << 60), c(n, 0);
    dijkstra(s, g1, c1); dijkstra(t, g2, c2);
    c[n - 1] = c1[n - 1] + c2[n - 1];
    for (auto i = n - 2; i >= 0; i--) c[i] = min(c1[i] + c2[i], c[i + 1]);
    for (auto i = 0; i < n; i++) cout << (int64_t)1e15 - c[i] << endl;
    return 0;
}

Measured memory_bytes: 21872
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
  exec({'RUBY_THREAD_VM_STACK_SIZE'=>'1000000000'}, '/usr/bin/ruby', $0)
end

def rec(v, g, dp)
  return dp[v] if dp[v] != -1
  res = 0
  g[v].each do |nv|
    d = rec(nv, g, dp) + 1
    res = d if d > res
  end
  dp[v] = res
end

n, m = gets.split.map(&:to_i)
g = Array.new(n+1){[]}
dp = Array.new(n+1){-1}
m.times do
  x, y = gets.split.map(&:to_i)
  g[x] << y
end

ans = 0
(1..n).each do |v|
  d = rec(v, g, dp)
  ans = d if d > ans
end
puts ans


Measured memory_bytes: 105168
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n,k; cin >> n >> k;
    vector<int> a(n); rep(i,n) cin >> a[i];
    while(k--){
        bool flag = true;
        vl b(n+1);
        rep(i,n){
            b[max(0LL,i-a[i])]++;
            b[min(n,i+a[i]+1)]--;
        }
        rep(i,n) b[i+1] += b[i];
        rep(i,n){
            if(b[i] != n) flag = false;
            a[i] = b[i];
        }
        if(flag){
            print(a);
            return 0;
        }
    }
    print(a);
}

Measured memory_bytes: 5636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
const double pi = 3.14159265358979323846264;

int main()
{
    ll a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    ll max_bunshi = 0;
    ll max_bunbo = 100 * a;
    for (ll i = 0; i <= (f / (a * 100)); i++)
    {
        for (ll j = 0; j <= (f - a * 100 * i) / (b * 100); j++)
        {
            ll mizu = a * 100 * i + b * 100 * j;
            for (ll k = 0; k <= (f - mizu) / c; k++)
            {
                for (ll l = 0; l <= (f - mizu - k * c) / d; l++)
                {
                    ll bunshi = 100 * (c * k + d * l);
                    ll bunbo = mizu + (c * k + d * l);
                    if (bunshi * (100 + e) <= 100 * e * bunbo)
                    {
                        if (bunshi * (max_bunbo) > max_bunshi * bunbo)
                        {
                            max_bunshi = bunshi;
                            max_bunbo = bunbo;
                        }
                    }
                }
            }
        }
    }
    cout << max_bunbo << " " << max_bunshi / 100 << endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
    int S,h,m,s;
    scanf("%d",&S);
    h = S/3600; S %= 3600;
    m = S/60; S %= 60;
    s = S;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


Measured memory_bytes: 2076
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<long long, long long>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename T>
void printvec(vector<T> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void sihou(vector<vector<ll>> &p, int x, int y){
    p[x][y] = p[x][y+1] + p[x+1][y] + p[x][y-1] + p[x-1][y];
}

int main(){
    int n; cin >> n;
    int k = (pow(1+8*n,0.5)-1) / 2;
    double kk = (pow(1+8*n,0.5)-1) / 2;
    if (k != kk) cout << "No" << endl;
    else {
        cout << "Yes" << endl;
        cout << k+1 << endl;
        k++;
        vector<vector<int>> ar(k, vector<int>(k-1));
        int cnt = 1;
        repp(i,k,1){
            rep(j,i){
                ar[i][j] = cnt;
                cnt++;
            }
        }
        cnt = 1;
        rep(j,k-1){
            rep(i,j+1){
                ar[i][j] = cnt;
                cnt++;
            }
        }
        rep(i,k){
            cout << k-1 << " ";
            rep(j,k-2){
                cout << ar[i][j] << " ";
            }
            cout << ar[i][k-2] << endl;
        }
    }
}

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

const int kN = 4e5 + 5;
const long long kInf = 1'000'000'000'000'000;
int c[kN], l[kN], r[kN], tl[kN], tr[kN];
long long dp[kN];

struct SegTree {
    long long tg[kN * 4], nd[kN * 4];

    SegTree() {
        for (int i = 0; i < kN * 4; ++i) {
            tg[i] = -kInf;
            nd[i] = -kInf;
        }
    }

    void Push(int o) {
        if (tg[o] == -kInf) return;
        nd[o * 2 + 1] = max(nd[o * 2 + 1], tg[o]);
        nd[o * 2 + 2] = max(nd[o * 2 + 2], tg[o]);
        tg[o * 2 + 1] = max(tg[o * 2 + 1], tg[o]);
        tg[o * 2 + 2] = max(tg[o * 2 + 2], tg[o]);
        tg[o] = -kInf;
    }

    void Modify(int l, int r, int ql, int qr, long long v, int o = 0) {
        if (l >= qr || ql >= r) return;
        if (l >= ql && r <= qr) {
            tg[o] = max(tg[o], v);
            nd[o] = max(nd[o], v);
            return;
        }
        Push(o);
        Modify(l, (l + r) >> 1, ql, qr, v, o * 2 + 1);
        Modify((l + r) >> 1, r, ql, qr, v, o * 2 + 2);
        nd[o] = max(nd[o * 2 + 1], nd[o * 2 + 2]);
    }

    long long Query(int l, int r, int p, int o = 0) {
        if (r - l == 1) return nd[o];
        Push(o);
        if (p < (l + r) >> 1) return Query(l, (l + r) >> 1, p, o * 2 + 1);
        return Query((l + r) >> 1, r, p, o * 2 + 2);
    }
} st[4][2], glob;

int main() {
    int n, m, x, y; scanf("%d%d%d%d", &n, &m, &x, &y);
    vector<int> ds;
    vector<tuple<int, int, int>> segs;
    for (int i = 1; i <= m; ++i) {
        scanf("%d%d%d", &c[i], &l[i], &r[i]);
        r[i] += 1;
        ds.push_back(l[i]);
        ds.push_back(r[i]);
        segs.emplace_back(r[i], l[i], c[i]);
    }
    ds.push_back(0);
    sort(ds.begin(), ds.end());
    ds.resize(unique(ds.begin(), ds.end()) - ds.begin());
    sort(segs.begin(), segs.end());
    for (int i = 1; i <= m; ++i) {
        tie(r[i], l[i], c[i]) = segs[i - 1];
        tl[i] = lower_bound(ds.begin(), ds.end(), l[i]) - ds.begin();
        tr[i] = lower_bound(ds.begin(), ds.end(), r[i]) - ds.begin();
    }
    dp[0] = 0;
    st[0][0].Modify(0, ds.size(), 0, 1, 0);
    glob.Modify(0, ds.size(), 0, ds.size(), 0);
    long long ans = 0;
    for (int i = 1; i <= m; ++i) {
        dp[i] = -kInf;
        for (int j = 0; j <= 3; ++j) {
            if (j != 0 && j != c[i]) 
                dp[i] = max(dp[i], st[j][1].Query(0, ds.size(), tl[i]) + 1LL * (x + x + y) * l[i]);
            else
                dp[i] = max(dp[i], st[j][0].Query(0, ds.size(), tl[i]) + 1LL * x * l[i]);
        }
        dp[i] = max(dp[i], glob.Query(0, ds.size(), tl[i]));
        dp[i] += 1LL * x * (r[i] - l[i]);
        if (tl[i] + 1 < tr[i]) {
            st[c[i]][0].Modify(0, ds.size(), tl[i] + 1, tr[i], dp[i] - 1LL * x * r[i]);
            st[c[i]][1].Modify(0, ds.size(), tl[i] + 1, tr[i], dp[i] - 1LL * (x + x + y) * r[i]);
        }
        glob.Modify(0, ds.size(), tr[i], ds.size(), dp[i]);
        ans = max(ans, dp[i]);
    }
    printf("%lld\n", ans);
    return 0;
}



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

typedef long long ll;
#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	int a[n];
	for (int i = 1; i <= n; ++i) {
		int ai; cin >> ai;
		a[ai - 1] = i;
	}
	for (int i = 0; i < n; ++i) {
		cout << a[i] << " ";
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string s,t;
    cin >> s >> t;
    ll i=0, flag=1;
    while(s[i]) {
    	if(s[i]!=t[i]) {
    		flag = 0;
    		break;
    	}
    	i++;
    }
    if(flag) cout << "Yes";
    else cout << "No";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        in.nextLine();

        char[][] chs = new char[N][N];
        for (int i = 0; i < N; i++) {
            String line = in.nextLine();
            chs[i] = line.substring(0, N).toCharArray();
        }
        
        Main m = new Main();
        int ret = m.solve(chs);
        System.out.println(ret);
    }
    
    int solve(char[][] chs) {
        int N = chs.length;
        int total = 0;
        for (int i = 0; i < N; i++) {
            if (isValid(chs, i)) total += N;
        }
        return total;
    }

    boolean isValid(char[][] chs, int i) {
        int N = chs.length;
        for (int r = 0; r < N; r++) {
            int c = (i + r) % N;
            for (int p = 0; p < N; p++) {
                if (chs[r][(i+p)%N] != chs[p][c]) return false;
            }
        }
        return true;
    }
}


Measured memory_bytes: 26708
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    vector<bool> ac(n);
    map<int,int> wa;
    for(int i = 0; i < m; ++i)
    {
        int id;
        string res;
        cin >> id >> res;
        --id;
        if(res == "AC")
        {
            ac[id] = true;
        }
        else
        {
            if(ac[id])
            {
                continue;
            }
            if(wa.find(id) == wa.end())
            {
                wa[id] = 1;
            }
            else
            {
                wa[id] += 1;
            }
        }
    }
    int acCnt = 0;
    int penaCnt = 0;
    for(bool res : ac)
    {
        if(res)
        {
            ++acCnt;
        }
    }
    for(pair<int,int> res: wa)
    {
        if(!ac[res.first])
        {
            continue;
        }
        penaCnt += res.second;
    }
    cout << acCnt << " " << penaCnt << endl;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) { os << p.first << " " << p.second; return os; }

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; }return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	string S; cin >> S;
	int ans = INF;
	int l = 0, r = count(all(S), '.');
	rep(i, 0, N) {
		chmin(ans, l + r);
		if (S[i] == '.') {
			r--;
		}
		else {
			l++;
		}
	}
	chmin(ans, l + r);
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <algorithm>

using namespace std;

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

    int n, k;
    cin >> n >> k;

    int cnt[n];
    fill(cnt, cnt+n, 0);
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int a;
            cin >> a;
            cnt[--a]++;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += cnt[i] == 0;
    }

    cout << ans << endl;

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int c[3][3];
    rep(i, 3) rep(j, 3) cin >> c[i][j];
    rep(i, 101)
    {
        rep(j, 101)
        {
            rep(k, 101)
            {
                int b1 = c[0][0] - i;
                int b2 = c[0][1] - i;
                int b3 = c[0][2] - i;
                if (b1 == c[1][0] - j && b1 == c[2][0] - k && b2 == c[1][1] - j && b2 == c[2][1] - k && b3 == c[1][2] - j && b3 == c[2][2] - k)
                    if (0 <= b1 && b1 <= 100 && 0 <= b2 && b2 <= 100 && 0 <= b3 && b3 <= 100)
                    {
                        OP("Yes");
                        return 0;
                    }
            }
        }
    }

    OP("No");
    return 0;
}

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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using ld = long double;

constexpr ll MOD = 1000000007LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

int main()
{
    int N;
    cin >> N;
    multiset<int> a;
    int maxi = 0;
    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        maxi = max(maxi, x);
        a.insert(x);
    }
    int mini = maxi + 1;
    for (int i = 0; i <= maxi; i++) {
        const int val = max(maxi - i, i);
        mini = min(mini, val);
        if (a.find(val) == a.end()) {
            cout << "Impossible" << endl;
            return 0;
        }
        auto it = a.find(val);
        a.erase(it);
    }
    for (const int e : a) {
        if (e <= mini or e > maxi) {
            cout << "Impossible" << endl;
            return 0;
        }
    }
    cout << "Possible" << endl;

    return 0;
}


Measured memory_bytes: 256
s=input()
ans = []
for i in range(len(s)):
    ans.append(s[i])
j=1
while True:
    if ans[0]=="B":
        ans.pop(0)
    elif j>=len(ans):
        break
    elif ans[j]=="B":
        ans.pop(j-1)
        ans.pop(j-1)
        j-=1
    else:
        j+=1
print(*ans,sep="")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int N;
int a[100001];
int main(){
  cin >> N;
  for(int i=0;i<N;i++)cin >> a[i];
  for(int i=0;i<N;i++)a[i]%=4;
  int zero_count=0,two_count=0;
  for(int i=0;i<N;i++){
    if(a[i]==0)zero_count++;
    else if(a[i]==2)two_count++;
  }
  two_count/=2;
  if(zero_count+two_count>=N/2)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
N,X,Y = (int(x) for x in input().split())
A = [0]*(N)

for i in range(1,N):
    for j in range(i+1,N+1):
        if j <= X or i >= Y:
            A[j-i] += 1
        else:
            A[min((j-i),(abs(i-X)+abs(j-Y)+1))] += 1

for i in range(1,N):
    print(A[i])


Measured memory_bytes: 74656
import math

PI = math.pi
EPS = 10**-10

def edge(a, b):
    return ((a[0]-b[0])**2+(a[1]-b[1])**2)**.5

def area(a, b, c):
    s = (a+b+c)/2
    return (s*(s-a)*(s-b)*(s-c))**.5

def LawOfCosines(a, b, c): #余弦定理
    return math.acos( (b*b+c*c-a*a) / (2.0*b*c) );

def is_same(x, y): 
    return abs(x-y) < EPS

class Triangle:
    def __init__(self, p):
        a, b, c = p
        self.a = a
        self.b = b
        self.c = c

        self.edgeA = edge(b, c)
        self.edgeB = edge(c, a)
        self.edgeC = edge(a, b)

        self.area = area(self.edgeA, self.edgeB, self.edgeC)

        self.angleA = LawOfCosines(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = LawOfCosines(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = LawOfCosines(self.edgeC, self.edgeA, self.edgeB)

    def circumscribeadCircleRadius(self): #外接円の半径を返す
        return self.edgeA / math.sin(self.angleA) / 2.0

    def circumscribedCircleCenter(self): #外接円の中心の座標を返す
        a = math.sin(2.0*self.angleA);
        b = math.sin(2.0*self.angleB);
        c = math.sin(2.0*self.angleC);
        X = (self.a[0] * a + self.b[0] * b + self.c[0] * c) / (a+b+c);
        Y = (self.a[1] * a + self.b[1] * b + self.c[1] * c) / (a+b+c);
        return X, Y

    def inscribedCircleRadius(self): #内接円の半径
        return 2 * self.area / (self.edgeA + self.edgeB + self.edgeC)

    def inscribedCircleCenter(self): #内接円の中心の座標
        points = [self.a, self.b, self.c]
        edges = [self.edgeA, self.edgeB, self.edgeC]
        s = sum(edges)
        return [sum([points[j][i]*edges[j] for j in range(3)])/s for i in range(2)]

    def isInner(self, p): #点が三角形の内側か判定
        cross = lambda a, b: a[0]*b[1]-a[1]*b[0]

        c1 = 0
        c2 = 0
        points = [self.a, self.b, self.c]
        for i in range(3):
            a = [points[i][0]-points[(i+1)%3][0], points[i][1]-points[(i+1)%3][1]]
            b = [points[i][0]-p[0],  points[i][1]-p[1]]
            c = cross(a, b)
            if c > 0:
                c1 += 1
            elif c < 0:
                c2 += 1
        if c1 == 3 or c2 == 3:
            return True
        else:
            return c1+c2 != 3 and (c1 == 0 or c2 == 0)

if __name__ == "__main__":
    while True:
        try:
            c = list(map(float, input().split()))
            points = [(c[i], c[i+1]) for i in range(0, 6, 2)]
            point = [c[6], c[7]] 
            t = Triangle(points)
            print(["NO","YES"][t.isInner(point)])
        except:
            break



Measured memory_bytes: 5812
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
void solve() {
    int N,K;
    R(N,K);
    VI A(N);
    REP(i,N)R(A[i]);
    int ll=1,rr=1e9;
    while(ll<rr){
        int mm=(ll+rr)/2;
        LL need=0;
        REP(i,N){
            need+=(A[i]-1)/mm;
        }
        if(need>K)ll=mm+1;
        else rr=mm;
    }
    W(ll);
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET{
        solve();
    }
#else
    solve();
#endif
    return 0;
}


Measured memory_bytes: 4064
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll power(ll n, ll k){
  ll res = 1;
	while(k > 0){
		if (k & 1) 
      res = res * n % MOD;
		n = n * n % MOD;
		k >>= 1;
	}
	return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}



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

  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;

  return 0;
}


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

#define printl(s) cout << s << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;

const ll modSeed = pow(10,9) + 7;
const int INF = 1'000'000'000;

template <typename T>
vector<T> getVector(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

ll calculateDivNums(ll tg){
	ll ans = 0;
  for(ll a=1;a*a<=tg;a++){
      if(tg%a!=0){
        continue;
    }
      ans++;
      if(tg!=a*a){
        ans++;
      }
    }
  return ans;
 }   

string S;
ll N,ans;

int main(){
  ans = 0;
  cin >> N;
  for(ll a=1;a*a<=N;a++){
    if(N%a!=0) continue;
    ll b = N /a;
    ll dig = max(log10(a)+1,log10(b)+1);
    if(ans==0){
      ans = dig;
    } else{
      ans = min(dig,ans);
    }
  }
  printl(ans);
}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

ll N, K;

int main(void){
    
    scanf("%lld %lld", &N, &K);
    
    if(K == 0){ printf("%lld", N * N); return 0; }
    
    ll ans = 0;
    for(ll b = K + 1; b <= N; ++b){
        
        ll n = (N + 1) / b;
        ans += n * (b - K);
        
        ll L = K + b * n;
        ll R = N;
        if (L <= R) ans += R - L + 1;
        
    }
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 256
//Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>	
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <climits>
using namespace std;
#define FOR(index, start, end) for(int index = start; index < end; index++)
#define RFOR(index, start, end) for(int index = start; index > end; index--)
#define FOREACH(itr, b) for(auto itr = b.begin(); itr != b.end(); itr++)
#define RFOREACH(itr, b) for(auto itr = b.rbegin(); itr != b.rend(); itr++)
#define INF 1000000000
#define M 1000000007
typedef long long ll;
typedef pair<int, int> pii;
vector<int> edges[100000];
int n, m, q;
int v[100000], d[100000], c[100000];
int ans[100000];
int maxDis[100000];
void dfs(int node, int dis, int color)
{
	if (dis < 0)
	{
		return;
	}
	if (maxDis[node] >= dis)
	{
		return;
	}
	maxDis[node] = dis;
	if (ans[node] == -1)
	{
		ans[node] = color;
	}
	for (int j : edges[node])
	{
		dfs(j, dis - 1, color);
	}
	
}
int main(void)
{
	scanf("%d%d", &n, &m);
	FOR(i, 0, m)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		a--;
		b--;
		edges[a].push_back(b);
		edges[b].push_back(a);
	}
	scanf("%d", &q);
	FOR(i, 0, q)
	{
		scanf("%d%d%d", &v[i], &d[i], &c[i]);
		v[i]--;
	}
	FOR(i, 0, n)
	{
		ans[i] = -1;
		maxDis[i] = -1;
	}
	RFOR(i, q - 1, -1)
	{
		dfs(v[i], d[i], c[i]);
	}
	FOR(i, 0, n)
	{
		if (ans[i] != -1)
		{
			printf("%d\n", ans[i]);
		}
		else
		{
			printf("%d\n", 0);
		}
	}
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

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


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

    int n;
    cin >> n;

    map<int, int> mp;
    rep(i, n){
        int a;
        cin >> a;

        mp[i+1] = a;
    }

    int i = 1;
    int ans = 0;
    while(i != 2){
        i = mp[i];
        ans++;
        if(ans > n) break;
    }

    if(ans > n){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int gcd(int a, int b){return b ? gcd(b, a % b): a;}
void yes(){cout<<"Yes"<<endl;return;}
void no(){cout<<"No"<<endl;return;}

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    REP(i, 0, s.size()){
        if(s[i] == '1') ans++;
        else ans--;
    }
    cout << s.size()-abs(ans) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

int main(void) {
	int n;
	std::cin >> n;
	std::vector<double> vec(n);
	for (int i = 0; i < n; i++) {
		std::cin >> vec[i];
	}
	std::sort(vec.begin(), vec.end());
	double val = (vec[0] + vec[1]) / 2;
	for (int i = 2; i < n; i++) {
		val = (vec[i] + val) / 2;
	}
	std::cout << val << std::endl;
	return 0;
}

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

using namespace std;
#define PI              3.1415926536

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod 1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define REP(i,n) for(i=0;i<n;i++)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

bool f(int x, int y)
{
	return x > y;
}
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void solve()
{


}
int32_t main()
{
	//c_p_c();
	FIO;

	string s;
	cin >> s;

	int l = s.length();
	if (s[l - 1] != 's')
	{
		s += "s";
	}
	else
	{
		s += "es";
	}
	cout << s;







}

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  bool q=false;
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
    if(a.at(i) == 1) q = true;
  }
  
  if(q == false){
    cout << -1 << endl;
  }
  else {
    ll cnt=0;
    ll x=0;
    
    for(ll i=1;i<n;i++){
      for(ll j=0;j<n;j++){
        if(j == 0) j = x;
        if(j == n-1) x = -1;
        
        if(a.at(j) != i) cnt++;
        else if(a.at(j) == i && j <n-1){
          x = j+1;
          break;
        }        
      }
      if(x == -1) break;
    }
  
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<queue>
#include<assert.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 1 << 18;
const int MM = 1000000007;

int val[MX];
int bit[30]={0,1};
int ans,st=1;
bool check[MX];
std::vector<int> way[MX];

void input()
{
	int n,a,b;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		way[a].push_back(b);
		way[b].push_back(a);
	}
	for(st=1;st<=n;st++)if(way[st].size()==1)break;
	for(int i=2;i<30;i++)bit[i]=bit[i-1]*2;
}

void fill(int x)
{
	int j;
	check[x]=true;
	for(int i=0;i<way[x].size();i++){
		if(check[way[x][i]])continue;
		fill(way[x][i]);
		for(j=25;j>=1;j--){
			if((val[x]&val[way[x][i]]&bit[j]) != 0){
				val[x]|=bit[j]-1;
				break;
			}
		}
		val[x]|=val[way[x][i]];
	}
	val[x]++;
	int tmp=29;
	while((bit[tmp]&val[x]) == 0)tmp--;
	ans=std::max(ans,tmp);
}

int main()
{
	//	freopen("input.txt","r",stdin);
	input();
	fill(st);
	printf("%d",ans-1);
	return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;
const int mod = 1e9 + 7;

ll N, T;

// [i][j]
// i 番目までの料理で時間j以下のBの総和の最大値
ll dp[3010][3010];

int main() {
    cin >> N >> T;
    vector<P> p(N);
    rep(i, N) {
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(), p.end());

    ll ans = 0;
    rep(i, N) {
        rep(j, T) {
            // i番目を食べない場合
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);

            // i番目を食べる
            ll nj = j + p[i].first;
            if (nj < T) dp[i + 1][nj] = max(dp[i + 1][nj], dp[i][j] + p[i].second);
        }

        // 最後の1つ
        ll now = dp[i][T - 1] + p[i].second;
        ans = max(ans, now);
    }

    cout << ans << endl;
}

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

if M<=N:
  print(0)
  exit()

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

X.sort()

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

sa.sort()
print(sum(sa[:M-N]))

Measured memory_bytes: 13968
S = input()

cur_l, max_l = 0, 0

for s in S:
  if s == 'R':
    cur_l += 1
  else: # s == 'R'
    if cur_l > max_l:
      max_l = cur_l
    cur_l = 0

if cur_l > max_l:
  max_l = cur_l

print(max_l) 



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

int main() {
  int x, y;
  cin >> x >> y;
  int gx, gy;
  if(x == 2)
    gx = 1;
  else if(x == 4 || x == 6 || x == 9 || x == 11)
    gx = 2;
  else 
    gx = 3;
  
  if(y == 2)
    gy = 1;
  else if(y == 4 || y == 6 || y == 9 || y == 11)
    gy = 2;
  else 
    gy = 3;
  
  if(gx == gy)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
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

vector<int> v[100010];
typedef pair<int, int> P;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, N) {
        int A, B;
        cin >> A >> B;
        if (M - A >= 0)
            v[M - A].push_back(B);
    }
    rep(i, 100001) sort(v[i].begin(), v[i].end(), greater<int>());
    priority_queue<int> pq;
    int ans = 0;
    RREP(i, M - 1, 0) {
        rep(j, min(i + 1, (int)v[i].size())) {
            //cout << v[i][j] << " ";
            pq.push(v[i][j]);
        }
        //cout << endl;
        if (pq.size()) {
            ans += pq.top();
            //cout << ans << endl;
            pq.pop();
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5632
def sosu(p):
	if p==2:
		return True
	l=int(p**0.5)+1
	for i in range(2,l+1):
		if p%i==0:
			return False
	return True
x=int(input())
x+=1 if x!=2 and x%2==0 else 0
while sosu(x)==False:
	x+=2
print(x)

Measured memory_bytes: 63248
#include<bits/stdc++.h>
#include<math.h>
#define ll long long int
using namespace std;
int main()
{
    ll a,c=0,i,d=100;
    cin>>a;
  for(i=1;;)
  {
      d=d+d/100;
      c++;
      if(d>=a)
      {
          break;
      }
  }
  cout<<c;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int ret = 0;
  int N, count, val, min_val;
  cin >> N;
  min_val = 40;
  for (int i = 0; i < N; i++){
    cin >> val;
    count = 0;
    while (true){
      if (val % 2 == 0){
        val /= 2;
        count++;
      }
      else{
        break;
      }
    }
    if (min_val > count){
      min_val = count;
    }
  }
  cout << min_val << endl;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val input = new Scanner(System.in)
    val numCharList: List[Char] = input.nextInt.toString.toList

    if (numCharList(0) == numCharList(1) && numCharList(1) == numCharList(2)) {
      println("Yes")
    } else if (numCharList(1) == numCharList(2) && numCharList(2) == numCharList(3)) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 27308
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1ll<<32;
const ll maxn=1e3+10;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<int> uid(l, r); return uid(rng); }



void solve(){
	
	ll n,m;
	cin>>n>>m;
	vector<ll> a(n);
	ll tot=0;
	for (int i=0;i<n;i++){
		cin>>a[i];
		tot+=a[i];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ll c=0;
	for (int i=0;i<n;i++){
		if (4*m*a[i]>=tot){
			c++;
		}
	}
	if (c>=m){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	
	return;
}

int main(){ 
    
    #ifndef ONLINE_JUDGE
  	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);


	//T{ solve(); }
	solve();
		
	
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int dis[2004];
int main(){
	int n,x,y;
	int tmp;
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;i++){
		//左外面和右外面 左外面和左外面(包括节点） 左外面和内部 
		if(i<x){
			for(int j=n;j>y;j--){
				dis[j-i-(y-x)+1]++;
			}
			for(int j=x;j>i;j--){
				dis[j-i]++;
			}
			for(int j=x+1;j<=y;j++){
				tmp=0;
				tmp=min(j-i,y-j+1+x-i);
				dis[tmp]++;
			} 
		}
		//右外面和右外面(不包括节点）  右外面和内部 
		else if(i>y){
			for(int j=y;j<i;j++){
				dis[i-j]++;
			}
			for(int j=x;j<y;j++){
				tmp=0;
				tmp=min(i-j,j-x+1+i-y);
				dis[tmp]++;
			}
		}
		// 节点和内部相互之间 
		else if(i>=x&&i<y){
			for(int j=i+1;j<=y;j++){
				tmp=0;
				tmp=min(j-i,y-j+1+i-x);
				dis[tmp]++;
			}
		}
	}
	for(int i=1;i<=n-1;i++)printf("%d\n",dis[i]);
}

Measured memory_bytes: 256
### main

loop do
  n, w = gets.split.map(&:to_i)
  break if (n | w) == 0

  vs = n.times.map{gets.to_i}
  vmax = vs.max
  #p vs

  hn = vmax / w
  hist = (hn + 1).times.map{0}
  vs.each {|v| hist[v / w] += 1}
  hmax = hist.max
  #p hmax

  ink = 0.01
  
  for i in (0..hn)
    ink += 1.0 * (hn - i) / hn * hist[i] / hmax
  end

  puts ink
end

Measured memory_bytes: 6144
x, n = map(int,input().split())
p = list(map(int,input().split()))
l=[]
judge=[]
for i in range(120):
    l.append(i)
    l.append(-1*i)
for i in range(n):
    l.remove(p[i])
for i in range(len(l)):
    judge.append((l[i]-x)**2)
judge.sort()
if x - judge[0]**0.5 in l :
    print(int(x - judge[0]**0.5))
else:
    print(int(x + judge[0]**0.5))


Measured memory_bytes: 9460
open Printf
open Scanf

module Pqueue = struct

  type 'a t = {mutable cnt : int; hp : 'a array; cmp : 'a -> 'a -> int}

  let create n v f = {cnt = 0; hp = Array.make n v; cmp = f}

  let push k pq =
    let swap i j =
      let t = pq.hp.(i) in
      pq.hp.(i) <- pq.hp.(j);
      pq.hp.(j) <- t in
    let rec iter i =
      let p = i / 2 in
      if p = 0 || pq.cmp pq.hp.(p) pq.hp.(i) >= 0 then ()
      else (swap p i; iter p)
    in
    pq.cnt <- pq.cnt + 1;
    pq.hp.(pq.cnt) <- k;
    iter (pq.cnt)

  let max_heapify pq n =
    let swap i j =
      let t = pq.hp.(i) in
      pq.hp.(i) <- pq.hp.(j);
      pq.hp.(j) <- t in
    let rec iter i =
      let l = 2 * i in
      let r = 2 * i + 1 in
      let mi =
        let ti = if l <= pq.cnt && pq.cmp pq.hp.(l) pq.hp.(i) > 0 then l else i in
        if r <= pq.cnt && pq.cmp pq.hp.(r) pq.hp.(ti) > 0 then r else ti in
      if mi <> i then
        begin
          swap mi i;
          iter mi
        end
    in
    iter n

  let pop pq =
    let ret = pq.hp.(1) in
    pq.hp.(1) <- pq.hp.(pq.cnt);
    pq.cnt <- pq.cnt - 1;
    max_heapify pq 1;
    ret

  let top pq = pq.hp.(1)

  let is_empty pq = pq.cnt = 0

  let length pq = pq.cnt

end

let id x = x

type state = {mv : int; h : int; sp : int; bd : int array}
               
let () =
  let n = 4 in
  let isp = ref 0 in
  let bd = Array.init (n * n) (fun i -> let v = scanf "%d " id in if v = 0 then isp := i; v) in
  let dist bd = Array.fold_left (fun (i, d) x ->
                                 if x = 0 then (i+1, d)
                                 else
                                   let r, c = (i / n, i mod n) in
                                   let y = x - 1 in
                                   let r', c' = (y / n, y mod n) in
                                   (i + 1, d + abs (r - r') + abs (c - c'))
                                ) (0, 0) bd |> snd in
  let pq = Pqueue.create 2000000 {mv = 0; h = 0; sp = 0; bd = [||]} (fun x y -> y.mv + y.h - x.mv - x.h) in
  let ht = Hashtbl.create 100 in
  let rec loop () =
    if Pqueue.is_empty pq then failwith "15 puzzle"
    else
      let st = Pqueue.pop pq in
      if st.h = 0 then st.mv
      else begin
          List.iter (fun (dx, dy) ->
                     let x, y = (st.sp / n, st.sp mod n) in
                     let nx, ny = (dx + x, dy + y) in
                     if 0 <= nx && nx < n && 0 <= ny && ny < n then
                       let nsp = n * nx + ny in
                       let nbd = Array.copy st.bd in
                       begin
                         nbd.(st.sp) <- st.bd.(nsp);
                         nbd.(nsp) <- 0;
                         if Hashtbl.mem ht nbd then ()
                         else
                           let nst = {mv = st.mv + 1; h = dist nbd; sp = nsp; bd = nbd} in
                           Pqueue.push nst pq;
                           Hashtbl.replace ht nbd true
                       end
                    ) [(1,0);(0,1);(-1,0);(0,-1)];
          loop ()
        end                  
  in
  Pqueue.push {mv = 0; h = dist bd; sp = !isp; bd = bd} pq;
  Hashtbl.add ht bd true;
  loop () |> printf "%d\n"

Measured memory_bytes: 305036
n, d = map(int, input().split())
xy = []
for i in range(n):
  xy.append(list(map(int,input().split())))

c = 0

for i in range(n):
  if xy[i][0] * xy[i][0] + xy[i][1] * xy[i][1] <= d * d:
    c += 1

print(c)


Measured memory_bytes: 45436
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
vector <char> v;
vector<int> num;
string s ;
int table[100001][3];
int main(){
  int a,b,c,d;
  s = "No";
  cin >> a>>b>>c>>d;

  if(((abs(a-b)<=d)&&(abs(b-c)<=d))||(abs(a-c)<=d)){
    s = "Yes";
  }
  cout << s<<endl;
  return 0;
}


Measured memory_bytes: 256
// B - Harshad Number

#include <bits/stdc++.h>
using namespace std;

int N, K;
int solve();

int main() {
  // ここにプログラムを追記
  cin >> N >> K;
  solve();
}


int solve(){
  int num = 1;
  for(int i = 0; i<N; i++){
    if(num *2 > num +K){
      num +=K;
    }else{
    num *=2;
    }
  }

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


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int a[n], ans = 0;
  for(int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  for(int i = 0; i < n; i++) {
    int up = upper_bound(a, a + n, a[i] + 2) - a;
    ans = max(ans, up - i);
  }
  cout << ans;
}


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

int main() {
  long long int X;
  cin >> X;
  bool ans = false;
  for (int i = 0;i < 10000;i++) {
    for (int j = -1000;j < 1000;j++) {
      if (i*i*i*i*i - j*j*j*j*j == X) {
        cout << i << " " << j << endl;
        ans = true;
      }
    }
    if (ans) break;
  }
}

Measured memory_bytes: 3640