akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	int ans = 0;
	n -= k;
	ans++;

	if (n > 0) {
		k--;
		ans += (n + k - 1) / k;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
package main

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

func main() {
	N := nextInt()
	vs := make([]int, N)
	for i := 0; i < N; i++ {
		vs[i] = nextInt()
	}

	var p int
	for i := 0; i < N; i++ {
		c := nextInt()
		if vs[i] > c {
			p += vs[i] - c
		}
	}

	fmt.Println(p)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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


	int N;
	cin >> N;
	int A[300001], B[300001], C[300001];
	rep(i, 3 * N) {
		cin >> A[i];
		B[i] = A[i];
		C[i] = A[i];
	}
	reverse(C, C + 3 * N);

	ll S1[100001] = {}, S2[100001] = {};

	map<int, int> MB, MC;
	rep(i, N) {
		MB[B[i]]++;
		MC[C[i]]++;
	}

	rep(i, N) S1[0] += B[i];

	rep1(i, N) {
		if (MB.begin()->first < B[N + i - 1]) {
			S1[i] = S1[i - 1] + B[N + i - 1] - MB.begin()->first;
			MB[MB.begin()->first]--;
			if (MB[MB.begin()->first] == 0) MB.erase(MB.begin()->first);
			MB[B[N + i - 1]]++;
		}
		else {
			S1[i] = S1[i - 1];
		}
	}

	rep(i, N) S2[0] += C[i];

	rep1(i, N) {
		if ((--MC.end())->first > C[N + i - 1]) {
			S2[i] = S2[i - 1] + C[N + i - 1] - (--MC.end())->first;
			MC[(--MC.end())->first]--;
			if (MC[(--MC.end())->first] == 0) MC.erase((--MC.end())->first);
			MC[C[N + i - 1]]++;
		}
		else {
			S2[i] = S2[i - 1];
		}
	}

	ll S[100001];
	rep(i, N + 1) {
		S[i] = S1[i] - S2[N - i];
	}

	co(*max_element(S, S + N + 1));

	Would you please return 0;
}

Measured memory_bytes: 15488
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}

void out(vector<int> &v){
	for(int x : v) cout << x << " ";
}

void solve()
{
	int n;
	cin >> n;
	ll a[n];
	vector<int> x, y;
	rep(i, n) {
		cin >> a[i];
		if(i % 2) x.pb(a[i]);
		else y.pb(a[i]);
	}
	if(n % 2 == 0) {
		reverse(all(x));
		out(x);
		out(y);
	}
	else{
		reverse(all(y));
		out(y);
		out(x);
	}

}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 5904
use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }

    let mut map = HashMap::new();

    for &na in &a {
        let entry = map.entry(na).or_insert(0);
        *entry += 1;
    }

    if k >= map.len() {
        println!("{}", 0);
        return;
    } else {
        let sub = map.len() - k;
        let mut v = vec![];
        for &value in map.values() {
            v.push(value);
        }
        v.sort();
        let ans: usize = v.iter().take(sub).sum();
        println!("{}", ans);
    }
}


Measured memory_bytes: 11380
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn binary_search<F>(lb: i32, ub: i32, criterion: F) -> i32
where
    F: Fn(i32) -> bool,
{
    let mut lb = lb;
    let mut ub = ub;
    while ub - lb > 1 {
        let mid = (ub + lb) / 2;
        if criterion(mid) {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    ub
}

fn criterion_to_right(
    i: i32,
    queries: &Vec<(String, String)>,
    s: &Vec<char>,
    inversed: bool,
) -> bool {
    if i >= s.len() as i32 {
        return true;
    }
    if i < 0 {
        return false;
    }
    let mut i = i;
    for ref q in queries.iter() {
        if q.0 == s[i as usize].to_string() {
            if !inversed {
                if q.1 == "L" {
                    i -= 1;
                } else {
                    i += 1;
                }
            } else {
                if q.1 == "R" {
                    i -= 1;
                } else {
                    i += 1;
                }
            }
        }
        if i >= s.len() as i32 {
            return true;
        }
        if i < 0 {
            return false;
        }
    }
    false
}

fn main() {
    let v: Vec<usize> = read_vec();
    let (n, q) = (v[0], v[1]);
    let mut s = read::<String>().chars().collect::<Vec<_>>();

    let mut queries = Vec::new();
    for _ in 0..q {
        let v: Vec<String> = read_vec();
        // let (t, d) = (v[0], v[1]);
        // let t = t.to_digit(36).unwrap() as usize - 10;
        queries.push((v[0].clone(), v[1].clone()));
    }

    let r_idx = binary_search(-1, n as i32, |x| {
        !criterion_to_right(x, &queries, &s, false)
    });
    s.reverse();
    let l_idx = binary_search(-1, n as i32, |x| !criterion_to_right(x, &queries, &s, true));

    let removed_by_r;
    if r_idx == -1 {
        removed_by_r = 0;
    } else {
        removed_by_r = n - r_idx as usize;
    }

    let removed_by_l;
    if l_idx == -1 {
        removed_by_l = 0;
    } else {
        removed_by_l = n - l_idx as usize;
    }
    println!("{}", n - removed_by_r - removed_by_l);
}


Measured memory_bytes: 18620
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8 = { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 },
			{ 1, 1 } };
	static int[][] directions4 = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
	static int ans;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (true) {

			int N = sc.nextInt();
			int M = sc.nextInt();

			if ((N | M) == 0) {
				break;
			}
			ans = 0;
			int[] h = new int[N];
			int[] hSum = new int[N + 1];
			int[] w = new int[M];
			int[] wSum = new int[M + 1];

			hSum[0] = 0;
			for (int i = 0; i < N; i++) {
				h[i] = sc.nextInt();
				hSum[i + 1] = h[i] + hSum[i];
			}
			wSum[0] = 0;
			for (int i = 0; i < M; i++) {
				w[i] = sc.nextInt();
				wSum[i + 1] = w[i] + wSum[i];
			}

			Map<Integer, Integer> hMap = new HashMap<Integer, Integer>();
			for (int i = 0; i < N + 1; i++) {
				for (int j = i + 1; j < N + 1; j++) {
					int tmpLength = hSum[j] - hSum[i];
					if (hMap.containsKey(tmpLength)) {
						hMap.put(tmpLength, hMap.get(tmpLength) + 1);
					} else {
						hMap.put(tmpLength, 1);
					}
				}
			}

			Map<Integer, Integer> wMap = new HashMap<Integer, Integer>();
			for (int i = 0; i < M + 1; i++) {
				for (int j = i + 1; j < M + 1; j++) {
					int tmpLength = wSum[j] - wSum[i];
					if (wMap.containsKey(tmpLength)) {
						wMap.put(tmpLength, wMap.get(tmpLength) + 1);
					} else {
						wMap.put(tmpLength, 1);
					}
				}
			}

			for (int hLength : hMap.keySet()) {
				if (wMap.containsKey(hLength)) {
					ans += hMap.get(hLength) * wMap.get(hLength);
				}
			}

			System.out.println(ans);

		}

	}

	// BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for (int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	// //二分探索
	// k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray) {
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while (upperBorder - lowerBorder > 1) {
			mid = (upperBorder + lowerBorder) / 2;
			if (orderedArray[mid] <= num) {
				lowerBorder = mid;
			} else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	// 二分探索
	// k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList) {
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while (upperBorder - lowerBorder > 1) {
			mid = (upperBorder + lowerBorder) / 2;
			if (orderedList.get(mid) <= num) {
				lowerBorder = mid;
			} else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	// aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}



Measured memory_bytes: 330684
def main():
    import sys
    sys.setrecursionlimit(2000000)
    input = sys.stdin.readline

    class UnionFind():
        def __init__(self,n):
            self.n=n
            self.parents = [i for i in range(n+1)]
            self.size = [1]*(n+1)
        def find(self,x):
            if self.parents[x]==x:
                return x
            else:
                self.parents[x]=self.find(self.parents[x])
                return self.parents[x]
        def unite(self,x,y):
            xRoot = self.find(x)
            yRoot = self.find(y)
            if xRoot == yRoot:
                return
            if self.size[xRoot]>self.size[yRoot]:
                self.parents[yRoot] = xRoot
            else:
                self.parents[xRoot] = yRoot
                if self.size[xRoot] == self.size[yRoot]:
                    self.size[yRoot]+=1

    N = int(input())
    nodesX = []
    nodesY = []
    for i in range(1,N+1):
        x,y = map(int,input().split())
        nodesX.append((x,i))
        nodesY.append((y,i))
    nodesX.sort()
    nodesY.sort()
    edges = []
    for i in range(1,N):
        edges.append((nodesX[i][0]-nodesX[i-1][0],nodesX[i][1],nodesX[i-1][1]))
        edges.append((nodesY[i][0]-nodesY[i-1][0],nodesY[i][1],nodesY[i-1][1]))
    edges.sort()
    tree = UnionFind(N)
    cost = 0
    for w,s,t in edges:
        if tree.find(s)!= tree.find(t):
            tree.unite(s,t)
            cost += w
    print(cost)

main()

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

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define NCK_MAX 510000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S secon

int main(int argc, char const *argv[]) {
  int n; std::cin >> n;
  int a[81];
  bool flag=false;
  FOR(i,1,9) {
    FOR(j,1,9) if (i*j == n) flag=true;
  }

  if (flag) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=[]
for i in range(m):
  a.append(int(input()))
a=set(a)
dp=[0]*(n+1)
dp[0]=1
if 1 in a:
  dp[1]=0
else:
  dp[1]=1
for i in range(2,n+1):
  if i in a:
    dp[i]=0
  else:
    dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%1000000007)


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

using namespace std;

#define fore(i, s, e) for(int i = s; i < e; i++)


typedef long long ll;

const int N = 3500;

int n;
int a[N];

ll dp[N][N];

ll calc(int j, int k) {
    if(j > k) return 0;
    ll &r = dp[j][k];
    if(r != -1) return r;
    ll res = 0;
    res = max(a[j] - calc(j + 1, k), a[k] - calc(j, k - 1));
    // cout << i << " " << j << " " << k << "  " << res << endl;
    return r = res;
}

int main() {
    cin >> n;
    fore(i, 0, n) cin >> a[i];
    memset(dp, -1, sizeof dp);
    cout << calc(0, n - 1) << endl;
}

Measured memory_bytes: 96256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    map<string, string> mp;
    mp["Sunny"] = "Cloudy"; mp["Cloudy"] = "Rainy"; mp["Rainy"] = "Sunny";
    string s; cin>>s;
    cout << mp[s] << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
typedef pair< pairint , string> P;
//実装案　勝たなかった試合＆負けた試合のベクター　照準ソートして上から
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
bool pairCompare(const P& firstElof, const P& secondElof)
{
  if(firstElof.first.first!= secondElof.first.first)    return firstElof.first.first< secondElof.first.first;
else if(firstElof.first.second != secondElof.first.second)    return firstElof.first.second< secondElof.first.second;
else return false;
}
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
string k;
while(1){
  std::cin >> x;
  if(x==0)return 0;
  std::vector< pair < pairint ,string> > v(x);
  Rep(j,x){
      std::cin >> k;
    v[j].second=k;
    v[j].first.first=0;
    v[j].first.second=0;
    rep(i,x){
    if(i==0){

    }else{
      std::cin >> z;
      if(z==1){
        v[j].first.first+=1;
        v[j].first.second+=1;
      }
      if(z==2)v[j].first.first+=1;
    }
    }
  }
  sort(all(v),pairCompare);
  rep(i,x){
    std::cout << v[i].second << '\n';
  }
}
}



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

using namespace std;

typedef __int128 ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

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

/**
 * func: (ll) -> boolean
 * binary_search() returns the minimum element x which satisfies f(-∞) != f(x)
 * e.g.
 * i:    1 2 3 4 5 6 7 8 9
 * f(i): 0 0 0 0 0 0 1 1 1
 *                   ^
 *                   x
 */
template<class F>
ll binary__search(F func) {
    ll l = -1, r = 1;
    while (func(l) == func(r)) {
        l *= 2;
        r *= 2;
    }
    bool l_value = func(l);

    while (l != r) {
        ll m = (l + r);
        if (m % 2 == 0) m /= 2;
        else m = (m - 1) / 2;
        if (func(m) != l_value) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    return l;
}

void solve(std::vector<long long> T, std::vector<long long> A,
           std::vector<long long> B) {
    ll X = A[0] - B[0];
    ll Y = A[1] - B[1];

    ll t1 = T[0];
    ll t2 = T[1];

    if ((X < 0 && Y < 0) || (X > 0 && Y > 0)) {
        cout << 0 << endl;
        return;
    }
    if (X < 0) {
        X *= -1;
        Y *= -1;
    }


    ll tot = t1 * X + t2 * Y;

    if (tot == 0) {
        cout << "infinity" << endl;
        return;
    }

    auto across = [&](ll t) {
        if (t < 0) return true;
        ll p = t * tot;
        return p + X * t1 + Y * t2 <= 0 && 0 <= p + X * t1;
    };

    ll tm = binary__search(across) - 1;
    if (tm == -1) {
        cout << 0 << endl;
        return;
    }
    int c = 0;
    if (tm * tot + X * t1 == 0) {
        c--;
    }
    cout << (long long) (2 * binary__search(across) - 1 + c) << endl;


}

int main() {
    std::vector<long long> T(2);
    for (int i = 0; i < 2; i++) {
        scanf("%lld", &T[i]);
    }
    std::vector<long long> A(2);
    for (int i = 0; i < 2; i++) {
        scanf("%lld", &A[i]);
    }
    std::vector<long long> B(2);
    for (int i = 0; i < 2; i++) {
        scanf("%lld", &B[i]);
    }
    solve(std::move(T), std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include

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

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

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

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

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

void solve() {
	int N,M;
	cin >> N >> M;
	string str;
	cin >> str;
	reverse(str.begin(), str.end());
	vector<int> ans0(0);
	int now = 0;
	int prev = 0;

	vector<int> OK;
	for (int i = 0; i <= N; ++i) {
		if (str[i] == '0') {
			OK.push_back(i);
		}
	}
	while (now < N) {
		bool flag = false;
		int ter = now + M;
		if (ter >= N) {//ゴールしてる
			int res = N - now;
			ans0.push_back(res);
			now = N;
			break;
		}
		vector<int>::iterator pos;
		pos = lower_bound(OK.begin(), OK.end(), ter+1);
		if (pos==OK.begin() || pos == OK.begin()) {
			cout << -1 << endl;
			return;
		}

		--pos;
		int next = *pos;
		
		if (next == now) {
			cout << -1 << endl;
			return;
		}
		int temp = next;
		ans0.push_back(temp - now);
		now = temp;
	}

	int len = ans0.size();
	reverse(ans0.begin(), ans0.end());
	for (int i = 0; i < len; ++i) {
		if (i)cout << " ";
		cout << ans0[i];
	}
	cout << endl;
}

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

	solve();
}
#pragma endregion //main()


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

struct Point
{
    double x, y;
};

int koch(int n, struct Point a, struct Point b)
{
    if (n == 0)
        return 0;

    struct Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main(void)
{
    int n;
    struct Point a, b;
    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


Measured memory_bytes: 2692
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    vector<long long >v1;
    vector<long long >v2;
    int n,m;
    long long k;
    cin >> n >> m >> k;
    long long sum  = 0,num;
    for(int i=0;i<n;i++){
        cin >> num ;
        sum+=num;
        v1.push_back(sum);
        //cout << sum << endl;
    }
    sum=0;
    for(int i=0;i<m;i++){
        cin >> num ;
        sum+=num;
        v2.push_back(sum);
    }
    int ans = upper_bound(v2.begin(),v2.end(),k)-v2.begin();
    for(int i=0;i<n;i++){
        //cout << 1+i+(upper_bound(v2.begin(),v2.end(),k-v1[i])-v2.begin()) <<endl;
        if(v1[i]<=k){
            int te = (upper_bound(v2.begin(),v2.end(),k-v1[i])-v2.begin());
            ans = max(ans,1+i+te);
        }
    }
    cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 7480
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define numrep(i,n) for(int i=1;i<=n;i++)
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)
#define ll int64_t
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;

int main() {

int A,B,C,K,X,Y; cin >> A >> B >> C >> K;

if(K<=A){
cout << K << endl;
}

else{
  X=K-A;
  if(X<=B){
    cout << A << endl;
  }

  else{
    X-=B;
    cout << A-X << endl;
  }
}


return 0;

}

Measured memory_bytes: 3636
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 03/May/20 05:35:57 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int n, k;
	cin >> n >> k;
	set< int > s;
	fr (i, 0, k) {
		int d;
		cin >> d;
		fr (j, 0, d) {
			int x;
			cin >> x;
			s.insert (x);
		}
	}
	int ans = 0;
	fr (i, 1, n + 1) {
		if (s.find (i) == s.end ()) ans++;
	}
	pr (ans);
	return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define N 2000
#define maxn (N + 10)
#define maxm (maxn * 2)
#define pb push_back
#define lc (id * 2)
#define rc (id * 2 + 1)
typedef long long ll;
const ll INF = (1e8);
const ll mod = (998244353);
int a[maxn];
int main(){
    int n,k;scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;i++)scanf("%d",&a[i]);
    sort(a + 1,a + 1 + n);
    int ans = 0;
    for(int i = 1;i <= k;i++){
        ans += a[i];
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3824
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100005];
int s,d,ans;
int depth[2][100005];
void dfs(int u,int par,int _depth=0)
{
    depth[0][u]=_depth;
    for(int v:adj[u])
        if(v!=par)
            dfs(v,u,_depth+1);
}
int dfs2(int u,int par,int _depth=0)
{
    int mx=0;
    depth[1][u]=_depth;
    for(int v:adj[u])
        if(v!=par)
            mx=max(mx,dfs2(v,u,_depth+1));
    if(depth[1][u]>depth[0][u])
        ans=max(ans,depth[1][u]+mx);
    return ++mx;
}
int main()
{
    int n;
    cin>>n>>s>>d;
    for(int i=0;i<n-1;i++)
    {
        int u,v;
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(s,0);
    int x=dfs2(d,0);
    cout<<ans-1<<endl;
    return 0;
}


Measured memory_bytes: 12928
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long a = sc.nextLong();
        final long b = sc.nextLong();
        final long c = sc.nextLong();
        final long k = sc.nextLong();

        System.out.println(1 * Math.min(a, k) + -1 * Math.min(c, Math.max(0, k-a-b)));
    }
}


Measured memory_bytes: 35792
package main

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

// Simple calculater
func main() {
	sc := bufio.NewScanner(os.Stdin)
	s := ""
	for {
		sc.Scan()
		ary := strings.Split(strings.TrimSpace(sc.Text()), " ")
		op := ary[1]
		if op == "?" {
			break
		}
		a, _ := strconv.Atoi(ary[0])
		b, _ := strconv.Atoi(ary[2])
		switch op {
		case "+":
			s += fmt.Sprintf("%v\n", a+b)
		case "-":
			s += fmt.Sprintf("%v\n", a-b)
		case "*":
			s += fmt.Sprintf("%v\n", a*b)
		case "/":
			s += fmt.Sprintf("%v\n", a/b)
		}
	}
	fmt.Print(s)
}



Measured memory_bytes: 1104
using System;

namespace ABC124
{
    class Program
    {
        static int Main(string[] args)
        {
            Program.ProblemA();
            return 0;
        }

        static void ProblemA()
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            if (a == b)
            {
                Console.WriteLine(a + b);
            }
            else
            {
                Console.WriteLine(2 * Math.Max(a,b) - 1);
            }
        }
    }
}


Measured memory_bytes: 13140
import java.util.*

data class Dice(val value: List<Int>) {
    var top = 1
    var south = 2
    var east = 3
    var west = 4
    var north = 5
    var bottom = 6

    fun rolls(ds: String) {
        for (d in ds) {
            roll(d)
        }
    }

    fun roll(d: Char) {
        if (d == 'S') {
            val w = top
            top = north
            north = bottom
            bottom = south
            south = w
        } else if (d == 'N') {
            val w = top
            top = south
            south = bottom
            bottom = north
            north = w
        } else if (d == 'E') {
            val w = top
            top = west
            west = bottom
            bottom = east
            east = w
        } else if (d == 'W') {
            val w = top
            top = east
            east = bottom
            bottom = west
            west = w
        }
    }
    fun top() = this.value.get(top - 1)
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val dice = Dice(listOf(
        scanner.nextInt(),
        scanner.nextInt(),
        scanner.nextInt(),
        scanner.nextInt(),
        scanner.nextInt(),
        scanner.nextInt()))
    dice.rolls(scanner.next())

    println(dice.top())
}



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

int main()
{
    ll a,b,c,d,ans;
    cin>>a>>b>>c>>d;
    ans=max((a*c),max(max(a*d,b*c),b*d));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
import collections
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")


Measured memory_bytes: 57048
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,k,v[3];
string t;vector<int> ha;

void solve(){
    cin >> n >> k;
    cin >> v[0] >> v[1] >> v[2];
    cin >> t;
    int ans=0;
    rep(i,n){
        if(t[i]=='r'){
            ha.push_back(2);
        }
        if(t[i]=='s'){
            ha.push_back(0);
        }
        if(t[i]=='p'){
            ha.push_back(1);
        }
    }
    vector<int> c(n);
    rep(i,n){
        if(!c[i]){
            ans+=v[ha[i]];
            if(i+k<=n-1){
                if(ha[i]==ha[i+k]){
                    c[i+k]=true;
                }
            }
        }
        //out << ans << endl;
        
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 1272
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

--Input functions with ByteString
readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine


decrease :: [Integer] -> Bool
decrease [h] = True
decrease (x:y:hs)
         | x >= y = decrease (y:hs)
         | x >= y - 1 = decrease (y - 1:hs)
         | x < y  = False
         | otherwise = False

buildStairs :: [Integer] -> String
buildStairs h = if decrease (reverse h) then "Yes" else "No"

main = do
     _ <- getInt
     h <- getIntList
     putStrLn $buildStairs h


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

signed main(){
    int n, m;
    cin >> n >> m;
    if(m<2*n){
        cout << m/2 << endl;
        return 0;
    }
    // m >= 2n
    m -= 2*n;
    m /= 4;
    cout << n+m << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    n = 48 - n;
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

#define ll long long

int main() {
  char c; cin >> c;
  if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n;
  cin >> n;
  map<int,int> a;
  rep(i,n){
    int x;
    cin >> x;
    a[x]++;
  }
  /*for(auto x : a){
    cout << x.first << "," << x.second << " ";
  }
  cout << endl;
  */
  for(auto x : a){
    if(x.second>1){
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}

Measured memory_bytes: 9600
#include<iostream>
#include<cstring>
#include<sstream>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<queue>
#include<cmath>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<algorithm>
#define fi first
#define se second
#define MP make_pair
#define P pair<int,int>
#define PLL pair<ll,ll>
#define Sca(x) scanf("%d",&x)
#define Sca2(x,y) scanf("%d%d",&x,&y)
#define Sca3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define Scl(x) scanf("%lld",&x)
#define Scl2(x,y) scanf("%lld%lld",&x,&y)
#define Scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define Pri(x) printf("%d\n",x)
#define Prl(x) printf("%lld\n",x)
#define For(i,x,y) for(int i=x;i<=y;i++)
#define _For(i,x,y) for(int i=x;i>=y;i--)
#define FAST_IO std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const double Pi = acos(-1.0);
using namespace std;
template <class T>void tomax(T&a,T b){ a=max(a,b); }  
template <class T>void tomin(T&a,T b){ a=min(a,b); }
const int N=2e5+5;
struct Segt{
	#define lc (p<<1)
	#define rc (p<<1|1)
	#define MID (tree[p].l+tree[p].r)>>1
	struct Tree{
		int l,r;
		ll val;
	}tree[N<<2|1];
	void pushdown(int p){ tree[p].val=tree[lc].val+tree[rc].val; }
	void build(int l,int r,int p){
		tree[p]=Tree{l,r,0};
		if(l==r) return ;
		int mid=MID;
		if(l<=mid) build(l,mid,lc);
		if(r>mid) build(mid+1,r,rc); 
	}
	void updata(int pos,int p){
		if(tree[p].l==pos && tree[p].r==pos){
			tree[p].val++;
			return ;
		}
		int mid=MID;
		if(pos<=mid) updata(pos,lc);
		if(pos>mid) updata(pos,rc);
		pushdown(p); 
	}
	ll getans(int l,int r,int p){
		if(l>r) return 0;
		if(tree[p].l>=l&&tree[p].r<=r) return tree[p].val;
		ll ans=0;
		int mid=MID;
		if(l<=mid) ans+=getans(l,r,lc);
		if(r>mid) ans+=getans(l,r,rc);
		return ans;
	}
}t;
ll tmp[N],sum[N];
int dispersed(int n){
	sort(tmp,tmp+1+n);
	return unique(tmp,tmp+1+n)-tmp;
}
int main(){
	int n,k; Sca2(n,k);
	For(i,1,n){
		int x; Sca(x);
		tmp[i]=sum[i]=sum[i-1]+x-k;
	}
	int len=dispersed(n);
	For(i,0,n){
		sum[i]=lower_bound(tmp,tmp+len,sum[i]) - tmp + 1;
	}
	t.build(1,n+1,1);
	ll ans=0;
	For(i,0,n){
		ans+=t.getans(1,sum[i],1);
		t.updata(sum[i],1);
	}
	Prl(ans);
}






Measured memory_bytes: 12544
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;

char mat[1001][1001];
int dist[1001][1001];
queue<pii> q;

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

int main() {
	memset(dist, -1, sizeof(dist));
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < n; i++) {
		scanf("%s", mat[i]);
		for (int j = 0; j < m; j++)
			if (mat[i][j] == '#') {
				q.push({ i, j });
				dist[i][j] = 0;
			}
	}

	pii tv;
	while (!q.empty()) {
		tv = q.front();
		q.pop();

		for (int i = 0; i < 4; i++) {
			int xx = tv.first + dx[i], yy = tv.second + dy[i];
			if (xx < 0 || yy < 0 || xx >= n || yy >= m) continue;
			if (dist[xx][yy] == -1) {
				dist[xx][yy] = dist[tv.first][tv.second] + 1;
				q.push({ xx, yy });
			}
		}
	}

	printf("%d", dist[tv.first][tv.second]);
}


Measured memory_bytes: 13328
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  ll a, b, c;
  cin >> a >> b >> c;
  ll n = c - a - b;
  if (n > 0 && 4 * a * b < n * n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

int main() {
  string s,t,u;
  int a,b;
  cin >> s >> t;
  cin >> a >> b;
  cin >> u;

  if (u == s) {
    cout << a-1 << " " << b << endl;
  } else {
    cout << a << " " << b-1 << endl;
  }

  return 0;
}


Measured memory_bytes: 384
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

let inline memo2 size1 size2 f =
  let dp = Array2D.create size1 size2 None
  let rec g x y =
    match dp.[x, y] with
    | None ->
      let v = f g x y
      dp.[x, y] <- Some v
      v
    | Some v -> v
  g
// start

let gcd = memo2 300 300 <| fun gcd a b ->
  if b=0 then a
  elif a<b then gcd b a
  else gcd b (a%b)

let K =readInt()

seq {
  for a in 1..K do
    for b in 1..K do
      for c in 1..K do
        yield int64 (gcd a (gcd b c))
}
|> Seq.sum
|> printfn"%d"


Measured memory_bytes: 34808
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    if (v[0] * v[1]) % 2 == 1 {
        println!("Odd");
    } else {
        println!("Even");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> d(K);
    vector<int> A(N,0);
    for (int i = 0; i < K; i++)
    {
        cin >> d.at(i);
        for (int j = 0; j < d.at(i); j++)
        {
            int po;
            cin >> po;
            A.at(po-1)++; 
        }
    }
    int count = 0;
    for (int i = 0; i < N; i++)
    {
        if (A.at(i) == 0)
        {
            count++;
        }
    }
    cout << count;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string s,t;
  cin >> s >> t;
  int ans = 2*N;
  int i = 0;
  while(i<N){
  bool b = true;
    for(int j = 0; i+j<N; j++){
      if(s.at(i+j) !=t.at(j)){
        b = false;
      }
    }
      if(b == true){
        cout << ans -(N-i) << endl;
        return 0;
      }
      else{
        i ++;
      }
      }
    cout << 2*N << endl;
  }

Measured memory_bytes: 256
import heapq
N = int(input())
a = list(map(int,input().split()))
fa = a[:N:]
ba = list(map(lambda x: x*(-1), a[2*N::]))
heapq.heapify(fa)
heapq.heapify(ba)
sumf = sum(fa)
sumb = sum(ba)
suml = [sumf]

k = -2

for i in range(N, 2*N):
    heapq.heappush(fa, a[i])
    sumf += a[i]
    sumf -= heapq.heappop(fa)
    suml.append(sumf)

suml[-1] += sumb

for j in range(2*N-1, N-1, -1):
        heapq.heappush(ba, -a[j])
        sumb -= a[j]
        sumb -= heapq.heappop(ba)
        suml[k] += sumb
        k -= 1
    


print(max(suml))
    


Measured memory_bytes: 121360
#include<iostream>

using namespace std;

int main()
{
  string s;
  int a[10],b[10];
  for(;cin>>s;)
    {
      for(int i=0;i<10;i++)
	a[i]=s[i]-'0';
      for(int i=9;i>0;i--)
	{
	  for(int j=0;j<i;j++)
	    b[j]=(a[j]+a[j+1])%10;
	  for(int j=0;j<i;j++)
	    a[j]=b[j];
	}
      cout<<a[0]<<endl;
    }    
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N,T,A;
  cin>>N>>T>>A;
  ll H[N];
  long double h=500*(T-A)/3;
  long double ABS=INF;
  ll ans;
  rep(i,N){
    cin>>H[i];
    if(ABS>abs(h-H[i])){
      ABS=abs(h-H[i]);
      ans=i+1;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3628
n,a,b = map(int,input().split())
mod = 1000000007
ans = pow(2,n,mod) - 1

def fur(n,k):
    p,q = 1,1
    for i in range(k):
        p = p * (n-i) % mod
        q = q * (i+1) % mod
    return p * pow(q,mod-2,mod) % mod

print((ans - fur(n,a) - fur(n,b)) %  mod)

Measured memory_bytes: 3064
<?php

fscanf(STDIN, '%d', $N);
$line = trim(fgets(STDIN));
$arr = explode(' ', $line);
for ($i = 0, $len = count($arr), $cnt = 0; $i < $len; $i++) {
    for ($j = $len - 1; $j > $i; $j--) {
        $tmp = $arr[$j];
        if ($arr[$j - 1] > $tmp) {
            $arr[$j] = $arr[$j - 1];
            $arr[$j - 1] = $tmp;
            $cnt++;
        }
    }
}
echo implode(' ', $arr), PHP_EOL, $cnt, PHP_EOL;

Measured memory_bytes: 6608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define fi first
#define se second
#define INF 1000000009
#define lINF 1000000000000000009
typedef long long ll;

int main(){
  int x;
  cin>>x;
  if(x<1200){
    cout<<"ABC"<<endl;
  }
  else{
    cout<<"ARC"<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>


using namespace std;


int main()
{
    int x,y,a,b,c,d,e,ans=0;
    cin>>x>>y;
    for(int i=x;i<=y;i++)
    {
    a=i/10000;
    b=i/1000%10;
    c=i/100%10;
    d=i/10%10;
    e=i%10;
    if(a==e && b==d)
    ans++;
    }
    cout<<ans;  

    return 0;
}     
     

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N;
	cin >> N;
	vi A(N);
	rep(i, N)
		cin >> A[i];
	vi Adec;
	int M = 0;
	rep(i, N - 1) {
		if (A[i] >= A[i + 1]) {
			Adec.push_back(A[i + 1]);
			M++;
		}
	}
	if (M == 0) {
		cout << "1" << endl;
		return 0;
	}
	int L = 1;
	int R = InfL * 2;
	while (1) {
		int anstmp = (L + R) / 2;
		if (L == anstmp)
			break;
		map<int, int> Stmp;
		bool can = true;
		rep(i, M) {
			int Atmp = Adec[i];
			for (auto it = Stmp.upper_bound(Atmp); it != Stmp.end();)
				Stmp.erase(it++);
			while (1) {
				Stmp[Atmp]++;
				if (Stmp[Atmp] >= anstmp) {
					Stmp[Atmp] = 0;
					if (Atmp == 1) {
						can = false;
						break;
					}
					Atmp--;
				}
				else
					break;
			}
		}
		if (can)
			R = anstmp;
		else
			L = anstmp;
	}
	int ans = R;
	cout << ans << endl;
	return 0;
}

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

int main(){
	int Q, c, a, n, s[110] = {}, t;
	
	cin>>Q;

	for(int i = 0; i < Q; i++){
		cin>>c>>a>>n;

		t = min(c, a);
		t = min(t, n);
		c -= t; a-= t; n-= t;
		s[i] += t;

		t = min(c / 2 , a);
		c -= t * 2; a -= t;
		s[i] += t;
		
		s[i] += c/3;
		
	}
	for(int i = 0; i < Q; i++){
		cout<<s[i]<<endl;
	}
	return 0;
}



Measured memory_bytes: 3100
import sys


def main():
    n, m = map(int, input().split())

    ans = 1

    for i in range(1, m + 1):
        if i*i > m:
            break
        if m % i == 0 and i * n <= m:
            ans = max(ans, i)

            if (m // i) * n <= m:
                ans = m // i
                break

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import heapq

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
L = []
ans = 0

heapq.heappush(L, -A[0])

for i in range(1, N):
    max = heapq.heappop(L)
    max *= -1
    ans += max
    heapq.heappush(L, -A[i])
    heapq.heappush(L, -A[i])

print(ans)



Measured memory_bytes: 31732