akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll N;
ll A[52];
int main()
{
	scanf("%lld",&N);
	for(ll i=0;i<N;i++){
		scanf("%lld",&A[(int)i]);
	}
	ll l=-1,r=(ll)(1000000000000000000);
//	printf("%lld\n",r-l);
	while(r-l>1){
		ll c=(l+r)/2LL;
		ll cou=0LL;
		for(ll i=0LL;i<N;i++){
			cou+=max(0LL,(A[(int)i]+c+1)/(N+1LL));
		}
		//printf("c=%lld:cou=%lld\n",c,cou);
		if(cou<=c){
			r=c;
		}
		else{
			l=c;
		}
	}
	//printf("%lld\n",r);
	ll ans=max(0LL,r-(N-1LL)*N);
	while(true){
		ll c=ans;
		ll cou=0LL;
		for(ll i=0LL;i<N;i++){
			cou+=max(0LL,(A[(int)i]+c+1)/(N+1LL));
		}
		if(cou<=c){
			break;
		}
		else{
			ans++;
		}
		
	}
	printf("%lld\n",ans);
	return 0;
}


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

int jian(int n);

int flag=0;

int main()
{
	int n;
	cin>>n;
	if(n<7&&n!=4)
	{
		cout<<"No\n";
		return 0;
	}
	jian(n);
	if(flag)
	{
		cout<<"Yes\n";
		return 0;
	}
	else
	{
		cout<<"No\n";
		return 0;
	}
	return 0;
}

int jian(int n)
{
	if(n==0)
	{
		flag=1;
	}
	else if(n<0)
		return 0;
	jian(n-4);
	jian(n-7);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
long int count=0;
int tmp;
void eat(int *a, int N, int x){
	int i;
	if(a[0]>x) {
		tmp = a[0];
		a[0]=x;
		count = tmp-x;
	}
	for(i=0;i<N-1;i++){
		if(a[i]+a[i+1]>x){
			tmp = a[i+1];
			a[i+1]=x-a[i];
			count =count+tmp-a[i+1];
		}
	}
	
}

int main(void) {
	int N,x,i;
	scanf("%d %d",&N,&x);
	int a[N];
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);

	}
	
	eat(a,N,x);
	
	printf("%ld\n",count);
	
	return 0;
}


Measured memory_bytes: 512
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        A: [[usize; 3]; 3],
        N: usize,
        b: [usize; N],
    }
    let mut board = [[false; 3]; 3];
    for i in 0..N {
        for y in 0..3 {
            for x in 0..3 {
                if b[i] == A[y][x] {
                    board[y][x] = true;
                }
            }
        }
    }
    let mut flag = false;
    for y in 0..3 {
        if board[y][0] && board[y][1] && board[y][2] {
            flag = true;
        }
    }
    for x in 0..3 {
        if board[0][x] && board[1][x] && board[2][x] {
            flag = true;
        }
    }
    if board[0][0] && board[1][1] && board[2][2] {
        flag = true;
    }
    if board[0][2] && board[1][1] && board[2][0] {
        flag = true;
    }
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
n, m = gets.chomp.split.map(&:to_i)

submits = []
m.times do |set|
  submits << gets.chomp.split
end

res = {}

submits.each do |set|
  num = set[0]
  type = set[1]
  res[num] = {} if res[num].nil?
  if type == 'AC'
    res[num]['ac'] = true if res[num]['ac'].nil?
  elsif type == 'WA'
	res[num]['wa'] = res[num]['wa'].to_i + 1 if res[num]['ac'].nil?
  end
end

ac = 0
wa = 0
res.each do |k, v|
  ac += 1 if v['ac']
  wa += v['wa'].to_i if v['ac']
end

puts "#{ac} #{wa}"

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a.at(i);

    vector<ll> d(61);
    rep(i,n){
        for(int j=0;j<=60;j++){
            if(((ll)1<<j) & a.at(i)) d.at(j)++;
        }
    }

    ll tot = 0;
    rep(i,d.size()){
        ll x = (d.at(i) * (n-d.at(i))) % p;
        ll y = ((ll)1<<(ll)i) % p;
        // cout << i << " " << x << " * " << y << endl;
        tot = (tot + (x * y) % p) % p;
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll          long long int
#define pii         pair<int,int>
#define uu          first
#define vv          second
#define fastIO      ios::sync_with_stdio(0);cin.tie(0);
using namespace std;

const int MAX = 2e5 + 5;
const ll INF = 1e18;
int main()
{
    fastIO;
    int n, W;
    cin>>n>>W;
    vector<ll>w(n+1), val(n+1);
    for(int i =1 ; i <=n ; i++ ) cin>>w[i]>>val[i];
    
    vector< ll > dp(MAX, INF);
    dp[0] = 0;
    
    
    for(int i = 1; i <=n ; i++ ) {
        
        for(int j = MAX-1 ; j >=1 && j - val[i] >= 0; j--) {
            dp[j] = min(dp[j], dp[j - val[i]] + w[i]);
        }
    }
    for(int i = MAX-1 ; i>=0 ; i--) {
        if(dp[i] <= W) {
            cout<<i<<'\n';
            return 0;
        }
    }
    return 0;
}

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

int main(){
    vector<vector<int>> bingo(3, vector<int>(3));
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> bingo.at(i).at(j);
        }
    }
    int n; cin >> n;
    for(int i = 0; i < n; i++){
        int b; cin >> b;
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b == bingo.at(j).at(k)) bingo.at(j).at(k) = 0;
            }
        }
    }
    bool ok = false;
    if(bingo.at(0).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(2) == 0) ok = true;
    if(bingo.at(2).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(0).at(2) == 0) ok = true;
    for(int i = 0; i < 3; i++){
        if(bingo.at(i).at(0) == 0 && bingo.at(i).at(1) == 0 && bingo.at(i).at(2) == 0){
            ok = true;
            break;
        }
    }
    for(int i = 0; i < 3; i++){
        if(bingo.at(0).at(i) == 0 && bingo.at(1).at(i) == 0 && bingo.at(2).at(i) == 0){
            ok = true;
            break;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m;
    cin>>n>>m;
    vector <pair <long long,long long> > vect,vect2;
    for(int i=0;i<n;i++)
    {
        long long a,b;
        cin>>a>>b;
        vect.push_back({a,b});
    }
    sort(vect.begin(),vect.end());
    long long q=0;
    long long a=upper_bound(vect.begin(),vect.end(),make_pair(m+1,q))-vect.begin();
    for(int i=0;i<a;i++)
    {
        vect2.push_back({vect[i].second,vect[i].first});
    }
    sort(vect2.begin(),vect2.end(),greater <pair <long long,long long> >());

     vector <long long> vect1(m,0);
     map <long long,long long> map1;
     long long count1=0;
     for(int i=0;i<a;i++)
    {
        long long j=m-vect2[i].second;
        if(map1[j]!=0)
            j=map1[j];
        while(j>=-1 && vect1[j]!=0)
        {
            j--;
        }
        map1[m-vect2[i].second]=j;
        if(j>-1)
        {
            vect1[j]=1;
            count1+=vect2[i].first;
        }
    }
    cout<<count1;
    return 0;
}


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

int main(){
    queue< pair<string,int> > process;
    int n,t,q;
    string s;
    int time=0;
    cin >> n >> q;
    for (int i = 0; i < n ; ++i) {
        cin >> s >> t;
        process.push(make_pair(s,t));
    }
    while(!process.empty()) {
        //?????????pair p?????????
        pair<string,int> p = process.front();
        process.pop();
        if (p.second > q){
            time += q;
            p.second -= q;
            process.push(p);
        }else{
            time += p.second;
            cout << p.first << " " << time << endl;
        }
    }
    return 0;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), tmp(n);
    rep(i, n){
        cin >> a[i];
        tmp[i] = a[i];
    }

    bool flg = true;
    rep(i, n-1){
        if(a[i] != a[i+1]){
            flg = false;
            break;
        }
    }

    if(flg){
        rep(i, n) cout << a[0] << endl;
        return 0;
    }

    sort(tmp.begin(), tmp.end());
    ll amax = tmp[n-1], asec = tmp[n-2];

    rep(i, n){
        if(a[i] == amax) cout << asec << endl;
        else cout << amax << endl;
    }
    

    return 0;
}

Measured memory_bytes: 6396
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    m = int(N ** .5)
    while N % m != 0:
        m -= 1
    else:
        print(int(N / m + m - 2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>
typedef long long unsigned int u64;


u64 solve(u64 n, u64 m) {
    if(n >= m / 2) return m / 2;
    else return n + (m - 2 * n) / 4;
}

int main(void) {
    u64 n, m;
    scanf("%llu%llu", &n, &m);
    printf("%llu", solve(n, m));
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
using namespace std;

long long gcd(long long a, long long b)
{
	return b ? gcd(b, a%b) : a;
}

int main()
{
	long long n, k; scanf ("%lld %lld", &n, &k);
	n %= k;
	if (n > k - n)
		n = k - n;
	printf ("%lld\n", n);

	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int a, b; cin >> a >> b;
    cout << (a + b) % 24 << "\n";
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int64_t powmod(int64_t x, int64_t n, int64_t mod) {
	int64_t ret = 1;
	while (n > 0) {
		if (n & 1) (ret *= x) %= mod;
		(x *= x) %= mod;
		n >>= 1;
	}
	return ret;
}



int main() {

	int n; cin >> n;

	vector<LL> a(n);
	vector<LL> d(n);

	LL mx = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

		mx = max(mx, a[i]);
		d[a[i]]++;
	}

	if (a[0] != 0 || d[0]>1) {
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < mx + 1; i++) {
		if (d[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	LL ans = 1;

	for (int i = 1; i < mx+1; i++) {
		ans = ans * powmod(d[i-1], d[i], 998244353);
      	ans%=998244353;
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<int>> map(h, vector<int>(w,0));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            char s;
            cin >> s;
            if(s == '#') map[i][j] = 1;
        }
    }
    vector<vector<int>> L(h, vector<int>(w,0)),
        R(h, vector<int>(w,0)), U(h, vector<int>(w,0)),
        D(h, vector<int>(w,0));
    for(int i=0; i < h; i++){
        for(int j=0; j < w; j++){
            if(map[i][j] == 1) L[i][j] = 0;
            else {
                if(j==0) L[i][j] = 1;
                else if(map[i][j-1] == 1) L[i][j] = 1;
                else L[i][j] = L[i][j-1] + 1;
            }
        }
    }
    for(int i=0; i < h; i++){
        for(int j=w-1; j >= 0; j--){
            if(map[i][j] == 1) R[i][j] = 0;
            else {
                if(j==w-1) R[i][j] = 1;
                else if(map[i][j+1] == 1) R[i][j] = 1;
                else R[i][j] = R[i][j+1] + 1;
            }
        }
    }
    for(int i=0; i < w; i++){
        for(int j=0; j < h; j++){
            if(map[j][i] == 1) U[j][i] = 0;
            else {
                if(j==0) U[j][i] = 1;
                else if(map[j-1][i] == 1) U[j][i] = 1;
                else U[j][i] = U[j-1][i] + 1;
            }
        }
    }
    for(int i=0; i < w; i++){
        for(int j=h-1; j >= 0; j--){
            if(map[j][i] == 1) D[j][i] = 0;
            else {
                if(j==h-1) D[j][i] = 1;
                else if(map[j+1][i] == 1) D[j][i] = 1;
                else D[j][i] = D[j+1][i] + 1;
            }
        }
    }
    int max = 0;
    for(int i=0; i < h; i++){
        for(int j=0; j < w; j++){
            int sum = L[i][j] + R[i][j] + U[i][j] + D[i][j];
            if(sum  > max) max = sum;
        }
    }
    cout << max-3 << endl;
    return 0;
}


Measured memory_bytes: 80640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    ll l[101];
    for(int i=0; i<n; i++) cin>>l[i];
    int ans=0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            for(int k=j+1; k<n; k++){
                if(l[i]!=l[j] && l[i]!=l[k] && l[j]!=l[k]){
                    ll a[3];
                    a[0]=l[i], a[1]=l[j], a[2]=l[k];
                    sort(a, a+3);
                    if(a[2]<a[0]+a[1]){
                        ans++;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
# coding: utf-8
N = int(input())
d = {}
for i in range(N):
    a = int(input())
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
ans = 0
for a in d.items():
    ans += a[1] % 2
print(ans)


Measured memory_bytes: 15076
import std.stdio, std.string, std.conv, std.array, std.algorithm, std.range;

void main()
{
    auto n = readln.chomp.split(" ")[0].to!int;
    auto ds = readln.chomp.split(" ").map!(to!string).join("");

    bool check(string xs) {
        foreach (d; ds) {
            foreach (x; xs.uniq) {
                if (d == x) return true;
            }
        }
        return false;
    }

    while (check(n.to!string))
        ++n;

    writeln(n);
}

Measured memory_bytes: 1276
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let x: usize = sc.read();
    let y: usize = sc.read();
    let z: usize = sc.read();
    let k: usize = sc.read();
    let mut a_values: Vec<u64> = sc.vec(x);
    a_values.sort_by(|x, y| y.cmp(x));
    let mut b_values: Vec<u64> = sc.vec(y);
    b_values.sort_by(|x, y| y.cmp(x));
    let mut c_values: Vec<u64> = sc.vec(z);
    c_values.sort_by(|x, y| y.cmp(x));
    let mut ab_values: Vec<u64> = Vec::new();
    for &a in a_values.iter() {
        for &b in b_values.iter() {
            ab_values.push(a + b);
        }
    }
    ab_values.sort_by(|x, y| y.cmp(x));
    ab_values.resize(k, 0);
    let mut abc_values: Vec<u64> = Vec::new();
    for &ab in ab_values.iter() {
        for &c in c_values.iter() {
            abc_values.push(ab + c);
        }
    }
    abc_values.sort_by(|x, y| y.cmp(x));
    for i in 0..k {
        println!("{}", abc_values[i]);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 48500
n,m=map(int,input().split())
ans=[["1"]*(2**m-1) for _ in range(2**n-1)]
for k in range(1,11):
    for i in range(2**k,2**n,2**k):
        for j in range(2**k,2**m,2**k):
            if ans[i-1][j-1]=="1":
                ans[i-1][j-1]="0"
            else:
                ans[i-1][j-1]="1"
for i in range(2**n-1):
    print("".join(ans[i]))

Measured memory_bytes: 49520
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	string t;
	if (s.size()%2)
	cout<<"No\n";
	else
	{
	    for (int i=0;i<n/2;i++)
	    {
	        t.push_back(s[i]);
	    }
	    for (int i=n/2;i<n;i++)
	    {
	        if (t[i-n/2]!=s[i])
	        return cout<<"No\n", 0;
	    }
	    cout<<"Yes\n";
	    
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli  long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define fbo find_by_order //returns iterator
#define fok order_of_key //return index
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=998244353;
lli inf=9223372036854775807;
//string s=bitset<32>(n).to_string();
typedef tree<lli,null_type,less<lli>,rb_tree_tag, // change both to lli if set is req insted of multiset
tree_order_statistics_node_update> indexed_set;
int main()
{
	lli t;
	t=1;//cin>>t;
	while(t--){
		lli l,r,d;
		cin>>l>>r>>d;
		lli an=0;
		for(lli i=l;i<=r;i++)if(i%d==0)an++;
		cout<<an<<endl;
		
		
		
		
		
	}
 
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

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

	ll n, m; cin >> n >> m;

	ll count = 0;			//作ったSccの数
	
	count = min(n, m / 2);

	ll nl = 0;
	ll ml = 0;


	nl = n - min(n, m / 2);
	ml = (m / 2) - min(n, m / 2);
	
	if (ml >= 2) {
		count += ml / 2;
	}

	//cout << nl << ' ' << ml << endl;
	cout << count << endl;
}


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


int main() {
  int N,count=0,coh=0;
  string ans="No";
  
  cin >> N;
  
  vector<int>vec(N);
  
  for(int i=0; i<N;i++){
     cin >> vec.at(i);
  }
  
   for(int i=0; i<N;i++){
     if(vec.at(i)==0)break;
     else if(vec.at(i)%4==0){
       count++;
     }
     else if(vec.at(i)%2==0){
       coh++;
     }
  }
  
  if(coh==1&&N/2<=count)ans="Yes";
  else if(coh==0 && N/2<=count)ans="Yes";
  else if((N-coh+1)/2<=count)ans="Yes";
  
  
  cout << ans <<endl;
  
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    // aをx
    // bをy
    int ans = a*x + b*y;
    for(int i=0;i<=max(x,y);i++){
        // abピザをi*2枚使う
        int t = c * i * 2;
        // 残り必要なピザはx-i枚とy-i枚
        t += max(0,(x-i))*a + max(0,(y-i))*b;
        chmin(ans,t);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int n, x, y, z, w, i;
    
    scanf("%d", &n);
    
    for(i=1; i<n+1; i++){
        x = i / 1000;
        y = (i - x*1000) / 100;
        z = (i - (x*1000 + y*100)) / 10;
        w = i - (x*1000 + y*100 + z*10);
    
        if(i%3 == 0 || x == 3 || y == 3 || z == 3 || w == 3){
            printf(" %d", i);
        }
    }
    
    printf("\n");
    return 0;
}



Measured memory_bytes: 2084
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let w: usize = it.next().unwrap().parse().unwrap();
    let mut p = vec![];
    for _ in 0..n {
        let a: usize = it.next().unwrap().parse().unwrap();
        let b: usize = it.next().unwrap().parse().unwrap();
        p.push((a, b));
    }
    p.sort_by_key(|p| p.0);
    let mut dp = vec![0; w + 3000];
    for &(a, b) in p.iter() {
        for i in (0..w).rev() {
            dp[i + a] = std::cmp::max(dp[i + a], dp[i] + b);
        }
    }
    let ans = dp.into_iter().max().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#ifdef MY_LOCAL
#define MY_MAIN(cls) class cls {public: int main();}; int cls::
#else
#define MY_MAIN(cls) int
#endif

#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


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

	string ans;
	switch (n % 10)
	{
	case 0:
	case 1:
	case 6:
	case 8:
		ans = "pon";
		break;
	case 2:
	case 4:
	case 5:
	case 7:
	case 9:
		ans = "hon";
		break;
	case 3:
		ans = "bon";
		break;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    if(n%2==0){
        vector<ll> b(n);
        rep(i,n/2) b[2*i+1] = a[i];
        rep(i,n/2) b[2*i] = a[i+n/2];
        ll ans = 0;
        rep(i,n-1) ans += abs(b[i]-b[i+1]);
        cout << ans << endl;
    }else{
        vector<ll> b(n),c(n);
        rep(i,n/2){
            b[2*i+1] = a[i];
            c[2*i+1] = a[i+n/2+1];
        }
        rep(i,n/2+1){
            b[2*i] = a[i+n/2];
            c[2*i] = a[i];
        }
        swap(b[n-1],b[2]);
        swap(c[0],c[n-3]);
        ll res1 = 0,res2 = 0;
        rep(i,n-1){
            res1 += abs(b[i]-b[i+1]);
            res2 += abs(c[i]-c[i+1]);
        }
        cout << max(res1,res2) << endl;
    }
    return 0;
}



Measured memory_bytes: 5556
#include<iostream>
using namespace std;
bool a[10000001];
int main() {
	fill(a, a + 10000001, true);
	a[0] = false; a[1] = false;
	for (int i = 3; i <= 10000000; i += 2) {
		if (a[i]) {
			int j = 2;
			while (i*j <= 10000000) {
				a[i*j] = false;
				j++;
			}
		}
	}
	int n;
	while (cin >> n&&n != 0) {
		int b = 13;
		for (int i = n; i >= 13; i--) {
			if (a[i] && a[i - 2] && a[i - 6] && a[i - 8]) {
				b = i;
				break;
			}
		}
		cout << b << endl;
	}
}

Measured memory_bytes: 12824
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<utility>
#include<stdbool.h>
using namespace std;
typedef long long ll;
#define N (1000000000+7)


int main(void) {
	int x;
	cin >> x;
	if (x == 3 || x == 5 || x == 7)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int n, b, f, r, v;
int board[4][3][10];
int main() {
	cin >> n;
	rep(i,n) {
		cin >> b >> f >> r >> v;
		board[b - 1][f - 1][r - 1] += v;
	}
	rep(i,4) {
		rep(j,3) {
			rep(k,10) {
				cout << " " << board[i][j][k];
			}
			cout << endl;
		}
		if(i != 3) {
			rep(j,20) {
				cout << "#";
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main(){
    //入力
    string S_dash,T;

    cin >> S_dash;
    cin >> T;

    //処理
    int len_S_dash = S_dash.size();
    int len_T = T.size();
    int i_s=S_dash.size()+1;
    if(len_S_dash < len_T){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }else{
        for(int i =0;i<=len_S_dash - len_T;i++){
            if(i_s!=S_dash.size()+1) break;
            string sub_S = S_dash.substr(len_S_dash-len_T-i,len_T);
            for(int j=0;j<len_T;j++){
                if(sub_S.at(j)!=T.at(j)&&sub_S.at(j)!='?') break;
                if(j==len_T-1) i_s=len_S_dash-len_T-i;
            }
        }
    }

    //答え
    if(i_s==S_dash.size()+1) cout << "UNRESTORABLE" << endl;
    else{
        string S(S_dash);
        for(int i=0;i<len_S_dash;i++){
            if(i<i_s||i>=i_s+len_T){
                if(S_dash.at(i)=='?') S.at(i)='a';
            }else{
                S.at(i)=T.at(i-i_s);
            }
        }
    cout << S << endl;
    }
    
    
}

Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin

heap_size = int(stdin.readline())
#assert heap_size <= 250
heap = [int(s) for s in stdin.readline().split()]
for i, v in enumerate(heap, start=1):
    parent = heap[i//2 -1] if i > 1 else None
    left = heap[2*i -1] if 2*i <= heap_size else None
    right = heap[2*i] if 2*i+1 <= heap_size else None
    print('node {}: key = {}, '.format(i, v), end='')
    if parent:
        print('parent key = {}, '.format(parent), end='')
    if left:
        print('left key = {}, '.format(left), end='')
    if right:
        print('right key = {}, '.format(right), end='')
    print()

Measured memory_bytes: 4256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string x;
  cin>>x;
  int a=x[0],b=x[1],c=x[2],d=x[3];
  if(a==b&&a!=c&&c==d){
    cout<<"Yes"<<endl;
  }
  else if(a==c&&a!=b&&b==d){
    cout<<"Yes"<<endl;
  }
  else if(a==d&&a!=c&&c==b){
    cout<<"Yes"<<endl;
  }
  else
    cout<<"No"<<endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define FOR(i, m, n) for (int i = m; i < n; i++)

int main() {
    vector<pair<int,P> > ls;
    FOR(i,1,151){
        FOR(j,i+1,151){
            ls.push_back({i*i+j*j,P(i,j)});
        }
    }
    sort(ls.begin(),ls.end());
    while(1){
        int h,w;
        cin >> h >> w;
        if(h==0)break;
        int t = 0;
        while(ls[t].second != P(h,w))t++;
        cout << ls[t+1].second.first << " " << ls[t+1].second.second << endl;
    }
    return 0;
}



Measured memory_bytes: 3084
N = int(input())
h = list(map(int, input().split()))

dp = [0] * N
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
    dp[i] = min(dp[i-2] + abs(h[i]-h[i-2]), dp[i-1] + abs(h[i]-h[i-1]))

print(dp[N-1])


Measured memory_bytes: 13980
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

n = I()
a = RI()

a.sort(reverse=True)

if a[-1]==0:
    print(0)
    exit()

ans = 1
for i in a:
    ans *= i
    if ans>(10**18):
        print(-1)
        exit()

print(ans)

Measured memory_bytes: 86200
import collections

if __name__ == '__main__':
    n, m = map(int, input().split())
    
    ht = collections.defaultdict(list)
    for _ in range(m):
        a, b = [int(token) - 1 for token in input().split()]
        ht[a].append(b)
        ht[b].append(a)

    stack = [(0, 0)]
    cnt = 0
    while stack:
        position, history = stack.pop()
        if history | (1 << position) == 2 ** n - 1: cnt += 1

        for next_position in ht[position]:
            if history & (1 << next_position) == 0: stack.append((next_position, history | (1 << position)))
        
    print(cnt)




Measured memory_bytes: 3316
#include<stdio.h>
long long int small(long long int a, long long int b) {
	if (a >= b) {
		return b;
	}
	else {
		return a;
	}
}
int main() {
	long long int n, s[5000] = {},m,min=10000000,count=0,x;
	char str[3000];
	scanf("%lld%lld", &n,&m);
	scanf("%s",str);
	
	for (int i = 0; i < n; i++) {
		if (str[i]-'0'<0|| str[i] - '0' > 9) { printf("No"); return 0; }
	}
	if (str[n]!='-') { printf("No"); return 0; }
	for (int i = n+1; i < n+m+1; i++) {
		if (str[i] - '0' < 0 || str[i] - '0' > 9) { printf("No"); return 0; }
	}
	printf("Yes");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	int ans = 0;
	if (A > B)
	{
		ans += A;
		A--;
	}
	else
	{
		ans += B;
		B--;
	}

	ans += max(A, B);

	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=805,inf=1e9+7;
char a[N][N];
bool vis[N][N];
ll dx[]={-1,0,1,0};
ll dy[]={0,1,0,-1};
ll dist[N][N];
void bfs(ll x,ll y,ll h,ll w){
    vis[x][y]=1;
    dist[x][y]=0;
    queue< pair<ll,ll> > q;
    q.push({x,y});
    while(!q.empty()){
        auto node=q.front();
        q.pop();
        for(ll i=0;i<4;i++){
            ll nx = node.first + dx[i];
            ll ny = node.second + dy[i];
            if(nx<=0 || nx>h || ny<=0 || ny>w)continue;
            if(vis[nx][ny] || a[nx][ny]!='.')continue;
            vis[nx][ny]=1;
            dist[nx][ny]=1+dist[node.first][node.second];
            q.push({nx,ny});
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w,k;cin>>h>>w>>k;
    for(ll i=1;i<=h;i++)cin>>(a[i]+1);
    ll x,y;
    for(ll i=1;i<=h;i++){
        for(ll j=1;j<=w;j++){
            if(a[i][j]=='S')x=i,y=j;
            dist[i][j]=inf;
        }
    }
    bfs(x,y,h,w);
    ll ans = inf;
    for(ll i=1;i<=h;i++){
        for(ll j=1;j<=w;j++){
            if(dist[i][j]>k)continue;
            ll req = min({i-1,h-i,j-1,w-j});
            req = (req+k-1)/k + 1;
            ans=min(ans , req);
        }
    }
    cout<<ans;
}



Measured memory_bytes: 6656
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef long long ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
#define N_MAX	(200 * 1000)
#define K_MAX	(10)
#define M_MAX	(10)
#define Q_MAX	(10)
#define H_MAX	(1000)
#define W_MAX	(1000)

int main()
{
	int N, M, C;
	cin >> N >> M >> C;
	
	vector<int> B(M);
	REP(i, M) cin >> B[i];

	vector<vector<int>> A(N, vector<int>(M));
	REP(i, N) REP(j, M) cin >> A[i][j];

	int ans = 0;
	REP(i, N) {
		int sum = C;
		REP(j, M) {
			sum += A[i][j] * B[j];
		}
		if (0 < sum) ans++;
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll K;
  cin>>K;
  ll A[K];
  REP(i,K) cin>>A[i];
  
  bool CAN=true;
  ll mn=2,mx=2;
  
  for(int i=K-1; i>=0; --i){
    if(mx/A[i]==mn/A[i] && mn*mx%A[i]!=0){
      CAN=false;
      break;
    }
    mn=((mn-1)/A[i]+1)*A[i];
    mx=(mx/A[i]+1)*A[i]-1;
  }
  
  if(CAN) cout<<mn<<" "<<mx<<endl;
  else co(-1);
  return 0;
}

Measured memory_bytes: 1152
//3/4/20 20:45
//nifty 8083.80

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

#define ll          long long
#define ull         unsigned long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define Mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)      (a).rbegin(),(a).rend()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define INF         numeric_limits<ll>::max();
#define NINF        numeric_limits<ll>::min();
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))




void solve(){
    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    int l[k],r[k];
    int b=0,e=k-1;
    int ind=-1;
    for(int i=0;i<n && b<k;i++){
        if(s[i]=='o' && i>ind){
            l[b]=i;
            b++;
            ind=i+c;
        }

    }

    ind=n;
    for(int i=n-1;i>=0 && e>=0;i--){
        if(s[i]=='o' && i<ind){
            r[e]=i;
            e--;
            ind=i-c;
        }
    }
    //int cnt=0;
    for(int i=0;i<k;i++){
        if(l[i]==r[i])cout<<l[i]+1<<endl;
        //cout<<l[i]<<" "<<r[i]<<endl;
    }

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define vpp vector<pair<int,int>>
#define ll long long int
#define ull unsigned long long
#define ld long double
#define fi(i,a,b) for(ll i=a;i<b;i++)
#define fj(j,a,b) for(ll j=a;j<b;j++)
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define mpi map<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define pb push_back
#define MOD 1000000007
#define ub upper_bound
#define lb lower_bound
#define itr(v) for(auto it:v)
#define all(v) v.begin(),v.end()  
#define w(t)  int t; cin>>t; while(t--)
#define fio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fast_pow(ll k, ll p)
{
if (p == 0)
        return 1;
 
    ll P = fast_pow(k, p/2);
    P = (P * P) % MOD;
 
    if (p % 2 == 1)
        P = (P * k) % MOD;
 
    return P;
}
ll invmod(ll a,ll m)
{
    return fast_pow(a,m-2);
}

bool isPrime(ll n) 
{ 
   
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
       if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll nextPowerOf2(ll n)
{
    n>>=1;
    ll count = 0;

    if (n && !(n & (n - 1)))
        return n;

    while( n != 0)
    {
        n >>= 1;
        count += 1;
    }

    return 1 << count;
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
    C[0] = 1;
  
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 


//////////////////////*********CODE***********/////////////////////

int main(){
int n,k;
  cin>>n>>k;
 
    ll a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    ll p[n+1]={1};
    ll p1=1;
    
    for(int i=1;i<=n;i++){
        if(i>k){
            if(a[i-1]>a[i-1-k]) cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
    }
}


Measured memory_bytes: 6788
local ior = io.read
local str = ior()
local ppos = #str - 1
local tot = (1<<ppos) - 1
local sum = 0
for i = 0, tot do
  local tsum = 0
  local t = 0
  local it = i
  for j = 1, ppos do
    if(it % 2 == 1) then
      t = t * 10 + tonumber(str:sub(j, j))
      tsum = tsum + t
      t = 0
    else
      t = t * 10 + tonumber(str:sub(j, j))
    end
    it = it // 2
  end
  tsum = tsum + t * 10 + tonumber(str:sub(#str, #str))
  sum = sum + tsum
end
print(sum)


Measured memory_bytes: 636
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

r,D,x2000 = map(int, input().split())

x = x2000
for i in range(10):
    ans = r*x - D
    print(ans)
    x = ans


Measured memory_bytes: 9128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

int main(void){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(m);
    for(ll i = 0;i < m;++i)    cin >> a[i];

    ll sum = 0;
    for(int i = 0;i < m;++i){
        sum += a[i];
    }

    if(n-sum >= 0){
        cout << n-sum << endl;
    }else{
        cout << "-1" << endl;
    }
    


    return 0;
}

Measured memory_bytes: 3712