akhauriyash/Code-Regression huggingface dataset:
#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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = 0;
    set<int> st;
    REP(len, 3, 10) {
        rep(i, pow(3, 10) + 0.5) {
            int bit = i;
            int cnt[3] = {};
            string S;
            rep(j, len) {
                cnt[bit % 3]++;
                if (bit % 3 == 0) S += '3';
                else if (bit % 3 == 1) S += '5';
                else S += '7';
                bit /= 3;
            }
            if (cnt[0] >= 1 && cnt[1] >= 1 && cnt[2] >= 1 && stoll(S) <= N){
                st.insert(stoll(S));
            }
        }
    }
    cout << st.size() << endl;

    return 0;
}


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

int  main(void){
  int a=0;
  int b=0;
  int count=0;
  cin>>a;
  cin>>b;
  if(a==1)
  {
    cout<<1<<endl;
    return 0;
  }
  if(a>1)
  {
    count=a-1;
  if(b>=a)
  {
  count++;
}

  cout<<count<<endl;
  return 0;
}
return 0;
}


Measured memory_bytes: 256
def two_color_card_games(N: int, S: list, M: int, T: list) -> int:
    # default おこずかいを失う言葉しかない場合は、何も言わない。
    d = {'': 0}
    for s in S:
        d.setdefault(s, 0)
        d[s] += 1

    for t in T:
        d.setdefault(t, 0)
        d[t] -= 1

    return max(d.values())


if __name__ == "__main__":
    N = int(input())
    S = [input() for _ in range(N)]
    M = int(input())
    T = [input() for _ in range(M)]
    ans = two_color_card_games(N, S, M, T)
    print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N, K, Q;
  while (cin >> N >> K >> Q) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    ll res = 1ll << 60;
    for (ll mn : A) {
      vector<ll> cand, sub;
      for (int i = 0; i < N; i++) {
        if (A[i] >= mn) {
          sub.push_back(A[i]);
        }
        if (A[i] < mn || i == N - 1) {
          if (sub.size() >= K) {
            sort(sub.begin(), sub.end());
            copy(sub.begin(), sub.begin() + (sub.size() - K + 1),
                 back_inserter(cand));
          }
          sub.clear();
        }
      }
      if (cand.size() >= Q) {
        sort(cand.begin(), cand.end());
        ll mx = cand[Q - 1];
        res = min(res, mx - mn);
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
  int n;cin>>n;
  int sum=0;
  int mx=0;
  while(n--){
    int p;cin>>p;
    sum+=p;
    mx=max(p,mx);
  }
  sum-=mx/2;
  cout<<sum<<endl;

  return 0;
}
	

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

using namespace std;

static constexpr int modulo = 1000000007;

int solve(const std::vector<int>& as) {
  int const n = as.size();
  std::vector<int> possibles((n + 1) / 2, 0);
  int const oddOfN = n % 2;
  for (int i = 0; i < n; i++) {
    auto const a = as[i];
    if (a % 2 == oddOfN) {
      return 0;
    }
    auto const possibleIdx = n / 2 - (a + 1) / 2;
    if (possibles[possibleIdx] >= 2) {
      return 0;
    }
    possibles[possibleIdx]++;
  }
  if (oddOfN && possibles[n / 2] != 1) {
    return 0;
  }
  int64_t ret = 1;
  for (int i = 0; i < n / 2; i++) {
    ret *= 2;
    ret %= modulo;
  }
  return static_cast<int>(ret);
}

int main() {
  int n;
  std::cin >> n;
  std::vector<int> as(n);
  for (auto& a : as) {
    std::cin >> a;
  }
  std::cout << solve(as) << std::endl;
  return 0;
}

Measured memory_bytes: 768
#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;
    rep(i,3) if(s[i] == s[i+1]){
        cout << "Bad" << endl;
        return 0;
    }
    cout << "Good" << endl;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {


    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();

        int xi = x;
        for(int i = 0;i < 10;i++){
            xi = r * xi - d;
            System.out.println(xi);
        }
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)













int main(){
    ll n;
    cin >> n;
    vector<ll> r(n + 1);
    REP(i, n){
        cin >> r[i + 1];
    }
    for(ll i = 1; i < n + 1; i++){
        r[i] += r[i - 1];
    }
    ll ans = INF;
    for(ll i = 1; i < n + 1; i++){
        ans = min(ans, abs(r[n] - r[i - 1] - r[i - 1]));
    }
    cout << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    long long result = 0;
    for (int i = 0, count = 0; i < s.size(); i++) {
        if (s[i] == 'B') {
            count++;
        } else {
            result += count;
        }
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 100000000
#define N 10000
ll tra[10000];
int main()
{
    string s;
    cin>>s;
    ll lock=0;
    for(int i=0;i<s.length();i++)
        if(s[i]=='7')
    {
        lock=1;
        break;
    }
    if(lock==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3592
import math
N , M , X =  map(int,input().split())
A = {}
B = {}
ANS = 100000000000
for i in range(1,N+1):
    A[i]=list(map(int,input().split()))
for i in range(1,2**N):
    l = str(bin(i))
    n = len(l)
    ans=0
    for s in range(1,M+1):
        B[s]=0
    for k in range(1,n+1):
        if l[-k] == "1":
            ans = ans + A[k][0]
            for s in range(1,M+1):
                B[s] += A[k][s]
    if all((B[l] >= X for l in range(1,M+1))):
        ANS = min(ans,ANS)
if ANS == 100000000000:
    print("-1")
else:
    print(ANS)

Measured memory_bytes: 69088
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] c = new int[17];
		int[] p = new int[100];
		int[] w = new int[100];
		int[] sit = new int[100];
		for (int i = 0; i < 100; i++) {
			p[i] = i % 5 == 1 ? 5 : 2;
			w[i] = 17 * (i % 2) + 3 * (i % 3) + 19;
		}
		int i = 0;
		int t = 0;
		Deque<Integer> deque = new ArrayDeque<Integer>();
		Deque<Integer> m = new ArrayDeque<Integer>();
		int a = -1;
		loop1: while (true) {
			if (t == i * 5 && i < 100) {
				deque.offer(i++);
				m.offer(t);
			}
			for (int k = 0; k < 17; k++) {
				c[k] = Math.max(0, c[k] - 1);
			}
			if (!deque.isEmpty()) {
				int de = deque.peekFirst();
				a = getA(p[de], c);
			}
			while (!deque.isEmpty() && a != -1) {

				int id = deque.poll();
				for (int j = a; j < a + p[id]; j++) {
					c[j] = w[id];
				}
				sit[id] = t - m.pollFirst();
				if (id == 99) {
					break loop1;
				}

				if (!deque.isEmpty()) {
					int de = deque.peekFirst();
					a = getA(p[de], c);
				} else {
					break;
				}
			}
			t++;
		}
		while (scanner.hasNext()) {
			int n = scanner.nextInt();
			System.out.println(sit[n]);
		}
	}

	private static int getA(int d, int[] c) {
		int count = 0;
		int a = -1;
		for (int i = 0; i < 17; i++) {
			if (c[i] == 0) {
				count++;
				if (d == count) {
					return i - count + 1;
				}
			}else{
				count = 0;
			}
		}
		return a;
	}

}

Measured memory_bytes: 16968
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<string>
#include<vector>
#include<climits>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define	mp	make_pair
#define	pb	push_back

using namespace std;

typedef	pair<int,int>	pii;

int main()
{
	for(int n;cin>>n,n;){
		vector<pii> blk(n);
		blk[0]=mp(0,0);
		for(int i=1;i<n;i++){
			int m,d;	cin>>m>>d;
			int x=blk[m].first,y=blk[m].second;
			switch(d){
				case 0:	x--;	break;
				case 1:	y++;	break;
				case 2:	x++;	break;
				case 3:	y--;	break;
			}
			blk[i]=mp(x,y);
		}
		int xmin=200,xmax=-200,ymin=200,ymax=-200;
		for(int i=0;i<n;i++){
			xmin=min(xmin,blk[i].first);
			xmax=max(xmax,blk[i].first);
			ymin=min(ymin,blk[i].second);
			ymax=max(ymax,blk[i].second);
		}
		cout<<xmax-xmin+1<<' '<<ymax-ymin+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
X = gets.to_i

max_n = X/100

(0..max_n).each do |i1|
    m1 = i1 * 100
    (0..(max_n-i1)).each do |i2|
        m2 = i2 * 101
        (0..(max_n-i1-i2)).each do |i3|
            m3 = i3 * 102
            (0..(max_n-i1-i2-i3)).each do |i4|
                m4 = i4 * 103
                (0..(max_n-i1-i2-i3-i4)).each do |i5|
                    m5 = i5 * 104
                    (0..(max_n-i1-i2-i3-i4-i5)).each do |i6|
                        m6 = i6 * 105
                        if m1 + m2 + m3 + m4 + m5 + m6 == X
                            puts "1"
                            exit
                        end
                    end
                end            
            end        
        end    
    end
end

puts "0"

Measured memory_bytes: 1788
#include<stdio.h>
#define ll long long

ll n, m, d;
int main(){
    scanf("%lld%lld%lld",&n, &m, &d);
    double P = d==0?(double)1/n:(double)(2 * (n - d))/(n*n);
    //printf("%lf ", P);
    /*
    double ans = 0;
    for (ll i = 0;(1<<i)<=(m-1);i++){
        if((m-1)&(1<<i)){
            ans += P;
        }
        //printf("%lld ",i);
        P *= 2;
    }
    */
    printf("%3.8lf", P*(m-1));
}

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

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

    int h, w, n;
    cin >> h >> w;
    cin >> n;
    vector<int> A(n);
    REP(i, n) cin >> A[i];

    int C[h][w] = {};

    bool f = true;
    int idx = 0;
    REP(i, h){
        if(f){
            REP(j, w){
                C[i][j] = idx + 1;
                A[idx]--;
                if(A[idx] == 0){
                    idx++;
                }
            }
            f = false;
        }else{
            for(int j = w - 1; j >= 0; j--){
                C[i][j] = idx + 1;
                A[idx]--;
                if(A[idx] == 0){
                    idx++;
                }         
            }
            f = true;
        }
    }

    REP(i, h){
        REP(j, w){
            if(j) cout << " ";
            cout << C[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

using namespace std;

#define fo(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define lli long long int
#define all(c) c.begin(),c.end()
#define lower(c) tolower(c)
#define upper(c) toupper(c)
#define MAX(c) *max_element(c.begin(),c.end())
#define MIN(c) *min_element(c.begin(),c.end())
#define len(c) c.size()
const int MOD = 1000000007;
const int MX = 2e5 + 5;
const int INF = 1e9 + 10;
const lli LINF = 1e18;

void solve() {
	lli x,k,d;
	cin >> x >> k >> d;
	x=abs(x);
	lli s=min(k,x/d);
	k-=s;
	x-=s*d;
	if(k&1)cout << d-x << endl;
	else cout << x << endl;

}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
	solve();
    return 0;
}



Measured memory_bytes: 3656
#include<stdio.h>

int main()
{
  int num;
  int h=0, m=0, s=0;
  int temp;
  scanf("%d", &num);

  s = num%60;
  num = num/60;
  m = num%60;
  num = num/60;
  h = num;

  printf("%d:%d:%d\n", h, m, s);
  return 0;
}


Measured memory_bytes: 2120
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var res = num/25;
        var cu = new[] { 25, 10, 5, 1 };
        for (var i = 0; i < 3; i++)
        {
            res += num % cu[i] / cu[i + 1];
            num %= cu[i];
        }
        WriteLine(res);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


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

typedef long long ll;
#define p pair<ll,ll>
const ll MAX_N = 16;
const ll MAX_V = 1<<MAX_N; // 2^MAX_N (subsets of S)
const ll INF = (ll)1e18;
vector<vector<p> > g(MAX_N);
ll dp[MAX_N][MAX_V];
ll n, m;

ll solve(ll v, unsigned int S) {
    if (!(S&(1<<v))) return INF;
    if (dp[v][S]) return dp[v][S];
    if (v == 0 && S == 1) return 0;
    ll res = INF;
    for (p tp : g[v]) {
        ll u = tp.first, w = tp.second;
        //printf("exploring edge: (%lld, %lld)\n", v, u);
        res = min(res, w+solve(u, S^(1<<v))); // v\in S
    }
    //printf("%lld %u: %lld\n", v, S, res);
    return dp[v][S] = res;
}

// n^2*2^n time, n*2^n space
int main() {
    cin >> n >> m;
    if (n > 25) {
        // 20 billion cycles > 20s
        cout << "This gonna take too long, lol\n";
        return 0;
    }
    else if (n == 0) {
        cout << "Don't be silly\n";
        return 0;
    }
    ll u, v, w, i;
    for (i = 0; i < m; i++) {
        cin >> u >> v >> w;
        g[u].push_back(p(v,w));
        //g[v].push_back(p(u,w));
    }
    ll res = INF;
    unsigned int S = (1<<n)-1;
    for (p tp : g[0]) {
        ll v = tp.first, w = tp.second;
        res = min(res, w+solve(v, S));
    }
    if (res == INF) cout << "-1\n";
    else cout << res << '\n';
}



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

// Rolling Hash
struct RollingHash64 {
  const unsigned long long B = 1e9 + 7; //基数

  // aはbにいくつ含まれているか？
  int contain(string a, string b) {
    int al = a.length(), bl = b.length();
    if (al > bl)
      return false;

    // B^al
    unsigned long long t = 1;
    for (int i = 0; i < al; i++)
      t *= B;

    // a,bの最初のal文字のハッシュ
    unsigned long long ah = 0, bh = 0;
    for (int i = 0; i < al; i++)
      ah = ah * B + a[i];
    for (int i = 0; i < al; i++)
      bh = bh * B + b[i];

    int cont = 0;
    for (int i = 0; i + al <= bl; i++) {
      if (ah == bh)
        cont++;
      if (i + al < bl)
        bh = bh * B + b[i + al] - b[i] * t;
    }
    return cont;
  }

  // mod 2^64
  // aの末尾とbの先頭を何文字重ねることができるか？
  int overlap(string a, string b) {
    int al = a.length(), bl = b.length();
    int ans = 0;
    unsigned long long ah = 0, bh = 0, t = 1;
    for (int i = 1; i <= min(al, bl); i++) {
      ah = ah + a[al - i] * t;
      bh = bh * B + b[i - 1];
      if (ah == bh)
        ans = i;
      t *= B;
    }
    return ans;
  }
};

signed main() {
  int N;
  string S;
  cin >> N >> S;

  RollingHash64 roll;

  int ok = 0, ng = N;
  while (abs(ok - ng) > 1) {
    int mid = (ok + ng) / 2;
    bool flag = false;
    for (int i = 0; i < N; i++) {
      if (i + mid >= N) {
        break;
      } else {
        string s1 = S.substr(i, mid);
        string s2 = S.substr(i + mid, N - mid);
        if (roll.contain(s1, s2) > 0) {
          flag = true;
          break;
        }
      }
    }

    if (flag) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  cout << ok << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int k[100005];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d", &k[i]);
	}
	sort(k,k+n);
	long long int a=0,b=0;
	for(int i=n-1;i>0;i--){
		if(k[i]==k[i-1]){
			if(a==0){
				a=k[i];
				i--;
			}else{
				b=k[i];
				break;
			}
		}
	}
	long long int sum=a*b;
	cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	string s;
	cin >> s;
	int ans = 0;
	int n = (int)s.length();
	for(int i = 0; i < n; ++i){
		ans += (s[i] - '0');
	}
	if(ans % 9 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 3688
import math

N = int(input())
T = [0] * N
for i in range(N):
    T[i] = int(input())

if N == 1:
    print(T[0])
elif N == 2:
    print(T[0]*T[1]//math.gcd(T[0], T[1]))
else:
    L = T[0]
    for i in range(1, N):
        L = L*T[i]//math.gcd(L, T[i])
    print(L)


Measured memory_bytes: 9196
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


string S;
int main() {
	
	cin >> S;
	ll sum = 0;


	if ((S.size() - 2) % 2 == 1 && S[0] != S[S.size() - 1]) {
		cout << "First" << endl;
	}


	else if ((S.size() - 2) % 2 == 0 && S[0] == S[S.size() - 1]) {
		cout << "First" << endl;
	}

	else {
		cout << "Second" << endl;
	}
	

	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int S = 0;
  
  for(int i=1; i < 10; i++){
    for(int j=0; j < 10; j++){
      for(int k=0; k < 10; k++){
        int P = 10001*i + 1010*j + 100*k;
        
        if(A <= P && P <= B)
          S++;
          
      }
    }
  }
  cout << S << endl;
}


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

int main()
{
	int n, k;
	cin >> n >> k;
	int x[100];
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += min(abs(0 - x[i]), k - x[i]);
	}

	cout << ans * 2 << endl;

	return 0;
}

Measured memory_bytes: 256
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	string str ;
	cin>> str ;
	for(ll i=0;i<str.length();i++){
		if((i+1)&1 && str[i]=='L'){
			cout<<"No"<<endl;
			return 0;
		}
		if((i+1)%2==0 && str[i]=='R'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;


public class Main{

	static int N,M;
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		M=sc.nextInt();
		List<Integer>[]list=new List[N];
		for(int i=0;i<N;i++){
			list[i]=new LinkedList<Integer>();
		}
		int[] iri = new int[N];
		for(int i=0;i<M;i++){
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			list[a].add(b);
			iri[b]++;
		}
		List<Integer>ans=new LinkedList<Integer>();
		boolean f = false;
		for(int t=0;t<N;t++){
			for(int i=0;i<N;i++){
				if(iri[i]==0){
					ans.add(i);
					iri[i]=-1;
					if(!f){
						for(int j=0;j<N;j++){
							if(iri[j]==0){
								f=true;
							}
						}
					}
					for(Integer j:list[i]){
						iri[j]--;
					}break;
				}
			}
		}
		
		for(Integer a:ans){
			System.out.println(a+1);
		}
		System.out.printf("%d\n", f?1:0);
		
	}
	static HashMap<Integer,Integer>rank = new HashMap<Integer,Integer>();
}

Measured memory_bytes: 102552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, d;
  in2(a, b);
  in2(c, d);
  a = min(a, b);
  c = min(c, d);
  out(a + c);
  memi;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N;
int temp;
vector<long> a,b,c;
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> temp;
        a.push_back(temp);
    }
    for(int i = 0; i < N; i++){
        cin >> temp;
        b.push_back(temp);
    }
    for(int i = 0; i < N; i++){
        cin >> temp;
        c.push_back(temp);
    }
    
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    long ctr = 0;
    
    for(int i = 0; i < N; i++){
        auto ita = lower_bound(a.begin(),a.end(),b.at(i));
        auto itc = upper_bound(c.begin(),c.end(),b.at(i));
        
        ctr += (ita-a.begin())*(c.end()-itc);
    }
    
    cout << ctr << endl;

}

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

typedef long long int ll;

string n;
ll ans = 0;

void dfs(string n, char a, string s)
{
    s += a;
    if(stoi(n) >= stoi(s)){
        bool f3, f5, f7;
        f3 = f5 = f7 = false;
        for(ll i = 0;i < s.size();i++){
            if(s[i] == '3'){
                f3 = true;
            }
            else if(s[i] == '5'){
                f5 = true;
            }
            else if(s[i] == '7'){
                f7 = true;
            }
        }
        if(f3 && f5 && f7){
            ans++;
        }
    }
    if(s.size() == n.size()){
        return;
    }
    dfs(n, '3', s);
    dfs(n, '5', s);
    dfs(n, '7', s);
}

int main()
{
    
    cin >> n;
    string s;
    dfs(n, '3', s);
    dfs(n, '5', s);
    dfs(n, '7', s);

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin
N,A,B = [int(x) for x in stdin.readline().rstrip().split()]
S = (stdin.readline().rstrip())

AC = 0
BC = 0

for i in S:
    if i == "a":
        if A + B > AC + BC:
            AC += 1
            print("Yes")
        else:
            print("No")
    elif i == "b":
        if A + B > AC + BC and BC < B:
            BC += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 4016
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
    int i, judge=1;
    char str[256], str2[256];

    scanf("%s", str);
    scanf("%s", str2);

    if(strlen(str)+1 == strlen(str2)) {
        judge = 0;
        for(i=0; i<strlen(str); i++) {
            if(str[i] != str2[i]) {
                judge = 1;
            }            
        }
    }

    if(judge == 0) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1628
#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 = 100005;
const int MM = 1000000007;

int A[MX];

int gcd(int a, int b){
	return b ? gcd(b, a%b) : a;
}

ll tot = 0;
int N, g = 0, c = 0;
bool solve()
{
	ll tot = 0;
	for(int i = 1; i <= N; i++){
		tot += A[i];
	}
	if( (tot-N) % 2 == 1 ) return true;
	int g = 0, c = 0;
	for(int i = 1; i <= N; i++){
		if( A[i] == 1 )  return false;
		if( A[i]&1 ) c++, A[i]--;
		g = gcd(A[i], g);
	}
	if( c >= 2 ) return false;
	for(int i = 1; i <= N; i++) A[i] /= g;
	return !solve();
}

int main()
{
	scanf("%d", &N);
	for(int i = 1; i <= N; i++){
		scanf("%d", A+i);
	}
	if( solve() ) printf("First\n");
	else printf("Second\n");
}


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

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))


using namespace std;


typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 
typedef long double LD;


int main(){
	string s;
	cin>>s;
	if(s.substr(0,4)=="YAKI") cout<<"Yes"<<endl;
	else cout<<"No"<<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, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main() {
    int n;
    cin >> n;
    int ans = (n/2) + (n%2);
    cout << ans << endl;

}


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

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

  int N;
  cin >> N;
  vector<int> X(1e6,0);
  int a;
  for(int i = 0; i < N; i++) {
    cin >> a;
    X[a]++;
  }
  int ans = 0;
  for(int i = 1; i < 1e6; i++) {
    ans = max(ans, X[i - 1] + X[i] + X[i + 1]);
  }

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


Measured memory_bytes: 7152
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstring>
using namespace std;
#define MAXN 100
int n;
long long G;
long long T[MAXN+5],c[MAXN+5];
long long cnt;
int vis[MAXN+5];
long long ans=1000000000;
void dfs(int x,long long G,int step)
{
    for(int i=n;i>=1;i--)
    if(!vis[i])
    {
        int M=T[i]*100*i+c[i];
        if(G>M)
        {
            vis[i]=1;
            //printf("::%d %d\n",M,c[i]);
            dfs(x+1,G-M,step+T[i]);
            vis[i]=0;
        }
        else
        {
            //printf("%d %d %d %d\n",step,G,i,G/(i*100));
            long long p=(G+i*100-1)/(i*100);
            ans=min(ans,step+min(p,T[i]));
            //step-=min(G/i*100,T[i]);
        }
    }
}
int main()
{
    scanf("%d%lld",&n,&G);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&T[i],&c[i]);
    }
    dfs(1,G,0);
    printf("%d",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios::sync_with_stdio(false)
#define pb push_back
#define mp make_pair
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) (x).begin(), (x).end()
#define uint usigned int
typedef vector <ll> vi;
ll mod=1918;
//vi v1[200005],v2;
//bool visit[200005]={false};

/*void bfs(ll n){
    queue<ll> q;
    q.push(n);
    visit[n]=true;
    while(!q.empty()){
        ll t=q.front();
        q.pop();
        v2.pb(t);
        for(ll i=0;i<v1[t].size();i++){
            if(visit[v1[t][i]]==false){
                q.push(v1[t][i]);
                visit[v1[t][i]]=true;
            }
        }
    }
}*/
/*void dfs(ll n){
    for(ll i=0;i<v1[n].size();i++)
    {
        ll y=v1[n][i];
        if(visit[y]==0)
        {
            v2.pb(y);
            visit[y]=1;
            dfs(y);
        }
    }
}*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    ll n,e,k,i,x=0,p,y=0,ans=0,m=0;
    cin>>n;
    ll a[5];
    for(i=0;i<5;i++){
        cin>>a[i];
        if(i==0) m=a[i];
        else if(m>=a[i]){
            y=i;
            m=a[i];
        }
    }
  //  cout<<y<<" "<<m<<endl;
  if(y==4 || y==0 || m==a[0] || m==a[4]){
      if(n%m==0) ans+=n/m;
      else ans+=n/m+1;
      cout<<ans+4;
      return 0;
  }
    i=0;
    while(y!=i){
        i++;
        ans++;
    }
    x=5-y-1;
    if(n%m==0) ans+=n/m;
    else  ans+=n/m+1;
    cout<<ans+x;
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int L,a,b,c,d;
    cin>>L>>a>>b>>c>>d;
    while(1){
        L--;
        a-=c;
        b-=d;
        if(a<=0 && b<=0){
            cout<<L<<endl;
            break;
        }

    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int T,X;
	cin >> T >> X;

	double d = T * 1.0 / X;
	println(d);
}


Measured memory_bytes: 256
n= int(input())
s = list(input())
a = s[1:].count('E')
g = [a]
b = 0
c = a
for i in range(1,n):
  if s[i-1]=='W':
    b+=1
  if s[i]=='E':
    c-=1
  g.append(b+c)
print(min(g))

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

using namespace std;

typedef long long ll;

const int MAXN = 100005;

int n, m;
char s[MAXN], t[MAXN];

int gcd(int x, int y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(int x, int y) {
  return 1LL * x / gcd(x, y) * y;
}

int main() {
  scanf("%d %d", &n, &m);
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  ll L = lcm(n, m);
  map<int, char> X;
  for(int i = 1; i <= n; i++) {
    X[(i - 1) * (L / n) + 1] = s[i];
  }
  bool ok = true;
  for(int i = 1; i <= m; i++) {
    int pos = (i - 1) * (L / m) + 1;
    if(X.count(pos)) {
      if(X[pos] != t[i]) ok = false;
    }
  }
  if(ok) printf("%lld\n", L);
  else puts("-1");
  return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG


signed main() {
  string S; cin >> S;
  
  int ans = 0;
  char now = S[0];
  rep(i, S.size()) {
    if(S[i] != now) {
      ans++;
      now = S[i];
    }
  }
  cout << ans << endl;
}

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

int main()
{
  int64_t A;
  double B;
  cin >> A >> B;
  //Bの整数部（int型）
  int Bdash = (int)B;
  double D = (B - Bdash);//Bの小数部（double型）
  D *= 100;
  string s = to_string(D);
  int E = stoi(s);
  //cout << A << "   " << Bdash << "   " <<  D << "   " << E << endl;
  cout << (int64_t)(A*Bdash) + (int64_t)((A*E)/100) << endl;
}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define ll long long
#define ljc 998244353
using namespace std;
#define gc getchar
inline ll read(){
    register ll x=0,f=1;char ch=gc();
    while (!isdigit(ch)){if (ch=='-') f=-1;ch=gc();}
    while (isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=gc();}
    return (f==1)?x:-x;
}
vector<int> e[1010101];
int n,sg[1010101],u,v;
void dfs(int u,int faa){
    sg[u]=0;
    for (auto v:e[u]){
        if (v==faa) continue;
        dfs(v,u);
        sg[u]^=sg[v]+1;
    }
}
int main(){
    n=read();
    for (int i=1;i<n;++i){
        int u=read(),v=read();
        e[u].push_back(v);
        e[v].push_back(u);
    }
    dfs(1,0);
    puts(sg[1]?"Alice":"Bob");
}

Measured memory_bytes: 38588
#include <bits/stdc++.h>
using namespace std;
int main(void) {
	int N, M;
	cin >> N >> M;

	const int NMMAX = 50;
	int A[NMMAX], B[NMMAX];

	for (int i = 0; i < M; ++i) {
		cin >> A[i] >> B[i];
	}

	int road[NMMAX];
	for (int i = 0; i < N; ++i) {
		road[i] = 0;
	}

	for (int i = 0; i < M; ++i) {
		road[A[i] - 1] += 1;
		road[B[i] - 1] += 1;
	}

	for (int i = 0; i < N; ++i) {
		cout << road[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char c = sc.next().charAt(0);
		if(c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o') {
			System.out.println("vowel");
		}else {
			System.out.println("consonant");
		}
	}
}


Measured memory_bytes: 20692
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

public class Main {

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

		int v = in.nextInt();
		int e = in.nextInt();

		init(v);
		for (int i=0;i<e;i++) {
			addEdge(in.nextInt(), in.nextInt());
		}
		makeStronglyConnectedComponent(v);

		int q = in.nextInt();
		for (int i=0;i<q;i++) {
			if (order[in.nextInt()]==order[in.nextInt()]) {
				System.out.println(1);
			} else {
				System.out.println(0);
			}
		}
	}

	///
	static List<Integer>[] edge;
	static List<Integer>[] revEdge;
	static boolean[] used;
	static List<Integer> lPostOrderNumber;
	static int[] order; // topological order number for each vertex
	@SuppressWarnings("unchecked")
	static void init(int v) {
		used = new boolean[v];
		edge = new ArrayList[v];
		for (int i=0;i<edge.length;i++) {
			edge[i] = new ArrayList<Integer>();
		}
		revEdge = new ArrayList[v];
		for (int i=0;i<revEdge.length;i++) {
			revEdge[i] = new ArrayList<Integer>();
		}
		lPostOrderNumber = new ArrayList<Integer>();
		order = new int[v];
	}
	static void addEdge(int from, int to) {
		edge[from].add(to);
		revEdge[to].add(from);
	}
	static void dfsPostOrderNumbering(int v) {
		Stack<Integer> s = new Stack<Integer>();
		s.push(v);
		used[v] = true;
		
		while (!s.isEmpty()) {
			int val = s.peek();
			boolean bPushed = false;
			for (int i=0;i<edge[val].size();i++) {
				if (!used[edge[val].get(i)]) {
					s.push(edge[val].get(i));
					used[edge[val].get(i)] = true;
					bPushed = true;
					break;
				}
			}
			if (!bPushed) {
				lPostOrderNumber.add(s.pop());
			}
		}
	}
//	static void dfsPostOrderNumbering(int v) {
//		used[v] = true;
//		for (int i=0;i<edge[v].size();i++) {
//			if (!used[edge[v].get(i)]) dfsPostOrderNumbering(edge[v].get(i));
//		}
//		lPostOrderNumber.add(v);
//	}
	static void dfsMakeComponent(int v, int k) {
		used[v] = true;
		order[v] = k;
		for (int i=0;i<revEdge[v].size();i++) {
			if (!used[revEdge[v].get(i)]) dfsMakeComponent(revEdge[v].get(i), k);
		}
	}
	static long makeStronglyConnectedComponent(int v) {
		for (int i=0;i<v;i++) {
			if (!used[i]) dfsPostOrderNumbering(i);
		}

		Arrays.fill(used, false);
		int k=0;
		for (int i=lPostOrderNumber.size()-1;i>=0;i--) {
			if (!used[lPostOrderNumber.get(i)]) dfsMakeComponent(lPostOrderNumber.get(i), k++);
		}
		return k; // # of strongly connected components
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<int> cost(n);
  cost[1] = abs(v[1] - v[0]);
  for (int i = 2; i < n; i++) {
    cost[i] = min(abs(v[i] - v[i - 1]) + cost[i - 1],
                  abs(v[i] - v[i - 2]) + cost[i - 2]);
  }
  cout << cost[n - 1] << endl;
}


Measured memory_bytes: 1024
s = input()

# def check(s):
#     if len(s) == 1:
#         return True

#     before = s[: len(s) // 2]
#     if len(s) % 2 == 0:
#         after = s[((len(s) // 2)):]
#     else:
#         after  = s[((len(s) // 2) + 1):]

#     if before == after:
#         return True
#     else:
#         return False

# if check(s) and check(s[:(len(s)//2)]):
#     print("Yes")
# else:
#     print("No") 

def palindrome(string): return 1 if string==string[::-1] else 0


if palindrome(s) and palindrome(s[:((len(s) - 1) // 2)]):
    print("Yes")
else:
    print("No")
 

Measured memory_bytes: 2940
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_map = lambda: [s == ord('.') for s in read() if s != ord('\n')]


def main():
    N, M = in_nn()
    t = in_map()
    A = np.array(t[:N * N]).reshape(N, N)
    B = np.array(t[N * N:]).reshape(M, M)

    ans = 'No'
    for y in range(N - M + 1):
        for x in range(N - M + 1):
            if np.all(A[y:y + M, x:x + M] == B):
                ans = 'Yes'

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27092
#include <bits/stdc++.h>
#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(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
bool B(int x,int i){return (x>>i)&1;}
int N,X;
vector<string> S;
int dp[21][1<<21];
int cnt[21][1<<21];
int getnext[21][1<<21][2];
void addfrom(int p,int s,int plen,int slen){
	int v = (p<<slen)|s;
	int n = plen+slen;
	int id = v + (1<<n)-1;

	if(plen==0){
		if(S[slen][s]=='1') dp[plen][id]++;
	}

	int val = dp[plen][id];

	cnt[plen][p] += val;

	if(slen==0){
		return;
	}

	rep(c,2){
		int i = getnext[slen][s][c];
		if(i==slen) continue;
		int np = (p<<1)|c;
		int nplen = plen+1;
		int nslen = slen-(i+1);
		int ns = s & ((1<<nslen)-1);

		int nv = (np<<nslen)|ns;
		int nn = nplen+nslen;
		int nid = nv + (1<<nn)-1;
		dp[nplen][nid] += val;
	}
}
int main(){
	cin>>N>>X;
	S.resize(N+1);
	rep(n,N+1){
		cin>>S[n];
//		S[n] = string(1<<n,'1');
	}
	rep(n,N+1){	//calcgetnext
		rep(b,1<<n){
			rep(c,2){
				getnext[n][b][c] = n;
				rep(i,n){
					if(B(b,n-1-i) == c){
						getnext[n][b][c] = i;
						break;
					}
				}
			}
		}
	}
	rep(plen,N+1){
		for(int n=plen;n<=N;n++){
			rep(b,1<<n){
				int slen = n-plen;
				int p = b>>slen;
				int s = b&((1<<slen)-1);
				addfrom(p,s,plen,slen);
			}
		}
	}
	for(int n=N;n>=0;n--){
		rep(b,1<<n){
			if(cnt[n][b] >= X){
				string s;
				rep(i,n) s += '0'+B(b,n-1-i);
				cout<<s<<endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 278016
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
using namespace std;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;

int main(){
	string a,b;
	cin >> a >> b;
	int n = stoi(a+b);
	int i = 1;
	while(1){
		int k = i * i;
		if(k==n){
			cout<<"Yes"<<endl;
			break;
		}
		else if(k > n){
			cout<<"No"<<endl;
			break;
		}
		i++;
	}


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<pr> vp;
typedef vector<vp> vpp;
typedef vector<vector<ll> > graph;
#define pb push_back
#define mp make_pair
#define endl '\n'
void set_val(vector<ll>& v, ll val){for(ll i=0;i<v.size();i++) v[i]=val;}

ll mod = pow(10,9) + 7;
ll modulo = 998244353;
double pi = 3.141592653589793238;
ll i_mov[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
ll j_mov[8] = {1, 1, 1, 0, -1, -1, -1, 0};


ll power(ll a, ll n)
{
    if(n==0)
    return 1;
    ll temp = power(a,n/2);
    if(n%2==0)
    return (temp*temp)%mod;
    return (((temp*temp)%mod)*a)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout<<fixed;
    cout<<setprecision(10);
    ll n;
    cin>>n;
    ll temp = (n/500)*500;
    cout<< 2*temp + 5*((n-temp)/5);
    
    
    
} 

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
int N,K,s01[101010],sn01;
char S[101010];
int i, j,k,ans;
int main(){
    scanf("%d%d%s",&N,&K ,S);
    fornum(i,1,N+1){
        if(S[i-1]=='1'&&S[i]!='1'){
            if(sn01>=K){
                ans= max(ans,i - s01[sn01-K]);
            }
        }
        if(S[i-1]=='0'&&S[i]!='0'){
            s01[++sn01] = i;
        }
    }
    ans = max(ans, sn01 >= K ? N - s01[sn01 - K] : N);
    //fornum(i,0,sn01+1){
    //    printf("%d\n", s01[i]);
    //}
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

LL H, W, N;
map<pair<LL, LL>, int> M;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> H >> W >> N;
	for(int i=0; i<N; i++){
		LL a, b;
		cin >> a >> b;
		for(int j=-1; j<=1; j++){
			for(int k=-1; k<=1; k++){
				if(a+j <= 1 || a+j >= H || b+k <= 1 || b+k >= W){
					continue;
				}
				pair<LL, LL> p = make_pair(a+j, b+k);
				if(M.count(p) == 0){
					M[p] = 1;
				}
				else{
					M[p]++;
				}
			}
		}
	}

	long long ans = 0;
	ans = (H - 2) * (W - 2) - M.size();
	printf("%lld\n", ans);
	for(int i=1; i<=9; i++){
		ans = 0;
		for(auto itr = M.begin(); itr != M.end(); itr++){
			pair<LL, LL> p = itr->first;
			int v = itr->second;
			if(v == i){
				ans++;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

int main() {
    long long i, j, max=0, count;
    string S, T;
    
    cin >> S >> T;
    
    
    for(i=0; i<S.size()-T.size()+1; i++){
        count=0;
        for(j=0; j<T.size(); j++){
            if(S.at(i+j)==T.at(j)){
                count += 1;
            }
            
            
        }
        if(max<count)
        max = count;
        
        
        
    }
    
    
    
    cout << T.size()-max;
    
}









Measured memory_bytes: 3556
#include<iostream>
#include<cstdio>
#include<cstring>

typedef long long ll;

int calc(ll x)
{
	int ret=0;
	for(;x;x/=10)ret+=x%10;
	return ret;
}

ll pow[17];

int main()
{
	pow[0]=1;
	for(int i=1;i<=16;i++)
		pow[i]=pow[i-1]*10;

	int ans=0;
	ll n;

	scanf("%lld",&n);
	for(int i=1;i<=17 && n>0;i++)
	{
		ans=std::max(ans,calc(n));
		n=n-(n%pow[i])-1;
	}
	printf("%d\n",ans);

	return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] v = new int[n];
		for (int i = 0; i < n; i++) {
			v[i] = scanner.nextInt();
		}
		Arrays.parallelSort(v);
		long sum = 0;
		for (int i = n - 1; i > 1; i--) {
			sum += v[i];
			sum <<= 1;
		}
		sum += v[0] + v[1];
		System.out.println((double) sum / (1l << (n - 1)));

	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll n)
{
    KAKA
    ll sum = 0;
    pragi(1,n)
    {
        sum += (n - 1)/i;
    }
    cout<<sum<<"\n";
}
int main()
{
    KAKA
    ll n;
    cin>>n;
    Compute(n);
}

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

int main(){
  string N; cin >> N;
  int c=0;
  int dp = 0;
  for (int i = 0; i < N.size(); i++) {
    if (N.at(i) == 'R'){
      c++;
    }else{
      if (dp < c) dp = c;
      c = 0;
    }
  }
  if (dp < c) dp = c;
  cout << dp << endl;
}

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

using namespace std;

using ll = long long;

ll hoge(ll n) {
  if (n <= 0)
    return 0;
  return n * (n - 1) / 2;
}

int main() {
  int n;
  cin >> n;
  vector<int> vec(n, 0);
  vector<int> vec2(n+1, 0);

  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
    ++vec2[vec[i]];
  }

  ll cnt = 0;
  for (auto &v : vec2)
    cnt += hoge(v);

  for (int i = 0; i < n; ++i) {
    ll cnt1 = hoge(vec2[vec[i]]);
    ll cnt2 = hoge(vec2[vec[i]] - 1);
    cout << cnt - cnt1 + cnt2 << endl;
  }
}

Measured memory_bytes: 4096