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

#define ll long long
#define mod 1000000007

using namespace std;



int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a=20000000;
    string s;
    cin>>s;
    for(int i=0;i<s.size()-3+1;i++){
        ll b=stoi(s.substr(i,3));
        a=min(a,abs(b-753));
    }
    cout<<a;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll C[200005], cnt[200005], ans[200005];
vvc<ll> G;
ll N;

ll dfs(ll now, ll p){
    ll sum = 1, nowcnt, precnt;
    nowcnt = precnt = cnt[C[now]];
    repa(to,G[now]){
        if (to == p) continue;
        ll dval = dfs(to, now);
        sum += dval;
        
        ll vcnt = dval - cnt[C[now]] + nowcnt;
        nowcnt = cnt[C[now]];
        ans[C[now]] -= vcnt * (vcnt + 1) / 2;

    }
    cnt[C[now]] = sum + precnt;
    
    if(now==0){
        rep(i, N) ans[i] -= (N - cnt[i]) * (N - cnt[i] + 1) / 2;
    }
    return sum;
}

int main() {
    init();
    cin >> N;
    G.resize(N);
    rep(i, N) cin >> C[i], C[i]--;
    rep(i,N-1){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        G[a].eb(b), G[b].eb(a);
    }
    fill(ans, ans + N, N * (N + 1) / 2);

    dfs(0, -1);

    rep(i, N) cout << ans[i] << '\n';
}

Measured memory_bytes: 37488
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

string words[] = {"eraser", "erase", "dreamer", "dream"};
int dp[100001];
string s;
int n;

int f(int i) {
    if (i == n) return 1;
    int &r = dp[i];
    if (r != -1) return r;
    r = 0;
    for (auto &p : words) {
        int m = p.size();
        if (s.substr(i, m) == p) {
            r = f(i+m);
            if (r) break;
        }
    }
    return r;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    cin >> s;
    n = s.size();
    memset(dp, -1, sizeof(dp));
    if (f(0)) cout << "YES\n";
    else cout << "NO\n";
}


Measured memory_bytes: 2768
import math
N = int(input())
X = []
Y = []
for i in range(N):
    x,y = map(int,input().split())
    X.append(x)
    Y.append(y)
    
length = []
for i in range(N-1):
    for j in range(i+1, N):
        tmp = math.sqrt((X[i] - X[j])**2 + (Y[i] - Y[j])**2)
        length.append(tmp)
path = 0
for i in range(N):
  path += i
res = 0
for i in range(path):
  res += length[i]
fac = math.factorial(N)
total = fac * (N-1) /path
res *= total
res /= fac
print(res)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
using namespace std;

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

const int MOD = 1e9 + 7;
double EPS = 1e-10;

int f(int H, int W, int y, int x) {
	if (y == 0) return x;
	if (x == W) return W + y;
	if (y == H) return W + H + (W - x);
	if (x == 0) return W + H + W + (H - y);
	return -1;
}

bool check(vector<int> a) {
	int N = a.size();
	if (!N) return true;
	int i0;
	for (i0 = 0; i0 < N && a[i0] != a[(i0 + 1) % N]; i0++);
	if (i0 == N) return false;
	stack<int> st;
	for (int i = 0; i < N - 2; i++) {
		int x = a[(i0 + 2 + i) % N];
		if (!st.empty() && st.top() == x) st.pop();
		else st.push(x);
	}
	return st.empty();
}

int main() {
	int H, W, N; cin >> W >> H >> N;
	vector<i_i> v;
	rep(i, N) {
		int y1, x1, y2, x2;
		cin >> x1 >> y1 >> x2 >> y2;
		int z1 = f(H, W, y1, x1);
		int z2 = f(H, W, y2, x2);
		if (z1 != -1 && z2 != -1) {
			v.pb(i_i(z1, i));
			v.pb(i_i(z2, i));
		}
	}
	sort(v.begin(), v.end());
	vector<int> a;
	for (i_i p: v) a.pb(p.second);
	cout << (check(a) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3824
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		StringBuffer s=new StringBuffer();
		s.append(sc.next());
		String str=s.reverse().toString();
		str=str.replaceAll("resare","");
		str=str.replaceAll("esare","");
		str=str.replaceAll("remaerd","");
		str=str.replaceAll("maerd","");
		
		if(str.equals(""))System.out.println("YES");
		else System.out.println("NO");
	}

}


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

const string no="No",yes="Yes";

int main(){
  int T; cin>>T;
  rep(i,T){
    ll A,B,C,D; cin>>A>>B>>C>>D;
    if(A<B) cout<<no<<endl;
    else if(B==D){
      ll t=abs(A-C)/B+((A-C)%B==0?0:1);
      if(A-B*t>=0) cout<<yes<<endl;
      else cout<<no<<endl;
    }else if(B>D) cout<<no<<endl;
    else if(B<=C) cout<<yes<<endl;
    else{
      ll g=__gcd(B,D);
      if(B-g+(A%g)<=C) cout<<yes<<endl;
      else cout<<no<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
pair <int, int> p[200100];
int n[200100], d[200100];
int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) cin >> p[i].first >> p[i].second;
    sort (p, p + N);
    d[N] = 1;
    for (int i = N - 1; i >= 0; i--) {
        int c = i + 1;
        while (c < N && p[c].first < p[i].first + p[i].second) c = n[c];
        d[i] = (d[i+1] + d[n[i] = c]) % 998244353;
    }
    cout << d[0] << "\n";
}

Measured memory_bytes: 3456
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>
#include <numeric>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 1000000007

int main() {
	int x, y, z;
	cin >> x >> y >> z;
	VI v;
	v.PB(abs(x - y) + abs(y - z));
	v.PB(abs(x - z) + abs(y - z));
	v.PB(abs(y - x) + abs(x - z));
	v.PB(abs(y - z) + abs(x - z));
	v.PB(abs(z - x) + abs(x - y));
	v.PB(abs(z - y) + abs(x - y));
	sort(ALL(v));
	cout << v[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum = 0;
  int i = 0;
  while ( i < N ) {
    int a,b;
    cin >> a >> b;
    sum = sum + b - a + 1;
    i++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f(i,l,r) for(int i=l;i<=r;i++)
#define debug(x) cout<<#x<<'='<<(x)<<endl
using namespace std;
template<class T> bool maxs(T& a,T& b)
{
    if(a<b)
    {
        T t;
        t=a;
        a=b;
        b=t;
        return true;
    }
    return false;
}
template<class T> bool maxi(T& a,T b)
{
    if(a<b)
    {
        a=b;
        return true;
    }
    return false;
}
template<class T> bool mini(T& a,T b)
{
    if(a>b)
    {
        a=b;
        return true;
    }
    return false;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    ll dp[s.size()+1][t.size()+1];
    f(i,0,s.size())     f(j,0,t.size())     dp[i][j]=0;

    f(i,1,s.size())
    {
        f(j,1,t.size())
        {
            if(s[i-1]==t[j-1])  
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
            
        }
    }
    string ans="";
    int l=s.size(),r=t.size();
    while(l>0&&r>0)
    {
        if(s[l-1]==t[r-1])
        {
            ans+=s[l-1];
            l--;
            r--;
        }
        else if(dp[l][r-1]>dp[l-1][r])
            r--;
        else
        {
            l--;
        }
    }
    for(int i=ans.size()-1;i>=0;i--)
        cout<<ans[i];
    
    return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 long long INF = 1LL << 60;

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

  int cnt = 0;
  rep(i, s.size()-1){
    if(s[i] != s[i+1]) cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 512
#include<iostream>
 #define ll long long 
using namespace std;
int main()
{
 
	ll t;
	ll i,j=100,n,m=100;
     cin>>n;
      ll cnt=0;
     while(m<n)
     {
     	m=m*1.01;
     	//cout<<m<<endl;
     	 
     	cnt++;
     	if(m==n)
     	{
     		cout<<cnt<<endl;
     		return 0;
		 }
     	
     	
     	
	 }
	 
	 cout<<cnt<<endl;
	 
	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define int long long

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

  int h, w;
  cin >> h >> w;

  set<pair<int, int>> p;
  multiset<int> val;

  for (int i = 1; i <= w; ++i) {
    p.insert({i, i});
    val.insert(0);
  }

  for (int i = 1; i <= h; ++i) {
    int a, b;
    cin >> a >> b;

    auto l = p.lower_bound({a, 0});
    auto r = p.upper_bound({b, w+5});
  
    int end = b+1, start = -1;
    if (b+1 > w) end = 1e15;
    
    while (l != r) {
      int s = (*l).first, f = (*l).second;
      l = p.erase(l);
      val.erase(val.find(s-f));
      start = max(start, f);
    }
  
    if (~start) {
      val.insert(end-start);
      p.insert({end, start});
    }
    
    int ans = *val.begin();
    if (ans > 1e11) ans = -1;
    else ans += i;
    cout << ans << '\n';
  }
}


Measured memory_bytes: 25480
#include<iostream>
#include<algorithm>
#define F 1145141919810
using namespace std;

long long dp[110][110];
int n,m,s,f,g;

long long Min(long long a,long long b){
	if(a>b)return b;
	return a;
}

void FW(){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			dp[i][j]=F;
			if(i==j)dp[i][j]=0;
		}
	}
	int a,b,c;
	for(int i=0;i<m;i++){
		cin>>a>>b>>c;
		dp[a-1][b-1]=c;
	}
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				dp[i][j]=Min(dp[i][j],dp[i][k]+dp[k][j]);
			}
		}
	}
}

int main(){
	while(cin>>n>>m>>s>>f>>g&&n){
	s--,f--,g--;
	FW();
	long long ans=F;
	for(int i=0;i<n;i++){
		ans=Min(ans,dp[s][i]+dp[i][f]+dp[i][g]);
	}
	cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3080
#include<stdio.h>
#define it register int
#define ct const int
#define il inline
#define P 1000000007
const int N=1000005;
int n,m,k,h[N],nxt[N],adj[N],s[N],u,v,t,top,dfn[N],low[N],ti,szp[N],sze[N],fac[N],ifac[N],inv[N],o[N],tot,o1,o2,o3,d;
il void add(){nxt[++t]=h[u],h[u]=t,adj[t]=v,nxt[++t]=h[v],h[v]=t,adj[t]=u;}
il int ksm(it x,it L){it ans=1;while(L) L&1?ans=(0ll+ans)*x%P:0,x=(0ll+x)*x%P,L>>=1;return ans;}
il int Min(ct p,ct q){return p<q?p:q;}
il int C(ct n,ct m){return (0ll+fac[n])*ifac[m]%P*ifac[n-m]%P;}
il void gcd(ct a,ct b){return !b?d=a,void():gcd(b,a%b);}
il void scc(ct x,ct fa){
	dfn[x]=low[x]=++ti;
	for(it i=h[x],j;i;i=nxt[i])
		if((j=adj[i])^fa){
			if(!dfn[j]){
				s[++top]=j,s[++top]=x,scc(j,x),low[x]=Min(low[x],low[j]);
				if(dfn[x]<=low[j]){
					++tot;it u,v;
					do{
						u=s[top--],v=s[top--],++sze[tot];
						if(o[u]^tot) o[u]=tot,++szp[tot];
						if(o[v]^tot) o[v]=tot,++szp[tot];
					}while(((u!=x)||(v!=j))&&top);
				}
			}
			else if(dfn[j]<dfn[x]) s[++top]=j,s[++top]=x,low[x]=Min(low[x],dfn[j]); 
		}
}
int main(){
	scanf("%d%d%d",&n,&m,&k);it i,j,now;ct lim=m+k;
	fac[0]=ifac[0]=inv[0]=fac[1]=ifac[1]=inv[1]=1;
	for(i=2;i<=lim;++i) fac[i]=(0ll+fac[i-1])*i%P,inv[i]=(0ll+inv[P%i])*(P-P/i)%P,ifac[i]=(0ll+ifac[i-1])*inv[i]%P;
	for(i=1;i<=m;++i) scanf("%d%d",&u,&v),add();
	for(i=1;i<=n;++i) if(!dfn[i]) scc(i,0);
	o1=o2=o3=1;
	for(i=1;i<=tot;++i)
		if(sze[i]==1) o1=(0ll+o1)*k%P;//树 
		else{ 
			if(sze[i]==szp[i]){//仙人掌 
				now=0;
				for(j=1;j<=sze[i];++j) gcd(j,sze[i]),now+=ksm(k,d),now=(now>=P?now-P:now);
				o2=(0ll+o2)*now%P*ksm(sze[i],P-2)%P;
			} 
			else o3=(0ll+o3)*C(sze[i]+k-1,k-1)%P;
		}
	printf("%d",(0ll+o1)*o2%P*o3%P);
	return 0;
}


Measured memory_bytes: 22656
package main

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

func main() {
	scan := bufio.NewScanner(os.Stdin)
	scan.Scan()
	scan.Scan()
	var in []int
	for _, i := range strings.Split(scan.Text(), " ") {
		v, _ := strconv.Atoi(i)
		in = append(in, v)
	}

	selectionSort(in)

	trace(in)
	fmt.Println(count)
}

func selectionSort(in []int) {
	for i := 0; i < len(in); i++ {
		var min int = i
		for j := i + 1; j < len(in); j++ {
			if in[j] < in[min] {
				min = j
			}
		}
		if min != i {
			swap(in, i, min)
		}
	}
}

var count int
func swap(in []int, a, b int) {
	t := in[b]
	in[b] = in[a]
	in[a] = t

	count++
}

func trace(in []int) {
	if len(in) > 0 {
		fmt.Print(in[0])
		for _, i := range in[1:] {
			fmt.Print(" ", i)
		}
	}

	fmt.Println("")
}



Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define pb push_back
#define eb emplace_back
#define sz(a) (int)a.size()
#define all(c) c.begin(),c.end()
#define FOR(i,a,b) for(i=a; i<b; i++)
#define FORR(i,a,b) for(i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define x first
#define y second
#define mp make_pair

const int INF = 1000000007;
const long long INFLL = (ll)INF * (ll)INF;

int32_t main()
{
	IOS;
	int n,m,x;
	vi a;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		cin>>x;
		a.pb(x);
	}
	int sum = accumulate(all(a),0);
	if(sum>n)
	{
		cout<<"-1";
	}
	else
	{
		cout<<n-sum;
	}
	return 0;
}


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

int main () {
int N; cin>>N;
  if(N % 2==0 &&N /2 <=10){cout<<"Yes"<<endl;}
    else if(N % 3==0 &N /3 <10){cout<<"Yes"<<endl;}
   else if(N % 4==0 &&N /4 <10){cout<<"Yes"<<endl;}
   else if(N % 5==0 &N /5 <10){cout<<"Yes"<<endl;}
   else if(N % 6==0 &&N /6 <10){cout<<"Yes"<<endl;}
   else if(N % 7==0 &&N /7 <10){cout<<"Yes"<<endl;}
   else if(N % 8==0 &&N /8 <10){cout<<"Yes"<<endl;}
   else if(N % 9==0 &&N /9 <10){cout<<"Yes"<<endl;}
  else if(N==1){cout <<"Yes"<<endl;}
  else{cout <<"No"<<endl;}
}


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine();
        var inputs = Console.ReadLine().Split(' ');
        decimal ans = 1;
        var flag = true;

        foreach (var n in inputs)
        {
            if (flag)
            {
                if (n.ToCharArray().Length + ans.ToString().ToCharArray().Length > 24)
                {
                    ans = 1000000000000000001;
                    flag = false;
                }
                else 
                {
                    ans *= decimal.Parse(n);

                    if (ans > (decimal)Math.Pow(10, 18))
                    {
                        flag = false;
                    } 
                }
            }
            else
            {
                if (decimal.Parse(n) == 0)
                {
                    ans = 0;
                }
            }
        }
        if (ans > (decimal)Math.Pow(10, 18))
        {
            Console.WriteLine(-1);
        }
        else
        {
            Console.WriteLine(ans);
        }
        Console.Read();
    }
}

Measured memory_bytes: 35920
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a;
	if (a % 2 == 0) cout << a << endl;
	else cout << a * 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    ll n, k;
    cin >> n >> k;
    ll ans = n;
    ans = min(ans, n%k);
    ans = min(ans, k-(n%k));
    cout << ans << endl;
}



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

string str;

int main(){
	cin >> str;
	int c = 0;
	int l[4] = { 0 };
	for (int i = 0; i < str.size(); i++) {
		switch (str[i])
		{
		case 'K':l[0]++;
			break;
		case 'U':l[1]++;
			break;
		case 'P':l[2]++;
			break;
		case 'C':l[3]++;
			break;
		default:
			break;
		}
	}
	c = l[0];
	for (int i = 1; i < 4; i++) {
		if (c > l[i])
			c = l[i];
	}
	cout << c << endl;

	return 0;
}

Measured memory_bytes: 3168
#include<stdio.h>
int main(){
  int a, b;
  scanf ("%d %d", &a, &b);

  if (a < b) {
    printf ("a < b\n");
  } else if (a > b) {
    printf ("a > b\n");
  } else {
    printf ("a == b\n");
  }

  return 0;
}


Measured memory_bytes: 2112
#include <stdio.h>
int main(void){
   
   int H, W;
   int i, t;
   
   while(1){
        scanf("%d %d\n", &H, &W);
        if(H == 0 && W == 0) break;
        for(i = 0; i < H; i++){
            for(t = 0; t < W; t++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
   }
   
  return 0;
   
}

Measured memory_bytes: 576
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

char str[200005];
ll   dp[200005][2];  //[0]:.  [1]:#

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);
    scanf("%s", str);

    if(str[0]=='#') {
        dp[0][0]=1;
        dp[0][1]=0;
    }
    else {
        dp[0][0]=0;
        dp[0][1]=1;
    }

    long i;
    for(i=1; i<n; i++) {
        if(str[i]=='#') {
            dp[i][0]=dp[i-1][0]+1;
            dp[i][1]=MIN(dp[i-1][0],dp[i-1][1])+0;
        }
        else {
            dp[i][0]=dp[i-1][0]+0;
            dp[i][1]=MIN(dp[i-1][0],dp[i-1][1])+1;
        }
    }
    printf("%lld\n", MIN(dp[n-1][0],dp[n-1][1]));


    return 0;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<queue>
#include<stack>
#include<math.h>
#define Max 1000000
#define INF 1000000000000000000
using namespace std;



int main(){

	int n;
	scanf("%d",&n);
	string s,t;
	cin >> s >> t;
	for(int i=0;i<n;i++)
		cout << s[i] << t[i];
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N - 1; i++) {
      count += A[i] / 2;
      A[i] = A[i] % 2;
      int m = Math.min(A[i], A[i + 1]);
      count += m;
      A[i] -= m;
      A[i + 1] -= m;
    }
    count += A[N - 1] / 2;
    System.out.println(count);
  }
}


Measured memory_bytes: 49124
import java.util.Scanner;
 
class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    System.out.println(gcd(a, b));
  }
   
  public static int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
  }
}

Measured memory_bytes: 17360
def get_point(info):
  info.reverse()
  acc = 0
  NORMAL, SPARE, STRIKE, DOUBLE = 0, 1, 2, 3
  flag = NORMAL
  game_num = 0
  while info:
    if game_num != 9:
      down_num1 = info.pop()
      if down_num1 != 10:
        down_num2 = info.pop()
        if flag == SPARE:
          acc += down_num1 * 2 + down_num2
        elif flag == STRIKE:
          acc += down_num1 * 2 + down_num2 * 2
        elif flag == DOUBLE:
          acc += down_num1 * 3 + down_num2 * 2
        else:
          acc += down_num1 + down_num2
        
        if down_num1 + down_num2 == 10:
          flag = SPARE
        else:
          flag = NORMAL
      
      else:
        if flag in (SPARE, STRIKE):
          acc += down_num1 * 2
        elif flag == DOUBLE:
          acc += down_num1 * 3
        else:
          acc += down_num1
        if flag in (STRIKE, DOUBLE):
          flag = DOUBLE
        else:
          flag = STRIKE
      game_num += 1

    else:
      down_num1, down_num2 = info.pop(), info.pop()
      if flag == SPARE:
        acc += down_num1 * 2 + down_num2
      elif flag == STRIKE:
        acc += down_num1 * 2 + down_num2 * 2
      elif flag == DOUBLE:
        acc += down_num1 * 3 + down_num2 * 2
      else:
        acc += down_num1 + down_num2
      if info:
        acc += info.pop()
  
  return acc

while True:
  m = int(input())
  if m == 0:
    break
  score = [list(map(int, input().split())) for _ in range(m)]
  score_mp = [(info[0], get_point(info[1:])) for info in score]
  score_mp.sort()
  score_mp.sort(key=lambda x:-x[1])
  for pair in score_mp:
    print(*pair)


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

struct MinSegTree{
    int n;
    vector<int> dat;

    MinSegTree(){}
    MinSegTree(int _n){
        n = 1;
        while(n<_n) n*=2;
        dat = vector<int>(2*n-1,INT_MAX);
    }
    void update(int k, int val){
        k += n-1;
        dat[k] = val;
        while(k>0){
            k = (k-1)/2;
            dat[k] = min(dat[2*k+1],dat[2*k+2]);
        }
    }
    int _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return INT_MAX;
        if(a<=l && r<=b) return dat[k];

        int vl = _query(a,b,2*k+1,l,(l+r)/2);
        int vr = _query(a,b,2*k+2,(l+r)/2,r);
        return min(vl,vr);
    }
    int query(int a, int b){
        return _query(a,b,0,0,n);
    }
    int get(int k)
    {
        k += n-1;
        return dat[k];
    }
};


int main()
{
    int n;
    scanf(" %d", &n);

    MinSegTree st[2];
    rep(j,2)
    {
        st[j] = MinSegTree(n);
        rep(i,n)
        {
            int v;
            scanf(" %d", &v);
            st[j].update(i,v);
        }
    }

    int Q;
    scanf(" %d", &Q);

    set<int> u;
    rep(i,n) u.insert(i);

    while(Q--)
    {
        int x,y,z;
        scanf(" %d %d %d", &x, &y, &z);

        --y;

        if(x==1 || x==2)
        {
            st[x-1].update(y,z);
            u.insert(y);
        }
        else if(x==3 || x==4)
        {
            printf("%d\n", st[x-3].query(y,z));
        }
        else
        {
            int focus = !(x-5);
            // printf(" x= %d focus %d\n", x,focus);
            for(int idx:u)
            {
                // st[x-5].update(idx, st[focus].query(idx,idx+1));
                st[x-5].update(idx, st[focus].get(idx));
            }
            u.clear();
        }

        // printf(" --- Q %d \n", Q);
        // printf(" A:");
        // rep(i,n) printf(" %d", st[0].get(i));
        // printf("\n");
        // printf(" B:");
        // rep(i,n) printf(" %d", st[1].get(i));
        // printf("\n");
    }

    return 0;
}

Measured memory_bytes: 16272
#define REP(i, n) for (int i = 0; i < (n); ++i)

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
long long f(long long n) {
  switch (n % 4) {
  case 0:
    return n;
  case 1:
    return 1;
  case 2:
    return n + 1;
  case 3:
    return 0;
  }
  return -1ll;
}
signed main() {
  ios::sync_with_stdio(false);
  long long a, b;
  cin >> a >> b;
  cout << (f(b) ^ f(a) ^ a) << endl;
  return 0;
}


Measured memory_bytes: 256
# 064_a
r,g,b=map(int,input().split())
num=int(str(r)+str(g)+str(b))
if (1<=r and r<=9) and (1<=g and g<=9) and(1<=b and b<=9):
    if num % 4 == 0:
        print('YES')
    else:
        print('NO')

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

int main() {
    int n;
    int m;
 
   cin >> n >> m;
  
   int l, k=0;
  
   string a[n+2][m+2]={};
  
   for(int i=0;i<n+2;i++){
      for(int j=0;j<m+2;j++){
        
       
        
        a[i][j]="#";
        
        
      }
     

   }
  
    
  for(int i=1;i<n+1;i++){
    
      for(int j=1;j<m+1;j++){
        
          
          char s;
          cin >> s;
        
         a[i][j] = s;
        
       //   cout << a[i][j];
        
     }
    
   
  }
  
  
  for(int i=0;i<n+2;i++){
      for(int j=0;j<m+2;j++){
        
     //   a[i][j]="#";
        
         if(j==m+1){
          cout << a[i][j] << endl;
        }else{
          cout << a[i][j];
         }
      }

   }

  
  
  
  // cout << n << endl;
  // cout << m << endl;
  
  return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
#define N 100
int times[N+1]={0};
int main (void)
{
	int n,maxtimes,i;
	while(scanf("%d",&n)!=EOF)
	    times[n]++;
	maxtimes=0;
	for(i=1;i<=N;i++)
	    if(times[i]>maxtimes)
		    maxtimes=times[i];
    for(i=1;i<=N;i++)
	    if(times[i]==maxtimes)
		    printf("%d\n",i);
    return 0;    
}


Measured memory_bytes: 2080
import sys
sys.setrecursionlimit(10**9)

def dfs(vNow):
    useds[vNow] = True
    for v2 in adjL[vNow]:
        if not useds[v2]:
            dfs(v2)

N, M = map(int, input().split())
adjL = [[] for v in range(N+M)]
for i in range(N):
    K, *Ls = map(int, input().split())
    for L in Ls:
        adjL[i].append(L+N-1)
        adjL[L+N-1].append(i)

useds = [False] * (N+M)
dfs(0)

print('YES' if all(useds[:N]) else 'NO')


Measured memory_bytes: 37656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k;
  cin >> a >> b >> k;
  int c[100] = {0};
  int j=1;
  for(int i=1; i<=100; i++){
    if(a%i==0 && b%i==0){
      c[j] = i;
      j++;
    }
  }
  sort(c,c+100,greater<int>());
  cout << c[k-1] << endl;
  return 0;
}
    

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
 
int main() {
 
  char ch[1200];
  int i,n;
  n=0;
  char a[1200];
 
  while(1) {
    scanf("%c",&a[n]);
    if(a[n] == '\n') {
      break;
    }
    ch[n] = a[n];
    if('A' <= a[n] && a[n] <= 'Z') {
      ch[n] = a[n] + 32;
    } else if(a[n] >= 'a' && a[n] <= 'z') {
      ch[n] = a[n] - 32;
 
    }
     
     
    n = n +1;
     
  }
   
  for(i=0; i<n ; i++) {
    printf("%c" ,ch[i]);
  }
  printf("\n"); 
  return 0;
   
}


Measured memory_bytes: 2052
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	edges := make([][]int, n+m)
	ins := make([]int, n)
	for i := 0; i < n+m-1; i++ {
		a, b := intScanner()-1, intScanner()-1
		edges[a] = append(edges[a], b)
		ins[b]++
	}
	init := -1
	for i := 0; i < n; i++ {
		if ins[i] == 0 {
			init = i
		}
	}
	pars := make([]int, n)
	pars[init] = 0
	q := make([]int, 1, n)
	q[0] = init
	for len(q) != 0 {
		idx := q[0]
		q = q[1:]
		for _, v := range edges[idx] {
			ins[v]--
			if ins[v] == 0 {
				q = append(q, v)
				pars[v] = idx + 1
			}
		}
	}
	for _, v := range pars {
		fmt.Println(v)
	}
}


Measured memory_bytes: 10224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F(i, a, b) for (int i = (a); i <= (b); i++)
#define D(i, a, b) for (int i = (a); i >= (b); i--)
#define R(i, a, b) for (int i = (a); i < (b); i++)
#define N 500000
#define ALL(vt) vt.begin(), vt.end()
#define ALLR(vt) vt.rbegin(), vt.rend()
int main(){
    int n; cin >> n;
    ll ans = 0;
    R(i, 1, n+1){
        if(i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


int main(){
	fio; cout<<fixed<<setprecision(25);	
	string a , b;
	cin >> a >> b;
	string aa , bb;
	for(int i = 0;i < b[0]-'0' ; ++i){
		aa.pb(a[0]);
	}
	for(int i = 0;i < a[0]-'0' ; ++i){
		bb.pb(b[0]);
	}
	cout << min(aa , bb) << endl;
	return 0;
}


Measured memory_bytes: 256
[N,X] = list(map(int,input().split()))
m = []
for i in range(N):
    m.append(int(input()))
# print('m:',m)
amari = X - sum(m)
# print('amari:',amari)

i=0
while True:
    if amari<min(m)*i:
        ans = len(m) + i-1
        break
    i+=1
print(ans)


Measured memory_bytes: 72700
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,d;
    cin >> n >> d;
    int ans = 0;
    rep(i,n) {
        int x,y;
        cin >> x >> y;
        if(ll(x)*x+ll(y)*y <= ll(d)*d) ans++;
    }
    cout << ans << endl;
}


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

int n;
string s, t;

int solve(){
    for(int i = 0; i < n; i++){
        if(s.substr(i) == t.substr(0, n-i)){
            return n+i;
        }
    }

    return n+n;
}

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

    cout << solve() << endl;
    return 0;

}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n;
int a[500];

int main()
{
	IOS;
	cin >> n;
	int s = 0, m = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		s += a[i];
		m = max(m, a[i]);
	}
	cout << s - m/2 << endl;
	return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = int(input())
R = []

for i in range(n):
    R.append(int(input()))

max_num = 1 - 10 ** 9
min_num = R[0]

for i in range(1, len(R)):
    max_num = max(max_num, (R[i] - min_num))
    min_num = min(min_num, R[i])

print(max_num)



Measured memory_bytes: 13592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n, m; cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    int cnt = 0;
    rep(i, n) {
        if(a[i]*4*m >= sum) cnt++;
    }
    if(cnt >= m) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (long long i = 0; i < (long long) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, k, c;
string s;
int suff[N];

bool read() {
    if (!(cin >> n >> k >> c >> s))
        return false;

    return true;
}

void solve(int id = 0) {
    for (int i = n - 1; i >= 0; --i) {
        suff[i] = suff[i + 1];

        if (s[i] == 'o')
            suff[i] = max(suff[i], 1 + (i + c + 1 < n ? suff[i + c + 1] : 0));
    }

    if (suff[0] > k) {
        return ;
    }

    int cur = 0;

    for (; cur < n && s[cur] == 'x'; ++cur) { }

    for (; cur < n; )
        if (s[cur] == 'x') {
            ++cur;
        } else {
            if (suff[cur] > suff[cur + 1])
                cout << cur + 1 << endl;

            cur += c + 1;
        }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    T = 1;

    while (read())
        solve(T++);

    return 0;
}



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

#define mod 1000000007

long long N, K, X, Y, ans = 0;
multiset<pair<int, int> > ms;

void maxamong0(int i) {
	long long sum = 0;
	for(auto it = ms.begin();it != ms.end();it++) {
		int x = it->first;
		if(!((1LL << i) & x)) {
			sum += it->second;
		}
	}

	ans = max(sum, ans);
}

void maxamong() {
	long long sum = 0;
	for(auto it = ms.begin();it != ms.end();it++) {
		sum += it->second;
	}

	ans = max(ans, sum);
}

void remove1(int i) {
	auto it = ms.begin();
	while(it != ms.end()) {
		int x = it->first;
		if((1LL<<i) & x) {
			it = ms.erase(it);
		} else {
			it++;
		}
	}
}

int main() {
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
	cin >> N >> K;
	for(int i = 0;i < N;i++) {
		cin >> X >> Y;
		ms.insert(make_pair(X, Y));
	}

	for(int i = 29;i >= 0;i--) {
		if((1LL<<i) & K) {
			maxamong0(i);
		} else {
			remove1(i);
		}
	}

	maxamong();
	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,m,x;
  long long ans=10010010010;
  cin>>n>>m>>x;
  int c[n],a[n][m];
  for(int i=0;i<n;i++){
      cin>>c[i];
    for(int j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  int p[m]={};
  for(int bit=0;bit<(1<<n);bit++){
    int sum=0,l=0;
    long long s=0;
    for(int i=0;i<n;i++){
      if(bit&(1<<i)) continue;
      else{
        s+=c[i];
        for(int k=0;k<m;k++){
          p[k]+=a[i][k];   
        }
      }
    }
      for(int j=0;j<m;j++){
          if(p[j]>=x) l++;
        
      }
    
      if(l==m) ans=min(ans,s);
    for(int q=0;q<m;q++){
      p[q]=0;
    }
  }
  if(ans==10010010010){
    cout<<-1<<endl;
    return 0;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
int main(){
int a,b,c,d=1,i,e,f=0,g,h=1,sum=0,x;
scanf("%d %d %d",&a,&b,&c);
x=a;
while(1){
if(a==0){
sum--;
}
for(i=0;i<b;i++){
d=d*a;
}
if(d>c){
break;
}
else{
g=d;
while(d!=0){
e=d%10;
f=f+e;
d=d/10;
}
f=f+x;
for(i=0;i<b;i++){
h=h*f;
}
if(g==h){
sum++;
}
}
a++;
d=1,f=0,h=1;
}
printf("%d\n",sum);
return 0;
}



Measured memory_bytes: 1992
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll n;
    cin>>n;
    string ans="APPROVED";
    ll a[n];
    for(ll i=0;i<n;++i){
        cin>>a[i];
        if(a[i]%2==0){
            if(a[i]%3==0 or a[i]%5==0){
                continue;
            }else{
                ans="DENIED";
                break;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int digitsum(int n){
  if(n == 0)
    return 0;
  else
    return (n % 10) + digitsum(n/10);
}

int main()
{
  int N;
  scanf("%d",&N);
  if(N % digitsum(N) == 0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main(void) {
	char c;
	cin >> c;
	cout << char(c+1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)

int main() {
	string a, b; cin >> a >> b;
	
	if (a.size() > b.size()) cout << "GREATER" << endl;
	else if (a.size() < b.size()) cout << "LESS" << endl;
	else {
		rep(i, 0, a.size()) {
			if (a[i]-'0' > b[i]-'0') {
				cout << "GREATER" << endl;
				return 0;
			}
			else if (a[i]-'0' < b[i]-'0') {
				cout << "LESS" << endl;
				return 0;
			}
		}
		cout << "EQUAL" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include <cassert>
using namespace std;

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

#define INF INT_MAX/3
#define lINF LLONG_MAX/3
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repl(i,s,n) for(int i=(s);i<=(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define MP make_pair
#define debug(x) cout<<#x<<":"<<x<<endl
#define debug2(x,y) cout<<#x<<":"<<#y<<"="<<x<<":"<<y<<endl


void solve(int n){
    vector<string> w(n);
    rep(i,n) cin >> w[i];

    rep(i,n) repl(j,i+1,n-1) repl(k,j+1,n-1) repl(l,k+1,n-1) repl(m,l+1,n-1){
        string s;
        for(int x=i;x<j;x++) s+=w[x];
        if(s.size()!=5) continue;
        s.clear();
        for(int x=j;x<k;x++) s+=w[x];
        if(s.size()!=7) continue;
        s.clear();
        for(int x=k;x<l;x++) s+=w[x];
        if(s.size()!=5) continue;
        s.clear();
        for(int x=l;x<m;x++) s+=w[x];
        if(s.size()!=7) continue;
        s.clear();
        for(int x=m;x<n;x++){
            s += w[x];
            if(s.size()==7){
                cout << i+1 << endl;
                return;
            }
        }
    }
}

int main(){
    int n;
    while(cin>>n && n){
        solve(n);
    }
}

Measured memory_bytes: 3104
n=int(input())
arr=list(map(int,input().split()))
l=min(arr)
r=max(arr)
ans=10**10
for i in range(l,r+1):
  tmp=0
  for j in range(n):
    tmp+=(arr[j]-i)**2
  if tmp<ans:
    ans=tmp
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

typedef long long ll;

const ll MOD=1e9+7;

const int MAX_N=1e5;

int N;
int T[MAX_N],A[MAX_N];

int TM[MAX_N],AM[MAX_N];

void solve(){
	if (T[N-1]!=A[0]){
		printf("0\n");
		return;
	}
	REP(i,N){
		if (TM[i] || AM[i]){
			if (TM[i] && AM[i] && TM[i]!=AM[i]){
				printf("0\n");
				return;
			}
			int m=max(TM[i],AM[i]);
			if (m>T[i] || m>A[i]){
				printf("0\n");
				return;
			}
		}
	}
	ll ans=1;
	REP(i,N){
		if (TM[i] || AM[i]) continue;
		ans*=min(T[i],A[i]);
		ans%=MOD;
	}
	printf("%lld\n",ans);
}

int main(){
	scanf("%d",&N);
	REP(i,N){
		scanf("%d",&T[i]);
	}
	REP(i,N){
		scanf("%d",&A[i]);
	}
	TM[0]=T[0];
	FOR(i,1,N){
		if (T[i-1]<T[i]){
			TM[i]=T[i];
		}
	}
	AM[N-1]=A[N-1];
	for (int i=N-2;i>=0;i--){
		if (A[i+1]<A[i]){
			AM[i]=A[i];
		}
	}
	solve();
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdio>
#include <list>
#include <queue>
using namespace std;

#define int long long
#define INF 1e18

signed main() {
    string s; cin >> s;
    int cnt = 0;
    for(int i = 1; i < s.size(); i++) {
        if(s[i] == s[i - 1] && s[i] == '1') {
            s[i] = '0';
            cnt++;
        } else if(s[i] == s[i - 1] && s[i] == '0') {
            s[i] = '1'; cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007

int main(){
	ll n;
	ll ans=0;
	cin >> n;
	VI a(n),b(n),c(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	for(int i=0;i<n;i++){
		cin >> b[i];
	}
	for(int i=0;i<n;i++){
		cin >> c[i];
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	sort(c.begin(),c.end());
	for(ll i=0;i<n;i++){
		ans += (lower_bound(a.begin(),a.begin()+n,b[i])-a.begin())* (n-(upper_bound(c.begin(),c.begin()+n,b[i])-c.begin()));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2040