akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int n;

void dfs(string s,char m){
	if(s.size()==n)cout<<s<<endl;
	else{
		for(char c='a';c<=m;c++){
			dfs(s+c,((c==m)?(char)(m+1):m));
		}
	}
	
}

int main(){
	cin>>n;
	dfs("",'a');
}

Measured memory_bytes: 1536
#define _CRT_SECURE_NO_WARNINGS 1

#include <set>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int maxn = 2e5 + 7;

int main() {
	int n,x,t;
	cin >> n >> x >> t;
	cout << (int)ceil(1.0 * n / x) * t << endl;
	return 0;
}

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

typedef long long ll;
 
int main(){
  int a[] = {1, 3, 5, 7, 8, 10, 12};
  int b[] = {4, 6, 9, 11};
  int c[] = {2};
  int x, y;
  cin >> x >> y;
  char xg, yg;
  for(int i=0; i<7; i++){
    if(x==a[i]) xg='a';
    if(y==a[i]) yg='a';
  }
  for(int i=0; i<4; i++){
    if(x==b[i]) xg='b';
    if(y==b[i]) yg='b';
  }
  for(int i=0; i<1; i++){
    if(x==c[i]) xg='c';
    if(y==c[i]) yg='c';
  }
  if(xg==yg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3560
n,m = map(int,input().split())
k = []
a = []
while True:
  try:
    tmp = list(map(int,input().split()))
    k.append(tmp[0])
    a.append(tmp[1:])
  except:
    break

counter = [0]*m
for i in a:
  for j in i:
    counter[j-1] +=1

ans = counter.count(n)
print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    const int cost[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    rep(i, m) cin >> a[i];
    sort(a.begin(), a.end());
    auto dp = make_vec<int>(m+1, n+1);
    auto pre = make_vec<int>(m+1, n+1);
    rep(i, m) {
        int c = cost[a[i]];
        rep(j, n+1) {
            dp[i+1][j] = dp[i][j];
            if ((j-c == 0 || (j-c > 0 && dp[i+1][j-c] > 0)) && dp[i+1][j] <= dp[i+1][j-c] + 1) {
                dp[i+1][j] = dp[i+1][j-c] + 1;
                pre[i+1][j] = 1;
            }
        }
    }
    int i = m, j = n;
    vector<int> ans;
    while (i != 0) {
        if (pre[i][j] == 0) {
            i -= 1;
        } else {
            j -= cost[a[i-1]];
            ans.push_back(a[i-1]);
        }
    }
    sort(ans.rbegin(), ans.rend());
    rep(i, ans.size()) cout << ans[i];
    cout << endl;
}


Measured memory_bytes: 4184
#include<iostream>
#include<cstdio>
#include<list>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
#include<set>
using namespace std;
#define LL long long
int main() 
{
	LL N,A,B;
	cin>>N>>A>>B;
	if(A==0)
		cout<<0<<endl;
	else
	{
		LL cnt=N/(A+B);
		cnt=cnt*A;
		LL P=N%(A+B);
		if(P<=A)
			cout<<cnt+P<<endl;
		else
			cout<<cnt+A<<endl;
	}

}




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var r = sc.nextInt();
		var c = sc.nextInt();
		var k = sc.nextInt();
		var v = new long[r][c];
		for (var i = 0; i < k; i++) {
			v[sc.nextInt() - 1][sc.nextInt() - 1] = sc.nextInt();
		}
		sc.close();

		for (var i = 0; i < r; i++) {
			var rv = new long[c][5];
			for (var j = 0; j < c; j++) {
				var cv = v[i][j];
				for (var ic = 0; ic < 4; ic++) {
					var rv1 = (i > 0 ? v[i - 1][j] : 0);
					var rv2 = (j > 0 ? rv[j - 1][ic] : 0);
					var rv3 = (j > 0 ? rv[j - 1][ic + 1] : 0);
					if (cv > 0) {
						if (ic == 0) {
							rv[j][ic + 1] = Math.max(Math.max(rv1 + cv, rv2 + cv), rv3);
						} else if (rv2 > 0) {
							rv[j][ic + 1] = Math.max(rv2 + cv, rv3);
						}
					} else {
						if (ic == 0) {
							rv[j][ic] = Math.max(rv1, rv2);
						} else {
							rv[j][ic] = rv2;
						}
					}
				}
				v[i][j] = Math.max(Math.max(Math.max(rv[j][0], rv[j][1]), rv[j][2]), rv[j][3]);
			}
		}

		System.out.println(v[r - 1][c - 1]);
	}
}


Measured memory_bytes: 146984
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
double pie=3.14159265358979;
long long mod=998244353;
//
int main(){
	double a,b,h,m;
	cin>>a>>b>>h>>m;
	double diff=abs(30*h+30*m/60-6*m);
	double s=diff/360*2*pie;
	double ans=sqrt(a*a+b*b-2*a*b*cos(s));
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4224
using System;

namespace ABC160b
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());

            long happy = 0;
            happy = 1000 * (x / 500);

            long zan = x % 500;

            happy += 5 * (zan / 5);

            Console.WriteLine(happy);
        }
    }
}


Measured memory_bytes: 11092
#include<cstdio>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==b)
	   printf("%d\n",c);
	if(a==c)
	   printf("%d\n",b);
	if(b==c)
	   printf("%d\n",a);
	return 0;
}

Measured memory_bytes: 128
//#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <utility>
#define N 120
using namespace std;

pair<int, int> a[N];

int main(void)
{
    int n;
    int i, k, x, y;
    long long o;

    scanf("%d", &n);
    for(i = 0; i < n; i ++)
        scanf("%d %d", &a[i].first, &a[i].second);

    for(k = o = 0; k < 100000; k ++)
    {
        random_shuffle(a, a + n);
        x = y = 0;
        for(i = 0; i < n; i ++) {
            if((long long)(x + a[i].first) * (x + a[i].first) + (long long)(y + a[i].second) * (y + a[i].second) > (long long)x * x + (long long)y * y)
            {
                x += a[i].first ;
                y += a[i].second;
            }
        }
        o = max(o, (long long)x * x + (long long)y * y);
    }
    printf("%.15Lf\n", sqrt((long double)o));

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const int N = 2e6+5;
ll a[N];
void solve(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    ll ans = 0;
    ans+=a[0];
    int k=1;
    for(int i=1;i<n-1;i++){
        ans+=a[k];
        if(i%2==0)k++;
    }
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
  //  cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 5204
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
int ceil(int a, int b){
	return (a+b-1)/b;
}

void solve(){
	string s, t;
	cin>>s>>t;
	int res=0;
	FOR(i, 0, sz(s)){
		res+=(s[i]!=t[i]);
	}
	cout<<res<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}



Measured memory_bytes: 3812
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 200000 + 1000;

struct State
{
	long long cnt[26], size;
	State()
	{
		memset(cnt, 0, sizeof(cnt));
		size = 0;
	}
	void add(char c)
	{
		cnt[c - 'a']++, size++;
	}
};

State operator + (const State &a, const State &b)
{
	State ret;
	for(int i = 0; i < 26; i++)
		ret.cnt[i] = a.cnt[i] + b.cnt[i];
	ret.size = a.size + b.size;
	return ret;
}

int n, m;
long long L, R;
char s[MAXN];
State f[MAXN];

State prefix(int v)
{
	State ret;
	for(int i = 1; i <= v; i++)
		ret.add(s[i]);
	return ret;
}

State calc(int x, long long v)
{
	if(x == 0 || x == 1)
		return prefix(v);
	if(v <= f[x - 1].size)
		return calc(x - 1, v);
	else
		return f[x - 1] + calc(x - 2, v - f[x - 1].size);
}

int get_period()
{
	static int next[MAXN];
	for(int i = 2; i <= n; i++)
	{
		int j = next[i - 1];
		while(j && s[j + 1] != s[i])
			j = next[j];
		if(s[j + 1] == s[i])
			j = j + 1;
		next[i] = j;
	}
	return n - next[n];
}

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> (s + 1);
	cin >> L >> R;
	n = strlen(s + 1) / 2;
	s[n + 1] = 0;

	int k = get_period();
	f[0] = prefix(k);
	f[1] = prefix(n);

	m = 2;
	while(f[m - 1].size <= R) {
		f[m] = f[m - 1] + f[m - 2];
		m++;
	}

	State ans1 = calc(m, L - 1);
	State ans2 = calc(m, R);

	for(int i = 0; i < 26; i++)
		cout << ans2.cnt[i] - ans1.cnt[i] << ' ';
	cout << endl;

	return 0;
}


Measured memory_bytes: 43264
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int maxn = 1e5 + 5 ;
int n ;
int num = 0 ;
int head[maxn] ;
int ans[maxn] ;
int k = 0 ;
int in[maxn] ;
struct edge
{
	int v ;
	int next ;
	int id ;
} e[maxn << 1] ;
void add_edge(int u , int v , int id)
{
	e[num].v = v ;
	e[num].next = head[u] ;
	e[num].id = id ;
	head[u] = num ++ ;
}
void dfs(int color , int fa , int u)
{
	int now = 0 ;
	for(int i = head[u] ; i != -1 ; i = e[i].next)
	{
		int v = e[i].v ;
		if(v == fa)
		  continue ;
		now ++ ;
		if(now == color)
		  now ++ ;
		ans[e[i].id] = now ;
		dfs(now , u , v) ; 
	}
}
int main()
{
	memset(head , -1 , sizeof(head)) ;
	scanf("%d" , &n) ;
	for(int i = 1 ; i <= n - 1 ; i ++)
	{
		int u , v ;
		scanf("%d%d" , &u , &v) ;
		add_edge(u , v , i) ;
		add_edge(v , u , i) ;
		in[u] ++ ;
		in[v] ++ ;
	}
	dfs(0 , 0 , 1) ;
	for(int i = 1 ; i <= n ; i ++)
	  k = max(k , in[i]) ;
	printf("%d\n" , k) ;
	for(int i = 1 ; i <= n - 1 ; i ++)
	  printf("%d\n" , ans[i]) ;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VS = vector<string>;
using graph = vector<vector<int>>;
int main()
{
int a,b;
cin>>a>>b;
if (a+b>=10)
{
    cout<<"error"<<endl;
}
else cout<<a+b<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if (a <= c && c <= b)
         cout << a << " " << c << " " << b << endl;
    else if(b <= c  && c <= a)
        cout << b << " " << c << " " << a << endl;     
    else if(c <= b  && b <= a)
         cout << c << " " << b << " " << a << endl;    
    else if(c <= a  && a <= b)
        cout << c << " " << a << " " << b << endl;  
    else if(b <= a  && a <= c)
        cout << b << " " << a << " " << c << endl; 
}


Measured memory_bytes: 3088
#include<stdio.h>
#define ARRAY_SIZE 10
#define MAX_VALUE 10000
#define MIN_VALUE 0

int searchMax();
int *heightList;

int main(void){
  heightList = new int[ARRAY_SIZE];

  for(int i = 0;i < ARRAY_SIZE;i++){
    scanf("%d",&heightList[i]);
  }
  for(int i = 0;i < 3;i++){
    printf("%d\n",searchMax());
  }

  delete(heightList);

  return 0;
}

int searchMax(){
  int maxValue = -1;
  int index = -1;

  for(int i = 0;i < ARRAY_SIZE;i++){
    if(maxValue < (heightList[i])){
      maxValue = (heightList[i]);
      index = i;
    }
  }

  if(index != -1){
    (heightList[index]) = 0;
  }
  else{
    return -1;
  }

  return maxValue;
}

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

using namespace std; 

// void dfs( int i, int j, vector<vector<char>> sq, int *count )
// {
// 	if( i<0 || j<0 || i>=sq.size() || j>=sq[0].size() )
// 		return ; 
// 	if( sq[i][j] == '#' )
// 		return ; 

// 	if( i == sq.size()-1 && j==sq[0].size()-1 )
// 		(*count) += 1%1000000007;

// 	dfs(i+1,j,sq,count);
// 	dfs(i,j+1,sq,count);
// 	return ; 
// }

int main()
{
	int h, w;
	cin>>h>>w;
	vector<vector<char>> sq(h, vector<char> (w));
	for( int i=0 ; i<h ; i++ )
		for( int j=0 ; j<w ; j++ )
			cin>>sq[i][j];

	vector<int> dp( w );
	for( int i=0 ; i<w ; i++ )
	{
		if(sq[0][i] == '.' )
			dp[i] = 1;
		else
			break;
	}

	for( int i=1; i<h; i++ )
	{
		for( int j=0 ; j<w; j++ )
		{
			if( sq[i][j] != '#' )
			{
				if( j>0 && sq[i][j-1] == '.' )
					dp[j] = (dp[j]%1000000007 + dp[j-1]%1000000007)%1000000007;

				else if( j>0 && sq[i-1][j] == '#' )
					dp[j] = dp[j-1]%1000000007;
			}
			else
				dp[j] = 0;			
		}
	}


	cout<<dp[w-1];
	return 0;

}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int A, B, C;
int N;
int D[333];
int ta[1000], tb[1000], tc[1000];
int x;

int main() {
  while (cin >> A >> B >> C) {
    if (A == 0 && B == 0 && C == 0) break;
    cin >> N;
    for (int i=0; i<333; i++) D[i] = 2;
    x = 0;
    for (int i=0; i<N; i++) {
      int a, b, c, r;
      cin >> a >> b >> c >> r;
      if (r == 1) {
        D[a-1] = 1;
        D[b-1] = 1;
        D[c-1] = 1;
      }
      else {
        ta[x] = a-1;
        tb[x] = b-1;
        tc[x] = c-1;
        x++;
      }
    }
    for (int k=0; k<4; k++) {
      for (int i=0; i<x; i++) {
        int a = ta[i], b = tb[i], c = tc[i];
        if      (D[a] == 2 && D[b] == 1 && D[c] == 1) D[a] = 0;
        else if (D[a] == 1 && D[b] == 2 && D[c] == 1) D[b] = 0;
        else if (D[a] == 1 && D[b] == 1 && D[c] == 2) D[c] = 0;
      }
    }
    for (int i=0; i<A+B+C; i++) {
      cout << D[i] << "\n";
    }
  }
  return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
#include <queue>
#include <cstring>
#define mp make_pair
#define pb push_back
#define p push

#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLl(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE 1000000007
#define MAXN 100005
using namespace std;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph ;




int main(){
    string s;
     cin >>s;
     char c = s[0];
    for (int i = 1; i <4 ; ++i) {
        if(c == s[i]){
            cout<<"Bad";
            return 0;
        }
        c = s[i];
    }
    cout<<"Good";
    return 0;
}

Measured memory_bytes: 256
/* ex4_2 melo */
#include <stdio.h>
#include <math.h>
#define PI 3.141592653589793238
int main(void){
    int lenA,lenB,hour,min;
    double angleA,angleB,angleA_B,lenA_B;
    scanf("%d%d%d%d",&lenA,&lenB,&hour,&min);
    angleA=(2*PI/12)*hour+(2*PI/720)*min;
    angleB=(2*PI/60)*min;
    angleA_B=((angleA-angleB)>0)?(angleA-angleB):(angleB-angleA);
    lenA_B=sqrt(lenA*lenA+lenB*lenB-2*lenA*lenB*cos(angleA_B));
    printf("%.18lf\n",lenA_B);
    return 0;
}

Measured memory_bytes: 2596
puts gets.scan(/R+L+/).map{|a|a.split(/(?<=R)(?=L)/)}
.map{|a|
  [
    '0 ' * (a[0].size-1),
    ((a[0].size/2.0).ceil + (a[1].size/2.0).floor).to_s + ' ',
    ((a[0].size/2.0).floor + (a[1].size/2.0).ceil).to_s + ' ',
    ('0 ' * (a[1].size-1))
  ].join
}.join.chop


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

int main() {
    int n;
    cin>>n;
    int x[n];

    int maxPos = 0;
    for (int i = 0; i < n; i++) {
        cin>>x[i];
        maxPos = max(maxPos, x[i]);
    }

    int minStamina = 1e9;
    for (int i = 0; i <= maxPos; i++) {
        int stamina = 0;
        for (int j = 0; j < n; j++) {
            stamina += (x[j] - i) * (x[j] - i);
        }
        minStamina = min(minStamina, stamina);
    }

    cout<<minStamina<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1000

int num[MAX];
int top;

int isEmpty(); /*スタックが空なら1を、そうでないなら0を返す関数*/
int isFull();/*スタックが要素で満されているなら1を、そうでないなら0を返す関数*/
void push(int);/*要素を挿入する関数*/
int pop();/*要素を取り出す関数*/

int main(){
    int n;
    char s[100];
    int a,b;

    top=0;

    while(scanf(" %s",s) != EOF){
        if(s[0] == '+'){
            
            a = pop();
            b = pop();
            push(a+b);

        }else if(s[0] == '-'){
            
            a = pop();
            b = pop();
            push(b-a);


        }else if(s[0] == '*'){
            
            a = pop();
            b = pop();
            push(a*b);

        }else{
            n = atoi(s);
            push(n);
        }

    }

    printf("%d\n",pop());

    return 0;
}

int isEmpty(){
    if(top == 0) return 1;
    return 0; 
}

int isFull(){
    if(top >= MAX-1) return 1;
    return 0;
}

void push(int n){
    if(isFull()){
        printf("Error,stack is full\n");
        exit(2);
    }
    num[++top] = n;
}

int pop(){
    if(isEmpty()){
        printf("Error,stack is empty\n");
        exit(3);
    }
    top--;
    return num[top+1];
}



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

bool check(vector<int>g){
  int n=0;
  for(int i=0;i<g.size();i++){
    if(n>g.at(i))
      return false;
    n=g.at(i);
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<int>kaz(n);
  for(int i=0;i<n;i++)
    cin >> kaz.at(i);
  bool ok=check(kaz);
  if(!ok){
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i!=j){
        swap(kaz.at(i),kaz.at(j));
        ok=check(kaz);
        swap(kaz.at(i),kaz.at(j));
        if(ok)
          break;
      }
    }
    if(ok)
      break;
  }
  }
  cout << (ok?"YES":"NO") << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

template <typename T>
class WarshallFloyd {
private:
    int m_V;                   
    vector<vector<T>> m_d;
    
public:
    const T INF = std::numeric_limits<T>::max();
    WarshallFloyd(int V)
        : m_V(V) {

        // 辺のコストを初期化
        // 辺が存在しないときはINFとする
        m_d.resize(m_V, vector<T>(m_V, INF));
        REP(i,V) m_d[i][i] = 0;
    }
    void add_dir_edge(int from, int to, T cost) {
        m_d[from][to] = cost;
    }
    void add_undir_twoways(int v1, int v2, T cost) {
        add_dir_edge(v1, v2, cost);
        add_dir_edge(v2, v1, cost);
    }
    // 全点間の最短距離を求める
    vector<vector<T>> shortest_path() {
        REP(k, m_V) REP(i, m_V) REP(j, m_V) 
            // 辺が存在するときのみ短縮できる 
           if(m_d[i][k] != INF && m_d[k][j] != INF)
                m_d[i][j] = min(m_d[i][j], m_d[i][k] + m_d[k][j]);
        return m_d;
    }
    // shortest_pathを呼んだあとに呼ぶこと
    bool has_negative_loop() {
        REP(i, m_V) {
            if (m_d[i][i] < 0) return true;
        }
        return false;
    }
};


int H, W;

int to_idx(int h, int w) {
    return h * W + w;
}

int main(void)
{
    cin.sync_with_stdio(false);
    cin >> H >> W;
    
    vector<string> cells(H);
    REP(h, H) cin >> cells[h];

    WarshallFloyd<int> wf(H * W);

    REP(h, H) {
        REP(w, W - 1) {
            if (cells[h][w] == '.' && cells[h][w+1] == '.') {
                wf.add_undir_twoways(to_idx(h, w), to_idx(h, w+1), 1);
            }
        }
    }
    REP(w, W) {
        REP(h, H - 1) {
            if (cells[h][w] == '.' && cells[h+1][w] == '.') {
                wf.add_undir_twoways(to_idx(h, w), to_idx(h+1, w), 1);
            }
        }
    }
    auto res = wf.shortest_path();

    int ans = -1;
    for(auto x: res) {
        for(auto y: x) {
            if (y == wf.INF) continue;
            ans = max(ans, y);
            // cerr << y << endl;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    cout << N * 180 - 360 << endl;
}


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

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

    int rnum = 0, ans = 0;
    rep(i,n) if(s[i]=='R') rnum++;
    rep(i,rnum) if(s[i]=='W') ans++;
    cout << ans << endl;
}

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

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

    int q, mi = 1e9, ma = 0;
    cin >> q;
    vector<int> L(q), R(q);
    REP(i, q){
        cin >> L[i] >> R[i];
        mi = min(mi, L[i]);
        ma = max(ma, R[i]);
    }
    
    vector<bool> F(ma + 1, true);
    F[0] = F[1] = false;
    for(int i = 2; i <= (int)sqrt(ma); i++){
        if(F[i]){
            for(int j = i + i; j <= ma; j += i){
                F[j] = false;
            }
        }
    }

    vector<int> A(ma + 1, 0);
    for(int i = mi; i <= ma; i++){
        if(F[i] and F[(i + 1) / 2]){
            A[i] = 1;
        }
    }
    
    for(int i = 1; i <= ma; i++){
        A[i] += A[i - 1];
    }

    REP(i, q){
        cout << A[R[i]] - A[L[i] - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int X = Integer.parseInt(br.readLine());
		List<Integer> beki = new ArrayList<Integer>();
		beki.add(1);

		for(int i = 2;i<32;i++){
			int p = 2;
			int now = (int)Math.pow(i, p);
			while(now <= X){
				beki.add(now);
				p++;
				now = (int)Math.pow(i, p);

			}
		}

		beki.sort(null);
		System.out.println(beki.get(beki.size()-1));

	}


}

Measured memory_bytes: 22484
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

struct team
{
	int id;
	int pen = 0;
	int cor = 0;
	int cnt[11] = {};
	bool f[11] = {};
};

bool operator<(team& lhs, team& rhs) {
	if (lhs.cor != rhs.cor)
		return lhs.cor > rhs.cor;
	if (lhs.pen != rhs.pen)
		return lhs.pen < rhs.pen;
	return lhs.id < rhs.id;
}

int main()
{
	while (1) {
		int t, p, r;
		cin >> t >> p >> r;
		if (!t && !p && !r) break;
		team ts[51];
		rep(i,0,t) ts[i].id = i+1;
		rep(i, 0, r) {
			int a, b, c;
			string s;
			cin >> a >> b >> c >> s;
			a--; b--;
			if (ts[a].f[b]) continue;
			if (s == "CORRECT") {
				ts[a].cor++;
				ts[a].pen += 1200 * ts[a].cnt[b] + c;
			}
			else {
				ts[a].cnt[b]++;
			}
		}
		sort(ts, ts+t);
		rep(i,0,t) cout << ts[i].id << " " << ts[i].cor << " " << ts[i].pen << endl;
	}
	return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define F first 
#define S second 
#define MAX 10000003
typedef long long ll; 
const int mod = 1000000007;  
int prime[MAX]; 
unordered_map<int, int> max_map; 
  
// Function to return a^n 
int power(int a, int n) 
{ 
    if (n == 0) 
        return 1; 
    int p = power(a, n / 2) % mod; 
    p = (p * p) % mod; 
    if (n & 1) 
        p = (p * a) % mod; 
    return p; 
} 
  
// Function to find the smallest prime factors 
// of numbers upto MAX 
void sieve() 
{ 
    prime[0] = prime[1] = 1; 
    for (int i = 2; i < MAX; i++) { 
        if (prime[i] == 0) { 
            for (int j = i * 2; j < MAX; j += i) { 
                if (prime[j] == 0) { 
                    prime[j] = i; 
                } 
            } 
            prime[i] = i; 
        } 
    } 
} 
  
// Function to return the LCM modulo M 
ll lcmModuloM(const int* ar, int n) 
{ 
  
    for (int i = 0; i < n; i++) { 
        int num = ar[i]; 
        unordered_map<int, int> temp; 
  
        // Temp stores mapping of prime factor to 
        // its power for the current element 
        while (num > 1) { 
  
            // Factor is the smallest prime factor of num 
            int factor = prime[num]; 
  
            // Increase count of factor in temp 
            temp[factor]++; 
  
            // Reduce num by its prime factor 
            num /= factor; 
        } 
  
        for (auto it : temp) { 
  
            // Store the highest power of every prime 
            // found till now in a new map max_map 
            max_map[it.first] = max(max_map[it.first], it.second); 
        } 
    } 
  
    ll ans = 1; 
  
    for (auto it : max_map) { 
  
        // LCM is product of primes to their highest powers modulo M 
        ans = (ans * power(it.F, it.S)) % mod; 
    } 
  
    return ans; 
} 
int main(){
  int n;
  cin>>n;
  int* a=new int[n];
  long long int s=1;
  int g=0;
  for(int i=0;i<n;i++){
   	cin>>a[i];
    s=(s*a[i])%mod;
    g=__gcd(g,a[i]);
  }
  sieve();
  if(g!=1)
    cout<<"not coprime"<<endl;  
  else if(lcmModuloM(a,n)==s)
    cout<<"pairwise coprime"<<endl;
  else
    cout<<"setwise coprime"<<endl;
}

Measured memory_bytes: 49600
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	map<int, int> A; 
	int ans = 0; 
	for(int i = 0; i < N; i++){
		int a; 
		cin >> a; 
		if(A[a] == 0){A[a] ++; ans ++;}
		else if(A[a] == 1){A[a] --; ans --;}
	}
	cout << ans << endl; 
}

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

int main() {
	int h, a;
	cin >> h >> a;
	cout << (h + a - 1) / a << endl;
	return 0;
}


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

int main(){
  int64_t N ; 
  cin >> N ; 
  int P = N/26 ; 
  vector<char> namae(100)   ;
  int i = 0 ; 
    //cout << N << " " << i << endl ; 
  
  
  while(N != 0 ){
    N-- ; 
    int M = N % 26 ; 
  	namae.at(i)  =  'a' + M ; 
    N  /= 26 ;
    i++ ; 
    
    //cout << N << " " << i << endl ; 
  }
  
  for(int j = i - 1; j >= 0 ; j--){
    cout << namae.at(j) ; 
  }
  
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int n;
	double input;
	int i;
	double sol = 0.0;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%lf", &input);

		sol += (double)1.0 / input;
	}

	printf("%.7lf\n", (double)1.0 / sol);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    ll r = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        r += a - 1;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import math

ans = 0
while True:
   try:
      n = int(input())
      if n == 2:
         ans += 1
         continue
      if n % 2 == 0:
         continue
      
      c = 0
      for i in range(2, math.floor(math.sqrt(n)) + 1):
         if n % i == 0:
            c += 1
      if c == 0:
         #print("#", n)
         ans += 1

   except EOFError:
      break
   
print(ans)


Measured memory_bytes: 5684
#include<iostream>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }



int main(){
  string s; cin >>s;
  print("ABC"+s);
}


Measured memory_bytes: 3580
n=input()
k=int(input())
m=len(n)
DP=[[[0]*(k+1) for _ in range(2)] for _ in range(m+1)]

DP[0][0][0]=1

for i in range(1,m+1):
    N=int(n[i-1])
    for j in range(k+1):
        DP[i][1][j] +=DP[i-1][1][j]
        if N!=0:DP[i][1][j] +=DP[i-1][0][j]
        else:DP[i][0][j] +=DP[i-1][0][j]
        if j!=0:
            DP[i][1][j] +=9*DP[i-1][1][j-1]
            if N!=0:
                DP[i][0][j] +=DP[i-1][0][j-1]
                DP[i][1][j] +=(N-1)*DP[i-1][0][j-1]

print(DP[m][0][k]+DP[m][1][k])

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

using namespace std;

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

    for(int i=0;i<k;i++)
    {
        sum+=a[i];
    }
    cout<<sum;

}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(ll x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int n,c[200004];
ll ans=1,dp[200004];
int main(){
	read(n);
	for (int i=1;i<=n;i++){
		read(c[i]);
		if (c[i]==c[i-1]) continue;
		ans=(ans+dp[c[i]])%MOD;
		dp[c[i]]=ans;
	}
	write(ans);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string A;
  cin >> A;
  
  if(A == "SUN"){
    cout << 7 << endl;
  }
  
  if(A == "MON"){
    cout << 6 << endl;
  }
  
  if(A == "TUE"){
    cout << 5 << endl;
  }
  
  if(A == "WED"){
    cout << 4 << endl;
  }
  
  if(A == "THU"){
    cout << 3 << endl;
  }
  
  if(A == "FRI"){
    cout << 2 << endl;
  }
  
  if(A == "SAT"){
    cout << 1 << endl;
  }
}


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

int main() {
	int a,b;
	int x;
	
	cin >> a >> b;
	
	x = a + b;
	
	if(x % 2 == 1){
		cout << x / 2 + 1 << endl;
	}else {
		cout << x / 2 << endl;
	}
}

Measured memory_bytes: 3648
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            Integer a[][] = new Integer[n][2];
            for (int i = 0; i < n; i++) {
                a[i][0] = Integer.parseInt(in.next());
            }
            long cnt = 0;
            long sum = 0;

            for (int i = 0; i < n; i++) {
                if (a[i][0] % 2 == 0) {
                    cnt++;
                    if (a[i][0] % 3 == 0 || a[i][0] % 5 == 0) {
                        sum++;
                    }
                }
            }
            // 出力
            if (cnt == sum) {
                out.println("APPROVED");
            } else {
                out.println("DENIED");
            }

        }

    }
}



Measured memory_bytes: 22740
// template version 1.7

// varibable settings {{{
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define int long long
#define INF 1e18
// #define INF 2147483647
#define MOD 1e9+7
#define infile "../test/sample-1.in"
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
// }}}

int solve(){
  int n,k;/*{{{*/
  cin>>n>>k;
  string s;
  cin>>s;/*}}}*/
  s = "1" + s + "1";
  n += 1;

  int res = 0;
  int sum = 0;
  int r = 1;
  for (int l=1; l<n; ++l) {
    auto isok=[&](){ // [l, r] e.g [l, r+1)がokか
      if (sum + (s[r]=='0' and s[r-1]=='1'?1:0)<=k) return true;
      else return false;
    };
    while (r<n && isok()) {
      sum += (s[r]=='0' and s[r-1]=='1' ? 1 : 0);
      ++r;
    }
    chmax(res, (r-l));

    // 枝刈り（なくてもよい）
    if (r==n) break;

    // leftをincrementする準備
    if (r==l) ++r;
    else sum -= (s[l]=='0' and s[l+1]=='1' ? 1 : 0);
  }
  cout << res << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

int main(){
	int x,a,b;	cin>>x>>a>>b;

	if(b-a>x)cout<<"dangerous"<<endl;
	else if(b-a>0)cout<<"safe"<<endl;
	else cout<<"delicious"<<endl;

	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()
res = ''
for i in range(n):
    if i!=k-1:
        res += s[i]
    else:
        if s[k - 1] == 'A':
            res += 'a'
        elif s[k - 1] == 'B':
            res += 'b'
        else:
            res += 'c'

print(res)

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

int main() {
  int N;
  cin>>N;
  pair<pair<string,int>,int>p[1000];
  for(int i=0;i<N;i++){
    string S;
    int T;
    cin>>S>>T;
    p[i]=make_pair(make_pair(S,-T),i+1);
  }
  sort(p,p+N);
  for(int i=0;i<N;i++){
    cout<<p[i].second<< endl;
  }
}
  

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

int main() {
    string o,e;
    int so,se,size,a,b;
    a = 0;  b = 0;
    cin >> o >> e;
    so = o.length();    se = e.length();
    if(so<se)
        size = se;
    else
        size = so;
    
    for(int i=1;i<=(so+se);i++){
        if(i%2==1){
            cout << o[a];
            a++;
        }else{
            cout << e[b];
            b++;
        }
    }
    
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
using namespace std;

#define fi first
#define se second
typedef long long LL;
typedef long double LD;

LL N,K,a[200010],s[200010],t[600010],P;
map<LL,LL> pos;
vector<LL> val;

void update(LL pos, LL val){
    for (; pos<=P; pos+=pos&-pos)
        t[pos]+=val;
}

LL query(LL pos){
    LL res=0;
    for (; pos; pos-=pos&-pos)
        res+=t[pos];
    return res;
}

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

    int i;
    val.push_back(0);
    for (i=1; i<=N; i++){
        cin >> a[i];
        a[i]-=K;
        s[i]=a[i]+s[i-1];
        val.push_back(s[i]);
        val.push_back(-s[i]);
    }
    sort(val.begin(),val.end());

    for (i=0; i<val.size(); i++)
        if (i==0 || val[i]!=val[i-1])
            pos[val[i]]=++P;

    update(pos[0],1);

    LL res=0;
    for (i=1; i<=N; i++) {
        res+=query(pos[s[i]]);
        update(pos[s[i]],1);
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 36716
// ABC152
// a.cs

using System;

class A
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int M = int.Parse(str[1]);

        if (N == M)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
N, K = map(int, input().split())
A = list(map(int, input().split()))

count = 0
for i in range(N):
    m = 0
    n = 0
    for j in range(N):
        if A[i] > A[j]:
            n += 1
            if i < j:
                m += 1
    count += K * m + n * K * (K - 1) // 2
print(count % (10 ** 9 + 7))


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

int main() {
  int n;
  int ans = 0;
  cin >> n;
  vector<int> num(n);

  for(int i = 0; i < n; i++) {
    cin >> num.at(i);
  }
  sort(num.begin(), num.end());
  reverse(num.begin(), num.end());

  for (int i=0; i < n; i += 2) {
    ans += num.at(i);
  }

  for (int i = 1; i<n; i += 2) {
    ans -= num.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <string.h>
#define sf(n) scanf("%d",&n)
#define sff(n,m) scanf("%d%d",&n,&m)
#define ll long long
#define mod 1000000007
#define INF 400000
using namespace std;
int main(){
    int a,b;
    sff(a,b);
    int mmax=max(b+b-1,max(a+b,a+a-1));
    printf("%d\n",mmax);
}


Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    int64 Z,W;
    cin >> N >> Z >> W;
    vector<int64> A(N);
    REP(i,N) cin >> A[i];
    if(N==1) {A.push_back(W); N++;}
    int64 ans = max(abs(A.back()-W), abs(A[N-1]-A[N-2]));

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
        #define ll long long
        #define f   first
        #define s   second
        #define pb          push_back
        #define mod        1000000007
        #define mod1       1000000009
        #define hell        998244353
        #define inf         1000000000000000000LL
        #define pi          3.14159265358979323
        #define N           1000005 
        using namespace std;
        ll n,k,sum,q,res,m,val,ans;
        ll x,y;
        ll xx[]={1,0,-1,0};
        ll yy[]={0,1,0,-1};
        void solve()    
        {   ll a,b;
            cin>>n>>x;
            if(x==1 || x==(2*n-1))
                {cout<<"No";return;}
            cout<<"Yes\n";
            vector<ll> ans(2*n-1);
            y=(2*n-1)/2;
            ans[y]=x;
            ll st=x-1;
            int j=y-1;
            set<ll> s;
            for(ll i=1;i<=2*n-1;i++) s.insert(i);
                s.erase(x);
            while(j>0 and st>0)
            {   s.erase(st);
                ans[j]=st;
                j--;
                st--;
            }
            st=x+1;
            j=y+1;
            while(j<(2*n-1) and st<=(2*n-1))
            {
                s.erase(st);
                ans[j]=st;
                j++;
                st++;
            }
            for(int i=0;i<2*n-1;i++)
            {
                if(ans[i]==0)
                {
                    auto it=s.begin();
                    ans[i]=*it;
                    s.erase(it);
                }
            }
            for(int i=0;i<2*n-1;i++)
                cout<<ans[i]<<"\n";



        }
        int main()
        {   ios_base::sync_with_stdio(false);
            cin.tie(0);cout.tie(0);
            ll t=1;
            //cin>>t;
            while(t--)
                solve();
            

        }            

Measured memory_bytes: 14312