akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

/**
 *
 * @author ena000078
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long cards[] = new long[N+1];
        
        cards[0] = 0;
        for (int i=1;i<=N;i++){
            cards[i] = cards[i-1] + sc.nextLong();
        }
        
        long minn = Math.abs(cards[N] - 2*cards[1]);
        for(int i=2;i<N;i++){
            minn = Math.min(minn, Math.abs(cards[N]-2*cards[i]));
        }

        System.out.println(minn);
    }
}


Measured memory_bytes: 65444
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s << "[";
    for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i];
    s << "]";
    return s;
}

#define ALL(a) (a).begin(), (a).end()

int main() {
    string N;
    cin >> N;
    if (N[0] == N[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
function main(input) {
  // 入力値（文字列）を改行で区切る
  const inputList = input.split(/\n/);
  const oneLine = inputList[0];
  const twoLine = inputList[1];
  
  // はねた回数と指定値
  const oneLineInfo = oneLine.split(/\s/);
  const numOfJump = oneLineInfo[0];
  const value = formatNum(oneLineInfo[1]);

  // 
  const twoLineInfo = twoLine.split(/\s/);
  const lengthList = twoLineInfo.map(tl => formatNum(tl));
  lengthList.unshift(0);
  
  var count = 0;
  var result = 0;
  
  for (var i = 0; i < lengthList.length; i++) {
    result += lengthList[i];
    if (result <= value) {
      count++;
    }
  }
  console.log(count);
};

// 文字列を数値に変換
function formatNum(str) {
  return Number(str);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<stdio.h>

int main(){
  double x1, y1, x2, y2, xp, yp, xq, yq, xr, yr;
  double a1, b1, a2, b2;
  char c1, c2, c3, c4, c5;

  while(scanf("%lf %c %lf %c %lf %c %lf %c %lf %c %lf", &x1, &c1, &y1, &c2, &x2, &c3, &y2, &c4, &xq, &c5, &yq) != EOF){
    if(x1 == x2){
      xr = xq + 2*(x1 - xq);
      yr = yq;
    }else if(y1 == y2){
      xr = xq;
      yr = yq + 2*(y1 - yq);
    }else{
      a1 = (y1 - y2)/(x1 - x2);
      b1 = y1 - a1*x1;
      a2 = -1/a1;
      b2 = yq - a2*xq;

      xp = (b2 - b1)/(a1 - a2);
      yp = a1*xp + b1;
      xr = xq + 2*(xp - xq);
      yr = yq + 2*(yp - yq);

    }

    printf("%0.6f %0.6f\n", xr, yr);
  }

  return 0;
}

Measured memory_bytes: 0
N = int(input())
A=list(map(int,input().split()))
ans=1
flag=0

for i in range(N):
    if(A[i]==0):
        flag=1

if flag==0:        
    if(N%2==0):
        for i in range(int(N/2)):
            ans *= (A[i]*A[N-1-i])
            if(ans>1000000000000000000):
              break
    else:
        for i in range(int(N/2)):
            ans *= A[i]*A[N-1-i]
            if(ans>1000000000000000000):
                break
        ans*=A[int((N-1)/2)]

if flag==1:
    print(0)
elif(ans>1000000000000000000):
    print(-1)
else:
    print(ans)
    




Measured memory_bytes: 21880
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100005
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
const int mod=1000000007;
vector<int> cir[N];
int n,ans=1,cnt,a[N],d[N],sy[N],fl[N],sum[N],f[N];
int vis[N];
int main()
{
	re(n);
	for(int i=1;i<=n;++i)
		re(a[i]),++d[a[i]];
	for(int i=1;i<=n;++i)
		if(!d[i])
		{
			static int st[N];
			int top=0,now=i;
			while(!vis[now])
			{
				st[++top]=now;
				vis[now]=i;
				now=a[now];
			}
			if(sy[now])
			{
				if(fl[now])return puts("0"),0;
				fl[now]=top;
			}
			else if(vis[now]!=i)return puts("0"),0;
			else
			{
				++cnt;
				while(st[top]!=now)
				{
					cir[cnt].push_back(st[top]);
					sy[st[top]]=cnt;
					--top;
				}
				--top;
				cir[cnt].push_back(now);
				sy[now]=cnt;
				fl[now]=top;
			}
		}
	for(int i=1;i<=n;++i)
		if(!vis[i])
		{
			int now=i,len=0;
			do
			{
				++len;
				vis[now]=1;
				now=a[now];
			}
			while(now!=i);
			++sum[len];
		}
	// LOG(ans);
	for(int i=1;i<=n;++i)
	{
		f[0]=1;
		for(int j=1;j<=sum[i];++j)
		{
			f[j]=f[j-1];
			if((i&1) && i>1)f[j]=(f[j]+f[j-1])%mod;
			if(j>=2)f[j]=(f[j]+(j-1ll)*i%mod*f[j-2])%mod;
		}
		ans=1ll*ans*f[sum[i]]%mod;
		// LOG(ans);
	}
	// LOG(ans);
	// LOG(cnt);
	for(int i=1;i<=cnt;++i)
	{
		// for(int j:cir[i])cerr<<fl[j]<<" ";
		// cerr<<endl;
		reverse(cir[i].begin(),cir[i].end());
		int last=0;
		for(int j=1;j<cir[i].size();++j)if(fl[cir[i][j]])
		{
			if(j-last>fl[cir[i][j]])ans=ans*2%mod;
			else if(j-last<fl[cir[i][j]])return puts("0"),0;
			last=j;
		}
		// LOG(ans);
		if(cir[i].size()-last>fl[cir[i][0]])ans=ans*2%mod;
		else if(cir[i].size()-last<fl[cir[i][0]])return puts("0"),0;
	}
	printf("%d\n",ans);
}
/*
1 2
2 1
3 4
4 3
5 6
6 7
7 5
8 9
9 10
10 8
11 8
12 9
13 11
*/


Measured memory_bytes: 5244
#include<iostream>
typedef long long ll ;
using namespace std ;
ll gcd(ll a,ll b)
{
    if(b==0){return a;}
    return gcd(b,a%b);
}
int main()
{
    ll a,b,x,y,ans;
    cin >> a >> b ;
    x=max(a,b);
    y=min(a,b);
    ll g = gcd(x,y);
    ans=a*b;
    ans=(ll)ans/g;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import math
s = input()

while len(s) > 0:
    if s.endswith("dream"):
        s = s[:len(s) - 5]
    elif s.endswith("dreamer"):
        s = s[:len(s) - 7]
    elif s.endswith("erase"):
        s = s[:len(s) - 5]
    elif s.endswith("eraser"):
        s = s[:len(s) - 6]
    else:
        print("NO")
        exit()
print("YES")

Measured memory_bytes: 9212
import java.util.Scanner;

public class Main{
		
	public static void main(String args[]){
		  
	    Scanner sc = new Scanner(System.in);
	    
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    int h = sc.nextInt();
	    
	    System.out.println((a+b)*h/2);
	    
	}
	
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    long long N,M; cin >> N >> M;
    if(N>=2 && M >= 2) cout<< (N-2)*(M-2) << endl;
    else if(N==1 && M >= 2) cout << M-2 << endl;
    else if(M==1 && N >= 2) cout << N-2 << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    int n; std::cin >> n;
    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i] >> b[i];
    }
    int max = *std::max_element(b.begin(), b.end());
    auto uf = [&](int targ) {
        int lo = 0, hi = max + 1;
        while (hi - lo > 1) {
            int mid = lo + (hi - lo) / 2;
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                cnt += b[i] >= mid;
            }
            if (cnt >= targ) lo = mid;
            else hi = mid;
        }
        return lo;
    };
    auto df = [&](int targ) {
        int lo = 0, hi = max + 1;
        while (hi - lo > 1) {
            int mid = lo + (hi - lo) / 2;
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                cnt += a[i] <= mid;
            }
            if (cnt >= targ) hi = mid;
            else lo = mid;
        }
        return hi;
    };
    if (n & 1) {
        std::cout << uf((n + 1) / 2) - df((n + 1) / 2) + 1 << std::endl;
    }
    else {
        int u1 = uf(n / 2 + 1), u2 = uf(n / 2);
        int d1 = df(n / 2), d2 = df(n / 2 + 1);
        std::cout << u1 + u2 - d1 - d2 + 1 << std::endl;
    }
    return 0;
}


Measured memory_bytes: 4844
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>

using namespace std;
typedef long long ll;
ll n, m, h, w;
ll x[505], y[505];
ll mp[505][505];
int mx, my; ll mc = 0;
ll sum;
int main(){
	scanf("%d%d%d%d", &n, &m, &h, &w);
	for(int i = h; i <= n; i += h){
		for(int j = w; j <= m; j += w){
			mp[i][j] = -(h * w - 1) * 500ll - 1ll;
		}
	}
	for(int i = 1; i <= n; i ++){
		for(int j = 1; j <= m; j ++){
			mp[i][j] = (mp[i][j] == 0 ? 500ll : mp[i][j]);
		}
	}
	sum = 0;
	for(int i = 1; i <= n; i ++){
		for(int j = 1; j <= m; j ++){
			sum += mp[i][j];
		}
	}
	if(sum <= 0){
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	for(int i = 1; i <= n; i ++){
		for(int j = 1; j <= m; j ++){
			printf("%lld ", mp[i][j]);
		}
		printf("\n");
	}
	return 0;
} 

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    int n,m;
    int err=0;
    set<int> data;
    cin>>n>>m;
    string x;
    int k;
    map<int,int> wa;
    while(m--){
        cin>>k>>x;
        if(x=="AC") data.insert(k);
        else {
            if(!data.count(k)){
                wa[k]++;
            }
        }
    }
    for(int x : data){
        err+= wa[x];
    }
    cout<<data.size()<<" "<<err<<"\n";
}

Measured memory_bytes: 9600
n = int(input())
a = list(map(int, input().split()))

snuke = 0
bear = sum(a)
ans = float('inf')

for i in range(n-1):
    snuke += a[i]
    bear -= a[i]
    if abs(snuke - bear) < ans:
        ans = abs(snuke - bear)

print(ans)

Measured memory_bytes: 100320
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  vll a(n);

  for(auto &it : a) {cin >> it;} 
  ll res = inf;
  for(ll tot = 1; tot <= 100; tot++) {
  ll ans = 0;
  for(auto it: a) {
  	ans+= (tot - it)*(tot - it);
  }
  res = min(res, ans);
 }
  cout << res << endl;
  return 0;
} //good night.

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)
vector<int> s;
int main() {
	int n, ma = 0, ans = 0;
	cin >> n;
	REP(i, n) {
		int a;
		cin >> a;
		ma = max(ma, a);
		s.push_back(a);
	}
	s.push_back(0);
	REPO(i, ma) {
		REP(j, s.size() - 1) {
			if (s[j] >= i and s[j + 1] < i)ans++;
		}
	}
	cout << ans << endl;
}

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

void insert(int _value);
void delete(int _value);
void deleteFirst(void);
void deleteLast(void);

struct Node{

  struct Node* next;
  struct Node* prev;
  int value;

};

struct Node* head;
struct Node* tail;
main(){

  int i;
  int n;
  int tmpValue;
  char str[20];
  struct Node* node;

  head = (struct Node*)malloc(sizeof(struct Node));
  tail = (struct Node*)malloc(sizeof(struct Node));
  head->next = tail;
  head->prev = NULL;
  tail->next=NULL;
  tail->prev=head;
  head->value = 0;
  tail->value=0;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%s",str);
    if(!strcmp(str,"insert")){
      scanf("%d",&tmpValue);
      insert(tmpValue);
    }else if(!strcmp(str,"deleteFirst")){
      deleteFirst();
    }else if(!strcmp(str,"deleteLast")){
      deleteLast();
    }else if(!strcmp(str,"delete")){
      scanf("%d",&tmpValue);
      delete(tmpValue);
    }
  }

  for(node=head->next; node != tail; node=node->next){
    printf("%d",node->value);
    if(node->next!=tail){
      printf(" ");
    }
  }
  printf("\n");

  return 0;

}

void insert(int _value){

  struct Node* newNode;
  struct Node* tmpNode;

  newNode = (struct Node*)malloc(sizeof(struct Node));

  tmpNode = head->next;
  if(tmpNode != NULL){
    tmpNode->prev = newNode;
  }
  head->next = newNode;
  newNode->next = tmpNode;
  newNode->prev = head;

  newNode->value = _value;

}

void delete(int _value){

  struct Node* node;
  struct Node* tmpNode;
  for(node=head->next; node != NULL; node=node->next){
    if(node->value == _value){
      tmpNode = node->prev;
      if(tmpNode != NULL){
	tmpNode->next = node->next;
      }
      if(node->next != NULL){
	node->next->prev = tmpNode;
      }
      break;
    }
  }

}

void deleteFirst(){

  struct Node* node;
  node=head->next;

  if(head != NULL){
    head->next= node->next;
  }
  if(node->next != NULL){
    node->next->prev = head;
  }
  //free(node);

}

void deleteLast(){

  struct Node* tmpNode;

  tmpNode=tail->prev;
  tail->prev=tmpNode->prev;
  tmpNode->prev->next=tail;

  //free(tmpNode);

}

Measured memory_bytes: 17000
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  v(double) p(N);
  rep(i,N) {
    cin >> p[i];
  }
  
  v(double) dp(N+1,0.0);
  dp[0] = 1.0;
  rep(i,N) {
    v(double) dp2(N+1,0.0);
    dp2[0] = dp[0] * (1.0-p[i]);
    srep(j,1,N+1) {
      dp2[j] = dp[j] * (1.0-p[i]) + dp[j-1] * p[i]; 
    }
    dp = dp2;
  }
  double ans = 0;
  rep(i,N+1) {
    if(i >= N-i) {
      ans += dp[i];
    }
  }
  cout << setprecision(16) <<  ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll H,W,A,B; cin >> H >> W >> A >> B;
  FOR(i,1,H+1) FOR(j,1,W+1){
    if(i<=B && j<=A || i>B && j>A) 
      cout << 1;
    else
      cout << 0;
    
    if(j==W) cout << "\n";
  }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,i,j,a,b,c,k,d;
    double f;
    cin>>n>>d;
    c=0;
    while(n--)
    {
        cin>>a>>b;
        k=(a*a+b*b);
        f=ceil(sqrt(k*1.0));
        if((ll)(f)<=d)c++;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3592
/*
* じょえチャンネル
* 高評価・チャンネル登録よろしくおねがいします！
* https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
*/

#include <bits/stdc++.h>


#define f(i,n) for(int i=0;i<(n);i++)


#define inf (int)(3e18)
#define int long long
#define mod (int)(1000000007)

#define intt long long
#define P pair<int,int>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)

using namespace std;

//Library
//モッドパウ
int modpow(int x, int y, int m = mod) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
            res %= m;
        }
        x = x * x % mod;
        y /= 2;
    }
    return res;
}

int mypow(int x, int y) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
        }
        x = x * x;
        y /= 2;
    }
    return res;
}
//is the number (x) a prime number?
bool prime(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (!(x % i)) {
            return false;
        }
    }
    return true;
}


//saidai-kouyakusuu
inline int gcd(int x, int y) {
    if (!y) {
        return x;
    }
    return gcd(y, x % y);
}


//number of keta
int keta(int x) {
    int ans = 0;
    while (x) {
        x /= 10;
        ans++;
    }
    return ans;
}

//sum of keta
int ketasum(int x) {
    int ans = 0;
    while (x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

inline int lcm(int x, int y) {
    int ans = x / gcd(x, y) * y;
    return ans;
}
int twobeki(int x) {
    int ans = 0;
    while (1) {
        if (!(x & 1)) {
            ans++;
            x /= 2;
        }
        else {
            break;
        }
    }
    return ans;
}


template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
    if (lhs < rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
    if (lhs > rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
void Yes(){
    cout<<"Yes"<<endl;
}
void No(){
    cout<<"No"<<endl;
}
void YES(){
    cout<<"YES"<<endl;
}
void NO(){
    cout<<"NO"<<endl;
}


#define fin(i) scanf("%lld",&i)
#define fout(i) printf("%lld",i)
#define fendl printf("\n")
//Library-End

int n,a[100004],ans,b,c;
string s;
signed main() {
    cin>>n>>s;
    for(int i=1;i<n;i++){
        bool cn1[34]={0},cn2[34]={0};
        rep(j,i){
            cn1[s[j]-'a']=1;
//            cout<<s[j]-'a'<<endl;
        }
        for(int j=i;j<n;j++){
            cn2[s[j]-'a']=1;
//            cout<<s[j]-'a'<<endl;
        }
        int cnt=0;
        rep(j,30){
            if(cn1[j]&&cn2[j])cnt++;
        }
        chmax(ans, cnt);
//        cout<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<stack>
#include<queue>
#include<ctype.h>
#include<math.h>
#include<map>
#include<time.h>
using namespace std;
const int N=1e6;
int isprime[N];
int prefixsum[N];
int SQRT=ceil(sqrt((double)N));		//返回大于或者等于指定表达式的最小整数 
int prime()
{
	memset(isprime,1,sizeof(isprime));
	int i;
	isprime[0]=isprime[1]=0;
	for(i=0;i<=SQRT;i++)
	{
		if(isprime[i])
		{
			for(int j=i*i;j<=N;j+=i)
			{
				isprime[j]=0;
			}
		}
	}
}
void maketable()
{
	for(int i=1;i<N;i++)
	{
		prefixsum[i]=isprime[i]?prefixsum[i-1]+1:prefixsum[i-1];
	}
} 
int main()
{
	prime();
	maketable();
//	printf("%.2f\n",(double)clock()/CLOCKS_PER_SEC);
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		printf("%d\n",prefixsum[n]);
	}
	return 0;
}


Measured memory_bytes: 11044
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var count = cin.ReadInt;

            var kingaku = cin.ReadInt;

            bool fla = false;
            var k10000 = 0;
            var k5000 = 0;
            var k1000 = 0;

            for (int x = 0; x <= count; x ++)
            {

                for (int y = 0; y <= count - x; y++)
                {
                    if (10000 * x + 5000 * y + 1000 * (count - x - y) == kingaku)
                    {
                        fla = true;

                        k10000 = x;
                        k5000 = y;
                        k1000 = count - x - y;
                        break;
                    }


                }

                if (fla == true)
                {
                    break;
                }
            }

            if (fla == false)
            {
                k10000 = -1;
                k5000 = -1;
                k1000 = -1;
            }

            WriteLine(k10000.ToString() + " " + k5000.ToString() + " "  + k1000.ToString());


        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}



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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

signed main() {
  ll N; cin >> N;
  ll ans = 1;
  bool ansm1 = false;
  bool anszero = false;
  rep(i, N) {
    ll A;
    cin >> A;
    if((double)ans * (double)A > 1e18){
      ansm1 = true;
    }
    ans *= A;
    if (ans > (ll)1e18) {
      ansm1 = true;
    }
    if(A == 0){
      anszero = true;
    }
  }
  if(ansm1) ans = -1;
  if(anszero) ans = 0;
  cout << ans <<endl;
}

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


int main(void){
    int x[4];
    int y[4];
    rep(i,2){
        int a,b;
        cin >> a >> b;
        x[i] = a;
        y[i] = b;
    }
    int a= x[1]-x[0];
    int b= y[1]-y[0];
    x[2] = x[1]-b;
    y[2] = y[1]+a;
    x[3] = x[2]-a;
    y[3] = y[2]-b;
    
    
    cout << x[2] << " "<<y[2] <<" "<<x[3] <<" "<<y[3]<<endl;
    
    
    return 0;
}











































Measured memory_bytes: 256
def main():
    ans = 0
    x = int(input())
    for i in range(-118,120):
        for j in range(-118, 120):
            if i**5 - j**5 == x:
                ans = [i,j]
                break 
    print(ans[0], ans[1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 9156
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res=res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int n,ans=0,a,b,a1,a2,a3;
	cin >> n;
	vector<int>vec1(n);
	vector<int>vec2(n);
	vector<int>vec3(n);
	vecin(vec1);
	vecin(vec2);
	vecin(vec3);
	sort(all(vec1));
	sort(all(vec2));
	sort(all(vec3));
	rep(i, n) {
		if (vec1[0] >= vec2[i]) {
			continue;
		}
		if (vec1.back() < vec2[i]) {
			a = n;
			goto skip;
		}
		a1 = 0;
		a2 = n - 1;
		while (a1 + 1 < a2) {
			a3 = (a1 + a2) / 2;
			if (vec1[a3] >= vec2[i]) {
				a2 = a3;
			}
			else {
				a1 = a3;
			}
		}
		a = a2;
	skip:
		if (vec3[0] > vec2[i]) {
			b = n;
			goto skip2;
		}
		if (vec3.back() <= vec2[i]) {
			continue;
		}
		a1 = 0;
		a2 = n - 1;
		while (a1 + 1 < a2) {
			a3 = (a1 + a2) / 2;
			if (vec3[a3] <= vec2[i]) {
				a1 = a3;
			}
			else {
				a2 = a3;
			}
		}
		b = n - a1-1;
	skip2:
		ans += a * b;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	a := nextInts(n)

	l, r := make([]int, n), make([]int, n)
	for i := 1; i < n; i++ {
		l[i] = l[i-1] ^ a[i-1]
	}
	for i := n - 2; i >= 0; i-- {
		r[i] = r[i+1] ^ a[i+1]
	}

	b := make([]int, n)
	for i := 0; i < n; i++ {
		if i == 0 {
			b[i] = r[i]
		} else if i == n-1 {
			b[i] = l[i]
		} else {
			b[i] = l[i] ^ r[i]
		}
	}

	for i := 0; i < n-1; i++ {
		putf("%d ", b[i])
	}
	puts(b[n-1])
}


Measured memory_bytes: 10616
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream cin("in.txt");
#endif
  int N;
  string S;
  while (cin >> N >> S) {
    vector<int> dp(2, N + 1);
    dp[0] = 0;
    for (char c : S) {
      int d = c == '.' ? 0 : 1;
      vector<int> ndp(2, N + 1);
      for (int pd = 0; pd < 2; pd++) {
        for (int nd = 0; nd < 2; nd++) {
          if (pd == 1 && nd == 0) continue;
          chmin(ndp[nd], dp[pd] + (nd != d));
        }
      }
      dp = ndp;
    }
    cout << min(dp[0], dp[1]) << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int main(){
  double a,b,x;
  cin>>a>>b>>x;
  double s=x/a;
  double deg=0;
  if(s>=a*b/2){
    double h=2*(a*b-s)/a;
    deg=atan2(h,a);
  }
  else{
    double w=2*s/b;
    deg=atan2(b,w);
  }
  double ans=deg/acos(-1)*180;
  cout<<fixed<<setprecision(10)<<ans<<endl;
  return 0;                       
}

Measured memory_bytes: 4156
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define EPB emplace_back
#define MP make_pair
#define d(x) cerr << #x << ":" << x << endl;
#define da(x) cerr << #x << endl; for (auto a : x) cerr << a << " "; cerr << endl;
const int MOD = 1000000007;


int main() {
	fastio();
	string s, t;
	cin >> s >> t;
	int n = s.length();
	int c = 0;
	for(int i=0;i<n;i++) {
		if(s[i] != t[i])
			c++;
	}
	cout << c << "\n";
	return 0;
}



Measured memory_bytes: 3740
/*Anup Ghosh*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi acos(-1)
#define ull unsigned long long
#define nl printf("\n")
#define MAXN 1000005
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sp(n)  fixed<<setprecision(n)
int main()
{
	fio();

		double n,d,x,y;int c=0;
		cin>>n>>d;
		double i;
		for(i=0;i<n;i++)
		{
			cin>>x>>y;
			double z;
			z=(x*x)+(y*y);
			if(sqrt(z)<=d)
			c++;
		}

	cout<<c;
	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    if (2 * k > n + 1) {
        return cout << -1, 0;
    } else {
        vector<pair<int, int>> ve;
        for (int i = 0; i < n; i++) {
            if (i < (n + 1) / 2) {
                ve.push_back({k + i, k + 2 * n - 1 - 2 * i});
            } else {
                ve.push_back({k + i, k + 2 * n - 2 - 2 * (i - (n + 1) / 2)});
            }
        }
        sort(ve.begin(), ve.end(), [](const pair<int, int> &u, const pair<int, int> &v) {
            return u.first + u.second < v.first + v.second;
        });
        for (int i = 0; i < n; i++) {
            cout << ve[i].first << " " << ve[i].second << " " << k + 2 * n + i << '\n';
        }
    }
}


Measured memory_bytes: 3188
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
int main(){
  ll a,b,n;cin>>a>>b>>n;
  ll x=min(b-1,n);
  cout<<a*x/b<<endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(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 powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
//__builtin_popcountll()

int vis[500005];
vector<int>g[500005];

void edge()
{
    int u,v;
    cin>>u>>v;
    g[v].pb(u);
    g[u].pb(v);

}

void dfs(int s)
{
	vis[s]=1;
	for(int i=0;i<g[s].size();i++)
	{
		if(vis[g[s][i]])
		continue;

	        dfs(g[s][i]);
	}
}


int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int n,m,i,j;
    	cin>>n>>m;
    	mem(vis,0);
    	for(i=0;i<m;i++)
    	{
    		edge();
		}
		int ans=0;
		for(i=1;i<=n;i++)
		{
			if(vis[i]==0)
			{
				dfs(i);
				ans++;
			}
		}
		cout<<ans-1;

    }

}

Measured memory_bytes: 20940
s = input()
n = len(s)
ok = True
for i in range(0, n, 2):
	if s[i] == "L":
		ok = False
for i in range(1, n, 2):
	if s[i] == "R":
		ok = False
if ok:
	print("Yes")
else:
	print("No")

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  char a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  if(a == f && b == e && c == d)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
/* 2_2
 * cy_an  */

#include <stdio.h>

int main(void){
    int n,w;
    scanf("%d", &n);          // Nの入力
    scanf("%d", &w);          // 白色に塗るマスの入力
    printf("%d\n",n * n - w); // 結果の表示

    return 0;
}

Measured memory_bytes: 128
<?php
while(fscanf(STDIN, "%d", $n)){
    fscanf(STDIN, "%d", $m);

    $t = range(1, $n);

    while($m-- > 0){
        fscanf(STDIN, "%d,%d", $a, $b);
        $a--;
        $b--;
        list($t[$a], $t[$b]) = array($t[$b], $t[$a]);
    }

    for($i = 0; $i < $n; $i++){
        echo $t[$i] . "\n";
    }
}

Measured memory_bytes: 6608
s = list(input().rstrip())
n=len(s)+1
from_left = [0]*n
from_right = [0]*n
ans=0
i=0
for i,ss in enumerate(s,1):
    if ss == '>':
        from_left[i] = 0
    else:
        from_left[i] = from_left[i-1]+1
for i,ss in enumerate(s[::-1]):
    i = n-2-i
    if ss == '<':
        from_right[i] = 0
    else:
        from_right[i] = from_right[i+1]+1
seq = [x if x>y else y for x,y in zip(from_left,from_right)]
answer = sum(seq)
print(answer)


Measured memory_bytes: 38508
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;

int main(){

    int n;
    cin >> n;

    int tmp = n;
    int sum = 0;
    for(int i=0;i<8;i++){
        sum += tmp%10;
        tmp /= 10;
    }
    if( n%sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;


   return 0;
}

Measured memory_bytes: 256
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))

ans = 0
i = 0
while x > 0:

    # 足りる時
    if a[i] <= x:
        # last で不一致
        if a[i] != x and i == N - 1:
            break
        else:
            x -= a[i]
            ans += 1
    # 足りない時
    else:
        break

    # indexの調整
    if i < N-1:
        i += 1
    else:
        break

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 2e5+5;

char s[sz];
int l[sz], r[sz];

int main()
{
    int n, k, c;
    cin >> n >> k >> c;
    scanf("%s", s);

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

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

    for(int i=0, j=0; i<n; i++) {
        if(s[i]=='o') {
            if(j + r[i+1] < k) cout << i+1 << endl;
        }
        j=l[i];
    }
}


Measured memory_bytes: 3200
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;

string hash[9999999] = {};

int h1(int key, int m) {
    return key % m;
}
int h2(int key, int m) {
    return 1 + (key % (m - 1));
}
int h(int key, int i, int m) {
    return (h1(key, m) + i * h2(key, m)) % m;
}

int getChar(char ch) {
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T') return 4;
    else return 0;
}

long long getKey(string str) {
    long long sum = 0, p = 1;
    int size = str.size();
    for (int i = 0; i < size; i++) {
        sum += p * getChar(str[i]);
        p *= 5;
    }

    return sum;
}
        
int main() {
    int count;
    bool b[1000000];

    cin >> count;
    for (int i = 0; i < count; i++) {
        string command, value;
        cin >> command >> value;

        long long key = getKey(value);
        if (command == "insert") {
            int j = 0;
            while (true) {
                int k = h(key, j, 9999999);
                if ((hash[k] == value) || (hash[k].size() == 0)) {
                    hash[k] = value;
                    break;
                }
       //cout << "hai " << j << " " << k << " " << hash[k] << endl;

                j++;
            }
        }
        else {
            int j = 0;
            while (true) {
                int k = h(key, j, 9999999);
                if (hash[k] == value) {
                    printf("yes\n");
                    break;
                } else if (hash[k].size() == 0 || k >= count) {
                    printf("no\n");
                    break;
                }
                j++;
            }
        }
    }
}

Measured memory_bytes: 95388
'use strict'
function main(input) {
  input = input.trim().split('\n').map(r => r.split(' ').map(v => Number(v)))
  const NM = input.shift()
  input = input.sort((a, b) => a[0] - b[0])
  let count = NM[1]
  let pay = 0
  for (let i = 0; i < NM[0]; i++) {
    if (count >= input[i][1]) {
      count -= input[i][1]
      pay += input[i][1] * input[i][0]
    } else {
      pay += count * input[i][0]
      break
    }
  }
  console.log(pay);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 52340
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define rint register int
#define INF ((1 << 30) - 1)
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Pair pair < int, int >
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i, k, j) for(rint i = (k); i >= (j); i--)
#define For(i, k, j) for(rint i = (k); i <= (j); i++)
#define Foe(i, u) for(rint i = lst[u], v = e[i].v; i; i = e[i].nxt, v = e[i].v)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
#define int long long
int P = 998244353; //
using namespace std;
inline void ckmax(int &a, int b) {a = max(a, b);}
inline void ckmin(ll &a, ll b) {a = min(a, b);}
inline void mulmod(int &a, int b) {a = 1ll * a * b % P;}
inline void addmod(int &a, int b) {int t = a + b; a = (t >= P ? t - P : t); }
inline int ksm(int a, int b) {int ans=1; for(;b;b>>=1) {if(b&1) ans=1ll*ans*a%P;a=1ll*a*a%P;}return ans;}
inline int inv(int a) {return ksm(a, P-2);}
namespace FastIO {
    const int SIZE=1<<16; char buf[SIZE], obuf[SIZE], str[64]; int bi=SIZE, bn=SIZE, opt;
    int read(char *s) {
        while (bn) {for (;bi<bn&&buf[bi]<=' ';bi++);if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}
        int sn=0;while (bn) {for (;bi<bn&&buf[bi]>' ';bi++) s[sn++]=buf[bi];if (bi<bn) break; bn=fread(buf,1,SIZE,stdin),bi=0;}s[sn]=0;return sn;
    }
    bool read(int& x) {if(x)x=0;int bf=0,n=read(str); if(!n)return 0; int i=0; if (str[i]=='-') bf=1,i=1; for(x=0;i<n;i++) x=x*10+str[i]-'0'; if(bf) x=-x; return 1;}
    void write(int x) {
        if(!x) obuf[opt++] = '0'; else {if(x<0) obuf[opt++]='-',x=-x;int sn=0; while(x)str[sn++]=x%10+'0',x/=10;for (int i=sn-1;i>=0;i--) obuf[opt++]=str[i];}
        if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}
    }
    void write(char x) {obuf[opt++]=x;if (opt>=(SIZE>>1)){fwrite(obuf, 1, opt, stdout); opt=0;}}
    void Fflush() { if (opt) fwrite(obuf, 1, opt, stdout); opt=0;}
}
const int MAXN = 2e5 + 5;
int n, x, a[MAXN], lst[MAXN];
signed main()
{
	#ifndef ONLINE_JUDGE
		file("pro");
	#endif
	cin >> n >> x >> P;
	if(n <= P) {
		int res = x;
		For(i, 2, n) {
			x = 1ll * x * x % P; res += x;
		}
		cout<< res <<endl;
	} else {
		a[1] = x % P; lst[x] = 1;
		int st = 0, len = 0, res = 0, t = 0, f = 0;
		For(i, 2, 2 * P) {
			a[i] = 1ll * a[i-1] * a[i-1] % P;
//			cerr << a[i] <<' ' << a[i-1] << endl;
			if(!lst[a[i]]) lst[a[i]] = i;
			else {
				if(f) continue;
				f = 1;
				st = lst[a[i]], len = i - lst[a[i]]; 
				For(j, lst[a[i]] + 1, i) t += a[j];
			}
		}
//		cerr << st <<' ' <<len<< ' ' << t <<endl;
//		For(i, 1, 2 * P) cerr << a[i] << ' ';
//		cerr << endl;
		For(i, 1, st) res += a[i];
		res += ((n - st) / len) * t;
		foR(i, n, n - (n - st) % len + 1) {
//			cerr << i << endl;
			res += a[st + ((i - st) % len)];
		}
		cout << res <<endl;
	}
	
    return FastIO::Fflush(), 0;
}
/*

*/



Measured memory_bytes: 5980
#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 pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const ll MOD = 1e9+7;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5; 
const double PI = 3.141592653589793;


template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>; 
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m   
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; } 

lf dp[3000][3000];
lf p[3000];

int main(){
    sync
    int n;

    cin>>n;
    FOI(i,1,n){
        cin>>p[i];
    }
    dp[0][0] = 1;
    FOI(i,1,n){
        dp[i][0] = (1-p[i])*dp[i-1][0];
        FOI(j,1, i){
            dp[i][j] = p[i]*dp[i-1][j-1] + (1-p[i])*dp[i-1][j];
        }
    }
    int mid = n/2 + 1;
    lf ans = 0;
    FOI(i,mid,n){
        ans = ans + dp[n][i];
    }
    printf("%.10Lf", ans);
}



Measured memory_bytes: 139136
#include <bits/stdc++.h>
using namespace std;
int n;
int a[105],c[105];
int dia;
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++){scanf("%d",&a[i]);c[a[i]]++;}
    sort(a+1,a+n+1);
    dia=a[n];
    for (int i=dia;i>=(dia+1)/2;i--){
//        cout<<c[i]<<endl;
        if (dia&1 && c[i]<2 || !(dia&1) && i==(dia+1)/2 && c[i]<1 || !(dia&1) && i!=(dia+1)/2 && c[i]<2){printf("Impossible");return 0;}
        c[i]-=2;
    }
    if (!(dia&1))c[(dia+1)/2]++;
    for (int i=1;i<=n;i++){
        //cout<<i<<" "<<c[i]<<" ";
        if (c[i]){
            if (!(dia&1) && i<=dia/2 || dia&1 && i<=(dia+1)/2){printf("Impossible");return 0;}
        }
    }
//    cout<<endl;
    printf("Possible");
    return 0;
}


Measured memory_bytes: 256