akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	map<string , int> mp;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	}

	cout<<mp.size(); 
}

Measured memory_bytes: 19220
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll H,N;
    cin>>H>>N;
    
    rep(i,N){
        ll A;
        cin>>A;
        H-=A;
    }
    if(H<=0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
    
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  deque<int> que;
  rep(i,n) {
    int p = lower_bound(que.begin(), que.end(), a[i]) - que.begin();
    if (p == 0) {
      que.push_front(a[i]);
    } else que[p-1] = a[i];
  }
  int res = que.size();
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
string s,s1;
ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt,br[200008];
int main()
{
    ll test;

cin>>a;
for(i=1;i<=a;i++)
    cin>>ar[i];
sort(ar+1,ar+a+1);
for(i=1;i<a;i++)
    sum+=ar[i];

//    else
//        cout<<"1";
cout<<sum+ar[a]/2<<endl;
//cout<<"No"<<endl;

}





Measured memory_bytes: 2304
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(2, 2919), 3719)

    def test_2(self):
        self.assertEqual(think(22, 3051), 3051)


def solve():
    n, r = read()
    result = think(n, r)
    write(result)


def read():
    return read_int(2)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, r):
    return r if n >= 10 else r + 100 * (10 - n)


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 50928
#include <bits/stdc++.h>
using namespace std;
#define intMax 2147483647
#define longMax 9223372036854775807
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vector<int>>
#define vvl vector < vector<long long>
#define vii vector<pair<int, int>>
#define ii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repp(i, a, b) for (int i = a; i >= b; i--)
#define be(x) x.begin(), x.end()
#define rbe(x) x.rbegin(), x.rend()
#define pb push_back
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b;
    cin >> a >> b;
    if (b == 1)
    {
        cout << 0;
        return 0;
    }
    int x = a, z = 1;
    a--;
    while (b > x)
    {

        x += a;
        z++;
    }
    cout << z;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int __int128
using namespace std;
template<class T>
inline void read(T &a)
{
    T s = 0, w = 1;
    char c = getchar();
    while(c < '0' || c > '9'){if(c == '-') w = -1; c = getchar();}
    while(c >= '0' && c <= '9') {s = (s << 1) + (s << 3) + (c ^ 48);c = getchar();}
    a = s*w;
}

template<class T>
void write(T x)
{
	if(x >= 10)
	{
		write(x/10);
	}
	putchar(x%10+'0');
}
string s;
int k, ans, answer;
signed main()
{
    cin>>s;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'B') k++;
        if(s[i] == 'W') ans += k;
    }
    answer = max(answer, ans);
    write(answer);
    return 0;
}


Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
ans = []
origin = A[0]

for i in range(1, N):
  origin ^= A[i]
  
for j in range(N):
  ans.append(origin^A[j])

for k in range(len(ans)-1):
  print("{} ".format(ans[k]), end="")
print(ans[len(ans)-1])

Measured memory_bytes: 102044
function myOut(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var len = parseInt(input[0]);
  var red = 0;
  var list = input[1].split("");
  for(var i = 0; i < list.length; i++){
    if(list[i] == "R"){
       red++;
       }
  }
  var blue = len - red;
  if(red > blue){
     console.log("Yes");
     }else{
     console.log("No");
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs ll INF = 1e18;
cs int N = 5e3 + 50;
int n, A, B; ll dp[N];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d%d%d",&n,&A,&B);
	memset(dp,0x3f,sizeof(dp));dp[0]=0;
	for(int i=1,x; i<=n; i++){
		scanf("%d",&x);ll mn=INF;
		for(int j=0; j<=x; j++)mn=min(mn,dp[j]);
		for(int j=0; j<x; j++)dp[j]+=A;
		for(int j=x+1; j<=n; j++)dp[j]+=B;dp[x]=mn;
	} ll ans=INF;
	for(int i=0;i<=n;i++)ans=min(ans,dp[i]);
	cout<<ans; return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a<b){
	cout<<"a < b"<<endl;
	}if(a>b){
	cout<<"a > b"<<endl;
	}if(a==b){
	cout<<"a == b"<<endl;
	}
    return 0;
}

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

int main() {
	int n, ans = 0;
	string s;

	cin >> n >> s;

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int S, h, m, s;

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

	cin >> S;
	h = S / 3600;
	m = (S - h*3600) / 60;
	s = S % 60;
	cout << h << ":" << m << ":" << s << "\n";

	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
using namespace std;

void solve()
{
    ll n,p;
    cin >> n;
    if(n%2==0)
    {
        cout << "-1" << endl;
        return;
    }
    p=7%n;
    for(int i=1;i<=n;i++)
    {
        if(!p)
        {
            cout << i << endl;
            return;
        }
        p=(p*10+7)%n;
    }
    cout << "-1" << endl;
}

int main()
{
    int t=1;
    //cin >> t;
    while(t--)
    solve();

    return 0;
}



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

int main() {
  int n,p;
  std::string s;
  std::cin >> n >> p >> s;

  std::uint64_t counter = 0;
  if (p == 2 || p == 5) {
    for (int i = 0; i < n; ++i) {
      int a = s[i] - '0';
      if ((a % p) == 0) {
        counter += i + 1;
      }
    }
  } else {
    int mod[10000] = {1};
    int p10 = 1;
    int subs = 0;
    for (int i = n - 1; i >= 0; --i) {
      subs = (subs + (s[i] - '0') * p10) % p;
      counter += mod[subs];
      mod[subs]++;
      p10 = (p10 * 10) % p;
    }
  }

  std::cout << counter << std::endl;

  return 0;
}


Measured memory_bytes: 644
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
long long a[100001];//????????????????????????(????????????
const long long inf = 8000000000;
int zombie[100001];//????????????????????????
struct A {
	long long cost,to;
};
vector<long long>e[100001];//??????????????£????????????
long long g[100001];
struct P {
	long long cost, pos;
};
bool operator<=(P a, P b) {
	return a.cost <= b.cost;
}
bool operator>(P a, P b) {
	return a.cost > b.cost;
}
int main() {
	long long n, m, k, s, p, q, c, d;
	cin >> n >> m >> k >> s >> p >> q;
	for (int i = 0; i < k; i++) {
		cin >> c;
		zombie[i] = c;
		a[c] = 3;
	}
	for (int i = 0; i < m; i++) {
		cin >> c >> d;
		e[c].push_back(d);
		e[d].push_back(c);
	}
	for (int i = 0; i < k; i++) {
		priority_queue<P, vector<P>, greater<P>>p;
		fill(g, g + n + 1, inf);
		long long r = zombie[i];
		p.push(P{ 0,r });
		g[r] = 0;
		while (!p.empty()) {
			P t = p.top(); p.pop();
			for (int i = 0; i < (int)e[t.pos].size(); i++) {
				long long o = t.pos;
				if (g[e[o][i]] > g[o] + 1&&a[e[o][i]]!=3) {
					g[e[o][i]] = g[o] + 1;
					p.push(P{ g[o] + 1,e[o][i] });
					if (g[e[o][i]] <= s) a[e[o][i]] = 2;
					else break;
				}
			}
		}
	}
	priority_queue<P, vector<P>, greater<P>>r;
	for (int i = 0; i <= n; i++) {
		g[i] = inf;
	}
	r.push(P{ 0, 1 });
	g[1] = 0;
	while (!r.empty()) {
		P t = r.top(); r.pop();
		for (int i = 0; i < (int)e[t.pos].size(); i++) {
			long long co;
			if (a[e[t.pos][i]] == 2) co = q;
			else if(a[e[t.pos][i]]==0)co = p;
			else if(a[e[t.pos][i]]==3){
				goto stop;
			}
			if (g[e[t.pos][i]] > g[t.pos] + co) {
				g[e[t.pos][i]] = g[t.pos] + co;
				r.push(P{ g[e[t.pos][i]], e[t.pos][i] });
			}
			if (g[n] != inf) goto sto;
		stop:;
		}
	}
sto:;
	long long cos;
	if (a[n] == 2)cos = q;
	else cos = p;
	cout << g[n]-cos << endl;
}

Measured memory_bytes: 13584
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const int MAXN = 100010;

vector<int> G[MAXN];
int qtype[MAXN], vertex[MAXN], marked[MAXN];
int par[MAXN], pp[MAXN];

void init() {
    for (int i = 0; i < MAXN; i++) par[i] = i;
}

int find(int x) {
    if (par[x] == x) return x;
    return par[x] = find(par[x]);
}

void unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return;
    par[y] = x;
}

void dfs(int v, int p, int m) {
    int nm = m;
    if (marked[v]) nm = v;
    pp[v] = p;
    unite(nm, v);
    for (size_t i = 0; i < G[v].size(); i++) {
        dfs(G[v][i], v, nm);
    }
}

int main(void) {
    int N, Q;
    while (cin >> N >> Q) {
        if (N == 0 && Q == 0) break;
        init();
        for (int i = 0; i < MAXN; i++) marked[i] = 0;
        marked[1] = 1;
        for (int i = 0; i < MAXN; i++) G[i].clear();
        for (int i = 2; i <= N; i++) {
            int v;
            scanf("%d", &v);
            G[v].push_back(i);
        }
        for (int i = 0; i < Q; i++) {
            char c;
            scanf(" %c %d", &c, vertex+i);
            if (c == 'Q') qtype[i] = 1;
            else {
                qtype[i] = 0;
                marked[vertex[i]]++;
            }
        }
        dfs(1, 0, 0);
        ll ans = 0;
        for (int i = Q-1; i >= 0; i--) {
            if (qtype[i]) {
                ans += find(vertex[i]);
//                cout << "now ans is " << ans << endl;
            }
            else {
                marked[vertex[i]]--;
                if (!marked[vertex[i]]) unite(pp[vertex[i]], vertex[i]);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 13932
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(auto &a:A)cin>>a;
    auto B=A;
    sort(A.begin(), A.end(),greater<int>());
    for(auto b:B){
        if(b!=A[0]){
            cout<<A[0]<<endl;
        }else{
            cout<<A[1]<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }



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

	int N, M; cin >> N >> M;
	vei dp(1<<N, INF); dp[0] = 0;
	vector<pair<int, int>> key;
	rep(i,M) {
		int a, b; cin >> a >> b;
		int s = 0;
		rep(j,b) {
			int c; cin >> c; c--;
			s |= 1<<c;
		}
		key.emplace_back(s,a);
	}
	

	rep(s, 1<<N) {
		rep(i,M) {
			int t = s | key[i].fs;
			int cost = dp[s] + key[i].sc;
			dp[t] = min(dp[t], cost);
		}
	}
	int ans = dp.back();
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll H, N;
    cin >> H >> N;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;
    vector<ll> dp(H + 1, INF);
    dp[H] = 0;
    rrep(i, H, 0) {
        rep(j, N) {
            P p = items[j];
            ll m = max(0LL, i-p.first);
            dp[m] = min(dp[m], dp[i] + p.second);
        }
// print(dp);
    }
    cout << dp[0] << '\n';
}

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


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
using ll = long long;
#define rep(i, start, end) for (ll i = (ll)start; i < (ll)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double L;
    cin >> L;
    cout << fixed << setprecision(10) << (L / 3) * (L / 3) * (L / 3) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <string>
#include <set>
#include <map>
#include <cmath>
#include <cassert>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll A[SIZE];
ll sum[SIZE];
ll s2[SIZE];

int main()
{
	int n,Q;
	scanf("%d %d",&n,&Q);
	for(int i=0;i<n;i++) scanf("%lld",&A[i]);
	for(int i=0;i<n;i++)
	{
		sum[i]=0;
		if((n-i-1)%2==0) sum[i]=A[i];
		if(i>0) sum[i]+=sum[i-1];
		s2[i]=A[i];
		if(i>0) s2[i]+=s2[i-1];
	}
	while(Q--)
	{
		ll x;
		scanf("%lld",&x);
		int l=0,r=n+1;
		while(r-l>1)
		{
			int d=(l+r)/2;
			if(A[n-d]<=x) r=d;
			else
			{
				if(2*d-1>n) r=d;
				else
				{
					if(A[n-d]-x>=x-A[n-2*d+1]) l=d;
					else r=d;
				}
			}
		}
		ll ret=s2[n-1]-s2[n-l-1];
		if(n-2*l-1>=0) ret+=sum[n-2*l-1];
		printf("%lld\n",ret);
	}
	return 0;
}


Measured memory_bytes: 3968
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T &a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T &a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

vector< vector<lint> > ans;

void solve(lint l, lint r, lint level){
    if(r - l <= 1){
        if(ans[l][r] == -1){
            ans[l][r] = level;
            ans[r][l] = level;
        }
        return;
    }

    lint m = (l + r) / 2LL;
    for(lint i = l ; i < m ; ++i){
        for(int j = m ; j < r ; ++j){
            ans[i][j] = level;
            ans[j][i] = level;
        }
    }

    solve(l, m, level + 1);
    solve(m, r, level + 1);

    return;
}

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

    lint n;
    cin >> n;

    ans.resize(n);
    rep(i, n){
        ans[i].resize(n, -1LL);
    }

    solve(0, n, 1);

    rep(i, n - 1){
        REP(j, i + 1, n){
            cout << ans[i][j];
            if(j < n - 1){
                cout << ' ';
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 2432
<?php
fscanf(STDIN, '%d %d', $n, $m);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
$x = array_count_values($a);
for ($i  = 0; $i < $m; $i++) {
    fscanf(STDIN, '%d %d', $b, $c);
    $x[$c] = ($x[$c] ?? 0) + $b;
}
krsort($x);
$ans = 0;
foreach ($x as $k => $v) {
    $min = min($v, $n);
    $ans += $k * $min;
    $n -= $min;
    if ($n === 0) break;
}
echo $ans . PHP_EOL;

Measured memory_bytes: 23540
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Foldable
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import qualified Data.Set as S
import System.IO.Unsafe
import Debug.Trace

unew :: VU.Unbox a => Int -> VUM.IOVector a
unew !n = accursedUnutterablePerformIO $ VUM.unsafeNew n

uread :: VU.Unbox a => Int -> VUM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VU.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

umodify :: VU.Unbox a => Int -> (a -> a) -> VUM.IOVector a -> VUM.IOVector a
umodify !i !f !v =
  accursedUnutterablePerformIO $ VUM.unsafeModify v f i >> return v

uthaw :: VU.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

ufreeze :: VU.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uset :: VU.Unbox a => a -> VUM.IOVector a -> VUM.IOVector a
uset !a !v = accursedUnutterablePerformIO $ VUM.set v a >> return v

--solve :: Int -> Int -> VU.Vector (Int, Int) -> Int
solve !n !w !wvs = foldl'
  ( \(!acc) (!i) ->
    let p = uread (toIndex n i) dp in if 0 <= p && p <= w then i else acc
  )
  0
  [0 .. sumOfValue]
 where
  sumOfValue = VU.sum $ VU.map (\(_, v) -> v) wvs

  toIndex i k = i * (sumOfValue + 1) + k

  min' x y | y > w     = x
           | otherwise = min x y

  dp = VU.ifoldl'
    ( \(!dp) !i (!wi, !vi) -> foldl'
      ( \(!dp) !v ->
        let z = min'
              (uread (toIndex i v) dp)
              (if v - vi < 0 then w + 1 else uread (toIndex i (v - vi)) dp + wi)
        in  uwrite (toIndex (i + 1) v) z dp
      )
      dp
      [0 .. sumOfValue]
    )
    (uwrite (toIndex 0 0) 0 $ uset (w + 1) $ unew $ succ n * succ sumOfValue)
    wvs

main = do
  let readInt = fmap (second B.tail) . B.readInt

  (n, w) <-
    (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 readInt <$> B.getLine
  wvs <-
    VU.replicateM n
    $   (\vec -> (vec VU.! 0, vec VU.! 1))
    .   VU.unfoldrN 2 readInt
    <$> B.getLine
  print $ solve n w wvs


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


int main() {
    int N;
    std::cin >> N;

    std::vector<int> a(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
        sum = sum ^ a[i];
    }
    for (int i = 0; i < N - 1; i++) {
        std::cout << (sum ^ a[i]) << " ";
    }
    std::cout << (sum ^ a[N - 1]) << std::endl;
}


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

int main() {
    int k, n;
    cin >> k >> n;
    int temp = 0;
    pair<int, int> p;
    int A[n];
    REP(i, n) {
        scanf("%d", &A[i]);
        if(i > 0) {
            if(temp < A[i] - A[i - 1]) {
                p.first = A[i-1];
                p.second = A[i];
                temp = A[i] - A[i - 1];
            }
        }
    }
    if(temp < A[0] + k-A[n - 1]) {
        cout << k-(A[0]+k-A[n-1]) << endl;
        return 0;
    }

    cout << k - (p.second - p.first) << endl;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    A,B=mi()
    if A <= 5:
        print(0)
    elif 6<=A<=12:
        print(B//2)
    else:
        print(B)




if __name__ == "__main__":
    main()

Measured memory_bytes: 61952
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pii             pair<int , int >
#define in(a)           scanf("%d", &a)
#define in2(a, b)       scanf("%d%d", &a, &b)
#define in3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define piil            pair<ll , ll >
#define inl(a)          scanf("%lld", &a)
#define inl2(a, b)      scanf("%lld%lld", &a, &b)
#define inl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define ins(s)          scanf("%s",s)
#define prst(s)         printf("%s\n",s)
#define pn              printf("\n")
#define pr(a)           printf("%d\n", a)
#define prl(a)          printf("%lld\n", a)
#define prs(a)          printf("%d ", a)
#define pr2(a, b)       printf("%d %d\n", a, b)
#define pr3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)         printf("%lld ", a)
#define prl2(a, b)      printf("%lld %lld\n", a, b)
#define prl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define pcs(a)          printf("Case %d: ", a)
#define pf              printf
#define sc              scanf
#define m_p             make_pair
#define vi              vector<int >
#define vil             vector<ll >
#define pb              push_back
#define fi              first
#define sc              second
#define mem(a, b)       memset((a), (b), sizeof(a))
#define lg2(n)         (31-__builtin_clz(n))
#define PI		        acos(-1.0)
#define N 2000010
#define unq(v)       v.erase(unique(all(v)),v.end())
#define inf 2e18
#define ll long long
#define ull unsigned long long
#define fbo find_by_order
#define ook order_of_key
#define fi first
#define sc second
#define __  std::ios_base::sync_with_stdio (false); cin.tie(0); cout.tie(0);
#define Check(n, pos) (n & (1<<pos))
#define Set(n, pos) (n | (1<<pos))
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename F, typename S>
using ordered_map = tree<F, S, less<F>, rb_tree_tag, tree_order_statistics_node_update>;
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//______________________________________________________________________________________________________________________________________________________
ll dp[N],arr[N];
char str[N];
int main()
{
    __;
   ll n,m,k,a,b,t;
   ll sum=0;
   string s;
  cin>>n>>s;
  for(int i=0;i<n-2;i++)
  {
      if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') sum++;
  }
  cout<<sum<<endl;


    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
using namespace std;
int n;
int main()
{
	cin>>n;
	if (n<=999) cout<<"ABC";
	else cout<<"ABD";
    return 0;
}

Measured memory_bytes: 256
import copy

N,M,X=map(int,input().split())
A=[]
for i in range(N):
    L=list(map(int,input().split()))
    A.append(copy.copy(L))


def make(x):
    global N

    bin_x=str(bin(x))[2:]
    rest=N-len(bin_x)
    bin_x=(bin_x[::-1]+'0'*(max(0,rest)))[::-1]

    return bin_x


cost=-1
for number in range(2**N):
    letter=make(number)
    develop=[0]*M
    temp=0
    for index in range(len(letter)):
        if letter[index]=='1':
            temp+=A[index][0]
            for j in range(1,M+1):
                develop[j-1]+=A[index][j]
    
    if X<=min(develop):
        if cost>=0:
            cost=min(cost,temp)
        else:
            cost=temp

print(cost)

Measured memory_bytes: 9360
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int flag = 0;
		for(int i = 1; i < 10; i++) {
			double b = a/i;
          	double c = a%i;
			if(b<=9&&c==0) {
				flag=1;
				break;
			}
		}
		if(flag==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23380
using System;

namespace ABC058_A
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			int c = int.Parse(input[2]);
			
			if(b - a == c - b) Console.WriteLine("YES");
			else Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

// $ g++ -std=c++11 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
// 21:04-21:13
LL A,B,C,K;
const string no="Unfair";
void solve() {
  LL res=0;
  if(K%2==0) res=A-B;
  else res=B-A;
  
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin>>A>>B>>C>>K;
  solve();
  return 0;
}


Measured memory_bytes: 256
sx,sy,gx,gy=map(int,input().split())
x,y=gx-sx,gy-sy
print('U'*y+'R'*x+'D'*y+'L'*(x+1)+'U'*(y+1)+'R'*(x+1)+'D'*1+'R'*1+'D'*(y+1)+'L'*(x+1)+'U'*1)

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

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

struct WaitedUnionFind{
    vector<int> par, rank, diff_weight;

    WaitedUnionFind( int N ){
        par.resize( N ), rank.resize( N ), diff_weight.resize( N );
        REP( i, N ) par[i] = i, rank[i] = diff_weight[i] = 0;
    }

    int root( int x ){
        if( par[x] == x ){
            return x;
        }else{
            int r = root( par[x] );
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    int weight( int x ){
        root( x );
        return diff_weight[x];
    }

    bool same( int x, int y ){
        return root( x ) == root( y );
    }

    void unite( int x, int y, int w ){
        w += weight( x ), w -= weight( y );
        x = root( x ), y = root( y );
        if( x == y ) return;
        if( par[x] < par[y] ) swap( x, y ), w = -w;
        if( par[x] == par[y] ) rank[x]++;
        par[y] = x;
        diff_weight[y] = w;
    }

    int diff( int x, int y ){
        return weight( y ) - weight( x );
    }
};

signed main(){
    int N;
    while( cin >> N, N ){
        bool ok = true;

        WaitedUnionFind uf( 200 );

        map<string, int> unite2id;
        int final_id = 0;

        REP( i, N ){
            int one, ten, e;
            string unite1, unite2;
            char c;
            cin >> one >> unite1 >> c >> ten >> c >> e >> unite2;

            if( !unite2id.count( unite1 ) ){
                unite2id[unite1] = final_id++;
            }
            int id1 = unite2id[unite1];

            if( !unite2id.count( unite2 ) ){
                unite2id[unite2] = final_id++;
            }
            int id2 = unite2id[unite2];

            if( uf.same( id1, id2 ) ){
                int curdiff = uf.diff( id1, id2 );
                if( e != curdiff ) ok = false;
            }else{
                uf.unite( id1, id2, e );
            }
        }

        if( ok ) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}




Measured memory_bytes: 3232
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a = sorted(LI())
    if a[-1] == a[0]:
        return 'Yes'

    return 'No'


print(main())




Measured memory_bytes: 7240
#include <iostream>
#include <stack>
#include <cmath>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	double x = 0 , y = 0, arg = 90; 
	int a,b;
	while((cin>>a).ignore()>>b){
		x += a * cos( arg / 180 * M_PI);
		y += a * sin( arg / 180 * M_PI);
		arg -= b;
	}
	cout << (x>=0?floor(x):ceil(x)) << endl << (y>=0?floor(y):ceil(y)) << endl;
}

Measured memory_bytes: 1240
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

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

signed main(){
    int a, b, c;
    cin >> a >> b >> c;

    if(a == b && b == c && a % 2 == 0){
            cout << -1 << endl;
            return 0;
    }

    int ans = 0;
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
        int aa = (b + c) / 2;
        int bb = (a + c) / 2;
        int cc = (a + b) / 2;
        a = aa;
        b = bb;
        c = cc;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

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

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n);
    rep (i, n) cin >> p[i];
    int ans = 0, now = p[0] + 1;
    rep (i, n) {
        if (chmin(now, p[i])) ans++;
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  bool can = true;
  int count_odd=0;
  for (int i=0; i<N; i++) {
    if (A.at(i)%2!=0) count_odd++;
  }
  if (count_odd%2!=0) can = false;
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
const int MAX_N = 1<<17;
const int INF = INT_MAX;
int n, seg[2*MAX_N - 1];

void init(int n_){
    n = 1;
    for(;n<n_;) n *= 2;
    fill(seg, seg + 2*n - 1, INT_MAX);
}

void update(int k, int a){
    k += n-1;
    seg[k] = a;
    for(;k>0;){
        k = (k-1)/2;
        seg[k] = min(seg[k*2+1], seg[k*2+2]);
    }
}

int query(int a, int b, int k=0, int l=0, int r=n){
    if(r <= a || b <= l) return INF;
    if(a <= l && r <= b) return seg[k];
    int vl = query(a, b, 2*k+1, l, (l+r)/2);
    int vr = query(a, b, 2*k+2, (l+r)/2, r);
    return min(vl, vr);
}

int main() {
    int q;
    cin >> n >> q;
    init(n);
    for(int i=0; i<q; i++){
        int a, b, c;
        cin >> a >> b >> c;
        if(a) cout << query(b, c+1) << endl;
        else update(b, c);
    }

    return 0;
}


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

bool kaibun(string s) {
  ll n = s.size();
  for (ll i = 0; i < n; i++) {
    if (s[i] != s[n - 1 - i]) {
      return false;
    }
  }
  return true;
}

int main() {
  string s;
  cin >> s;
  
  ll n = s.size();
  if (kaibun(s) && kaibun(s.substr(0, (n-1)/2)) && kaibun(s.substr((n+3)/2 - 1, (n-1)/2))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    vi as(n);
    for (int i = 0; i < n; i++) {
        cin >> as[i];
    }
    int m;
    cin >> m;
    vi bs(m);
    for (int i = 0; i < m; i++) {
        cin >> bs[i];
    }

    vi cs;
    set_intersection(as.begin(), as.end(), bs.begin(), bs.end(), back_inserter(cs));

    cout << (bs.size() == cs.size()) << endl;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

map<P, bool> mp;

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

    int N, M;
    cin >> N >> M;
    while(M--) {
        int a, b;
        cin >> a >> b;
        mp[MP(a, b)] = true;

    }

    for(int i = 2; i < N; ++i) {
        if(mp[MP(1, i)] && mp[MP(i, N)]) {
            cout << "POSSIBLE" << endl;
            return 0;

        }
    }
    cout << "IMPOSSIBLE" << endl;

    return 0;
}



Measured memory_bytes: 25216
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    map<int,int> mp;
    rep(i,0,N){
        int a;
        cin >> a;
        mp[a]++;
    }
    int cnt2 = 0, cnt1 = 0;
    for(auto p:mp){
        if(p.second & 1)cnt1++;
        else cnt2++;
    }
    if(cnt2 & 1)cnt1--;
    cout << cnt1 + cnt2 << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;

vector<ll> inv,fact,invfact;
void mod_build(int n){  
  fact.resize(n+1); inv.resize(n+1); invfact.resize(n+1);
  fact[0]=inv[0]=invfact[0]=1; inv[1]=1;
  rep(i,n){
    fact[i+1]=fact[i]*(i+1)%mod;
    if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
    invfact[i+1]=invfact[i]*inv[i+1]%mod;
  }
}
ll perm(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return fact[n]*invfact[n-k]%mod; } }
ll comb(int n,int k){ if(n<0||k<0||k>n){ return 0; } else { return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod; }}
ll modpow(ll x,ll n){
  x%=mod; ll res=1;
  while(n>0){ if(n&1){res=res*x%mod;} x=x*x%mod; n>>=1; }
  return res;
}
ll modinv(ll a){ return modpow(a, mod-2); }

ll powll(ll n,ll k){ ll ret=1; while(k){ if(k&1)ret=ret*n; n=n*n; k>>=1; } return ret; }


int main(){
  mod_build(mx);
  int n,p;
  cin >> n >> p;
  vector<int> a(n);
  map<int,ll> mp;
  rep(i,n){
    cin >> a[i];
    a[i] %= 2;
    mp[a[i]]++;
  }
  if(p==1){
    ll ans = powll(2,mp[0]);
    ll tmp = 0;
    for(ll i=1; i<=mp[1]; i+=2){
      tmp += comb(mp[1],i);
    }
    ans *= tmp;
    cout << ans << ln;
  } else {
    ll ans = powll(2,mp[0]);
    ll tmp = 0;
    for(ll i=0; i<=mp[1]; i+=2){
      tmp += comb(mp[1],i);
    }
    ans *= tmp;
    cout << ans << ln;
  }

  return 0;
}

Measured memory_bytes: 5452
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        long x = long.Parse(Console.ReadLine());
        long q = x / 11;
        long r = x % 11;
        long ans;

        if (r == 0) ans = q * 2;
        else if (r < 7) ans = q * 2 + 1;
        else ans = q * 2 + 2;

        Console.WriteLine(ans);
    }

}

Measured memory_bytes: 2648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int count = 0;
		
		while (in.hasNextLine())
		{	
			boolean prime = true;
			int num = in.nextInt();
			in.nextLine();
			
			if (num % 2 == 0 && num != 2)
			{
				prime = false;
			} else {
				for (int i = 3; i * i <= num; i += 2)
				{
					if (num % i == 0)
					{
						prime = false;
					}
				}
			}
			
			if (prime)
			{
				count++;
			}
			
		}
		
		System.out.println(count);
		
	}

}


Measured memory_bytes: 74500
def LI():return list(map(int,input().split()))
def II():return int(input())
def yes():return print("Yes")
def no():return print("No")
INF=float("inf")
from collections import deque, defaultdict, Counter
from heapq import heappop, heappush
from itertools import product, combinations
from functools import reduce, lru_cache
from math import pi, gcd
from decimal import Decimal

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

class Unionfind:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def root(self, x):
        if self.p[x] != x:
            self.p[x] = self.root(self.p[x])

        return self.p[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        u = self.root(x)
        v = self.root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def count(self, x):
        return self.size[self.root(x)]


d,t,s=LI()

if (d<=t*s):
    yes()
else:
    no()


Measured memory_bytes: 10016
import math

n = int(input())
a = input().split()

#インデックスは1~n
oku = {}
okun = 0
for i in range(int(n/2)+1, n+1):
  oku[i] = int(a[i-1])
  if int(a[i-1]) == 1:
    okun += 1
    
for i in range(int(n/2), 0, -1):
  b = 0
  for j in range(i*2, n+1, i):
    if oku[j] == 1:
      b+=1
  if b % 2 == int(a[i-1]):
    oku[i] = 0
  else:
    oku[i] = 1
    okun += 1

print(okun)
for i in range(1,n+1):
  if oku[i] == 1:
    print(i, end = " ")
    

Measured memory_bytes: 29632
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, a, b, c, d = LI()
a, b, c, d = a - 1, b - 1, c - 1, d - 1
s = S()

# 連続した岩がないか
for i in range(a + 1, max(c, d) - 1):
    if s[i:i + 2] == '##':
        print('No')
        sys.exit()

if c < d:
    print('Yes')
    sys.exit()

else:
    # どこかで a が b を追い越す必要がある
    # b がどこに居ても追い越せるための 3マス連続の空きマスがあるか
    for i in range(b, d + 1):
        if s[i - 1:i + 2] == '...':
            print('Yes')
            sys.exit()
    print('No')


Measured memory_bytes: 9532
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
int main(void){
     int d,t,s;
     cin >> d >> t >> s;
     if((d + s - 1) / s <= t){
           cout << "Yes" << endl;
     }else{
           cout << "No" << endl;
     }
}


Measured memory_bytes: 3604
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}
/********************************************************/
//	d.erase(unique(all(d)), d.end());


int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s,p;
	while(t--)
	{
		cin>>n>>m>>k;
		// n=s.length();
		ll a[n],b[m];
		for(i=0;i<n;i++)
			cin>>a[i];
		for(i=0;i<m;i++)
			cin>>b[i];
		
		for(i=1;i<n;i++)
			a[i]+=a[i-1];
		for(i=1;i<m;i++)
			b[i]+=b[i-1];
		i=j=0;
		c=lbnd(b,b+m,k)-b;
		if(c<m && b[c]==k) c++;
		for(i=0;i<n;i++)
		{
			if(a[i]>k) break;
			j=lbnd(b,b+m,k-a[i])-b;
			if(j<m && b[j]==k-a[i]) j++;
			// debug3(c,i,j);
			c=max(c,i+j+1);
		}
		// c=n+(n*n)+(n*n*n);
		cout<<c;

		
		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 6772