akhauriyash/Code-Regression huggingface dataset:
/* by Natsu Kinmoe */
#include <bits/stdc++.h>
using namespace std;
#define SZ(x)               ((int)(x).size())
#define all(x)              (x).begin(), (x).end()
#define loop(i, n)          for(int i = 0; i < (n); i++)
#define cont(i, n)          for(int i = 1; i <= (n); i++)
#define circ(i, a, b)       for(int i = (a); i <= (b); i++)
#define range(i, a, b, c)   for(int i = (a); ((c) > 0 ? i <= (b) : i >= (b)); i += (c))
#define foreach(it, v)      for(__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define y0          y0O0OO00OO0OO0OO0OOO00OO0OO0O0O000OO0
#define y1          y1II11II11III11I1III11II111IIII1II1I1
#define pub         push_back
#define pob         pop_back
#define mak         make_pair
typedef long long   ll;
typedef long double lf;
const int   Inf = 0x3f3f3f3f;
const ll    INF = 0x3f3f3f3f3f3f3f3fll;
/* Source code starts here */

int n, k;
const int maxn = 1 << 19;

struct Segtree {
	int dt[maxn << 1];
	void inline add(int a, int x) {
		for(a += maxn; a; a >>= 1) dt[a] = max(dt[a], x);
	}
	int inline qmax(int l, int r) {
		int res = 0;
		for(l += maxn, r += maxn + 1; l < r; l >>= 1, r >>= 1) {
			if(l & 1) res = max(res, dt[l++]);
			if(r & 1) res = max(res, dt[--r]);
		}
		return res;
	}
} seg;

int a[maxn];

int main() {
	scanf("%d%d", &n, &k);
	cont(i, n) scanf("%d", a + i);
	cont(i, n) {
		int mx = seg.qmax(max(0, a[i] - k), min(maxn - 1, a[i] + k)) + 1;
		seg.add(a[i], mx);
	}
	printf("%d\n", seg.qmax(0, maxn - 1));
	return 0;
}


Measured memory_bytes: 7360
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	int n, k, r, s, p;
	string t;
	cin >> n >> k >> r >> s >> p >> t ;

	int r_c = 0, s_c = 0, p_c = 0;
	for (int i = 0;i < t.length();i++) {
		if(k > i){
			if (t[i] == 'r')r_c++;
			else if (t[i] == 's')s_c++;
			else p_c++;
		}
		else {
			if (t[i] != t[i - k]) {
				if (t[i] == 'r')r_c++;
				else if (t[i] == 's')s_c++;
				else p_c++;
			}
			else {
				t[i] = 0;
			}
		}
	}

	long long ans = 0;
	ans += r_c * p;
	ans += s_c * r;
	ans += p_c * s;
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3736
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements <=num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//Sort(v);
//v.erase(unique(all(v)),v.end());
//It keeps unique elements in sorted order....
//#define int long long int
void solve(){
	ll x,y,a,b,c,v;
	cin>>x>>y>>a>>b>>c;
	vl v1(a),v2(b),v3(c);
	cin>>v1;
	cin>>v2;
	cin>>v3;
	vl r,g;
	RSort(v1);RSort(v2);RSort(v3);
	for(int i=0;i<x;i++) r.pb(v1[i]);
	for(int i=0;i<y;i++) g.pb(v2[i]);
	Sort(r);Sort(g);
	r.pb(inf);g.pb(inf);
	int i=0,j=0;
	for(int k=0;k<c;k++){
		ll mn=min(r[i],g[j]);
		if(mn>=v3[k]) break;
		if(mn==r[i]) r[i]=v3[k],i++;
		else g[j]=v3[k],j++;
	}
	ll ans=0;
	for(int i=0;i<x;i++) ans+=r[i];
	for(int i=0;i<y;i++) ans+=g[i];
	cout<<ans<<endl;
	
	
}
 
int32_t main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();
}
} 

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

int main(){
    int n;
    double sum=0;
    cin >> n;
    vector<double> x(n);
    vector<string> u(n);
    for(int i=0;i<n;i++){
        cin >> x[i] >> u[i];
        if(u[i]=="BTC") x[i]*=380000.0;
        sum+=x[i];
    }
    cout << sum <<  endl;
 }


Measured memory_bytes: 256
//region #include <cp_helper>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vll vector<ll>
#define vii vector<ii>
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define pin(n) in(n.first) >> n.second
#define vin(a, n) for (ll i=0; i<n; ++i) in(a[i])
#define viin(a, n) for (ll i=0; i<n; ++i) in2(a[i].first, a[i].second);
#define out(n) cout << n
#define outs(n) out(n) << ' '
#define outn(n) out(n) << '\n'
#define out2(n, m) cout << n << ' ' << m
#define out2s(n, m) out2(n, m) << ' '
#define out2n(n, m) out2(n, m) << '\n'
#define pout(n) out2(n.first, n.second)
#define pouts(n) pout(n) << ' '
#define poutn(n) pout(n) << '\n'
#define vout(a) for (auto i : a) outs(i)
#define viout(a) for (auto i : a) out2n(i.first, i.second)
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pp(a, b) emplace_back(make_pair(a, b))
#define fori(i, n) for (ll i=0; i<n; ++i)
#define foris(i, a, b) for (ll i=a; i<b; ++i)
#define ford(i, n) for (ll i=n-1; i>=0; --i)
#define fords(i, a, b) for (ll i=a; i>=b; --i)
#define forr(i, a) for (auto &i : a)
#define umap unordered_map
#define fileio(in, out) freopen("in", "r", stdin); freopen("out", "w", stdout)
const int mod = (int)(1e9) + 7;
//endregion

int main() {
    io();
    int n, k, c=0, a;
    in2(n, k);
    fori (i, n) {
        in(a);
        if (a>=k) c++;
    }
    out(c);
}


Measured memory_bytes: 256
fn main() {
    // N M C
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();

    let ans = if b%a == 0 {
        a+b
    }
    else {
        b-a
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
readline = sys.stdin.readline

mod = 10**9+7
def frac(limit):
    frac = [1]*limit
    for i in range(2,limit):
        frac[i] = i * frac[i-1]%mod
    fraci = [None]*limit
    fraci[-1] = pow(frac[-1], mod -2, mod)
    for i in range(-2, -limit-1, -1):
        fraci[i] = fraci[i+1] * (limit + i + 1) % mod
    return frac, fraci
frac, fraci = frac(1341398)
def comb(a, b):
    if not a >= b >= 0:
        return 0
    return frac[a]*fraci[b]*fraci[a-b]%mod

X, Y = map(int, readline().split())
mod = 10**9+7

ans = 0

ta = 2*Y - X
if ta%3 == 0:
    a = ta//3
    db = X - a
    if db % 2 == 0:
        b = db//2
        if 0 <= a and 0 <= b:
            ans = comb(a+b, a)

print(ans)

Measured memory_bytes: 74204
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pque priority_queue
#define endl '\n'
typedef vector <int> 	vi;
typedef pair <int, int> ii;
typedef vector <vi > 	vvi;
typedef vector <ii > 	vii;

const int N = 1e5 + 5, mod = 1e9 + 7, inf = 1e18 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, t, x, y, ans = 2000;
    cin >> n >> t;
    for (int i = 0; i < n; i++){
        cin >> x >> y;
        if (y <= t){
            ans = min(ans, x);
        }
    }
    if (ans == 2000) cout << "TLE";
    else cout << ans;
}

/*
INPUT:


OUTPUT:


*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    string sa,sb,sc;
    cin >> sa >> sb >> sc;
    int a=sa.size();
    int b=sb.size();
    int c=sc.size();
    int i,j,k;
    i=0; j=0; k=0;
    char x='a';
    while(true){
        cerr << x << " " << i << " " << j << " " << k << endl;
        if(x=='a'){
            if(i==a){
                cout << "A" << endl;
                break;
            }
            x = sa[i];
            i++;
        }else if(x=='b'){
            if(j==b){
                cout << "B" << endl;
                break;
            }
            x = sb[j];
            j++;
        }else{
            if(k==c){
                cout << "C" << endl;
                break;
            }
            x = sc[k];
            k++;
        }
        
        
    }
    return 0;
}


Measured memory_bytes: 3628
def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    buf = input()
    buflist = buf.split()
    T = int(buflist[0])
    A = int(buflist[1])
    buf = input()
    buflist = buf.split()
    H = list(map(int, buflist))

    mindiff = float("inf")
    point = None
    for i in range(N):
        temp = T - (H[i] * 0.006)
        diff = abs(A - temp)
        if diff < mindiff:
            mindiff = diff
            point = i
    print(point+1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main() {
 int N;
 cin>>N;
 vector<int>T(N);
 int cnt=0;
 rep(i,N){
     cin>>T[i];
     cnt+=T[i];
 }
 int M;
 cin>>M;
 vector<int>P(M);
 vector<int>X(M);
 rep(i,M){
     cin>>P[i];
     cin>>X[i];
     cout<<cnt-T[P[i]-1]+X[i]<<endl;
 }
}




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


int main(){
    int n, search;
    while (cin >> n && n){
	int inp[101];
	for (int i = 0; i < n; i++) cin >> inp[i];
	cin >> search;
	
	int ans = 0;
	int e = n - 1, s = 0;
	int p = (e - s) / 2;

	while (s <= e){
	    ans++;
	    if (inp[p] == search) break;
	    if (inp[p] > search) e = p - 1;
	    else s = p + 1;

	    p = (s + e) / 2;
	}

	cout << ans << endl;
    }
}

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

int GetDigitsCount(long long targetNumber, long long baseNumber) {
	int digitsCount = 0;
	while (targetNumber != 0) {
		digitsCount++;
		targetNumber /= baseNumber;
	}
	return digitsCount;
}

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

	cout << GetDigitsCount(n, k) << endl;

	return 0;
}

Measured memory_bytes: 256
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var m = int.Parse(line[1]);
            if (n == 0 && m == 0) break;
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            var yasai = Array.ConvertAll(line2, int.Parse);
            var yasai2 = yasai.OrderByDescending(x => x).ToArray();
            var free = n / m;
            var sumyasai = yasai2.Sum();
            for (int i =1 ; i <= free ; i++ )
                sumyasai -= yasai2[i * m - 1];
            Console.WriteLine(sumyasai);
        }
    }
}

Measured memory_bytes: 10352
#include <stdio.h>
#include <stdint.h>

int getNumsInt32(int32_t *buf, int32_t num)
{
  int32_t i;

  for (i = 0; i < num; i++) {
    if (scanf("%d", &buf[i]) == EOF) {
      return -1;
    }
  }
  return 0;
}

int main()
{
  int32_t N, i, val = 0, cost = 0;
  int32_t V[20];
  int32_t C[20];

  if (getNumsInt32((int32_t *)&N, (int32_t)1) == -1) {
    return -1;
  }

  if (getNumsInt32((int32_t *)V, (int32_t)N) == -1) {
    return -1;
  }

  if (getNumsInt32((int32_t *)C, (int32_t)N) == -1) {
    return -1;
  }
  
  for (i = 0; i < N; i++) {
    if (V[i] > C[i]) {
      val += V[i];
      cost += C[i];
    }
  }

  printf("%d\n", val - cost);

  return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int a,b; 
  cin >> a >> b;
  string s = "";
  
  if(a <= b){
    REP(i,b) s.push_back(a + '0');
  }
  else{
   REP(i,a) s.push_back( b + '0');  
  }
  
  cout << s << endl;
  
}

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

int main(){
  string S,T;
  cin >> S >> T;
  int N=S.size(),c=0;
  
  for(int i=0;i<N;i++){
    if(S.at(i)!=T.at(i)){
      c++;
    }
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 3820
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n")
  tmp0 = input[0].split(" ")
  tmp1 = input[1].split(" ")
  H = tmp0[0]
  W = tmp0[1]
  h = tmp1[0]
  w = tmp1[1]
  var ans = 0;
  console.log((H-h) * (W-w))
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main("3 2\n2 1\n")

Measured memory_bytes: 22076
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}

int main(){
	int n,m;
	cin >> n >> m;
	vector<string> a(n),b(m);
	REP(i,n) cin >> a[i];
	REP(i,m) cin >> b[i];
	
	for(int i=0; i<n-m+1; i++){
		for(int j=0; j<n-m+1; j++){
			bool ok = true;
			for(int x=0; x<m; x++){
				for(int y=0; y<m; y++){
					if(a[i+x][j+y]!=b[x][y]){
						ok = false;
					}
				}
			}
			if(ok){
				cout << "Yes\n";
				return 0;
			}
		}
	}
	
	cout << "No\n";
	
	return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int K,S;
  cin>>K>>S;
  int cnt=0;
  for(int i=0 ; i<=K ; i++){
    for(int j=0 ; j<=S-i && j<=K; j++){
      if(S-i-j>=0 && S-i-j<=K) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define MAX 10000003
using namespace std;
int main()
{
    int n,l,s=0,p,mina;
    cin>>n>>l;
    int arr[n+5];
    arr[0]=0;
    for(int i=1;i<=n;i++)
    {
        arr[i]=l+i-1;
        s=s+arr[i];
    }
    mina=100000000;
    for(int i=1;i<=n;i++)
    {
        if(abs(arr[i])<mina)
            mina=abs(arr[i]);
    }
    if(s>=0)
        cout << s-mina << endl;
    else
        cout << s+mina << endl;;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define For(i,a,b) for(i=(a);i<(b);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const double PI=acos(-1.0);


int main(){
  int n,m; cin >> n >> m;
  cout << (1800*m+100*n)*pow(2,m) << endl;
}


Measured memory_bytes: 512
// inputに入力データ全体が入る
function Main(input) {
  input = input.split(' ').map(val => parseInt(val));
  
  var ans = 'Yes'
  for (var i of input) {
    if(input[0] !== i) {
      ans = 'No';
      break;
    }
  }

  console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>
int main(){
  int arr[3], i, j, tmp, idx=0;
  scanf("%d %d %d", &arr[0], &arr[1], &arr[2]);
	for (i=0; i<3; i++) {
		idx=i;
		for (j=i+1; j<3; j++) {
			if (arr[idx]>arr[j]) {
				idx=j;
			}
		}
		tmp=arr[i];
		arr[i]=arr[idx];
		arr[idx]=tmp;
	}
  printf("%d %d %d\n", arr[0], arr[1], arr[2]);
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> n >> x >> t;

	y=n/x;
	if(n%x)
		y++;
	cout<<t*y<<endl;
}

Measured memory_bytes: 3648
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        string t = sc.Next();
        int n = t.Length;

        // iまで見た 最後が 0 P 1 Dのときの最大
        int[,] dp = new int[n, 2];
        for (int i = 0; i < n; i++)
        {
            dp[i, 0] = int.MinValue;
            dp[i, 1] = int.MinValue;
        }
        if (t[0] == 'P' || t[0] == '?')
        {
            dp[0, 0] = 0;
        }
        if (t[0] == 'D' || t[0] == '?')
        {
            dp[0, 1] = 1;
        }

        for (int i = 1; i < n; i++)
        {
            if (t[i] == 'P' || t[i] == '?')
            {
                dp[i, 0] = Math.Max(dp[i - 1, 0], dp[i - 1, 1]);
            }
            if (t[i] == 'D' || t[i] == '?')
            {
                dp[i, 1] = Math.Max(dp[i - 1, 0] + 2, dp[i - 1, 1] + 1);
            }
        }

        var ans = new char[n];
        int last;
        if (dp[n - 1, 0] < dp[n - 1, 1])
        {
            ans[n - 1] = 'D';
            last = 1;
        }
        else
        {
            ans[n - 1] = 'P';
            last = 0;
        }
        for (int i = n - 2; i >= 0; i--)
        {
            // p
            if ((last == 0 && dp[i, 0] == dp[i + 1, 0]) || (last == 1 && dp[i, 0] + 2 == dp[i + 1, 1]))
            {
                ans[i] = 'P';
                last = 0;
            }
            else
            {
                ans[i] = 'D';
                last = 1;
            }
        }

        Console.WriteLine(new string(ans));
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main() {
	int n;
	cin >> n;
	vector<int> S(n);
	for (int& i : S) cin >> i;
	sort(S.begin(), S.end());
	int q;
	cin >> q;
	int C = 0;
	for (int i = 0; i < q; ++i) {
		int T;
		cin >> T;
		if (binary_search(S.begin(), S.end(), T)) ++C;
	}
	cout << C << endl;
}


Measured memory_bytes: 3176
S = input()
# print(S)

T = []
num_r = 0
num_l = 0
for i in range(len(S) - 1):
    s = S[i]
    if s == 'R':
        num_r += 1
    if s == 'L':
        num_l += 1
    if S[i] == 'L' and S[i + 1] == 'R':
        t = 'R'*num_r + 'L'*num_l
        T.append(t)
        num_r = 0
        num_l = 0
    if i == len(S) - 2:
        t = 'R'*num_r + 'L'*(num_l + 1)
        T.append(t)
# print(T)

def even_odd(num):
    num_even = num_odd = 0
    if num % 2 == 0:
        num_even = num_odd = num//2
    else:
        num_even = (num - 1)//2
        num_odd = num_even + 1
    return num_even, num_odd

def solve(ans, T):
    len_t = len(T)
    num_r = T.count('R')
    num_l = T.count('L')
    num_r_even, num_r_odd = even_odd(num_r)
    num_l_even, num_l_odd = even_odd(num_l)
    ans.extend([0]*(num_r - 1))
    ans.append(num_r_odd + num_l_even)
    ans.append(num_r_even + num_l_odd)
    ans.extend([0]*(num_l - 1))

ans = []
for t in T:
    solve(ans, t)
# print(ans)
print(' '.join(map(str, ans)))


Measured memory_bytes: 57052
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
const int INF = 1e9;
const int MAX = 100000;
const long long LINF = 1e18;


int gcd(int x,int y){
  if(y == 0) return x;
  return gcd(y,x % y);
}


int main(){
  int N;cin >> N;
  vector<int>A(N);
  for(int i = 0; i< N; i++){
    cin >>A[i];
  }
  sort(A.begin(),A.end(),greater<int>());
  int ans = A[0];
  for(int i = 0; i < N;i ++){
    ans = gcd(ans,A[i]);
  }
  cout << ans << endl;
}

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

LL A, B, C, D;
map<LL, LL> memo;
LL solve(LL N) {
    if (N == 0) return 0;
    if (N == 1) return D;
    if (memo.count(N)) return memo[N];
    LL l2 = (N/2)*2;
    LL r2 = ((N+1)/2)*2;
    LL l3 = (N/3)*3;
    LL r3 = ((N+2)/3)*3;
    LL l5 = (N/5)*5;
    LL r5 = ((N+4)/5)*5;

    LL res = 1e18;
    if (N < res/D) res = N*D;
    res = min(res, llabs(l2-N)*D + A + solve(l2/2));
    res = min(res, llabs(r2-N)*D + A + solve(r2/2));

    res = min(res, llabs(l3-N)*D + B + solve(l3/3));
    res = min(res, llabs(r3-N)*D + B + solve(r3/3));

    res = min(res, llabs(l5-N)*D + C + solve(l5/5));
    res = min(res, llabs(r5-N)*D + C + solve(r5/5));

    memo[N] = res;

    return res;
}

int main() {
    int T;
    cin >> T;
    for (int t = 0; t < T; t++) {
        memo.clear();
        LL N;
        cin >> N;
        cin >> A >> B >> C >> D;
        cout << solve(N) << "\n";
    }
}


Measured memory_bytes: 4388
S = input()
c = ["dream","dreamer","erase","eraser"]

S = S[::-1]
c = [cc[::-1] for cc in c]

i=0
while i < len(c):
    if S[:len(c[i])] == c[i]:
        S = S[len(c[i]):]
        i = 0
        continue
    i += 1

if S=="":
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		for(int n1 = 1; n1 < 10; n1++) {
			for(int n2 = 1; n2 < 10; n2++) {
				System.out.printf("%dx%d=%d\n", n1, n2, n1 * n2);
			}
		}
	}

}

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

///////////////////////////////////////////
const long long int INF = 1000000000000000000LL;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
///////////////////////////////////////////

int main(){
    int n,k;cin>>n>>k;
    if(n%k!=0){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}












Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        for (int i = 0; i <= N; i++)
        {
            if (i % 4 == 0 && (N - i) % 7 == 0)
            {
                WriteLine("Yes");
                return;
            }
        }
        WriteLine("No");
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

ll l, r;
ll DP[62][2][2][2];
ll getVal(ll, ll, ll, ll);

int main(){
    for(int i=0; i<62; i++) for(int j=0; j<8; j++){
        DP[i][!(j&4)][!(j&2)][j&1] = -1;
    }
    cin >> l >> r;
    cout << getVal(59, 0, 0, 0);
}

ll getVal(ll a, ll x, ll y, ll z){
    if(a==-1) return 1;
    if(DP[a][x][y][z]!=-1) return DP[a][x][y][z];
    ll ret = 0;
    if(x || !(l & (1LL<<a))){
        ret += getVal(a-1, x, (r&(1LL<<a))?1:y, z);
    }
    if((x || !(l & (1LL<<a))) && (y || (r&(1LL<<a))) && z){
        ret += getVal(a-1, x, y, z);
    }
    if(y || (r&(1LL<<a))){
        ret += getVal(a-1, (!(l&(1LL<<a)))?1:x, y, 1);
    }
    return DP[a][x][y][z] = ret%MOD;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int f(int b, int n)
{
  if(b < 2) return inf;
  if(n < b) return n;
  return f(b, n/b) + n%b;
}

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

  int n, s;
  cin >> n >> s;
  if(n == s) {
    cout << n+1 << endl;
    return 0;
  }

  for(int i = 2; i*i <= n; i++) {
    if(f(i, n) == s) {
      cout << i << endl;
      return 0;
    }
  }

  int ans = inf;
  for(int i = 1; i*i <= n; i++) {
    if(f((n-s)/i+1, n) == s) ans = min(ans, (n-s)/i+1);
  }

  cout << (ans == inf ? -1 : ans) << endl;

  return 0;
}


Measured memory_bytes: 256
// Problem : C - A+...+B Problem
// Contest : Virtual Judge - practice contest 2
// URL : https://vjudge.net/contest/390405#problem/C
// Memory Limit : 262 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	ll n,a,b;
	cin>>n>>a>>b;
	if(a>b || (n==1 && a!=b))
	cout<<0;
	else if(n==1 && a==b)
	cout<<1;
	else
		cout<<(b-a)*(n-2)+1;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b) //最大公約数
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

ll lcm(ll a, ll b) //最小公倍数
{
	return a * b / gcd(a, b);
}

ll box(double a) //doubleの切り捨て
{
	ll b = a;
	return b;
}

ll fff(double a) //doubleの四捨五入
{
	ll b = a + 0.5;
	return b;
}

ll sum(ll n) { //整数sまでの合計
	if (n == 0) {
		return 0;
	}

	int s = sum(n - 1);
	return s + n;
}

bool prime(ll num)//素数判定、primeならtrue,違うならfalse
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}

// ===============================================================

int main() {
	ll a, b; cin >> a >> b;
	if (a <= b) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#define rep(i, n)  for (int i = 0; i <  (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

class Doukutu{
    public:
        vector<ll> road;
        ll saki;
        ll step;
        bool finish;
        Doukutu(){
            saki = 0;
            step = INF;
            finish = false;
        }
};

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

    ll n,m;
    cin >> n >> m;

    vector<Doukutu> d(n);
    queue<ll> q;

    rep(i,m){
        ll ai,bi;
        cin >> ai >> bi;
        ai--;
        bi--;
        d[ai].road.push_back(bi);
        d[bi].road.push_back(ai);
    }

    q.push(0);
    d[0].step = 0;
    d[0].finish = true;
    
    while(q.size()!=0){
        for(ll i:d[q.front()].road){
            if(d[i].step < d[q.front()].step){
                // cout << q.front() << "の行き先が" << i << "に，ステップが" << d[i].step+1 << "になりました\n";
                d[q.front()].step = d[i].step + 1;
                d[q.front()].saki = i;
            }
            if(!d[i].finish){
                q.push(i);
                d[i].finish = true;
            }
        }
        q.pop();
    }

    bool flag = true;
    rep(i,n){
        if(!d[i].finish) flag = false;
    }

    if(flag){
        cout << "Yes\n";
        rep(i,n-1){
            cout << d[i+1].saki + 1 << "\n";
        }
    }
    else cout << "No\n";
}

Measured memory_bytes: 14492
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include <random>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int n;
  cin >> n;
  int p[n],pos[n];
  rep(i,n){
    cin >> p[i];
    p[i]--;
    pos[p[i]]=i;
  }
  ll ans=0;
  int cnt=p[0];
  rep(i,n){
    ll len=1;
    while(i+1<n && pos[i]<pos[i+1]){
      len++;
      i++;
    }
    ans=max(ans,len);
  }
  cout << n-ans << endl;
return 0;}

Measured memory_bytes: 1792
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int result = 0;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++){
		    int now = sc.nextInt();
		    if(min > now){
		        result++;
		        min = now;
		    }
		}
		
		// 計算
		//int result = 0;
		
		// 出力
		System.out.println(result);
	}
}




Measured memory_bytes: 65328
def kmp(s):
    n = len(s)
    kmp = [0] * (n+1)
    kmp[0] = -1
    j = -1
    for i in range(n):
        while j >= 0 and s[i] != s[j]:
            j = kmp[j]
        j += 1
        kmp[i+1] = j

    return kmp

from collections import deque
def topological_sort(graph: list, n_v: int) -> list:
    # graph[node] = [(cost, to)]
    indegree = [0] * n_v # 各頂点の入次数
    for i in range(n_v):
        for v in graph[i]:
            indegree[v] += 1

    cand = deque([i for i in range(n_v) if indegree[i] == 0])
    res = []
    while cand:
        v1 = cand.popleft()
        res.append(v1)
        for v2 in graph[v1]:
            indegree[v2] -= 1
            if indegree[v2] == 0:
                cand.append(v2)

    return res

import sys

def main():
    input = sys.stdin.readline
    s = input().rstrip()
    t = input().rstrip()

    n0 = len(s)
    m = len(t)

    s = s * (m // n0 + 2)

    res = kmp(t + '*' + s)
    res = res[m+2:]

    graph = [set() for _ in range(n0)]
    for i in range(len(res)):
        if res[i] >= m:
            graph[(i-m+1)%n0].add( (i + 1) % n0 )
    # print(graph)

    ts = topological_sort(graph, n0)
    if len(ts) != n0:
        ans = -1
    else:
        # print(ts)
        ans = 0
        path = [0] * n0
        for i in range(n0):
            ans = max(ans, path[ts[i]])
            for j in graph[ts[i]]:
                path[j] = path[ts[i]] + 1

    print(ans)

main()


Measured memory_bytes: 190112
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  ll A, B;
  cin >> A >> B;
  if((A + B) % 2 == 0)
    cout << (A + B) / 2 << endl;
  else
    cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a[5], temp;

    int i, j, k;
    scanf("%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4]);
    for(i = 0; i < 5; i++){

        for(j = 0; j < 4; j++){
            //printf("comparing %d and %d\n", a[j], a[j + 1]);
            if(a[j] < a[j + 1]){
                //printf("comparing %d and %d\n", a[j], a[j + 1]);
                temp = a[j];
                a[j] = a[j + 1];
                a[j + 1] = temp;
            }
        }
        for(k = 0; k < 5; k++){
         //printf("%d ", a[k]);
        }
         //putchar('\n');
    }
    //putchar('\n');
    printf("%d", a[0]);
    for(i = 1; i < 5; i++){
        printf(" %d", a[i]);
    }
    putchar('\n');
    return (0);
}



Measured memory_bytes: 2044
parseInt(x) = parse(Int,x)
parseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)
function main()
	n,k = map(parseInt, split(readline()))
  	p = 0
  for i = 1:n
    if i >=k
      p += 1/n
      continue
    end
    u = 1
    while i*(2^u) <k
      u +=1
    end
    p += 1/(n*(2^u)) 
  end
  println(Float64(p))
end
main()

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

int main() {
  string s;
  cin >> s;
  vector<bool> found(26, false);
  rep(i, s.size()) found[s[i] - 'a'] = true;
  int a = -1;
  rep(i, 26) if (found[i] == false) {
    a = i;
    break;
  }
  if (a == -1) cout << "None" << endl;
  else {
    char c = a + 'a';
    cout << c << endl;
  }
  return 0;
}

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

void solve()
{
	string str;
	getline(cin, str);
	for(int i = 0; i < str.size(); ++i)
	{
		if('a' <= str[i] && str[i] <= 'z')
		{
			str[i] += 'A' - 'a';
		}
	}
	cout << str << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1172
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=998244353;
const int N=1e5+10;
const int inf=1e9;
int n;
int a[310];
ll dp[100010];
int main(){
    //ios::sync_with_stdio(false);
    //freopen("in","r",stdin);
    scanf("%d",&n);
    int sum=0;
    ll x=1;
    rep(i,1,n){
        scanf("%d",&a[i]);
        sum+=a[i];
        x=x*3%mod;
    }
    int s=sum/2;
    dp[0]=1;
    rep(i,1,n){
        for(int j=s;j>=a[i];j--){
            dp[j]=(dp[j]+dp[j-a[i]]*2)%mod;
        }
    }
    ll ans=0;
    rep(i,0,s) ans=(ans+dp[i]);
    if(sum%2==0){
        memset(dp,0,sizeof(dp));
        dp[0]=1;
        rep(i,1,n){
            for(int j=s;j>=a[i];j--){
                dp[j]=(dp[j]+dp[j-a[i]])%mod;
            }
        }
        ans=(ans-dp[s])%mod;
    }
    ans=(x-ans*3%mod)%mod;
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4520
var int = x=>parseInt(x,10);var spln = x=>x.split(/\n/g);var spsp = x=>x.split(/\s/g);
function main(input) {
  if(input.includes('2')){
    console.log('No');
  }else{
   console.log('Yes') 
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21956
import java.util.Arrays;
import java.util.Scanner;

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


Measured memory_bytes: 23124
function Main(s) {
	s = s.split("\n");
	var n = parseInt(s[0]);
	var a = s[1].split(" ").map(a => parseInt(a));
	var b = 0;
	for(var i = 0; i < n; i++){
		b |= a[i];
	}
	
	var ans = 0;
	while((b & 1) === 0){
		ans++;
		b >>>= 1;
	}
	
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7500
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
   int n;
   cin >> n;
   cout << n * n * n << endl;
}

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

int main() {
    int n, p=0, q=0, r=0;
    cin >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        if(a%4==0)p++;
        else if(a%2==0)q++;
        else r++;
    }
    if(q>0)r++;
    if(r<=p+1){
        cout << "Yes" << endl;
    }else{
        cout << "No"  << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long N,b[200001],a,x,i;
int main(){
	cin>>N;
	for(i=1L;i<=N;++i){
		scanf("%d",&a);
		b[a]=i;
	}
	set<long>s;
	s.insert(0L);
	s.insert(N+1);
	for(i=1L;i<=N;++i){
		auto it=s.upper_bound(b[i]);
		x+=i*(*it-b[i])*(b[i]-*--it);
		s.insert(b[i]);
	}
	cout<<x<<endl;
}


Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  double l;
  cin >> l;
  cout << setprecision(10) << (l/3.0)*(l/3.0)*(l/3.0) << endl;
return 0;}

Measured memory_bytes: 256
n,m = map(int, input().split())
h = list(map(int, input().split()))
x = [1]*n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] == h[b-1]:
        x[a-1] = 0
        x[b-1] = 0
    elif h[a-1] < h[b-1]:
        x[a-1] = 0
    elif h[a-1] > h[b-1]:
        x[b-1] = 0
print(sum(x))

Measured memory_bytes: 20120
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

const int INF = 10000000;

int main(int argc, char *argv[])
{
  string s;
  int a = 0;
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'o') {
      a++;
    }
  }

  int rest = (15 - s.size());

  if (a + rest >= 8) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256