akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {

    string s;
    cin >> s;

    vector<string> terms;

    for (int i = 0; i < (1 << (s.size() - 1)); i++) {
        string t = "";
        bitset<10> b(i);
        for (int j = 0; j < s.size(); j++) {
            t = t + s[j];
            if (b[j]) {
                terms.push_back(t);
                t = "";
            }
        }
        terms.push_back(t);
    }

    ll ans = 0;
    for (string str : terms) {
        ans += atoll(str.c_str());
    }

    cout << ans << endl;

}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int R = sc.nextInt();
        if (N>=10) System.out.println(R);
        else System.out.println(R+100*(10-N));
    }
}

Measured memory_bytes: 24916
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

void dfs(int y, int x, vector<vector<bool>> &used, vector<vector<int>> &M) {
    if (used[y][x]) return;
    used[y][x] = true;
    REP(i, -1, 2) {
        REP(j, -1, 2) {
            int ny = y + i, nx = x + j;
            if (ny < 0 || ny >= M.size() || nx < 0 || nx >= M[ny].size() || M[ny][nx] == 0) continue;
            dfs(ny, nx, used, M);
        }
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int w, h;
    while (cin >> w >> h, w + h) {
        auto M = make_v(h, w, 0);
        REP(i, 0, h) {
            REP(j, 0, w) {
                cin >> M[i][j];
            }
        }
        auto used = make_v(h, w, false);
        int ans = 0;
        REP(i, 0, h) {
            REP(j, 0, w) {
                if (!used[i][j] && M[i][j] == 1) {
                    dfs(i, j, used, M);
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}



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

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<long long, long long>> A;
    for(int i = 0; i < N; i++){
        pair<long long, long long> a;
        cin >> a.first;
        a.second = 1;
        A.push_back(a);
    }
    for(int i = 0; i < M; i++){
        pair<long long, long long> a;
        cin >> a.second >> a.first;
        A.push_back(a);
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    
    int cnt = 0;
    long long ans = 0;
    for(int i = 0; i < A.size(); i++){
        while(cnt < N && A[i].second > 0){
            ans += A[i].first;
            cnt++;
            A[i].second--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int d, n, m;
    while(cin >> d, d){
        cin >> n >> m;
        vector<int> v(n, 0);
        for(int i = 1; i < n; i++)  cin >> v[i];
        v.push_back(v[n-1]-d);
        v.push_back(d);
        sort(v.begin(), v.end());
        int ans = 0;
        while(m-- > 0){
            int k;  cin >> k;
            int x = lower_bound(v.begin(), v.end(), k)-v.begin();
            ans += min(v[x]-k, k-v[x-1]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3652
(let ((n (read))
    (s (read-line))
    (k (read))
    (a ""))
    (setq a (char s (- k 1)))
    (loop for char across s do
        (if (char= char a)
            (format t "~A" a)
            (format t "*")
        )
    )
    (format t "~%")
)

Measured memory_bytes: 24356
#include <iostream>
using namespace std;long k,n,s,j,a,m=998244353,d[3001];int main(){cin>>n>>s;while(n--){cin>>a;for(j=s+1;j-->a;)d[j]=(d[j]+d[j-a])%m;d[a]++;d[0]++;k+=d[s];}cout<<k%m;}

Measured memory_bytes: 3560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
        public static void main(String[] args) throws IOException {

          System.out.println(new Main().run(args, System.in));
    }
    public String run(String[] args, InputStream in) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] val = reader.readLine().replaceAll("\\s+", " ").split(" ");

       long A = Long.parseLong(val[0]);
       long B = Long.parseLong(val[1]);
       long C = Long.parseLong(val[2]);
       if (A == B && B==C && (A % 2)== 0) return "-1";

      long count = 0;
       while (true) {
           if (A%2 == 1|| B%2 == 1 || C%2 == 1) {
               break;
           }           
           count++;
           long a2 = A / 2;
           long b2 = B / 2;
           long c2 = C / 2;

           A = b2 + c2;
           B = a2 + c2;
           C = b2 + a2;
       }              
       return String.valueOf(count);
    }   
}


Measured memory_bytes: 21072
#include <stdio.h>

int F[50];

int fib(int n) {
	if ( n == 0 || n == 1) {
		return F[n] = 1;
	}
	if ( F[n] != -1) {
		return F[n];
	}
	return F[n] = fib(n - 1) + fib(n - 2);
}

int main() {
	int n, i;
	for( i = 0; i < 50; i++) {
		F[i] = -1;
	}
	
	scanf("%d", &n);
	printf("%d\n", fib(n));
	return 0;
}

Measured memory_bytes: 1852
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program{
    static void Main(){
        int.Parse(Console.ReadLine());
        int[] S = Console.ReadLine().Split(' ')
                                         .Select(val => int.Parse(val))
                                         .ToArray();
        int q = int.Parse(Console.ReadLine());
        int[] T = Console.ReadLine().Split(' ')
                                         .Select(val => int.Parse(val))
                                         .ToArray();
        int cnt = 0;
        for (int i = 0; i < q; i++)
        {
            if(BinarySearch(S, T[i])) cnt++;
        }
        Console.WriteLine(cnt);
    }

    static bool BinarySearch<T>(IEnumerable<T> col, T key)
        where T : IComparable
    {
        int l = 0, r = col.Count();
        while(l < r){
            int mid = (r + l) / 2;
            if(col.ElementAtOrDefault<T>(mid).CompareTo(key) == 0) return true;
            else if(col.ElementAtOrDefault<T>(mid).CompareTo(key) < 0) l = mid + 1;
            else r = mid;
        }
        return false;
    }
}

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

int main() {
  int N;
  cin >>N;
  vector<vector<int>> jobs(N, vector<int>(2));
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    jobs[i][0]=b;
    jobs[i][1]=a;
    }

  sort(jobs.begin(),jobs.end());

  long time=0;
  for(int i=0;i<N;i++){
    time+=jobs[i][1];
    if(time>jobs[i][0]){
      cout<<"No"<<endl;
      return 0;
    }
  }

  cout<<"Yes"<<endl;
  }


Measured memory_bytes: 11264
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    u32 n, k;
    cin >> n >> k;
    vector<int> v;
    v.reserve(k);
    for (int j = 0; j < k; ++j) {
        v.emplace_back(0);
    }
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        v.emplace_back(a);
    }
    sort(v.begin(), v.end(), greater<>());
    cout << accumulate(v.begin(), v.begin()+k, 0) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define mid (low+high)/2
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 300004
#define INF 1e9+7

using namespace std;

ll n,a[N],b[N];
ll s[N],t[N];

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

    cin >> n;

    rep(i,0,n)
        cin >> a[i];

    rep(i,0,n)
        cin >> b[i];

    ll num = 1;
    ll ans = 0;

    rep(bit,0,29)
    {
        ll mod = num*2;

        rep(i,0,n)
            s[i] = a[i]%mod;
        rep(i,0,n)
            t[i] = b[i]%mod;

        sort(s,s+n);
        reverse(s,s+n);
        sort(t,t+n);

        ll low = 0;
        ll high = 0;
        ll last = 0;
        ll cnt = 0;

      //  cout << bit << ":\n";

        rep(i,0,n)
        {
         //   cout << s[i] << " " << t[i] << endl;
            while(high < n && s[i]+t[high] < mod) // high = first index s.t. s[i]+t[high] >= 2*num
                high++;

            while(low < n && s[i]+t[low] < num) // low = first index s.t. s[i]+t[low] >= num
                low++;

            while(last < n && s[i]+t[last] < 3*num)
                last++;

            cnt += high-low;
            cnt += n-last;

            //cout << i << " " << low << " " << high << "  " << last << endl;
        }

        if(cnt%2==1)
            ans += num;

        num *= 2;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 8448
#include<iostream>
#include<string>

using namespace std;

void West(int surface[]);
void East(int surface[]);
void North(int surface[]);
void South(int surface[]);
void Swing(int surface[]);

bool judge(int surface1[], int surface2[]);

typedef struct dice {

	int surface[6] = { 0 };
	string str;

} Dice;

Dice memory;
bool change = false;

int main() {

	Dice dice;
	Dice ans;
	int n = 0;
	bool correct = false;

	for (int i = 0; i < 6; i++) {

		cin >> dice.surface[i];

	}

	for (int i = 0; i < 6; i++) {

		cin >> ans.surface[i];

	}

	memory = dice;

	change = true;

	if (judge(dice.surface, ans.surface)) {

		cout << "Yes" << endl;

	}
	else {

		cout << "No" << endl;

	}

	

}

void West(int surface[]) {

	memory.surface[0] = surface[2];
	memory.surface[2] = surface[5];
	memory.surface[5] = surface[3];
	memory.surface[3] = surface[0];

	return;

}

void East(int surface[]) {

	memory.surface[0] = surface[3];
	memory.surface[3] = surface[5];
	memory.surface[5] = surface[2];
	memory.surface[2] = surface[0];

	return;

}

void North(int surface[]) {

	memory.surface[0] = surface[1];
	memory.surface[1] = surface[5];
	memory.surface[5] = surface[4];
	memory.surface[4] = surface[0];

	return;

}

void South(int surface[]) {

	memory.surface[0] = surface[4];
	memory.surface[4] = surface[5];
	memory.surface[5] = surface[1];
	memory.surface[1] = surface[0];

	return;

}

void Swing(int surface[]){

	memory.surface[2] = surface[1];
	memory.surface[1] = surface[3];
	memory.surface[3] = surface[4];
	memory.surface[4] = surface[2];

	return;

}

bool judge(int surface1[], int surface2[]) {

	Dice tempo = memory;
	int need[4] = { 0 };
	int arr[3][6] =
	{
		{0,5,1,2,4,3},
		{1,4,0,3,5,2},
		{2,3,0,1,5,4}
	};

	for (int i = 0; i < 3; i++) {

		if (surface1[arr[i][0]] == surface2[arr[0][0]] && surface1[arr[i][1]] == surface2[arr[0][1]]) {

			need[0] = arr[i][2];
			need[1] = arr[i][3];
			need[2] = arr[i][4];
			need[3] = arr[i][5];

			for (int u = 0; u < 4; u++) {

				if (surface1[need[(u < 4) ? u : u - 4]] == surface2[arr[0][2]] && surface1[need[(u + 1 < 4) ? u + 1 : u + 1 - 4]] == surface2[arr[0][3]] && surface1[need[(u + 2 < 4) ? u + 2 : u + 2 - 4]] == surface2[arr[0][4]] && surface1[need[(u + 3 < 4) ? u + 3 : u + 3 - 4]] == surface2[arr[0][5]]) {

					return true;

				}
				
			}

		}
		else if (surface1[arr[i][0]] == surface2[arr[0][1]] && surface1[arr[i][1]] == surface2[arr[0][0]]) {

			need[0] = arr[i][2];
			need[1] = arr[i][3];
			need[2] = arr[i][4];
			need[3] = arr[i][5];

			for (int u = 0; u < 4; u++) {

				if (surface1[need[(u < 4) ? u : u - 4]] == surface2[arr[0][2]] && surface1[need[(u + 1 < 4) ? u + 1 : u + 1 - 4]] == surface2[arr[0][5]] && surface1[need[(u + 2 < 4) ? u + 2 : u + 2 - 4]] == surface2[arr[0][4]] && surface1[need[(u + 3 < 4) ? u + 3 : u + 3 - 4]] == surface2[arr[0][3]]) {

					return true;

				}

			}

		}
		else {

			continue;

		}

	}

	return false;

}






Measured memory_bytes: 3168
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;i++)
#define FORD(i,a,b) for (int i=a;i>=b;i--)
using namespace std;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const int MO=1e9+7;
LL fac[5010],ANS,inv[5555],f[5010][5010],ans;
int nedge,siz[500010],x,y,n,ts,tmp[5555],root,cnt,mx[500010],too[500010],hed[500010],nxt[500010];
LL pw(LL x,LL y){
	LL t=1;
	for (;y;y>>=1){
		if (y&1) t=t*x%MO;
		x=x*x%MO;
	}
	return t;
}
LL C(int x,int y){
	return fac[x]*inv[y]%MO*inv[x-y]%MO;
}
void ae(int x,int y){
	nxt[++nedge]=hed[x];
	hed[x]=nedge;
	too[nedge]=y;
}
void dfs(int x,int l){
	siz[x]=1;
	for (int i=hed[x];i;i=nxt[i]){
		int y=too[i];
		if (y==l) continue;
		dfs(y,x);
		mx[x]=max(mx[x],siz[y]);
		siz[x]+=siz[y];
	}
	mx[x]=max(mx[x],n-siz[x]);
}
int main(){
	scanf("%d",&n);
	fac[0]=1;
	FOR(i,1,n) fac[i]=fac[i-1]*i%MO;
	inv[n]=pw(fac[n],MO-2);
	FORD(i,n-1,0) inv[i]=inv[i+1]*(i+1)%MO;
	FOR(i,2,n){
		scanf("%d%d",&x,&y);
		ae(x,y),ae(y,x);
	}
	dfs(1,0);
	FOR(i,1,n)
		if (mx[i]<=n/2) root=i,++cnt;
	if (cnt==2) return cout<<fac[n/2]*fac[n/2]%MO<<endl,0;
	dfs(root,0);
	for (int i=hed[root];i;i=nxt[i]){
		int y=too[i];
		tmp[++ts]=siz[y];
	}
	tmp[++ts]=1;
	f[0][0]=1;
	FOR(i,0,ts-1)
		FOR(j,0,n)
			if (f[i][j]){
				FOR(k,0,tmp[i+1])
					(f[i+1][j+k]+=f[i][j]*C(tmp[i+1],k)%MO*C(tmp[i+1],k)%MO*fac[k])%=MO;
			}
	FOR(i,0,n)
		if (i&1) (ans-=f[ts][i]*fac[n-i])%=MO;
		else (ans+=f[ts][i]*fac[n-i])%=MO;
	FOR(i,0,n)
		if (i&1) (ANS-=f[ts-1][i]*fac[n-1-i])%=MO;
		else (ANS+=f[ts-1][i]*fac[n-1-i])%=MO;
	cout<<((ans+ANS)%MO+MO)%MO<<endl;
	return 0;
}


Measured memory_bytes: 203904
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s, t;
    cin >> s >> t;
    vector<int> v1(26, -1);
    vector<int> v2(26, -1);
    int n = s.size();
    rep(i, n) {
        if (v1[s[i]-'a'] == -1) {
            v1[s[i]-'a'] = t[i]-'a';
        }
        else if (v1[s[i]-'a'] != t[i]-'a'){
            cout << "No" << endl;
            return 0;
        }
        if (v2[t[i]-'a'] == -1) {
            v2[t[i]-'a'] = s[i]-'a';
        }
        else if (v2[t[i]-'a'] != s[i]-'a') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3900
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    set<ll> S;
    ll s;
    cin>>s;
    ll ans=1;
    while(1){
        if(S.count(s)){cout<<ans<<endl; return 0;}
        S.insert(s);
        if(s&1){s=3*s+1;}
        else{s/=2;}
        ans++;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>


#define PI 3.14159265


double area(double a, double b, double C) {
  return a * b * sin(C * PI / 180) / 2;
}


double circumference(double a, double b, double C) {
  return a + b + sqrt(a * a + b * b - 2 * a * b *cos(C * PI / 180));
}

double height(double b, double C) {
  return b * sin(C * PI / 180);
}


int main() {
  double a, b, C;
  std::cin >> a >> b >> C;

  std::cout << std::fixed << std::setprecision(8)
    << area(a, b, C) << std::endl
    << circumference(a, b, C) << std::endl
    << height(b, C) << std::endl;

  return 0;
}



Measured memory_bytes: 3316
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = -1;

    if(a < 10 && b < 10){
      ans = a * b;
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
N, Y = map(int, input().split())

for i in range(N+1):
    for j in range(N-i+1):
        tmp = 10000 * i + 5000 * j + 1000 * (N-i-j)
        if tmp == Y:
            print(str(i) + ' ' + str(j) + ' ' + str(N-i-j))
            quit()

print('-1 -1 -1')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

int main() {
  ll a, l;
  cin >> l >> a;

  ll cnt = a, w = a, h = l - a;
  bool isY = true;
  while (w && h) {

    if (isY) {

      cnt += ((w / h) * 2 + 1) * h;
      w -= (w / h) * h;
      // cout << w << " " << h << endl;
      if (w == 0)
        cnt -= h;
    }

    if (!isY) {
      cnt += ((h / w) * 2) * w;

      // cout << ((h / w) * 2) * w << endl;
      // cout << w << " " << h << endl;
      h -= (h / w) * w;
      if (h == 0)
        cnt -= w;
    }
    swap(w, h);
    isY = false;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define MAXN 100000
struct point{
	int t,x,y;
}p[MAXN+5];
int n;
bool flag=1;
bool cmp(point x,point y) {
	return x.t<y.t;
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d %d %d",&p[i].t,&p[i].x,&p[i].y);
	sort(p+1,p+n+1,cmp);
	p[0].t=0,p[0].x=0,p[0].y=0;
	for(int i=1;i<=n;i++) {
		int dist=fabs(p[i].x-p[i-1].x)+fabs(p[i].y-p[i-1].y);
		int time=p[i].t-p[i-1].t;
		if(dist>time||(time-dist)%2==1) {
			flag=0;break;
		}
	}
	if(flag)
		printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 1280
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////

    int N,M;
    cin>>N;
    vector<string>S(N);
    for(int i=0;i<N;i++){
        cin>>S.at(i);
    }
    cin>>M;
    vector<string>T(M);
    for(int i=0;i<M;i++){
        cin>>T.at(i);
    }
    vector<int>count(N);
    int output=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(S.at(j)==S.at(i)){
                count.at(i)++;
            }
        }
        for(int j=0;j<M;j++){
            if(T.at(j)==S.at(i)){
                count.at(i)--;
            }
        }
        if(count.at(i)>output){
            output=count.at(i);
        }
    }
    cout<<output<<endl;
    
    
    
    
    
        return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int cnt;

void insertionSort(vector<int> &a,int g){
	for(int i=g;i<a.size();i++){
		int v = a[i];
		int j = i - g;
		while(j>=0 && a[j]>v){
			a[j+g] = a[j];
			j = j - g;
			cnt++;
			a[j+g] = v;
		}
	}
}

void shellSort(vector<int> &a){
	vector<int>g;
	cnt = 0;
	for(int h=1;h<=a.size();h=3*h+1)g.push_back(h);
	reverse(g.begin(),g.end());
	int m = g.size();
	printf("%d\n",m);
	for(int i=0;i<g.size();i++)printf(i<g.size()-1?"%d ":"%d\n",g[i]);
	for(int i=0;i<m;i++)insertionSort(a,g[i]);
}

int main(){
	vector<int> a;
	int n,x;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&x),a.push_back(x);
	shellSort(a);
	printf("%d\n",cnt);
	for(int i=0;i<n;i++)printf("%d\n",a[i]);
}



Measured memory_bytes: 6520
import java.util.*;
class Main /*atcoder beginner contest 42*/{
	public static void main(String[] args) {
			
			Scanner s = new Scanner(System.in);
			int n = s.nextInt() , l = s.nextInt();
			ArrayList<String> str = new ArrayList<String>();

			for(int i = 0;i < n;i++){
				String line =  s.next();
				str.add(line);
			}

			Collections.sort(str);

			String ans = "";
			for(int i = 0;i < n;i++)
				ans += str.get(i);
			System.out.println(ans);
	}
}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    int n; cin >> n;
    set<int> s;
    rep(i, n) {
        int d; cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
using namespace std;
int main(){
	string card1, card2;
	int n,T,H;
	n = 0;
	T = 0;
	H = 0;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> card1 >> card2;
		if (card1 == card2){
			T += 1;
			H += 1;
		}
		else if (card1 > card2){
			T += 3;
		}
		else if (card1 < card2){
			H += 3;
		}
	}
	cout << T << " " << H << endl;
		return 0;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

VI numToBit(LL num){
    VI bits(20, 0);
    REP(i, 20) {
        bits[i] = ((num & (1LL << i)) != 0);
    }

    return bits;
}

void solve(long long N, std::vector<long long> A){
    A.PB(0);
    int l = 0, r = 0;

    VI memo(20, 0);
    LL ans = 0;
    while(l != N){
        // cout << "l: " << l << "  r:" << r << endl;
        // cout << "now: [";
        // REP(i, 20) cout << memo[i] << ", ";
        // cout << "]" << endl;
        if(l == r) {
            memo = numToBit(A[r]);
            r++;
            continue;
        }

        VI tmp = numToBit(A[r]);
        // cout << "tmp: [";
        // REP(i, 20) cout << tmp[i] << ", ";
        // cout << "]" << endl;
        bool flag = true;
        REP(i, 20) {
            if(memo[i] == 1 && tmp[i] == 1) {
                flag = false;
            }
        }
        if(r == N) flag = false;

        if(flag) {
            REP(i, 20) if(tmp[i] == 1) memo[i] = 1;
            r++;
        } else {
            ans += (r - l);
            VI tmp2 = numToBit(A[l]);
            REP(i, 20) if(tmp2[i] == 1) memo[i] = 0;
            l++;
        }
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
using namespace std;
 
int main(){
    int k; cin >> k;
    ll ans=0;
    rep(i,k){
        for(int j=i; j<k; j++){
            for(int p=j; p<k; p++){
                int factl=3;
                if(i!=j && i!=p && j!=p) factl=6;
                if(i==j && j==p) factl=1;
                ans+=gcd(gcd(i+1,j+1),p+1)*factl;
            }
        }
    }

    cout << ans << endl;
}

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

//mapを使わなくても制約より大きなベクトルを作り、その対応indexを増やすやり方で実装できる
const int MX=100005;

int main(){
    int n;
    cin >> n;
    //データの持ち方を値：その値を持つカウントという持ち方に変える
    //1回のクエリごとに変わるのは高々2箇所
    vector<ll> cnt(MX);
    rep(i,n){
        int a;
        cin >> a;
        cnt[a] ++;
    }

    ll total=0;
    rep(i,MX) total += i*cnt[i];

    int q;
    cin >> q;
    rep(i,q){
        int b, c;
        cin >> b >> c;
        total -= b*cnt[b];
        total -= c*cnt[c];
        cnt[c] += cnt[b];
        cnt[b] = 0;
        total += b*cnt[b];
        total += c*cnt[c];
        cout << total << endl;
    }



    

   

}

Measured memory_bytes: 4016
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<set>
using namespace std;
typedef long long ll;
#define in_ inline
#define re_ return
#define st_ static
#define op_ operator
#define gC() getchar()
#define fst first
#define snd second
#define mP(a, b) make_pair(a, b)
#define inc(l, i, r) for(i=l;   i<r;  ++i)
#define dec(l, i, r) for(i=r-1; i>=l; --i)
in_ ll mne(ll& a, ll b) {a<b?a=b:0;}

struct io
{
	ll r, c, s;
	in_ ll op_!(void)
	{
		for(r=s=0;(c=gC())<48||57<c;)
			if(c=='-') s=1;
		for(;c>47&&58>c; c=gC())
			r=10*r+c-48;
		re_ s?-r:r;
	}
	in_ io& op_&(char* a)
		{re_ scanf("%s", a), *this;}
	in_ io& op_&(ll& a)
		{re_ a=!*this, *this;}
	in_ io& op_^(ll a)
		{re_ printf("%lld", a), *this;}
	in_ io& op_^(const char* a)
		{re_ printf("%s", a), *this;}
} io;

const ll mxn=1<<17;
ll a[mxn];

int main()
{
	ll n, i, j, x=0;
	io &n;
	inc(0, i, n) io &a[i];
	sort(a, a+n);
	for(i=n-1; i>=0; i=j)
	{
		for(j=i-1; j>=0&&a[j]==a[i]; --j);
		if(x && i-j>1)
			re_ io ^x*a[i] ^"\n", 0;
		if(i-j>3)
			re_ io ^a[i]*a[i] ^"\n", 0;
		if(i-j>1) x=a[i];
	}
	io ^0ll ^"\n";
	re_ 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <cstring>
#include <algorithm>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)


using namespace std;

typedef long long ll;

int K;
char s[5005];
vector<string> v;
unordered_map<string, bool> om;


// 0 1 2 3 4

int main(void) {
	scanf("%s", s);
	string S = s;
	int n = strlen(s);
	scanf("%d", &K);

    for (char c = 'a'; c <= 'z'; c++) {
    	REP(i, 0, n) {
    		if (s[i] == c) {
    			REP(j, 1, min(n - i + 1, 6)) {
    				string subs = S.substr(i, j);
    				if (!om[subs]) {
    					v.push_back(subs);
    					om[subs] = true;
    				}

    			}
    		}
    		
    	}
    	if (v.size() > 5) break;

    }
    sort(v.begin(), v.end());
/*
    REP(i, 0, v.size()) {
    	cout << v[i] << endl;
    }
*/
    cout << v[K-1] << endl; 

	return 0;
}


Measured memory_bytes: 384
M = 1000000007
n = int(input())
if n == 1:
    print(0)
    exit(0)
a = pow(10, n, M)
b = 2 * (pow(9, n, M)) % M
c = pow(8, n, M)
ans = (a - b + c + M) % M
print(ans)

Measured memory_bytes: 61724
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;
int MOD = 1000000007;
ll nCk[60][60];
ll nck(int n, int k){
    if(k == 0 || n == k) return nCk[n][k] = 1;
    if(nCk[n][k] != 0) return nCk[n][k];
    return nCk[n][k] = nck(n-1,k-1) + nck(n-1,k);
}

signed main(){
    int n,a,b;
    cin >> n >> a >> b;
    nCk[50][50] = 1;
    nck(59,5);
    nck(59,30);
    nck(59,57);
    nck(59,45);
    nck(59,40);
    nck(59,52);
    nck(59,10);
    nck(59,15);
    nck(59,20);
    nck(59,25);
    nck(59,35);


    vector<int> v(n);
    rep(i,n) cin >> v[i];
    sort(v.begin(), v.end(), greater<int>());
    int s = 0;
    rep(i,a) s += v[i];
    double m = s/(a*1.0);
    printf("%.10lf\n",m);
    int cnt_a = 0;
    rep(i,n){
        if(v[a-1] == v[i])cnt_a++;
    }
    int ans = 0;
    if(v[0] == v[a-1]){
        for(int i = a-1;i < b && v[i] == v[0];i++){
            ans += nCk[cnt_a][i+1];
            //cerr << "nCk[cnt_a][i+1] " << cnt_a << " " << i+1 << " => " << nCk[cnt_a][i+1] << endl;
        }
        cout << ans << endl;
        // cerr << "E1 "<< cnt_a << " " << endl;
        return 0;
    }
    int cnt = 0;
    rep(i,a-1){
        if(v[i] != v[a-1])cnt++;
    }
    ans += nCk[cnt_a][a-cnt];
    cout << ans << endl;
    // cerr << "E2 "<< cnt_a << " " << cnt << endl;
    // //cerr << nCk[3][1] << endl;
    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://arc060.contest.atcoder.jp/tasks/arc060_a

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
	string s;
	cin >> s;
	if (s == "ABC") cout << "ARC" << endl;
	else if (s == "ARC") cout << "ABC" << endl;
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
long long a[1010];
int main()
{
	int n,m;
	cin>>n>>m;
	long long cnt=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		a[i]*=4*m;
		cnt+=a[i];	
	} 
	long long comp=cnt/(4*m);
	long long num=n;
	for(int i=1;i<=n;i++)
		if(a[i]<comp)
			num--;
	if(num>=m)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");
#define random rand() ^ (rand() << 5)

const int N = (int)8000 + 7;
const int inf = (int)1e9 + 7;

int shift = 8002;

bitset < N + N > dpx, dpy;
vector < int > dx, dy;

main() {
	string s;
	int x, y;
	cin >> s;
	int n = sz(s);
	scanf("%d %d", &x, &y);
	int res = 0;
	bool fl = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'T') {                           	
			if (!fl) {
				dx.pb(res);
			} else {
				dy.pb(res);
			}
			res = 0;
			fl ^= 1;
		} else {
			res++;
		}
	}
	if (!fl) {
		dx.pb(res);		
	} else {
		dy.pb(res);
	}
	dpx[shift] = 1;
	dpy[shift] = 1;
	dpx = (dpx << dx[0]);
	for (int i = 1; i < sz(dx); i++) {
		int to = dx[i];
		dpx = (dpx >> to) | (dpx << to);
	}
	for (int to : dy) {
		dpy = (dpy >> to) | (dpy << to);
	}
	if (dpx[x + shift] && dpy[y + shift]) {
		puts("Yes");
	} else {
		puts("No");
	}
}



Measured memory_bytes: 256
n=int(input())+1;a=list(map(int,input().split()));d,A,q=[0]*n,0,0
for i in range(n-1):
    q+=(a[i]+1)//n;d[(a[i]+1)%n]+=1
A=q*n
for r in range(1,n):
    q+=d[n-r]-1;A=min(A,max(q,0)*n+r)
print(A)

Measured memory_bytes: 3064
/*
  Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
  Author - Aryan Choudhary (@aryanc403)
 
  const short DEBUG { 0 };
  #define debug(x) if (DEBUG) cout << #x << " = " << x << '\n'
*/

#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"
#define PI 3.1415926535897932384626433832795
typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

//const lli [3] ={ 999119999L,1000000007L,1000992299L};
//const lli [3] ={ 97L,101L,103L};
//const lli  = chrono::high_resolution_clock::now().time_since_epoch().count();
clock_t time_p=clock();
void aryanc403()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

class CMP
{
public:
    bool operator()(lli a , lli b) //For min priority_queue .
    {
        return ! ( a <= b );
    }
};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt==m.end())         m.insert(mp(x,cnt));
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}
const lli INF = 0xFFFFFFFFFFFFFFFL;
const lli mod = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r;
    lli m;
    string s;
    vi a;
    vi :: iterator it;
    //priority_queue < lli , vector < lli > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    cout<<n+m/2<<endl;
    exit(0);
    a.clear();a.reserve(n);
    
    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }
    
}   aryanc403();
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  cin >> n;
  while(n--) {
    int a[10];
    REP(i,10) {
      cin >> a[i];
    }
    int i;
    for (i=0; i<(1<<10); i++) {
      int s=0,t=0;
      int j;
      for (j=0; j<10; j++) {
        if (1&(i>>j)) {
          if (a[j]>s)
            s=a[j];
          else
            break;
        } else {
          if (a[j]>t)
            t=a[j];
          else
            break;
        }
      }
      if (j==10) break;
    }
    if (i!=(1<<10))
      cout << "YES" << endl;
    else
      cout <<"NO" <<endl;
  }
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> A[i];
    }

    vector<ll> v(N);
    ll s = N / 2;
    ll n = 1;
    v[s] = A[0];
    if (N % 2 == 0) {
        REP(i, N - 1) {
            if (i % 2 == 0)
                v[s - n] = A[i + 1];
            else {
                v[s + n] = A[i + 1];
                n++;
            }
        }
    }
    else {
        REP(i, N - 1) {
            if (i % 2 == 0)
                v[s + n] = A[i + 1];
            else {
                v[s - n] = A[i + 1];
                n++;
            }
        }
    }

    REP(i, N) {
        cout << v[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<ll, ll>;

template<typename T>
class SWAG{
  private:

  std::function<T(T,T)> fn;

  std::stack<T> front,back;
  std::vector<T> front_fold,back_fold;

  T id;

  public:

  SWAG(T id_,std::function<T(T,T)> fn_):id(id_),fn(fn_),front_fold(1,id_),back_fold(1,id_){}

  void push(T val){
    back.push(val);
    back_fold.push_back(fn(back_fold.back(),val));
  }

  void pop(){
    if(front.empty()){
      assert(front_fold.size()==1);
      while(!back.empty()){
        T temp=back.top();
        back.pop();
        back_fold.pop_back();

        front.push(temp);
        front_fold.push_back(fn(temp,front_fold.back()));
      }
    }

    assert(!front.empty());

    front.pop();
    front_fold.pop_back();
    
  }

  T fold_all(){
    return fn(front_fold.back(),back_fold.back());
  }
};

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

  ll n,m;
  std::cin>>n>>m;

  std::string s;
  std::cin>>s;

  SWAG<P> swag({MOD,MOD},[](P a,P b){return std::min<P>(a,b);});

  std::vector<P> dp(n+1,{MOD,MOD});

  dp[n]={0,0};
  swag.push({0,n});

  for(ll i=n-1;i>=0;i--){
    if(s[i]=='0'){
      P temp=swag.fold_all();
      dp[i]={temp.first+1,temp.second-i};
    }

    swag.push({dp[i].first,i});
    if(i<=n-m)swag.pop();
  }

  if(dp[0].first>=MOD){
    std::cout<<-1<<"\n";
    return 0;
  }

  ll now=0;

  while(now!=n){
    std::cout<<dp[now].second;
    now+=dp[now].second;
    if(now!=n)std::cout<<" ";
  }

  std::cout<<"\n";

  return 0;
}

Measured memory_bytes: 8048
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
#define mod 1e9+7
typedef long long ll;

void Main()
{
	int a,b,c;
  	cin >> a >> b >> c;
  	if(b-a == c-b){
		puts("YES");
    }
  else{puts("NO");}
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl; 
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF =0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a,LL b){LL s=1;while(b>0){if(b&1)s=s*a%mod;a=a*a%mod;b>>=1;}return s;}
LL gcd(LL a,LL b) {return b?gcd(b,a%b):a;}
int dr[2][4] = {1,-1,0,0,0,0,-1,1};
typedef pair<int,int> P;
int main(void)
{
	int k,x;
   cin>>k>>x;
   for(int i =x-k+1;i <= x+k-1;++i )
   	cout<<i<<" ";

   return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repp(i,n,s) for (int i= (int)(n); i >= (int)(s); i--)
#define mp make_pair
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> a(n);
    rep(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    int ans = a[n/2]-a[n/2-1];
    cout<<ans<<endl;
}

Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        char[] s = sc.next().toCharArray();

        for (int i = 0; i < s.length; i++) {
            int num = s[i] - 'A';
            s[i] = (char) ((num + N) % 26 + 'A');
            System.out.print(s[i]);
        }

    }
}

Measured memory_bytes: 25684
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 n,x,t;
cin >> n >> x >> t;
i32 tako = 0;
i32 mini = 0;
while(1){
    tako += x;
    mini += t;
    if(tako >= n)break;
}
cout << mini << endl;
}

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main{
	public static void main(String[] args)throws Exception {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(a == b && a != c) {
			System.out.println("Yes");
		}else if(a == c && a != b){
			System.out.println("Yes");
		}else if(b == c && a != b){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		scan.close();
	}
}

Measured memory_bytes: 27056
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 510000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> H >> W;
  if(H==1||W==1)Out(1);
  else if(H&1&&W&1)Out(H*W/2+1);
  else Out(H*W/2);
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath> 
#include<iostream> 
#include<iomanip>
#include<string>
#include<algorithm>
using namespace std;
int n,i=0,ans=0;
int main()
{
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	cin>>n;
	while(i*7<=n)
	{
		if((n-i*7)%4==0)
			ans++;
		i++;
	}
	if(ans==0)
		cout<<"No";
	else
		cout<<"Yes";
	//fclose(stdin);
	//fclose(stdout);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
const int MAXN = 1e5 + 5;

int n, tot;
char str[10];

int main() {
  while (~scanf("%s", str)) {
    puts(str[0] == str[2] ? "Yes" : "No");
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin>>a[i];

    ll res=0;
    int right=0;
    int sum=0;
    for(int left=0;left<n;left++){
        while(right<n && (sum^a[right])==(sum+a[right])){
            sum+=a[right];
            ++right;
        }
        res += right - left;
        if(left==right) ++right;
        else sum-=a[left];
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();


int main(){
  int n,k;
  cin >> n>>k;
  //kの何条で割れるか

  int count = 1;
  while (n >= k)
  {
    n = n / k;
    count++;
  }
  cout << count << endl;
}



Measured memory_bytes: 384