akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,ii ) for( typeof(gg.begin()) ii=gg.begin();ii!=gg.end();ii++)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define sz(a) int((a).size())
#define N 1000010
#define MAX 30
#define mod 1000000007
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define all(a) a.begin(),a.end()
const ll INF = 1e18+1;

int isprime[1010];

int main()
{
	ll n,ans=1,curr,nc;
	scanf("%lld",&n);
	REPP(i,2,1001){
		if (!isprime[i]){
			curr=0,nc=i;
			while(n/nc){
				curr+=n/nc;
				nc*=i;
			}
			ans=((1+curr)*ans)%mod;
			for(int j=2*i;j<1001;j+=i) isprime[j]=1;
		}
	}
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 384
D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]

last = {}
for i in range(1,27):
    last[i] = 0

for d in range(1,D+1):
    ans = [1,-float('inf')]
    for i in range(1,27):
        satisfaction = 0
        satisfaction += s[d-1][i-1]
        for j in range(1,27):
            if i != j:
                satisfaction -= c[j-1]*(d-last[j])
        if ans[1] <= satisfaction:
            ans = [i,satisfaction]
    last[ans[0]] = d
    print(ans[0])


Measured memory_bytes: 68852
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, _) = scan!(usize, usize);
    let mut vs = scan!(;;n);
    vs.sort();
    for v in vs {
        print!("{}", v);
    }
    println!();
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            long A = in.Long();
            long B = in.Long();
            long N = in.Long();

            if (B <= N) {
                long x = B - 1;
                out.println((long) ((A * x) / B - A * (x / B)));
            } else {
                out.println((long) ((A * N) / B - A * (N / B)));
            }
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public long Long() {
            return Long.parseLong(next());
        }

    }
}



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

int main() {
  int sum = 0;
  for(int i=0; i<4; i++) {
    int a;
    cin >> a;
    sum += a;
  }

  cout << sum / 60 << endl;
  sum %= 60;
  cout << sum << endl;
}

Measured memory_bytes: 1160
import sys

def main():
    N, X, M = map(int, sys.stdin.readline().rstrip().split())

    S = [0] * M  # 何回目に来たか
    C = [0] * M  # 最初にたどり着いたときの値

    _sum = 0
    cycle_sum = 0
    cycle_count = 0
    for i in range(1, N+1):
        _sum += X
        if S[X] == 0:
            C[X] = _sum
            S[X] = i
        else:
            cycle_sum = _sum - C[X]
            cycle_length = i - S[X]
            break
        X = X**2 % M
    else:
        print(_sum)
        return        

    # print(X, S[X], C[X], i, _sum)
    first_sum = C[X]
    cycle_n = (N - S[X]) // cycle_length
    _sum = first_sum + cycle_n * cycle_sum
    rest = N - (S[X] + cycle_n * cycle_length)
    # print(first_sum, cycle_length, cycle_sum, _sum, rest)
    # print(X, X**2  % M)

    for i in range(rest):
        X = X**2 % M
        _sum += X
    
    print(_sum)


main()



Measured memory_bytes: 14088
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>

using namespace std;

int main() {
    long long x;
    cin >> x;
    long long n = 100;
    long long a = 0;
    while(1){
        n = n * 1.01;
        a += 1;
        if(n >= x){
            break;
        }
    }
    cout << a << endl;
    return 0;
}

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

    int n;
    string s;

    cin >> n >> s;

    // west 西
    // east 東
    vector <int> acE(n);
    vector <int> acW(n);

    int sum = 0;
    for(int i = 0; i < n; i++){
        if(s.at(i) == 'W') {
            sum++;
        }
       acE.at(i) = sum;
    }
  

    sum = 0;
    for(int i = n-1 ; i > -1 ; i--){
        if(s.at(i) == 'E') {
            sum++;
        }
      	acW.at(i) = sum;
    }

    int mv = n;
    for(int i = 0; i < n; i++){
        int tmp = acW.at(i) + acE.at(i);
        //cout << acE.at(i)<< " " << acW.at(i) << " " << tmp << endl;
        mv = min(mv,tmp);
    }

    cout << mv -1 << endl;
}



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

int main() {

	double l;
	cin >> l;

	double ans;
	ans = pow(l,3);
	ans = ans / 27;

	cout << fixed << setprecision(10);
	cout << ans << endl;
}

Measured memory_bytes: 256
def resolve():
    S = int(input())
    DP = [0]*(S+1)
    DP[0] = 1
    for i in range(3, S+1):
        DP[i] = (DP[i-3] + DP[i-1]) % (10**9 + 7)
    print(DP[-1])
    
resolve()

Measured memory_bytes: 9208
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		char prev = '0';
		int ans = 0;
		for (int i = 0; i < s.length(); i++) {
			if (prev == s.charAt(i)) {// 前と同じ
				ans++;
			}
			prev = i % 2 == 0 ? '1' : '0';
		}
		System.out.println(Math.min(ans, s.length() - ans));
	}
}


Measured memory_bytes: 24944
#include<bits/stdc++.h>
#define pb push_back 
using namespace std;

const int maxn=1;
typedef long long ll;

int n,m,ans;
int a,b,c;

int main()
{
	int i,j,k;
	scanf("%d%d%d",&a,&b,&c);
	for(i=1;i<=200;++i)
	{
		int x=a,y=b,z=c;
		if(x%2||y%2||z%2)
		{
			printf("%d",i-1);
			return 0;
		}
		a=(x+y)/2;
		b=(y+z)/2;
		c=(x+z)/2;
	}
	
	printf("-1");
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
S = input()
n=0
flg=0
#print(s[0:K-1]+s[K-1].lower()+s[K:N])
S=S[::-1]
while(not S==""):

#    if  S[n:].startswith("dreameraser"):
#        n=n+11
        #print(S[n:])
        #flg==1
#        continue
    if S.startswith("remaerd"):
        #n=n+6
        S=S.replace("remaerd","",1)
        #print(S[n:])
        continue
    elif S.startswith("maerd"):
        #n=n+5
        S=S.replace("maerd","",1)
        #print(S)
        #flg==1
        continue
    elif S.startswith("resare"):
        #n=n+6
        S=S.replace("resare","",1)
        #print(S[n:])
        continue
    elif S.startswith("esare"):
        #n=n+5
        S=S.replace("esare","",1)
        #print(S)
        #flg==1
        continue
    print("NO")
    exit()

print("YES")


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long coun,a,b,c;
int main()
{string s;
   ios::sync_with_stdio(0);
   cin>>s;
   if(((s[0]==s[s.length()-1]) + s.length())%2==0)
    cout<<"Second"<<endl;
   else
    cout<<"First"<<endl;
   return 0;


}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
#define endl '\n'

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a;
    long double b,c;
    cin >> a >> b;
    c = a * b;
    long long int x=c;
    cout << x << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

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

        auto g = make_v(n, n, false);
        
        REP(i, n) {
                string s;
                cin >> s;
                REP(j, n) g[i][j] = s[j] - '0';
        }

        int ans = -1;

        REP(s, n) {
                vector<int> c(n, -1);
                queue<int> q;

                c[s] = 0;
                q.push(s);

                bool ok = true;
                int t = -1;
                while (!q.empty()) {
                        int u = q.front();
                        q.pop();

                        REP(v, n) if(g[u][v] && c[v] == -1) {
                                c[v] = c[u] + 1;
                                q.push(v);

                                REP(w, n) if (g[v][w] && c[w] != -1) {
                                        if (c[w] + 1 != c[v]) ok = false;
                                }

                                t = max(t, c[v]);
                        }
                }

                if (ok) ans = max(ans, t + 1);
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
string S;
  cin >> S;
int mi = 999;
int a;  
  for(int i = 0;i < S.size() - 2;i++){
  a = (S.at(i) - '0') * 100 + (S.at(i+1) - '0') * 10 + S.at(i+2) - '0';
    
  mi = min(mi,abs(a - 753));
  }
  
  cout << mi << endl;
  
return 0;
  
}

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

typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
const double pi = 3.141592653589793238;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

void printV(vector<int> &v);
void printVV(vector<vector<int>> &vv);


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


  int l, r, bl, br;
  cin >> bl >> br;
  for(int i = 1; i < M; i++) {
    cin >> l >> r;
    bl = max(bl, l);
    br = min(br, r);

    if(br - bl < 0) {
      cout << 0 << endl;
      return 0;
    };
  }

  cout << br - bl + 1 << endl;
  return 0;
}


// ベクターの中身を全部出力
void printV(vector<int> &v) {
  cout << "  [ ";
  for(int i = 0; i < (int)v.size(); i++) {
    cout << v.at(i) << " ";
  }
  cout << "]" << endl;
}

void printVV(vector<vector<int>> &vv) {
  cout << "{" << endl;
  for(int i = 0; i < (int)vv.size(); i++) {
    cout << "  [ ";
    for(int j = 0; j < (int)vv.at(i).size(); j++) {
      cout << vv.at(i).at(j) << " ";
    }
    cout << "]," << endl;
  }
  cout << "}" << endl;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

int sq(int n){
	int c=1;
	if (n<0) c=-1;
	return (c*n*n);
}

inline void solve(){
    int a,b,c; cin>>a>>b>>c; 
    int f=4*a*b,s=sq((c-a-b));
    if (f<s) cout << "Yes" << endl; 
    else cout << "No" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define fill(a,val) memset(a,val,sizeof(a))
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define pb push_back
#define SQ(a) (a)*(a)

#define M 315
using namespace std;
 

int main()
{
    std::ios::sync_with_stdio(false);
    int T = 1;
    //cin>>T;
    while(T--)
    {
        ll n;
        cin>>n;
        vector<int> a(n);
        map<int,int> m;
        ll sum = 0;
        for(int  i = 0;i<n;i++)
        {
            cin>>a[i];
            sum+=a[i];
            m[a[i]]++;
        }
        int q;
        cin>>q;
        for(int i = 0;i<q;i++)
        {
          int b,c;
          cin>>b>>c;
          int count = m[b];
          m[c] += m[b];
          m[b] = 0;
          if(c > b)
            sum = sum + (c-b)*count;
          else
            sum = sum - (b-c)*count;
          cout<<sum<<endl;
        }

    }   
    
    return 0;
}


Measured memory_bytes: 8032
H, W = map(int, input().split())
A = [list(input().split()) for _ in range(H)]
for i in range(H+2):
    if i == 0 or i == H+1:
        print(''.join(['#'] * (W+2)))
    else:
        print(''.join(['#'] + A[i-1] + ['#']))


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

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 3000 + 10;
int T;

const int mod = 1e9 + 7;
int dp[1 << 21];
vector<int> women[21];
int a;
int n;

//生成下个相同1的数
int nextN(int n)
{
    int x = n & (-n);
    int t = n + x;
    return ((n ^ t) / x) >> 2 | t;
}

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
// freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        for (int i = 0; i < n; i++)
        {
            women[i].clear();
            for (int j = 0; j < n; j++)
            {
                cin >> a;
                if (a)
                {
                    women[i].push_back(j);
                }
            }
        }

        clr(dp, 0);
        int lim = (1 << n);
        for (auto j : women[0])
        // for (int j = 0; j < n; j++)
        {
            dp[1 << j] = 1;
        }

        for (int i = 0; i < n - 1; i++)
        {
            for (int st = (1 << (i + 1)) - 1; st < lim; st = nextN(st))
            {
                // debug(i, st);
                for (auto j : women[i + 1])
                // for (int j = 0; j < n; j++)
                {
                    if (st & (1 << j)) continue;
                    dp[st | (1 << j)] += dp[st];
                    dp[st | (1 << j)] %= mod;
                }
            }
        }

        cout << dp[lim - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 11796
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = []
for j in range(n-k+1):
    if x[j] > 0:
        ans.append(x[j+k-1])
    elif x[j] <= 0 <= x[j+k-1]:
        ans.append(min(2*abs(x[j])+x[j+k-1], abs(x[j])+2*x[j+k-1]))
    else:
        ans.append(-x[j])
print(min(ans))

Measured memory_bytes: 20092
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <iostream>
#include <bitset>
using namespace std;

int main() {
        string s;
        cin >> s;
        int x, y;
        scanf("%d %d", &x, &y);
        int cnt = 0;
        vector<int> lr, ud;
        int p = 0;
        while (s[p] == 'F') {
                p ++;
                x --;
        }
        bool is_lr = true;
        for (; p < s.size(); p ++) {
                if (s[p] == 'F') { 
                        cnt ++;
                } else {
                        if (cnt) {
                                if (is_lr) {
                                        lr.push_back(cnt);
                                } else {
                                        ud.push_back(cnt);
                                }
                                cnt = 0;
                        }
                        is_lr = !is_lr;
                }
        }
        if (cnt) {
                if (is_lr) {
                        lr.push_back(cnt);
                } else {
                        ud.push_back(cnt);
                }
        }
        auto calc = [&](int target, const vector<int> &a) {
                const int MID = 16060;
                bitset<MID * 2> cur, prev;
                prev[MID] = 1;
                for (int i = 0; i < a.size(); i ++) {
                        cur |= prev << a[i];
                        cur |= prev >> a[i];
                        prev = cur;
                        cur.reset();
                }
                return prev[target + MID];
        };
        bool ans = calc(x, lr) && calc(y, ud);
        puts(ans ? "Yes" : "No");
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
	int x, y,a,b,c; cin >> x >> y;
	vector<vector<int>> v(x, vector<int>());
	for (int i = 0; i < y; i++) {
		cin >> a >> b;
		if (a == 0) {
			cin >> c;
			v[b].push_back(c);
		}
		else if (a == 1) {
			for (int j = 0; j < v[b].size();j++) {
				if (j) {
					cout << ' ';
				}
				 cout << v[b][j];
			}
			cout << endl;
		}
		else {
			v[b].clear();
		}
	}
}



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

int main() {
  int h, w;
  int nax = 1005;
  cin >> h >> w;

  vector< char > graph[nax];
  long long dp[nax][nax];
  for (int i = 0; i < h; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < w; j++) {
      graph[i].push_back(s[j]);
    }
  }

  dp[1][1] = 1;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (i == 1 && j == 1) continue;
      if (graph[i - 1][j - 1] == '#') continue;
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % (long long)(1e9 + 7);
    }
  }
  cout << dp[h][w] << endl;

  return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

string s;
int dp[1<<26];

int main() {
	cin >> s;
	int N = s.size();
	REP(i, N) s[i] -= 'a';
	
	fill(dp, dp + (1<<26), INF);
	
	int x = 0;
	dp[0] = 0;
	REP(i, N) {
		x ^= 1<<s[i];
		REP(j, 26) chmin(dp[x], dp[x ^ 1<<j] + 1);
	}
	
	cout << max(dp[x], 1) << endl;
	
	return 0;
}


Measured memory_bytes: 262788
n = int(input())
acc = 0
flag = False
for _ in range(n):
  s = input()
  if s == "A":
    acc += 1
  else:
    acc -= 1
  if acc < 0:
    flag = True
if acc != 0:
  flag = True

if flag:
  print("NO")
else:
  print("YES")


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(long long i = a;i < b;i++)
#define rf(i,a,b) for(long long i=a;i>=b;i--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define w(t) while(t--)
#define c(n); cin>>n;
#define p(n) cout<<n;
#define pl(n) cout<<n<<"\n";
#define ps(n); cout<<n<<" ";
#define F first
#define S second
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
#define ull unsigned long long
#define vll vector<ll>
#define vii vector<ii>
#define mkp make_pair
#define ld long double
#define arrin(a,n) f(i,0,n){cin>>a[i];}
#define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";}
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define PI (2*acos(0))

int main(void){
    fastio;
    double n;
    c(n);
    cout<<setprecision(10)<<fixed<<2*n*PI<<endl;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;

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

int main()
{
    int H, W;
    cin >> H >> W;
    string S[H];

    rep(i, H) cin >> S[i];

    Graph G(H * W);
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] != '.') continue;
            for (int k = 0; k < 4; k++) {
                if (i + dy[k] >= 0 && i + dy[k] < H && j + dx[k] >= 0 && j + dx[k] < W) {
                    if (S[i + dy[k]][j + dx[k]] == '.') {
                        G.at(i * W + j).push_back((i + dy[k]) * W + j + dx[k]);
                        G.at((i + dy[k]) * W + j + dx[k]).push_back(i * W + j);
                    }
                }
            }
        }
    }

    int res = 0;
    for (int i = 0; i < H * W; i++) {
        vector<int> dist(H * W, -1);
        queue<int> que;

        dist[i] = 0;
        que.push(i);

        while(!que.empty()) {
            int v = que.front();
            que.pop();

            for (int nv : G[v]) {
                if (dist[nv] != -1) continue;
                dist[nv] = dist[v] + 1;
                res = max(dist[nv], res);
                que.push(nv);
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

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

int main()
{   _
    lli n; cin >> n;
    if(n % 1000 == 0) cout << 0 << ENDL;
    else cout << 1000 - (n % 1000) << ENDL;
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 1e6+5;
vector<pair<int,int>> vec[N];
int degree[N],res[N];
void solve(int id,int co,int pre)
{
    int nco = 0;
    for(auto x:vec[id])
    {
        if(x.first == pre)continue;
        nco++;
        if(nco==co)nco++;
        res[x.second] = nco;
        solve(x.first,nco,id);
    }
}
int main()
{
    int n,v1,v2;
    cin>>n;
    int ans = 0;
    for(int i = 1;i<n;i++)
    {
        cin>>v1>>v2;
        vec[v1].push_back(make_pair(v2,i));
        vec[v2].push_back(make_pair(v1,i));
        degree[v1]++;
        degree[v2]++;
        ans = max(ans,degree[v1]);
        ans = max(ans,degree[v2]);
    }
    solve(1,0,0);
    cout<<ans<<endl;
    for(int i = 1;i < n; i++)
    {
        cout<<res[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 35200
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;


int main(){
    int n;cin >> n;
    vector<int> x(n),y(n),h(n);
    rep(i,n){
        cin >> x[i] >> y[i] >> h[i];
    }

    for(int cx=0;cx<=100;cx++){
        for(int cy=0;cy<=100;cy++){
            int nh = -1;
            for(int i=0;i<n;i++){
                if(h[i]>0){
                    int tmp = abs(cy-y[i])+h[i]+abs(cx-x[i]);
                    if(nh==-1){
                        nh = tmp;
                    }else{
                        if(nh!=tmp){
                            nh = -2;
                            break;
                        }
                    }
                }
            }
            if(nh==-2) continue;
            for(int i=0;i<n;i++){
                if(h[i]==0){
                    int dist = abs(cy-y[i])+abs(cx-x[i]);
                    if(nh>dist){
                        nh = -2;
                        break;
                    }
                }
            }
            if(nh==-2) continue;
            cout << cx << " " << cy << " " << nh << endl;
            return 0;
            
        }
    }

}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t a;
    double bb;
    cin >> a >> bb;

    bb *= 100L;
    int64_t b = (bb + 0.5);

    cout << a * b / 100 << endl;
}

Measured memory_bytes: 3736
#include <bits/stdc++.h> 
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define each(it,o) for(auto it= (o).begin(); it != (o).end(); ++ it)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define inrep(t) int t;cin>>t; while(t--)
#define pb push_back
#define mp make_pair 
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi; 
typedef pair<int,int> pii;
typedef vector<pii > vpii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll > vpll; 
typedef vector<string> vs;
typedef long double ld;


int main(){
	ios_base::sync_with_stdio(false); 
	int n,p; 
	cin>>n>>p; 
	int sum=p/1000-n; 
	int x=INF,y=INF,z=-1; 
	reu(i,0,n+1){
		reu(j,0,n+1){
			if(9*i+4*j==sum) {
				if(x+y>i+j){
					x=i; y=j;
				}
			}
		}
	}
	if(x!=INF) z=n-x-y; 
	if(z<0) printf("-1 -1 -1");
	else cout<<x<<" "<<y<<" "<<z; 
}

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int a,b,c;
    cin >> a >> b >> c;
    
    if((a+b+c)>=22)
    cout << "bust";
    else
    cout << "win";
    
	return 0;
    
}

Measured memory_bytes: 8832
n = int(input())
dict = {}
for i in range(n):
    s = list(input())
    s.sort()
    s2 = "".join(s)
    if s2 in dict:
        dict[s2] += 1
    else:
        dict[s2] = 1
ans = 0
for k in dict:
    ans += dict[k]*(dict[k]-1)//2

print(ans)


Measured memory_bytes: 17808
def main():
    import sys
    from itertools import permutations
    input = sys.stdin.readline

    N = int(input())
    P = map(int, input().split())
    Q = map(int, input().split())

    P = ''.join(map(str, P))
    Q = ''.join(map(str, Q))

    l = list(range(1, N+1))
    a = b = 0
    s_list = []
    for s in permutations(l):
        s_list.append(''.join(map(str, s)))
    s_list.sort()

    for i, s in enumerate(s_list):
        if s == P:
            a = i
        if s == Q:
            b = i
    print(abs(a-b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 45276
#include <cstdio>

int main()
 {
   int S, h, m ,s;
   int hour = 60*60;
   scanf("%d", &S);
   h = S/hour;
   m = S%hour/60;
   s = (S%hour)%60;
   printf("%d:%d:%d\n", h, m, s);

   return 0;
 }

Measured memory_bytes: 2756
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010, Mod=1e9+7;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    int x=read();
    if(x<1200) puts("ABC");
    else puts("ARC");
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  const int dx[4] = {1,0,-1,0};
  const int dy[4] = {0,1,0,-1};
  int n,d;
  string s;
  for(cin>>n;n>0;n--){
    cin>>d;
    s = "";
    for(int i=0;i<d;i++) s+=" ";
    vector<string> spiral(d);
    for(int i=0;i<d;i++)spiral[i] = s;
    int x=0,y=d-1,dir=2,i=0;
    while(i<=d){
      spiral[y][x] = '#';
      if((i<4&&(y==0||y==d-1)&&(x==0||x==d-1))||(i>3&&spiral[y+2*dy[dir]][x+2*dx[dir]]=='#')){
	dir = (++dir)%4;
	i++;
	if(d==1)break;
      }
      x+=dx[dir];
      y+=dy[dir];
    }
    for(int y=0;y<d;y++)
      cout<<spiral[y]<<endl;
    if(n>1)cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#define N 100010
int father[N];
int findfather(int x){
    if(x == father[x]) return x;
    else return findfather(father[x]);
}
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    for(int i = 0; i < n; i++) {
        father[i] = i;
    }
    for(int k = 0; k < m; k++){
        int a, b;
        scanf("%d %d", &a, &b);
        father[findfather(b)] = findfather(a);
    }

//    for(int i = 0; i < n; i++){
//        printf("i = %d father = %d\n", i, father[i]);
//    }
    int q;
    scanf("%d", &q);
    for(int k = 1; k <= q; k++){
        int x, y;
        scanf("%d %d", &x, &y);
        if(findfather(x) == findfather(y)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


Measured memory_bytes: 3080
import math
N = int(input())
S = [input() for i in range(N)]

def soort(s):
    new_str_list = sorted(s)
    new_str = ''.join(new_str_list)
    return new_str

A = []
for i in range(N):
    A.append(soort(S[i]))
B = {}  
for i in A:
    B[i] = 0

for i in A:
    B[i] +=1
def combinations_count(n):
    return math.factorial(n)//(math.factorial(n-2)*2)
sum = 0
for i in B.values():
    if i == 1:
        sum +=0
    else:
        sum += combinations_count(i)
  
print(sum)    

Measured memory_bytes: 26716
import sys
input = sys.stdin.readline

N = int(input())
adj = [[] for i in range(N)]
ran = [0]*N
ans = [0]*(N-1)
for i in range(N-1):
    a,b = [int(i)-1 for i in input().split()]
    adj[a].append([b,i])
    adj[b].append([a,i])
    ran[a]+=1
    ran[b]+=1
K = max(ran)
ind = ran.index(K)
print(K)

que = [[ind,0]]
while len(que)!=0:
    i,c = que.pop(0)
    col = 1
    for jlis in adj[i]:
        if col == c:
            col += 1
        if ans[jlis[1]]==0:
            ans[jlis[1]] = col
            que.append([jlis[0],col])
            col += 1
print("\n".join([str(i) for i in ans]))

Measured memory_bytes: 52016
a,b,c,d = map(int,input().split())
taka_hp=a-d
aoki_hp=c-b
while True:
    if  aoki_hp <=0:
        print("Yes")
        exit()
    else:
        aoki_hp -= b
        if taka_hp <= 0:
            print("No")
            exit()
        else:
            taka_hp -= d

Measured memory_bytes: 61620
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
    return *(int*)a-*(int*)b;
}
int main(void){
    char s[4];
    int a=0;
    int i;
    scanf("%s",s);
    for(i=0;i<4;i++){
        if(s[i]=='+')a++;
        else a--;
    }
    printf("%d\n",a);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node{
  int key;
  struct Node *next,*prev;
};

struct Node *nil;

struct Node* listS(int key){
  struct Node *cur=nil->next;
  while(cur!=nil && cur->key!=key){
    cur=cur->next;
  }
return cur;
}

void init(){
  nil=(struct Node*)malloc(sizeof(struct Node));
  nil->next=nil;
  nil->prev=nil;
}

void pL(){
  struct Node *cur=nil->next;
  int isf=0;
  while(1){
    if(cur==nil)break;
    if(isf++>0)printf(" ");
    printf("%d",cur->key);
    cur=cur->next;
  }
printf("\n");
}

void dNode(struct Node *t){
  if(t==nil)return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}

void dFirst(){
  dNode(nil->next);
}

void dLast(){
  dNode(nil->prev);
}

void dKey(int key){
  dNode(listS(key));
}

void insert(int key){
  struct Node *x=(struct Node*)malloc(sizeof(struct Node));
  x->key=key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
}

int main(){
  int key,n,i;
  int size=0;
  char com[20];
  int np=0,nd=0;
  scanf("%d",&n);
  init();
  for(i=0;i<n;i++){
    scanf("%s%d",com,&key);
    if(com[0]=='i'){
      insert(key);
      np++;
      size++;
    }
else if(com[0]=='d'){
  if(strlen(com)>6){
    if(com[6]=='F')dFirst();
    else if(com[6]=='L')dLast();
  }
else{
  dKey(key);
  nd++;
}
size--;
}
  }
pL();
return 0;
}



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

typedef long long ll;

int main(){
  vector<int> v;
  for(int i = 0; i < 3; i++){
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
  }
  sort(v.begin(), v.end() );
  
  // v[0], v[1], v[2]
  
  int ans = 0;
  ans += v[2] - v[1];
  v[0] = v[0] + v[2] - v[1];
  v[1] = v[2];

  cerr << v[0] << " "<< v[1] << " "<< v[2] << endl;
  
  if( (v[2] - v[0]) % 2 == 0){
    ans = ans + ( v[2] - v[0] )/2;
  } else { 
    ans = ans + ( v[2] - v[0] )/2 + 2;
  }
  
  cout << ans << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 自分の得意な言語で
		// Let's チャレンジ！！

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int[][] zahyo = new int[n][d];
		double distance = 0;
		int count=0;
		int sum=0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < d; j++) {
				zahyo[i][j] = sc.nextInt();
			}
		}

		for (int i = 0; i < n-1; i++) {
			for (int k = i+1; k < n; k++) {
				for (int j = 0; j < d; j++) {
				sum += (zahyo[i][j] - zahyo[k][j]) * (zahyo[i][j] - zahyo[k][j]);
				}
				distance=Math.sqrt(sum);
				if(distance==(int)distance) count++;
				sum=0;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll gcd(ll x,ll y){
	if(y==0) return x;
	else return gcd(y,x%y);
} 
int main (){
    ll n,x;
    scanf("%lld%lld",&n,&x);
    printf("%lld\n",3ll*(n-gcd(n-x,x)));
    return 0;
}

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

int main(){
	char ch;
	while(1){scanf("%c", &ch); if(isalpha(ch)){if(isupper(ch)){printf("%c", tolower(ch));}else{printf("%c", toupper(ch));}}else{printf("%c", ch);}
	if (ch=='\n'){break;}


	}

return 0;
}

Measured memory_bytes: 1104
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)



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

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<class V, int ME> class BIT {
public:
	V bit[1<<ME],val[1<<ME];
	V operator()(int e) {if(e<0) return 0;V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
	void add(int e,V v) { val[e++]+=v; while(e<=1<<ME) bit[e-1]+=v,e+=e&-e;}
	void set(int e,V v) { add(e,v-val[e]);}
	int lower_bound(V val) {
		V tv=0; int i,ent=0;
		for(i=ME-1;i>=0;i--) if(tv+bit[ent+(1<<i)-1]<val) tv+=bit[ent+(1<<i)-1],ent+=(1<<i);
		return ent;
	}
};
BIT<ll,19> bt;

int N;
ll A[101010],B[101010],SA;
pair<ll,int> P[101010];
ll p,q=1;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i]>>B[i];
		SA+=A[i];
		P[i]={-max(A[i],B[i]),i};
	}
	sort(P,P+N);
	
	FOR(i,N) {
		bt.add(i+1,-P[i].first);
	}
	FOR(i,N) {
		bt.add(i+1,P[i].first);
		ll t=SA-B[P[i].second];
		x=bt.lower_bound(t);
		if(x<N) {
			ll lef=SA-bt(x);
			if(lef<=B[P[i].second] && lef>=0) {
				if(x>i) x--;
				
				ll tq=B[P[i].second];
				//cout<<i<<" "<<x<<" "<<1.0*lef/tq<<endl;
				ll tp=(N-x)*tq-lef;
				tq*=N;
				ll g=__gcd(tp,tq);
				tp/=g;
				tq/=g;
				//cout<<tp<<" "<<tq<<" "<<1.0*tp/tq<<endl;
				if((__int128_t)tp*q>(__int128_t)p*tq) p=tp,q=tq;
			}
		}
		
		bt.add(i+1,-P[i].first);
	}
	cout<<p<<" "<<q<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, INF = 0x3f3f3f3f;
inline int read() {
	int x = 0, f = 0; char ch = 0;
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}
int pre[N], suf[N];
char s[N]; 
int main() {
	int n = read(), k = read(), c = read();
	scanf("%s", s + 1); int len = strlen(s + 1);
	for (int i = 1, j = 0; i <= len && j <= k; i++) if (s[i] == 'o') pre[++j] = i, i += c;
	for (int i = len, j = k; i >= 1 && j; i--) if (s[i] == 'o') suf[j--] = i, i -= c;
	for (int i = 1; i <= k; i++) if (pre[i] == suf[i] && pre[i]) printf("%d\n", pre[i]);
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=long long int;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> m(h);
    for (auto &e: m) cin >> e;
    vector<vector<int>> rl(h, vector<int>(w)), cl(h, vector<int>(w));
    for (int i = 0; i < h; ++i) {
        int last = -1;
        for (int j = 0; j < w; ++j) {
            if (m[i][j] == '#') last = j;
            rl[i][j] = last;
        }
        last = w;
        for (int j = w-1; j >= 0; --j) {
            if (m[i][j] == '#') last = j;
            rl[i][j] = last - rl[i][j] - 1;
        }
    }
    for (int j = 0; j < w; ++j) {
        int last = -1;
        for (int i = 0; i < h; ++i) {
            if (m[i][j] == '#') last = i;
            cl[i][j] = last;
        }
        last = h;
        for (int i = h-1; i >= 0; --i) {
            if (m[i][j] == '#') last = i;
            cl[i][j] = last - cl[i][j] - 1;
        }
    }

    int ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (m[i][j] == '#') continue;
            ans = max(ans, rl[i][j]+cl[i][j]-1);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35712
import sys
from fractions import gcd
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
l = 1
res = 0
for x in a:
  l = x * l // gcd(x, l)
l %= mod
for x in a:
  res += l * pow(x, mod - 2, mod)
  res %= mod
print(res)


Measured memory_bytes: 67388
#include <bits/stdc++.h>
using namespace std;
int main(void){
    char s1[3],s2[3];
    for(int i=0;i<3;i++) cin >> s1[i];
    for(int i=0;i<3;i++) cin >> s2[i];
    
    if(s1[0]==s2[2]&&s1[2]==s2[0]&&s1[1]==s2[1]){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
N = int(input())
A = [int(x) - 1 for x in input().split(" ")]
B = [int(x) for x in input().split(" ")]
C = [int(x) for x in input().split(" ")]

satisfiction = 0
before_id = None
for i in range(N):
    satisfiction += B[A[i]]
    if before_id is None: pass
    elif before_id == A[i] - 1:
        satisfiction += C[before_id]
    before_id = A[i]
    
print(satisfiction)


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

using namespace std;

#define ll long long int
#define ld long double
#define MAX 1005
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846
#define Q ll _; cin >> _; while(_--)
#define endl "\n"
#define flush fflush(stdout);

int main(){

    fast

    ll i,n;
    cin >> n;
    ll a=0,b=0,c=0;
    for(i=1;i<=n;i++){
        ll a1,b1,c1;
        cin >> a1 >> b1 >> c1;
        ll a2 = a;
        ll b2 = b;
        ll c2 = c;
        a = a1 + max(b2,c2);
        b = b1 + max(a2,c2);
        c = c1 + max(a2,b2);
    }
    cout << max(a,max(b,c)) << endl;
}

//    cout << fixed << setprecision(12);


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	vector<ll> l(n), r(n);
	l[0] = v[0];
	rep(i,n-1) {
		l[i+1] = gcd(l[i], v[i+1]);
	}
	reverse(ALL(v));
	r[0] = v[0];
	rep(i,n-1) {
		r[i+1] = gcd(r[i], v[i+1]);
	}
	reverse(ALL(r));

	ll mx = 1;
	for (int i = 1; i < n-1; i++) {
		ll x = l[i-1];
		ll y = r[i+1];
		mx = max(mx, gcd(x, y));
	}
	mx = max(mx, r[1]);
	mx = max(mx, l[n-2]);
	cout << mx << endl;
}

Measured memory_bytes: 5048
# coding: utf-8


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())

    T = [0]*n
    for A in args[2::2]:
        for a in map(int, A.split()):
            T[a-1] += 1

    return str(T.count(0))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


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

int main() {
  int64_t N;
  cin>>N;
  int64_t a=10;
  int64_t answer=0;
  if(N%2==1)
    cout<<0<<endl;
  else{
    while(N>=a){
      answer+=N/a;
      a=a*5;
    }
    cout<<answer<<endl;
  }
}

Measured memory_bytes: 256