akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<map>
using namespace std;
typedef long long ll;
const ll base = 1'000'000'000 + 7;
ll n;
ll pow3[100];
map<ll, ll> memo[100];
ll dfs(ll bit, int d, ll u, ll v)
{
	if (!bit) return 1;
	if (u + (bit * 4 - 2) <= n) // can do whatever
	{
		return pow3[d + 1];
	}
	if (memo[d].count(u)) return memo[d][u];
	ll ret = dfs(bit >> 1, d - 1, u, v);
	if (u + bit <= n) ret = (ret + dfs(bit >> 1, d - 1, u + bit, v ^ bit)) % base;
	if (u + bit + bit <= n) ret = (ret + dfs(bit >> 1, d - 1, u + bit + bit, v)) % base;
	return memo[d][u]=ret;
}
int main()
{
	pow3[0] = 1;
	for (int i = 1; i < 100; i++) pow3[i] = (pow3[i - 1] * 3) % base;
	scanf("%lld", &n);
	printf("%lld\n", dfs(1LL << 61, 61, 0, 0));
	return 0;
}


Measured memory_bytes: 504
N,W = map(int,input().split())
wv =[[0,0]]
dp = []
Counting = []
for _ in range(N):
    wv.append(list(map(int,input().split())))
for _ in range(N+1):
    dp.append([0]*(W+1))
    Counting.append([0]*(W+1))
for i in range(1,N+1):
    for sum_w in range(W+1):
        if Counting[i-1][sum_w] > sum_w:
            continue
        elif sum_w-wv[i][0]<0:
            dp[i][sum_w] =  dp[i-1][sum_w]
            Counting[i][sum_w]  = Counting[i-1][sum_w]
        else:
            if dp[i-1][sum_w] < dp[i-1][sum_w-wv[i][0]]+wv[i][1]:
                Counting[i][sum_w]  = Counting[i-1][sum_w-wv[i][0]]  + wv[i][0]
            else:
                Counting[i][sum_w]  = Counting[i-1][sum_w]
            dp[i][sum_w] = max(dp[i-1][sum_w],dp[i-1][sum_w-wv[i][0]]+wv[i][1])
print(dp[-1][-1])


Measured memory_bytes: 194328
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n=700,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a;
	cout<<48-a;





	cout<<endl;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string s) {
	int l = s.length();
	for(int i = 0; 2 * i <= l; i++) {
		if(s[i] != s[l - 1 - i]) return false;
	}
	return true;
}
string Replace( string String1, string String2, string String3 )
{
    string::size_type  Pos( String1.find( String2 ) );

    while( Pos != string::npos )
    {
        String1.replace( Pos, String2.length(), String3 );
        Pos = String1.find( String2, Pos + String3.length() );
    }

    return String1;
}
int main() {
	string S;
	cin >> S;
	string s = Replace(S, string("x"), string(""));
	if(!isPalindrome(s)) {
		cout << -1 << endl;
		return 0;
	}
	int l = 0, r = S.length() - 1;
	int lx = 0, rx = 0, ans = 0;
	while(true) {
		if(S[l] == 'x') {
			lx++;
			l++;
		}
		if(S[r] == 'x') {
			rx++;
			r--;
		}
		if(S[r] != 'x' && S[r] == S[l]) {
			ans += abs(lx - rx);
			lx = rx = 0;
			if(l >= r) break;
			l++;r--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    char[] SS = S.toCharArray();
    for (int i=0; i<S.length(); i++) {
      if(SS[i] + N > 'Z') {
        SS[i] += N - 26;
      } else {
        SS[i] += N;
      }
      System.out.print(SS[i]);
    }
  }
}

Measured memory_bytes: 25820
#include <iostream> 
#include <cstring>
#include <algorithm> 
#include <cmath> 
#include <cstdio> 
typedef long long ll;
#define size 500050
using namespace std;
int a[size];
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll e = c*d / __gcd(c,d);
	ll ans = 0;
	a--;
	ans=(b-a) - (b/c - a/c + b/d - a/d) + (b/e - a/e);

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        //List<int> values = new List<int>(Console.ReadLine().Split(' ').Select(s => int.Parse(s)));
        //List<int> values = new List<int>();

        string input = Console.ReadLine();
        //int n = int.Parse(input.Split(' ')[0]);
        //int m = int.Parse(input.Split(' ')[1]);
        //int k = int.Parse(input.Split(' ')[2]);

        string ss = "";


        foreach (var item in input)
        {
            if (item.Equals('B'))
            {
                if (ss.Length != 0)
                {
                    ss=ss.Remove(ss.Length - 1, 1);
                }
            }
            else
            {
                ss += item;
            }
        }


        
        

        Console.WriteLine(ss);
        input = Console.ReadLine();

    }
}

Measured memory_bytes: 13140
S = int(input())
MOD = 10 ** 9 + 7

DP = [0] * (S+1)
DP[0] = 1

for i in range(S):
	for nex in range(i+3, S+1):
		DP[nex] += DP[i]
		DP[nex] %= MOD

print(DP[S] % MOD)


Measured memory_bytes: 80172
#pragma GCC optimize(2)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cmath>
#define fi first
#define se second
#define re register
#define ls i << 1
#define rs i << 1 | 1
#define pb push_back
#define pii pair<int,int>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007

//#define int long long

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);

inline int rd(){
  int x = 0, f = 1; char ch = getchar();
  while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
  while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
  return x * f;
}

void out(int a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) out(a / 10);
  putchar(a % 10 + '0');
}
int a[110];
//signed main(){
int main() {
  int n = rd();
  for (int i = 1; i <= n; i++) a[i] = rd();
  if (n < 3) cout << "0\n";
  else {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i+1; j <= n; j++) {
        for (int k = j+1; k <= n; k++) {
            vector<int> v;
            v.pb(a[i]), v.pb(a[j]), v.pb(a[k]);
            sort(v.begin(),v.end());
            if (v[0] == v[1] || v[1] == v[2]) ;
            else {
              ans += (v[0] + v[1] > v[2]);
            }
          }          
        }
      }
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int m1,m2,d1,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(d1+1 == d2) {
    cout << 0 << endl;
  }else {
    cout << 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define FILL(i,n) memset(i,n,sizeof(i));
#define X first
#define Y second
#define pb push_back
#ifdef brian
#define  debug(...) do{\
    fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename t> void _do(t &&x){cerr<<x<<endl;}
template<typename t,typename ...T> void _do(t &&x,T &&...tail){cerr<<x<<", ";_do(tail...);}
#else
#define debug(...)
#endif // brian

const ll INF=ll(1e15);

const ll MAXn=100005;

ll d[MAXn];
ll cl[MAXn];
ll mx=0,n;
vector<ll> r[MAXn];
ll build(ll now)
{
    vector<ll> dp;
    for(int i:r[now])
    {
        dp.pb(build(i));
    }
    ll tmp=cl[now];
    sort(dp.begin(),dp.end(),greater<ll>());
    for(int i=1;i<=cl[now];i++)
    {
        tmp=max(tmp,i+dp[i-1]);
    }
    return tmp;
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n;
    for(int i=1;i<n;i++){cin>>d[i];d[i]--;}
    FILL(cl,0);
    for(int i=1;i<n;i++)
    {
        cl[d[i]]++;
        r[d[i]].pb(i);
    }
    cout<<build(0)<<endl;

}


Measured memory_bytes: 16640
#include<iostream>
#define Arena                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
using namespace std;
// int i = 0, j = 0;

int main()
{
    Arena


        int n;
        cin >> n;
        int k;
        cin >> k;
        if(k >= n){
            cout << "unsafe" <<endl;
        }
        else{
            cout << "safe" <<endl;
        }
        return 0;
}


Measured memory_bytes: 3048
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<iomanip>
#include<utility>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#define ll long long
#define fi first
#define sec second
#define mp make_pair
#define pb push_back
#define rep(a,b,c) for(ll a=1;a<=b;a+=c)
#define repp(a,b,c,d) for(int a=b;a<=c;a+=d)

const double PI=acos(-1);
const double EPS=1e-12;
const ll MOD=1e6+3;
const int INF=1<<30;


using namespace std;

ll fact[3000005];

void pre(){
	fact[0]=1;
	rep(i,3000000,1){
		fact[i]=fact[i-1]*i;
		fact[i]%=MOD;
	}
}


ll fast(ll a,ll b){
	if(b==0)return 1;
	ll temp=fast(a,b/2);
	temp*=temp;
	temp%=MOD;
	if(b%2==1)temp*=a;
	return temp%MOD;
}

ll gamma(ll a){
	return fact[a-1];
}

int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	pre();
	int in;
	ll a,d,n,res;
	cin>>in;
	rep(i,in,1){
		cin>>a>>d>>n;
		res=fast(d,n);
		if(d==0){
			cout<<fast(a,n)<<endl;
			continue;
		}
		if(n>=MOD){
			cout<<0<<endl;
		}
		else{
			res*=gamma((a*fast(d,MOD-2)%MOD)+n);
			res%=MOD;
			res*=fast(gamma((a*fast(d,MOD-2))%MOD),MOD-2);
			res%=MOD;
			cout<<res<<endl;
		}
	}
	return 0;
}


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

struct Info
{
  long len;
  long index;

  bool operator<(const Info &another) const
  {
    return len < another.len;
  };
};

void func1()
{
}

int main()
{
  long N, M;
  cin >> N >> M;
  long X[M];
  for (long i = 0; i < M; ++i)
    cin >> X[i];

  if (N >= M)
  {
    cout << 0 << endl;
    return 0;
  }

  sort(X, X + M);

  if (N == 1)
  {
    cout << X[M - 1] - X[0] << endl;
    return 0;
  }

  vector<Info> vec;
  for (long i = 1; i < M; ++i)
  {
    Info info = {X[i] - X[i - 1], i - 1};
    vec.push_back(info);
  }
  sort(vec.begin(), vec.end());

  for (long i = 0; i < N - 1; ++i)
  {
    vec.pop_back();
  }

  long ans = 0;
  while (!vec.empty())
  {
    ans += vec.back().len;
    vec.pop_back();
  }

  cout << ans << endl;
}


Measured memory_bytes: 3188
import itertools
N, M, Q = map(int, input().split())
tapple = []
d_sum_max = 0
for i in range(Q):
    tapple.append([int(n) for n in input().split()])
A = list(itertools.combinations_with_replacement(range(1, M+1), N))
for j in range(len(A)):
    d_sum = 0
    for i in range(Q):
        if A[j][tapple[i][1]-1] - A[j][tapple[i][0]-1] == tapple[i][2]:
            d_sum += tapple[i][3] 
    if d_sum_max < d_sum:
        d_sum_max = d_sum
print(d_sum_max)

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


int main() {

    //freopen ("in.txt","r",stdin);
    //freopen ("out.txt","w",stdout);

	int n;
	
	cin >> n;
	
	int ans = n + pow(n,2) + pow(n, 3);

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


Measured memory_bytes: 4100
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int p, m, c;


int main(){

	cin >> p >> m >> c;
	
	cout << p + m + c << endl;


	return 0;
}



Measured memory_bytes: 3116
import scala.io.StdIn

object Main extends App {

  val Array(n, w) = StdIn.readLine().split(' ').map(_.toInt)

  case class Item(index: Int, value: Int, weight: Int)

  val items = (1 to n).map { i =>
    val a = StdIn.readLine().split(' ').map(_.toInt)
    Item(i, a(0), a(1))
  }

  val c = Array.fill[Int](n + 1, w + 1)(0)
  val g = Array.fill[Int](n + 1, w + 1)(1)

  val DIAGONAL = 1
  val TOP = 0

  items.foreach { i =>
    (1 to w).foreach { k =>
      if (i.weight <= k) {
        if (c(i.index - 1)(k - i.weight) + i.value > c(i.index - 1)(k)) {
          c(i.index)(k) = c(i.index - 1)(k - i.weight) + i.value
          g(i.index)(k) = DIAGONAL
        } else {
          c(i.index)(k) = c(i.index - 1)(k)
          g(i.index)(k) = TOP
        }
      } else {
        c(i.index)(k) = c(i.index - 1)(k)
        g(i.index)(k) = TOP
      }
    }

  }

  println(c(n)(w))

}


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

using ll = long long;
const int N = 3005;
ll dp[N][N], s[N], a[N];

template <class X, class Y>
bool chkmax(X &a, const Y &b){
	return a < b ? a = b, 1 : 0;
}

ll sum(int i, int j){
	return s[j] - s[i - 1];
} 

ll calc(int i, int j){
	if (dp[i][j] != -1) return dp[i][j];
	if (i == j) return dp[i][j] = a[i];
	dp[i][j] = a[i] + sum(i + 1, j) - calc(i + 1, j);
	chkmax(dp[i][j], a[j] + sum(i, j - 1) - calc(i, j - 1));
	return dp[i][j];
}

int main(){
	int n; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i]; s[i] = s[i - 1] + a[i];
	}
	memset(dp, -1, sizeof dp);
	cout << calc(1, n) * 2 - s[n] << '\n';
}

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

int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  long long ret = -1000000000000000001;

  ret = max(ret, a * c);
  ret = max(ret, a * d);
  ret = max(ret, b * c);
  ret = max(ret, b * d);

  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 3632
def getIntegers(sum)
	cnt = 0
	[0,1,2,3,4,5,6,7,8,9].repeated_permutation(4) do |a , b , c , d|
		if (a + b + c + d) == sum
			cnt += 1
		end
	end
	puts cnt
end

$stdin.each do |input|
	getIntegers(input.to_i)
end

Measured memory_bytes: 6172
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e14;
using Graph = vector<vector<int>>;

signed main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A[i];
  int ans = 0;
  for( int i = 1; i < N; i++ ){
    if( A[i] < A[i-1] ){
      ans += A[i-1]-A[i];
      A[i] = A[i-1];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4852
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long i64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 2e5+5, P = 1e9+7, Q = P-(P/2);
i64 inv(int i) { return i == 1?1:P-(P/i)*inv(P%i)%P; }
int n, a[N], c[N], p[N], D[N], E[N], f[N], g[N], ans; i64 S;
void add(int x, int d) { for( ; x <= n; x += x&-x) f[x] = (f[x]+d)%P, ++g[x]; }
int askf(int x) { int ret = 0; for( ; x; x -= x&-x) ret = (ret+f[x])%P; return ret; }
int askg(int x) { int ret = 0; for( ; x; x -= x&-x) ret += g[x]; return ret; }
int main()
{
    n = read(), S = 1; for(int i = 1; i <= n; ++i) a[i] = read(), ++c[a[i]];
    for(int i = n; i; --i) c[i] += c[i+1], S = S*max(c[i]-(n-i), 0)%P;
    if(S == 0) return puts("0"), 0; D[0] = 1;
    for(int i = 1; i <= n; ++i)
    {
        i64 w = (c[i]-1-(n-i))*inv(c[i]-(n-i))%P;
        if(w == 0) p[i] = i, D[i] = D[i-1]; else p[i] = p[i-1], D[i] = D[i-1]*w%P;
        E[i] = inv(D[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        ans = (ans+(askf(a[i])-askf(p[a[i]]-1)+P)%P*S%P*D[a[i]]%P*Q%P)%P;
        add(a[i], E[a[i]]);
    }
    for(int i = 1; i <= n; ++i) f[i] = g[i] = 0;
    for(int i = n; i; --i)
    {
        ans = (ans-(askf(a[i]-1)-askf(p[a[i]]-1)+P)%P*S%P*D[a[i]]%P*Q%P+P)%P;
        ans = (ans+askg(a[i]-1)*S%P)%P;
        add(a[i], E[a[i]]);
    }    
    printf("%d\n", ans);
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main()
{   
    ll N;
    cin >> N;

    vector<string> S(N);

    REP(i,N){
        cin >> S[i];
        // cout << S[i] << endl;
    }
    sort(S.begin(), S.end());

    string name;
    map<string, int> seqLen;
    ll len = 0;
    ll max_len = 0;
    REP(i,N){
        if(i == 0){
            name = S[i];
            len = 1;
            max_len = 1;
            seqLen[name] = 1;
            continue;
        }
        if(S[i] == name){
            seqLen[name]++;
            len++;
            max_len = max(max_len, len);
            // cout << len << endl;
        }
        else{
            name = S[i];
            seqLen[name] = 1;
            len = 1;
        }
    }
    for (map<std::string, int>::iterator i = seqLen.begin(); i != seqLen.end(); ++i) {
        if(i->second == max_len){
            cout << i->first << endl;
        }
    }
    // cout << seqLen["beat"] << endl;
    return 0;
}

Measured memory_bytes: 26752
input()
listnum = list(map(int, input().split()))
for i in range(int(input())):
    eachq = list(map(int, input().split()))
    listq = listnum[eachq[0]:eachq[1]]
    count = 0
    for i in range(len(listq)):
        if listq[i] == eachq[2]:
            count = count + 1
    print(count)



Measured memory_bytes: 5716
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int A[] = new int[M];
        int sumA=0;
        
        for(int i=0;i<M;i++) {
        	A[i] = sc.nextInt();
        }
        
        for(int i=0;i<M;i++) {
        	sumA += A[i];
        }
        
        int daysForPlay = N - sumA;
        if(daysForPlay<0) {
        	System.out.println(-1);
        }else {
        	System.out.println(daysForPlay);
        }
        
        }
	}



Measured memory_bytes: 39536
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
  
int main()
{
  ll N, M;
  cin >> N >> M;
  vector<P> A(M);
  REP(i,M) cin >> A[i].first >> A[i].second;
  
  ll BOX[N];
  REP(i,N){
    BOX[i]=1;
  }
  set<int> red;
  red.insert(0);
  REP(i,M){
    if(red.count(A[i].first-1)>=1){
      red.insert(A[i].second-1);
      if(BOX[A[i].first-1]==1){
        red.erase(A[i].first-1);
      }
    }
    BOX[A[i].first-1]--;
    BOX[A[i].second-1]++;
  }

  cout << red.size() << endl;
}

Measured memory_bytes: 7296
x = int(input())

def judge_prime(j):
    k = int(j ** 0.5) + 1
    for i in range(2, k):
        if j % i == 0:
            return False # 素数でない
    else:
        return True

j = x
while True:
    if judge_prime(j):
        print(j)
        break
    j += 1

Measured memory_bytes: 38896
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.14159265358979323846;

void solve() {
    ll a, b;
    cin >> a >> b;
    bool ans = a % 2 && b % 2;
    cout << (ans ? "Yes" : "No") << endl;
    return;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<cctype>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const int len=2e5+5;
const ll mod=1e9+7;
int main()
{
	ll x,y;
	while(~scanf("%lld%lld",&x,&y))
	{
		if(x%y==0)puts("-1");
		else cout<<x<<endl;
	}
}

Measured memory_bytes: 256
n,m=map(int,input().split())
a=["0"]*n
for i in range(m):
    s,c=map(int,input().split())
    if a[s-1]=="0":
        a[s-1]=c
    elif a[s-1]!=c:
        print(-1)
        exit()
if n>1 and a[0]==0:
    print(-1)
    exit()
if n>1 and a[0]=="0":
    a[0]=1
print(*a,sep="")

Measured memory_bytes: 3064
N, W = map(int,input().split())
V = [[] for _ in range(4)]

w, v = map(int,input().split())
w0 = w
V[0].append(v)

for _ in range(N-1):
    w, v = map(int,input().split())
    V[w-w0].append(v)
for i in range(4):
    V[i].sort(reverse=True)
    for j in range(1,len(V[i])):
        V[i][j] = V[i][j-1]+V[i][j]
    V[i].insert(0,0)
    V[i].append(0)

ans = 0
for i in range(len(V[0])):
    wi = w0*i
    if wi > W:
        break
    vi = V[0][i]
    for j in range(len(V[1])):
        wj = wi + (w0+1)*j
        if wj > W:
            break
        vj = vi + V[1][j]
        for k in range(len(V[2])):
            wk = wj + (w0+2)*k
            if wk > W:
                break
            vk = vj + V[2][k]

            l = min((W-wk)//(w0+3), len(V[3])-1)
            v = vk + V[3][l]
            ans = max(ans, v)
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
    int N, Y, i, man, gosen, sen;
    scanf("%d %d", &N, &Y);
    Y /= 1000;

    for (man = 0; man <= N; man++){
        for (gosen = 0; gosen <= N - man; gosen++){
            sen = N - gosen - man;
            if (man * 10 + gosen * 5 + sen == Y)
            {
                printf("%d %d %d\n", man, gosen, sen);
                return 0;
            }
        }
    }

    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def trace(bits, idx, history):
  if idx == len(bits):
    history.append(bits[:])
  elif idx == len(bits) - 1:
    history.append(bits[:])
    bits[idx] = 1 - bits[idx]
    history.append(bits[:])
  else:
    trace(bits, idx + 1, history)
    bits[idx] = 1 - bits[idx]
    trace(bits, idx + 1, history)


def down(bits, idx, count, history):
  if idx == len(bits):
    history.append(bits[:])
  elif idx == len(bits) - 1:
    history.append(bits[:])
    bits[idx] = 1 - bits[idx]
    history.append(bits[:])
  elif count > 0:
    trace(bits, idx + 2, history)
    bits[idx] = 1 - bits[idx]
    trace(bits, idx + 2, history)
    bits[idx + 1] = 1 - bits[idx + 1]
    trace(bits, idx + 2, history)
    bits[idx] = 1 - bits[idx]
    down(bits, idx + 2, count - 2, history)
  else:
    trace(bits, idx + 2, history)
    bits[idx + 1] = 1 - bits[idx + 1]
    trace(bits, idx + 2, history)
    bits[idx ] = 1 - bits[idx ]
    trace(bits, idx + 2, history)
    bits[idx + 1] = 1 - bits[idx + 1]
    down(bits, idx + 2, count - 2, history)


def main():
  n, a, b = map(int, input().split())
  x = a ^ b
  count = 0
  remain = 0
  mapper = [-1] * n

  for i in range(n):
    if (x >> i) & 0x1 != 0:
      mapper[count] = i
      count += 1
    else:
      remain += 1
      mapper[-remain] = i

  if count % 2 == 0:
    print('NO', flush=True)
    return

  bits = [0] * n
  history = []
  trace(bits, 1, history)
  bits[0] = 1
  down(bits, 1, count - 1, history)

  for i in range(len(history)):
    v = history[i][:]

    for j, m in enumerate(mapper):
      history[i][n - m - 1] = v[j]

  history = [str(a ^ int(''.join(str(v) for v in h), 2)) for h in history]

  print('YES', flush=True)
  print(' '.join(history), flush=True)


if __name__ == '__main__':
  main()



Measured memory_bytes: 39252
s = '0' + input() + '1'


def f():
    for i, v in enumerate(s[:-2]):
        if s[i] == s[i + 1]:
            return (i, i + 1)
        elif s[i] == s[i + 2]:
            return (i, i + 2)
    return (-1, -1)


(a, b) = f()
print('{0} {1}'.format(a, b))


Measured memory_bytes: 3188
#include <cstdio>
using namespace std;

int main() {
  double x[11] = {0.0, 48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0};
  const char *label[11] = {"light fly", "fly", "bantam", "feather",  "light", "light welter", "welter", "light middle", "middle", "light heavy", "heavy"};
  double w;
  int a, b, c;
  while (scanf("%lf", &w) == 1) {
    a = 0;
    b = 11;
    do {
      c = (a+b)/2;
      if (x[c] >= w) {
        b = c;
      } else {
        a = c;
      }
    } while (a+1 < b);
    printf("%s\n", label[a]);
  }
  return 0;
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
const ll INF = 1e9;
//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);

int main(){
  faster();
  string s;
  cin >> s;
  ll cnt=0,ans=INF;
  rep(i,s.size()){
    if(i%2==1 && s[i]!='1') cnt++;
    if(i%2==0 && s[i]!='0') cnt++;
  }
  ans = min(ans,cnt);
  cnt=0;
  rep(i,s.size()){
    if(i%2==1 && s[i]!='0') cnt++;
    if(i%2==0 && s[i]!='1') cnt++;
  }
  ans = min(ans,cnt);
  cout << ans << endl;
}








































//以下、ライブラリ

void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} //ユークリッドの互除法

ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} //桁数取得

ll POW(auto x,auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} //べき乗計算

Measured memory_bytes: 512
N,A = gets.split.map(&:to_i)
x = gets.split.map(&:to_i)
dp = Array.new(N+1){Array.new(N*50+1,0)}
dp[0][0] = 1

N.times do |i|
	i.downto(0) do |j|
		(N*50+1-x[i]).times do |k|
			dp[j+1][k+x[i]] += dp[j][k]
		end
	end
end

ans = 0
1.upto(N) do |i|
	ans += dp[i][i*A]
end
p ans

Measured memory_bytes: 2812
#include <iostream>
#include <string>
#include <cstring> 

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;

long long mod_div(long long a, long long b) {
	if (a % b == 0)return a / b;
	long long tmp = MOD - 2, c = b, ret = 1;
	while (tmp > 0) {
		if (tmp & 1) {
			ret *= c; ret %= MOD;
		}
		c *= c; c %= MOD; tmp >>= 1;
	}
	return a*ret%MOD;
}

char str[100011];
ll dp[4][100011];

int main() {

	scanf("%s", str);

	ll tmp = 1;
	ll cou = 0;
	REP(i, strlen(str)) {
		if (str[i] == '?')cou++;
	}
	REP(i, cou) {
		tmp *= 3;
		tmp %= MOD;
	}

	dp[0][0] = tmp;
	REP(i, strlen(str)) {
		REP(j, 4) {
			if (dp[j][i]) {
				if (j < 3) {
					if (str[i] == 'A' + j) {
						dp[j + 1][i + 1] += dp[j][i];
						dp[j + 1][i + 1] %= MOD;
					}
					else if (str[i] == '?') {
						dp[j + 1][i + 1] += mod_div(dp[j][i], 3);
						dp[j + 1][i + 1] %= MOD;
					}
				}
				dp[j][i + 1] += dp[j][i];
				dp[j][i + 1] %= MOD;
			}
		}
	}

	cout << dp[3][strlen(str)] << endl;

	return 0;
}


Measured memory_bytes: 3456
/***
    BISMILLAH
    @Author : Arham
**/
#include <bits/stdc++.h>
#define endl "\n"
#define found true
#define infinity 1e+9+10
#define not_found false
#define FOR(limit) for(int i = 0; i < limit; i++)
#define __FOR(limit) for(int j = 0; j < limit; j++)
#define __FOR__(limit) for(int k = 1; k <= limit; k++)
#define hello(a) a ? "Yes" : "No"
#define HELLO(a) a ? "YES" : "NO"
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pof pop_front
#define pob pop_back
#define I insert
#define fr front
#define B back
#define P push
#define pp pop
#define T top
#define F first
#define S second
/// getline (cin, string);
/// find (lower_bound(inclusive), upper_bound(exclusive), value);
/// set.find (value):
typedef long long lld;
using namespace std;

void solving_f() {
    lld n, count = not_found, temp;
    vector < lld > v;
    lld val;
    cin >> n;
    FOR (n) {
        cin >> val;
        v.pb(val);
    }
    sort(v.begin(), v.end());
    for(lld i = not_found; i < n; i++) {
        for(lld j = i + found; j < n; j++) {
            if(v[i] != v[j]) {
                for(int k = j + found; k < n; k++) {
                    if(v[i] != v[k] && v[k] != v[j]) {
                        lld max_val = max(v[i], max(v[j], v[k]));
                        lld min_val = min(v[i], min(v[j], v[k]));
                        lld mid = (v[i] + v[j] + v[k]) - (max_val + min_val);
                        if(mid + min_val > max_val)
                            count++;
                    }
                }
            }
        }
    }
    cout << count << endl;
}

int main(string hello_world) {
    ios_base :: sync_with_stdio(not_found);
    cin.tie(NULL);
//    cout.tie(0);

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    solving_f();

    return not_found;
}


Measured memory_bytes: 3636
N,A,B,C = map(int,input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9

def ans(cur,a,b,c):
    
    if cur == N:
        return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF
    
    ret0 = ans(cur + 1,a,b,c) 
    ret1 = ans(cur + 1,a + l[cur],b,c) + 10
    ret2 = ans(cur + 1,a,b + l[cur],c) + 10
    ret3 = ans(cur + 1,a,b,c + l[cur]) + 10

    return min(ret0,ret1,ret2,ret3)

print(ans(0,0,0,0))







Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64, b: i64,
    }

    println!("{}", std::cmp::max(a + b, std::cmp::max(a-b, a* b)));
}


Measured memory_bytes: 4352
# E - Count Median

N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N%2:
    A_median = A[(N+1)//2-1]
    B_median = B[(N+1)//2-1]
    print(B_median - A_median + 1)
else:
    A_median = (A[N//2-1] + A[N//2])
    B_median = (B[N//2-1] + B[N//2])
    print(B_median - A_median + 1)



Measured memory_bytes: 25412
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int r,c,n;cin>>r>>c>>n;
  vector<pair<P,P>> p(n);
  rep(i,n){
      P f,b;cin>>f.first>>f.second>>b.first>>b.second;
      p[i]={f,b};
  }
  vector<P> top,bottom,right,left;
  rep(i,n){
      if(p[i].first.first%r==0||p[i].first.second%c==0){
          if(p[i].second.first%r==0||p[i].second.second%c==0){
              if(p[i].first.second==0){
                  top.push_back({p[i].first.first,i});
              }
              else if(p[i].first.second==c){
                  bottom.push_back({p[i].first.first,i});
              }
              else if(p[i].first.first==0){
                  left.push_back({p[i].first.second,i});
              }
              else{
                  right.push_back({p[i].first.second,i});
              }
              if(p[i].second.second==0){
                  top.push_back({p[i].second.first,i});
              }
              else if(p[i].second.second==c){
                  bottom.push_back({p[i].second.first,i});
              }
              else if(p[i].second.first==0){
                  left.push_back({p[i].second.second,i});
              }
              else{
                  right.push_back({p[i].second.second,i});
              }
          }
      }
  }
  sort(top.begin(),top.end());
  sort(bottom.begin(),bottom.end());
  sort(left.begin(),left.end());
  sort(right.begin(),right.end());
  reverse(ALL(bottom));
  reverse(ALL(left));
  vector<P> all;
  for(auto& val:top)all.push_back(val);
  for(auto& val:right)all.push_back(val);
  for(auto& val:bottom)all.push_back(val);
  for(auto& val:left)all.push_back(val);
  vector<P> position(n,{inf,inf});
  int nm=all.size();
  rep(i,nm){
      //cout<<all[i].second<<"\n";
      if(position[all[i].second].first==inf){
        position[all[i].second].first=i;
      }
      else{
          position[all[i].second].second=i;
      }
  }
  vector<int> sm(n*3+10,0);
  //cout<<1<<"\n";
  rep(i,n){
      if(position[i].first==inf)continue;
      sm[position[i].first]+=1;
      sm[position[i].second+1]-=1;
  }
  rep1(i,n*3+9){
      sm[i]+=sm[i-1];
  }
  bool flag=true;
  //cout<<0<<"\n";
  rep(i,n){
      if(position[i].first==inf)continue;
      if(sm[position[i].first]!=sm[position[i].second])flag=false;
  }
	if(flag){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
  return 0;
}

Measured memory_bytes: 10136
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

double stod (string s )
{
	stringstream ss (s );
	double res;
	ss >> res;

	return res;
}

double Reverse_Polish_Natation (string t )
{
	stringstream ss (t );
	string s = "";
	stack<double> st;
	while (ss >> s ){
		if (isdigit (s[0] ) || (s[0] == '-' && s.length() > 1 && isdigit (s[1] ) ) ){
			st.push (stod (s ) );
		}else{
			double b = st.top(); st.pop();
			double a = st.top(); st.pop();
			double c = 0.0;
			char ope = s[0];
			switch (ope ){
				case '+': c = a + b; break;
				case '-': c = a - b; break;
				case '*': c = a * b; break;
				case '/': c = a / b; break;
			} // end switch
			st.push (c );
		} // end if
	} // end while

	double res = st.top();

	return res;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.SME", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		double res = Reverse_Polish_Natation (str );
		printf ("%.9lf\n", res );
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1296
/**
 * @author: shashankchdhry
 * @made:   2020-04-05 12:08:45 
**/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;

const int MOD = 1e9+7;

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

    int n;
    cin >> n;

    ll ans = 1;
    for (int i = 1; i <= n; i++)
    {
        ans *= i;
        ans %= MOD;
    }

    cout << ans << "\n";

    return 0;
}

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

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

std::vector<int> str2vec(std::string str){
	std::vector<int> v;

	v.resize(str.size(), 0);
	for(int i = 0; i < str.size(); i++){
		v[i] = str[i] - '0';
	}

	return v;
}

long vec2l(std::vector<int> v){
	long result = 0;
	long d = 1;

	for(int i = 0; i < v.size(); i++){
		result += v[i] * d;
		d *= 10;
	}

	return result;
}

int main(){
	int n;
	std::string buf;
	std::vector<int> v;
	long min, max;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

#if INPUT_FROM_FILE
	std::getline(ifs, buf);
#else
	std::getline(std::cin, buf);
#endif
	n = std::stoi(buf);
	
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		std::getline(ifs, buf);
#else
		std::getline(std::cin, buf);
#endif
		v = str2vec(buf);

		std::sort(v.begin(), v.end());
		max = vec2l(v);

		std::sort(v.begin(), v.end(), std::greater<int>());
		min = vec2l(v);

		std::cout << max - min << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3140
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
	char taro[101], hanako[101];
	int i, j, n, t_p = 0, h_p = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		memset(taro, '\0', sizeof(taro));
		memset(hanako, '\0', sizeof(hanako));
		scanf("%s", taro);
		scanf("%s", hanako);

		if (strcmp(taro, hanako) == 0) {
			t_p += 1;
			h_p += 1;
		}
		else {
			int taro_len = strlen(taro);
			int hanako_len = strlen(hanako);
			int max_len = taro_len > hanako_len ? taro_len : hanako_len;

			for (j = 0; j < max_len; j++) {
				if (j < taro_len && j < hanako_len) {
					if (taro[j] > hanako[j]) {
						t_p += 3;
						break;
					}
					else if (taro[j] < hanako[j]) {
						h_p += 3;
						break;
					}
				}
				else {
					if (j == taro_len) {
						h_p += 3;
						break;
					}
					else if (j == hanako_len) {
						t_p += 3;
						break;
					}
				}
			}
		}
	}

	printf("%d %d\n", t_p, h_p);

	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

vec zalgo(string& s) {
    int n = s.size();
    vec A(n);
    A[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i+j < n && s[j] == s[i+j]) ++j;
        A[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i+k < n && k+A[k] < j) A[i+k] = A[k], ++k;
        i += k; j -= k;
    }
    return A;
}

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

    int res = 0;

    rep(i, n) {
        string t = s.substr(i);
        auto lcp = zalgo(t);

        rep(j, t.size()) {
            int l = min(lcp[j], j);
            res = max(l, res);
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[3];
int main()
{
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[0] <<" "<< a[1]<<" " << a[2]<<endl;
	return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()
/*
void solve(){
  ll n; cin >> n;
  vector<ll> prime;
  FOR(i,2,(1000006)){
    bool flg = true;
    
    if(flg) prime.push_back(i);
  }
}
*/
/*
void solve(){
  int n; cin >> n; int ans =0;
  if(n<10) {cout << n; return;}
  priority_queue<
      int,                // 要素の型はint
      std::vector<int>,   // 内部コンテナはstd::vector (デフォルトのまま)
      std::greater<int>   // 昇順 (デフォルトはstd::less<T>)
    > qb, qa;
  FOR(i,1,10000000){
    string s = std::to_string(i);
    bool flg=true;
    FOR(j,0,s.size()-1){
      if(abs(s[j]-s[j+1])>1) {flg=false; break;}
    }
    if(flg) ans++;
    if(ans==n) {cout << i; return;}
  }
  cout << ans << endl;
}*/
/*
void solve(){
  int n, k, c; cin >> n >> k >> c;
  string s; cin >> s;
}*/
template <class T> std::vector<T> divisors(const T &n) {
  std::vector<T> ret;
  T i = static_cast<T>(1);
  while (i * i < n) {
    if (n % i == static_cast<T>(0)) {
      ret.push_back(i);
      ret.push_back(n / i);
    }
    ++i;
  }
  if (i * i == n) {
    ret.push_back(i);
  }
  std::sort(ret.begin(), ret.end());
  ret.shrink_to_fit();
  return std::move(ret);
}


template<class T> struct prime{
  T N;
  vector<T> v;
  void init(const T &n){
    N = n;
    T i = static_cast<T>(2);
    while(true);
  }
};


void solve(){
  ll n; cin >> n;
  size_t ans = 0;
  for (const ll k : divisors(n)) {
    if (k == 1)
      continue;
    ll m = n;
    while (m % k == 0) {
      m /= k;
    }
    if (m % k == 1) {
      ans += 1;
    }
  }
  ans += divisors(n - 1).size();
  std::cout << ans - 1 << std::endl;
}

void solve2(){
  int n, k, c;
  scanf("%d%d%d",&n,&k,&c);
  char *s;
  s = new char[n+10];
  scanf("%s",s);
  vector<int> L(k+5), R(k+5);
  int cnt = 0, bf=-987654321;
  FOR(i,0,n){
    if(s[i]=='o' && (i-bf)>c) {bf = i; L[cnt] = i; cnt++;}
    if(cnt==k) break;
  }
  bf = 987654321; cnt = k-1;
  IFOR(i,0,n){
    if(s[i]=='o' && (bf-i)>c) {bf = i; R[cnt] = i; cnt--;}
    if(cnt==-1) break;
  }
  FOR(i,0,k){
    if(L[i]==R[i])  cout << (L[i]+1) << '\n' ;
  }
}

int main(){
  //solve();
  solve2();
  return 0;
}

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

int main(){

    string s1,s2;
    cin >> s1;

    int hug = 0;
    for (size_t i = 0; i < s1.size(); i++)
    {
        if(s1[i]!=s1[s1.size()-1-i]){
            hug++;
        }
    }

    cout << hug/2 << endl;

    
    return 0;
}

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

#define mod 1000000007

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int a,b,c;
	cin >> a>>b>>c;
	if (a == b && b != c)
		print("Yes");
	else if (a != b && b == c )
		print("Yes");
	else if (a == c && b != c)
		print("Yes");
	else
	print("No");
}

Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

a, b= map(int, input().split())

if a < b:
    for i in range(b):
        print(a, end="")
else:
    for i in range(a):
        print(b, end="")
print("")


Measured memory_bytes: 9100
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;

typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<int> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;
const int MOD = 1e9 + 7;
void solve() {
    int n, k;
    cin >> n >> k;
    int s = 0;
    rep(i, k, n + 2) {
        int lo = i * (i - 1) / 2;
        int hi = (n - i + 1 + n) * i / 2;
        s = (s + hi - lo + 1) % MOD;
    }
    put(s);
}


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

//    freopen("input.txt", "r", stdin);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}


Measured memory_bytes: 3652