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

using namespace std;

using int64 = long long;
//const int mod = (int) (1e9 + 7);
const int mod = 998244353;

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int64 N;
  cin >> N;
  string S;
  while(N > 0) {
    S += ((N - 1) % 26) + 'a';
    N = (N - 1) / 26;
  }
  reverse(begin(S), end(S));
  cout << S << "\n";
}









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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

ll gcd(ll a, ll b)
{
	if(b==0)
		return a;
	return gcd(b,a%b);
}

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

    ll n;
    cin >> n;

    ll a[n];

    rep(i,n)
    {
    	cin >> a[i];
    }

    ll ans = a[0];

    rep(i,n)
    {
    	ans = gcd(ans, a[i]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1024
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		log.Fatal(e)
	}
	return i
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func main() {
	sc.Split(bufio.ScanWords)

	r := getInt()
	out(math.Pi * 2 * float64(r))
}


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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

int main(){
    int K,N;
    cin >> K >> N;
    
    vi A (N+1);
    REP(i,N){
        cin >> A[i];
    }
    
    A[N] = K + A[0];
    
    vi dist (N);
    REP(i,N){
        dist[i] = A[i+1] - A[i];
    }
    
    int maxd = 0;
    
    REP(i,N){
        maxd = max(maxd,dist[i]);
    }
    
    int answer = K-maxd;
    
    cout << answer << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define pb push_back
#define pii pair<long long,long long>
#define endl '\n'
#define N 300001
vector<vector<int>>dp;
void solve()
{
    int n,w; cin>>n>>w; dp.clear();
    vector<int> val(n),weight(n);
    for(int i=0;i<n;i++)
    cin>>weight[i]>>val[i];
    dp.assign(n+1,vector<int>(w+1)); int ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
            if(j-weight[i-1]>=0)
            dp[i][j]=max(dp[i][j],dp[i-1][j-weight[i-1]]+val[i-1]);
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test; test=1;
    while(test--)
    {
        solve();
    }
    return 0;
}

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

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

    int ans = 0;
    if (a + W < b)
        ans = b - (a + W);
    else if (b + W < a)
        ans = a - (b + W);

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		int A = sc.nextInt();
		int B = sc.nextInt();

		int ans=(A-1)*(B-1);
		System.out.println(ans);
	}
}

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

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using ll=long long;
using pii=pair<int, int>;
#define int ll
const int MOD = 1000000007;

vector<int> elist[55];
int fa[55][8], dep[55];

void dfs(int node, int par) {
	int v = 0;
	fa[node][v] = par;
	while(fa[node][v] != -1) {
		fa[node][v+1] = fa[fa[node][v]][v];
		v++;
	}
	while(v != 8) fa[node][v++] = -1;
	if(par == -1) dep[node] = 0;
	else dep[node] = dep[par]+1;
	for(int i:elist[node]) if(i != par) dfs(i, node);
}

int lca(int a, int b) {
	if(dep[a] < dep[b]) swap(a, b);
	for(int i=7; i>=0; i--)
		if(fa[a][i] != -1 && dep[a] - (1<<i) >= dep[b]) a = fa[a][i];
	for(int i=7; i>=0; i--)
		if(fa[a][i] != -1 && fa[b][i] != -1 && fa[a][i] != fa[b][i]) {
			a = fa[a][i];
			b = fa[b][i];
		}
	if(a != b) return fa[a][0];
	return a;
}

uint64_t mask[25];

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	rep(i, n-1) {
		int u, v; cin >> u >> v;
		elist[u].pb(v);
		elist[v].pb(u);
	}
	dfs(1, -1);
	int m; cin >> m;
	rep(i, m) {
		int a, b; cin >> a >> b;
		int lc = lca(a, b);
		while(b != lc) {
			mask[i] |= (1ull<<b);
			b = fa[b][0];
		}
		while(a != lc) {
			mask[i] |= (1ull<<a);
			a = fa[a][0];
		}
	}
	uint64_t ans = 0;
	rep(bm, 1ull<<m) {
		uint64_t tree = 0;
		int cnt = 0, free = 0;
		rep(i, m) {
			if(bm & (1ull<<i)) {
				tree |= mask[i];
				cnt++;
			}
		}
		iter(i, 2, n+1) if(!(tree & (1ull<<i))) free++;
		if(cnt%2) ans -= (1ull<<free);
		else ans += (1ull<<free);
	}
	cout << ans << endl;
}


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

int main() {
  int n; cin >> n;
  int p[n];
  for(int i = 0; i < n;i++) cin >> p[i];
  int cnt = 0;
  for(int i = 0; i < n-1;i++){
    if(p[i] != i+1)cnt++;
  }
  if(cnt < 3) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long int
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define ff first
#define ss second
#define vp vector <pair<int,int>>
#define vpp vector <pair<int,pair<int,int>>>
#define seti set<int>
#define setbit(x) __builtin_popcountll(x)
#define sov(v) accumulate(all(v),0)
#define fs(it,a) for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pqmax priority_queue <int,vector <int>> 
#define pqmin priority_queue <int,vector <int>,greater<int>> 
#define dq deque <int>
#define umi unordered_map<int,int>
#define ums unordered_map<string,int>
#define sp(x,y) fixed << setprecision(y) << x
#define all(x) x.begin(),x.end()
#define f(x,y,z) for(int x=y;x<z;x++)
#define si size()
#define countdigit(x) floor( log10(x) +1)
#define M 1000000007  
//Use (k%M+m)%m always where k is any no
#define PI 3.1415926535
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> pdbs; 
// null for set,mapped_type for map; 
//less for assending greater for descending
//ceil(a/b)=(a+b-1)/b
#define ee "\n"
#define re return 
 
 
 
//Author Rahul Sannigrahi
 
vector<int> take(int n)
{
    int i,j;
    vi v;
    f(i,0,n)
    {
        cin>>j;
        v.pb(j);
    }
    return v;
}
 
void show(vector<int>v)
{
    int i;
    for(i=0;i<v.si;i++)
    {
     cout<<v[i]<<" ";   
    }
    cout<<ee;
}
 
int decode()
{
   int i,j,k,l,n,m,c=0;
   vp v;
   cin>>n;
   f(i,0,n)
   {
       cin>>k>>l;
       v.pb(mp(k,l));
   }
   for(auto x: v)
   {
   if (x.first==x.second)
   c++;
   else if(c<3)
   c=0;
   }
   if(c>=3)
   cout<<"Yes"<<ee;
   else
   cout<<"No"<<ee;
    re 0;
}
 
int32_t main()
{
    IOS
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
    // #endif 
    
    int t=1;
    //cin>>t;
    while(t--)
    decode();
    return 0;
}

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

struct Graph {
    struct Vertex { int n, x; };
    struct Edge { int i, n, c; };
    Graph(int n, int m) : v(n, { -1, -1 }), e(m), n(n), m(0) {}
    void add_edge(int i, int j, int c) {
        e[m] = { j, v[i].n, c };
        v[i].n = m;
        m++;
    }
    void dfs(int i, int p, int x) {
        v[i].x = x;
        for (int j = v[i].n; j >= 0; j = e[j].n) {
            Edge &o = e[j];
            if (o.i == p) continue;
            dfs(o.i, i, (x + o.c) % 2);
        }
    }
    vector<Vertex> v;
    vector<Edge> e;
    int n, m;
};


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

    int n;
    cin >> n;

    Graph g(n, (n - 1) * 2);
    for (int i = 0; i < n - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        c %= 2;

        g.add_edge(a, b, c);
        g.add_edge(b, a, c);
    }

    g.dfs(0, -1, 0);

    for (int i = 0; i < n; i++) {
        cout << g.v[i].x << '\n';
    }
    cout << flush;

    return 0;
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    VI p(n), q(n); cin >> p >> q;
    VI a(n);
    FOR(i, 0, n)a[i] = i + 1;

    int cnt = 1, x = -1, y = -1;

    do {
        bool P = true, Q = true;
        FOR(i, 0, n) {
            if (a[i] != p[i])P = false;
            if (a[i] != q[i])Q = false;
        }
        if (P)x = cnt;
        if (Q)y = cnt;
        ++cnt;
    } while (next_permutation(all(a)));

    cout << abs(x - y) << "\n";
}

Measured memory_bytes: 256
N,A=map(int,input().split())
X=list(map(int,input().split()))
DP=[[0]*2501 for i in range(N+1)]
DP[0][0]=1
for k in range(N):
  for i in range(N-1,-1,-1):
    for j in range(2450,-1,-1):
      DP[i+1][j+X[k]]+=DP[i][j]
P=0
for i in range(N+1):
  P+=DP[i][i*A]
print(P-1)

Measured memory_bytes: 69204
# a〜z
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s=list(input())
K=int(input())

l2=[]

a=''
for x in l:
  if x in s:
    a=x
    for i in range(len(s)):
      if s[i]==a:
        for j in range(6):
          l2.append(''.join(s[i:i+j]))

l2=list(set(l2))
l2.remove('')
l2.sort()
print(l2[K-1])

Measured memory_bytes: 5084
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		char[] alp = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
		int[] count = new int[26];
		while(scan.hasNext()){
			String word = scan.next();
			word = word.toLowerCase();
			for(int i = 0; i < word.length(); i++){
				char ch = word.charAt(i);
				for(int j = 0; j < 26; j++){
					if(ch == alp[j]){
						count[j]++;
					}
				}
			}
		}

		for(int i = 0; i < 26; i++){
			System.out.printf("%c : %d\n", alp[i], count[i]);
		}
	}
}

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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            Solver solver = new Solver();
            solver.solve();
            return;
        }
    }

    class Solver
    {
        public Solver()
        {
            /* Here Initialize */
        }

        public void solve()
        {
            for (int i = 1; i < 10; i++)
                for (int j = 1; j < 10; j++)
                    Console.WriteLine(i + "x" + j + "=" + (i * j));
        }

        static String rs() { return Console.ReadLine(); }
        static int ri() { return int.Parse(Console.ReadLine()); }
        static long rl() { return long.Parse(Console.ReadLine()); }
        static double rd() { return double.Parse(Console.ReadLine()); }
        static String[] rsa() { return Console.ReadLine().Split(' '); }
        static int[] ria() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e)); }
        static long[] rla() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e)); }
        static double[] rda() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e)); }
    }

}

Measured memory_bytes: 5584
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    IOS
    char s[3];
    cin >> s[0] >> s[1] >> s[2];
    int cnt = 0;
    for (int i = 0; i < 3; i++)
        if (s[i] - '0') cnt++;
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <climits>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <functional>
#include <unordered_set>
#include <cstring>
#include <cassert>
#include <bitset>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x...)
#endif

//#define int ll
//#pragma GCC optimize("Ofast")

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define sz(x) int((x).size())

#ifdef ONLINE_JUDGE
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#else
mt19937 rng(228);
#endif

const int N = 2e6 + 7;
const int inf = INT_MAX / 2;
const ll INF = LLONG_MAX / 3;
//const int MOD = 998244353;
const int MOD = 1e9 + 7;
const ld eps = 1e-6;
const pii dir[] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };


signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(9);
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    map <string, int> a;
    while (n--) {
        string s;
        cin >> s;

        a[s]++;
    }

    cout << "AC x " << a["AC"] << "\n" << "WA x " << a["WA"] << "\n" << "TLE x " << a["TLE"] << "\n" << "RE x " << a["RE"] << endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int x = sc.nextInt();
    int ab = a + b;
    
    if (a <= x && ab >= x) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }
}

Measured memory_bytes: 21844
import sys
from collections import Counter
from operator import itemgetter
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    S=[input()for _ in range(n)]
    s_cnt=Counter(S)
    s_list=sorted(list(s_cnt.items()),key=itemgetter(1),reverse=True)
    s_list=[s[0] for s in s_list if s[1]==s_list[0][1]]
    s_list.sort()
    for s in s_list:
        print(s)
if __name__=='__main__':
    main()

Measured memory_bytes: 46684
S = input()
N = len(S)

ans = [0] * N

tmp_l = -1

def compute_right(index):
    org = index
    tmp = S[index]
    while tmp != 'R' and index < N - 1:
        index += 1
        tmp = S[index]
    if index == N - 1:
        index = N
    return index - org

for i in range(N):
    if i < N - 1 and S[i] == S[i+1] and S[i] == 'R':
        continue
    if i > 0 and S[i] == S[i-1] and S[i] == 'L':
        tmp_l = i
        continue
    if S[i] == 'L':
        left = (i - tmp_l - 1) // 2
        right = (compute_right(i) - 1) // 2
        ans[i] = 1 + left + right
        tmp_l = i
    if S[i] == 'R':
        left = (i - tmp_l - 1) // 2
        right = compute_right(i + 1) // 2
        ans[i] = 1 + left + right

print(' '.join(map(str, ans)))


Measured memory_bytes: 10612
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int n, m, nn, edge[16][16], tmpx, tmpy, tmpz, sums;
int blocks[1 << 16], len, f[1 << 16][16];
int main() {
	cin >> n >> m;
	nn= 1 << n;
	for(int i= 1; i <= m; i++) {
		cin >> tmpx >> tmpy >> tmpz;
		sums+= edge[tmpx][tmpy]= edge[tmpy][tmpx]= tmpz;
	}
	for(int i= 0; i < nn; i++) {
		for(int j= 1; j <= n; j++) {
			if(!(i & (1 << (j - 1))) && !(blocks[i | (1 << (j - 1))])) {
				blocks[i | (1 << (j - 1))]= blocks[i];
				for(int k= 1; k <= n; k++)
					if((i & (1 << (k - 1)))) blocks[i | (1 << (j - 1))]+= edge[j][k];
			}
		}
	}
	memset(f, -1, sizeof(f));
	f[1][1]= 0;
	for(int i= 0; i < nn; i++) {
		for(int j= 1; j <= n; j++) {
			if(f[i][j] != -1 && (i & (1 << (j - 1)))) {
				for(int k= 1; k <= n; k++)
					if(!(i & (1 << (k - 1))) && edge[j][k]) f[i | (1 << (k - 1))][k]= max(f[i | (1 << (k - 1))][k], f[i][j] + edge[j][k]);
				tmpx= ((nn - 1) ^ i) | (1 << (j - 1));
				for(int k= tmpx; k; k= (k - 1) & tmpx)
					if(k & (1 << (j - 1))) f[i | k][j]= max(f[i | k][j], f[i][j] + blocks[k]);
			}
		}
	}
	cout << sums - f[nn - 1][n] << endl;
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;

int main(){
    long long n,k;
    cin >> n >> k;
    long long a,b;
    a = (0+k-1)*k/2;
    b = (n+(n-k+1))*k/2;
    long long ans = 0;
    while(k<=n+1){
        ans += (b-a+1);
        ans %= mod;
        a += k;
        b += n-k;
        k++;
    }
    cout << ans << endl;
    return 0;
}


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

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

int main(){
    int h,w;
    cin>>h>>w;
    char table[h+2][w+2];
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            table[i][j]='%';
        }
    }
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            cin>>table[i][j];
        }
    }
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            if(table[i][j]=='#'){
                if(table[i-1][j]=='#') continue;
                if(table[i+1][j]=='#') continue;
                if(table[i][j-1]=='#') continue;
                if(table[i][j+1]=='#') continue;
                cout<<"No";
                return 0;
            }
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a = scan.nextInt();
		int masu = n*n;
		System.out.println(masu-a);
	}

}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
void Yes() {
    cout << "Yes" << endl;
}
void No() {
    cout << "No" << endl;
}
int main(void) {
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s) Yes();
    else No();
}


Measured memory_bytes: 3600
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

long long modpow(long long a, long long b){ 
  long long r = 1LL;
  while(b){
    if(b & 1LL)r *= a;
    if(r >= MOD)r %= MOD;
    a *= a;
    if(a >= MOD)a %= MOD;
    b >>= 1LL;
  }
  return r%MOD;
}
 
#define N_MAX 400100

long long fact[N_MAX];
long long rfact[N_MAX];

long long nCr(long long n, long long r){ 
  long long ret = 1LL;
  ret *= fact[n];
  ret %= MOD;
  ret *= rfact[r];
  ret %= MOD;
  ret *= rfact[n-r];
  ret %= MOD;
  return ret;
}

int main(){
clr(fact,0);
fact[0]=1;
rep(i,1,N_MAX){
  fact[i] = fact[i-1]*i;
  fact[i] %= MOD;
}
clr(rfact,0);
rfact[0]=1;
rep(i,1,N_MAX){
  rfact[i] = rfact[i-1]*modpow(i,MOD-2);
  rfact[i] %= MOD;
}
  ll n,k;
  cin>>n>>k;
  if(n<=k){
    ll a = nCr(2*n-1,n);
    a %= MOD;
    cout << a << endl;
  }
  else{
    ll a = 1;
    rep(i,1,k+1){
      ll r = n-i;
      ll b = nCr(n,i);
      ll c = nCr(i+r-1,i);
      b *= c;
      b %= MOD;
      a += b;
      a %= MOD;
    }
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 6528
n, w = [int(x) for x in input().split()]
W = []
V = []
for i in range(n):
  wi, vi = [int(x) for x in input().split()]
  W.append(wi)
  V.append(vi)

dp = []
for i in range(n+1):
  dp.append([0]*(w+1))

for i in range(n):
  for sum_w in range(w + 1):
    # 選ぶ場合
    if sum_w - W[i] >= 0:
      dp[i+1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - W[i]] + V[i])

    # 選ばない場合
    dp[i+1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])

print(dp[n][w])

Measured memory_bytes: 120812
n, k = map(int, input().split())
R, S, P = map(int, input().split())
t = input()
 
dp = [0] * n
dic = {'r': P, 's': R, 'p': S}
 
for i in range(n):
  if i >= k and (t[i-k] == t[i]) and dp[i-k] != 0:
    continue
  dp[i] = dic[t[i]]
 
print(sum(dp))

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

int dp[100001];
int a[100001];
int main(){
	int N, K;
	cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		dp[i]=1e9+7;
	}

	dp[0]=0;
	for(int i = 1; i < N; i++){
		for(int j = 1; j <= K; j++){
			if(i-j>=0){
				dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
			}
		}
	}
	cout << dp[N-1] << endl;

}


Measured memory_bytes: 4308
N=int(input())
inf=float("inf")

X=[inf]*(N+1)
X[0]=0

for x in range(1,N+1):
    X[x]=X[x-1]+1

    b=6
    while x>=b:
        X[x]=min(X[x],X[x-b]+1)
        b*=6

    c=9
    while x>=c:
        X[x]=min(X[x],X[x-c]+1)
        c*=9

print(X[-1])


Measured memory_bytes: 74668
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f(z) for(int i=1;i<=z;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
#define mod  1000000007
#define cl(n,m) (n-1)/m  + 1 ;
#define T() int TT; cin>>TT; while(TT--)
#define P pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

signed main(){
	int n ;
	string s ,k;
	cin>>s >>k;
	reverse( s.begin() , s.end()) ;
	if( s==k ) cout << "YES\n" ;
	else cout <<" NO\n" ;
}

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

class Program
{
    static void Main(string[] args)
    {

        String[] aryStr = Console.ReadLine().Split(' ');

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

        int shou = a / b;
        int jou = a % b;
        double shouD =(double) a / b;
        String strShouD = string.Format("{0:f5}\r\n", shouD);

        Console.WriteLine("{0} {1} {2}", shou, jou, strShouD);

    }
}

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MOD2 100000000
#define ll long long
#define cnl(d) cout<<d<<'\n'
#define cns(d) cout<<d<<' '
#define endl '\n'
#define cno cout<<"NO\n"
#define cyes cout<<"YES\n"
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define pl pair<ll,ll>
#define vll vector<pl>
#define sl set<ll>
#define sll set<pl>
#define msl map<string,ll>
#define mll map<ll,ll>
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define rdp(i,a,b) for(i=(a);i>=(b);i--)
#define lb(v,z) lower_bound(all(v),z)
#define ub(v,z) upper_bound(all(v),z)
#define trvl(c,it) for(vl::iterator it=(c).begin();it!=(c).end();it++)
#define trvll(c,it) for(vll::iterator it=(c).begin();it!=(c).end();it++)
#define trsll(c,it) for(sll::iterator it=(c).begin();it!=(c).end();it++)
#define trmsl(c,it) for(msl::iterator it=(c).begin();it!=(c).end();it++)
#define trmll(c,it) for(mll::iterator it=(c).begin();it!=(c).end();it++)
#define trsl(c,it) for(sl::iterator it=(c).begin();it!=(c).end();it++)
#define trsi(c,it) for(set<int>::iterator it=(c).begin();it!=(c).end();it++)

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,x;
    cin>>n>>x;
    int ar[n];
    for(int i=0;i<n;i++)
        cin>>ar[i];
    sort(ar,ar+n);
    for(int i=0;i<n;i++)
    {
        if(x-ar[i]>=0)
        {
            x-=ar[i];
            continue;
        }
        else{cout<<i<<"\n";return 0;}
    }
    if(x==0)n++;
    cout<<n-1<<"\n";
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


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

	if (a==b) {
		cout << "Draw" << "\n";
		return 0;
	}

	if (a==1) {
		cout << "Alice" << "\n";
		return 0;
	}
	if (b==1) {
		cout << "Bob" << "\n";
		return 0;
	}
	if (a>b) {
		cout << "Alice" << "\n";
		return 0;
	} else {
		cout << "Bob" << "\n";
		return 0;

	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define reps(i,a,b) for(long long int i=a;i<b;i++)
#define rep(i,a) for(long long int i=0;i<a;i++)
typedef long long int ll;
using namespace std;
//http://kyopro.hateblo.jp/entry/2019/05/06/043431

class Tree {
public:
    int n;
    vector<vector<pair<int, int>>> adj;

    Tree(int nn) { n = nn;
    adj.resize(n);
    }

    void add_edge(const int v1, const int v2, const int w) {
        adj[v1].push_back(make_pair(v2, w));//v1→v2 重みがw
        adj[v2].push_back(make_pair(v1, w));//adj[v1]にはv1から行けるところが入ってる。これは無向グラフの奴
    }

    pair<int, int> Dfs(const int prev, const int cur) { //深さ優先探索　previous昔　current　今
        pair<int, int> res(cur, 0); //result。右側が距離？
        for (const auto &e : adj[cur]) {//adj[cur]というベクトルの初めから最後までやります　参照auto& eを書くと、コンテナ内の要素を変更できる。＆がないと変更できない//次に行ける場所へと！
            if (prev == e.first) continue;//後戻りはしない
            auto nxt = Dfs(cur, e.first);//そこから先の距離を返せ//再帰のキモ
            nxt.second += e.second;//そこから先の距離＋今回の移動分
            if (res.second < nxt.second) res = nxt;//最大値を求める
        }
        return res;
    }

    pair<int, int> farthest_pair;
    int Diameter() {
        const auto v1 = Dfs(-1, 0), v2 = Dfs(-1, v1.first);//初期状態で初めの場所とかないから-1
        farthest_pair = make_pair(v1.first, v2.first);
        return v2.second;
    }
    void junbanire(vector<int>& irerare,vector<int> irerumono){
        int otozure[n]={};
        int nankome=0;
        queue<int> que;
        que.push(0);
        while(que.size()){
            
            int cur = que.front();
            
            que.pop();
            if(otozure[cur]>0){
                continue;
            }
            else{
                otozure[cur]++;
                irerare[cur]=irerumono[n-1-nankome];
                //cout<<"ansno"<<cur<<"ni"<<irerumono[nankome]<<endl;
                nankome++;
                for (const auto &e : adj[cur]) {//adj[cur]というベクトルの初めから最後までやります　参照auto& eを書くと、コンテナ内の要素を変更できる。＆がないと変更できない//次に行ける場所へと！
                    que.push(e.first);
                }
            }
        }

    }
};


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

    Tree tree(N);
    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        tree.add_edge(a-1,b-1,1);
    }
    vector<int> c;
    rep(i,N){
        int cc;
        cin>>cc;
        c.push_back(cc);
        
    }
    sort(c.begin(),c.end());
    ll sum = 0;
    rep(i,N-1){
        sum += (ll)c[i];
    }
    cout<<sum<<endl;
    vector<int> ans(N);
    tree.junbanire(ans,c);

    rep(i,N){
        cout<<ans[i]<<endl;
    }
    return 0;
}

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

if x>=400 and x<600 :
    print (8)
elif x>=600 and x<800 :
    print (7)
elif x>=800 and x<1000 :
    print (6)
elif x>=1000 and x<1200 :
    print (5)
elif x>=1200 and x<1400 :
    print (4)
elif x>=1400 and x<1600 :
    print (3)
elif x>=1600 and x<1800 :
    print (2)
elif x>=1800 and x<2000 :
    print (1)


Measured memory_bytes: 9184
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    S = list(sys.stdin.readline().rstrip())
    a = S[0]
    if S.count(a) > 2:
        print("No")
        exit()
    S = S[1::]
    if a in S:
        S.remove(a)
    else:
        print("No")
        exit()
    b = S[0]
    S = S[1::]
    if b in S:
        print("Yes")
    else:
        print("No")

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    ll n;
    cin>>n;

    vector<ll> v;

    while(n>0)
    {
        ll x=n%26;
        if(x==0)
        {
            v.pb(26);
            n=n/26-1;
        }
        else
        {
            v.pb(x);
            n=n/26;
        }
    }
    reverse(all(v));
    for(auto i:v) cout<<(char)('a'+i-1);
    
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++)
    cin >> A.at(i);
  
  sort(A.begin(), A.end(), [](const int x, const int y){return x > y;});
  
  int score1 = 0;
  int score2 = 0;
  for(int i = 0; i < N; i+=2) 
  	score1 += A.at(i);
  for(int i = 1; i < N; i+=2) 
  	score2 += A.at(i);
  cout << score1 - score2 << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long llong;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
int getInt(){
    int s;
    scanf("%d", &s);
    return s;
}
int main(){
    int h, w, n;
    cin >> h >> w >> n;

    int large = max(h, w);
    int sum = 0;

    int ans = 0;
    while(sum < n){
        ans++;
        sum += large;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp

#include <iostream>
#include <vector>
using namespace std;


int main(){	
	int n,m;
	int A[1001]={},B[1001]={};
	vector<pair<int,int> > vec;
	
	cin >> n >> m;
	for(int i=0;i<n;i++){
		cin >> A[i];
//		vec.push_back(make_pair(A[i],i));
	}
	for(int i=0;i<m;i++){
		cin >> B[i];
	}
	
//	sort(vec.begin(),vec.end(),greater<pair<int,int> >());
	int answer[1001]={};
	
	for(int j=0;j<m;j++){
		for(int i=0;i<n;i++){
			if(A[i] <= B[j]){
				answer[i] ++;
				break;
			}
		}
	}
	int Max = -1;
	for(int i=0;i<n;i++){
		Max = max(Max,answer[i]);
	}
	for(int i=0;i<n;i++){
		if(Max == answer[i]){
			cout << i+1 << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>

char str[1005];
char p[1005];

int main()
{
	int q, a, b;
	char op[10], *x, *y, c;
	
	scanf("%s%d", str, &q);
	while (q--) {
		scanf("%s%d%d", op, &a, &b);
		if (op[2] == 'i') {             // print
			b++, c = *(str+b), *(str+b) = 0, puts(str+a), *(str+b) = c;
		} else if (op[2] == 'v') {      // reverse
			x = str+a, y = str+b;
			while (x < y) {
				c = *x, *x = *y, *y = c;
				x++, y--;
			}
		} else {                        // replace
			scanf("%s", p);
			x = str+a, y = p;
			while (*y) *x++ = *y++;
		}
	}
	return 0;
}



Measured memory_bytes: 2108
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{

	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int peak = 0;
		int returnNumber = 0;
		mathClass keisan =new mathClass();
		ArrayList<String> stack = new ArrayList<String>();
		stack.add("??§?¨?0 ??????????????´??????");
		while(scan.hasNext()){
			stack.add(scan.next());
			peak += 1;

			//??\??????????????????????????£???????¨?????????????
			if(stack.get(peak).equals("+") || stack.get(peak).equals("-") || stack.get(peak).equals("*") || stack.get(peak).equals("/")){
				returnNumber = keisan.shisokuEnzan(stack.get(peak-2),stack.get(peak-1),stack.get(peak));
//				System.out.println(returnNumber);
				//?????£?????????????????????????¨???????????????\??????
				stack.remove(peak);
				stack.remove(peak-1);
				stack.remove(peak-2);
				stack.add(String.valueOf(returnNumber));
				peak -= 2;
			}
//			System.out.println("While");
		}
		System.out.println(stack.get(peak));
	}
}
class mathClass{

	public mathClass(){

	}

	//?????????????????????
	public int shisokuEnzan(String stringX,String stringY,String op){
		int ret =0;
		int x =Integer.parseInt(stringX);
		int y =Integer.parseInt(stringY);
//		System.out.println(x+" "+op+" "+y+" wo okonau");

		if(op.charAt(0) == '+'){
			ret = x + y;
		}
		if(op.charAt(0) == '-'){
			ret = x - y;
		}
		if(op.charAt(0) == '*'){
			ret = x * y;
		}
		if(op.charAt(0) == '/'){
			ret = x / y;
		}
		return ret;
	}

	//???????????¨?????????
	public void disp(int[] ary){
		for(int i=0;i<ary.length;i++){
			System.out.println(ary[i]);
		}
	}

}

Measured memory_bytes: 26264
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}
// auto v = make_vec<int>(h, w);
// fill(v, 0);

signed main(){

  int n, k, c; cin >> n >> k >> c;
  string s; cin >> s;

  auto dp = make_vec<int>(2, n);
  fill(dp, 0);
  for(int i = 0; i < 2; i++){
    if(i == 1) reverse(s.begin(),s.end());
    int nxt = 0, cnt = 0;
    for(int j = 0; j < n; j++){
      if(s[j] == 'x') continue;
      if(j >= nxt){
        if(cnt >= k) return 0;
        dp[i][j] = 1;
        nxt = j + c+1;
        cnt++;
      }
    }
  }

  reverse(dp[1].begin(),dp[1].end());
  for(int i = 0; i < n; i++){
    if(dp[0][i] == 1 && dp[1][i] == 1){
      cout << i+1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 5252
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$r = $key->A[0];
$g = $key->A[1];
$b = $key->A[2];

$wk = $r.$g.$b;
if  ($wk % 4 == 0) {
  printf("YES\n");
}
else {
  printf("NO\n");
}


Measured memory_bytes: 3700
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
  long long int n,m;
  long long int X = 1000000007;
  long long int ans = 1;
  cin >> n >> m;

  if(n-m >= 2 || m-n >= 2){
    cout << 0 << endl;
    return 0;
  }

  if(n-m == 1 || m-n == 1){

    for(int i=n;i>0;i--)
      ans = (ans * i)%X;

    for(int i=m;i>0;i--)
      ans = (ans * i)%X;

    cout << ans << endl;
    return 0;

  }

  ans *= 2;

    for(int i=n;i>0;i--)
      ans = (ans * i)%X;

    for(int i=m;i>0;i--)
      ans = (ans * i)%X;

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
typedef long long i64;
const int MAXN = 1e5 + 10;

i64 answer;
i64 totCnt;
i64 N, M;
i64 check[MAXN];
i64 cnt[3];

bool flag;

vector<pair<i64, i64> > Adj[MAXN];

inline void addEdge(i64 u, i64 v, i64 w)
{
	Adj[u].emplace_back(v, w);
}

void DFS(int cur)
{
	cnt[check[cur]] ++;

	for(auto x : Adj[cur])
	{
		totCnt += (x.second == 1);

		if(check[x.first] != -1)
		{
			if((check[cur] + x.second) % 3 != check[x.first])
				flag = true;
		}
		else
		{
			check[x.first] = (check[cur] + x.second) % 3;
			DFS(x.first);
		}
	}
}

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

	cin >> N >> M;
	for (int i = 1; i <= M; i++)
	{
		i64 u, v;
		cin >> u >> v;
		addEdge(u, v, 1);
		addEdge(v, u, 2);
	}

	memset(check, -1, sizeof check);

	for(int i = 1; i <= N; i++)
	{
		if(check[i] != -1)
			continue;

		check[i] = 0, totCnt = 0;
		cnt[0] = cnt[1] = cnt[2] = 0;
		flag = false;

		DFS(i);
		if(flag)
			answer += (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
		else if(!cnt[0] || !cnt[1] || !cnt[2])
			answer += totCnt;
		else
			answer += cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];

	}

	cout << answer << endl ;

	return 0;
}


Measured memory_bytes: 12800
from collections import Counter
def i(): return int(input())
def l(): return list(map(int,input().split()))

N = i();A = l()
A.sort()
dp = [1]*(10**6+1)
C = Counter(A)
ans = 0
for a,b in C.items():
    if b != 1:dp[a] = 0
    elif dp[a]:ans += 1
    for j in range(a,10**6+1,a):dp[j] = 0
print(ans)


Measured memory_bytes: 133544
import itertools
N,M=map(int,input().split())
tributes=[]
ans=0
seq=(0,1,2)
for i in range(N):
    x,y,z=map(int,input().split())
    tributes.append([x,y,z])
for i in range(8):
    sor=[0]*3
    for j in range(3):
        if (i >> j) & 1:
            sor[j] = 1
    l=[]
    for i in range(N):
        num=0
        for j in range(3):
            num=num+tributes[i][j]*pow(-1,sor[j])
        l.append(num)
    l.sort(reverse=True)
    ans=max(ans,sum(l[:M]))
print(ans)

"""
order=list(itertools.permutations(seq))
#print(ord)

for i in range(len(order)):
    for j in range(8):
        sor=[0]*3
        l=[0]*3
        for k in range(3):
            if (j>>k)&1:
                sor[k]=1
        for k in range(3):
            if sor[k]==0:
                if k!=2:
                    tributes=sorted(tributes,key=lambda x:x[order[i][k]])
                else:
                    tributes.sort(key=lambda x:x[order[i][k]])
            else:
                if k!=2:
                    tributes=sorted(tributes,key=lambda x:x[order[i][k]],reverse=True)
                else:
                    tributes.sort(key=lambda x:x[order[i][k]],reverse=True)
        for k in range(M):
            l[0] = l[0] + tributes[k][0]
            l[1] = l[1] + tributes[k][1]
            l[2] = l[2] + tributes[k][2]
        l=list(map(lambda x:abs(x),l))
        ans=max(ans,sum(l))
print(ans)

#2→1→0
tributes=sorted(tributes,key=lambda x:x[2])
tributes=sorted(tributes,key=lambda x:x[1])
tributes.sort(key=lambda x:x[0])
#print(tributes)
l=[0]*3
for i in range(M):
    l[0]=l[0]+tributes[i][0]
    l[1] = l[1] + tributes[i][1]
    l[2] = l[2] + tributes[i][2]
l=list(map(lambda x:abs(x),l))
ans=max(ans,sum(l))
"""



Measured memory_bytes: 74164
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  string s;
  cin >> n >> s;
  vector<int> sumb(n+1,0), sumw(n+1,0); 
  rep(i,n) { //累積和
    if (s[i] == '#') sumb[i+1]++;
    else sumw[i+1]++;
    sumb[i+1] += sumb[i];
    sumw[i+1] += sumw[i];
  }
  int ans = 1001001001;
  rep(i,n) { //0...iを白、i+1...n-1を黒にする
    int res = sumb[i+1] + (sumw[n] - sumw[i+1]);
    debug(i, sumb[i+1], sumw[n] - sumw[i+1]);
    chmin(ans, res);
  }
  int allblack = sumw[n]; //すべて黒にする場合
  chmin(ans, allblack);
  cout << ans << endl;
  return 0;
}

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

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

    if(n==1&&m==0){
        cout << 0 << endl;
        exit(0);
    }
    if(n==2&&m==0){
        cout << 10 << endl;
        exit(0);
    }
    if(n==3&&m==0){
        cout << 100 << endl;
        exit(0);
    }
    
    vector<char> ans(n+1,'x');
    int si;
    char ci;
    for (int i = 0; i < m; i++){
        cin >> si >> ci;
        if(ans[si]=='x' || ans[si]==ci){
            ans[si]=ci;
        }
        else{
            cout << -1 << endl;
            exit(0);
        }
    }
    if(n!=1&&ans[1]=='0'){
        cout << -1 << endl;
    }
    else{
        if(ans[1]=='x'){
            ans[1]='1';
        }
        for (int i = 1; i <= n; i++){
            if(ans[i]=='x'){
                ans[i]='0';
            }
            cout << ans[i];
        }
        cout << endl;
    }

}

Measured memory_bytes: 3624