akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int n,k;

signed main(){

    in(n,k);
    YN((n+1)/2>=k);

    return 0;
}


Measured memory_bytes: 888
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << (x) << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    OUT(n / 100 == n % 10 ? "Yes" : "No");
    return 0;
}



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

void solve() {
  int n, m;
  cin >> n >> m;
  priority_queue<pair<int, int>> a;
  rep(i,n) {
    int x;
    cin >> x;
    a.push(make_pair(x, 1));
  }
  rep(i, m) {
    int b, c;
    cin >> b >> c;
    a.push(make_pair(c, b));
  }
  ll ans = 0;
  int count = 0;
  int i = 0;
  while(i < n) {
    pair<int, int> p = a.top();
    a.pop();
    if (n - i < p.second) {
      ans += (ll) p.first * (n-i);
      break;
    } else {
      ans += (ll) p.first * p.second;
      i += p.second;
    }
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

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

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

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int m=1000;
    rep(i,n) s[i]=s[i]-'0';
    rep(i,n-2){
        int c=100*s[i]+10*s[i+1]+s[i+2];
        m=min(m,abs(c-753));
    }
    cout<<m<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long int
#define ull unsigned long long int
#define fasterInOut ios::sync_with_stdio(false); cin.tie(0);
#define pi acos(-1)
 
int main()    {
	//freopen("/home/mimi0007/Desktop/Temp/in", "r", stdin);
	fasterInOut;
	ll n, x, t;
	cin >> n >> x >> t;
	ll m = ceil((double)n/(double)x);
	cout << m * t << endl;
	return 0;
}


Measured memory_bytes: 3724
//Kaori Miyazono, did I reach you ?
//"I can't die because... I have to protect you." -Asuna Yuuki
 
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b > c + d) {
		cout << "Left"; 
	} else if (a + b == c + d) cout << "Balanced";
	else cout << "Right";
	return 0;
}







Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        d: u64
    }

    let mut v = vec!["Christmas".to_owned()];
    for _ in 0..(25 - d) {
        v.push("Eve".to_owned());
    }
    println!("{}", join(&v, " "));
}

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

Measured memory_bytes: 4352
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll N; cin >> N;
    vvc S(N, vc(N));
    vc lis(0);
    rep(i, 0, N){
        rep(j, 0, N){
            cin >> S[i][j];
        }
    }
    map<char, vector<P>> m;
    rep(i, 0, N){
        rep(j, 0, N){
            if(m.find(S[i][j]) == m.end()){
                lis.emplace_back(S[i][j]);
                vector<P> h(0);
                h.emplace_back(P(i, j));
                m[S[i][j]] = h;
            }else{
                m[S[i][j]].emplace_back(P(i,j));
            }
        }
    }
    vector<P> q;
    rep(i, 0, N){
        q.emplace_back(P(i,0));
    }
    rep(i, 1, N){
        q.emplace_back(P(0,i));
    }
    for(auto x: lis){
        vector<P> t = m[x];
        ll m = sz(q);
        vector<P> r(0);
        rep(j, 0, m){
            P s = q[j];
            ll a = s.first, b = s.second;
            bool isok = true;
            for(auto y: t){
                bool ok = false;
                ll c = y.first, d = y.second;
                ll e = d - b + a, f = c - a + b;
                if(e<0){e = N + e;}
                else if(e > N-1){e = e%N;}
                if(f<0){f = N + f;}
                else if(f > N-1){f = f%N;}
                if(c == d){ok = true;}
                else{
                    if(S[c][d] == S[e][f]){ok = true;}
                }
                if(!ok){isok = false;}
            }
            if(isok){r.emplace_back(s);}
        }
        q = r;
    }
    ll ans = 0;
    for(auto x:q){
        ll n = max(x.first, x.second);
        ans += N - n;
    }
    prt(ans);
}

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

using namespace std;

#define sz(a) int(a.size())

const int MAX_N = 1e5+10;
int P [MAX_N], R[MAX_N];

int find (int x) {return x == P[x] ? x : P[x] = find(P[x]);}

bool unionS (int x, int y) {
	x = find(x), y = find(y);
	if (x == y) return 0;
	if (R[x] < R[y]) swap(x,y);
	R[x] += R[y];
	P[y] = x;
	return 1;
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) P[i] = i, R[i] = 1;
	for (int i = 0; i < m; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		x--, y--;
		unionS(x, y);
	}

	set <int> r;
	for (int i = 0; i < n; i++) r.insert(find(i));

	cout << sz(r) << endl;
}


Measured memory_bytes: 5760
n,m=map(int,input().split())
h=list(map(int,input().split()))
cnt=[0]*n
chk=[0]*n
ans=0

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]>h[b-1]:
        cnt[a-1] +=1
    if h[a-1]<h[b-1]:
        cnt[b-1]+=1
    chk[a-1]+=1
    chk[b-1]+=1
    
for i in range(n):
    if cnt[i]==chk[i]:
        ans+=1
        
print(ans)

Measured memory_bytes: 20112
grid = [list(map(int, input().split())) for _ in range(3)]
ds = []
for c1, c2, c3 in grid:
    ds.append([c1-c2, c2-c3, c3-c1])
count = 0
for i in range(3):
    if ds[0][i] == ds[1][i] == ds[2][i]:
        count += 1
print('Yes' if count == 3 else 'No')

Measured memory_bytes: 3064
s = input()
set = {'A', 'T', 'G', 'C'}
l, ans = 0, 0
for i in range(len(s)):
  if s[i] in set:
    l += 1
  else:
    ans = max(l, ans)
    l = 0
ans = max(l, ans)
print(ans)

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

int main() {
  int A;
  cin>>A;
  cout<<"Christmas"<<endl;
  if(A<=24){
    cout<<"Eve"<<endl;
    if(A<=23){
      cout<<"Eve"<<endl;
      if(A==22){
        cout<<"Eve"<<endl;
      }
    }
  }
}


Measured memory_bytes: 256
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}


int main()
{
  ll N;
  cin >> N;
  vector<ll> a(5);
  rep(i, 5) cin >> a[i];
  int i = 0;
  ll ans = 0;
  foreach(x, a){
    ll t = (N + x - 1) / x + 4;
    ans = max(ans, t);
    i++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
    string s;
    ll k;
    cin >> k>>s;
    if (s.size() <= k) cout << s << endl;
    else {
        for (ll i = 0; i < k;i++){
            cout << s[i];
        }
        cout << "..." << endl;
    }
}


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

const unsigned int NUM = 10;

int main(){
	std::vector<int> nums(NUM);
	
	for(auto& num : nums){
		std::cin >> num;
	}

	std::sort(nums.begin(), nums.end(), std::greater<int>());

	std::cout << nums[0] << std::endl;
	std::cout << nums[1] << std::endl;
	std::cout << nums[2] << std::endl;
}

Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		if(a*b == 15 ) {
			System.out.println('*');
		}else if(a+b ==15) {
			System.out.println('+');
		}else {
			System.out.println('x');
		}
	}

}

Measured memory_bytes: 22996
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// 入力の受け取り
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();

		int bird = 0;
		boolean ans = false;

		for (int i = 0; i <= X; i ++) {
			bird = i;
			int tar = X - bird;
			if ((bird * 2 + tar * 4 ) == Y) {
				ans = true;
				break;
			}

		}

		System.out.println(ans ? "Yes" : "No");

		sc.close();
	}
}


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

int main(){
	int h1, h2, m1, m2, k, ta, tb, t;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	t = h2*60 + m2 - h1*60 - m1;
	cout << t-k << endl;
}




Measured memory_bytes: 3624
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var NTE=Arr.shift().split(" ").map(Number);
var N=NTE[0];
var T=NTE[1];
var E=NTE[2];
var x=Arr.shift().split(" ").map(Number);
var ans=-1;
for(var i=0;i<N;i++){
   if(ans!=-1)break;
   var time;
   var j=1;
   while(true){
      time=x[i]*j;
      if(T+E<time)break;
      if(T-E<=time && time<=T+E){ans=i+1;break;}
      j++;
   }
}
console.log(ans);

Measured memory_bytes: 7384
import java.math.*;import java.util.*;class Main{public static void main(String[]a){for(Scanner s=new Scanner(System.in);s.hasNext();){BigInteger x=s.nextBigInteger(),y=s.nextBigInteger();System.out.println(x.gcd(y)+" "+x.multiply(y).divide(x.gcd(y)));}}}

Measured memory_bytes: 12000
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;


ll powmod(ll k){
    ll ret=1;
    ll n=2LL;
    while(k>0){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k/=2;
    }
    return ret;
}

int cnt[101010];
bool even[101010],odd[101010],e[101010],o[101010],eve[101010],od[101010],e3[101010],o3[101010];
int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<pint,int>> v;
    rep(i,m){
        int a,b,c;
        cin>>a>>b>>c;
        --a;--b;
        if(a>b)swap(a,b);
        v.push_back({{a,b},c});
    }
    sort(v.begin(),v.end());
    v.push_back({{inf,inf},inf});
    v.push_back({{inf,inf},inf});
    rep(i,n){
        cnt[i]=i;
        even[i]=odd[i]=true;
        e[i]=o[i]=true;
        e3[i]=o3[i]=true;
        eve[i]=od[i]=true;
    }
    rep(i,m){
        if(v[i].first==v[i+1].first){
            cnt[v[i].first.second]--;
            if(v[i].first.second==v[i].first.first+1){
                if(v[i].second==v[i+1].second)o[v[i].first.second]=false;
                else e[v[i].first.second]=false;
                
            }
            else if(v[i].first.second==v[i].first.first+2){
                if(v[i].second==v[i+1].second)o3[v[i].first.second]=false;
                else e3[v[i].first.second]=false;
            }
            else {
                if(v[i].second==v[i+1].second)odd[v[i].first.second]=false;
                else even[v[i].first.second]=false;
            }
            i++;
        }
        else {
            if(v[i].first.first==v[i].first.second){
                if(v[i].second)eve[v[i].first.second]=false;
                else od[v[i].first.second]=false;
            }
            else {
                cnt[v[i].first.second]--;
            }
        }
    }
    ll ans0=eve[0],ans1=od[0];
    rep(i,n-1){
        ll ret0=0;
        if(eve[i+1]){
            if(e[i+1]&&e3[i+1]&&even[i+1])ret0+=ans0*powmod(cnt[i+1])%mod;
            if(o[i+1]&&o3[i+1]&&even[i+1])ret0+=ans1*powmod(cnt[i+1])%mod;
        }
        ll ret1=0;
        if(od[i+1]){
            if(e[i+1]&&o3[i+1]&&even[i+1])ret1+=ans1*powmod(cnt[i+1])%mod;
            if(o[i+1]&&e3[i+1]&&even[i+1])ret1+=ans0*powmod(cnt[i+1])%mod;
        }
        ans0=ret0%mod;
        ans1=ret1%mod;
    }
    cout<<(ans0+ans1)%mod;
    return 0;
}


Measured memory_bytes: 2168
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

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...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	double d, t, s; cin >> d >> t >> s;
	cout << (((d / s) > t) ? "No" : "Yes");

	return 0;
}

Measured memory_bytes: 3776
#include <stdio.h>

int main(void) {
	int h,w,ih,iw;
	while (scanf("%d%d",&h,&w), h != 0){
		for(ih = 1; ih <= h;ih++){
			for(iw = 1; iw <= w;iw++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 572
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/

int main() {
    ll N;
    ll cnt = 1;
    cin >> N;
    while (N) {
        N /= 2;
        cnt*= 2;
    }
    cout << cnt - 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100010];
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0; i<n; i++) scanf("%d",&a[i]);
	int m;
	scanf("%d",&m);
	while(m--)
	{
		int x;
		scanf("%d",&x);
		if(*lower_bound(a, a+n, x) == x) printf("1\n");
		else printf("0\n");
	}
	return 0;
}


Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];
    vector<ll> constant(m + 5, 0), variable(m + 5, 0);
    for(int i = 0; i < n-1; ++i){
        int s = a[i], t = a[i+1];
        if(s < t){
            constant[1] += t - s;
            constant[s+1] -= t - s;
            constant[s+1] += 1 + t;
            constant[t+1] -= 1 + t;
            constant[t+1] += t - s;
            constant[m+1] -= t - s;
            variable[s+1] += -1;
            variable[t+1] -= -1;
        }
        else{
            constant[1] += 1 + t;
            constant[t+1] -= 1 + t;
            constant[t+1] += m - s + t;
            constant[s+1] -= m - s + t;
            constant[s+1] += m + 1 + t;
            constant[m+1] -= m + 1 + t;
            variable[1] += -1;
            variable[t+1] -= -1;
            variable[s+1] += -1;
            variable[m+1] -= -1;
        }
    }
    for(int i = 1; i <= m; ++i){
        constant[i+1] += constant[i];
        variable[i+1] += variable[i];
    }
    for(int i = 1; i <= m; ++i) variable[i] *= i;
    vector<ll> sum(m + 5, 1e+15);
    for(int i = 1; i <= m; ++i) sum[i] = constant[i] + variable[i];
    ll res = *min_element(sum.begin(), sum.end());
    cout << res << endl;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main(){
//freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int a, b;
    cin >> a >> b;
    if(a+b>=10) cout  << "error"<<endl;
    else cout << a+b << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int high[100];

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++)cin>>high[i];

  int cnt=0;
  bool st;
  for(int i=0;i<100;i++){
    if(high[0]>0){
      cnt++;
      st=true;
    }else{
      st=false;
    }
    for(int i=0;i<n;i++){
      if(high[i]>0){
        if(!st){
          cnt++;
          st=true;
        }
        high[i]--;
      }else{
        st=false;
      }
    }
  }
  cout<<cnt<<endl;

  return 0;
}


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

using namespace std;

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main()
{
    boost;
    time_t tic, toc;

    ll tt = 1, n, m, k = 0, i, j, p, q;
    ll a, b, c, d, h, w, u, v, x, y;
    ll l = 0, r = 0;
    ll ans = 0;

    bool poss = true;

    string s;

    // cin >> tt;
    tic = clock();
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> n >> k;
        vi arr(n);
        loop(z, arr) cin >> z;
        sort(arr.B, arr.E);

        ans = 0;
        for(i = 0; i < k; i++) ans += arr[i];
        cout << ans << nl;
    } 
    // cerr << (clock() - tic*1.0) / CLOCKS_PER_SEC << nl;
    return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String ans = "";
		for(int i = 0; i < s.length(); i++) {
			ans = ans + "x";
		}
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 38684
#include <bits/stdc++.h>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

typedef long long ll;

const ll p = 1e9 + 7;

class Matrix{
public:
  vector<vector<long long> > a;
  int rows, cols;

  Matrix(){}
  Matrix(int){}

  Matrix(int r, int c):rows(r), cols(c){
    a.resize(rows);
    for(int i = 0; i < r; i++){
      a[i].resize(cols);
    }
  }

  vector<long long>& operator[](int i){ return a[i]; }
};

Matrix operator*(const Matrix& m1, const Matrix& m2){
  Matrix result(m1.rows, m2.cols);
  for(int i = 0; i < result.rows; i++){
    for(int j = 0; j < result.cols; j++){
      for(int k = 0; k < m1.cols; k++){
	result.a[i][j] = (result.a[i][j] + m1.a[i][k] * m2.a[k][j]) % p;
      }
    }
  }
  return result;
}

ostream& operator<<(ostream& fout, const Matrix& m){
  for(int i = 0; i < m.rows; i++){
    for(int j = 0; j < m.cols; j++){
      fout << m.a[i][j] << " ";
    }
    fout << endl;
  }
  return fout;
}

int main() {
  ll n, k; cin >> n >> k;
  Matrix A(n, n);
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> A[i][j];
  Matrix B = power(A, k);
  ll ans = 0;
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) ans = (ans + B[i][j]) % p;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    string s; cin>>s;
    const int N=s.size();

    string ans="AC";
    if(s[0]!='A'){
        ans="WA";
    }
    if(count(s.begin()+2,s.end()-1,'C')!=1){
        ans="WA";
    }
    REP(i,N){
        if(s[i]!='A' and s[i]!='C' and isupper(s[i])){
            ans="WA";
        }
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define maxl 65
#define maxn 100005
#define LL long long
using namespace std;
int n,tot;
LL ans,sum,a[maxn],b[maxn],p[maxl];
inline LL read(){
	LL ret=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return ret*f;
}
void insert(LL x){
	for (int i=1;i<=tot;i++)
	if (x&((LL)1<<b[i])){
		if (!p[i]){p[i]=x;break;}
		x^=p[i];
	}
}
int main(){
	n=read();
	for (int i=1;i<=n;i++) a[i]=read(),sum^=a[i];
	for (int i=61;i>=0;i--) if (!(sum&((LL)1<<i))) b[++tot]=i;
	for (int i=61;i>=0;i--) if (sum&((LL)1<<i)) b[++tot]=i;
	for (int i=1;i<=n;i++) insert(a[i]);
	for (int i=1;i<=tot;i++)
	if (!(ans&((LL)1<<b[i]))) ans^=p[i];
	printf("%lld\n",(ans^sum)+ans);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define mod 1000000007
#define inv2 500000004

using namespace std;

const int N = 3010;
int add(int x,int y){
	x += y;
	if (x >= mod) x -= mod;
	return x;
}

int n , q , a[N] , f[N][N] , g[N][N];

int main(){
	
	scanf("%d%d",&n,&q);
	
	for (int i = 1;i <= n;i++){
		scanf("%d",a+i);
	}
	
	for (int i = 1;i <= n;i++){
		for (int j = i + 1;j <= n;j++){
			if (a[i] > a[j]){
				f[i][j]++;
			}
			if (a[i] < a[j]){
				f[j][i]++;
			}
			
		}
	}
	
	int mul = 1;
	while (q--){
		mul = 2ll * mul % mod;
		int x , y;scanf("%d%d",&x,&y);
		
		for (int i = 1;i <= n;i++){
			if (i != x && i != y){
				g[y][i] = add(g[y][i] , f[x][i]);		
				g[x][i] = add(g[x][i] , f[y][i]);		
				
				g[i][x] = add(g[i][x] , f[i][y]);
				g[i][y] = add(g[i][y] , f[i][x]);
			}
		}
		
		g[x][y] = add(g[x][y] , f[y][x]);	
		g[y][x] = add(g[y][x] , f[x][y]);
		
		for (int i = 1;i <= n;i++){
			if (i != x && i != y){
				f[i][x] = add(f[i][x] , g[i][x]);g[i][x] = 0;
				f[i][y] = add(f[i][y] , g[i][y]);g[i][y] = 0;
				f[x][i] = add(f[x][i] , g[x][i]);g[x][i] = 0;
				f[y][i] = add(f[y][i] , g[y][i]);g[y][i] = 0;
			}
		}
		
		f[x][y] = add(f[x][y] , g[x][y]);g[x][y] = 0;
		f[y][x] = add(f[y][x] , g[y][x]);g[y][x] = 0;
		
		
		for (int i = 1;i <= n;i++){
			if (i != x && i != y){
				f[i][x] = 1ll * inv2 * f[i][x] % mod;
				f[i][y] = 1ll * inv2 * f[i][y] % mod;
				f[x][i] = 1ll * inv2 * f[x][i] % mod;
				f[y][i] = 1ll * inv2 * f[y][i] % mod;
			}
		}
		
		f[x][y] = 1ll * f[x][y] * inv2 % mod;
		f[y][x] = 1ll * f[y][x] * inv2 % mod;		
	
	/*
		for (int i = 1;i <= n;i++)
		for (int j = 1;j <= n;j++)
		if (f[i][j]) printf("%d %d] %d\n",i,j,f[i][j]);*/
	}
	
	int res = 0;
	for (int i = 1;i <= n;i++)
	for (int j = i + 1;j <= n;j++)
	res = add(res , f[i][j]);
	
	res = 1ll * res * mul % mod;
	cout<<res;
    return 0;
}

Measured memory_bytes: 70912
N, M = map(int, input().split())

odd_head, odd_tail = 1, 0
even_head, even_tail = 0, 0

if M & 1:
    odd_tail = M + 1
    even_head = M + 2
    even_tail = M + 2 + M - 1
else:
    odd_tail = 1 + (M - 1)
    even_head = M + 1
    even_tail = M + 1 + M

while odd_tail - odd_head > 0:
    print(odd_head, odd_tail)
    odd_head += 1
    odd_tail -= 1

while even_tail - even_head > 0:
    print(even_head, even_tail)
    even_head += 1
    even_tail -= 1

Measured memory_bytes: 9188
//c.......

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(){
    int n;
    scanf("%d",&n);
    int count4 = 0;
    int count2 = 0;
    int v;
    for(int i=0;i<n;i++){
        scanf("%d",&v);
        if(v%4==0) count4++;
        else if(v%2==0) count2++;
    }
    
    //count2 == 3;count4 == 0; n==3;
    //printf("%d   %d\n",count2,count4);
    if((count4+count2/2)>=n/2) printf("Yes");
    else printf("No");
    
    
    return 0;
}


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

int main() {
	int n, c, k;
	cin >> n >> c >> k;
	vector<int> t(n);
	map<int, int> mp;
	rep(i, n) cin >> t[i];
	sort(all(t));
	int ans = 1;
	int cnt = 0;
	int lim = t[0] + k;
	rep(i, n) {
		mp[t[i]]++;
	}
	rep(i, n) {
		cnt++;
		if (cnt > c) {
			ans++;
			cnt = 1;
			lim = t[i] + k;
		} else if (lim < t[i]) {
			ans++;
			cnt = 1;
			lim = t[i] + k;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5376
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x[] = new int[n];
    int y[] = new int[n];

    for(int i = 0 ; i < n ; ++i){
      x[i] = sc.nextInt();
      y[i] = sc.nextInt();
    }
    
    double sum = 0;
    
    for(int i = 0 ; i < n ; ++i){
      for(int j = i+1 ; j < n ; ++j){
        int xx= x[i]-x[j];
        int yy= y[i]-y[j];
        int r= xx*xx + yy*yy;
        sum += Math.sqrt(r);
      }      
 
    }

    System.out.println(sum * 2/n);
    
  }
}

Measured memory_bytes: 35752
import java.math.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long count = 0;
    for (long i = 1, len = (long) Math.floor(Math.sqrt(n)); i <= len; i++) {
      for (long j = i, lenj = n / i; j <= lenj; j++) {
        if (i * j == n) {
          continue;
        }
        if (i == j) {
          count++;
        } else {
          count += 2;
        }
      }
    }
    System.out.println(count);
  }
}


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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;
const double PI = 3.14159;

using namespace std;

int main() {

    string s, t;
    cin >> s >> t;

    int ans = 0;

    rep(i, s.length())
        if (s[i] != t[i]) ans++;

    AA(ans);
}

Measured memory_bytes: 3840
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');
 
var nums = lines.map(function(line) {
    return line.split(',').map(function(n){return +n;});
});

var sum = nums.reduce(function(p, n) {
    return p + n[0] * n[1];
}, 0);

var qsum = nums.reduce(function(p, n) {
    return p + n[1];
}, 0);

console.log(sum);
console.log(Math.round(qsum/nums.length));

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

using P = pair<int, int>;

int main() {
  int N, M;
  cin >> N >> M;
  set<P> requests;
  for (int i{}; i < M; ++i) {
    int a, b;
    cin >> a >> b;
    requests.insert({a, b});
  }
  int ans{1};
  P range(1, N);
  for (const auto &r : requests) {
    P uni{max(range.first, r.first), min(range.second, r.second)};
    if (uni.first < uni.second) {
      range = uni;
    } else {
      range = r;
      ++ans;
    }
  }

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


Measured memory_bytes: 4992
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 
typedef tuple<int, int, char, long long, string>  T;

void solve(){
  vector<T> v;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
	  int a, b; char c; long long d; string s;
	  cin >> a >> b >> c >> d >> s;
	  v.push_back(T(a, b, c, d, s));
   }
   sort(all(v));
   for(int i = 0; i < n; i++){
	   cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << " " << get<3>(v[i]) << " " << get<4>(v[i]) << endl; 
	 }	
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 11924
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
  int T, D, t_A, t_B, d_A, d_B;
  cin >> T >> D >> t_A >> t_B >> d_A >> d_B;

  double ret = -1;
  for(int va=0;va<=D;va+=d_A){
	for(int vb=0;vb<=D-va;vb+=d_B){
	  if(va + vb < 1) continue;
	  double temp = (t_A * va + t_B * vb) * 1.0 / (va + vb);
	  ret = (ret < 0)? abs(temp-T): min(ret, abs(temp - T));
	}
  }

  printf("%.10f\n", ret);

  return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
ll inf=100000000000000000,mod=1000000007,m;

int main(){
   
   
   ll h,n;
   cin>>h>>n;
   ll arr[n],barr[n];
   for(ll i=0;i<n;i++)cin>>arr[i]>>barr[i];
   ll dp[n][h+1],mi;
   for(ll i=0;i<n;i++)for(ll j=0;j<h+1;j++)dp[i][j]=inf;
   for(ll i=1;i<h+1;i++)dp[0][i] = ((i-1)/arr[0] +1)*barr[0];
   for(ll i=1;i<n;i++){
       for(ll j=1;j<h+1;j++)
        {
           mi = inf;
           if(j-arr[i]>=0) mi=dp[i][j-arr[i]];
           if(mi==inf && j-arr[i]>=0) mi=dp[i-1][j-arr[i]];
           if(mi==inf) mi = (j-1)/arr[i] * barr[i];
           dp[i][j]=min(dp[i-1][j],mi+barr[i]);
       }
   }
   cout<<dp[n-1][h]<<endl;

}


Measured memory_bytes: 78336
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long
int a[114514],b[114514];
signed main(){
	int n,k;
	cin>>n;
	rep(0,i,n)cin>>a[i];
	cin>>k;
	rep(0,i,k)cin>>b[i];
	int sum=0;
	rep(0,i,k){
		rep(0,j,n){
			if(b[i]==a[j]){
				sum++;
				j+=114514;
			}	
		}	
	}	
	c(sum)
}		


Measured memory_bytes: 3116
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 500010;
const int INF = 9999999;
int n;
int A(int x){
   int sum = 0;
   while (x){
      sum += x % 10;
      x /= 10;
   }
   return sum;
}
int main(){
  scanf("%d", &n);
  int mini = INF;
  for (int i = 1; i < n; ++i){
    mini = min(mini, A(i) + A(n - i));
  }
  printf("%d", mini);
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll h,a;
    cin>>h>>a;
    cout<<(h+a-1)/a;    
    return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    a, b, x = map(int, readline().split())
    ans = b//x - (a-1)//x
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
def makePascal(n):  # l[m][k] で mCk を取り出せるリストを返す
	res = [[1]]

	for m in range(1, n+1):
		l = []
		for k in range(m + 1):
			if k == 0 or k == m:
				l.append(1)
			else:
				tmp = res[m-1][k-1] + res[m-1][k]
				l.append(tmp)
		res.append(l)

	return res

N, P = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N):
	if A[i] % 2 == 0:
		A[i] = 0
	else:
		A[i] = 1

ans = 0
comb = makePascal(N)
if P == 0:
	vol = 2 ** A.count(0)
	odds = A.count(1)
	i = 0
	while True:
		if i > odds:
			break
		else:
			ans += comb[odds][i] * vol
			i += 2
else:
	vol = 2 ** A.count(0)
	odds = A.count(1)
	i = 1
	while True:
		if i > odds:
			break
		else:
			ans += comb[odds][i] * vol
			i += 2
	
print(ans)


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

int main() {
    ll n,k,ans,temp;
    cin>>n>>k;
    if (n%k==0) ans=0;
    else if(n>k){
        temp=n%k;
        ans=abs(temp-k);
        ans=min(ans,temp);
    } else {
        temp=n%k;
        ans=k-n;
        ans=min(ans,temp);
    }                                                                                                                                                                                                                     
    cout<<ans<<endl;
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0]*q
c = [0]*q
for i in range(q):
    b[i], c[i] = map(int, input().split())

k = [0]*(10**5+1)
for i in range(n):
    k[a[i]] += 1

s = sum(a)

for i in range(q):
    s = s +(c[i] - b[i])*k[b[i]]
    k[c[i]] += k[b[i]]
    k[b[i]] = 0
    print(s)

Measured memory_bytes: 21984
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int w = sc.nextInt();
        
        char[] list = S.toCharArray();
        for(int i = 0; i < list.length; i += w){
          System.out.print(list[i]);
        }
         System.out.println();
      
    }
}

Measured memory_bytes: 36088
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main (){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	   
    int n;
	cin >> n;
	double x,sum=0;
	string u;
	rep(i,n){
		cin >> x >> u;
		if(u=="BTC"){
			x *= 380000;
		}
		sum += x;
	}

    cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;cin>>n;
	int ans = n%10;
	if(ans==2 || ans==4 || ans==5|| ans==7||ans==9)cout<<"hon";
	else if(ans==0 || ans==1||ans==6||ans==8) cout<<"pon";
	else cout<<"bon";
	
 
 }

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

using namespace std;

typedef long long ll;

const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T>
inline void chkmax(T&a, T b) { a = a > b ? a : b; }

short S1[110][110];
short S2[110][110];
short f[101][101][101][101];

inline short Sx(int x, int ly, int ry) { return ly < ry ? S1[x][ry] - S1[x][ly] : 0; }
inline short Sy(int y, int lx, int rx) { return lx < rx ? S2[rx][y] - S2[lx][y] : 0; }

int main() {
#ifdef LOCAL
	FILE("");
#endif

	int n = ri, m = ri, x, y;

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++) {
			char c = ge;
			while(c != 'E' && c != '.' && c != 'o') c = ge;
			S1[i][j] = S2[i][j] = c == 'o';
			if(c == 'E') x = i, y = j;
		}

	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			S1[i][j] += S1[i][j - 1];
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
			S2[i][j] += S2[i - 1][j];

	short res = 0;
	int Lx = x - 1, Rx = n - x;
	int Ly = y - 1, Ry = m - y;
	for(int lx = 0; lx <= Lx; lx++)
		for(int rx = 0; rx <= Rx; rx++)
			for(int ly = 0; ly <= Ly; ly++)
				for(int ry = 0; ry <= Ry; ry++) {
					short F = f[lx][rx][ly][ry];
					// cerr << lx << ' ' << rx << ' ' << ly << ' ' << ry << ' ' << F << endl;
					chkmax(res, F);
					int LX = x - lx - 1, RX = x + rx + 1;
					int LY = y - ly - 1, RY = y + ry + 1;
					if(LX > rx) chkmax(f[lx + 1][rx][ly][ry], short(F + Sx(LX, max(ry, LY), min(m - ly, RY - 1))));
					if(LY > ry) chkmax(f[lx][rx][ly + 1][ry], short(F + Sy(LY, max(rx, LX), min(n - lx, RX - 1))));
					if(RX <= n - lx) chkmax(f[lx][rx + 1][ly][ry], short(F + Sx(RX, max(ry, LY), min(m - ly, RY - 1))));
					if(RY <= m - ly) chkmax(f[lx][rx][ly][ry + 1], short(F + Sy(RY, max(rx, LX), min(n - lx, RX - 1))));
				}
	printf("%d\n", int(res));
	return 0;
}

Measured memory_bytes: 199040
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 300005;

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i ) {
            ret.pb( i );
            if( i * i != n ) ret.pb( n / i );

        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string s;
    cin >> s;
    int a, b, c;
    a = b = c = 0;
    for( int i = 0; i < s.size(); ++i ) {
        if( s[i] == 'a' ) ++a;
        if( s[i] == 'b' ) ++b;
        if( s[i] == 'c' ) ++c;

    }

    if( max( max( a, b ), c ) - min( min( a, b ), c ) > 1 ) cout << "NO";
    else cout << "YES";
    cout << endl;
    return 0;
}



Measured memory_bytes: 512
package main

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

func main() {
	N := nextInt()
	H := make([]int, N)

	for i := 0; i < N; i++ {
		H[i] = nextInt()
	}
	ok := true
	for i := 0; i < N-1; i++ {
		d := H[i+1] - H[i]
		if d >= 1 {
			// OK 減らしても問題ないので減らしておく
			H[i+1]--
		} else if d == 0 {
			// OK そのまますすめる
		} else {
			// NG
			ok = false
			break
		}
	}

	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 4096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();

		if((A % 3 == 0) || (B % 3 == 0) || ((A + B) % 3 == 0)) {
			System.out.println("Possible\r\n" +
					"");
		}else {
			System.out.println("Impossible\r\n" +
					"");
		}
	}
}

Measured memory_bytes: 22612
import sys

K = int(input())
A, B = map(int, input().split())

if K == 1:
    print('OK')
    sys.exit()

n = 1
while True:
    m = K * n
    if A <= m <= B:
        print('OK')
        sys.exit()

    if n == B:
        break

    n += 1

print('NG')


Measured memory_bytes: 9048
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int total = 0;
    for(int i = 0;i<n;i++){
      int h = sc.nextInt();
      if(h>=k)total++;
    }
    System.out.println(total);
  }
}


Measured memory_bytes: 58708
#include <stdio.h>
#include <string.h>

int main(void)
{
	char str[110], str2[110];
	int i, n, s;
	
	s = 0;
	
	while (scanf("%s", str) != EOF){
		
		n = strlen(str) - 1;
		
		for (i = 0; i < strlen(str); i++){
			str2[i] = str[n];
			n--;
		}
		
		str2[strlen(str)] = '\0';
		
		if (strcmp(str, str2) == 0){
			s++;
		}
	}
	
	printf("%d\n", s);
	
	return (0);
}

Measured memory_bytes: 544