akhauriyash/Code-Regression huggingface dataset:
h,w=map(int,input().split())
s=[input() for i in range(h)]
ss=[[0 for _ in range(w+2)] for _ in range(h+2)]
for j in range(w):
    for i in range(h):
        ss[i+1][j+1]=s[i][j]
s=[[0 for _ in range(w)] for _ in range(h)]
for j in range(1,w+1):
    for i in range(1,h+1):
        for a in range(-1,2):
            for b in range(-1,2):
                if a==0 and b ==0:
                    continue
                if ss[i+a][j+b]=='#':
                    s[i-1][j-1]+=1
for j in range(w):
    for i in range(h):
        if ss[i+1][j+1]=='#':
            s[i][j]='#'
for i,d in enumerate(s):
    d=map(str,d)
    print(''.join(d))


Measured memory_bytes: 9196
/*|In The Name of Allah|*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<pair<int,int> > vii;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef pair<int, int> pii;
#define el	'\n'
#define lp(i,n) for(int i = 0;i < int(n);i++)
#define rlp(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rng(i,a,b) for(int i = int(a);i <= int(b);i++)
#define mp(x,y)  	make_pair((x),(y))
#define pb(x)    	push_back((x))
#define all(v)  	((v).begin()),((v).end())
#define sz(x)  		((int) (x).size())
#define bits(a) 	__builtin_popcountll(a)
#define fr first
#define sc second
#define pii pair<int, int>
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define SS stringstream
#define ll long long
#define clr(x, y) memset(x, y, sizeof(x))
#define foreach(it,x) for(__typeof__((x).begin()) it = (x).begin(); it != (x).end(); ++it)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
ll gcd(ll a, ll b){if (a == 0)return b;return gcd(b % a, a);}



void MisSiOn_ImPosSiBlE(){
//freopen("portals.in", "r", stdin);
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

}


int const N = 1e3 + 9, mod = 1e9+7 , oo = 0x3f3f3f3f;
//------------------------------------------------------------------------------------






int main()
{
    MisSiOn_ImPosSiBlE();

    double x,y;
    cin>>x>>y;
    cout<< fixed<<setprecision(10)<< x/y;
























/*
*/
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;

int main(void)
{
	int N; cin >> N;
	int ans = 1;
	while (N >= 2*ans)ans *= 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<deque>
using namespace std;
const int MAXN=30;
const double EPS=1e-8;
double a[MAXN][4];
double dist[MAXN][MAXN];
int flag[MAXN];
int n,m;
double res;
double dblcmp(double x){
    if(fabs(x)<EPS){
        return 0;
    }
    return x>0?1:-1;
}
double max(double a,double b){
    return dblcmp(a-b)>=0?a:b;
}
double check(){
    double res=0.0;
    for(int i=0;i<n;i++){
        if(flag[i]==-1){
            continue ;
        }
        for(int j=i+1;j<n;j++){
            if(flag[j]!=-1){
                res+=dist[i][j];
            }
        }
    }
    return res;
}
void dfs(int k,int step){
    if(step>=m){
        double t=check();
        res=max(res,t);
        return ;
    }
    if(k>=n){
        return ;
    }
    if(n-k+step<m){
        return ;
    }
    flag[k]=k;
    dfs(k+1,step+1);
    flag[k]=-1;
    dfs(k+1,step);
}
int main(){
    freopen("A.in","r",stdin);
    while(scanf("%d%d",&n,&m)==2){
        for(int i=0;i<n;i++){
            scanf("%lf%lf%lf",&a[i][0],&a[i][1],&a[i][2]);
        }
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                dist[i][j]=(a[i][0]-a[j][0])*(a[i][0]-a[j][0])+
                (a[i][1]-a[j][1])*(a[i][1]-a[j][1])+(a[i][2]-a[j][2])*(a[i][2]-a[j][2]);
            }
        }
        memset(flag,-1,sizeof(flag));
        res=0.0;
        dfs(0,0);
        printf("%.20lf\n",res);
    }
    return 0;
}*/
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<vector>
using namespace std;
const int MAXN=30;
const double EPS=1e-8;
double a[MAXN][4];
double dist[MAXN][MAXN];
int s[MAXN];
double res;
int top;
int n,m;
double check(){
    double res=0.0;
    for(int i=1;i<=top;i++){
        for(int j=i+1;j<=top;j++){
            res+=dist[s[i]][s[j]];
        }
    }
    return res;
}
void dfs(int k){
    if(top>=m){
        double t=check();
        res=max(res,t);
        return ;
    }
    if(k>=n){
        return ;
    }
    if(top+n-k<m){
        return ;
    }
    s[++top]=k;
    dfs(k+1);
    top--;
    dfs(k+1);
}
int main(){
    //freopen("A.in","r",stdin);
    while(scanf("%d%d",&n,&m)==2){
        for(int i=0;i<n;i++){
            scanf("%lf%lf%lf",&a[i][0],&a[i][1],&a[i][2]);
        }
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                dist[i][j]=(a[i][0]-a[j][0])*(a[i][0]-a[j][0])+
                (a[i][1]-a[j][1])*(a[i][1]-a[j][1])+
                (a[i][2]-a[j][2])*(a[i][2]-a[j][2]);
            }
        }
        res=0.0;
        top=0;
        dfs(0);
        printf("%.20lf\n",res);
    }
    return 0;
}

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

int main()
{
	int n,x,sum=0,c=0,a;
	cin>>n>>x;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int k = sizeof(arr)/sizeof(arr[0]);
    sort(arr, arr+k);
	for(int i=0;i<n;i++)
	{
		if(sum+arr[i]<=x)
		{
			sum+=arr[i];
			c++;
		}
	}
	if(c==n)
	{
		a=x-sum;
		a=a/arr[0];
		c+=a;
	}
	cout<<c;
}	

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

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

    char c;

    cin >> c;

    switch (c) {
        case 'a':
        case 'i':
        case 'u':
        case 'e':
        case 'o':
            cout << "vowel";
            break;
        default:
            cout << "consonant";
            break;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.thief", "r", stdin);
	string str = "";
	int count = 0;

	while (getline (cin, str ) ){
		int max_wight;
		stringstream ssw (str );
		ssw >> max_wight;

		if (max_wight == 0 ){
			break;
		} // end if
		++count;
		
		int n;
		getline (cin, str );
		stringstream ssn(str);
		ssn >> n;

		vector <int> W (n, 0 );
		vector <int> V (n, 0 );
		vector <int> DP (max_wight + 1, 0 );
		int i,j;

		for (i = 0; i < n; ++i){
			getline (cin, str );
			while (str.find (',') != string::npos ){
				str = str.replace ( str.find (','), 1, " " );
			} // end while
			stringstream ss(str);
			ss >> V[i] >> W[i];
		} // end for

		for (i = 0; i < n; ++i){
			vector <int> dp = DP;
			for (j = W[i]; j <= max_wight; ++j){
				int p = j - W[i];
				if (dp[p] + V[i] > DP[j] ){
					DP[j] = dp[p] + V[i];
				} // end if 
			} // end for
		} // end for

		int maxvalue = DP[max_wight];
		int minwight = max_wight;

		for (j = max_wight - 1; j >= 0; --j){
			if (DP[j] >= maxvalue){
				minwight = j;
				maxvalue = DP[j];
			} // end if
		} // end for
		cout << "Case " << count << ':' << endl;
		cout << maxvalue << endl;
		cout << minwight << endl;
			
	} // end while	
	
	return 0;
}

Measured memory_bytes: 0
# https://atcoder.jp/contests/abc166/tasks/abc166_e

from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

# j - i = Ai + Aj (i < j)
# i + Ai = j - Aj
# Li = Ri

ans = 0
memo = defaultdict(int)  # i + Aiを記録

for i in range(N):
    # i + Ai
    memo[i + 1 + A[i]] += 1


# jについて，j > iの値を確認
for j in range(N):
    ans_j = j + 1 - A[j]
    if ans_j in memo:
        ans += memo[ans_j]

print(ans)

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

struct UnionFind{
    vector<int> par;
    UnionFind(int n) : par(n){
       REP(i, n) par[i] = i;
    }
    int root(int x){
        if(x == par[x]) return x;
        else return par[x] = root(par[x]);
    }
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(x < y) swap(x, y);
        par[x] = y;
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
};

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

    int n, m;
    cin >> n >> m;

    vector<int> P(n);
    REP(i, n){
        int p;
        cin >> p;
        p--;
        P[i] = p;
    }

    UnionFind uf(n);
    REP(i, m){
        int x, y;
        cin >> x >> y;
        x--; y--;
        uf.unite(x, y);
    }

    int ans = 0;
    REP(i, n){
        if(uf.root(P[i]) == uf.root(i)){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
def resolve():
    n = int(input())
    s = input()
    rlist = []
    glist = []
    blist = []
    for i in range(n):
        if s[i] == "R":
            rlist.append(i)
        elif s[i] == "G":
            glist.append(i)
        else:
            blist.append(i)
    blist = set(blist)
    ans = 0
    for i in range(len(rlist)):

        for j in range(len(glist)):
            r = rlist[i]
            ng = 0
            g = glist[j]
            s = sorted([r, g])
            r = s[0]
            g = s[1]
            if (r-(g-r)) in blist:
                ng += 1
            if (g+(g-r)) in blist:
                ng += 1
            if (r+g) % 2 == 0 and (r+g)//2 in blist:
                ng += 1
            ans += len(blist)-ng
    print(ans)
resolve()

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

#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vi >
#define vpii vector<pii >
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define LL long long
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;

template<typename T>
inline int getplc(T x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}

LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}

template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) {
	return max(a, Smax(args...));
}
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) {
	return min(a, Smin(args...));
}

template <typename T>
#define errorl(args...) {  \
	string _s = #args;   \
	replace(_s.begin(), _s.end(), ',', ' ');  \
    stringstream _ss(_s);  \
    istream_iterator<string> _it(_ss);  \
    errl(_it, args);  \
}
void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}
#define error(args...) {  \
  string _s = #args;  \
  replace(_s.begin(), _s.end(), ',', ' ');  \
  stringstream _ss(_s);  \
  istream_iterator<string> _it(_ss);  \
  err(_it, args);  \
  cerr<<endl; \
}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}

void Solve() {
  int k;
  cin >> k;
  rep (i, 1, k) cout << "ACL";
}


int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
//  freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}


Measured memory_bytes: 3436
/**
 * @author karayuu
 */

fun main(args: Array<String>) {
    val blue = readLine()!!.toInt()
    val blueList = (1..blue).map { readLine()!! }

    val red = readLine()!!.toInt()
    val redList = (1..red).map { readLine()!! }

    val check = blueList.distinct().toMutableList() + redList.distinct()
    val yen = check.map { check ->
        blueList.filter { it == check }.count() - redList.filter { it == check }.count()
    }.max()!!

    println(
            if (yen <= 0) 0 else yen
    )
}

Measured memory_bytes: 33692
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		int n=cin.nextInt();List<String> B=new ArrayList<>(),S=new ArrayList<>();
		for(int i=0;i<n;i++) {
			B.add(cin.next());S.add(B.get(i));
		}
		
		//bubble
		boolean flag=true;
		while(flag) {
			flag=false;
			for(int i=n-1;i>0;i--) {
				char c1[]=B.get(i).toCharArray(),c2[]=B.get(i-1).toCharArray();
				if(c1[1]<c2[1]) {
					Collections.swap(B, i, i-1);
					flag=true;
				}
			}
		}
		
		for(int i=0;i<n;i++) {
			System.out.print(B.get(i));
			if(i!=n-1)System.out.print(" ");
		}
		System.out.println();
		System.out.println("Stable");
		
		//Selection
		for(int i=0;i<n-1;i++) {
			int min=i;
			for(int j=i+1;j<n;j++) {
				char c1[]=S.get(j).toCharArray(),c2[]=S.get(min).toCharArray();
				if(c1[1]<c2[1])min=j;
			}
			if(min!=i)Collections.swap(S, i, min);
		}
		
		for(int i=0;i<n;i++) {
			System.out.print(S.get(i));
			if(i!=n-1)System.out.print(" ");
		}
		System.out.println();
		
		int c=0;
		for(int i=0;i<n;i++) {
			if(B.get(i).equals(S.get(i)))c++;
		}
		if(c==n)System.out.println("Stable");
		else System.out.println("Not stable");
	}

}



Measured memory_bytes: 26468
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;
 
typedef int ll;
 
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define endl '\n'
 
typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;
 
const int mod=1e9+7;
 
int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}
 
void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
 
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}
 
ll main() {
	// freopen("Task.in", "r", stdin);freopen("Task.out", "w", stdout);
	int n, x, t;
	cin>>n>>x>>t;

	int ret = n/x;
	ret+=(n%x!=0);

	cout<<ret*t<<endl;
}

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

int sum_diggit(int n){
  int sum =0;
  while( n > 0){
    sum += n%10;
    n /= 10;
  }
  return sum;
}

int main(){
 
  int N;
  cin >> N;
  int add = 0;
  int digit = sum_diggit(N);

  if( N % digit == 0)	cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <list>
using namespace std;

typedef long long ll;

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

#define FOR(i, start, end) for(ll i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {
    int N;
    cin >> N;
    vector<int> A(N);
    REP (i, N) {
        cin >> A[i];
    }
 
    sort(A.rbegin(), A.rend());
    ll ans = 0;
    int t = N - 1;
    REP (i, N) {
        int limit = 2;
        if (i == 0) {
            limit = 1;
        }
        REP (j, limit) {
            if (t > 0) {
                ans += A[i];
                t--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <stdlib.h>
using namespace std;

int oh[4][3][10]={};

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

  int b,f,r,v;

  for(int i=0; i<n; i++){
    cin >> b >> f >> r >> v;

    oh[b-1][f-1][r-1] += v;
    if(oh[b-1][f-1][r-1] < 0){
      oh[b-1][f-1][r-1] = 0;
    }else if(oh[b-1][f-1][r-1] > 9){
      oh[b-1][f-1][r-1] = 9;
    }
  }

  for(int i=0; i<4; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        cout << " " << oh[i][j][k];
        if(k==9){
          cout << endl;
        }
      }
    }
    if(i!=3){
      cout << "####################" << endl;
    }
  }
  
}

Measured memory_bytes: 1160
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    numbers = list(map(int, input().split()))

    more = X
    less = X

    if X not in numbers:
        print(X)
    else:
        while (True):
            more += 1
            less -= 1

            if less not in numbers:
                print(less)
                break

            if more not in numbers:
                print(more)
                break

Measured memory_bytes: 9192
#include <iostream>
#include <cmath>

using namespace std;

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

    int a[1000];

    while (n != 0) {
        double sum = 0.0;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            sum += a[i];
        }
        double average = 1.0 * sum / n;
        double x = 0;
        for (int i = 0; i < n; i++)
            x += (a[i] - average) * (a[i] - average);
        double standardDeviation = sqrt(x / n);
        cout << standardDeviation << endl;

        cin >> n;
    }

    return 0;
}



Measured memory_bytes: 3248
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 

#define lo long long int

lo x[100006], v[100006], rm[100006], lm[100006];
int main() {
	
	lo n, c,vs,rt=0,lt=0;
	cin >> n>> c;

	fori1(n) {
		cin >> x[i];
		cin >> v[i];
		
	}
	vs = 0;
	fori1(n) {
		vs += v[i];
		rm[i] = max(rm[i-1], vs - 2*x[i]);
		//printf("(%d,%lld)", i, rm[i]);
	}
	vs = 0;
	for (int i = n;i >= 1;i--) {
		vs += v[i];
		rt = max(rt, vs - (c - x[i]) + rm[i - 1]);
	}
	vs = 0;
	for (int i = n;i >= 1;i--) {
		vs += v[i];
		lm[i] = max(lm[i + 1], vs -  2*(c-x[i]));
		//printf("(%d,%lld)", i, rm[i]);
	}
	vs = 0;
	fori1(n) {
		vs += v[i];
		lt = max(lt, vs -  x[i] + lm[i + 1]);
	}
	cout << max(rt,lt);
	//system("pause");

	return 0;

}


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

int main() {
    int n, m, a, b, ans = 0;
    cin >> n >> m;
    int h[n];
    for(int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<vector<int>> v(n);
    for(int i = 0; i < m; ++i) {
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(int i = 0; i < n; ++i) {
        bool f = true;
        for(int j = 0; j < v[i].size(); ++j) {
            if(h[i] <= h[v[i][j]]) f = false;
        }
        if(f) ans++;
    }
    cout << ans << '\n';
    
    return 0;
}


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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    string str;
    cin >> str;
    string abc = "ABC";
    int result = 0;
    for (int i = 0; i+2 < n; ++i) 
    	if (str.substr(i, 3) == abc) ++result;
    cout << result << '\n';
}

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main() {
    int n;
    cin >> n;
    map<ll,int> mp;
    REP(i,n){
        ll t;
        cin >> t;
        mp[-t]++;
    }
    vector<ll> v;
    for(const auto& e:mp){
        ll a = e.first;
        int b = e.second;
        if(b>=2)v.push_back(a);
        if(b>=4){v.push_back(a);v.push_back(a);}
        if(v.size()>=2){
            COUT(v[0]*v[1]);
            return 0;
        }
    }
    COUT(0);
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;

string split(string str, char c) {
	string res;
	for (int i = 0; i < str.length(); i++) {
		if (str[i] == c) {
			break;
		}
		else {
			res += str[i];
		}
	}
	return res;
}

string readed(string str, int n) {
	int r = 0;
	if (n > 0) {
		if (n > 1) {
			r = 2;
		}
		else {
			r = 1;
		}
	}
	return str.substr(r, str.length());
}

int check_num(string str, char c) {
	if (str == split(str, c)) {
		return 0;
	}
	else {
		if (split(str, c) == "") {
			return 1;
		}
		else {
			return std::atoi(split(str, c).c_str());
		}
	}
}

int main(void) {
	char mcxi[4] = { 'm', 'c', 'x', 'i' };
	int n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		std::string m1,m2;
		std::vector<int> c(4);
		cin >> m1;
		cin >> m2;
		for (int j = 0; j < 4; j++) {
			int c1,c2;
			c1 = check_num(m1, mcxi[j]);
			c2 = check_num(m2, mcxi[j]);
			c[j] = c1 + c2;
			m1 = readed(m1, c1);
			m2 = readed(m2, c2);
		}
		for (int j = 3; j > 0; j--) {
			if (c[j] > 9) {
				c[j-1] += 1;
				c[j] -= 10;
			}
		}
		for (int j = 0; j < 4; j++) {
			if (c[j] > 0) {
				if (c[j] > 1) {
					cout << c[j];
				}
				cout << mcxi[j];
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
int main() {
  string w;
  cin >> w ;
  if(w[0]==w[1] || w[2]==w[3] || w[1]==w[2] ){
    cout << "Bad" <<endl;
  }
    else{
      
  cout << "Good" <<endl;
}
}

Measured memory_bytes: 256
from sys import stdin
import heapq

n,m = map(int, input().split())
a = [int(x)*(-1) for x in stdin.readline().rstrip().split()]
heapq.heapify(a)

for i in range(m):
    temp = (-1)*heapq.heappop(a)//2
    heapq.heappush(a,temp*(-1))

print(sum(a)*(-1))


Measured memory_bytes: 14180
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;
typedef pair<ll,int> P;


long long  gcd(long long x,long long y){
  long long mindata,maxdata;
  mindata=min(x,y);
  maxdata=max(x,y);
  while(maxdata%mindata!=0){
    long long temp;
    temp=maxdata%mindata;
    maxdata=mindata;
    mindata=temp;
  }
  return mindata;
}



int main(){
  int N,temp;
  cin>>N;
  ll ans=0;
  for(int i=0;i<N;i++){
    cin>>temp;
    ans+=temp;
  }
  cout<<ans-N<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int x,y,z;
    cin >> x >> y >> z;
    x -= z;
    int tmp = y+z;
    cout << x / tmp << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int x;
  cin >> x;
  if(x>=30)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

int main() {
	int count;
	int counter = 0;
	int flag = 0;
	cin >> count;
	vector <int> nums(count);
	for (auto& num : nums) {
		cin >> num;
	}
	while (true) {
		for (auto& num : nums) {
			if (num % 2 != 0) {
				flag = 1;
			}
			else {
				num /= 2;
			}
			if (flag) break;
		}
		if (flag)break;
		else counter++;
	}
	
	cout << counter;

}

Measured memory_bytes: 256
<?php
  $a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
 
$c=str_split($a);
$d=str_split($b);
 
$num=strlen($a);
 
if($a==$b){
  echo 0;
  exit;
}
$count=0;
 
for($i=0;$i<=$num;$i++){
  if($c[$i]!==$d[$i]){
    $count+=1;
  }
}
 echo $count;
?>

Measured memory_bytes: 41460
#include<iostream>
#include<algorithm>
using namespace std; 
int a[80000],b[440000];
int main()
{
	int i,j=0,k;
	a[1]=2;a[2]=3;a[3]=5;
	a[4]=7;a[5]=11;a[6]=13;a[7]=17;
	a[8]=19;a[9]=23;a[10]=29;a[11]=31;a[12]=37;
	for(i=37;i<1000000;i+=2){
		if(i%3&&i%5&&i%7&&i%11&&i%13)
			if(i%17&&i%19&&i%23&&i%29&&i%31)
			         b[j++]=i;
	}
	int max=j-1;j=12;
	for(i=0;i<=max;i++){
		for(k=12;a[k]*a[k]<=b[i];k++){
			if(b[i]%a[k]==0) break;
		}
		if(a[k]*a[k]>b[i]) {
			a[j++]=b[i];
		}
	} 
	max=j-1;
	long long L;int c[100];
	while(cin>>L&&L){
		if(L==1)  cout<<1<<endl;
		else{
			for(i=0;i<100;i++) c[i]=1;
			int t=0;
			for(i=1;i<=max;i++){
				while(L%a[i]==0) { L/=a[i];c[t]++;}
				if(c[t]>1)  t++;
				if(L==1) break;
			}
			if(L>1) c[99]=2;
			long long sum=1;
			for(i=0;i<100;i++){
				 sum*=(2*c[i]-1);
			}
			cout<<(sum+1)/2<<endl;
		}     
	}
}

Measured memory_bytes: 2064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  int ans = max(max(10 * A + B + C, A + 10 * B + C), A + B + 10 * C);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string st;
    cin>>st;
    bool f[26]={};
    for(int i=0;i<st.length();i++){
        f[st[i]-'a']=true;
    }
    for(int i=0;i<26;i++){
        if(!f[i]){
            cout<<(char)('a'+i)<<endl;
            break;
        }
        if(i==25){
            cout<<"None"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n,t,c1,c2;
set <int> v;
int main()
{
    cin>>n>>t;
    for (int i=0;i<n;i++)
    {
        cin>>c1>>c2;
        if (c2<=t)
            v.insert(c1);
    }
    if (v.size()==0)
        cout<<"TLE";
    else
    {
        set <int> :: iterator it;
        it=v.begin();
        cout<<*it;
    }
    return 0;
}


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

int main(){
    
    int y,m,d;

    char c1,c2;

    cin>>y>>c1>>m>>c2>>d;

    if( m > 4) cout<<"TBD"<<endl;

    else cout<<"Heisei"<<endl;

    return 0;
}

Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
ans = 0
ans2 = 10**10
if (a+b) / 2 > c:
    x2 = x - min(x,y)
    y2 = y - min(x,y)
    ans += 2 * min(x,y) * c
    ans2 = 2 * max(x,y) * c
else:
    x2 = x
    y2 = y
ans += a*x2 + b*y2

print(min(ans,ans2))

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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define sz(x)          (int) x.size()
#define MOD 1000000007
#define EPS 1e-7
#define lol    {cout<<i<<" "<<-j<<endl; goto here;}
#define lol2    {cout<<i<<" "<<j<<endl; goto here;}

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
        ll x; cin>>x;
        for(ll i = 0; i<=1000; i++){
            for(ll j = 0; j<=1000; j++){
                if((ll)power(i, 5) + power(j, 5)==x)lol
                if((ll)power(i, 5) - power(j, 5)==x)lol2
            }
        }

    here:{};
	return 0;
}


Measured memory_bytes: 3652
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


n = int(input())
if n == 1:
    print(0)
    exit()
z = factorization(n)
cnt = 0
for item in z:
    p = item[0]
    e = item[1]
    num = 1
    while e >= num:
        e -= num
        cnt += 1
        num += 1

print(cnt)

Measured memory_bytes: 9492
import sys

input = sys.stdin.readline
s = int(input())
n_list = [s]
i = 0
while True:
    a_i = n_list[i]
    if a_i % 2 == 0:
        n_list.append(int(a_i/2))
    else:
        n_list.append(int(a_i*3+1))
    i += 1
    if i == len(set(n_list)):
        print(i+1)
        break


Measured memory_bytes: 3068
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;

struct bag
{
    int w,v;
}g[160];

bool cmp(bag a,bag b)
{
    return a.v > b.v;
}
bag A[160],B[160],C[160],D[160];

LL swa[160],swb[160],swc[160],swd[160];//重量的前缀和
LL sva[160],svb[160],svc[160],svd[160];//价值的前缀和

int main(void)
{
    int n,w,i,j,k,l;
    int a,b,c,d;
    while(scanf("%d%d",&n,&w)==2)
    {
        a = b = c = d = 0;
        for(i=1;i<=n;i++)
        {
            cin>>g[i].w>>g[i].v;
            if(g[i].w == g[1].w)
                A[++a] = g[i];
            if(g[i].w == g[1].w + 1)
                B[++b] = g[i];
            if(g[i].w == g[1].w + 2)
                C[++c] = g[i];
            if(g[i].w == g[1].w + 3)
                D[++d] = g[i];
        }
        sort(A+1,A+a+1,cmp);
        sort(B+1,B+b+1,cmp);
        sort(C+1,C+c+1,cmp);
        sort(D+1,D+d+1,cmp);
        swa[0] = swb[0] = swc[0] = swd[0] = 0;
        sva[0] = svb[0] = svc[0] = svd[0] = 0;
        for(i=1;i<=a;i++)
        {
            swa[i] = swa[i-1] + A[i].w;
            sva[i] = sva[i-1] + A[i].v;
        }
        for(i=1;i<=b;i++)
        {
            swb[i] = swb[i-1] + B[i].w;
            svb[i] = svb[i-1] + B[i].v;
        }
        for(i=1;i<=c;i++)
        {
            swc[i] = swc[i-1] + C[i].w;
            svc[i] = svc[i-1] + C[i].v;
        }
        for(i=1;i<=d;i++)
        {
            swd[i] = swd[i-1] + D[i].w;
            svd[i] = svd[i-1] + D[i].v;
        }
        int sumv = 0;
        int ans = 0;
        for(i=0;i<=a;i++)
        {
            for(j=0;j<=b;j++)
            {
                for(k=0;k<=c;k++)
                {
                    for(l=0;l<=d;l++)
                    {
                        LL sum = swa[i] + swb[j] + swc[k] + swd[l];
                        if(sum <= (LL)w)
                        {
                            ans = max((LL)ans,sva[i]+svb[j]+svc[k]+svd[l]);
                        }
                    }
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
typedef long long ll;
                                                                            /*,---.   ,--.                          ,--.
                                                                            '   .-'  |  ,---.  ,--.,--. ,--.  ,--. `--'
                                                                            `.  `-.  |  .-.  | |  ||  |  \  `'  /  ,--.
                                                                            .-'    | |  | |  | '  ''  '   \    /   |  |
                                                                            `-----'  `--' `--'  `----'     `--'    `--'*/
using namespace std;
multiset<int> all_val;
vector<int> coord;
vector<int> hight;

int main()
{
    int n;
    cin >> n;
    long long res = 0;
    vector<pair<int, int>> all_pos;
    bool isCor = false;
    for(int i = 0;i<n;i++){
        int a, b;
        cin >> a >> b;
        if(b > a){
            isCor = true;
        }
        all_pos.emplace_back(a,  b);
    }
    if(!isCor){
        cout<<0;
        return 0;
    }
    int mini = 1000000000 + 47;
    long long sum = 0;
    for(int i = 0;i<n;i++){
        sum+=all_pos[i].first;
        if(all_pos[i].second < all_pos[i].first){
            mini = min(mini, all_pos[i].second);
        }
    }
    cout<<sum - mini;

}

Measured memory_bytes: 640
n = int(input())
a = input()
b = input()
c = input()

ans = 0
for i in range(n):
    if (a[i] == b[i]) and (b[i] == c[i]):
        continue
    if (a[i] == b[i]) or (b[i] == c[i]) or (c[i] == a[i]):
        ans += 1
    else:
        ans += 2

print(ans)


Measured memory_bytes: 3064
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

n=inp()
p = inpl()
sorted_p = sorted(p)
diff=0
for i in range(n):
    if p[i] != sorted_p[i]:
        diff += 1
if diff == 0 or diff == 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 4324
answers = Array.new
while line = $stdin.gets
	n = line.chomp.to_i	
	break unless n > 0
	sum = 0
	1.upto( n ){ |i|
		check = i
		while (check % 5) == 0
			sum += 1
			check /= 5
		end
	}
	answers << sum
end
answers.each{ |a| puts a }


Measured memory_bytes: 6088
#include<stdio.h>

int main()
{
	int i,j,p;
	for(i=1;i<=9;i++)
	{
		for(j=1;j<=9;j++)
		{
			p=i*j;
			printf("%dx%d=%d\n",i,j,p);
		}
	}
	return 0;
}

Measured memory_bytes: 0
INF = float('inf')

cnt = 0

def merge_sort(num_list,left,right):
    if left+1 < right:
        middle = (left+right)//2
        merge_sort(num_list,left,middle)
        merge_sort(num_list,middle,right)
        merge(num_list,left,middle,right)

def merge(num_list,left,middle,right):
    global cnt
    left_list  =  num_list[left:middle] + [INF]
    right_list = num_list[middle:right] + [INF]

    i,j = 0,0
    for k in range(left,right):
        if left_list[i] <= right_list[j]:
            num_list[k]  = left_list[i] 
            i += 1
        else:
            num_list[k]  = right_list[j] 
            j += 1 
        cnt += 1

n = int(input())
n_list = list(map(int,input().split()))
merge_sort(n_list,0,len(n_list))
print(' '.join([str(i) for i in n_list]))
print(cnt)


Measured memory_bytes: 66980
#include <bits/stdc++.h>
#define MAXN 100002
using namespace std;

int n;
vector <int> adjList[MAXN];

vector<int> bfs(int start){
    vector<int> dist (n+1, -1);
    queue<int> q;
    q.push(start);
    dist[start] = 0;
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(int v : adjList[u]){
            if(dist[v]==-1){
                dist[v] = dist[u]+1;
                q.push(v);
            }
        }
    }
    return dist;
}



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 1; i < n; i++){
        int a, b;
        cin >> a >> b;
        adjList[a].push_back(b);
        adjList[b].push_back(a);
        
    }
    vector<int> F = bfs(1);
    vector<int> S = bfs(n);
    int l = 0;
    int r = 0;
    for(int i = 1; i <= n; i++){
        if(F[i]<=S[i]){
            l++;
        }else{
            r++;
        }
    }
    if(l > r){
        cout << "Fennec" << "\n";
    }else{
        cout << "Snuke" << "\n";
    }
    return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int q,h,s,d;
    int n;
    cin>>q>>h>>s>>d;
    cin>>n;
    q*=8,h*=4,s*=2;
    int mi=min(q,h);
    mi=min(mi,s);
    int mi2=min(mi,d);
    long long sum=1LL*n/2*mi2;
    if(n&1)sum+=mi/2;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int n,m=0,i,j,k,len1,len2;
char s1[10001],s2[10001];
int main(){
	cin>>s1>>s2;
	len1=strlen(s1);
	len2=strlen(s2);
	n=len2-len1;
	for(i=0;i<len1;i++){
		if(s1[i]!=s2[i]){
			m++;
		}
	}
	if(m==0&&n==1){
		printf("Yes");
	}
	else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 3724
import java.io.*;
 
class Main
{
   public static void main(String[] args) throws IOException
   {
 
      BufferedReader br =
       new BufferedReader(new InputStreamReader(System.in));
 
      String str = br.readLine();
      int x = Integer.parseInt(str);
 
      System.out.println( (int)Math.pow(x,3) );
 
   }
}

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

int main()
{
    int N,A;
    bool check = true;
    cin>>N;
    for(int i=0;i<N;i++)
    {
        cin>>A;
        if(A%2==0)
        {
            if(A%3!=0&&A%5!=0)
            {
                check = false;
            }
        }
    }

    if(check)
    {
        cout<<"APPROVED"<<endl;
    }
    else
    {
        cout<<"DENIED"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace().map(|e| e.parse().unwrap());
    let n: usize = itr.next().unwrap();
    let k = itr.next().unwrap();

    println!("{}", k * (k - 1).pow((n - 1) as u32));
}


Measured memory_bytes: 4352
#include<cstdio>

int main(){
    int N, arr[105], x;
    int sum = 0;
    scanf("%d",&N);

    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
        sum+=arr[i];
    }
    int M, p;
    scanf("%d",&M);
    for(int i=0;i<M;i++){
        scanf("%d%d",&p,&x);
        printf("%d\n",sum-arr[p-1]+x);
    }
    return 0;
}
// test

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

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

using namespace std;

int main(){
	int N;
	while(cin >> N, N){
		int sum=0, mi=0, ans=0, r[1005], w[1005];

		rep(i,N){
			cin >> r[i] >> w[i];
			if( r[i] > r[mi] ) mi = i;
			sum += r[i];
			ans += r[i] + w[i];
		}

		int dp[2005]={};
		dp[0] = true;
		rep(i,N) if(i!=mi) for(int j=1000; j>=0; j--) dp[ j+w[i] ] |= dp[j];

		int tmp = max(0, 2*r[mi] - sum);
		for(int i=0; !dp[tmp-i]; i++) ans++;

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

Measured memory_bytes: 3128
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
mt19937 rnd(1337);
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
#define pNN pair <Node *, Node *>
#define SZ(x) (int)(x).size()
#define pii pair <int, int>
#define pb push_back
#define rev reverse
#define ins insert
#define ers erase
#define S second
#define F first
#define int ll
const int N = 2e5 + 10, INF = 1e9 + 10;


vector <int> g[N];

int h[N], d[N];
bool used[N];
int sum[N];
int n, k, c;
int cnt = 0;

void dfs(int v) {
	used[v] = true;
	for (auto to : g[v]) {
		if (!used[to]) {
			h[to] = h[v] + 1;
			dfs(to);
			d[v] = max(d[v], d[to]);
			sum[v] += sum[to];
		}
	}
	++h[v];
	++d[v];
	if (h[v] >= k) {
		++cnt;
		++sum[v];
	}
}

void solve() {
	cin >> n >> k >> c;
	string s;
	cin >> s;
	vector <int> vec;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'o') {
			vec.pb(i + 1);
		}
	}
	int ptr = -1;
	for (int i = 0; i < SZ(vec); ++i) {
		while (vec[ptr + 1] <= vec[i] - c - 1) {
			++ptr;
		}
		if (ptr != -1) {
			g[ptr].pb(i);
		}
	}
	for (int i = 0; i < SZ(vec); ++i) {
		if (!used[i]) {
			dfs(i);
		}
	}

	for (int i = 0; i < SZ(vec); ++i) {
		if (sum[i] < cnt) {
			continue;
		}
		if (d[i] - 1 >= k) {
			continue;
		}
		if (i != 0) {
			if (h[i - 1] + d[i] - 1 >= k) {
				continue;
			}
		}
		cout << vec[i] << '\n';
	}
	
}
 
signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    #ifdef Solenoid555
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1;
    //cin >> t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 28424
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int nmax=200005;
vector<int> v[nmax];
int arb[4*nmax],best[nmax],b[nmax],cost[nmax];
int n,m,i,j,num,x,y,st,dr,ans,poz,value;
void query(int nod,int l,int r)
{
    if(st<=l&&r<=dr)
    {
        ans=min(ans,arb[nod]);
        return;
    }
    int m=(l+r)/2;
    if(st<=m) query(2*nod,l,m);
    if(m<dr) query(2*nod+1,m+1,r);
}
void update(int nod,int l,int r)
{
    if(l==r)
    {
        arb[nod]=min(arb[nod],value);
        return;
    }
    int m=(l+r)/2;
    if(poz<=m) update(2*nod,l,m);
    else update(2*nod+1,m+1,r);
    arb[nod]=min(arb[2*nod],arb[2*nod+1]);
}
int main()
{
    //freopen("data.in","r",stdin);
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>b[i];
        if(b[i]==0)
        {
            num++;
            cost[i]=-1;
        }
        else cost[i]=1;
    }
    for(i=1;i<=4*n;i++)
        arb[i]=(1<<30);
    cin>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
    }
    for(i=1;i<=n;i++)
        best[i]=(1<<30);
    for(i=1;i<=n;i++)
    {
          for(j=0;j<v[i].size();j++)
        {
            st=max(i-1,1);dr=v[i][j];ans=best[i-1];
            query(1,1,n);
            if(ans<best[v[i][j]])
            {
                best[v[i][j]]=ans;
                poz=v[i][j];value=best[v[i][j]];
                update(1,1,n);
            }

        }
        best[i]=min(best[i-1]+cost[i],best[i]);

    }
    cout<<best[n]+num;
    return 0;
}


Measured memory_bytes: 14336
#include <iostream>
using namespace std;
int main(){
	int x,y;
	while (1){
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		else if (x < y){
			cout << x << " " << y << endl;
		}
		else if (x > y){
			cout << y << " " << x << endl;
		}
		else if (x>y||x==y){
			cout << x << " " << y << endl;
		} 
	}

	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
string ans="";
int main()
{
	int n;
	cin >>n;
	if(n==0)
	{
		puts("0");
		return 0;
	}
	bool ok=false;
	while(n)
	{
        ok=!ok;
	    if(n%2)
	    {
		   if(!ok)
		   n++;
		   else
		   n--;
		   ans+="1";
		   n/=2;
	    }
	    else
	    {
		   n/=2;
		   ans+="0";
	    }
	}
	reverse(ans.begin(),ans.end());
	cout <<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k]:
                if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                    ans+=1
print(ans)

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

using namespace std;
long long p=1;
int main() {
    int n,a[100005]={},ok=1;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        
    }
    for(int i=n-1;i>=1;i--){
        if(a[i]>a[i+1])
            {
                if(a[i]-a[i+1]==1){
                    a[i]--;
                }
                else{
                    ok=0;
                    break;
                }
            }
    }
    
    if(ok==0){
        cout<<"No";
        
    }
    else{
        cout<<"Yes";
    }
}

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

int main(){
  int a;
  int b;
  scanf("%d %d",&a,&b);
  if(a==b){
    printf("Draw");}
  else{
    if(a==1 || b==1){
      if(a==1){
	printf("Alice");}
      else{
	printf("Bob");}
    }
    else{
      if(a>b){
	printf("Alice");}
      else{
	printf("Bob");}
    }
  }

  return 0;
}

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

int main()
{
    long long int N, i, div, result;
    cin >> N;
    vector<long long int> A_sum(N);
    vector<long long int> A(N);
    div = 1;
    for (i = 0; i < 9; i++)
    {
        div *= 10;
    }
    div += 7;
    for (i = 0; i < N; i++)
    {
        cin >> A[i];
        A[i] = A[i] % div;
    }
    A_sum[N - 1] = A[N - 1];
    for (i = N - 2; i > 0; i--)
    {
        A_sum[i] = A_sum[i + 1] + A[i];
        A_sum[i] = A_sum[i] % div;
    }
    result = 0;
    for (i = 0; i < N - 1; i++)
    {
        result += A[i] * A_sum[i + 1];
        result = result % div;
    }
    cout << result << endl;
    return 0;
}

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

int main (){
	char c;
	scanf("%c", &c);
	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') puts("vowel");
	else puts("consonant");
	return 0;
}


Measured memory_bytes: 3736
s = input()
t = input()
ls = sorted(list(s))
lt = sorted(list(t),reverse=True)
os = [ord(x) for x in ls]
ot = [ord(x) for x in lt]
for i in range(min(len(s),len(t))):
	if os[i] < ot[i]:
		print('Yes')
		break
	elif os[i] > ot[i]:
		print('No')
		break
else:
	if len(s) < len(t):
		print('Yes')
	else:
		print('No')


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <cmath>
#include <list>
#include <vector>
#include <tuple>
using namespace std;
//#define FILENAME "./F/in/b04"
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long

#define MOD 1000000007

int n,m,tmp,a,b,ans;
vector<int> h;
vector<int> good;

int main(int argc, char *argv[]) {

#ifdef FILENAME
  ifstream file(FILENAME);
  cin.rdbuf(file.rdbuf());
#endif

  cin >> n >> m;
  rep(i,n) {
    cin >> tmp;
    h.push_back(tmp);
    good.push_back(1);
  }

  rep(i,m) {
    cin >> a >> b; a--; b--;
    if(h[a] < h[b]) good[a] = 0;
    else if(h[a] > h[b]) good[b] = 0;
    else good[a] = good[b] = 0;
  }

  ans = 0;
  rep(i,n) ans += good[i];
  cout << ans << endl;
  
  
  return 0;
}


Measured memory_bytes: 4296
#include<stdio.h>

int main(){
	
	int a[7],b[7],c[2][7],z,Z,x,X;
	
	for(int i=0;i<6;i++){
		
		scanf("%d",&a[i]);
	}
	for(int i=0;i<6;i++){
		
		scanf("%d",&b[i]);
		c[0][i]=i;
		c[1][i]=b[i];
	}
	
	X=0;
	for(int i=0;i<6;i++){
		
		///??????c[1][i]?????????///
		
		for(int t=0;i!=c[0][0];t++){
			if(t==4) break;
			z=c[0][0];
			Z=c[1][0];
			c[0][0]=c[0][4];
			c[1][0]=c[1][4];
			c[0][4]=c[0][5];
			c[1][4]=c[1][5];
			c[0][5]=c[0][1];
			c[1][5]=c[1][1];
			c[0][1]=z;
			c[1][1]=Z;
		}
		if(i!=c[0][0]){
			for(int t=0;i!=c[0][0];t++){
				if(t==4) break;
				z=c[0][0];
				Z=c[1][0];
				c[0][0]=c[0][2];
				c[1][0]=c[1][2];
				c[0][2]=c[0][5];
				c[1][2]=c[1][5];
				c[0][5]=c[0][3];
				c[1][5]=c[1][3];
				c[0][3]=z;
				c[1][3]=Z;
			}
		}
		///a[]??¨????????????????????´??¢?????????///
		
		for(int t=0;t<4;t++){
			x=0;
			for(int t=0;t<6;t++){
				if(a[t]!=c[1][t]){
					x++;
				}
			}
			//printf("%d\n",x);
			if(x==0) break;
			
			Z=c[1][1];
			c[1][1]=c[1][3];
			c[1][3]=c[1][4];
			c[1][4]=c[1][2];
			c[1][2]=Z;
		}
		if(x==0) break;
	}
	if(x==0){
		printf("Yes\n");
	}
	else printf("No\n");
	
	return 0;
}

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

template<class T> T lcm(T a,T b){
	return a/__gcd(a,b)*b;
}

int main(){
	long a,b,c,k;
	cin >> a >> b >> c >> k;
	long ans=0;
	if(a>k){
		cout << k;
	}else if(k<=a+b){
		cout << a;
	}else{
		cout << a-(k-a-b);
	}
	
	
	return 0;
}


Measured memory_bytes: 3636