akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = {1,0,-1,0};
ll dy[4] = {0,1,0,-1};


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vi v(3);
	rep(i, 3) cin >> v[i];
	sort(all(v));
	cout << v[0] * v[1] / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
using namespace std;

int main()
{
	int n;
	cin >> n;
	int a[100];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = n-1; i >=0 ; i--)
	{
		if (i>0)
		{
			cout <<a[i]<< " ";
		}
		else {
			cout << a[i];
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
int n,m,ans;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n>>m;
	if((max(n,m)-min(n,m))%2)cout<<"IMPOSSIBLE";
	else cout<<(max(n,m)-min(n,m))/2+min(n,m);
	return 0;
}


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


int main(){
  std::vector<bool> isprime(300000, true);
  int N;
  scanf("%d", &N);
  isprime[0]=false;
  isprime[1]=false;
  isprime[2]=false;
  for (int i=2; i<300000; i++){
    if (isprime[i]){
      for (int j=2*i; j<300000; j+=i){
	isprime[j]=false;
      }
    }
  }
  std::vector<int > ans;
  int counter=2;
  while(ans.size()<N){
    if (isprime[counter]&&counter%5==1){
      ans.push_back(counter);
    }
    counter++;
  }
  for (int i=0; i<ans.size(); i++){
    printf("%d%c",ans[i],(i!=ans.size()-1)?' ':'\n');
  }
  return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i,s.size()){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3916
package main

import (
	"fmt"
	"strings"
)

func main(){
	var H, W int
	var S string
	fmt.Scan(&H, &W)
	g := [][]string{}
	i := 0

	for i < H {
		i++
		fmt.Scan(&S)
		row := strings.Split(S,"")
		g = append(g, row)
	}
	res := true
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if g[i][j] == "#" {
				ch := false
				if i-1 >= 0 {
					if g[i-1][j] == "#" {ch = true}
				}
				if i+1 < H {
					if g[i+1][j] == "#" {ch = true}
				}
				if j-1 >= 0 {
					if g[i][j-1] == "#" {ch = true}
				}
				if j+1 < W {
					if g[i][j+1] == "#" {ch = true}
				}
				if !ch {
					res = false
					break
				}
			}
		}
		if !res {
			break
		}
	}
	if res {
		fmt.Println("Yes")
	}else{
		fmt.Println("No")
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <complex>
#include <cmath>
#include <utility>
#include <algorithm>
using namespace std;

int D;
double V[16];
double interpolate(int n, int E)
{
    double sum = 0.0;
    for(int k=0;k<D+3;k++)
    {
        if(k==n || k==E)
            continue;
        double p = V[k];
        for(int i=0;i<D+3;i++)
            if(!(i==k || i==n || i==E))
                p *= 1.0*(n-i)/(double)(k-i);
        sum += p;
    }
    return sum;
}

bool outlier(int E)
{
    for(int i=0;i<D+3;i++)
    {
        if(i==E)
            continue;
        double p=interpolate(i, E);
        if(abs(p-V[i]) > 0.1)
            return false;
    }
    return true;
}

int main()
{
    while(cin >> D && D)
    {
        for(int i=0;i<D+3;i++)
            cin >> V[i];
        for(int i=0;i<D+3;i++)
            if(outlier(i))
            {
                cout << i << endl;
                break;
            }
    }
}


Measured memory_bytes: 3212
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
    int a,b,c;
    double ans;
    cin>>a;
    
    ans=2*a*3.1415926;
    cout<<setprecision(10)<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3788
//quming
#include<bits/stdc++.h>
#define R register
#define fi first
#define se second
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b) {
	return a<b?a=b,1:0;
}
template<class T>inline bool cmin(T&a,const T&b) {
	return a>b?a=b,1:0;
}
using namespace std;
int P;
inline int up(R int x) {
	return x<0?x+P:x;
}
inline void upd(R int &x,R int y) {
	(x+=y)>=P?x-=P:0;
}
inline int add(R int x,R int y) {
	return x+y>=P?x+y-P:x+y;
}
inline int dec(R int x,R int y) {
	return x-y<0?x-y+P:x-y;
}
inline int mul(R int x,R int y) {
	return 1ll*x*y-1ll*x*y/P*P;
}
int ksm(R int x,R int y) {
	R int res=1;
	for(; y; y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
typedef pair<int,int> pi;
const int N=505;
pi st[N];
int c[N],a[N],dp[N],top,n,res;
inline int f(R int x,R int y) {
	R int r=0;
	while(r<(n<<1)&&r*r+y*y<x*x)++r;
	return r;
}
inline int g(R int x,R int y) {
	R int r=0;
	while(r<(n<<1)&&r*r+y*y<=x*x)++r;
	return r;
}
int main() {
	scanf("%d%d",&n,&P);
	fp(i,0,n-1) st[++top]=pi(f(n,i),-i);
	fp(i,n,(n<<1)-1) st[++top]=pi(g(n<<1,i),1);
	fp(i,0,n-1) c[i]=g(n<<1,i);
	sort(st+1,st+1+top);
	fp(k,0,n) {
		memset(dp,0,(k+1)<<2);
		dp[0]=1;
		int s1=0,s2=0;
		fp(i,1,top)
			if(st[i].se==1) {
				fp(j,0,s2) dp[j]=mul(dp[j],up(st[i].fi-s1-j));
				++s1;
			} else {
				fd(j,s2,0) {
					upd(dp[j+1],mul(dp[j],up(st[i].fi-s1-j)));
					dp[j]=mul(dp[j],up(c[-st[i].se]-(n+k+s2-j)));
				}
				++s2;
			}
		upd(res,(k&1)?P-dp[k]:dp[k]);
	}
	printf("%d\n",res);
	return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int i;
  for (i = 0; i < 2; i++) {
    int temp;
    if (a < b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (b < c) {
      temp = b;
      b = c;
      c = temp;
    }
  }

  cout << (a * 10 + b) + c << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, X;
  cin >> N >> X;
  int b = 0;
  int r = 1;
  F0R(i, N) {
    int l;
    cin >> l;
    b += l;
    if (b <= X) r++;
  }
  cout << r;
}
#endif


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
int main () {
  int H, W;
  cin >> H >> W;
  string S;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> S;
      if(S == "snuke")cout << (char)('A' + j) << i + 1 << endl;
    }
  }
  return 0;
}


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

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int M1, D1, M2, D2;
	cin >> M1 >> D1;
	cin >> M2 >> D2;

	if(M1 != M2 && D2 == 1){
		printf("1\n");
	}
	else{
		printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Vec2(T, n, m, xs, x0) vector<vector<T>> xs(n, vector<T>(m, x0))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(ll, n, a, b);
    if(n == 1){
        Cout((a == b) ? 1 : 0);
    }
    else{
        Cout(max(0ll, (b*(n-1)+a) - (a*(n-1)+b) + 1));
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    long int L,R;
    int i,j;
    int ans = 2020;
    scanf("%lu%lu",&L,&R);
    int defL = L;
    int defR = R;
    if(defR-defL >= 2019){
    }else{
    while(L>=2019 || R>=2019){
    L = L%2019;
    R = R%2019;
    }
    
    
    for(i=L;i<R;i++){
        for(j=i+1;j<=R;j++){
            int sub = i*j;
            while(sub>=2019){
                sub=sub%2019;
            }
            if(sub<ans){
                ans = sub;
            }
        }
    }
    }
    if( defR-defL >= 2019)ans = 0;
    printf("%d\n",ans);
    return 0;
}

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

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

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  int A,B;
  cin >> A >> B;
  if(A + B >= 24) cout << A + B -24 << endl;
  else cout << A + B << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  string S;
  int sum = 0;
  cin >> S;
  for (int i = 0;i< S.size();i++)
    if (S.at(i) == 'o') sum +=100;
  cout << sum + 700 << endl;
}

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

signed main() {
	unordered_map<char, int>a;
	string b;
	cin >> b;
	for (char c:b) {
		a[c]++;
	}
	for (char d = 'a'; d <= 'z'; d++) {
		if (a[d] & 1) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

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

const int sz = 1e5 + 10;
ll ar[sz];
ll br[sz];
int n, cnt, di, cn;

int main() {
    #ifdef CLown1331
        freopen( "in.txt","r",stdin );
    #endif /// CLown1331
    while( cin >> n ) {
        cnt = 0;
        cn = 0;
        di = n;
//        for( int i=0; i<n; i++ ) {
//            cin >> ar[i];
//            if( ar[i] % 4 == 0 ) {
//                cnt++;
//                di--;
//            }
//            else
//            if( ar[i] % 2 == 0 ) cn++;
//        }
//        di -= ( cn / 2 ) * 2;
//        if( ( cn & 1 ) && cn > 2 ) {
//            di--;
//        }
//        if( cnt * 2 >= di ) {
//            cout << "Yes\n";
//        }
//        else {
//            cout << "No\n";
//        }
        stack < ll > a1, a2, a3;
        for( int i=0; i<n; i++ ) {
            cin >> ar[i];
            if( ar[i] % 4 == 0 ) {
                a1.push( ar[i] );
            }
            else if( ar[i] % 2 == 0 ) {
                a2.push( ar[i] );
            }
            else {
                a3.push( ar[i] );
            }
        }
        memset( br, -1, sizeof br );
        for( int i=1; i<n; i+=2 ) {
            if( a1.empty() ) break;
            br[i] = a1.top();
            a1.pop();
        }
        for( int i=n-1; i>=0; i-- ) {
            if( a2.empty() ) break;
            if( br[i] == -1 ) {
                br[i] = a2.top();
                a2.pop();
            }
        }
        for( int i=0; i<n; i++ ) {
            if( a3.empty() ) break;
            if( br[i] == -1 ) {
                br[i] = a3.top();
                a3.pop();
            }
        }
        int fl = 1;
        for( int i=1; i<n; i++ ) {
            if( ( br[i - 1] * br[i] ) % 4 != 0 ) {
                fl = 0;
            }
        }
        if( fl ) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 2688
#include<iostream>
using namespace std;
int main(void)
{
	int N,M,X,Y;
		cin >> N >> M >> X >> Y;
	for(int i=0;i<N;i++){
		int a;
			cin >> a;
		X=max(X,a);
	}
	for(int i=0;i<M;i++){
		int a;
			cin >> a;
		Y=min(a,Y);
	}
	if(X<Y)
		cout << "No War" << endl;
	else
		cout << "War" << endl;
	return 0;
}

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

void read(vector<string> &g, int n, int m) {
    for(int i = 0; i < n; i++) cin >> g[i];
}

bool isIn(int x, int y, int n, int m) {
    return(x >= 0 and x < n and y >= 0 and y < m);
}

int solve(const vector<string> &g, int n, int m) {
    vector<vector<int>> ans(n,vector<int>(m,0));
    int mov[2][2] = { {1,0},{0,1} };
    ans[n-1][m-1] = 1;

    for(int i = n-1; i >= 0; i--) {
        for(int j = m-1; j >= 0; j--) {
            if(g[i][j] == '#') continue;
            for(int k = 0; k < 2; k++) {
                int ii = i + mov[k][0];
                int jj = j + mov[k][1];
                if(isIn(ii,jj,n,m) and g[ii][jj] != '#')
                    ans[i][j] = (ans[i][j] + ans[ii][jj]) % MOD;
            }
        }
    }

    return ans[0][0];
}

int main() {
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<string> g(n);
    read(g,n,m);
    cout << solve(g,n,m) << endl;
    return 0;
}



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

int main(){
	long A,B;
	cin>>A>>B;
	long num;
	long ans;
	/*
	long ans1=A;
	for(long i=A+1;i<=B;++i){
		ans1=ans1^i;
	}
	*/
	if(A%2==0){
		if(B%2==0){
			num=B-A;
			if(num%4==0){
				ans=0;
			}
			else{
				ans=1;
			}
			ans=ans^B;
		}
		else{
			num=B-A+1;
			if(num%4==0){
				ans=0;
			}
			else{
				ans=1;
			}
		}
	}
	else{
		if(B%2==0){
			num=B-A-1;
			if(num%4==0){
				ans=0;
			}
			else{
				ans=1;
			}
			ans=ans^A;
			ans=ans^B;
		}
		else{
			num=B-A;
			if(num%4==0){
				ans=0;
			}
			else{
				ans=1;
			}
			ans=ans^A;
		}
	}
	cout<<ans<<endl;
	//cout<<ans1<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;

int main() {
    int h = 0, w = 0;
    cin >> h >> w;
    vector<vector<int>> coin(h, vector<int>(w));
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cin >> coin.at(i).at(j);
        }
    }
    int cnt = 0;
    vector<vector<int>> res;
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            if (i == h-1) {
                if (j == w-1) break;
                else {
                    if (coin.at(i).at(j)%2 == 1) {
                        coin.at(i).at(j+1)++;
                        res.push_back({i, j, i, j+1});
                        cnt++;
                    }
                }
            }
            else {
                if (coin.at(i).at(j)%2 == 1) {
                    coin.at(i+1).at(j)++;
                    res.push_back({i, j, i+1, j});
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
    for (auto vec : res) {
        for (int i=0; i<4; i++) {
            cout << vec.at(i) + 1;
            if (i == 3) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 9904
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> //required
//#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define lb long double
#define pb push_back
#define loop(i,start,n) for(ll i=start;i<n;i++)
#define rloop(i,n,start)for(ll i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e15
#define NEG_INF -1e15
#define pll pair<ll,ll>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
//using namespace __gnu_pbds;

int main(){
	IOS;
	ll n;
	cin >> n;
	ll a[n + 1], ans = 1, ok  = 1;
	loop(i, 1, n + 1)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	loop(i, 1, n + 1){
		ll t = sqrt(ans) * sqrt(a[i]);
		if( t > 1000000000){
			ok = 0;
			break;
		}
		ans = ans * a[i];
		if( ans > 1000000000000000000){
			debug(ok);
			ok = 0;
			break;
		}
	}

	cout << (ok? ans : -1) ;
}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
  ll n, a, b, k, l;
  cin >> n >> a >> b;
  
  k = n / (a+b);
  l = n - k*(a+b);
  
  if (l > a) dunk(a*k + a);
  else dunk(a*k + l);
  
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}

int main(){
	int a;scanf("%d",&a);
	int x=0;
	int y=0;
	int t=0;
	for(int i=0;i<a;i++){
		int p,q,r;
		scanf("%d%d%d",&p,&q,&r);
		if(ABS(q-x)+ABS(r-y)>p-t||(ABS(q-x)+ABS(r-y))%2!=(p-t)%2){
			printf("No\n");return 0;
		}
		x=q;y=r;t=p;
	}
	printf("Yes\n");
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		//キーがStringで中身がintのHashMapを作る
		HashMap<String, Integer> count = new HashMap<String, Integer>();
		
		for (int s=0; s<N; s++) {
			String S = keyboard.next();
			if (count.containsKey(S)) { //HashMapに既にキーがあるとき
				int now = count.get(S); //キーSのに紐づく中身のintを取得
				count.replace(S, now + 1);
			}
			else {
				count.put(S, 1); //まだHashMapにキーが登録されていないなら、登録する
			}
		}
		
		int M = keyboard.nextInt();
		for (int t=0; t<M; t++) {
			String T = keyboard.next();
			if (count.containsKey(T)) {
				int now = count.get(T);
				count.replace(T, now - 1);
			}
		}
		
		int ans = 0;
		//拡張for分（左が確認する1個の名前、右が確認するものの集合）
		//HashMapでキーが登録されている部分のintの集合を、valとして1個ずつ順番に全部確認する
		//右にcount.keysと書くと、全てのキーの集合が取れるし、count.entryなら全てのキーと中身のセットの集合が取れる
		for (int val: count.values()) { 
			if (ans < val) {
				ans = val;
			}
		}
				
		System.out.println(ans);
		keyboard.close();
	}
	
}


Measured memory_bytes: 35712
n=int(input())

#n=m*a+a
#n=(m+1)*a
#m>a

if n==1 or n==2:
    print(0)
    exit()

cnt=0
for i in range(1,int(n**(0.5))+1):
    if n%i==0:
        m=n//i-1
        if n%m==n//m:
            cnt+=m
print(cnt)
        
    


Measured memory_bytes: 40172
/*
    Code written by Talant I.D.
*/
   
#include <bits/stdc++.h>
   
using namespace std;
   
typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;
   
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mt make_tuple
#define mod (int)1e9+7
#define eps (double)1e-9
#define PI 2*acos(-0.0);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod 998244353

inline bool isvowel(char ch){
    ch = tolower(ch);
    return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}

bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2) 
		if(n % i == 0) return false;
	return true;
}

int main(){ 
    do_not_disturb
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //freopen("milkvisits.in", "r", stdin);
    //freopen("milkvisits.out", "w", stdout);
	int n, i;
	cin >> n;
	int a[n], b[n], c[n], dp[n][3];
	for(i = 0; i < n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(i = 1; i < n; i++){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2])+a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2])+b[i];
		dp[i][2] = max(dp[i-1][1], dp[i-1][0])+c[i];
	}
	cout << max(max(dp[n-1][1], dp[n-1][0]), dp[n-1][2]);
    
    return 0;
} // What is to be written here?


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

using namespace std;
using ll = long long;
using ld = long double;

#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define f first
#define ss second

template<class T> bool remin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool remax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

#define int long long

double dist(int x, int y) {
    return sqrt((x*x) + (y*y));
}

void solve_case() {
    // :pray: :fishy: :orz:
    int n,i,j,m;
    cin >> n >> m;
    int cnt = 0;
    for(i=0; i<n; i++) {
        int x,y;
        cin >> x >> y;
        if(dist(x,y)<=m) cnt++;
    }
    cout << cnt << "\n";
}

signed main() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);
    int Testcases = 1;
    //std::cin >> Testcases;
    while(Testcases--) {
        solve_case();
    }
    return 0;
}


Measured memory_bytes: 3700
n, m = list(map(int, input().split()))
x = list(map(int, input().split()))

x = sorted(x)
dist = [x[i+1] - x[i] for i in range(len(x) - 1)]

dist = sorted(dist)

if n == 1:
    print(sum(dist))
else:
    print(sum(dist[:-(n-1)]))

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

inline int topbit(unsigned long long x){
    return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x){
    return __builtin_parity(x);
}


template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

    ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

    ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<1000000007>;
//using mint=ModInt<998244353>;

signed main(){
	int N,K;
	cin>>N>>K;
	mint ans=0;
	for(int i=K;i<=N+1;i++){
		int lo=i*(i-1)/2;
		int hi=i*(N+N-i+1)/2;
		ans+=hi-lo+1;
	}
	cout<<ans<<endl;
    return 0;
}


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

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll allwater = 0;
    rep(i,N) {
        cin >> A[i];
        allwater += A[i];
    }
    ll allround = 0;
    for(int i=0;i<N;i+=2) allround += A[i];
    ll X = allround - (allwater/2);
    X*=2;

    rep(i,N){
        cout << X << " ";
        X = (A[i] - (X/2))*2;
    }
    cout << endl;
}

Measured memory_bytes: 2048
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

#各本を読んだ際の合計時間を考える
#これを(0,0)-(N,M)まで考えるのは無理がある
#0-Nに対し、それぞれM冊全探索をする

a,b=[0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans=0
point=M
for i in range(N+1):#i＝読んだ冊数.N冊まで読める
    ans_b = K-a[i]
    for j in reversed(range(point+1)):#j 読んだ冊数。M冊まで読める
        if ans_b>=b[j]:#この条件を満たす最大のjを求める
            ans=max(ans,i+j)
            point=j#pointより上を見る必要はない
            break
print(ans)



Measured memory_bytes: 134408
import numpy as np
N , K ,Q = map(int, input().split())
initializer_list = [0] * N
for _ in range(Q):
    i = int(input())-1
    initializer_list[i] += 1
    

[print('Yes') if (Q - initializer_list[i] < K) else print('No')  for i in range(N)]


Measured memory_bytes: 16272
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <iostream>


using namespace std;

signed main() {
    long n;
    cin >> n;
    long long x[n];
    long long plus_sum = 0;
    long long minus_sum = 0;
    long long a;
    for (long i = 0; i < n; i++) {
        // cin >> x[i];
        scanf("%lld", &x[i]);
        x[i] -= (i + 1);
        // if (x[i] >= 0) {
        //     plus_sum +=x[i] - (i + 1);
        // } else {
        //     minus_sum +=x[i] - (i + 1);
        // }
    }
    sort(x, x + n);
    long center = n / 2;
    long long res = 0;
    long long b;
    if (n % 2) {
        b = x[center];
    } else {
        b = static_cast<long long int>(round((x[center - 1] + x[center]) / 2));
    }

    for (long i = 0; i < n; i++) {
        res += abs(x[i] - b);
    }

    cout << res << endl;
}


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

#define fio                         \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);                    \
cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define ld long double
#define endl "\n"
#define ff first
#define ss second
#define pi pair<ll, ll>
#define PI 3.141592653589793238462643383279502884L
#define mp make_pair
#define pb push_back
#define fall(i, a, b) for (int i = a; i < b; i++)
#define sz(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define ed cout << "ed";
#define time_passed 1.0 * clock() / CLOCKS_PER_SEC
ll MOD = 1e9 + 7;
ll MOD1 = 1e9 + 123;
ll MOD2 = 1e9 + 321;

int main()
{
    fio;
    ll t, a, n, q, k, i, l, m, c, u, f, j, p,  x, y, s, b, d;

 cin>>n;
a=n/11;a*=2;
b=n%11;

 if (b>6)a+=2;
 else if(b)a+=1; 
cout<<a;
    return 0;
}


Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Vector;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        Vector<int[]> vector = new Vector<>();

        int ans = 0;
        while (a%2==0 && b%2==0 && c%2==0) {
            for (int[] i : vector) {
                if (a == i[0] && b == i[1] && c == i[2]) {
                    System.out.println(-1);
                    return;
                }
            }
            vector.add(new int[]{a, b, c});

            int x = b/2 + c/2;
            int y = a/2 + c/2;
            int z = a/2 + b/2;
            a = x; b = y; c = z;
            ans++;
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

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

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fore(b,c) for(int val0=b;val0<c;val0++)
#define forr(k,c,s) for(int k=c;k<s;k++)
#define pb push_back
#define mmp make_pair
#define oset(T) tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long double ld;
typedef vector<vii> al;
typedef vector<ll> vl;
const int INF = 1e9;
const ll INFL = 1LL<<61;
const int MN = 1001000;
int tr[MN][2];
bitset<MN> bs;
int ctr = 1;
void proc(string& s) {
	int st = 0;
	for(int i=0;i<s.size();i++) {
		int id = s[i]-'0';
		if(tr[st][id] == -1) {
			tr[st][id] = ctr++;
		}
		st = tr[st][id];
	}
	bs.set(st);
}
ll gr = 0;
void dfs(int u, int d, ll& l) {
	if(bs[u]) return;
	for(int i=0;i<2;i++) {
		if(tr[u][i] == -1) {
			ll tp = l-d;
			ll x = 1;
			while(!(tp&1)) {tp >>= 1;x <<= 1;}
			gr ^= x;
		} else {
			dfs(tr[u][i],d+1,l);
		}
	}
}
int main() {
	ios::sync_with_stdio(0);cout.precision(20);cout.tie(0);cin.tie(0);
	memset(tr,-1,sizeof(tr));
	ll n,l;
	cin >> n >> l;
	for(int i=0;i<n;i++) {
		string s;
		cin >> s;
		proc(s);
	}
	dfs(0,0,l);
	bool res = (gr != 0);
	cout << (res?"Alice":"Bob") << '\n';
}

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

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    int price;
    if (k < n) {
        price = x * k + y * (n - k);
    } else {
        price = x * n;
    }
    cout << price << endl;
    return 0;
}


Measured memory_bytes: 256
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
    exec({'RUBY_THREAD_VM_STACK_SIZE'=>'1000000000'}, '/usr/bin/ruby', $0)
end


def dfs(i, l=0)
    return if @used[i]
    @used[i] = true
    @g[i].each do |j|
        #a, b = i, j
        #a, b = b, a if a > b
        dfs(j, l ^ @path[[i, j]])
    end
    @ans[i] = l
end

N=gets.to_i
UVW=(N-1).times.map{gets.split.map(&:to_i)}

@g=Array.new(N){[]}
@path=Hash.new(0)
UVW.each do |u,v,w|
    u -= 1
    v -= 1
    @g[u] << v
    @g[v] << u
    #u, v = v, u if u > v
    @path[[u, v]] = w % 2
    @path[[v, u]] = w % 2
end

@used=Array.new(N, false)
@ans=Array.new(N, 0)
dfs(0)
puts @ans


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

int main() {
    vector<int> cnt(101);
    int a;
    int ma_cnt = 0;
    while(cin >> a) {
        ma_cnt = max(ma_cnt, ++cnt[a]);
    }
    vector<int> res;
    for(int i=0; i<101; ++i) {
        if(cnt[i] == ma_cnt) {
            cout << i << endl;
        }
    }
}


Measured memory_bytes: 3080
n=int(input())
a=sorted([int(input()) for i in range(n)])

now=a[0]
odd=False
ans=0
for i in range(n):
	#前の文字と一緒の時
	if a[i]==now:
		odd=not odd
	#前の文字と違う時
	else:
		#前の文字の個数の偶奇を判定し、奇数ならansをインクリメント
		ans+=odd
		#注目する文字を今の文字にする
		now=a[i]
		odd=True
#最後の文字をきちんと処理するためにoddを加える
print(ans+odd)

Measured memory_bytes: 8284
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000000)
from collections import deque 
INF = int(1e9)
ans = INF
def main():
    N, M, X = map(int, readline().split())
    costs = []
    score = []
    for _ in range(N):
        c, *d = map(int, readline().split())
        costs.append(c)
        score.append([i for i in d])
    dq = deque()
    def dfs():
        global ans
        if len(dq) == N:
            cost = 0
            sumScore = [0 for _ in range(M)]
            for i in range(N):
                if dq[i]:
                    cost += costs[i]
                    for j in range(M):
                        sumScore[j] += score[i][j]
            flag = True 
            for i in range(M):
                if sumScore[i] < X: 
                    flag = False

            if flag:
                ans = min(ans, cost)
                return 
            return 
        for i in range(2): 
            dq.append(i)
            dfs()
            dq.pop()

    dfs()
    if ans == INF:
        print(-1)
    else:
        print(ans)
if __name__ == '__main__':
    main()


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n;cin >> n;
    vl a(n+1);
    rep1(i,n+1)cin>>a[i];
    vl b(n+1);
    for(int i = n;i>0;i--){ //n番目から入れる個数を確定させる
        ll num = 0;
        for(int j = 2*i;j<=n;j+=i){
            if(b[j] & 1)num++;
        }
        if(a[i] == 0){
            if(num % 2 == 0)b[i] = 0;
            else b[i] = 1;
        }
        else{
            if(num % 2 == 1)b[i] = 0;
            else b[i] = 1;
        }
    }
    vl res;
    rep1(i,n+1)if(b[i])res.push_back(i);

    if(res.size() == 0){
        out(0);
        return 0;
    }
    out(res.size());
    rep(i,res.size()){
        if(i)cout << " ";
        cout << res[i];
    }
    cout << endl;
}


Measured memory_bytes: 5108
#include <iostream>
#define MAXH 10001
#define MAXN 1000
#define INF (999999999)
using namespace std;
inline int clamp(int a){ return (a > 0)? a:0; }
int cost[MAXN][MAXH] = {0};
int main(){
	int H, N;
	int A[MAXN], B[MAXN];
	cin >> H >> N;
	for(int i=0; i<N; i++)
		cin >> A[i] >> B[i];
	for(int i=0; i<N; i++)
		for(int j=1; j<=H; j++)
			cost[i][j] = min(i? cost[i-1][j]:INF, cost[i][clamp(j-A[i])] + B[i]);
	cout << cost[N-1][H] << endl;
}




	


Measured memory_bytes: 39296
#include<bits/stdc++.h>
using namespace std;
#define    bit(a)          __builtin_popcount(a)
#define    all(x)           x.begin(), x.end()
#define    minv(v)         *min_element(all(v))
#define    maxv(v)         *max_element(all(v))
#define    unq(v)           sort(all(v)),v.erase(unique(all(v)),v.end())
#define    w(x)             while(x--)
#define    rep(i,a,b)       for(i=a;i<=b;i++)
#define    ll               long long
#define    pb               push_back
#define    vii              vector<int>
#define    vll              vector<ll>
#define    vcc              vector<char>
#define    sii              set<int>
#define    sll              set<ll>
#define    scc              set<char>
#define    li               list<int>
#define    pii              pair<int,int>
#define    pll              pair<ll,ll>
#define    mii              map<int,int>
#define    mll              map<ll,ll>
#define    fill(arr,x)      memset(arr,x,sizeof(arr))
#define    gcd(a,b)         __gcd(a,b)
#define    lcm(a,b)        (a*(b/gcd(a,b)))
#define    srtc(a,b)        sort(a,a+b,greater<int>())
#define    pi               acos(-1.00)
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*
//find the position of 0 or 1 in binary representation
int zero(int n)
{
    int i=1,pos=0;
    while(n)
    {
        if(n%2==0)pos=i;
        n/=2;
        i++;
    }
    return pos;
}
*/
int t;
string s;
int main()
{
    _ios;
    ll x,y;
    cin>>x>>y;
    if(y>=x*2&&y<=x*4&&y%2==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}





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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;


void solve(){
	ll n,k;
	cin>>n>>k;
	cout<<ll(k*pow(k-1,n-1));
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;
//	ll t;cin>>t;while(t--)
	solve();

}


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

int main() 
{
    int X,A,B;
    cin >> X >> A >> B;
    
    if (A >= B) {
        cout << "delicious";
    }else if(A+X >= B){
        cout << "safe";
    }else{
        cout << "dangerous";
    }
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N;
	cin >> N;
	vector <string> s;
	for (int ii = 0; ii < N; ++ii){
		string tmp;
		cin >> tmp;
		sort(tmp.begin(), tmp.end());
		s.push_back(tmp);
	}

	sort(s.begin(), s.end());

	ll ans = 0;
	string ref = s[0];
	ll cnt = 1;
	for (int ii = 1; ii < N; ++ii){
		if (ref == s[ii]){
			cnt++;
		} else {
			//清算
			ans += cnt*(cnt-1)/2;
			cnt = 1;
			ref = s[ii];
		}
	}
	if (cnt > 1){
		ans += cnt*(cnt-1)/2;
	}


	cout << ans << "\n";


	return 0;
}


Measured memory_bytes: 5748
# frozen_string_literal: true

def ina
  gets.chomp.split(' ').map(&:to_i)
end
n = gets.to_i
an = ina
bn = ina
buckets = Array.new(n, 0)
sa = Array.new(n+1, 0)
sb = Array.new(n+1, 0)
an.each do |ai|
  buckets[ai - 1] += 1
  sa[ai]+=1
end
bn.each do |bi|
  buckets[bi - 1] += 1
  sb[bi]+=1
end
satisfy = buckets.max <= n

if !satisfy
  puts 'No'
else
  puts 'Yes'
  (1..n).each do |i|
    sa[i]+=sa[i-1]
    sb[i]+=sb[i-1]
  end
  off = sa[1..-1].zip(sb[0..-2]).map{|arr| arr[0]-arr[1]}.max
  res = (0...n).map{|i| bn[(i-off)%n]}
  puts res.join(' ')
end


Measured memory_bytes: 61676
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1'000'000'007;
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

int main() {
    ll x;
    cin >> x;
    ll ret = 2 * (x / 11);
    if (x % 11 != 0) {
        ret += x % 11 > 6 ? 2 : 1;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

ll ans=LINF;
vector<ll> h;
ll n,a,b;
void solve(ll l,ll r){
    if(l>r) return;
    //m回魔法
    ll m=(l+r)/2;
    ll dame=m*b;
    ll tmp=0;
    for(ll i=n-1;i>=0;i--){
        if(h[i]>dame){
            tmp+=(h[i]-dame+a-b-1)/(a-b);
        }
        if(tmp>m){solve(m+1,r);return;}
    }
    ans=min(ans,m);
    solve(l,m-1);
}

int main(){
    
    cin>>n;
    cin>>a>>b;
    h.resize(n);
    ll hmax=-1;
    rep(i,n){cin>>h[i];hmax=max(hmax,h[i]);}

    sort(ALL(h),greater<ll>());
    solve(1ll,(hmax+b)/b);
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int n,i,j;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  int ma=0;
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
      ma=max(ma,abs(a[i]-a[j]));
    }
  }
  cout<<ma;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,i;
    cin>>n;
    for(i=n;;i+=n){
        if(i%2==0){
            cout<<i<<endl;
            return 0;
        }
    }
}


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

using namespace std;

int main() {
    long long X, m, ans;
    cin >> X;
    m = 100;
    ans = 0;
    while(m < X){
        ans++;
        m *= 1.01;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	string n;
	cin >> n;
	if (n[0] == '1') {
		n[0] = '9';
	}
	else {
		n[0] = '1';
	}

	if (n[1] == '1') {
		n[1] = '9';
	}
	else {
		n[1] = '1';
	}

	if (n[2] == '1') {
		n[2] = '9';
	}
	else {
		n[2] = '1';
	}

	cout << n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define Abs(x) ((x) > 0 ? (x) : -(x))
#define REP(i, n) for(int i = 0; i < n; i++)
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9 + 7
typedef long long ll;

int sort(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}

int
main(int argc, char *argv[])
{
  ll r[13] = {}, rr[13] = {};
  char s[100001];
  scanf("%s", s);

  int d[6] = {1, 10, 9, 12, 3, 4};

  int n = strlen(s);
  if(s[n - 1] != '?'){
    r[(s[n - 1] - '0') % 13]++;
    rr[(s[n - 1] - '0') % 13]++;
  }
  else{
    for(int i = 0; i <= 9; i++){
      r[i]++;
      rr[i]++;
    }
  }
  
  for(int i = n - 2; i >= 0; i--){
    
    for(int j = 0; j < 13; j++){
      r[j] = rr[j];
      rr[j] = 0;
    }
    if(s[i] == '?'){
      for(int j = 0; j <= 9; j++){
	int b = (j * d[(n - 1 - i) % 6])% 13;
	for(int k = 0; k < 13; k++){
	  rr[(b + k) % 13] += r[k];
	  rr[(b + k) % 13] %= MOD;
	}
      }
    }
    else{
      int f = s[i] - '0';
      f *= d[(n - 1 - i) % 6];
      f %= 13;
      for(int j = 0; j < 13; j++){
	rr[(f + j) % 13] = r[j];
      }
    }
    
  }
  
  printf("%lld\n", rr[5]);

  return 0;
}
    
    


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

int main()
{
  string s;
  cin >> s;
  assert(s == "ARC" || s =="ABC");
  if(s=="ABC")
  {
    s = "ARC";
  }
  else
  {
    s = "ABC";
  }
  cout <<s<<endl;
return 0;
}

Measured memory_bytes: 3572