akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int, int>P;

P p[500000];
int calc(P*a, int n) {
	if (n == 1)return INT_MAX;
	int x = a[n / 2].first;
	int d = min(calc(a, n / 2), calc(a + n / 2, n - n / 2));
	inplace_merge(a, a + n / 2, a + n, [](const P&a, const P&b) {return a.second < b.second; });
	rep(i, n) {
		if (abs(a[i].first - x)*abs(a[i].first - x) >= d)continue;
		for (int j = i + 1; j < n; j++) {
			int dx = a[i].first - a[j].first;
			int dy = a[j].second - a[i].second;
			if (dy*dy >= d)break;
			d = min(d, dx*dx + dy*dy);
		}
	}
	return d;
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d%d", &p[i].first, &p[i].second);
	sort(p, p + n);
	printf("%d\n", calc(p, n));
}

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

void permute(string s, int low, int high, vector <string>& arr){
    if(low == high){
        arr.push_back(s);
    }
    for(int i = low; i <= high; i++){
        swap(s[i], s[low]);
        permute(s, low+1, high, arr);
        swap(s[i], s[low]);
    }
}

int find(vector <string> arr, int low, int high, string target){
    while(low <= high){
        int mid = (low+high)/2;
        if(arr[mid] == target){
            return mid;
        }
        else if(arr[mid] > target){
            high = mid-1;
        }
        else{
            low = mid+1;
        }
    }
    return -1;
    
}

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

    int n;
    cin >> n;
    string s = "", x = "", y = "";
    for(int i = 0; i < n; i++){
        int num;
        cin >> num;
        s += ((i+1) + '0');
        x += (num + '0'); 
    }
    for(int i = 0; i < n; i++){
        int num;
        cin >> num;
        y += (num + '0');
    }
    vector <string> arr;
    permute(s, 0, n-1, arr);
    sort(arr.begin(), arr.end());
    int pos1 = find(arr, 0, arr.size()-1, x);
    int pos2 = find(arr, 0, arr.size()-1, y);
    cout << abs(pos1-pos2) << endl;
}

Measured memory_bytes: 2808
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int pond[12][12];

int main(){
	int d,w;
	while(1){
		cin >> d >> w;
		if(d + w == 0) break;
		for(int i = 0;i < d;i++){
			for(int j = 0;j < w;j++){
				cin >> pond[i][j];
			}
		}
		int ans = 0;
		for(int y1 = 0;y1 < d;y1++){
			for(int y2 = y1 + 2;y2 < d;y2++){
				for(int x1 = 0;x1 < w;x1++){
					for(int x2 = x1 + 2;x2 < w;x2++){
						int minsell = pond[y1][x1];
						for(int i = x1;i <= x2;i++){
							minsell = min(minsell,min(pond[y1][i],pond[y2][i]));
						}
						for(int i = y1;i <= y2;i++){
							minsell = min(minsell,min(pond[i][x1],pond[i][x2]));
						}
						int sum = 0,flag = 0;
						for(int i = y1+1;i < y2;i++){
							for(int j = x1+1;j < x2;j++){
								if(pond[i][j] >= minsell){
									flag = 1;
								}else{
									sum += minsell - pond[i][j];
								}
							}
						}
						if(flag == 1) continue;
						ans = max(ans,sum);
					}
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3104
n = int(input())
a = list(map(int, input().split()))

if n == 2:
    a = sorted(a)
    print(a[1], a[0])
    exit()

max_a = max(a)
M = max_a // 2
min_diff = float('inf')
r = 0
for i in range(n):
    if abs(a[i] - M) < min_diff:
        min_diff = abs(a[i] - M)
        r = a[i]

print(max_a, r)


Measured memory_bytes: 14428
#pragma region header
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
#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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 2000000000;
const int MINF=-2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll kind(vi SYURUI) {//vector<int>型の配列の要素の種類数
    int size = SYURUI.size();
    sort(all(SYURUI));
    int cnt = 1;
    rep(i, size-1) {
        if (SYURUI[i] != SYURUI[i + 1])cnt++;
    }
    return cnt;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int A, B, C; cin >> A >> B >> C;
    cout << max(C - (A - B), 0LL) << endl;
}




Measured memory_bytes: 3672
#include<iostream>
#include<cstdlib>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<cctype>

using namespace std;

int main(){
  int m;
  cin>>m;
  map<string,set<unsigned char> > mp;
  while(m--){
    string name;
    int lb,ub;
    cin>>name>>lb>>ub;
    set<unsigned char> s;
    for(int i=lb;i<=ub;i++){
      s.insert(i);
    }
    mp[name]=s;
  }
  int n;
  cin>>n;
  bool zd=false;
  stack<set<unsigned char> > s;
  while(n--){
    string e;
    cin>>e;
    if(isdigit(e[0])){
      s.push({(unsigned char)atoi(e.c_str())});
    }else if(isalpha(e[0])){
      s.push(mp[e]);
    }else{
      auto b=s.top();
      s.pop();
      auto a=s.top();
      s.pop();
      set<unsigned char> r;
      for(auto aa:a){
	for(auto bb:b){
	  if(e[0]=='/'&&bb==0){
	    zd=true;
	  }else{
	    if(e[0]=='+'){
	      r.insert(aa+bb);
	    }else if(e[0]=='-'){
	      r.insert(aa-bb);
	    }else if(e[0]=='*'){
	      r.insert(aa*bb);
	    }else{
	      r.insert(aa/bb);
	    }
	  }
	}
      }
      s.push(r);
    }
  }
  cout<<(zd?"error":"correct")<<endl;
}

Measured memory_bytes: 1420
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int n,x;
    cin>>n>>x;
    int l[n];
    int ans=1;
    int d=0;
    rep(i,0,n-1) cin>>l[i];
    rep(i,0,n-1){
        d += l[i];
        if(d<=x) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val m = sc.nextInt()

  val tle = 1900L

  val nm = n - m
  val nmTime = nm.toLong() * 100L
  val mTime = m.toLong() * tle
  val sum = nmTime + mTime

  val c = Math.pow(2.0, m.toDouble()).toLong()

  println(sum * c)

}


Measured memory_bytes: 36380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
int main(int argc, char* argv[]) {
    char c;
    cin >> c ;
    cout << (char)(c + 1) << endl;
    return 0;
}


Measured memory_bytes: 256
//This code was made by Chinese_zjc_
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
inline int rd(int &ddd)
{
	char tmp=getchar();
	int xxx=1;
	ddd=0;
	while(('0'>tmp||tmp>'9')&&tmp!='-'&&tmp!=EOF)
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	if(tmp=='-')
	{
		xxx=-1;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		ddd=(ddd<<3)+(ddd<<1)+(tmp^48);
		tmp=getchar();
	}
	return ddd*=xxx;
}
inline char rd(char &ddd)
{
	char tmp=getchar();
	while(tmp==' '||tmp=='\n')
	{
		tmp=getchar();
	}
	if(tmp==EOF)
	{
		return EOF;
	}
	return ddd=tmp;
}
inline int max(const int &A,const int &B)
{
	return A<B?B:A;
}
inline int min(const int &A,const int &B)
{
	return A<B?A:B;
}
int n,a[100005],x,ans;
signed main()
{
	rd(n);
	for(int i=1;i<=n+1;++i)
	{
		rd(a[i]);
	}
	for(int i=1;i<=n;++i)
	{
		rd(x);
		ans+=min(a[i],x);
		x-=min(a[i],x);
		ans+=min(a[i+1],x);
		a[i+1]-=min(a[i+1],x);
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    bool x=true;
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        if(a[i]%2==0){
            if(a[i]%6!=0 && a[i]%10!=0)
                x=false;
        }
    }
    if(x==true)
        printf("APPROVED\n");
    else
        printf("DENIED\n");
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, a, b, f = 0, i, j;
    vector <int> v, w;
    
    scanf("%d %d %d", &n, &a, &b);
    
    if (a + b > n + 1) {
        puts("-1");
        return 0;
    }
    
    if (a > b) {
        swap(a, b);
        f = 1;
    }
    
    for (i = n - a + 1; i <= n; i++) v.push_back(i);
    for (i = 1; i <= n - a; i++) w.push_back(i);
    
    while (--b) {
        if (w.size() < b) {
            puts("-1");
            
            return 0;
        }
        
        if (w.size() == b) {
            while (w.size() > 0) {
                v.push_back(w.back());
                w.pop_back();
            }
            break;
        }
        
        for (i = a; i >= 1; i--) {
            if (w.size() >= b + i - 1) break;
        }
        
        if (i == 0) {
            puts("-1");
            
            return 0;
        }
        
        for (j = w.size() - i; j < w.size(); j++) v.push_back(w[j]);
        for (j = 0; j < i; j++) w.pop_back();
    }
    
    if (w.size() > 0) {
        puts("-1");
        
        return 0;
    }
    
    if (f == 1) reverse(v.begin(), v.end());
    
    for (i = 0; i < v.size(); i++) {
        if (i > 0) putchar(' ');
        printf("%d", v[i]);
    }
    puts("");
    
    return 0;
}


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

int main() {
	set<int> S;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int d;
		cin >> d;
		S.insert(d);
	}
	cout <<S.size()<< endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	long long n,m,a,b=0,i,j,k,s=0,c=1,d[10010]={};
	scanf("%lld %lld %lld",&n,&a,&m);
	for(i=0;i<n;i++){
		scanf("%lld",&k);
		for(j=i;j&&d[j-1]<k;j--)d[j]=d[j-1];
		d[j]=k;
	}//for(i=0;i<n;i++)printf("%lld ",d[i]);printf("\n");
	for(i=0;i<a;i++)s+=d[i];
	for(j=0;d[i-1]-d[j];j++);
	for(k=j;d[i-1]==d[k];k++);//printf("%lld %lld %lld\n",i,j,k);
	i=i-j;
	j=k-j;//printf("%lld %lld\n",i,j);
	if(d[0]==d[a-1])i=m+1;
	for(n=0;n<i;n++){
		if(n>=a)b+=c;
		c*=j-n;//printf("%lld ",c);
		c/=n+1;//printf("%lld\n",c);
	}
	printf("%f\n%lld\n",1.0*s/a,d[0]-d[a-1]?c:b);
	return 0;
}

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

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 20004;

int n;
int p[N];
int idx[N];
int a[N], b[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i];
		idx[p[i]] = i;
	}
	for (int i = 1; i <= n; i++) {
		a[i] = i * n;
		b[i] = (n - i + 1) * n + idx[i];
	}
	for (int i = 1; i <= n; i++)
		cout << a[i] << " \n"[i == n];
	for (int i = 1; i <= n; i++)
		cout << b[i] << " \n"[i == n];
	return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int N=10;
int n,f[N][N][N][N],a[N];
int dp(int i,int full,int sum1,int sum2,int sum3,int have0)
{
	if(f[i][sum1][sum2][sum3]!=-1&&!full&&!have0) return f[i][sum1][sum2][sum3];
	if(!i)
	{
		if(sum1&&sum2&&sum3) return 1;
		else return 0;
	}
	int end=full?a[i]:9,sum=0;
	for(int j=0;j<=end;j++)
	{
		if(j==0&&have0) sum+=dp(i-1,full&(end==0),sum1,sum2,sum3,1);
		else if(j==3) sum+=dp(i-1,full&(end==3),sum1+1,sum2,sum3,0);
		else if(j==5) sum+=dp(i-1,full&(end==5),sum1,sum2+1,sum3,0);
		else if(j==7) sum+=dp(i-1,full&(end==7),sum1,sum2,sum3+1,0);
	}
	if(!full&&!have0) f[i][sum1][sum2][sum3]=sum;
	return sum;
}
int calc(int x)
{
	memset(f,-1,sizeof(f));
	int t=0;
	while(x) a[++t]=x%10,x/=10;
	return dp(t,1,0,0,0,1);
}
int main()
{
	scanf("%d",&n);
	printf("%d",calc(n));
	return 0;
}

Measured memory_bytes: 3268
nm = list(map(int,input().split()))
n=nm[0]
m=nm[1]
a = [0 for i in range(n)]
for i in range(n):
    a[i]=list(map(int,input().split()))
b = [[0 for i in range(m+1)] for i in range(n)]
for i in range(n):
    for j in range(1,len(a[i])):
        b[i][a[i][j]] = 1
c = [1 for i in range(m)]
for i in range(n):
    for j in range(m):
        c[j] = c[j]*b[i][j+1]
print(sum(c))


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

using namespace std;

const int INF = 1000000000;

int solve(const int n, const int c, const vector<int>& v) {
    vector<int> dp(c + 1, INF);
    dp[0] = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= c; j++) {
            if (j >= v[i] && dp[j - v[i]] != INF) {
                dp[j] = min(dp[j], dp[j - v[i]] + 1);
            } 
        }
    }
    
    return dp[c];  
}


int main() {
    int n, c;
    cin >> c >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    int ans = solve(n, c, v);
    cout << ans << endl;
}

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

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] line = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();

            if (line[0] < line[1] && line[1] < line[2])
            {
                Console.WriteLine("Yes");
            } else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 16312
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1) / d << endl;



}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> kitai(n),dp(n-k+1);
    double ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        kitai.at(i)=(a+1);
    }
    for(int i=0;i<k;i++){
        dp.at(0)+=kitai.at(i);
    }
    ans=dp.at(0);
    if(n-k+1!=1){
        for(int i=1;i<n-k+1;i++){
            dp.at(i)=dp.at(i-1)+kitai.at(i+k-1)-kitai.at(i-1);
            if(ans<dp.at(i))ans=dp.at(i);
        }
    }
    double ansss=(double)ans/(double)2;
    printf("%.10f\n",ansss);
    return 0;
}


Measured memory_bytes: 4744
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
s = len(input())
dp = [0] * (n + 2)
dp[0] = 1
for i in range(1, n + 1):
    ndp = [0] * (n + 2)
    for j in range(n + 1):
        if j:
            ndp[j] = (dp[j - 1] * 2 + dp[j + 1]) % mod
        else:
            ndp[j] = (dp[j] + dp[j + 1]) % mod
    dp = ndp


print(dp[s] * pow(pow(2, s, mod), mod - 2, mod) % mod)


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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;
const int K = 500;
const int maxN = 2e4 + 1;


void solve() {
	int n, m;
	cin >> n >> m;
	string s;
	cin >> s;
	vector<int> p(n + 1);
	queue<int> q;
	q.push(0);
	for (int l = 0, r = 1; r <= n; r++) {
		if (r - l > m) {
			if (s[l] == '0') q.pop();
			l++;
		}
		if (q.empty()) {
			cout << -1;
			return;
		}
		p[r] = q.front();
		if (s[r] == '0') q.push(r);
	}

	int now = n;
	vector<int> ans;
	while (now) {
		ans.pb(now - p[now]);
		now = p[now];
	}
	reverse(all(ans));
	for (int i : ans) cout << i << " ";
}
	

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 2248
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

const int N = 1000;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int cost[N][N];
char m[N][N];
class st{
public:
  int y,x;
};

int bfs(int sy,int sx,int r,int c,char tar){
  queue<st> Q;
  rep(i,r){
    rep(j,c)cost[i][j]=-1;
  }
  cost[sy][sx]=0;
  Q.push((st){sy,sx});
  while(!Q.empty()){
    st now = Q.front();Q.pop();
    int nc=cost[now.y][now.x];
    if (m[now.y][now.x] == tar){
      return nc;
    }
    rep(i,4){
      int nex=now.x+dx[i],ney=now.y+dy[i];
      if (nex == -1 || ney == -1 || nex == c || ney == r ||
	  m[ney][nex] == 'X' || cost[ney][nex] != -1)continue;
      cost[ney][nex]=nc+1;
      Q.push((st){ney,nex});
    }
  }
  return -1;
}

main(){
  int r,c,n;
  while(cin>>r>>c>>n ){
    rep(i,r){
      cin>>m[i];
    }
    int sx[n],sy[n];
    const string tar="123456789";
    rep(i,r){
      rep(j,c){
	if (m[i][j] == 'S'){
	  sx[0]=j;
	  sy[0]=i;
	}else if (isdigit(m[i][j]) && m[i][j]-'0' != n){
	  sx[m[i][j]-'0']=j;
	  sy[m[i][j]-'0']=i;
	}
      }
    }

    int ans=0;
    rep(i,n){
      int tmp=bfs(sy[i],sx[i],r,c,tar[i]);
      //cout <<i <<" " << tmp << " " << sy[i] <<" " <<
      //sx[i] <<" " << tar[i] << endl;
      ans+=tmp;
    }
    cout << ans << endl;
  }
  return false;
}

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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

struct Node {
    int v, l, r;
    Node() {}
    Node(int v, int l, int r) : v(v), l(l), r(r) {}
};

//---------------------------------------------------------------------------------------------------

vector<int> pars;
vector<Node> tree;

void preoder(int p) {
    // dfs
    if (p < 0) {
        return;
    }
    cout << " " << p;
    auto n = tree[p];
    preoder(n.l);
    preoder(n.r);
}

void inorder(int p) {
    if (p < 0) {
        return;
    }
    // 左
    auto n = tree[p];
    inorder(n.l);
    // 自身
    cout << " " << p;
    // 右
    inorder(n.r);
}

void postorder(int p) {
    if (p < 0) {
        return;
    }
    // 左、右
    auto n = tree[p];
    postorder(n.l);
    postorder(n.r);
    // 自身
    cout << " " << p;
}

signed main() {
    int N;
    cin >> N;
    tree.resize(N);
    pars.resize(N, -1);
    rep(i, 0, N) {
        int p, l, r;
        cin >> p >> l >> r;
        Node node(p, l, r);
        tree[p] = node;
        if (l >= 0) {
            pars[l] = p;
        }
        if (r >= 0) {
            pars[r] = p;
        }
    }

    int root = -1;
    rep(i, 0, N) {
        if (pars[i] == -1) root = i;
    }

    cout << "Preorder\n";
    preoder(root);
    cout << "\n";

    cout << "Inorder\n";
    inorder(root);
    cout << "\n";

    cout << "Postorder\n";
    postorder(root);
    cout << "\n";
}



Measured memory_bytes: 3188
N, M = map(int, input().split())
A = list(sorted(map(int, input().split())))

operation = [list(map(int, input().split())) for _ in range(M)]
operation = list(sorted(operation, key=lambda x: -x[1]))

p = 0
b = operation[p][0]
c = operation[p][1]
for i in range(N):
    if b == 0:
        p += 1
        if p >= M:
            break
        b = operation[p][0]
        c = operation[p][1]

    A[i] = max(A[i], c)
    b -= 1

print(sum(A))


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

int main(void){
	string s1,s2;
	cin>>s1>>s2;
	for(int L=min(s1.size(),s2.size());L>=1;L--){
		vector<int> a(26),b(26);
		set<vector<int>>st;
		rep(i,L)a[s1[i]-'a']++;
		rep(i,4000){
			st.insert(a);
			if(i+L==(int)s1.size())break;
			a[s1[i]-'a']--;
			a[s1[i+L]-'a']++;
		}

		rep(i,L)b[s2[i]-'a']++;
		rep(i,4000){
			if(st.find(b)!=st.end()){
				cout<<L<<endl;
				return 0;
			}
			if(i+L==(int)s2.size())break;
			b[s2[i]-'a']--;
			b[s2[i+L]-'a']++;			
		}
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 3824
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
#define watch(x) cout << (#x)<<" = "<<x<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, m, k; cin >> n >> m >> k;
	vi A(n), B(m);
	vector<ll> pre(m);
	for (auto& it : A) cin >> it;
	for (auto& it : B) cin >> it;
	pre.front() = B.front();
	for (int i = 1; i < m; i++)
		pre[i] = B[i] + pre[i - 1];
	int ans = 0;
	int tmp = k;
	for (int i = 0; i <= n; i++) {
		if (i) {
			tmp -= A[i - 1];
			if (tmp < 0) break;
		}
		int start = 0, end = m - 1, mid, gt = 0;
		while (start <= end) {
			mid = (start + end) / 2;
			if (pre[mid] <= tmp) {
				gt = mid + 1;
				start = mid + 1;
			}
			else
				end = mid - 1;
		}
		ans = max(ans, i + gt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6360
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
typedef long long LL;
const int e[40]={0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,
               5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8};
const LL UnUseMethod=5e8;
LL count[2]={0};
LL IN(void)
{
  LL x=0;short f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
LL GCD(LL a,LL b){return !b?a:GCD(b,a%b);}
LL Mult(LL x,LL y,LL mod)
{LL temp=x*y-(LL)((long double)x/mod*y+1e-8)*mod;return temp<0?temp+mod:temp;}
LL BinaryModularPower(LL base,LL pow,LL mod)
{
  LL x=1;
  while(pow){if(pow&1){x=Mult(x,base,mod);}base=Mult(base,base,mod);pow>>=1;}
  return x;
}
LL f(LL x,LL mod,LL c){return (Mult(x,x,mod)+c)%x+1;}
void Exp(LL x,LL y){count[1]=0;while(!(x%y)){count[1]++;x/=y;}count[0]=x;return;}
int MillerRabin(const LL a)
{
  if(a==2)return 1;
  if(a%2==0||a==1)return 0;
  static int pr[7]={2,325,9375,28178,450775,9780504,1795265022};
  LL u=a-1,t=0,p=1;
  while(!(u&1)){u>>=1;t++;}
  for(int i=0;i<7;++i)
  {
    p=pr[i]%a;
    if(!p)return 1;
    LL x=BinaryModularPower(p,u,a);
    if(x==1)continue;
    for(int j=0;x!=a-1&&j<t;++j)
    {
      x=Mult(x,x,a);
      if(x==1)return 0;
    }
    if(x==a-1)continue;
    return 0;
  }
  return 1;
}
LL PollardRho(LL n,LL a)
{
  srand((unsigned int)time(NULL));
  LL x=rand()%n,y=x,gcd=1,k=0,i=1;
  while(gcd==1)
  {
    k++;
    x=Mult(x,x,n)+a;if(x>=n)x-=n;
    gcd=GCD(x>y?x-y:y-x,n);
    if(k==i){y=x;i<<=1;}
  }
  if(gcd==n)return PollardRho(n,a+1);
  return gcd;
}
int main(void)
{
  LL a=0,p=1,q=-1,N=IN();
  if(N<=1)return puts("0"),0;
  Exp(N,2);a=e[count[1]];N=count[0];
  Exp(N,3);a+=e[count[1]];N=count[0];
  while(q*q<=UnUseMethod)
  {
    p+=6,q+=6;
    Exp(N,p);a+=e[count[1]];N=count[0];
    Exp(N,q);a+=e[count[1]];N=count[0];
  }
  if(N<=UnUseMethod){if(N>1){a++;}return printf("%lld\n",a),0;}
  if(MillerRabin(N)){a++;return printf("%lld\n",a),0;}
  while(N>=UnUseMethod)
  {
    p=PollardRho(N,0);
    while(!MillerRabin(p))p=PollardRho(p,p);
    Exp(N,p);a+=e[count[1]];N=count[0];
  }
  if(MillerRabin(N)){a++;}return printf("%lld\n",a),0;
}

Measured memory_bytes: 1604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF MOD
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int k;
    cin >> k;
    Int n = 7;
    int ans = 0;
    rep(i,1e8)
    {
        ans++;
        if (n % k == 0)
        {
            cout << ans << endl;
            return 0;
        }
        n = n * 10 + 7;
        n %= k;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define ll long long
#define xmod 1000000007
using namespace std;

int ct[1000005],s,ans;
int main(){
	scanf("%d",&s); ans=1;
	while (ct[s] != 1){
		ct[s]+=1;
		ans+=1;
		if (s%2 == 0 )
		s/=2;
		else
		s=s*3+1;
	}
	printf("%d\n",ans);
    return 0;
}
//3 4 5 6 7

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
struct K {
	int R, A, W, T;
	bool operator<(const K &right)const {
		return R + T < right.R + right.T;
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<K> A(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i].R >> A[i].A >> A[i].W >> A[i].T;
	}


	sort(A.rbegin(), A.rend());
	vector<int> dp(4001, 0);
	int INF = (int)1 << 60;
	for (int i = 0; i < N; i++) {
		vector<int> ndp(4001, -INF);
		for (int j = 0; j <= 4000; j++) {
			if (j + A[i].R + A[i].T > 4000 && j + A[i].R <= 4000) {
				ndp[j + A[i].R] = max(ndp[j + A[i].R], dp[j] + A[i].A);
			}
		}

		for (int j = 0; j <= 4000; j++) {
			if(j > 0)dp[j] = max(dp[j], dp[j - 1]);
			if(j - A[i].R >= 0)ndp[j] = max(ndp[j], ndp[j - A[i].R] + A[i].W);
			dp[j] = max(dp[j], ndp[j]);
		}

	}
	cout << dp.back() << endl;
}


Measured memory_bytes: 3348
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  int N,K,Q;
  cin>>N>>K>>Q;

  int A[N]={};
  rep(i,Q){
    int a;
    cin>>a;
    ++A[a-1];
  }

  rep(i,N){
    if(K-Q+A[i]>0) cout<< "Yes"<<"\n";
    else cout<< "No"<<"\n";
  }


}

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


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

using namespace std;

typedef long long ll;

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

  string s;
  cin >> s;
  for (int i = 0; i < 12; i++) {
    cout << s[i];
    if (i == 3) {
      cout << " ";
    }
  }
  cout << "\n";

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int LL;

LL N, A, B, h[100000];

int test(int r) {
  LL t = 0;
  REP(i, N) {
    if(h[i] > r * B) {
      t += (h[i] - r * B - 1) / (A - B) + 1;
    }
  }
  return t <= r;
}
 
int main(){
  cin >> N >> A >> B;
  LL hmax = 0;
  REP(i, N) {
    cin >> h[i];
    if(hmax < h[i]) {
      hmax = h[i];
    }
  }
  int rmax = hmax / B + 1, rmin = hmax / A;
  while(rmax - rmin > 0) {
    int mid = rmin + (rmax - rmin) / 2;
    if(test(mid)) {
      rmax = mid;
    } else {
      rmin = mid + 1;
    }
  }
  cout << rmin << endl;
}

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

using namespace std;

int check(int,int,int,int);
char S[50][50];

int main(){
	int H,W,flag=0;
	cin >> H >> W;
	for(int j=0;j<W;j++){
		for(int i=0;i<H;i++){
			cin >> S[i][j];
		}
	}
	for(int j=0;j<W;j++){
		for(int i=0;i<H;i++){
			if(S[i][j]=='#'){
				if(check(i,j,H,W)==0){
					flag=1;
				}
			}
		}
	}
	
	if(flag==0){cout << "Yes" << endl;}
	else{cout << "No" << endl;}
	return 0;
}
int check(int i,int j,int H,int W){
	int o=0;
	if(i!=0){
		if(S[i-1][j]=='#'){
			o=1;
		}
	}
	if(j!=0){
		if(S[i][j-1]=='#'){
			o=1;
		}
	}
	if(i!=H){
		if(S[i+1][j]=='#'){
			o=1;
		}
	}
	if(j!=W){
		if(S[i][j+1]=='#'){
			o=1;
		}
	}
	return o;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
ll ways[200005];
vector< pair<ll, ll> > seg;
int main()
{
	ll n, k, i, j, x, y;
	cin >> n >> k;
	seg.push_back( make_pair(0, 0) );
	for(i=1; i<=k; i++){
		cin >> x >>y;
		seg.push_back( make_pair(x, y) );
	}

	memset(ways, 0, sizeof(ways));
	sort(seg.begin(), seg.end());
	ways[1] = 1;


	for(i=2; i<=n; i++){
		
		for(j=1; j<=k; j++){
			y = i-seg[j].first;
			if (y >= 1){
				x = max((ll)1, i-seg[j].second);
				ways[i] = (ways[i] + ways[y] - ways[x-1] + mod) % mod;
			}
		}
		ways[i] = (ways[i] + ways[i-1]) % mod;
	}

	/*
	for(i=1; i<=5; i++)
		cout << ways[i] << " ";

	cout << endl;
	*/
	cout << (ways[n] - ways[n-1] + mod) % mod << endl;
}


Measured memory_bytes: 5192
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

string a, b, c;

int main()
{
	cin >> a >> b >> c;

	char ch = a[0];
	while (true)
	{
		if (ch == 'a') {
			if (a.empty()) {
				cout << "A" << endl;
				break;
			}
			ch = a[0];
			a.erase(0, 1);
		}
		else if (ch == 'b') {
			if (b.empty()) {
				cout << "B" << endl;
				break;
			}
			ch = b[0];
			b.erase(0, 1);
		}
		else if (ch == 'c') {
			if (c.empty()) {
				cout << "C" << endl;
				break;
			}
			ch = c[0];
			c.erase(0, 1);
		}
	}

	return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())

a = {}

for i in range(Q):
    A = int(input()) - 1

    if A in a.keys():
        a[A] += 1
    else:
        a[A] = 1

    K -= 1

count = 0

if K > 0:
    for i in range(N):
        print('Yes')
else:
    for i in range(N):
        if i in a.keys():
            if a[i] + K > 0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')


Measured memory_bytes: 9060
N = int(input())
v = list(map(int, input().split()))

sort_v = sorted(v)

for i in range(N):
  if i == 0:
    var = sort_v[0]
  if i >= 1 and i < N-1:
    var = (sort_v[i]+var)/2
  if i == N-1:
    var = (sort_v[i]+var)/2
    print(var)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Set<Character> set = new HashSet<>();
    for (int i = 0; i < N; i++) {
      set.add(sc.next().charAt(0));
    }
    System.out.println(set.size() == 4 ? "Four" : "Three");
  }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define INF 2000000000

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    pair<int, int> id = make_pair(1, INF);
    rep(i,m) {
        int l, r;
        scanf("%d %d", &l, &r);
        id.first = max(id.first, l);
        id.second = min(id.second, r);
    }
    printf("%d\n", max(id.second-id.first+1, 0));
}

Measured memory_bytes: 256
using System;

namespace AIDU {
    class AIDU0019
    {
        public static void Main(){
            string s=Console.ReadLine();
            char[] chars = s.ToCharArray();
            for(int i=0;i<chars.Length;i++) {
                chars[i]=char.ToUpperInvariant(chars[i]);
            }
            Console.WriteLine(new string(chars));
        }
    }
}

Measured memory_bytes: 8736
/*
    アリナ・グレイはかわいい
*/

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define itn int
#define endl "\n"

int main(void){
    int h,w,k;
    cin >> h >> w >> k;
    string s[1004];
    int mn = 1e9;
    
    for(int i = 0;i < h;i++)cin >> s[i];
    
    for(int i = 0;i < (1 << (h-1));i++){
        int sum = 0,a[h];
        for(int j = 0;j < h;j++){
            a[j] = sum;
            if(i & (1 << j))sum++;
        }
        sum++;
        int num = sum-1,b[h];
        
        for(int p = 0;p < h;p++)b[p] = 0;
        for(int p = 0;p < w;p++){
            for(int q = 0;q < h;q++){
                b[a[q]] += (s[q][p]-'0');
            }
            for(int q = 0;q < sum;q++){
                if(b[q] > k){
                    num++;
                    for(int l = 0;l < sum;l++)b[l] = 0;
                    for(int l = 0;l < h;l++)b[a[l]] += (s[l][p]-'0');
                    break;
                }
            }
            for(int l = 0;l < sum;l++)if(b[l] > k)num = 1e9;
        }
        mn = min(mn,num);
    }
    cout << mn << endl;
}


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

int main(){
    string a;
    char a_b,a_e;
    int b;
    cin>>a;
    b=a.size();
    a_b=a.at(0);
    a_e=a.at(b-1);
    b-=2;
    cout<<a_b<<b<<a_e<<endl;
}

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

void solver() {
  int n;
  cin >> n;

  map<string, int> mp;

  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mp[s]++;
  }

  cout << mp.size() << "\n";
}

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


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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)



int main(){

  int n,sum=0;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n){
    int l = 0;
    int r = 40;
    while(l!=r-1){
      int m = (l+r)/2;
      if (a[i] % (long long)(powl(2,m))==0) l=m;
      else r=m;
    }
    sum+=l;
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    
    cin >> a >> b >> c;
    
    while(c < 1000000)
    {
        if(0 <= c % (a + b) && c % (a + b) <= a)
        {
            cout << c << endl; return 0;
        }
        
        c += 60;
    }
    
    cout << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 3112
"""
M <= 10 ** 5
なので全探索しても間に合いそう。
"""
N, M = map(int, input().split())
input_li = []   # 入力[p, y]の組み合わせを格納する二次元リスト
p_dict = {}     # pごとのyのリストを格納する辞書
ans_dict = {}   # キーp, yを指定することでIDが取り出せる辞書

# 入力をinput_liに詰めつつp_dictを作っていく
for _ in range(M):
    p, y = map(int, input().split())
    input_li.append([p, y])
    if p not in p_dict:
        li = [y]
        p_dict[p] = li
    else:
        p_dict[p].append(y)

# p_dictを元にans_dictを作っていく
for p in p_dict:
    li = sorted(p_dict[p])
    ans_dict[p] = {}
    for i in range(len(li)):
        p_id = '0' * (6 - len(str(p))) + str(p)
        c_id = '0' * (6 - len(str(i + 1))) + str(i + 1)
        ans_dict[p][li[i]] = p_id + c_id

# input_li順にIDを出力していく
for p, y in input_li:
    print(ans_dict[p][y])


Measured memory_bytes: 146416
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var n     = int.Parse(spl[0]);
        var a     = int.Parse(spl[1]);
        var b     = int.Parse(spl[2]);

        if(n == 1 && a!=b) return 0;
        if(a > b) return 0;

        long min = (long)a * (long)(n-1) + b;
        long max = (long)b * (long)(n-1) + a;

        return max - min + 1;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }

}


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

using namespace std;

int main() {
	vector<int> furui(10001, 0);
	furui[0] = furui[1] = 1;
	for (int i = 2; i*i < 10001; i++) {
		if (furui[i] == 0) {
			for (int j = 2; j <= 10000/i; j++) {
				furui[i*j] = 1;
			}
		}
	}
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 0;
		int i;
		int sum = 0;
		for (i = 2; i <= n; i++) {
			if (sum >= n) {
				break;
			} else {
				if (furui[i] == 0) {
					sum += i;
				}
			}
		}
		i++;
		int k = 2;
		while (k <= n) {
			if (sum == n) {
				counter++;
				while (sum == n) {
					if (furui[i] == 0) {
						sum += i;
						i++;
					} else {
						i++;
					}
					if (i > 10000) {
						break;
					}
				}
				if (i > 10000) {
					break;
				}
			} else if (sum > n) {
				while (sum > n) {
					if (furui[k] == 0) {
						sum -= k;
						k++;
					} else {
						k++;
					}
				}
			} else {
				while (sum < n) {
					if (furui[i] == 0) {
						sum += i;
						i++;
					} else {
						i++;
					}
					if (i > 10000) {
						break;
					}
				}
				if (i > 10000) {
					break;
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
package main

import (
	"fmt"
)

type Line struct {
	a, b int
}

func (l Line) getNextPoint(p int) (bool, int) {
	switch {
	case l.a == p:
		return true, l.b
	case l.b == p:
		return true, l.a
	default:
		return false, 0
	}
}

type Point struct {
	value int
	next  map[int]bool
}

var points map[int]*Point

type Graph struct {
	lines      []Line
	startPoint int
	points     map[int]bool
}

func (g Graph) String() string {
	return fmt.Sprintf("%d:%v:%v", g.startPoint, g.lines, g.points)
}

func (g Graph) nextGrpah(num int) Graph {
	nextG := Graph{}
	nextG.lines = make([]Line, 0, 0)
	nextG.points = make(map[int]bool)
	ok, nextStartPoint := g.lines[num].getNextPoint(g.startPoint)
	if ok {
		nextG.startPoint = nextStartPoint
	}
	for i := 0; i < len(g.lines); i++ {
		if i == num {
			continue
		}
		nextG.lines = append(nextG.lines, g.lines[i])
	}
	for p, _ := range g.points {
		if g.lines[num].a == p || g.lines[num].b == p {
			continue
		}
		nextG.points[p] = true
	}
	return nextG
}

func (g Graph) hasPoint(p int) bool {
	_, ok := g.points[p]
	return ok
}

func (g Graph) candidateLines() []int {
	paths := make([]int, 0, 0)
	for i, line := range g.lines {
		if ok, nextPoint := line.getNextPoint(g.startPoint); ok {
			if g.hasPoint(nextPoint) {
				paths = append(paths, i)
			}
		}

	}
	return paths
}

func (g Graph) countEuler() int {
	sum := 0
	if len(g.points) == 0 {
		return 1
	}

	for _, path := range g.candidateLines() {
		nextG := g.nextGrpah(path)
		sum += nextG.countEuler()
	}
	return sum
}

func main() {
	var n, m int
	var a, b int
	fmt.Scan(&n, &m)
	g := Graph{}
	g.startPoint = 1
	g.lines = make([]Line, 0, 0)
	g.points = make(map[int]bool)
	for i := 1; i <= n; i++ {
		g.points[i] = true
	}
	for i := 0; i < m; i++ {
		fmt.Scan(&a, &b)
		g.lines = append(g.lines, Line{a: a, b: b})
	}
	fmt.Println(g.countEuler())
}

Measured memory_bytes: 5504
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
//import static java.lang.System.*; はしばらく使わなそう(使うとしてもexit(0)のためだけ)←return;でよさそう
最後にout.flush()またはout.close()をするのを忘れずに！
Point2D p2d=new Point2D.Double(d1,d2);
*/
//入力終了→Ctrl+D
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.Point2D;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        int n=sc.nextInt();
        int x=sc.nextInt();
        int[] l=new int[n];
        for (int i = 0; i < n; i++) {
            l[i]=sc.nextInt();
        }
        int[] d=new int[n+1];
        int ans=1;
        for (int i = 1; i < n + 1; i++) {
            d[i]=d[i-1]+l[i-1];
            if(d[i]<=x)ans++;
        }
        out.println(ans);
        out.close();
    }

    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    //Union Find木(0-indexed)
    static class UF {
        static int[] d;

        static void Init(int size) {
            d = new int[size];
            for (int i = 0; i < size; i++) {
                d[i] = -1;
            }
        }

        static boolean unite(int x, int y) {
            x = find(x);
            y = find(y);
            if (x == y) return false;
            if (d[x] > d[y]) {
                int t = d[y];
                d[y] = d[x];
                d[x] = t;
            }
            d[x] += d[y];
            d[y] = x;
            return true;
        }

        static boolean same(int x, int y) {
            return find(x) == find(y);
        }

        static int find(int k) {
            return d[k] < 0 ? k : (d[k] = find(d[k]));
        }

        static int size(int k) {
            return -d[find(k)];
        }
    }

    static PrintWriter out = new PrintWriter(System.out);

    static class sc {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static String nextLine() {
            return s.nextLine();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }

        static boolean hasNext() {
            return s.hasNext();
        }

        static boolean hasNextInt() {
            return s.hasNextInt();
        }

    }

}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-

def kyu(x):
    kyu = 0
    if   x < 600:  kyu = 8
    elif x < 800:  kyu = 7
    elif x < 1000:  kyu = 6
    elif x < 1200: kyu = 5
    elif x < 1400: kyu = 4
    elif x < 1600: kyu = 3
    elif x < 1800: kyu = 2
    else:          kyu = 1
    return kyu

X = int(input())
print(kyu(X))


Measured memory_bytes: 9176