akhauriyash/Code-Regression huggingface dataset:
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

class UnionFind {
public:
  std::vector<int> rank;
  std::vector<int> parent;
  std::vector<int> size_;
  using Iter = std::vector<int>::iterator;
  void init(int n) {
    parent.resize(n, 0); rank.resize(n, 0); size_.resize(n, 1);
    for (int i = 0; i < n; ++i)parent[i] = i;
  }
  int root(int n) {
    if (parent[n] == n)return n;
    else {
      parent[n] = root(parent[n]);
      return parent[n];
    }
  }
  void merge(int a, int b) {
    a = root(a);
    b = root(b);
    if (a == b)return;
    if (rank[a] < rank[b]) {
      parent[a] = b;
      size_[b] += size_[a];
    }
    else {
      parent[b] = a;
      if (rank[a] == rank[b])++rank[a];
      size_[a] += size_[b];
    }
  }
  int size(int n) {
    n = root(n);
    return size_[n];
  }
  bool is_same(int a, int b) {
    return root(a) == root(b);
  }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, M, K;
  cin >> N >> M >> K;
  UnionFind friends;
  vector<int> direct_fr(N, 0);
  friends.init(N);
  for (int i = 0; i < M; ++i) {
    int A, B;
    cin >> A >> B;
    --A; --B;
    ++direct_fr[A];
    ++direct_fr[B];
    friends.merge(A, B);
  }
  vector<int> ans(N);
  for (int i = 0; i < N; ++i)ans[i] = friends.size(i) - 1 - direct_fr[i];
  for (int i = 0; i < K; ++i) {
    int C, D;
    cin >> C >> D;
    --C; --D;
    if (friends.is_same(C, D))--ans[C], --ans[D];
  }
  for (const auto e : ans)cout << e << " ";
  cout << endl;
}


Measured memory_bytes: 2816
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(ll i = a; i < n; i++)

#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#include<cassert>
#include<stack>
#include<deque>
#include<list>
#include<sstream>
#include<unordered_map>
#include<time.h>
#include<functional>
#pragma comment(linker, "/STACK:8809999999")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef pair<ld, ld> pld;
typedef pair<ll, pll> pllp;
typedef pair<pll, ll> ppll;
typedef pair<pll, pll> ppp;
typedef vector<vector<vector<ll>>> vvv;
const ll mod = 1e9 + 7;
const ll atcmod = 998244353;
const ld eps = 1e-9;
const ll settled = 400007;


int main()
{
	ios_base::sync_with_stdio(false); cout.tie(NULL);
#ifndef overlord
	/*freopen("capitals.in", "r", stdin);
	freopen("capitals.out", "w", stdout);*/
#else
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll r, g, b, n;
	cin >> r >> g >> b >> n;
	vl dp(3001, 0);
	dp[0] = 1;

	forn(i, 0, n)
	{
		if (dp[i] == 0)
			continue;

		if (i + r <= 3000)
			dp[i + r] += dp[i];
	}

	forn(i, 0, n)
	{
		if (dp[i] == 0)
			continue;

		if (i + g <= 3000)
			dp[i + g] += dp[i];
	}

	forn(i, 0, n)
	{
		if (dp[i] == 0)
			continue;

		if (i + b <= 3000)
			dp[i + b] += dp[i];
	}

	cout << dp[n];
	return 0;
}

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

#define INF (int)1e9
#define vi vector<int>
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define pq priority_queue
#define qq queue
#define w(n) while(n--)
#define for0(i, n) for(i = 0; i < n; i++)
#define for1(i, n) for(i = 1; i <= n; i++)

#define MOD 1000000007
#define MAXN 1001
ll h, w, dp[MAXN][MAXN];
char camp[MAXN][MAXN];

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> h >> w;
    
    int i, j;
    for1(i, h) {
        for1(j, w) {
            cin >> camp[i][j];
        }
    }
    
    dp[1][1] = 1LL;
    for1(i, h) {
        for1(j, w) {
            if (camp[i][j] == '#') continue;
        
            if (camp[i-1][j] == '.') dp[i][j] += dp[i-1][j] % MOD;
            if (camp[i][j-1] == '.') dp[i][j] += dp[i][j-1] % MOD; 
        }
    }
    
    ll res = dp[h][w] % MOD;
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 12448
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll to, cost;
	bool operator<(const edge& right) const {
		return cost == right.cost ? to < right.to : cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

bool solv(ll x) {
	if ((x % 10 == (x / 10000) % 10) && ((x / 10) % 10 == (x / 1000) % 10)) return true;
	else return false;
}

int main() {
	ll a, b, ans = 0;
	cin >> a >> b;
	repi(i, a, b + 1) if (solv(i)) ans++;
	wrln(ans);
	return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<vector>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
template <typename T>
class UnionFind
{
public:
    vector<T> par;
    UnionFind(T n) : par(n, -1) {}
    void init(T n)
    {
        for (usize i = 0; i < n; i++)
        {
            par[i] = -1;
        }
    }

    i64 root(T x)
    {
        if (par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool same(T x, T y)
    {
        return root(x) == root(y);
    }

    bool merge(T x, T y)
    {
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    i64 size(T x)
    {
        return -par[root(x)];
    }
};
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n;
i64 q;
cin >> n >> q;
UnionFind uft(n);
rep(i,q){
    i64 t,u,v;
    cin >> t >> u >> v;
    if(t == 0){
        uft.merge(u,v);
    }else{
        if(uft.same(u,v))cout << 1 << endl;
        else cout << 0 << endl;
    }
}
}

Measured memory_bytes: 4716
'''
参考
https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0817_agc037
'''

S = input()

pre = ''
ans = 0
cnt = 0

while cnt < len(S):
    ch = S[cnt]
    if ch == pre:
        cnt += 1
        if cnt == len(S):
            break
        ch += S[cnt]
    pre = ch
    ans += 1
    cnt += 1

print(ans)


Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
typedef long long ll;
const int N=1e4+5;
int n,a[N],sum[N];
bool vis[N];
int pow(int a,int n)
{
    if(n>=9) return 1e9;
    int ans=1;
    for(int i=1;i<=n;i++) ans=ans*10;
    return ans;
}
bool check(int p)
{
    if(a[0]%p) return false;
    for(int i=0;i<=p-2;i++) sum[i]=0;
    for(int i=0;i<=n;i++) sum[i%(p-1)]=(sum[i%(p-1)]+a[i])%p;
    for(int i=0;i<=p-2;i++) if(sum[i]) return false;
    return true;
}
vector<int>v;
int main()
{
    scanf("%d",&n);
    int k=0;
    for(int i=n;i>=0;i--)
    {
        scanf("%d",&a[i]);
        k=__gcd(k,a[i]);
    }
    k=abs(k);
    for(int j=2;j*j<=k;j++)
        if(k%j==0)
    {
        v.push_back(j);
        while(k%j==0) k/=j;
    }
    if(k>1) v.push_back(k);
    for(int i=2;i<=n;i++)
        if(!vis[i])
    {
        if(check(i)) v.push_back(i);
        for(int j=i+i;j<=n;j+=i)
            vis[j]=true;
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
        if(i==v.size()-1||v[i]!=v[i+1])
    {
        printf("%d\n",v[i]);
    }
}


Measured memory_bytes: 384
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long ans = 0;
            for(int i = 1; i <= (int)Math.Sqrt(n)+1; i++)
            {
                for(int j = i; j <=n; j++)
                {
                    if (!(1<=n-i*j)) continue;
                    if (i == j) ans++;
                    else ans+=2;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 27496
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353LL;

using namespace std;
typedef long long ll;


using Tp = tuple<int, int, int>;
vector<Tp> update;
vector<vector<int>> dp;
vector<int> mx;
int allmax;
void st(int i, int j, int k) {
	update.emplace_back(i, j, k);
	update.emplace_back(j, i, k);
}

void upd() {
	for (auto [a, b, c] : update) {
		chmax(dp[a][b], c);
		chmax(mx[a], c);
		chmax(allmax, c);
	}
	update.clear();
}
int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int n; cin >> n;
	vector<int> a(n * 3); for (int i = 0; i < n * 3; i++) cin >> a[i], a[i]--;
	dp.assign(n, vector<int>(n, -1));
	mx.assign(n, -1);
	dp[a[0]][a[1]] = dp[a[1]][a[0]] = mx[a[0]] = mx[a[1]] = 0;
	int pl = 0;
	for (int i = 2; i + 2 < 3 * n; i += 3) {
		if (a[i] == a[i + 1] and a[i + 1] == a[i + 2]) {
			pl++;
			continue;
		}
		for (int kkt = 0; kkt < 3; kkt++) {
			vector<int> v;
			int r = a[i + kkt];
			for (int j = 0; j < 3; j++) if (j != kkt) v.emplace_back(a[i + j]); 
			st(v[0], v[1], allmax);
			if(dp[r][r] != -1) st(v[0], v[1], dp[r][r] + 1);
			if (v[0] == v[1]) {
				for (int j = 0; j < n; j++) if (dp[v[0]][j] != -1) st(r, j, dp[v[0]][j] + 1);
			}
			for (int j = 0; j < n; j++) st(r, j, mx[j]);
		}
		upd();
	}
	int res = 0; 
	for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
		if (i == j and i == a.back()) {
			chmax(res, dp[i][j] + 1);
		}
		else {
			chmax(res, dp[i][j]);
		}
	}
	res += pl;
	cout << res << endl;
}


Measured memory_bytes: 19480
a,b,v = map(int,input().split())
import math
s = v/a
if 2*s < a*b:
  sin = b/math.sqrt((b**2)+(4*(s**2)/(b**2)))
  print(math.degrees(math.asin(sin)))
elif 2*s == a*b:
  sin = b/math.sqrt((b**2)+(a**2))
  print(math.degrees(math.asin(sin)))
else:
  sin = 2*(a*b-s)/math.sqrt(((4*((a*b-s)**2))/(a**2))+(a**2))/a
  print(math.degrees(math.asin(sin)))
  

Measured memory_bytes: 3064
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    int dt[n];
    rep(i,n){
      cin>>dt[i];
    }
    int sum=0;
    sort(dt,dt+n);
    dt[0]=dt[n-1]=0;
    rep(i,n){
      sum+=dt[i];
    }
    cout<<sum/(n-2)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1172
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, ans = 1;
    cin>>n;
    ll a[n], i;
    for(i=0; i<n; i++) {
    	cin>>a[i];
    }
    ll m = a[0];
    for(i=1; i<n; i++) {
    	if(m >= a[i]) {
    		ans++;
    		m = a[i];
    	}
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 1792
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] cnt = new int[100000];
		for(int i = 0; i < 10010; i++) {
			cnt[i] = 0;
		}
		//System.out.println(Math.pow((double)n, 1.0/2.0));
		for(int i = 1; i < Math.pow((double)n, 1.0/2.0); i++) {
			for(int j = 1; j < Math.pow((double)n, 1.0/2.0); j++) {
				for(int k = 1; k < Math.pow((double)n, 1.0/2.0); k++) {
					if(i*i+j*j+k*k+i*j+j*k+k*i == 10000) {
						//System.out.println(i + " " + j + " " + k);
					}
					if(i == j && j == k) {
						cnt[i*i+j*j+k*k+i*j+j*k+k*i] += 1;
					}else if((i == j && j != k) || (j == k && k != i) || (k == i && i != j)) {
						cnt[i*i+j*j+k*k+i*j+j*k+k*i] += 1;
					}else if(i != j && j != k && k != i) {
						//System.out.println(i+ " " + j + " " + k +" " + i*i+j*j+k*k+i*j+j*k+k*i);
						cnt[i*i+j*j+k*k+i*j+j*k+k*i] += 1;
					}
				}
			}
		}
		for(int i = 1; i < n+1; i++) {
			System.out.println(cnt[i]);
		}
	}
}


Measured memory_bytes: 30244
#include <stdio.h>
#define swap(x, y) {int z; z=y; y=x; x=z;}
int main ()
{
	double r, pi = 3.14159265359;
	scanf("%lf", &r);
	printf("%.6lf %.6lf\n", r*r*pi, 2*r*pi);	
	return 0; 
} 


Measured memory_bytes: 2700
N, P = [int(i) for i in input().split()]
S = input()


def mod_pow(a, n, mod):
  res = 1
  while  n > 0:
    if n & 1:
      res = (res * a ) % mod
    a = a * a  % mod
    n = n >> 1
  return res

if P == 2 or P == 5:
#if False:
  count = 0
  for n in range(N):
    if int(S[n]) % P==0:
      count += (n + 1)
  print(count)
else:    
  Pa = [0 for _ in range(P)]
  number = 0
  for i in range(N, 0, -1):
    number = (number + int(S[i-1])*mod_pow(10, N - i, P)) % P
    Pa[number] += 1
  count = 0
  if Pa[0] > 0:
    count += Pa[0]
  for p in range( P):
    pmod = Pa[p]
    if pmod > 0:
      count += (pmod * (pmod - 1))//2
  print(count)
  


Measured memory_bytes: 3628
#include <stdio.h>
#include <string.h>
 
int main(void)
{
  int n;
  char s[364364], tmp[364364], res[364364];
  int i, j;
  int cnt, len;
 
  while (scanf("%d", &n), n){
    scanf("%s", s);
    for (i = 0; i < n; i++){
      cnt = 1;
      *res = '\0';
      len = strlen(s);
      for (j = 0; j < len; j++){
        if (s[j] == s[j + 1]){
          cnt++;
        }
        else {
          sprintf(tmp, "%d%c", cnt, s[j]);
          strcat(res, tmp);
          cnt = 1;
        }
      }
      strcpy(s, res);
    }
    printf("%s\n", s);
  }
 
  return (0);
}

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

#define ll long long
#define db double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ino freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);

#define fr(i,n) for(i=0;i<n;i++)
#define frs(i,a,n) for(i=a;i<n;i++)
#define frv(i,n) for(i=n-1;i>=0;i--)

#define ne cout<<"\n";
#define cas(i) cout<<"Case #"<<i<<": "

#define vpi vector <pair <int,int> >
#define vpin(v,a,b) v.push_back(make_pair(a,b))
#define vsort(v) sort(v.begin(),v.end());

#define todegree(rad) rad*(180.0/pi)
#define isnttriangle(a,b,c) (a+b<c||a+c<b||b+c<a)
#define pi acos(-1)
#define siz 200009

char a[siz],b[siz];
int main()
{
    cin>>a>>b;
    int i,num,cn;
    cn=0;
    num=strlen(a);
    for(i=0;i<num;i++)
    {
        if(a[i]!=b[i]) cn++;
    }
    cout<<cn<<"\n";
    return 0;
}




Measured memory_bytes: 3972
m, n = gets.split(" ").map(&:to_i)
sum = Array.new(n + 1, 0)

m.times do
  r = gets.split(" ").map(&:to_i)
  r.push(r.sum)
  for i in 0..n
    sum[i] += r[i]
  end
  puts r.join(" ")

end
puts sum.join(" ")



Measured memory_bytes: 7004
package main
import "fmt"

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	if (n % (2 * d + 1) == 0) {
		fmt.Printf("%d", n / (2 * d + 1))
	} else {
		fmt.Printf("%d", n / (2 * d + 1) + 1)
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <unordered_map>
#include <string>
#include <algorithm>

using namespace std;

using veci = vector<int>;
using pii = pair<int, int>;
using vecii = vector<pii>;
using ll = long long;
using vecl = vector<ll>;
#define fi first
#define se second
#define endl '\n'

void solve() {
    int n, m;
    cin >> n >> m;

    string s;
    cin >> s;

    vector<int> prev(n+1, -1);
    vector<int> dp(n+1, -1);
    dp[0] = 0;

    priority_queue<pii, vecii, greater<pii>> pq;
    pq.push({0,0});
    for (int i=1; i<=n; ++i) {
        while (!pq.empty() && i - pq.top().se > m) pq.pop();

        if (pq.empty()) {
            cout << -1 << endl;
            return;
        }
        if (s[i]=='0') {
            pii nearest = pq.top();
            dp[i] = nearest.fi + 1;
            prev[i] = nearest.se;
            pq.push({dp[i], i});
        }
    }

    if (dp[n]<0) {
        cout << -1 << endl;
        return;
    }

    stack<int> ans;
    int cur = n;
    while (prev[cur]>=0) {
        ans.push(cur-prev[cur]);
        cur = prev[cur];
    }
    while (!ans.empty()) {
        cout << ans.top() << " ";
        ans.pop();
    }
    cout << endl;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#if defined(LOCAL_TEST)
    (void)argc;
    freopen(string(argv[0]).append("-test.in").c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
    solve();
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
//#include<stdio.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fr(i, a, b) for(int i=a; i>=b; i--)
#define l long int
#define endl '\n'
#define pb push_back
#define pf pop.front()

using namespace std;
ll MOD=1e9+7;
int main()
{
FAST
l n , i,j;
cin>>n;
ll a[n],ans=0,sum=0,s=0;

for(i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
//s=a[0];
for(i=0;i<n-1;i++)
{
	s=a[i];
	sum-=s;
	ans=(ans+(a[i]%MOD)*(sum%MOD)%MOD)%MOD;

}
cout<<ans;
}








Measured memory_bytes: 5212
n1 = int(input())

s2 = input()

r4 = "Yes"
if n1 % 2 == 1:
    r4 = "No"
for i3 in range(n1 // 2):
    if s2[i3] != s2[i3 + (n1 // 2)]:
        r4 = "No"

print(r4)

Measured memory_bytes: 2940
# ABC084D - 2017-like Number
from bisect import bisect_left as bsl, bisect_right as bsr


def get_primes(n: int) -> list:
    # return a list of primes <= n
    sieve = [1] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def main():
    Q, *LR = map(int, open(0).read().split())
    P = get_primes(10 ** 5 + 1)
    S = set(P)
    selected_P = [p for p in P if (p + 1) // 2 in S]  # 2017-like primes
    # the number of 2017-like primes b/w l, r -> bisect[r] - bisect[l]
    ans = [bsr(selected_P, r) - bsl(selected_P, l) for l, r in zip(*[iter(LR)] * 2)]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()

Measured memory_bytes: 25076
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int firstIndex = S.indexOf("A");
		int lastIndex = S.lastIndexOf("Z");
		System.out.println(lastIndex-firstIndex+1);
		sc.close();
	}
}

Measured memory_bytes: 26644
#include <stdio.h>
int main(void)
{
	int a,b,d,r;
	double x,y,f;
	scanf("%d",&a);
	scanf("%d",&b);
	d=a/b;
	r=a%b;
	f=(double)a/b;
	printf("%d %d %f\n",d,r,f);
	return 0;
}



Measured memory_bytes: 2108
n = int(input())
total = n * (n+1) / 2
sum3 = sum(range(3, n+1, 3))
sum5 = sum(range(5, n+1, 5))
sum15 = sum(range(15, n+1, 15))
print(int(total - sum3 - sum5 + sum15))

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

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

    long long n, d, x, y, ans = 0; cin>>n>>d;
    d *= d;

    for(int i = 0; i<n; i++){
        cin>>x>>y;
        x = x*x + y*y;
        if(x<=d) ans++;
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>
int main (){
	char kata[10001];
	int angka;
	scanf ("%d", &angka);
	scanf ("%s", &kata);
	int panjang = strlen(kata);
	for(int i=0;i<panjang;i++){
		if(kata[i]+angka>'Z'){
			kata[i]=kata[i]-(26-angka);
		}else{
			kata[i]+=angka;
		}
	}
	printf ("%s", kata);
}


Measured memory_bytes: 1744
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;


int main() {
    int n; cin >> n;
    for(int i = 0; i < 10; i++) {
        if(n <= i * 111){
            cout << i * 111 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)


const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
vector<ll>adj[200001];
vec order;
ll n,q;
// vec size(8,0);
// ll les=1;

// void dfstree(ll s)
// {

//     visit[s]=true;
//     size[s]=1;
//     order.pb(s);
//     for(auto u:adj[s])
//     {
//         if(visit[u])
//         {
//             continue;
//         }
//         dfstree(u);
//         size[s]+=size[u];

//     }
// }
// struct fenwicktree
// {
//     ll n;
//     vector<ll>bit;
//     fenwicktree(ll n)
//     {
//         this->n=n+1;
//         bit.assign(n+1,0);
//     }
//     void add(ll idx, ll val) {
//     for (idx; idx < n; idx += idx & -idx)
//         bit[idx] += val;
//     }

//     void range_add(ll l, ll r,ll val) {
//         add(l, val);
//         add(r + 1, -val);   
//     }

//     ll point_query(ll idx) {
//         ll ret = 0;
//         for (idx; idx > 0; idx -= idx & -idx)
//             ret += bit[idx];
//         return ret;
//     }


// };
ll xx,val,result[200001+1];

ll dist[500001];

queue<ll>q1;

void bfs(ll x)
{
  
  bool visits[500001]={false}; 
  visits[x]=true;

  q1.push(x);
  while(!q1.empty())
  {
      ll s=q1.front();
      q1.pop(); 
      for(auto u : adj[s])
      {
        if(visits[u])
          continue;
        visits[u]=true;
        q1.push(u);
        result[u]+=result[s];
      }

  }
}






int main() 
{

    fast();
      
  

        cin>>n>>q;
        ll i,x,y;
        f(i,0,n-1)
        {
         cin>>x>>y;
         adj[x].pb(y);
         adj[y].pb(x);  
    
        }
        f(i,0,q)
        {
            cin>>xx>>val;
            result[xx]+=val;
      
        }
        bfs(1);

        f(i,1,n+1)
        {
          
            cout<<result[i]<<" ";
           
        }
        


        
  

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Measured memory_bytes: 20336
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func nextFloat64() float64 {
	return float64(nextInt())
}

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

	a, b, x := nextFloat64(), nextFloat64(), nextFloat64()

	ans := 0.0
	if x < a*a*b/2 {
		ans = 90 - (math.Atan(2.0*x/(a*b*b)) * 180.0 / math.Pi)
	} else {
		ans = math.Atan((a*a*b-x)*2/a/a/a) * 180.0 / math.Pi
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define minv(a) *min_element(all(a))
#define maxv(a) *max_element(all(a))
#define br cout<<"\n"
using namespace std;
int dr[]={1,-1,0,0};
int dc[]={0,0,1,-1};
ll mod=1000000007;
ll po(ll x,ll n){
    ll res = 1;
    while(n>0){
        if(n%2==1)
            res = ((res)*(x));
        x = (x*x);
        n = n/2;
    }
    return res;
}
ll ceil(ll x,ll y)
{
    if(x%y==0)
        return x/y;
    else
        return(x/y)+1;
}
ll reverse(ll num)
{
     ll n, reversedNumber = 0, remainder;
     n=num;
    while(n != 0)
    {
        remainder = n%10;
        reversedNumber = reversedNumber*10 + remainder;
        n /= 10;
    }
    return reversedNumber;
}

int main(){
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char a;
    cin>>a;
    if(a-65<26){cout<<"A";}
    else cout<<"a";
    return 0;
}


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

typedef long long ll;
typedef int64_t i6;
typedef std::vector<std::vector<int64_t> > Graph;

#define rep(i, n) for (int64_t i = 0; i < n; ++i)
#define rep2(i, n) for (int64_t i = 1; i <= n; ++i)
#define repb(i, l, n) for (int64_t i = l; i < n; ++i)
#define repb2(i, l, n) for (int64_t i = l; i <= n; ++i)
#define repe(a, b) for (auto&(a) : (b))
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))
#define mp(a, b) make_pair((a), (b))
#define Push_back(a, b) push_back( mp( (a), (b) ) )

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;  }
template<typename V,typename T> bool find_num(V v, T num) { if ( find(ALL(v), num) == v.end() ) { return false; } return true; }

const int inf = 0x3fffffff;
const int64_t INF = 0x3fffffffffffffff;
const int64_t MOD = 1e9+7;

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

    std::vector<int64_t> v(2000);
    rep(i, n) {
        if ( i < 5 ) {
            v[i] = 1;
        } else {
            v[i] = (v[i-1]+v[i-3])%MOD;
        }
    }
    int64_t ans = v[n-1];
    if ( n < 3 ) {
        ans = 0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.io.*;
import java.util.*;
class Main{
    public static void main(String args[]) throws IOException{

	int a=0;
	int b=0;
	int c=0;
	int i=0;
	int tmp=0;

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String str = br.readLine();
	String delimiter = " ";
        StringTokenizer stringTokenizer = new StringTokenizer( str, delimiter );
	while(stringTokenizer.hasMoreTokens())
	{
            String current = stringTokenizer.nextToken();
	    if(i==0)a=Integer.parseInt(current);
	    if(i==1)b=Integer.parseInt(current);
	    if(i==2)c=Integer.parseInt(current);
	    i++;
	}
	if(a>c){
	    tmp=a;
	    a=c;
	    c=tmp;
	}
	if(a>b){
	    tmp=a;
	    a=b;
	    b=tmp;
	}
	if(b>c){
	    tmp=b;
	    b=c;
	    c=tmp;
	}
        System.out.println(a+" "+b+" "+c);
    }
}

Measured memory_bytes: 16932
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

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

int p, q, a, n;

int solve(int d, int numer, int denom, int m) {
	int c = 0;
	for(int i=d; i*denom<=a; i++) {
		int n1 = p * i * denom;
		int n2 = numer * i + denom;
		if(n1 < n2 * q) { continue; }
		if(n1 == n2 * q) { c++; continue; }
		if(m == 1) { continue; }
		c += solve(i, n2, denom * i, m-1);
	}
	return c;
}

int main() {
	while(cin>>p>>q>>a>>n, p|q|a|n) {
		cout << solve(1, 0, 1, n) << endl; 
	}
}

Measured memory_bytes: 1160
#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>;

const ll INF=1e8;
const ll MOD=1e9+7;

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

    cout << a * b << endl;

    return 0;
}

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

using namespace std;
#define int long long
#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()
using ll = long long;
using lint = long long;
typedef pair<int,int> P;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  string s;cin>>s;
  int n=s.length();
  int a=0;int ab=0;int abc=0;int cnt=1;
  rep(i,n){
      if(s[i]=='A'){
          a+=cnt;a%=MOD;
      }
      else if(s[i]=='B'){
          ab+=a;ab%=MOD;
      }
      else if(s[i]=='C'){
          abc+=ab;abc%=MOD;
      }
      else{
          int hoge[3]={a,ab,abc};
          abc*=3;abc%=MOD;
          ab*=3;ab%=MOD;
          a*=3;a%=MOD;
          abc+=hoge[1];abc%=MOD;
          ab+=hoge[0];ab%=MOD;
          a+=cnt;a%=MOD;
          cnt*=3;cnt%=MOD;
      }
  }
  cout<<abc<<"\n";
  return 0;
}

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

int main(){
    string a,b;
    cin>>a>>b;
    if(a.length()>b.length()){
        cout<<"GREATER";
        return 0;
    }else if(a.length()<b.length()){
        cout<<"LESS";
        return 0;
    }else{
        for(int i=0;i<a.length();i++){
            if((int)a[i]>(int)b[i]){
                cout<<"GREATER";
                return 0;
            }else if((int)a[i]<(int)b[i]){
                cout<<"LESS";
                return 0;
            }
        }
        cout<<"EQUAL";
        return 0;
    }
}

Measured memory_bytes: 256
n = gets.to_i
x = []
n.times do
  com, key = gets.split
  key = key.to_i
  case com
  when 'insert' then x.unshift key
  when 'delete'
    i = x.index(key)
    x.delete_at(i) unless i.nil?
  when 'deleteFirst' then x.shift
  when 'deleteLast' then x.pop
  end
end
puts x.join(' ')



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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

const ll MOD = 1e9 + 7;
struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint& operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}
  mint& operator-=(const mint a) {if ((x += MOD-a.x) >= MOD) x -= MOD;return *this;}
  mint& operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}
  mint operator+(const mint a) const {mint res(*this);return res+=a;}
  mint operator-(const mint a) const {mint res(*this);return res-=a;}
  mint operator*(const mint a) const {mint res(*this);return res*=a;}
  mint pow(ll b) const {
    mint res(1), a(*this);
    while (b) {
      if (b & 1) res *= a;
      a *= a;
      b >>= 1;
    }
    return res;
  }
  // for prime MOD
  mint inv() const {return pow(MOD-2);}
  mint& operator/=(const mint a) {return (*this) *= a.inv();}
  mint operator/(const mint a) const {mint res(*this);return res/=a;}
};
ostream& operator<<(ostream& os, const mint& a) {os << a.x; return os;}


mint dp[55][55][55 * 55];

int main2() {

  REP(i, 55) REP(j, 55) REP(k, 55*55) dp[i][j][k] = 0;

  int N = nextLong();
  int K = nextLong();

  dp[0][0][0] = 1;
  for (int n = 0; n <= N; n++) {
    for (int a = 0; a <= N; a++) {
      for (int k = 0; k <= N*N; k++) {
        mint cur = dp[n][a][k];
        if (cur.x == 0) continue;
        // if (N <= 10) cout << "dp[" << n << "]["  << a << "][" << k << "] = " << cur << endl;
        dp[n+1][a][k+2*a] += cur;
        dp[n+1][a][k+2*a] += mint(2)*mint(a)*cur;
        if (a > 0) dp[n+1][a-1][k+2*(a-1)] += mint(a)*mint(a)*cur;
        dp[n+1][a+1][k+2*(a+1)] += cur;
      }
    }
  }

  mint ans = dp[N][0][K];
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

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

	int A,B,C,K;
	int i,k;
	int ans=0;
	int ctr=0;

	cin >> A >> B >> C >> K;

	while(A>=B){
		B*=2;
		K--;
	}

	while(B>=C){
		C*=2;
		K--;
	}
	
	if(K>=0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}



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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int n, x, t;
    cin >> n >> x >> t;
    if (n % x == 0) {
        cout << (n / x) * t << endl;
        return 0;
    }
    else cout << ((n / x) + 1) * t << endl;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){

    int n;
    cin >> n;
    string s;
    cin >> s;

    int mx = 0;
    for (int div = 1; div < n-1; ++div) {

        char x[div];
        rep(i, div) {
            x[i] = s[i];
        }
        char y[n-div];
        rep(i, n-div) {
            y[i] = s[div+i];
        }

        bool flag[26];
        rep(i, 26) flag[i] = false;
        rep(i, div) {
            rep(j, n-div) {
                if (x[i] == y[j]) flag[x[i]-'a'] = true;
            }
        }

        int tmp = 0;
        rep(i,26) {
            if (flag[i]) ++tmp;
        }

        mx = max(tmp, mx);
    }


    cout << mx << endl;
    




}



//              g++ -std=c++1z


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    int a,b; cin >> a >> b;
    int ans;
    rep(i,30){
        if((1 + a * i - i) >= b){ans = i;break;}
    }
    cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int comp(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return (*(int*)a<*(int*)b)-(*(int*)a>*(int*)b);}

#define putchar(c) putc_unlocked((c), stdout);
uint32_t nextpint(void){ char c=getc_unlocked(stdin); while(c<'0'||'9'<c) c=getc_unlocked(stdin); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getc_unlocked(stdin); } return x; }
uint64_t nextplong(void){ char c=getc_unlocked(stdin); while(c<'0'||'9'<c) c=getc_unlocked(stdin); uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getc_unlocked(stdin); } return x; }
uint32_t nextstr(char *s){ char c=getc_unlocked(stdin); while(c==' '||c=='\n') c=getc_unlocked(stdin); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getc_unlocked(stdin); } *s='\0'; return len; }
uint32_t nextstrln(char *s){ char c=getc_unlocked(stdin); while(c==' '||c=='\n') c=getc_unlocked(stdin); uint32_t len=0; while(c!='\n'){ *s++=c; len++; c=getc_unlocked(stdin); } *s='\0'; return len; }

void printint(int x){ if(x<0){x=-x; putc_unlocked('-', stdout);}else if(x==0){putc_unlocked('0', stdout);} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putc_unlocked(s[i], stdout); }
void printlong(long x){ if(x<0){x=-x; putc_unlocked('-', stdout);}else if(x==0){putc_unlocked('0', stdout);} int d=0; char s[20]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putc_unlocked(s[i], stdout); }

inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}
inline int abs2(const int a){return a>=0?a:-a;}

char s[200001];
int l[200001];
int r[200001];
int main(void){
	int n=nextpint();
	int k=nextpint();
	int c=nextpint();
	nextstr(s);
	int h=0, hp=-1;
	for(int i=0; i<n; i++){
		if(s[i]=='o'){
			if(i>hp){
				h++;
				l[h]=i;
				hp=i+c;
			}
		}
	}
	h=0, hp=n;
	for(int i=n-1; i>=0; i--){
		if(s[i]=='o'){
			if(i<hp){
				h++;
				r[h]=i;
				hp=i-c;
			}
		}
	}
	for(int i=max2(1,k-h+1); i<=min2(h,k); i++){
		//printf("%d %d\n", l[i], r[k-i+1]);
		if(l[i]==r[k-i+1]){
			printf("%d\n", l[i]+1);
		}
	}
}


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;

typedef unsigned long long ull;
const ull p=1000000007;
const int SIZE=1000000;
ull H[SIZE+1],power[SIZE+1];
char S[SIZE+1],T[SIZE+1];

signed main(){
    scanf("%s%s",S,T);
    int ls=strlen(S),lt=strlen(T);
    power[0]=1;
    for(int i=1;i<=ls;i++){
        power[i]=power[i-1]*p;
        H[i]=H[i-1]*p+S[i-1];
    }

    ull ht=0;
    rep(i,lt)ht=ht*p+T[i];

    for(int i=lt;i<=ls;i++){
        ull hs=H[i]-H[i-lt]*power[lt];
        if(hs==ht)printf("%d\n",i-lt);
    }
    return 0;
}



Measured memory_bytes: 19820
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;int K;cin>>K;
  for(int i=0;i<S.length();i++){
    if(S[i]=='a')continue;
    int a=26-(S[i]-97);
    if(a<=K){S[i]='a';K-=a;}
  }
  S[S.length()-1]=(S[S.length()-1]-97+K)%26+97;
  cout<<S;
}

Measured memory_bytes: 512
import copy
from operator import itemgetter
M =int(input())
S1 =[]
P1 =[]
for i in range(M):
    N,P = input().split()
    P = [N,int(P),i]
    P1 += [P]
b = sorted(P1, key=itemgetter(1),reverse = True)
b = sorted(b, key=itemgetter(0))
for i in range(M):
	print(b[i][2]+1)

Measured memory_bytes: 38384
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

ans = 0
prev = -1
for i in range(N):
    a = a_list[i]
    b = b_list[a-1]
    if i != N-1:

        if a_list[i+1] == a+1:
            c = c_list[a-1]
            #print(c)
            ans +=c
    prev = a
    ans += b

    #print(prev)
print(ans)


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

int main() {
  int N;
  int ans;
  ans = 100;
  cin >> N;
  
  for (int i=0;i<N;i++){
    int a;
    int tmp=0;
   	cin >>  a;
    
    while (a%2==0){
      a /= 2;
      tmp +=1;
    }
    
    if(ans>tmp){
      ans = tmp;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		a = sc.nextInt();
		b = sc.nextInt();
		sc.close();
		int ans = 0;

		for (int i = 1; i <= b - a; i++) {
			ans += i;
		}
		System.out.println(ans - b);
	}
}


Measured memory_bytes: 21844
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	list := make([]int, 26)
	for _, c := range s {
		list[c-97]++
	}
	for i := 0; i < 26; i++ {
		if list[i] == 0 {
			fmt.Println(string(i + 97))
			return
		}
	}
	fmt.Println("None")

}


Measured memory_bytes: 2468
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;
 
#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
 
#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	//ios::sync_with_stdio(false);
	ll N;
	string s;
	while(cin>>N>>s) {
		string t(s);
		ll cost=0;
		RANGE(i, 1, N) {
			if(s[i]=='E') {
				t[i]='W';
				cost++;
			}
		}
//		DD(s);
//		DD(t);
//		DD(cost);
		ll ans = cost;
		RANGE(i, 1, N) {
			if(s[i-1]=='W' && s[i-1]==t[i-1]) {
				cost++;
				t[i-1]='E';
			}
			if(s[i]!=t[i]) {
				cost--;
				t[i] = s[i];
			}
			ll lans = cost;
//			DD(i);
//			DD(cost);
//			DD(lans);
//			DD(t);
			ans = min(ans, lans);
		}
		cout<<ans<<endl;
	}
	return 0;
}


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

int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(NULL);
	long long int n,x,ans=0;
	cin >> n ;
  
  	map<long long int, long long int> m;
	for(int i=0;i<n;i++)
    {
      cin>>x;
      m[x]++;
    }
  
  	for(auto i:m)
      if(i.second<i.first)
        ans+=i.second;
  	else if(i.second>i.first)
      ans+=(i.second-i.first);
  
  	cout<<ans;
        
	return 0;
}


Measured memory_bytes: 9640
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	int H, W, K;
	cin >> H >> W >> K;
	/*
	縦棒がW本ある。W-1個のあるなしで全探索。って
	*/

	//左付きで棒があるかないか
	vector<vector<bool>> BF;
	vector<int> BF_num;
	for (int s = 0; s < (1 << (W-1)); ++s) {
		int ter = s;
		vector<bool> res(W - 1);
		int cnt = 0;
		for (int i = 0; i < W-1; ++i) {
			if (ter & 1) {
				res[i] = true;
				cnt++;
			}
			else {
				res[i] = false;
			}
			ter /= 2;
		}
		bool flag = true;
		for (int i = 0; i < W - 1 - 1; ++i) {
			if (res[i] == true && res[i + 1] == true) {
				flag = false;
				break;
			}
		}
		if (flag == true) {
			BF.push_back(res);
			BF_num.push_back(cnt);
		}
	}

	/*
	H+1 * W * (K+1)個必要
	*/
	//高さと位置のみ
	vector<vector<LL>> dp(H + 1,vector<LL>(W, 0));
	dp[0][0] = 1;
	int BF_len = BF.size();
	for (int h = 0; h < H; ++h) {//上から順に
		//dp[h]->dp[h+1]
		for (int s = 0; s < BF_len; ++s) {//全ての横棒で
			vector<bool> B = BF[s];
			
			for (int w = 0; w < W; ++w) {
				//dp[h][k]
				if (w+1 <W && B[w] == true) {//右へ
					dp[h + 1][w + 1] += dp[h][w];
					dp[h + 1][w + 1] %= MOD;
				}
				else if (w - 1 >= 0 && B[w - 1] == true) {//左
					dp[h + 1][w - 1] += dp[h][w];
					dp[h + 1][w - 1] %= MOD;
				}
				else{//真下へ
					dp[h + 1][w] += dp[h][w];
					dp[h + 1][w] %= MOD;
				}
			}
		}
	}
	//[H][K-1]
	LL ans = dp[H][K-1];
	
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256