akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),k=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    int sum=0;
    set <int> fact;
    for(auto i:v)
        sum+=i;
    for(int i=1;i<=sqrt(sum);i++)
        if(sum%i==0)
        {
            fact.insert(i);
            fact.insert(sum/i);
        }
    int test=1;
    for(auto i: fact)
    {
        vector <int> rem=v;
        for(auto &j:rem)
            j%=i;
        sort(all(rem));
        vector <int> prefix(n);
        prefix[0]=rem[0];
        for(int i=1;i<n;i++)
            prefix[i]=prefix[i-1]+rem[i];
        for(int j=0;j<n;j++)
        {
            if(prefix[j]==(n-j-1)*i-(prefix[n-1]-prefix[j]))
            {
                if(prefix[j]<=k)
                    test=i;
                break;
            }
        }
    }

    cout<<test<<endl;
    
    
    
    return 0;   
}


 
 


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

int main(){
  int n,ans=0;
  cin>>n;
  vector<int> a(n+1);
  for(int i=1;i<=n;i++) cin>>a[i];
  for(int i=1;i<=n;i++){
    if(a[i]==i){
      swap(a[i],a[i+1]);
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
def main():
    N,M = map(int, input().split())
    inf = 10**9
    p = 2**N
    dp = [inf] * p
    dp[0] = 0
    
    for i in range(M):
        a,b = map(int, input().split())
        c = sum([2**(int(j)-1) for j in list(input().split())])
        for k in range(p):
            if dp[k|c] > dp[k] + a:
                dp[k|c] = dp[k] + a
    if dp[-1] == inf:
        print(-1)
    else:
        print(dp[-1])
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    int h,a;
    cin>>h>>a;
    cout<<h/a+(h%a==0?0:1)<<endl;






return 0;
}


Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))
X_sort = sorted(X)
m1 = X_sort[N // 2 - 1]
m2 = X_sort[N // 2]
for i in range(N):
    if(X[i] < m2):
        print(m2)
    else:
        print(m1)

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (int)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

int main()
{
    ll n;
    cin >> n;
    vll a(n);
    rep(i,n)cin >> a[i];

    sort(all(a));

    if(a[n/2] == a[n/2 - 1]){
        cout << 0 << endl;
        return 0;
    }

    else{
        cout << a[n/2] - a[n/2 - 1] << endl;
        return 0;
    }
        


    return 0;
}

Measured memory_bytes: 1024
<?php
//$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
list($N,$M) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$uft = new UF($N);
for($i=0;$i<$M;$i++) {
  list($A,$B) = array_map('intval',explode(" ",trim(fgets(STDIN))));
  $uft->unite($A,$B);
}
$g=array();
for($i=1;$i<=$N;$i++) {
 $g[]=$uft->find($i);
}
$v = array_count_values($g);
printf("%d\n",count($v)-1);


class UF {
  private $pnode;
  private $sz;
  public function __construct($n)
  {
    $this->pnode = range(0,$n);
    $this->sz = array_fill(0,$n,1);
  }
  public function find($x) {
    return $x==$this->pnode[$x]?$x:$this->pnode[$x]=$this->find($this->pnode[$x]);
  }
  public function unite($x,$y) {
    $x = $this->find($x);
    $y = $this->find($y);
    if ($x==$y) return;
    $this->sz[$x]+=$this->sz[$y];
    $this->pnode[$y]=$x;
  }
  public function same($x,$y) {
    return $this->find($x) == $this->find($y);
  }
  public function size($x) {
    return $this->sz[$this->find($x)];
  }
}


Measured memory_bytes: 28764
#include<bits/stdc++.h>
using namespace std;
int n,ans;
map<pair<int,int>,int> mp;
vector<pair<int,int> > v;
bool vis[55];
void dfs(int p,int q,int n1,int n2,int index)
{
	vis[index]=true;
	if(mp[make_pair(n1-p,n2-q)]!=0)
		dfs(p,q,n1-p,n2-q,mp[make_pair(n1-p,n2-q)]-1);
	return ;
}
main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int x,y;
		cin>>x>>y;
		v.push_back(make_pair(x,y));
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
		mp[make_pair(v[i].first,v[i].second)]=i+1; 
	ans=n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(i!=j)
			{
				int p=v[i].first-v[j].first,q=v[i].second-v[j].second;
				memset(vis,false,sizeof(vis));
				int tmp=0;
				for(int k=0;k<n;k++)
					if(!vis[k])
					{
						dfs(p,q,v[k].first,v[k].second,k);
						++tmp;
					}
				ans=min(ans,tmp);
			}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4096
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    int a, b;
    cin>>a>>b;
    for(int i = 1; i < 1100; i++){
        if(i*8/100 == a && i*10/100 == b){
            cout<<i;
            return ;
        }
    }
    cout<<"-1\n";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main() {
	int a, b;
	for (a = 1; a <= 9; a++) {
		for (b = 1; b <= 9;b++) {
			cout << a << "x" << b << "=" << a*b << "\n";
		}
	}
        char c;
        cin>>c;
	return 0;
}

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
int n ;
vll a ;
ll check(ll x){
	ll ans = 0 ;
	for(int i = 0 ; i < n ; i++) ans += abs(a[i] - (x + i + 1)) ;
	return ans ;
} 
//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	cin >> n;
	a.resize(n);for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	ll d = -1e18 , f = 1e18 , ans = 1e18; 
	while(d <= f){
		ll mid = (d + f) / 2 ;
		if(check(mid + 1) < check(mid - 1)){
			ans =  check(mid + 1) ;
			d = mid + 1 ;
		}
		else if(check(mid - 1) < check(mid + 1)){
			ans =  check(mid - 1);
			f = mid - 1 ;
		}
		else{
			ans = min({ check(mid + 1) , check(mid)}) ;
			break ;
		}
		
	}
	cout << ans << endl ;
	return 0;
}


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

int main() {

	int n;
	bool allSame=true;
	string s;
	int r=0;
	cin>>n;
	vector <string> a(n);
	cin>>s;

	for (int i=0;i<n-1;++i) {
		if (s[i]!=s[i+1]) {
			allSame=false;
			r++;
			if (i==n-2) {
				a[n-1]=s[n-1];
			}
		}
	}

	if (allSame) {
		cout<<1;
	} else {
		cout<<++r;
	}

	return 0;
}

Measured memory_bytes: 1280
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;




int main(void)
{
	//変数の宣言
	char b;

	//よく使う変数
	int i,j,k,l,p,q,r,s;
	int flag=0;
	ll int ans=0;
	int count=0;
	int temp=0;
	int temp1=0;
	int temp2=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;



	//データの読み込み


	scanf("%c",&b);
//	scanf_s("%c",&b);

/*	for(i=0;i<n;i++){
//		scanf("%d",&p[i]);
		scanf_s("%d",&p[i]);
	}*/

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	if(b=='A'){
		printf("T");
	}else if(b=='C'){
		printf("G");
	}else if(b=='T'){
		printf("A");
	}else if(b=='G'){
		printf("C");
	}

	//	printf("計算部分終了\n");

	//出力

	//printf("%lld",ans);

/*	printf("\n");
	for(i=1;i<=n;i++){
		for(j=i;j<=n;j++){
			printf("hanten[%d][%d]={%d,%d}\n",i,j,hanten[i][j][0],hanten[i][j][1]);
		}
	}*/
	
	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;

const int N_MAX = 200000;

int N;
long A[N_MAX + 1];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%ld", &A[i]);
  }
  map<long, int> mp;
  for (int i = 0; i < N; i++) mp[A[i]]++;
  long bin[33] = { 1 };
  for (int i = 1; i < 33; i++) bin[i] = bin[i - 1] * 2;
  sort(A, A + N);

  int count = 0;
  for (int i = N - 1; i >= 0; i--) {
    long n = A[i];
    if (!mp[n]) continue;
    mp[n]--;

    long x = 0;
    for (int j = 0; j < 33; j++) {
      if (bin[j] > n) {
        x = bin[j];
        break;
      }
    }
    if (mp[x - n]) {
      mp[x - n]--;
      count++;
    }
  }
  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 26752
#include "bits/stdc++.h"

// Begin {{{
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)

#ifndef DEBUG
#define dump(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M;
    cin >> N >> M;
    vector<int> t(M);
    rep(i, M) cin >> t[i];
    vector<int> res(N);
    rep(i, M) {
        i64 x = 0;
        rep(j, N) {
            int valid;
            cin >> valid;
            if (valid == t[i]) {
                ++res[j];
            } else {
                ++x;
            }
        }
        res[t[i]-1] += x;
    }
    rep(i, N) cout << res[i] << "\n";
    return 0;
}



Measured memory_bytes: 3156
import heapq
from sys import stdin
input = stdin.readline

#入力
# s = input()
# n = int(input())
n,m = map(int, input().split())
# a = list(map(int,input().split()))
# a = [int(input()) for i in range()]

ab=[]
for i in range(m):
    a,b = map(int, input().split())
    ab.append((a,b))
ab = sorted(ab, key = lambda x: x[1])

     
def main():
    left = 0
    ans = 0
    for a,b in ab:

        if left < a:
            left = b-1
            ans +=1
    print(ans)


    
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 19096
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;
  cin >> n;
  cout <<a[n-1];
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
    int x, y;
    cin >> x >> y;
    int a = 100000;
    
    int ans = 0;
    if(x <= 3) ans += (4-x)*a;
    if(y <= 3) ans += (4-y)*a;
    if(x == 1 && y == 1) ans += 4*a;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll maxk=22;
const ll mod=1e9+7;
const ll inf=1e9+500;

struct hh{
    vector<ll> sar;
    vector<ll> tah;
    ll maxx;
};
hh f(ll n){
    hh ans;
    if(n==2){
        ans.sar.pb(1);
        ans.tah.pb(1);
        ans.maxx=1;
        return ans;
    }
    if(n%2==0){
        ans=f(n/2);
        ans.sar.pb(ans.maxx+1);
        ans.tah.pb(ans.maxx+1);
        ans.maxx++;
        return ans;
    }
    ans=f(n-1);
    ans.sar.pb(ans.maxx+1);
    ans.tah.pb(ans.maxx+1);
    for(ll i=ans.tah.size()-1;i>=1;i--){
        swap(ans.tah[i],ans.tah[i-1]);
    }
    ans.maxx++;
    return ans;
}
int main(){
    string s,t;
    ll n;
    cin>>n;
    n++;
    hh e=f(n);
    cout<<e.sar.size()+e.tah.size()<<endl;
    for(auto v:e.sar){
        cout<<v<<' ';
    }
    for(auto v:e.tah){
        cout<<v<<' ';
    }
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std; 


int main(){
    int x;
    int v[100];
    scanf("%d", &x);    


    int index = 0;
    for(int j=2; j<10; j++){
        int ans = 0;
        int i = 1;
        while(ans <= x){
            ans = pow(i, j);
            i++;
        }

        ans = pow(i-2, j);
        v[index] = ans;
        index++;
    }

    int max = 0;
    for(int j=0; j<index; j++){
        if(v[j] > max)
            max = v[j];
    }

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

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
#define PI 3.14159265358979323846264338327950L
typedef unsigned long long uint64;
using namespace std;
int main(){
 int a,b;
 int d= 0;
 cin >> a>> b;
 vector<int>c(a);
 rep(i,a){
   cin >> c[i];
 }
 sort(c.begin(),c.end());
 for(int i= 0;i<b;i++){
   d += c[i];
 }
 cout << d << endl;
return 0;
}

Measured memory_bytes: 3624
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N, K;
	cin >> N >> K;
	
	const ll mod = 1e9 + 7;
	ll dp[100001] = {};
	dp[0] = 1;

	rep(i, N) {
		int a;
		cin >> a;

		//rep1(j, K) dp[j] += dp[j - 1];
		partial_sum(dp, dp + K + 1, dp);

		auto are = dp - a - 1;
		for (int j = K; j > a; j--) {
			dp[j] -= are[j];
		}

		rep1(j, K) dp[j] %= mod;
	}

	co((dp[K] + mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  string s;
  cin>>s;
  int pre=(int)(s[0]-'0');
  int c=0;
  for(auto it=s.begin()+1; it!=s.end(); it++) {
    if((int)(*it-'0')==pre) {
      c++;
      pre=(pre+1)%2;
    } else {
      pre=(int)(*it-'0');
    }
    
  }
  std::cout << c << std::endl;
  return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define popb pop_back
#define all(A) A.begin(),A.end()
#define mod 1000000007
using namespace std;
int main() {
	string s;
	cin>>s;
	int i=0,n=s.size();	
	vector<int> ans(n,0);
	while(i<n){
		int a,count=0;
		int j=i;
		while(s[j]==s[i] && j<n){
			j++;
			count++;
		}
		a=j-1;
		ans[a]+=count-(count/2);
		ans[a+1]+=count/2;
		count=0;
		while(s[j]!=s[i] && j<n){
			j++;
			count++;
		}
		ans[a]+=count/2;
		ans[a+1]+=count-(count/2);
		i=j;
	}
	for(int i=0;i<n;i++) cout<<ans[i]<<" ";
	cout<<"\n";
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  if (N<M) {
    for (int i=0; i<M; i++) {
      cout << N;
    }
  }
  
  else {
    for (int i=0; i<N; i++) {
      cout << M;
    }
  }
  
  cout << endl;
}

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


long int merge(long int a1[], long int a2[], long int b1[], long int b2[], long int a1_size, long int a2_size, long int b1_size, long int b2_size, long int a[], long int b[]);
long int mergeSort(long int a[], long int a_size, long int b[], long int b_size);

int main(void)
{
	long int n;
	long int i, j;
	long int work;
	long int a[200000];
	long int b[200000];
	
	scanf("%ld", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &a[i]);
		b[i] = i + 1;
	}
	
	if(n <= 100) {
		for(i = 0; i < n - 1; i++) {
			for(j = 0; j < n - 1 - i; j++) {
				if(a[j] > a[j + 1]) {
					work = a[j];
					a[j] = a[j + 1];
					a[j + 1] = work;
					
					work = b[j];
					b[j] = b[j + 1];
					b[j + 1] = work;
				}
			}
		}
		
		for(i = 0; i < n; i++) {
			printf("%ld ", b[i]);
		}
		return 0;
	}
	
	mergeSort(a, n, b, n);
	
	for(i = 0; i < n; i++) {
		printf("%ld ", b[i]);
	}
	//printf("%ld", b[n - 1]);
	
	return 0;
}

long int merge(long int a1[], long int a2[], long int b1[], long int b2[], long int a1_size, long int a2_size, long int b1_size, long int b2_size, long int a[], long int b[])
{
	long int i = 0, j = 0;
	
	while( (i < a1_size ) || (j < a2_size) ) {
		if( (j >= a2_size ) || ( (i < a1_size) && (a1[i] < a2[j]) ) ) {
			a[i + j] = a1[i];
			b[i + j] = b1[i];
			i++;
		} else {
			if( (a1[i] == a2[j]) && (b1[i] > b2[j]) ) {
				//printf("Ok\n");
				a[i + j]  = a1[i];
				b[i + j]  = b1[i];
				i++;
			} else {
				a[i + j] = a2[j];
				b[i + j] = b2[j];
				j++;
			}
		}
	}
	
	return 0;
}

long int mergeSort(long int a[], long int a_size, long int b[], long int b_size)
{
	long int m = a_size / 2, n = a_size - m;
	long int a1[m];
	long int a2[n];
	long int b1[m];
	long int b2[n];
	long int i, j;
	
	if(a_size > 1) {
		for(i = 0; i < m; i++) {
			a1[i] = a[i];
			b1[i] = b[i];
		}
		for(i = 0; i < n; i++) {
			a2[i] = a[m + i];
			b2[i] = b[m + i];
		}
		mergeSort(a1, m, b1, m);
		mergeSort(a2, n, b2, n);
		merge(a1, a2, b1, b2, m, n, m, n, a, b);
	}
	
	return 0;
}


Measured memory_bytes: 6400
#include<cstdio>
using namespace std;
int main(){
    int n,a,cnt=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        if(a%2){
            cnt++;
        }
    }
    if(cnt%2){
        printf("NO\n");
    }
    else{
        printf("YES\n");
    }
}

Measured memory_bytes: 128
#include<stdio.h>

int n, A[50];

int solve(int i, int m){
	if (m == 0) return 1;
	if (i >= n) return 0;
	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main(void){
	int q, M, i;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &A[i]);
	scanf("%d", &q);
	for (i = 0; i < q; i++){
		scanf("%d", &M);
		if (solve(0, M)) printf("yes\n");
		else printf("no\n");
	}
	
	return 0;
}




Measured memory_bytes: 2076
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, readline().split())

    if N % K == 0:
        print(0)
    else:
        print(1)

    return


if __name__ == '__main__':
    main()


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

const long long inf = 1e18;

struct Task {
	int n;
	vector<int> a;
	vector<vector<int>> g;

	Task(int n): n(n), a(n), g(n) {
		for (auto& item : a) {
			cin >> item;
		}
	}

	void dfs(int v, vector<int>& was, vector<int>& path) {
		was[v] = 1;
		for (auto& to : g[v]) {
			if (was[to]) {
				continue;
			}
			path[to] = v;
			dfs(to, was, path);
		}
	}

	vector<int> compute(int v, vector<int> &was) {
		vector<int> path(n, -1);
		path[v] = v;
		dfs(v, was, path);
		priority_queue<int> q;
		q.push(v);
		vector<int> result;
		while (!q.empty()) {
			int v = q.top();
			q.pop();
			result.push_back(a[v]);
			for (auto& to : g[v]) {
				if (path[to] != v) {
					continue;
				}
				q.push(to);
			}
		}
		return result;
	}

	vector<int> merge(vector<int>& a, vector<int>& b) {
		vector<int> result;
		int i = 0, j = 0;
		while (i < (int)a.size() && j < (int)b.size()) {
			if (a[i] >= b[j]) {
				result.push_back(a[i++]);
			} else {
				result.push_back(b[j++]);
			}
		}
		while (i < (int)a.size()) {
			result.push_back(a[i++]);
		}
		while (j < (int)b.size()) {
			result.push_back(b[j++]);
		}
		return result;
	}

	void run() {
		sort(a.begin(), a.end());
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (i == j) {
					continue;
				}
				if (__gcd(a[i], a[j]) > 1) {
					g[i].push_back(j);
				}
			}
		}
		vector<int> was(n);
		vector<int> result;
		for (int i = 0; i < n; ++i) {
			if (!was[i]) {
				vector<int> now = compute(i, was);
				result = merge(result, now);
			}
		}
		for (auto& item : result) {
			cout << item << ' ';
		}
		cout << '\n';
	}
};

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

	int n;
	cin >> n;

	Task a(n);
	a.run();

	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int n,d[2333],sd[2333],ca=0;
int f[233];
inline void dfs(int x)
{
	if(x>n)
	{
		for(int i=0;i<=24;++i) f[i]=0;
		for(int i=0;i<=n;++i)
		{
			if(f[d[i]]) return;
			f[d[i]]=1;
		}
		int g=0;
		for(int i=0;i<=24;++i) if(f[i]) sd[g++]=i;
		int ans=min(sd[n],24-sd[n]);
		for(int i=1;i<=n&&ans>ca;++i)
		{
			int g=sd[i]-sd[i-1]; if(g>24-g) g=24-g;
			if(g<ans) ans=g;
		}
		if(ca>=ans) return;
		ca=ans; return;
	}
	dfs(x+1); d[x]=24-d[x];
	dfs(x+1); d[x]=24-d[x];
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",d+i);
	if(n>=25)
	{
		puts("0");
		return 0;
	}
	dfs(1);
	printf("%d\n",ca);
}


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

int main()
{
    long long X;
    cin >> X;
    long long sum = 100;
    int count = 0;
    for (int i = 0; i < 100000 ; ++i)
    {
        sum += sum * 0.01;
        count++;
        if ( sum >= X ){
            cout << count << endl;
            return 0;
        }
    }
    // cout << count << endl;
    // return 0;
}


Measured memory_bytes: 3560
#include <iostream>
using namespace std;
int main() {
    string s;
    cin >> s;
    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }
    if(s == "Cloudy"){
        cout << "Rainy" << endl;
    }
    if(s == "Rainy"){
        cout << "Sunny" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	n := scanInt()
	x, y := scanInt(), scanInt()

	ans := make(map[int]int, n-1)

	for i := 1; i <= n; i++ {
		for j := i + 1; j <= n; j++ {
			d := j - i
			d = min(d, abs(x-i)+1+abs(y-j))
			d = min(d, abs(y-i)+1+abs(x-j))
			ans[d]++
		}
	}
	for i := 1; i < n; i++ {
		fmt.Println(ans[i])
	}
}


Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
int main()
{
    int i, w, l;
    char s[1010];
    gets(s);
    l=strlen(s);
    scanf("%d", &w);
    for(i=0; i<l; i=i+w)
        printf("%c", s[i]);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    static int[] six = new int[]{46656,7776,1296,216,36,6};
    static int[] nine = new int[]{59049,6561,729,81,9};
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = n;
        for(int i=0;i<=n;i++) ans = Math.min(ans,help(n,i));
        System.out.println(ans);
    }
    static int help(int n, int m){
        int ans = 0;
        int t = n-m;
        for(int i=0;i<6;i++){
            if(m>=six[i]){
                ans += m/six[i];
                m = m%six[i];
            }
        }
        for(int i=0;i<5;i++) {
            if (t >= nine[i]) {
                ans += t / nine[i];
                t = t % nine[i];
            }
        }
        return ans+t+m;
    }
}


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

int main(){

  string s;

  cin>>s;
    

  bool good = true;
  
  if(s[0] == s[1]) good = false;

  if(s[1] == s[2]) good = false;

  if(s[2] == s[3]) good = false;

  if(good){cout<<"Good"<<endl;
  }else{
    cout<<"Bad"<<endl;
  }

    return 0;
  

}
  


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

int main(){
	int n,m,k=0;cin>>n>>m;
  	ll ans=0;
  	vector<pair<ll,ll>> v(n);
  	for(int i=0;i<n;i++) cin>>v[i].first>>v[i].second;
  	sort(v.begin(),v.end());
  	while(m){
      	ll t=v[k].second;
    	if(m>=t)
        {m-=t;
      	ans+=t*v[k].first;}
      	else
        {ans+=m*v[k].first;m=0;}
      	k++;
    }
  	cout<<ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    int res = 0;
    for(auto& e : a) res += e - 1;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
using System;

namespace rectangle
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            string[] str = Console.ReadLine().Split(' ');

            a = int.Parse(str[0]);
            b = int.Parse(str[1]);

            Console.WriteLine("{0} {1}", a * b, 2 * (a + b));

        }
    }
}

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

int main(){
  int N;
  ll A;
  cin>>N;
  
  map<ll,ll>v;
  for(int i=0;i<N;i++){
    cin>>A;
    v[A]++;
  }
  ll ans=0;
  for(auto x:v){
    if(x.second%2!=0)ans++;
  }
  cout<<ans<<endl;
}
    


Measured memory_bytes: 9640
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=MI()
    if a+b+c==2*max(a,b,c):
        print("Yes")
    else:
        print("No")

main()


Measured memory_bytes: 38384
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P) :
 P = sorted(P)
 phU = []
 phU.append(P[0])
 phU.append(P[1])
 for p in P[2:] :
  phU.append(p)
  if isCLKWISE(phU) : continue
  while(True) :
   del phU[-2]
   try :
    if isCLKWISE(phU) : break
   except IndexError : break
 phL = []
 phL.append(P[-1])
 phL.append(P[-2])
 for p in P[-3::-1] :
  phL.append(p)
  if isCLKWISE(phL) : continue
  while(True) :
   del phL[-2]
   try:
    if isCLKWISE(phL) : break
   except IndexError : break
 ph = phU + phL[1:-1]
 return ph
  
n = range(int(input()))
P = [[int(x) for x in input().split()] for _ in n]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33140
#include "bits/stdc++.h"

#include <bits/stdc++.h>

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

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse

#endif


int main(void)
{
	ll n; cin >> n;
	vector<ll> a(n);
	vector<ll> xor_a(n-1);
	rep(i, 0, n)
		cin >> a[i];

	ll ans = 0;
	rep(i, 0, n-1)
		ans ^= a[i];

	if (ans == a[n-1])
		cout << "Yes";
	else
		cout << "No";

	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    string s;
    ll k;
    cin >> s >> k;
    repi(i,k,0){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << "1" << endl;
    return 0;
}

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll L;
    cin >> L;
    double a = (double)L/3;
    double ans = (a*a*a);

    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
k = int(input())
x = list(map(int, input().split()))

ans = 0
for i in range(n):
    a_diff = x[i]
    b_diff = abs(k - x[i])
    
    if a_diff < b_diff:
        ans += a_diff*2
    else:
        ans += b_diff*2

print(ans)

Measured memory_bytes: 3060
n = int(input())
b = [int(i) for i in input().split()]
a = [b[0]]
# print(a)
b += [b[n-2]]
# print(b)
for i in range(1,n):
    a += [min(b[i-1],b[i])]
# print(a)
print(sum(a))

Measured memory_bytes: 3060
N, M = list(map(int, input().split()))

f1, f2 = [], []

k = 1
while k*k<=M:
    if M%k==0:
        f1.append(k)
        f2.append(M//k)
    k+=1

for f in f1 + list(reversed(f2)):
    if f>=N:
        print(M//f)
        break

Measured memory_bytes: 3060
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

n = int(input())
ans = digitSum(n)
#print(ans)

if ans%9 == 0:
    print("Yes")
else:
    print("No")



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

/* snippet: useful macros and functions */
#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; }
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; }
template<class T> T rng(const T &a, const T &b){ return a < b ? b - a : a - b; }
template<class T> void th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

/* snippet: modint library */
template<class T, int MOD>
class Modint{
	T val;
public:
	Modint(T val = 0) : val(val) {}
	operator T(){ return val; }
	Modint &operator+=(const Modint &a){ val += a.val; if(val >= MOD) val -= MOD; return *this; }
	Modint &operator-=(const Modint &a){ val -= a.val; if(val < 0) val += MOD; return *this; }
	Modint &operator*=(const Modint &a){ val = val * a.val % MOD; return *this; }
	void inverse(){T x[2]={MOD,val},a[2]={0,1};int i;for(i=0;x[!i];i^=1){a[i]-=x[i]/x[!i]*a[!i];x[i]=x[i]%x[!i];}if(!i)a[i]+= MOD;val=a[i];}
	Modint &operator/=(Modint a){ a.inverse(); return *this *= a; }
	friend Modint modpow(Modint a, int n){ Modint ret(1); while(n){ if(n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
	friend Modint operator+(Modint a, const Modint &b){ return a += b; }
	friend Modint operator-(Modint a, const Modint &b){ return a -= b; }
	friend Modint operator*(Modint a, const Modint &b){ return a *= b; }
	friend Modint operator/(Modint a, const Modint &b){ return a /= b; }
	friend std::ostream &operator<<(std::ostream &os, const Modint &a){ return os << a.val; }
};

/* snippet: using declarations */
using Int = int;
using namespace std;
using Mint = Modint<long long, 1000000007>;

Int n, k, c;
char s[212345];
Int dp_f[412345], dp_b_[412345], *dp_b = dp_b_ + 212345;

int main(){
	cin >> n >> k >> c >> s;
	RCH(i, n){
		if(s[i] == 'o'){
			dp_f[i] = ant(dp_f[i + 1], dp_f[i + c + 1] + 1);
		}else{
			dp_f[i] = dp_f[i + 1];
		}
	}
	RC(i, n){
		if(s[i] == 'o'){
			dp_b[i] = ant(dp_b[i - 1], dp_b[i - c - 1] + 1);
		}else{
			dp_b[i] = dp_b[i - 1];
		}
	}
	// RC(i, n) cout << dp_f[i] << " "; cout << endl;
	// RC(i, n) cout << dp_b[i] << " "; cout << endl;
	RC(i, n){
		if(dp_b[i - 1] + dp_f[i + 1] < k){
			cout << i + 1 << endl;
		}
	}
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

std::vector<ll> Eratosthenes(ll N )
{
    std::vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<ll> P;
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}

int main(){
    ll N;
    cin >> N;
    ll NN = 1000000;
    vector<ll> Pr = Eratosthenes(NN);
    ll ans=0;
    for(int i=0;i<Pr.size();i++){
        ll num=1;
        while(1){
            ll div = pow(Pr[i],num);
            if(N%div==0){
                N/=div;
                ans++;
            }else{
                while(1){
                    if(N%Pr[i]==0){
                        N/=Pr[i];
                    }else{
                        break;
                    }
                }
                break;
            }
            num++;
        }
    }
    if(N>1){
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4500
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

const int N = 100005;

vector<int>g[N];
ll d[N],ssize[N];
ll ck[N],ckd;
map<ll,int>f;

void dfs(int u, int p){
    for(int v:g[u]){
        if(v==p){
            continue;
        }
        ck[v]=ck[u]+1;
        dfs(v,u);
    }
    ckd+=ck[u];
}

void dfs2(int u,int p){
    for(int v:g[u]){
        if(v==p){
            continue;
        }
        cout<<u<<" "<<v<<endl;
        dfs2(v,u);
    }
}

int main(){
    IOS

    int n;
    cin>>n;
    FOR(i,1,n+1){
        cin>>d[i];
        f[d[i]]=i;
        ssize[i]=1;
    }
    sort(d+1,d+n+1);
    ROF(i,n,2){
        int u=f[d[i]];
        ll dd=n-2*ssize[u];
        if(dd<=0){
            cout<<-1;
            return 0;
        }
        dd=d[i]-dd;
        if(f[dd]==0){
            cout<<-1;
            return 0;
        }
        int v=f[dd];
        cerr<<u<<" "<<v<<endl;
        ssize[v]+=ssize[u];
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1,0);
    if(f[ckd]!=1){
        cout<<-1;
    }
    else{
        dfs2(1,0);
    }

    cerr<<"Time: "<<1.0/CLOCKS_PER_SEC<<" ms"<<endl;
    return 0;
}

Measured memory_bytes: 23168
(set! *unchecked-math* true)
(defn input []
  (let [[N M] (->> (clojure.string/split (read-line) #"\s")
                (map #(Byte/parseByte %)))]
    (list N
      (->> (repeatedly M read-line)
        (sequence
          (comp (map #(clojure.string/split % #"\s"))
            (map (partial mapv #(Byte/parseByte %)))))))))

(defn CoutningRoads [^"[B" Array Rs]
  (doseq [r Rs
          :let [id1 (unchecked-dec-int (r 0))
                id2 (unchecked-dec-int (r 1))
                v1 (byte (unchecked-inc-int (aget ^"[B" Array id1)))
                v2 (byte (unchecked-inc-int (aget ^"[B" Array id2)))]]
    (aset ^"[B" Array id1 v1)
    (aset ^"[B" Array id2 v2)))

(defn output [^"[I" Array]
  (->> Array
    (transduce (map #(format "%s\n" %)) str "")
    print))

(let [[N Rs] (input)]
  (doto (byte-array N (byte 0))
    (CoutningRoads Rs)
    (output)))

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

int main()
{
	int N, L;
	cin >> N >> L;

	vector<string> moji;
	vector<string>::iterator it;

	string s;
	for (int i = 0; i < N; i++)
	{
		cin >> s;
		moji.push_back(s);
	}

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

	it = moji.begin();
	while (it != moji.end())
	{
		cout << *it;
		it++;
	}

	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<typename T>
struct BIT{
    int n;
    vector<T> d;
    BIT(int n = 0):n(n), d(n+1){}
    void add(int i, T x = 1){
        for(i++; i <= n; i += i&-i){
            d[i] += x;
        }
    }
    T sum(int i){
        T x = 0;
        for(i++; i; i -= i&-i){
            x += d[i];
        }
        return x;
    }
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	int ans = 0;
	BIT<int> bit(n+1);
	rep(i,n){
		int now = bit.sum(i);
		if(now <= h[i]){
			ans += h[i] - now;
			bit.add(i, h[i] - now);
		}
		else bit.add(i, h[i] - now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	string s,t;cin>>s>>t;
	int ans = 0;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != t[i])ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int a, b, v, w, t;
	cin >> a >> v;
	cin >> b >> w;
	cin >> t;
	if(v <= w) cout << "NO\n";
	else {
		int req = abs(b - a) % (v - w) ? abs(b - a) / (v - w) + 1 : abs(b - a) / (v - w);
		cout << (req <= t ? "YES\n" : "NO\n");
	}
}


Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int n,w[510],x[510],a[510],f[250010];
inline bool cmp(int a,int b)
{
	return x[a]<x[b];
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j,k,l;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  {
	   scanf("%d",&x[i]);
	   a[i]=i;
	  }
	sort(a+1,a+n+1,cmp);
	for(i=1;i<n;i++)
	  if(x[a[i]]==x[a[i+1]])
	    {
	     printf("No\n");
	     return 0;
	    }
	for(i=1,j=l=1,k=(a[1]==1?2:1);i<=n*n;i++)
	  if(i==x[a[j]])
	    if(k==j)
	      {
	       printf("No\n");
	       return 0;
	      }
	    else
	      f[i]=a[j++];
	  else if(k<=n)
	    {
	     f[i]=a[k];
	     w[a[k]]++;
	     for(;k<=n && w[a[k]]==a[k]-1;k++);
	    }
	  else
	    {
	     for(;l<=n && w[a[l]]==n-1;l++);
	     if(l>=j)
	       {
	        printf("No\n");
	        return 0;
	       }
	     f[i]=a[l];
	     w[a[l]]++;
	    }
	printf("Yes\n");
	for(i=1;i<=n*n;i++)
	  printf("%d ",f[i]);
	printf("\n");
	return 0;
}


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

typedef long long ll;

#define fr first
#define sc second

int main(){
	int N;
	string S;
	cin >> N >> S;
	
	map<string,ll> x[20];
	for(int i = 0 ; i < (1<<N) ; i ++){
		int cnt = 0;
		string s = "";
		for(int j = 0 ; j < N ; j ++){
			if(i&(1<<j))s += S[j];
		}
		cnt = s.size();
		for(int j = N-1 ; j >= 0 ; j --){
			if(!(i&(1<<j)))s += S[j];
		}
		x[cnt][s] ++;
	}
	map<string,ll> y[20];
	reverse(S.begin(),S.end());
	for(int i = 0 ; i < (1<<N) ; i ++){
		int cnt = 0;
		string s = "";
		for(int j = 0 ; j < N ; j ++){
			if(i&(1<<j))s += S[j];
		}
		cnt = s.size();
		for(int j = N-1 ; j >= 0 ; j --){
			if(!(i&(1<<j)))s += S[j];
		}
		y[cnt][s] ++;
	}
	
	ll ret = 0;
	for(int i = 0 ; i <= N ; i ++){
		map<string,ll>::iterator itr = x[i].begin();
		while(itr != x[i].end()){
			ret += (itr->sc)*(y[i][itr->fr]);
			++itr;
		}
	}
	cout << ret << endl;
}



Measured memory_bytes: 90368