alexjercan/bugnet huggingface dataset:
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

#define f(i, a, b) for (ll i = a; i < (ll)b; i++)
#define af(i, a, b) for (ll i = a; i >= (ll)b; i--)
#define rep(i, a, b, k) for (ll i = a; i < b; i += k)
#define arep(i, a, b, k) for (ll i = a; i >= b; i -= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort(a.begin(), a.end())
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)
#define inter                                                                  \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(nullptr);                                                            \\
  cout.tie(nullptr)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll MAX = 3e5 + 100;

ll l[MAX], r[MAX];

int main() {
  fastio;
  ll tc, n, k, c, w, ind;
  string s;
  cin >> n >> k >> c >> s;
  ind = 0, w = 0;
  while (w < k) {
    if (s[ind] == 'x')
      ind++;
    else {
      l[w++] = ind;
      ind += (c + 1);
    }
  }
  ind = n - 1, w = k - 1;
  while (w >= 0) {
    if (s[ind] == 'x')
      ind--;
    else {
      r[w--] = ind;
      ind -= (c + 1);
    }
  }
  //	f(i,0,k) cout<<l[i]<<" "<<r[i]<<endl;
  f(i, 0, k) if (l[i] == r[i]) cout << l[i] + 1 << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define f(i, a, b) for (ll i = a; i < (ll)b; i++)
#define af(i, a, b) for (ll i = a; i >= (ll)b; i--)
#define rep(i, a, b, k) for (ll i = a; i < b; i += k)
#define arep(i, a, b, k) for (ll i = a; i >= b; i -= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort(a.begin(), a.end())
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)
#define inter                                                                  \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(nullptr);                                                            \\
  cout.tie(nullptr)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int MAX = 1e6 + 100;

ll l[MAX], r[MAX];

int main() {
  fastio;
  ll tc, n, k, c, w, ind;
  string s;
  cin >> n >> k >> c >> s;
  ind = 0, w = 0;
  while (ind < n) {
    if (s[ind] == 'x')
      ind++;
    else {
      l[w++] = ind;
      ind += (c + 1);
    }
  }
  ind = n - 1, w = k - 1;
  while (ind >= 0) {
    if (s[ind] == 'x')
      ind--;
    else {
      r[w--] = ind;
      ind -= (c + 1);
    }
  }
  //	f(i,0,k) cout<<l[i]<<" "<<r[i]<<endl;
  f(i, 0, k) if (l[i] == r[i]) cout << l[i] + 1 << endl;
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define M_PI 3.14159265358979323846 // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a, n) for (ll a = 0; a < n; a++)
#define repi(a, b, n) for (ll a = b; a < n; a++)

static const ll INF = 1e15;

ll n, k, c;
string s;

int main(void) {
  cin >> n >> k >> c;
  cin >> s;
  vector<ll> f, l;
  ll prev = -INF;
  for (ll i = 0; i < n; i++) {
    if (s[i] != 'x') {
      ll d = i - prev;
      if (d > c) {
        f.push_back(i);
        prev = i;
        if (f.size() >= k) {
          break;
        }
      }
    }
  }
  prev = INF;
  for (ll i = n - 1; i >= 0; i--) {
    if (s[i] != 'x') {
      ll d = prev - i;
      if (d > c) {
        l.push_back(i);
        prev = i;
        if (l.size() >= k) {
          break;
        }
      }
    }
  }
  vector<int> r;
  auto ff = f.begin();
  auto fl = l.rbegin();
  for (int i = 0; i < k; i++) {
    if (*ff == *fl) {
      r.push_back(*ff + 1);
    }
    ff++;
    fl++;
  }
  for (auto p : r) {
    cout << p << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define M_PI 3.14159265358979323846 // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a, n) for (ll a = 0; a < n; a++)
#define repi(a, b, n) for (ll a = b; a < n; a++)

static const ll INF = 1e15;

ll n, k, c;
string s;

int main(void) {
  cin >> n >> k >> c;
  cin >> s;
  list<ll> f, l;
  ll prev = -INF;
  for (ll i = 0; i < n; i++) {
    if (s[i] != 'x') {
      ll d = i - prev;
      if (d > c) {
        f.push_back(i);
        prev = i;
        if (f.size() >= k) {
          break;
        }
      }
    }
  }
  prev = INF;
  for (ll i = n - 1; i >= 0; i--) {
    if (s[i] != 'x') {
      ll d = prev - i;
      if (d > c) {
        l.push_front(i);
        prev = i;
        if (l.size() >= k) {
          break;
        }
      }
    }
  }
  vector<int> r;
  auto ff = f.begin();
  auto fl = l.begin();
  for (int i = 0; i < k; i++) {
    if (*ff == *fl) {
      r.push_back(*ff + 1);
    }
    ff++;
    fl++;
  }
  for (auto p : r) {
    cout << p << endl;
  }
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <random>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

ll n, k, c, l[200010], r[200010];
string s;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> c >> s;

  for (int i = 0; i < n; ++i) {
    if (s[i] == 'o') {
      l[i + 1]++;
      i += c;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == 'o') {
      r[i]++;
      i -= c;
    }
  }
  REP(i, n) l[i + 1] += l[i];
  for (int i = n; i >= 1; --i)
    r[i - 1] += r[i];

  // check:
  for (int i = 0; i < n; ++i) {
    if (l[i] + r[i + 1] < k) {
      cout << i + 1 << '\\n';
    }
  }
  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <random>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1LL << 60;

ll n, k, c, l[100010], r[100010];
string s;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> c >> s;

  for (int i = 0; i < n; ++i) {
    if (s[i] == 'o') {
      l[i + 1]++;
      i += c;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == 'o') {
      r[i]++;
      i -= c;
    }
  }
  REP(i, n) l[i + 1] += l[i];
  for (int i = n; i >= 1; --i)
    r[i - 1] += r[i];

  // check:
  for (int i = 0; i < n; ++i) {
    if (l[i] + r[i + 1] < k) {
      cout << i + 1 << '\\n';
    }
  }
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

int n, k, c;
string s;
vector<int> l, r;

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

  cin >> n >> k >> c;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < n && cnt < k; i++)
    if (s[i] == 'o' && (l.empty() || l.back() + c < i)) {
      l.push_back(i);
      cnt++;
    }

  cnt = 0;
  for (int i = n - 1; i >= 0 && cnt < k; i--)
    if (s[i] == 'o' && (r.empty() || r.back() - c > i)) {
      r.push_back(i);
      cnt++;
    }

  for (int i = 0; i < k; i++)
    if (l[i] == r[k - i - 1])
      cout << l[i] + 1 << "\\n";

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

int n, k, c;
string s;
vector<int> l, r;

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

  cin >> n >> k >> c;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < n && cnt < k; i++)
    if (s[i] == 'o' && (l.empty() || l.back() + c < i)) {
      l.push_back(i);
      cnt++;
    }

  cnt = 0;
  for (int i = n - 1; i >= 0 && cnt < k; i--)
    if (s[i] == 'o' && (r.empty() || r.back() - c > i)) {
      r.push_back(i);
      cnt++;
    }

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

  int a = 0, b = 0;
  vector<int> res;
  while (a < k || b < k) {
    if (l[a] == r[b]) {
      cout << l[a] + 1 << "\\n";
      a++, b++;
    } else if (l[a] < r[b])
      a++;
    else
      b++;
  }
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e5 + 7;
int n, k, c, l[maxn], r[maxn], cnt;
char s[maxn];

int main() {
  scanf("%d%d%d%s", &n, &k, &c, s + 1);
  for (int i = 1; i <= n; ++i) {
    if (cnt == k + 1)
      break;
    if (s[i] == 'x')
      continue;
    if (cnt == 0) {
      l[++cnt] = i;
      continue;
    }
    if (l[cnt] + c >= i)
      continue;
    l[++cnt] = i;
  }
  cnt = k + 1;
  for (int i = n; i >= 1; --i) {
    if (cnt == 0)
      break;
    if (s[i] == 'x')
      continue;
    if (cnt == k + 1) {
      r[--cnt] = i;
      continue;
    }
    if (r[cnt] - c <= i)
      continue;
    r[--cnt] = i;
  }
  for (int i = 1; i <= k; ++i) {
    if (l[i] == r[i])
      printf("%d\\n", l[i]);
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e5 + 7;
int n, k, c, l[maxn], r[maxn], cnt;
char s[maxn];

int main() {
  scanf("%d%d%d%s", &n, &k, &c, s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == 'x')
      continue;
    if (cnt == 0) {
      l[++cnt] = i;
      continue;
    }
    if (l[cnt] + c >= i)
      continue;
    l[++cnt] = i;
  }
  cnt = k + 1;
  for (int i = n; i >= 1; --i) {
    if (s[i] == 'x')
      continue;
    if (cnt == k + 1) {
      r[--cnt] = i;
      continue;
    }
    if (r[cnt] - c <= i)
      continue;
    r[--cnt] = i;
  }
  for (int i = 1; i <= k; ++i) {
    if (l[i] == r[i])
      printf("%d\\n", l[i]);
  }
}
Problem p02721 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int n, k, c;
char s[200005];
set<int> st;
set<int> st2;
set<int> st3;
int main() {
  // freopen("in.txt","r",stdin);
  scanf("%d%d%d%s", &n, &k, &c, s);

  int cnt = 1;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      st.insert(i + 1);
      cnt++;
      i += c;
    }
    if (cnt > k)
      break;
  }

  cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      st2.insert(i + 1);
      cnt++;
      i -= c;
    }
    if (cnt > k)
      return 0;
  }
  set_intersection(st.begin(), st.end(), st2.begin(), st2.end(),
                   ostream_iterator<int>(cout, "\\n"));
  // set_intersection(st.begin(),st.end(),st2.begin(),st2.end(),inserter(st3,st3.begin()));

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int n, k, c;
char s[200005];
set<int> st;
set<int> st2;
set<int> st3;
int main() {
  // freopen("in.txt","r",stdin);
  scanf("%d%d%d%s", &n, &k, &c, s + 1);

  int cnt = 1;
  for (int i = 1; i <= n; i++) {
    if (cnt > k)
      break;
    if (s[i] == 'o') {
      st.insert(i);
      cnt++;
      i += c;
    }
  }

  cnt = 1;
  for (int i = n; i >= 1; i--) {
    if (cnt > k)
      break;
    if (s[i] == 'o') {
      st2.insert(i);
      cnt++;
      i -= c;
    }
  }
  // set_intersection(st.begin(),st.end(),st2.begin(),st2.end(),ostream_iterator<int>(cout,"\\n"));
  set_intersection(st.begin(), st.end(), st2.begin(), st2.end(),
                   inserter(st3, st3.begin()));
  for (int i : st3) {
    cout << i << endl;
  }
  //	for(int i:st){
  //		if(st2.find(i)!=st2.end()) cout<<i<<endl;
  //	}
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;

signed main() {
  int n, k, c;
  bool isWorkDays[200000];
  cin >> n >> k >> c;
  for (int i = 0; i < n; i++) {
    char charaWork;
    cin >> charaWork;
    isWorkDays[i] = (charaWork == 'o');
  }

  int holiday = c;

  int needsWorkAfter[200000];
  int needsWorkBefore[200000];
  int day = k - 1;
  for (int i = n - 1; i >= 0 || day >= 0; i--) {
    if (isWorkDays[i]) {
      needsWorkBefore[day] = i;
      i -= holiday;
      day--;
    }
  }

  day = 0;
  for (int i = 0; i < n || day < k; i++) {
    if (isWorkDays[i]) {
      needsWorkAfter[day] = i;
      i += holiday;
      day++;
    }
  }

  for (int i = 0; i < k; i++) {
    if (needsWorkAfter[i] == needsWorkBefore[i]) {
      cout << needsWorkAfter[i] + 1 << endl;
    }
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;

signed main() {
  int n, k, c;
  bool isWorkDays[200000];
  cin >> n >> k >> c;
  for (int i = 0; i < n; i++) {
    char charaWork;
    cin >> charaWork;
    isWorkDays[i] = (charaWork == 'o');
  }

  int holiday = c;

  int needsWorkAfter[100000];
  int needsWorkBefore[100000];
  int day = k - 1;
  for (int i = n - 1; i >= 0 || day >= 0; i--) {
    if (isWorkDays[i]) {
      needsWorkBefore[day] = i;
      i -= holiday;
      day--;
    }
  }

  day = 0;
  for (int i = 0; i < n || day < k; i++) {
    if (isWorkDays[i]) {
      needsWorkAfter[day] = i;
      i += holiday;
      day++;
    }
  }

  for (int i = 0; i < k; i++) {
    if (needsWorkAfter[i] == needsWorkBefore[i]) {
      cout << needsWorkAfter[i] + 1 << endl;
    }
  }
  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
#include <vector>

int main() {
  int N, K, C;
  std::cin >> N >> K >> C;
  std::string S;
  std::cin >> S;

  std::vector<int> Fastest(K);
  std::vector<int> Latest(K);

  int cnt = 0;
  int j = 0;
  while (j < N && cnt != K) {
    if (S[j] == 'o') {
      Fastest[cnt] = j + 1;
      cnt++;
      j += C + 1;
    } else {
      j++;
    }
  }

  cnt = 0;
  j = N - 1;
  while (j >= 0 && cnt != K) {
    if (S[j] == 'o') {
      Latest[K - cnt - 1] = j + 1;
      cnt++;
      j -= (C + 1);
    } else {
      j--;
    }
  }

  for (int i = 0; i < K; i++) {
    if (Fastest[i] == Latest[i]) {
      std::cout << Fastest[i] << std::endl;
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <vector>

int main() {
  int N, K, C;
  std::cin >> N >> K >> C;
  std::string S;
  std::cin >> S;
  std::vector<int> skip(N);
  int cnt = 1;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == 'x') {
      skip[i] = cnt;
      cnt++;
    } else {
      skip[i] = C + 1;
      cnt = 1;
    }
  }

  std::vector<int> ans;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'x') {
      continue;
    }
    std::string tmp = S;
    tmp[i] = 'x';
    int skiptmp = skip[i];
    skip[i] = 1;
    int cnt = 0;
    int j = 0;
    while (j < N && cnt != K) {
      if (tmp[j] == 'o') {
        cnt++;
      }
      j += skip[j];
    }
    if (cnt != K) {
      ans.push_back(i + 1);
    }
    skip[i] = skiptmp;
  }

  for (int i = 0; i < ans.size(); i++) {
    std::cout << ans[i] << std::endl;
  }

  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main() {

  int n, k, c, aa, bb;
  string s;
  vector<int> a, b;

  cin >> n >> k >> c;
  cin >> s;

  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      a.push_back(i + 1);
      i += c;
    }
    if (a.size() == k)
      break;
  }

  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      b.push_back(i + 1);
      i -= c;
    }
    if (b.size() == k)
      break;
  }

  /*for (int i = 0;i < a.size();i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0;i < b.size();i++) cout << b[i] << " ";
  cout << endl;
  cout << a.size() << endl;
  cout << b.size() << endl;*/

  // sort(a.begin(), a.end());
  /*reverse(b.begin(), b.end());

  aa = 0;
  bb = 0;
  while (1) {
          //if((aa+bb)>132090) cout << aa << " " << bb << endl;;
          if (a[aa] == b[bb]) {
                  cout << a[aa] << endl;
                  aa++;
                  bb++;
          }
          else if (a[aa] < b[bb]) {
                  aa++;
          }
          else if (a[aa] > b[bb]) {
                  bb++;
          }

          if (aa == k || bb == k) break;
  }*/

  for (int i = 0; i < k; i++) {
    if (a[i] == b[k - i - 1])
      cout << a[i] << endl;
  }

  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {

  int n, k, c, aa, bb;
  string s;
  vector<int> a, b;

  cin >> n >> k >> c;
  cin >> s;

  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      a.push_back(i + 1);
      i += c;
    }
    if (a.size() == k)
      break;
  }

  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      b.push_back(i + 1);
      i -= c;
    }
    if (b.size() == k)
      break;
  }

  /*for (int i = 0;i < a.size();i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0;i < b.size();i++) cout << b[i] << " ";
  cout << endl;
  cout << a.size() << endl;
  cout << b.size() << endl;*/

  // sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  aa = 0;
  bb = 0;
  while (1) {
    if ((aa + bb) > 132090)
      cout << aa << " " << bb << endl;
    ;
    if (a[aa] == b[bb]) {
      cout << a[aa] << endl;
      aa++;
      bb++;
    } else if (a[aa] < b[bb]) {
      aa++;
    } else if (a[aa] > b[bb]) {
      bb++;
    }

    if (aa == k && bb == k)
      break;
  }

  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

int main() {

  int n, k, c;
  string s;
  vector<int> a, b;

  cin >> n >> k >> c;
  cin >> s;

  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      a.push_back(i + 1);
      i += c;
    }
    if (a.size() == k)
      break;
  }

  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      b.push_back(i + 1);
      i -= c;
    }
    if (b.size() == k)
      break;
  }

  /*for (int i = 0;i < a.size();i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0;i < b.size();i++) cout << b[i] << " ";
  cout << endl;
  cout << a.size() << endl;
  cout << b.size() << endl;*/

  // sort(a.begin(), a.end());
  reverse(b.begin(), b.end());

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

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {

  int n, k, c, aa, bb;
  string s;
  vector<int> a, b;

  cin >> n >> k >> c;
  cin >> s;

  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      a.push_back(i + 1);
      i += c;
    }
    if (a.size() == k)
      break;
  }

  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      b.push_back(i + 1);
      i -= c;
    }
    if (b.size() == k)
      break;
  }

  /*for (int i = 0;i < a.size();i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0;i < b.size();i++) cout << b[i] << " ";
  cout << endl;
  cout << a.size() << endl;
  cout << b.size() << endl;*/

  // sort(a.begin(), a.end());
  reverse(b.begin(), b.end());

  aa = 0;
  bb = 0;
  while (1) {
    // if((aa+bb)>132090) cout << aa << " " << bb << endl;;
    if (a[aa] == b[bb] && aa == bb) {
      cout << a[aa] << endl;
      aa++;
      bb++;
    } else if (a[aa] < b[bb]) {
      aa++;
    } else if (a[aa] > b[bb]) {
      bb++;
    }

    if (aa == k || bb == k)
      break;
  }

  return 0;
}
Problem p02721 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define ll long long
#define itn int
#define co(ans) cout << ans << endl;
#define COYE cout << "YES" << endl;
#define COYe cout << "Yes" << endl;
#define COye cout << "yes" << endl;
#define CONO cout << "NO" << endl;
#define CONo cout << "No" << endl;
#define COno cout << "no" << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FFOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FFOR(i, 1, n)
#define SORT(V) sort((V).begin(), (V).end())
#define REVERSE(V) reverse((V).begin(), (V).end())
#define INF ((1LL << 62) - (1LL << 31))
#define MOD 1000000007
#define MAX 5100000
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;

int main() {
  ll N, K, C, ans = 0;
  string S;
  cin >> N >> K >> C >> S;

  ll L[K],
      R[K]; // L[i]=仕事iが可能な日にちの最小値,R[i]=仕事iが可能な日にちの最大値
  ll cnt = 0;
  for (ll i = 0; i < N; ++i) {
    if (S[i] == 'o') {
      L[cnt] = i;
      cnt++;
      i += C;
    }
    if (cnt == K)
      break;
  }
  cnt = K - 1;
  for (ll i = N - 1; i >= 0; --i) {
    if (S[i] == 'o') {
      R[cnt] = i;
      cnt--;
      i -= C;
    }
    if (cnt == -1)
      break;
  }

  REP(i, K) {
    if (L[i] == R[i])
      co(L[i] + 1);
  }
  cout << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#define ll long long
#define itn int
#define co(ans) cout << ans << endl;
#define COYE cout << "YES" << endl;
#define COYe cout << "Yes" << endl;
#define COye cout << "yes" << endl;
#define CONO cout << "NO" << endl;
#define CONo cout << "No" << endl;
#define COno cout << "no" << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FFOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FFOR(i, 1, n)
#define SORT(V) sort((V).begin(), (V).end())
#define REVERSE(V) reverse((V).begin(), (V).end())
#define INF ((1LL << 62) - (1LL << 31))
#define MOD 1000000007
#define MAX 5100000
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;

int main() {
  ll N, K, C, ans = 0;
  string S;
  cin >> N >> K >> C >> S;

  ll L[K],
      R[K]; // L[i]=仕事iが可能な日にちの最小値,R[i]=仕事iが可能な日にちの最大値
  ll cnt = 0;
  for (ll i = 0; i < N; ++i) {
    if (S[i] == 'o') {
      L[cnt] = i;
      cnt++;
      i += C;
    }
  }
  cnt = K - 1;
  for (ll i = N - 1; i >= 0; --i) {
    if (S[i] == 'o') {
      R[cnt] = i;
      cnt--;
      i -= C;
    }
  }

  REP(i, K) {
    if (L[i] == R[i])
      co(L[i] + 1);
  }
  return 0;
}