akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;

namespace ABC130B
{
    static class Program
    {
        static void Main(string[] args)
        {
            var line = ReadLine()?.SplitTryParseToList<int>();
            var list = ReadLine()?.SplitTryParseToList<int>();


            list?.Insert(0, 0); // 先頭に挿入
            for (int i = 1; i < list?.Count; i++)
            {
                list[i] += list[i - 1];
            }

            WriteLine(list?.Count(x => x <= line[1]));
        }

        public static T TryParse<T>(this String input)
        {
            try
            {
                var converter = TypeDescriptor.GetConverter(typeof(T));
                return (T)converter.ConvertFromString(input);
            }
            catch
            {
                throw new InvalidCastException(typeof(T) + " is not supported.");
            }
        }

        public static List<T> SplitTryParseToList<T>(this String input)
        {
            return input.Split().Select(n => n.TryParse<T>()).ToList();
        }

        public static List<T> ListSwap<T>(this List<T> list, Int32 index1, Int32 index2)
        {
            var t = list[index1];
            list[index1] = list[index2];
            list[index2] = t;
            return list;
        }

        public static List<Tuple<T, int>> DuplicateCount<T>(this IEnumerable<T> list)
        {
            return list
                .GroupBy(i => i)
                .Where(g => g.Any())
                .Select(g => Tuple.Create(g.Key, g.Count()))
                .ToList();
        }
        public static List<Tuple<T, int>> DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list)
        {
            return list.OrderByDescending((x) => x.Item2).ToList();
        }
        public static List<T> ReadLineOne<T>(int n)
        {
            var list = new List<T>();
            foreach (var i in Enumerable.Range(1, n))
            {
                list.Add(Console.ReadLine().TryParse<T>());
            }
            return list;
        }
        public static void PrintAll<T>(this IEnumerable<T> list)
        {
            foreach (var i in list)
            {
                Console.Write($"{i} ");
            }

            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 14548
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <iomanip>
#include <set>
using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define SORT(s) sort((s).begin(),(s).end())

int main(){
    ll A,B; cin >> A >> B;
    if((A*B)%2==0) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 3564
#include <stdio.h>
int main(void){
   char a[10];
   int j,i,max;
 fgets(a,10,stdin);
 for(i=0;i<=4;i=i+2){
     if(i==4)break;
     for(j=i+2;j<=4;j=j+2){
     if(a[i]<a[j]){
         max=a[j];
         a[j]=a[i];
         a[i]=max;
     }
     }
 }
 int k=a[0]-'0';
 int kk=a[2]-'0';
 int kkk=a[4]-'0';
 
 max=10*k+kk+kkk;
   printf("%d",max);
  return 0;
}


Measured memory_bytes: 128
//RUPC-B
#include<stdio.h>
typedef struct dice{
	int n,m,np[105];
	double p[105],e,s;
}DICE;
DICE a[15];
int main(){
	int i,j,t;
	double aa=0.0000000001;
	//printf("%lf\n",aa);
	scanf("%d",&t);
	for(i=1;i<=t;i++){
		scanf("%d%d",&a[i].n,&a[i].m);
		a[i].s=a[i].e=0.0;
		for(j=0;j<a[i].m;j++){
			scanf("%d %lf",&a[i].np[j],&a[i].p[j]);
			a[i].s+=a[i].p[j];
			//a[i].e+=(double)a[i].np[j]*a[i].p[j];
		}
		for(j=0;j<a[i].m;j++){
			a[i].e+=(double)a[i].np[j]*(a[i].p[j]/a[i].s);
		}
		//printf("%d:%lf\n",i,a[i].e);
	}
	scanf("%d%d",&a[0].n,&a[0].m);
	a[0].e=0.0;
	for(j=0;j<a[0].m;j++){
		scanf("%d%lf",&a[0].np[j],&a[0].p[j]);
		a[0].s+=a[0].p[j];
		//a[0].e+=a[0].np[j]*a[0].p[j];
	}
	for(j=0;j<a[0].m;j++)a[0].e+=a[0].np[j]*(a[0].p[j]/a[0].s);
	//printf("%d:%lf\n",0,a[0].e);
	
	for(i=1;i<=t;i++)if(a[i].e-a[0].e>0.0000001)break;
	printf("%s\n",(i==t+1)?"NO":"YES");
	return 0;
}

Measured memory_bytes: 0
def answer(H,W,ans):
    global ans_list
    for x in range(1,W):
        y1 = H // 2
        S1 = [H * x,(W - x) * y1,(W - x) * (H - y1)]
        ans_list.append(max(S1)-min(S1))

        y2 = (W - x) // 2
        S2 = [H * x,H * y2,H * (W - x - y2)]
        ans_list.append(max(S2)-min(S2))

if __name__ == '__main__':
    H,W = [int(i) for i in input().split()]
    ans_list = []
    answer(H,W,ans_list)
    answer(W,H,ans_list)

    print(min(ans_list))


Measured memory_bytes: 24592
#include <stdio.h>
int main(void) {
    int num,c1,m1,s1,m2,s2,m3,s3,m4,s4,tempt,cf,tf,cs,ts,cb,tb,cl,tl,i;
    while (1) {
        scanf("%d",&num);
        if (num==0) break;
        tf=14400,ts=14400,tb=-1,tl=-1;
        for (i=0; i<num; i++) {
            scanf("%d %d %d %d %d %d %d %d %d",&c1,&m1,&s1,&m2,&s2,&m3,&s3,&m4,&s4);
            tempt=(m1+m2+m3+m4)*60+s1+s2+s3+s4;
            if (tempt<tf) {
                cs=cf;
                ts=tf;
                cf=c1;
                tf=tempt;
            } else if (tempt<ts) {
                cs=c1;
                ts=tempt;
            }
            if (tempt>tl) {
                cb=cl;
                tb=tl;
                cl=c1;
                tl=tempt;
            } else if (tempt>tb) {
                cb=c1;
                tb=tempt;
            }
        }
        printf("%d\n%d\n%d\n",cf,cs,cb);
    }
    return 0;
}

Measured memory_bytes: 600
object Main extends App {
    for (Array(a, b, n) <- io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))) {
        var i = n
        var rem = a % b
        var res = 0
        while (i > 0) {
            rem *= 10
            res += rem / b
            rem %= b
            i -= 1
        }
        println(res)
    }
}

Measured memory_bytes: 44252
from collections import deque

def main():
    s = input()
    ans = deque()

    for i in s:
        if i == '0' or i == '1':
            ans.append(i)
        elif i == 'B' and len(ans)>0:
            ans.pop()

    print(''.join(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b;

    return 0;
}


Measured memory_bytes: 3672
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  if(n==1){
    cout<<1<<ENDL;
    cout<<0<<ENDL;
  }else if(n==2){
    cout<<2<<ENDL;
    cout<<0<<ENDL;
    cout<<11<<ENDL;
  }else{
    string s(n,'0');
    s[0]='1';
    s.back()='1';
    cout<<n-1<<ENDL;
    while(s.size()>1){
      cout<<s<<ENDL;
      s.pop_back();
      s.back()='1';
    }
  }
  

}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?


Measured memory_bytes: 3236
#include <iostream>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <math.h>
#include <stdio.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
int n,x,y;
vector<pair<int,int>> p;
int kaijo(int x){
    if(x==0)return 1;
    return kaijo(x-1)*x;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>x>>y,p.push_back(make_pair(x,y));
    double sum=0.0;
    sort(p.begin(),p.end());
    do{
        for(int i=1;i<n;i++){
            sum+=sqrt((p[i-1].f-p[i].f)*(p[i-1].f-p[i].f)+(p[i-1].s-p[i].s)*(p[i-1].s-p[i].s));
        }
    }while(next_permutation(p.begin(),p.end()));
    printf("%.10f\n",sum/kaijo(n));
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int m,a,b;
	cin >> m >> a >> b;
	if(b>a+m)
		cout << b-a-m << endl;
	else if(b+m<a)
		cout << a-m-b << endl;
	else
		cout << "0" << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    num = int(input())
    data = [int(input()) for i in range(num)]
    data.sort()
    ans = sum(data)
    if ans % 10 == 0:
        for ele in data:
            if ele % 10 != 0:
                ans -= ele
                break

    if ans % 10 == 0:
        print(0)
    else:
        print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int MAX = 1e6;
const int INF = 2e9;
typedef long long ll;

unsigned int h, w, k;
char choco[11][1002];

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

    cin >> h >> w >> k;
    for (int i = 0; i < h; ++i)
    {
        cin >> choco[i];
    }

    int minCut = INF;
    for (int mask = 0; mask < 1u << (h - 1); ++mask)
    {
        int cut = __builtin_popcount(mask);
        vector<int> whites(cut + 1, 0);

        int wsize = 1;
        for (int j = 0; j < w; ++j)
        {
            for (int i = 0; i < h; ++i)
            {
                int wi = __builtin_popcount(mask & ((1u << i) - 1u));
                if (choco[i][j] == '1') whites[wi]++;
            }

            if (*max_element(whites.begin(), whites.end()) > k) {
                if (wsize == 1) {
                    cut = INF;
                    break;
                }

                for (auto& x :  whites) x = 0;
                cut++;
                j--;
                wsize = 1;
            } else {
                wsize++;
            }
        }

        minCut = min(minCut, cut);
    }

    cout << minCut;

    return 0;
}


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

int main() {
    double x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    printf("%lf\n",hypot(x1-x2,y1-y2));
}


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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define pb push_back

const long long MOD = 1000000007;


int main(){
    ll n, k, q;
    cin >> n >> k >> q;

    vector<ll> ks(n);
    ll a;
    rep(i, q){
        cin >> a;
        ks[a-1]++;
    }
    rep(i, n){
        if(q-ks[i] >= k){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}


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

int main() {
  int n; cin>>n;
  vector<char> a(n);
  rep(i, n) cin>>a[i];

  int ans=0;
  int tmp=0;
  rep(i, n) {
    if (a[i]=='I') tmp++;
    else tmp--;
    ans=max(ans, tmp);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    ll cnt = 0;
    ll ans;
    for(ll i = min(a,b); i >= 1; i--) {
        if (a % i == 0 && b % i == 0) cnt++;
        if (cnt == k) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    char b;
    cin >> b;
    if (b == 'A')
        cout << 'T';
    if (b == 'T')
        cout << 'A';
    if (b == 'C')
        cout << 'G';
    if (b == 'G')
        cout << 'C';
    //system("pause");
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

c0 = input()
c1 = input()
c2 = input()

print(c0[0]+c1[1]+c2[2])


Measured memory_bytes: 4468
S = input()
S = list(S)
for i in range(len(S)):
    S[i] = int(S[i])
dic = {0:1,1:0}

S1 = S[:]
S2 = S[:]

S2[0] = dic[S2[0]]
cnt1 = 0
cnt2 = 1


for i in range(len(S1)-1):
    if S1[i] == S1[i+1]:
        S1[i+1] = dic[S1[i+1]]
        cnt1 += 1



for i in range(len(S2)-1):
    if S2[i] == S2[i+1]:
        S2[i+1] = dic[S2[i+1]]
        cnt2 += 1


print(min(cnt1,cnt2))


Measured memory_bytes: 5548
from sys import stdin
input = stdin.readline

n = int(input())
P = list(map(int, input().split()))
nums = [0]
for i in range(n):
    p = P[i]
    if p == i+1 and nums[i] == 0:
        nums.append(1)
    else:
        nums.append(0)

print(nums.count(1))
    

Measured memory_bytes: 13876
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> inputList = new ArrayList<>(30);

		try {
			while (input.ready()) {
				inputList.add(Integer.valueOf(input.readLine()));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

		int maxNum = 0;
		for (int num : inputList) {
			if (maxNum < num)
				maxNum = num;
		}

		ArrayList<Integer> primeNumberList = getPrimeNumberList(maxNum);

		for (int num : inputList) {
			int primeNumberCount = 0;
			for (int i = 0; i < primeNumberList.size(); i++) {
				if (num >= primeNumberList.get(i)) {
					primeNumberCount++;
				} else {
					break;
				}
			}
			System.out.println(primeNumberCount);
		}
	}

	public static ArrayList<Integer> getPrimeNumberList(int maxNumber) {
		ArrayList<Integer> primeNumberList = new ArrayList<>();
		primeNumberList.add(2);
		primeNumberList.add(3);
		primeNumberList.add(5);
		primeNumberList.add(7);

		int[] oneDigitList = {1,3,7,9};

		int tmp;
		int sqrtTmp;
		boolean addFlag;
		for (int i = 10; i <= maxNumber; i += 10) {
			for (int oneDigit : oneDigitList) {
				addFlag = true;
				tmp = i + oneDigit;
				sqrtTmp = (int) Math.sqrt(tmp);
				for (int primeNumber : primeNumberList) {
					if (tmp % primeNumber == 0) {
						addFlag = false;
						break;
					}
					if ( sqrtTmp < primeNumber) {
						break;
					}
				}
				if (addFlag) {
					primeNumberList.add(tmp);
				}
			}
		}
		return primeNumberList;
	}
}

Measured memory_bytes: 41216
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define N 210
using namespace std;
int f[2][N][N][N];
char mp[N][N];
int main()
{
	int n,m;
	scanf("%d%d",&m,&n);
	for(int i=1;i<=m;i++)
		scanf("%s",mp[i]+1);
	int u=1;
	for(int j=1;j<=m;j++)
		for(int i=j;i;i--)
			for(int k=n;k;k--)
			if(i==j)
			{
				if(k==n) f[u][i][j][k]=n+1;
				else if(mp[i][k]==mp[i][k+1]) f[u][i][j][k]=f[u][i][j][k+1];
				else f[u][i][j][k]=k+1;
			}
			else
			{
				if(mp[j-1][k]==mp[j][k]) f[u][i][j][k]=min(f[u][i][j-1][k],f[u][j][j][k]);
				else f[u][i][j][k]=k;
			}
	int ans=0;
	while(1)
	{
		if(f[u][1][m][1]==n+1)
		{
			printf("%d\n",ans);
			return 0;
		}
		int pre=u;
		u=!u;
		for(int i=1;i<=m;i++)
			for(int j=i;j<=m;j++)
				for(int k=1;k<=n;k++)
				{
					if(f[pre][i][j][k]==n+1) f[u][i][j][k]=n+1;
					else f[u][i][j][k]=f[pre][i][j][f[pre][i][j][k]];
					int l=i,r=j;
					while(l<r)
					{
						int mid=(l+r)>>1;
						f[u][i][j][k]=max(f[u][i][j][k],min(f[pre][i][mid][k],f[pre][mid+1][j][k]));
						if(f[pre][i][mid][k]>f[pre][mid+1][j][k]) l=mid+1;
						else r=mid;
					}
				}
		ans++;
	}
	return 0;
}


Measured memory_bytes: 67456
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main() {
  ll n,T;
  cin>>n>>T;
  vector<ll> t(n);
  rep(i,n) cin>>t[i];
  ll ans=0;
  for(int i=1;i<n;i++){
    if(t[i]-t[i-1]<T) ans+=t[i]-t[i-1];
    if(t[i]-t[i-1]>=T) ans+=T;
  }
  cout<<ans+T<<endl;
}

Measured memory_bytes: 4716
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    for (int i=0; i<=n; i++)
    {
        for (int j=0; j<n; j++)
        {
            if (4*i + 7*j == n) {
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}


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

int main() {
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string week[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
    int m, d, start, count;
    while(cin >> m >> d){
        if(m==0) break;
        start = 1;
        count = 3;
        while(1){
            for(int i=1 ; i <= month[start-1] ; i++, count++){
                if(m==start && d==i) break;
            }
            if(m==start) break;
            start++;
        }
        cout << week[count%7] << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

A_cnt = [1] * N
A_sum = [i+1 for i in range(N)]
A_sum.append(0)
B_cnt = [0] * N
B_sum = [0] * N
C_cnt = [0] * N
C_sum = [0] * N

for i in range(N):
    key = B[i]
    ok = -1
    ng = N
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if A[mid] < key:
            ok = mid
        else:
            ng = mid
    B_cnt[i] = A_sum[ok]

B_sum[0] = B_cnt[0]
for i in range(1, N):
    B_sum[i] = B_sum[i-1] + B_cnt[i]
B_sum.append(0)

for i in range(N):
    key = C[i]
    ok = -1
    ng = N
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if B[mid] < key:
            ok = mid
        else:
            ng = mid
    C_cnt[i] = B_sum[ok]

C_sum[0] = C_cnt[0]
for i in range(1, N):
    C_sum[i] = C_sum[i-1] + C_cnt[i]

print(C_sum[-1])

# print(A)
# print(B)
# print(C)
# print(A_cnt)
# print(B_cnt)
# print(C_cnt)
# print(A_sum)
# print(B_sum)
# print(C_sum)

Measured memory_bytes: 39108
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

bool isPrime(int x) {
    if (x == 1) return false;
    bool ans = true;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) ans = false;
    }
    return ans;
}

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, n) {
        int x;
        cin >> x;
        if (isPrime(x)) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using i64 = long long;

int N;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);

  cin>>N;
  int res=0;
  rep(i,0,N) {
    int x;
    cin>>x;
    res+=x-1;
  }
  cout<<res<<"\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        for (int i = 0; i < num; i++) {
            String[] str = new String[2];
            int[] ans = new int[2];
            for (int j = 0; j < 2; j++) {
                ans[j] = 0;
                str[j] = scan.next();
                for (int k = 0; k < str[j].length(); k = k + 2) {
                    String hoge = String.valueOf(str[j].charAt(k));
                    try {
                        String huga = String.valueOf(str[j].charAt(k + 1));
                        ans[j] = ans[j] + Integer.parseInt(hoge) * changeChar(huga);
                    } catch (Exception e) {
                        ans[j] = ans[j] + changeChar(hoge);
                        k--;
                    }
                }
            }
//            System.out.println((ans[0] + ans[1]));
            System.out.println(returnChar(ans[0] + ans[1]));

        }
    }

    public static String returnChar(int n) {
        String str = "";
        int data = 1000;
        while (true) {
            if (n / data >= 1) {
                if (n / data >= 2) {
                    str = str + n / data;
                }
                if (data == 1000) {
                    str = str + "m";
                }
                if (data == 100) {
                    str = str + "c";
                }
                if (data == 10) {
                    str = str + "x";
                }
                if (data == 1) {
                    str = str + "i";
                }
                n = n - (n / data) * data;
            }
            if (data == 1) {
                break;
            }
            data = data / 10;
        }
        return str;
    }

    public static int changeChar(String str) {
        if (str.equals("m")) {
            return 1000;
        }
        if (str.equals("c")) {
            return 100;
        }
        if (str.equals("x")) {
            return 10;
        }
        return 1;

    }
}


Measured memory_bytes: 41952
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};


int main(int argc, char const *argv[]) {
  string S;
  int cnt=0,i=0;
  std::cin >> S;

  while(i<S.size()){
    if(S[i]!=S[i+1]) cnt++;
    i++;
  }
  std::cout << cnt-1 << '\n';
  return 0;
}


Measured memory_bytes: 512
A = []
for _ in range(3):
    a = list(map(int, input().split()))
    A.append(a)

import numpy as np
A = np.array(A)

N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))

ans = [[False] * 3 for _ in range(3)]
ans = np.array(ans)

for b in B:
    temp = (A == b)

    ans = np.logical_or(ans, temp)


if ans[0, :].all() or ans[1, :].all() or ans[2, :].all():
    print("Yes")

elif ans[:, 0].all() or ans[:, 1].all() or ans[:, 2].all():
    print("Yes")

elif ans[0, 0] and ans[1, 1] and ans[2, 2]:
    print("Yes")
elif ans[0, 2] and ans[1, 1] and ans[2, 0]:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 21044
N=int(input())
M=str(N)
L=len(M)
A=[[] for _ in range(L+1)]
A[0]=[""]

cnt=0
for i in range(1,L+1):
  for a in A[i-1]:
    b = a+"3"
    c=  a+"5"
    d=  a+"7"
    if int(b) <= N:
      A[i].append(b)
    if int(c) <= N:
      A[i].append(c)
    if int(d) <= N:
      A[i].append(d)
  for item in A[i]:
    if item.count("3")>=1 and item.count("5")>=1 and item.count("7")>=1:
      cnt+=1
print(cnt)

Measured memory_bytes: 5228
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(std::string S){
  if(S=="ABC"){
    cout<<"ARC"<<endl;
  }else{
    cout<<"ABC"<<endl;
  }
}

int main(){
  cout<<setprecision(1000);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	ll h, w;
	ll ans = INF;
	cin >> h >> w;
	for(int i=1; i<h; i++){
		ll a = w*i;
		ll b = (h-i)*(w/2);
		ll c = (h-i)*(w - (w/2));
		ll ma = max(a, max(b, c));
		ll mi = min(a, min(b, c));

		if(h - i >= 2){
			ll a2 = w*i;
			ll b2 = ((h-i)/2)*w;
			ll c2 = (h-i - ((h-i)/2))*w;
			ll ma2 = max(a2, max(b2, c2));
			ll mi2 = min(a2, min(b2, c2));

			//printf("%lld %lld %lld\n", a, b, c);
			//printf("%lld %lld %lld\n", a2, b2, c2);
			ans = min(ans, min(ma - mi, ma2 - mi2));
		}else{
			//printf("%lld %lld %lld\n", a, b, c);
			ans = min(ans, ma - mi);
		}
	}
	int t = w;
	w = h;
	h = t;
	for(int i=1; i<h; i++){
		ll a = w*i;
		ll b = (h-i)*(w/2);
		ll c = (h-i)*(w - (w/2));
		ll ma = max(a, max(b, c));
		ll mi = min(a, min(b, c));

		if(h - i >= 2){
			ll a2 = w*i;
			ll b2 = ((h-i)/2)*w;
			ll c2 = (h-i - ((h-i)/2))*w;
			ll ma2 = max(a2, max(b2, c2));
			ll mi2 = min(a2, min(b2, c2));

			//printf("%lld %lld %lld\n", a, b, c);
			//printf("%lld %lld %lld\n", a2, b2, c2);
			ans = min(ans, min(ma - mi, ma2 - mi2));
		}else{
			//printf("%lld %lld %lld\n", a, b, c);
			ans = min(ans, ma - mi);
		}
	}
	cout << ans << endl;

	
	return 0;
}


Measured memory_bytes: 256
max_n=2000
mod=10**9+7

frac=[1]
for i in range(1,max_n+1):
  frac.append((frac[-1]*i)%mod)

inv=[1,1]
inv_frac=[1,1]
for i in range(2,max_n):
  inv.append((mod-inv[mod%i]*(mod//i))%mod)
  inv_frac.append((inv_frac[-1]*inv[-1])%mod)
  
def perm(m,n):
  if m<n:
    return 0
  if m==1:
    return 1
  return (frac[m]*inv_frac[m-n])%mod

def comb(m,n):
  if m<n:
    return 0
  if m==1:
    return 1
  return (frac[m]*inv_frac[n]*inv_frac[m-n])%mod

n,k=map(int,input().split())


for i in range(1,k+1):
  print((comb(n-k+1,i)*comb(k-1,i-1))%mod)



Measured memory_bytes: 74592
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        N = cin.nextint;
        if (N % 10 == 9 || N / 10 == 9)
        {
            WriteLine("Yes");
        }
        else
        {
            WriteLine("No");
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11216
fun main(args : Array<String>) {
    val (A, B) = readLine()!!.split(" ").map { it.toLong() }
    var answer = 0L
    var count = 0
    var maxDigit = 0
    while (true) {
        val a = 1L
        if (a.shl(count) > B) {
            maxDigit = count
            break
        }
        count++
    }
    (1..Math.max(maxDigit, 1)).forEach { digit ->
        val sumA = sum(A - 1, digit)
        val sumB = sum(B, digit)
        answer += Math.abs(sumB - sumA) * Math.pow(2.toDouble(), (digit - 1).toDouble()).toLong()
    }
    println(answer)
}

fun sum(num: Long, digit: Int) : Int {
    if (num == -1L) {
        return 0
    }

    if (digit == 1) {
        if (num.mod(4) == 1L || num.mod(4) == 2L) {
            return 1
        } else {
            return 0
        }
    }

    val freq = Math.pow(2.toDouble(), digit.toDouble()).toLong()
    val mod = num.mod(freq)
    if (mod < freq / 2) {
        return 0
    }

    if ((mod - freq / 2).mod(2) == 0L) {
        return 1
    } else {
        return 0
    }
}

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

int main() {
  long long int N;
  string S;
  cin >> N >> S;
  int arr[26];
  for (int i=0; i<26; i++) arr[i] = 1;
  for (int i=0; i<S.size(); i++) {
    char c = S[i];
    int j = (int)(c - 97);
    arr[j]++;
  }
 
  long long int ans = 1;
  for (int i=0; i<26; i++) {
    ans *= arr[i];
    ans %= 1000000007;
  }
 
  cout << ans - 1 << endl;
 
  return 0;
}


Measured memory_bytes: 512
import math
def calc(u,v):
    return math.sqrt((u[0]-v[0])**2 + (u[1]-v[1])**2)
import itertools
N = int(input())
XY = [list(map(int,input().split())) for i in range(N)]

l = [i+1 for i in range(N)]
dist = 0
for v in itertools.permutations(XY,N):
    for i in range(1,N):
        dist += calc(v[i],v[i-1])

print(dist/math.factorial(N))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s[0] == s[1]  && s[1] == s[2] && s[0] == 'R')cout<<3<<endl;
    else if(s[0] == s[1] && s[0] == 'R' || s[1] == s[2] && s[1] == 'R')cout<<2<<endl;
    else if(s[0]== 'R' || s[1] == 'R' || s[2] == 'R')cout<<1<<endl;
    else cout<<0<<endl;

    return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>
#define num 100

int main(){
  int N,i,count=0,flag,stac,A[num];

  scanf("%d",&N);

  for(i=0;i<N;i++)scanf("%d",&A[i]);

  flag=1;
  while(flag){
    flag=0;
    for(i=N-1;i>0;i--){
      if(A[i]<A[i-1]){
	stac=A[i];
	A[i]=A[i-1];
	A[i-1]=stac;
	flag=1;
	count++;
      }
    }
  }
  for(i=0;i<N-1;i++)printf("%d ",A[i]);
  printf("%d\n%d\n",A[N-1],count);

  return 0;
}

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

int main(){
  int N, K;
  double sum = 0, avg = 0, cent = 100;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    sum += a[i];
  }
  avg = sum/N;
  for(int i = 0; i < N; i++){
    double tmp = abs(a[i] - avg);
    if(tmp < cent){
      cent = tmp;
      K = i;
    }
  }
/*
  vector<char> S(N);
  for(int i = 0; i < N; i++)
    cin >> S.at(i);
*/
  cout << K << endl;
}

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

int main(){
 int K,N;
  cin >> K >> N;
  vector<long long> A(2*N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    A.at(i+N)=A.at(i)+K;
  }
  long long mincost=1e9;
  for(int i=0;i<N;i++){
    long long cost=A.at(i+N-1)-A.at(i);
    mincost=min(mincost,cost);
  }
  cout << mincost << endl;
}

Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io
   
   int n, x, t;
   cin >> n >> x >> t;
   int cnt = 0;
   int ans =0;
   while(cnt < n){
       cnt += x;
       ans += t;
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if( a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0 ){
		cout << "P";
	} else {
		cout << "Imp";
	}
	cout << "ossible" << endl;
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
arr = gets.split(' ').map(&:to_i)

ds = [0, (arr[0] - arr[1]).abs]

(2...n).each do |i|
  ds << [ds[i-2] + (arr[i-2] - arr[i]).abs, ds[i-1] + (arr[i-1] - arr[i]).abs].min
end

puts ds[-1]

Measured memory_bytes: 11396
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i, n) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    ll right = d[n/2];
    ll left = d[n/2-1];
    cout << right - left << endl;

}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int X,Y;
int dp[20][20];
char maps[20][20];
int bun(int x,int y);
int dx[3]={-1,0,1};
main(){
  while(1){
    cin>>X>>Y;
    if(X==0&&Y==0){
      break;
    }
    for(int i=1;i<=Y;i++){
      for(int j=1;j<=X;j++){
    cin>>maps[i][j];
    dp[i][j]=0;
      }
    }
    int ans=0;
    for(int i=1;i<=X;i++){
      if(maps[1][i]!='1'){
    ans+=bun(1,i);
      }
    }
    cout<<ans<<endl;
  }
}
int bun(int y,int x){
  if(y>=Y){
    return 1;
  }
  else if(dp[y][x]!=0){
    return dp[y][x];
  }
  else if(maps[y][x]=='2'){
    if(maps[y+2][x]!='1'){
      return dp[y][x]=bun(y+2,x);
    }
    else{
      return 0;
    }
  }
  else if(maps[y][x]=='1'){
    return 0;
  }
  else{
    int anss=0;
    for(int i=0;i<3;i++){
      int nx=x+dx[i];
      if(i!=1){
    if(nx>0&&nx<=X&&maps[y+1][nx]=='0'){
      anss+=bun(y+1,nx);
    }
      }
      else{
    if(maps[y+1][nx]!='1'){
      anss+=bun(y+1,nx);
    }
      }
    }
    return dp[y][x]=anss;
  }       
}

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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

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

  int N;
  cin >> N;
  cout << ((N) ? 0 : 1) << "\n";
}

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

class Node:
    def __init__(self):
        self.nxt = [-1] * 26
        self.is_end = False

nodes = [Node()]
N = int(input())
S = [input().rstrip()[::-1] for _ in range(N)]
paths = [[] for _ in range(N)]
for i, s in enumerate(S):
    node = 0
    for c in s:
        c = ord(c) - ord('a')
        paths[i].append(node)
        if nodes[node].nxt[c] == -1:
            nodes[node].nxt[c] = len(nodes)
            nodes.append(Node())
        node = nodes[node].nxt[c]
    nodes[node].is_end = True

ans = 0
for i, s in enumerate(S):
    suffix = set()
    for j in range(len(s) - 1, -1, -1):
        suffix.add(ord(s[j]) - ord('a'))
        node = paths[i][j]
        for c in suffix:
            if nodes[node].nxt[c] != -1:
                ans += nodes[nodes[node].nxt[c]].is_end
print(ans - N)

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

int main(){
  int N,M;
  std::cin>>N>>M;
  std::vector<int>H(N);
  std::vector<int>copy_H(N);
  for(int i=0;i<N;i++){
    std::cin>>H[i];
    copy_H[i]=0;
  }
  for(int i=0;i<M;i++){
	int a,b;
    std::cin>>a>>b;
    //std::cout<<"start:"<<H[a-1]<<" "<<H[b-1]<<std::endl;
    copy_H[a-1]=std::max(copy_H[a-1],H[b-1]);
    copy_H[b-1]=std::max(H[a-1],copy_H[b-1]);
    //std::cout<<"end:"<<H[a-1]<<" "<<H[b-1]<<std::endl;
  }
  int count=0;
  for(int i=0;i<H.size();i++){
    if(H[i]>copy_H[i]){
      count++;
    }
  }
  /*for(int i=0;i<N;i++){
    std::cout<<copy_H[i]<<" ";
  }
  std::cout<<std::endl;*/
  std::cout<<count<<std::endl;
  return 0;
}
    




Measured memory_bytes: 4056
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pll pair<ll,ll>
#define P push
#define R return
#define C continue
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define SI size()
#define F first
#define S second
#define B begin()
#define E end()
#define W while
using namespace std;
long long MOD=1e9+7;
long long INF=1e16+7;
char c1[55][55],c2[55][55];
int main()
{
    ll n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>c1[i][j];
    for(int i=0;i<m;i++)
        for(int j=0;j<m;j++)
            cin>>c2[i][j];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if((i+m)>n||(j+m)>n)C;
            bool b=1;
            for(int i1=i;i1<(i+m);i1++){
                for(int j1=j;j1<(j+m);j1++){
                    if(c1[i1][j1]!=c2[i1-i][j1-j])b=0;
                }
            }
            if(b)R cout<<"Yes",0;
        }
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define int ll
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/4
#define INTINF INT_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T &a, T b){if(a < b){a = b;return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a > b){a = b;return true;}return false;}
/*----------------------------------------------------------------*/
// int MOD = 998244353;
int MOD = 1000000007;

/*----------------------------------------------------------------*/
signed main(){
	
	int n,c,k;
	cin >> n >> k >> c;
	string s;
	cin >> s;

	vll L(n,-1);
	vll R(n,-1);
	
	int day = 0;
	int cnt = 1;
	while(day < n){
		if(s[day] == 'x'){
			day++;
		}else if(s[day] == 'o'){
			L[day] = cnt;
			cnt++;
			day += c+1;
		}
	}
	day = n-1;
	cnt = k;
	while(day >= 0){
		if(s[day] == 'x'){
			day--;
		}else if(s[day] == 'o'){
			R[day] = cnt;
			cnt--;
			day -= c+1;
		}
	}
	rep(i,n){
		if(L[i] != -1 && L[i] == R[i]){
			cout << i+1 << endl;
		}
	}
	// debug_vec(L);
	// debug_vec(R);



	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl 


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int sum = 0, max_val = 0;
    int n; cin >> n;
    while (n--) {
        int tmp; cin >> tmp;
        sum += tmp;
        max_val = max(max_val, tmp);
    }
    
    cout << (sum - max_val > max_val ? "Yes" : "No") << '\n';
    
    return 0;
}


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

int main(void)
{
  int i, j, n, m, a[10000], sum=0;
  
  scanf("%d %d", &n, &m);
  
  for( i = 0; i < m; i++ ){
    scanf("%d", &a[i]);
    sum += a[i];
  }
  
  if( sum <= n ){
    printf("%d\n", n-sum);
  } else {
    printf("-1\n");
  }

}

Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=998244353;
const ll mod=1e9+7;
signed main(){
    ll h,n;cin>>h>>n;
    vector<ll>a(n);
    vector<ll>b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    vector<vector<ll> >dp(n+1,vector<ll>(h+1,mod*mod));
    dp[0][0]=0;
    rep(i,n){
        rep(j,h+1){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            if(j+a[i]<=h){
                dp[i][j+a[i]]=min(dp[i][j+a[i]],dp[i][j]+b[i]);
            }else{
                dp[i][h]=min(dp[i][h],dp[i][j]+b[i]);
            }
        }
    }
    cout<<dp[n][h]<<endl;
}

Measured memory_bytes: 81600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))

#define INF 1000000000

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)
{
	if (a < b)
		swap(&a, &b);

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

int lcm(int a, int b)
{
	return a*b/gcd(a, b);
}

void bubble_sort(int* p, int n)
{
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[j], &p[j + 1]);
		}
	}
}

int array_max(int* p, int n)
{
	int max = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] > max)
			max = p[i];
	}
	return max;
}

int binary_search(int* p, int key, int n)
{
	int low = 0, high = n - 1;
	int middle;

	while (low <= high)
	{
		middle = (low + high) / 2;

		if (key == p[middle])
			return key;
		else if (key < p[middle])
			high = middle - 1;
		else if (key > p[middle])
			low = middle + 1;
	}
	return -1;
}

int main()
{
	int N;
	int ans = 0;
	char S[100];

	scanf("%d", &N);
	scanf("%s", S);

	for (int i = 0; i < N - 2; i++)
	{
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')
			ans++;
	}

	printf("%d\n", ans);
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.function.IntConsumer;
import java.util.function.LongSupplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final void  REP(int t,IntConsumer i){
		for(int v=0;v<t;v++)i.accept(v);
	}
	static final void RREP(int t,IntConsumer i){
		for(int v=t-1;v>=0;v--)i.accept(v);
	}
	static final IntStream REPS(int v){return IntStream.range(0, v);};
	public static void main(String[] __){
		int n=s.nextInt();
		String regex=REPS(s.nextInt()).mapToObj(i->s.next()).collect(Collectors.joining("","^[^","]+$"));
		while (!String.valueOf(n).matches(regex))
			n++;
		System.out.println(n);
	}
}


Measured memory_bytes: 59740
#include <stdio.h>
int main(){
  int K;
  int A[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  scanf("%d",&K);
  printf("%d",A[K-1]);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(ll i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	rep (i, n) cin >> a[i];
	sort(all(a));
	// bin search
	int ng = -1, ok = n;
	while (ok - ng > 1) {
		int med = (ok + ng) / 2;
		ll now = a[med];
		bool chk = true;
		rep (j, n) {
			if (med != j) {
				if (now * 2 >= a[j]) now += a[j];
				else {
					chk = false;
					break;
				}
			}
		}
		if (chk) ok = med;
		else ng = med;
	}
	cout << n - ok << "\n";
	return 0;
}

Measured memory_bytes: 640
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	int N;
  	cin >> N;
  	vector<int> H(N);
  	rep(i,N) cin >> H[i];
  
  	
  	int mx = 0;
  	rep(i,N){
    	if(H[i] < mx-1){
        	puts("No");
          	return;
        }
      	mx = max(mx,H[i]);
    }
  	puts("Yes");
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 640