akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, sum=0;
  bool a=true;
  cin>>n;
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    cin>>vec.at(i);
    for(int j=0; j<i; j++){
      if(vec.at(i)==vec.at(j)){a=false; break;} else{a=true;}
    }
    if(a==true){sum++;}
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 */
int partition(vector<int>& A, int p, int r) {
    // xに基準を入れる
    int x = A[r];
    int i = p;
    // pとrの範囲でぐるぐる
    FOR(j, r, p) {
        // j番目がx以下のときi番目と交換
        if(A[j] <= x) {
            swap(A[i], A[j]);
            i++;
        }
    }
    swap(A[i], A[r]);
    return i;
}
int main()
{
    int n;
    cin >> n;
    vector<int> A(n);
    REP(i, n) cin >> A.at(i);
    int q = partition(A, 0, n-1);
    REP(i, n) {
        if(i) cout << " ";
        if(i == q) cout << "[";
        cout << A[i];
        if(i == q) cout << "]";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int H,N,A=0;
    cin>>H>>N;
    for(int i=0;i<N;i++){
        int tmp;
        cin>>tmp;
        A+=tmp;
    }
    if(H<=A) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main(){
  long long N;
  cin >> N;
  for(long long i=ceil(sqrt(N)); i>=1; i--){
    if(N%i==0){
      cout << (i-1)+(N/i-1) << endl;
      return 0;
    }
  }
  return 0;
}

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


using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  srand((unsigned)time(NULL));
  int d;
  int res = 0;
  cin >> d;
  vector<int> c(26);
  rep(i,26)cin >> c[i];
  vector<vector<int>> v(d,vector<int>(26));
  vector<int> contest(d,0);
  vector<int> last(26,0);
  vector<int> satisfy(26,0);
  rep(i,d)rep(j,26){
    int x;cin >> x;
    v[i][j] = x;
  }
  {
    int j = d;
    for(int i = 0;j;i++){
      contest[d-j] = (i%26);
      j--;
    }
  }
  for(int i = 1;i <= d;i++){
    //rep(j,26)if(v[i-1][contest[i-1]] < v[i-1][j])contest[i-1] = j;
    last[contest[i-1]] = i;
    res += v[i-1][contest[i-1]];
    rep(j,26)res -= c[j]*(i-last[j]),satisfy[j] += c[j]*(i-last[j]);
  }
  while(1.0*clock()/CLOCKS_PER_SEC <= 1.7){
    //int now_time = clock();
    //if(1.0*now_time/CLOCKS_PER_SEC > 1.7)break;
    int day = rand()%d,pos = rand()%26;
    vector<int> new_contest = contest;
    int res_ = res;
    int pre = new_contest[day];
    res_ += satisfy[pos];
    res_ += satisfy[pre];
    res_ -= v[day][pre];
    res_ += v[day][pos];
    int pos_satisfy = 0,pre_satisfy = 0;
    last[pos] = last[pre] = 0;
    new_contest[day] = pos;
    for(int i = 1;i <= d;i++)last[pos] = (new_contest[i-1] == pos ? last[pos] = i : last[pos]),pos_satisfy += c[pos]*(i-last[pos]);
    for(int i = 1;i <= d;i++)last[pre] = (new_contest[i-1] == pre ? last[pre] = i : last[pre]),pre_satisfy += c[pre]*(i-last[pre]);
    res_ -= (satisfy[pos]+satisfy[pre]);
    if(res < res_){
      res = res_;
      contest = new_contest;
      satisfy[pre] = pre_satisfy;
      satisfy[pos] = pos_satisfy;
    }
  }
  rep(i,d)cout << contest[i]+1 << endl;
  


  return 0;
}


Measured memory_bytes: 3684
def binary_search(s, t):
    top = 0
    tail = len(s)
    while top < tail:
        mid = (top + tail) // 2
        if s[mid] == t:
            return True
        elif s[mid] < t:
            top = mid + 1
        else:
            tail = mid
    return False

n = int(input())
S = [int(n) for n in input().split()]
q = int(input())
T = [int(q) for q in input().split()]

count = 0

for t in T:
    if binary_search(S, t):
        count += 1

print(count)



Measured memory_bytes: 16892
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll              long long
#define pi              pair<int,int>
#define pll             pair<ll,ll>
#define pb              push_back
#define F               first
#define S               second
#define vi              vector<int>
#define vll             vector<ll>
#define endl            '\n'
#define all(v)          (v).begin(),(v).end()
#define FOR(i,a,b)      for(int i=a;i<b;i++)
#define MP(a,b)         make_pair(a,b)
#define debug(x)        cerr<< #x << " : " << x << endl;
#define debugp(p)       cerr<< #p << " : " << "(" << (p).first << "," << (p).second << ")\n";
#define debugv(v)       cerr<< #v << " : " << "["; for(int i = 0; i < (v).size(); i++) cerr << v[i] << " "; cerr<<"]\n";
#define debugs(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<*itr << " "; cerr << "]\n";
#define debugm(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<"(" << itr->first << "," << itr->second << ") "; cerr << "]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/

inline ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;

void solve(){
    int d , t , s;
    cin >> d >> t >> s;
    if (s * t >= d) cout << "Yes\n";
    else cout << "No\n";
}
int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    #ifdef LOCAL
    cerr << "Time elapsed\t: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
}



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

int main(){
  ll k,n,a,pa,fa,ans,i;
  ans=0;
  cin >> k >> n >> fa;
  pa=fa;
  for(i=1;i<n;i++){
    cin >> a;
    ans=max(ans,a-pa);
    pa=a;
  }
  ans=max(ans,k-pa+fa);
  cout << k-ans;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NT = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, T) = (NT[0], NT[1]);
        var ct = Enumerable.Range(0, N).Select(i => ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray()).Select(x => new { c = x[0], t = x[1] });

        var ans = ct.Where(x => x.t <= T).OrderBy(x => x.c).FirstOrDefault()?.c.ToString() ?? "TLE";

        WriteLine(ans);
    }
}


Measured memory_bytes: 28528
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define SUM(n) ((n)+1)*(n)/2
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = (1e9)+7;
#define all(v) v.begin(),v.end()
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

vit edge[10];
bool isvisited[10] = {false};
int n, m;

int bfs(int x, int ans, int sum){
  if(isvisited[x]){
    return ans;
  }
  if(sum == n){
    return ans + 1;
  }
  isvisited[x] = true;
  rep(i, edge[x].size()){
    ans = bfs(edge[x][i], ans, sum + 1);
  }
  isvisited[x] = false;
  return ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> m;
  int a, b;
  rep(i,m){
    cin >> a >> b;
    edge[a].pu(b);
    edge[b].pu(a);
  }
  cout << bfs(1, 0, 1) << '\n';
  return 0;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

constexpr ll INF = TEN(18);

int main() {
    int N, K;
    cin >> N >> K;
    V<int> P(N), C(N);
    rep(i, N) cin >> P[i], --P[i];
    rep(i, N) cin >> C[i];

    ll ans = -INF;

    rep(i, N) {
        int v = i;
        ll cycle_sum = 0;
        int cycle_cnt = 0;

        while (true) {
            cycle_cnt++;
            cycle_sum += C[v];
            v = P[v];
            if (v == i) break;
        }

        ll path = 0;
        int cnt = 0;

        while (true) {
            cnt++;
            path += C[v];

            if (cnt > K) break;

            int num = (K - cnt) / cycle_cnt;
            ll score = path + max(0ll, cycle_sum) * num;
            chmax(ans, score);

            v = P[v];
            if (v == i) break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<stdlib.h>
struct node
{
	long long a;
	long long b;
}num[100005];
int inc(const void *a, const void *b)
{
    struct node m = *(struct node *)a;
    struct node n = *(struct node *)b;
    return m.a - n.a;
}
int main()
{
	int n;
	long long k;
	scanf("%d%lld",&n,&k);
	for(int i=0;i<n;i++)scanf("%d%d",&num[i].a,&num[i].b);
	qsort(num,n,sizeof(struct node),inc);
	for(int i=0;i<n;i++)
	{
		k-=num[i].b;
		if(k<=0)
		{
			printf("%lld\n",num[i].a);
			return 0;
		}
	}
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MD=998244353;
const int N=2e5+5;
pair<int,int> p[N];
stack<pair<int,int> > st;
int f[N];
int main() {
	//freopen("in.txt","r",stdin);
	int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d%d",&p[i].first,&p[i].second);
    }
    sort(p+1,p+n+1);
    f[n+1]=1;
    for(int i=n;i>=1;i--) {
        int t=p[i].first+p[i].second,nex=i+1;
        while(!st.empty()&&t>p[st.top().first].first) {
            nex=st.top().second;
            st.pop();
        }
        st.push({i,nex});
        f[i]=(f[i+1]+f[nex])%MD;
    }
    printf("%d\n",f[1]);
	return 0;
}

Measured memory_bytes: 3456
#include <string>
#include <iostream>

using namespace std;


int main() {
    int H, W, N;
    int sr, sc;
    string S;
    string T;

    cin >> H >> W >> N;
    cin >> sr >> sc;
    cin >> S;
    cin >> T;

    string ans = "YES";

    // up down
    int f_h = 0;
    int l_h = H-1;
    for (int i=N-1; i>=0; i--) {
        if (T[i] == 'U') {
            l_h = min(l_h+1, H-1);
        } else if (T[i] == 'D') {
            f_h = max(f_h-1, 0);
        }
        if (S[i] == 'U') {
            f_h = f_h+1;
        } else if (S[i] == 'D') {
            l_h = l_h-1;
        }
        if (f_h > l_h) {
            ans = "NO";
        }
    }

    // left right
    int f_w = 0;
    int l_w = W-1;
    for (int i=N-1; i>=0; i--) {
        if (T[i] == 'L') {
            l_w = min(l_w+1, W-1);
        } else if (T[i] == 'R') {
            f_w = max(f_w-1, 0);
        }
        if (S[i] == 'L') {
            f_w = f_w+1;
        } else if (S[i] == 'R') {
            l_w = l_w-1;
        }
        if (f_w > l_w) {
            ans = "NO";
        }
    }

    if (sr-1 < f_h or l_h < sr-1 or sc-1 < f_w or l_w < sc-1) {
        ans = "NO";
    }

    //cout << f_h << l_h << f_w << l_w << endl;
    cout << ans << endl;
}



Measured memory_bytes: 776
n = int(input())
ng = 0
def prime(a):
    if a == 1: return 1
    i = 3
    while i <= a / i:
        if a % i == 0:
            return 0
        i += 2
    return 1

for i in range(n):
    a = 2 * int(input()) + 1
    ng += prime(a)
    
print(ng)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl

void solve(long long A, long long B){
  cout << A * B / __gcd(A, B) << endl;
}

signed main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 1000;

void trace(int a[],int n){
    for (int i=0;i<n;i++){
        if (i>0) {
            cout << " ";
        }
        cout << a[i];
    }
    cout << endl;
}

void insertionSort(int a[], int n){
    int v,j;
    for (int i=1;i<n;i++){
        v=a[i];
        j = i-1;
        while(j>=0&&v<a[j]){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        trace(a,n);
    }
    
}

int main(){
    int n,i;
    int a[N];
    cin>>n;
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    trace(a,n);
    insertionSort(a,n);
    
    return 0;
}

Measured memory_bytes: 3080
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 1000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
bitset<maxx/2>vis;
vector<ll>prime;
void sieve(){
    ll x=maxx/2, y=sqrt(maxx)/2;
    for(ll i=1;i<=y;i++){
        if(vis[i]==0){
            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
                vis[j]=1;
        }
    }
    prime.push_back(2);
    for(ll i=3;i<maxx;i+=2)
        if(vis[i/2]==0)
        prime.push_back(i);
}
bool isprime(ll a)
{
    if(a==2){
        return true;
    }
    if(a%2==0){
        return false;
    }
    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++){
        if(a%prime[i]==0){
            return false;
        }
    }
    return true;
}
ll lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    ll x,y;
    cin>>x>>y;
    ll lowest=2*x;
    ll highest=4*x;
    if(y>=lowest && y<=highest && y%2==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}
int main()
{
	FastIO;
	///sieve();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <ios>
#include <iomanip>
using namespace std;

int main() {
    
    int n, m;
    int p[100000], y[100000], index[100000], r[100000], c[100000];
    
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> p[i] >> y[i];
        index[i] = i;
    }
    for (int i = 1; i <= n; i++) {
        c[i] = 0;
    }
    
    sort(index, index + m, [&](int a, int b) -> int {
        return y[a] < y[b];
    });
    
    for (int i = 0; i < m; i++) {
        r[index[i]] = ++c[p[index[i]]];
    }
    
    for (int i = 0; i < m; i++) {
        std::cout << std::setfill('0') << std::right << std::setw(6);
        cout << p[i];
        std::cout << std::setfill('0') << std::right << std::setw(6);
        cout << r[i] << endl;
    }
    
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
int main(){
    int n;cin>>n;
    int co[110]={};
    vector<int> f;
    for(int i=2;i<=n;i++){
        bool ff=true;
        for(int j=2;j<i;j++){
            if(i%j==0)ff=false;
        }
        if(ff)f.push_back(i);
    }
    for(int i=2;i<=n;i++){
        for(int j=0;j<f.size();j++){
            int k=i;
            while(k%f[j]==0){
                k/=f[j];
                co[j]++;
            }
        }
    }
    ll ans=0;
    for(int i=0;i<f.size();i++){
        if(co[i]<2)continue;
        for(int j=0;j<f.size()-1;j++){
            if(i==j)continue;
            if(co[j]<4)continue;
            for(int k=j;k<f.size();k++){
                if(i==k||j==k)continue;
                if(co[k]<4)continue;
                ans++;
            }
        }
    }
    for(int i=0;i<f.size();i++){
        if(co[i]<2)continue;
        for(int j=0;j<f.size();j++){
            if(i==j)continue;
            if(co[j]<24)continue;
            ans++;
        }
    }
    for(int i=0;i<f.size();i++){
        if(co[i]<4)continue;
        for(int j=0;j<f.size();j++){
            if(i==j)continue;
            if(co[j]<14)continue;
            ans++;
        }
    }
    for(int i=0;i<f.size();i++){
        if(co[i]>=74)ans++;
    }
    cout<<ans<<endl;
	return 0;
}   

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL N;
	cin >> N;

	vector<LL> A(N),B(N);

	for(int i = 0; i < N; i++){
		cin >> A[i];
	}

	for(int i = 0; i < N; i++){
		cin >> B[i];
	}

	LL ibit = 1;
	LL ans = 0;

	for(int i = 0; i < 29; i++){
		ibit <<= 1;
		LL count = 0;
		vector<LL> tmp(N);
		for(int j = 0; j < N; j++){
			tmp[j] = B[j]%ibit;
		}
		sort(tmp.begin(),tmp.end());
		for(int j = 0; j < N; j++){
			LL start;
			if(A[j]%ibit >= ibit >> 1){
				start = 1;
			}else{
				LL skey = (ibit >> 1) - (A[j]%ibit);
				auto sitr = lower_bound(tmp.begin(),tmp.end(),skey);
				start = (LL)(sitr - tmp.begin()) + 1;
			}
			LL key = ibit - (A[j]%ibit);
			auto itr = lower_bound(tmp.begin(),tmp.end(),key);
			LL end = (LL)(itr - tmp.begin())+1;
			LL nkey = ibit + (ibit >> 1) -(A[j]%ibit);
			auto nitr = lower_bound(tmp.begin(),tmp.end(),nkey);
			count += (LL)(tmp.end() - nitr);
			if(end - start >= 0){
				count += end - start;
			}
		}
		if(count % 2 == 0){
		}else{
			ans += (ibit >> 1);
		}
	}

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

Measured memory_bytes: 4992
#include <cstdio>
#include <cstdlib>

int main()
{
	int n, ov, ev, of = 0, os = 0, ef = 0, es = 0, ofi = 0, efi = 0, *odd, *even;
	scanf("%d", &n);
	odd = (int *)calloc(100001, sizeof(int));
	even = (int *)calloc(100001, sizeof(int));

	for (int i = 0; i < n/2; i++) {
		scanf("%d %d", &ov, &ev);
		odd[ov]++, even[ev]++;
	}

	for (int i = 1; i <= 100000; i++) {
		if (odd[i] > of) {
			if (of > os)
				os = of;
			of = odd[i];
			ofi = i;
		}
		else if (odd[i] > os)
			os = odd[i];

		if (even[i] > ef) {
			if (ef > es)
				es = ef;
			ef = even[i];
			efi = i;
		}
		else if (even[i] > es)
			es = even[i];
	}

	if (ofi != efi)
		printf("%d\n", n - of - ef);
	else if (of + es > os + ef)
		printf("%d\n", n - of - es);
	else
		printf("%d\n", n - os - ef);

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define LIMIT 1000000007 //10^9+7
/* 一括cin */
template<class H>
void CIN(H& h){cin>>h;}
template<class H, class... T>
void CIN(H &h, T&... t){cin>>h;CIN(t...);}
/* デバッグ */
namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
  int a,p;CIN(a,p);
  debug((a*3+p)/2);
}

Measured memory_bytes: 256
from collections import Counter
a=int(input())

l=[]
x = [input() for _ in range(a)]
count=Counter(x)
x=count.most_common()
x.sort()
y=x.copy()
y.sort(key=lambda x:x[1],reverse=True)
tmp=y[0][1]
for i in x:
    if tmp <= i[1]:
        l.append(i[0])
        tmp=i[1]

print('\n'.join(l))


Measured memory_bytes: 50260
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
    int a,b,c;
    double x,S,L,h,rad;
    double pi = acos(-1);
    cin >> a >> b >> c;
    rad = c*pi/180;
    S = a*b*sin(rad)/2;
    x = sqrt(a*a+b*b-2*a*b*cos(rad));
    L = a+b+x;
    h = 2*S/a;
    printf("%lf\n",S);
    printf("%lf\n",L);
    printf("%lf\n",h);
    return 0;
}


Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
    LL(N);
    LL(K);
    STR(S);
    S[K-1] += 32; 
    
    cout<< S << endl;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	int m = 1 << n;
	map<int, int> cnt;
	REP(i, m) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	map<int, int> now;
	{
		auto c = cnt.end();
		c--;
		int b = (*c).first;
		if (--cnt[b])cnt.erase(b);
		now[b]++;
	}
	REP(i, n) {
		map<int, int> next;
		for (auto&& a : now) {
			REP(j, a.second) {
				auto c = cnt.lower_bound(a.first);
				if (c == cnt.begin()) {
					cout << "No" << endl;
						return 0;
				}
				c--;
				int b = (*c).first;
				next[b]++;
				if (--cnt[b] == 0)cnt.erase(b);
			}
		}
		for (auto&& a : now) {
			next[a.first] += a.second;
		}
		now = next;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 200010
/*------------------------------------------------------------*/
int n,m;
int a[maxn],f[maxn];
void dfs(int d,int ans){
	if(d==4){
		if(ans==7){
			FOR(i,1,3){
				cout<<a[i];
				if(f[i]==1)cout<<'+';
				 else cout<<'-';
			}
			cout<<a[4];
			cout<<"=7";
			exit(0);
		}
		return ;
	}
	f[d]=1;
	dfs(d+1,ans+a[d+1]);
	f[d]=2;
	dfs(d+1,ans-a[d+1]);
}
int main(){
	string s;
	cin>>s;
	FOR(i,0,3){
		a[i+1]=s[i]-'0';
	}
	dfs(1,a[1]);
}

Measured memory_bytes: 256
def myAnswer(N:int,S:str) -> int:
   rightE = S.count("E")
   leftW = 0
   ans = 10**10
   for s in S:
      if(s == "W"):
         ans = min(ans,rightE + leftW)
         leftW += 1
      else:
         rightE -= 1
         ans = min(ans,rightE + leftW)
   return ans

def modelAnswer():
   return
def main():
   N = int(input())
   S = (input())
   print(myAnswer(N,S))
if __name__ == '__main__':
   main()

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

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

    cout << (n == m ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if(A <= C and C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;

signed main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    int ans = s.size() + t.size();
    for(int i = 1; i <= s.size(); i++)
        if(t.substr(0, i) == s.substr(s.size() - i))
            ans = max(n, min(ans, (int)s.size() + (int)t.size() - i));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

vector<vector<int>> G;
vector<vector<int>> rG;
vector<bool> visited;
vector<int> vs;
vector<int> cmp;

void dfs(int v) {
    visited[v] = true;
    for(int i=0;i<G[v].size();i++){
        if(!visited[G[v][i]]) dfs(G[v][i]);
    }
    vs.push_back(v); // 帰りがけにvを記録。グラフの末端に近いものから並ぶ
}

void rdfs(int v, int k) {
    visited[v] = true;
    cmp[v] = k;

    for(int i=0;i<rG[v].size();i++){
        if(!visited[rG[v][i]]) rdfs(rG[v][i], k);
    }
}

int scc(int n) { // 強連結成分分解
  vs.clear();

  visited.assign(n, false);
  for(int i=0;i<n;i++){
    if(!visited[i]) dfs(i);
  }

  cmp.assign(n, -1);
  visited.assign(n, false);
  int k=0;
  for(int i=vs.size()-1;i>=0;i--){
    if(!visited[vs[i]]) rdfs(vs[i], k++);
  }
  return k;
}

int scc_start;
vector<int> a;
int N;

int get_min_a(set<int>& s){
    int min_a = 0;
    for(int a : s){
        if(a != min_a){
            return min_a;
        }
        min_a++;
    }
    return min_a;
}

int set_a(int v){
    if(a[v] != -1) return a[v];
    set<int> s;
    for(int to : G[v]){
        if(cmp[to] != cmp[scc_start]){
            s.insert(set_a(to));
        }
    }
    a[v] = get_min_a(s);
    return a[v];
}

void set_a_in_scc(int v){
    if(v != scc_start){
        set<int> s;
        for(int to : G[v]){
            s.insert(a[to]);
        }
        a[v] = get_min_a(s);
    }
    for(int from : rG[v]){
        if(cmp[from] == cmp[scc_start] && from != scc_start){
            set_a_in_scc(from);
        }
    }
}

bool solve(){
    cin >> N;

    G.assign(N, {});
    rG.assign(N, {});
    for(int i=0;i<N;i++){
        int p;
        cin >> p;
        p--;
        G[p].push_back(i);
        rG[i].push_back(p);
    }

    scc(N);
    set<int> ks;
    for(int i=0;i<N;i++){
        if(ks.count(cmp[i]) == 1){
            scc_start = i;
        }
        ks.insert(cmp[i]);
    }

    a.assign(N, -1);
    for(int i=0;i<N;i++){
        if(cmp[i] != cmp[scc_start]){
            set_a(i);
        }
    }

    set<int> s;
    for(int to : G[scc_start]){
        if(cmp[to] != cmp[scc_start]){
            s.insert(a[to]);
        }
    }

    a[scc_start] = get_min_a(s);
    set_a_in_scc(scc_start);

    {
        set<int> s_all;
        for(int to : G[scc_start]){
            s_all.insert(a[to]);
        }
        if(a[scc_start] == get_min_a(s_all)) return true;
    }

    s.insert(a[scc_start]);
    a[scc_start] = get_min_a(s);
    set_a_in_scc(scc_start);

    {
        set<int> s_all;
        for(int to : G[scc_start]){
            s_all.insert(a[to]);
        }
        if(a[scc_start] == get_min_a(s_all)) return true;
    }

    return false;
}

int main(){
    if(solve()) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 40176
n = int(raw_input())
slimes = raw_input()


def solve():
	if not slimes:
		print(0)
		return

	ans = 1
	prev = slimes[0]
	for i in range(1, len(slimes)):
		if prev != slimes[i]:
			prev = slimes[i]
			ans += 1
	print(ans)

solve()

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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int n;
ll a[200000], b[200000];

int main() {
    cin >> n;
    rep(i,n) cin >> a[i] >> b[i];
    ll sum = 0;
    rep(i,n) sum += a[i];
    bool end = true;
    rep(i,n) if (a[i] != b[i]) {
        end = false;
    }
    if (end) {
        cout << 0 << endl;
        return 0;
    }
    ll minB = INF*INF;
    rep(i,n) if (a[i] > b[i]) {
        minB = min(minB, b[i]);
    }
    cout << sum-minB << endl;
}
































Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

int main()
{
	vector<int> bd;
	int n, cont;
	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

	while(1){
		bd.clear();
		cont = 0;
		cin >> n;

		if(cin.eof())    break;

		while(n != 0){
			bd.push_back(n % 2);	
			n /= 2;
			cont++;
		}

		for(int i = 0; i < cont; i++){
			if(bd[i] == 1){
				cout << weight[i];
				if(i+1 != cont)
					cout << " ";
			}
		}

		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
package main

import (
    "fmt"
    "os"
    "bufio"
    )
    
var r = bufio.NewReader(os.Stdin)

func main(){
   var a,b,c int 
   fmt.Fscan(r, &a)
   fmt.Fscan(r, &b)
   fmt.Fscan(r, &c)

   if a < b  && b < c {
       fmt.Println("Yes")
   }else{
       fmt.Println("No")
   }
}



Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
int mod=163577857;
inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(int a,int n,int m){if(n==0)return 1;int p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
vector<int>adj[100009];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    int h[n+1];
    for(int i=1;i<=n;i++)
        cin>>h[i];
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
  int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(adj[i].size()==0){cnt++;continue;}
        int flag=0;
        for(int j=0;j<adj[i].size();j++)
        {
            if(h[i]<=h[adj[i][j]]){flag=1;break;}
        }
        if(flag==0)cnt++;
    }
   cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 10200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n,m;cin>>n>>m;
    int r[m+1]={0};
    rep(i,n){
        int k;cin>>k;
        rep(i,k){int tmp;cin>>tmp;r[tmp]++;}
    }
    int cnt = 0;
    rep(i,m+1){
        if(r[i]==n)cnt++;
    }
    co(cnt);
}

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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

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

signed main(){
    int w,h,c;
    cin>>w>>h>>c;

    int g=gcd(w,h);
    cout<<(w/g)*(h/g)*c<<endl;
    return 0;
}

Measured memory_bytes: 3096
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();

		ArrayList<ArrayList<Integer>> sll = new ArrayList<>();
		ArrayList<Integer>pl = new ArrayList<>();
		for(int i=0; i<M; i++) {
			sll.add(new ArrayList<Integer>());
			int k=sc.nextInt();
			for(int j=0; j<k; j++) {
				int s=sc.nextInt();
				s--;
				sll.get(i).add(s);
			}
		}
		for(int i=0; i<M; i++) {
			int p=sc.nextInt();
			pl.add(p);
		}

		int ans = 0;

		//スイッチ全状態
		for(int b=0; b<(1<<N); b++) {

			boolean ok=true;


			for(int i=0; i<M; i++) {
				ArrayList<Integer> sl = sll.get(i);
				int cnt = 0;
				//電球につながっているスイッチ
				for(int j=0; j<sl.size(); j++) {
					int sn = sl.get(j);
					if(((b>>sn)&1)==1) {
						cnt++;
					}
				}
				if(cnt%2!=pl.get(i)) {
					ok=false;
					break;
				}
			}

			if(ok) {
				ans++;
			}

		}

		System.out.println(ans);

		sc.close();
	}


}


Measured memory_bytes: 23636
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(a,b,c) for (int a=b;a<=c;a++)
using namespace std;
typedef long long LL;
int n,a[100010];
int main(){
	scanf("%d",&n);
	rep(i,1,n) scanf("%dd",a+i);
	sort(a+1,a+1+n);
	int l=n,r=n,f=0,x;
	while (r>=1){
		while (l>1&&a[l-1]==a[l]) --l;
		if (r-l+1>=4&&!f){
			printf("%lld\n",(LL)a[l]*a[l]);
			return 0;
		}
		if (r-l+1>=2){
			if (!f){
				f=1;
				x=a[l];
			} else {
				printf("%lld\n",(LL)x*a[l]);
				return 0;
			}
		}
		r=l-1,l=r;
	}
	puts("0");
	return 0;
}


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

int main(){
  long long n,a,b,c,d,e;
  cin >> n >> a >> b >> c >> d >> e;
  
  long long MinMove=min({a,b,c,d,e});
  
  long long ans=(n+MinMove-1)/MinMove+4;//切り上げのための、-1
  
  cout << ans << endl;
}


Measured memory_bytes: 256
local mfl = math.floor

local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local function upper_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if comp(x, ary[1]) then return 1 end
  if not comp(x, ary[num]) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = mfl((min + max) / 2)
    if not comp(x, ary[mid]) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n = io.read("*n")
local l = {}
for i = 1, n do
  l[i] = io.read("*n")
end
table.sort(l)
local ret = 0
for i = n, 3, -1 do
  local large = l[i]
  for j = i - 1, 2, -1 do
    local middle = l[j]
    if middle * 2 <= large then break end
    local smallmin = upper_bound(l, large - middle)
    if smallmin < j then
      ret = ret + j - smallmin
    end
  end
end
print(ret)


Measured memory_bytes: 384
package main

import (
  "fmt"
)

func main() {
  var k, sLen int
  var s string
  fmt.Scanf("%d", &k)
  fmt.Scanf("%s", &s)
  sLen = len(s)

  if sLen <= k {
    fmt.Println(s)
  } else  {
    ans := fmt.Sprint(s[:k], "...")
    fmt.Println(ans)
  }
}


Measured memory_bytes: 1816
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	ll arr[n];
	for(ll i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n,greater<ll>());
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        if(k>0)
        {
            k--;
            continue;
        }
        sum+=arr[i];
    }
    cout<<sum;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<string>
#include<stdio.h>
using namespace std;
typedef long long ll;
int cmp(const void *a,const void *b)
{
    int *c = (int *)a;
    int *d = (int *)b;
    return *d - *c;
}
int main()
{
    int a,b,c,d;
    while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)
    {
        int max,min;
        if(a>c)
            min=a;
        else
            min=c;
        if(b>d)
            max=d;
        else
            max=b;
        if(min>max)
            printf("0\n");
        else
            printf("%d\n",max-min);
    }
    return 0;
}


Measured memory_bytes: 256
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    int a, b;
    std::cin >> a >> b;
    if(a > b) std::swap(a, b);
    rep(i, b) std::cout << a;
    std::cout << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int A,B; cin >> A >> B;
    cout << max({A+B,A-B,A*B}) << ln;
}


Measured memory_bytes: 256
import sys
import math
import collections
input = sys.stdin.readline

N = int(input())
S = input().strip()

cnt = collections.Counter(S)
ans = cnt['R'] * cnt['G'] * cnt['B']

for i in range(N):
	for d in range(1,N):
		j, k = i+d, i+2*d
		if k > N-1: break
		if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
			ans -= 1
print(ans)


Measured memory_bytes: 68872
#include <string.h>
#include<stdio.h>
int main(void)
{
	int i,sum=0;
	int flag=0;
	char x[1001];
	scanf("%s",x);
	do{
		
		for(i=0;i<1001;i++){
			if(x[i]==0){
				printf("%d\n",sum);
				break;
			}else{
				sum+=x[i]-0x30;
			}
		}
		sum=0;
		scanf("%s",x);
	}while(x[0]!=0x30);

	return 0 ;
}

Measured memory_bytes: 536
#include<bits/stdc++.h>  
using namespace std;
typedef pair< int, int > Pi;

int dp[3001][3001];

int main(){
  int N, T, S, A[3000], B[3000];
  cin >> N >> T >> S;
  for(int i = 0; i < N; i++){
    cin >> A[i] >> B[i];
  }

  for(int i = 0; i < N; i++){
    for(int j = 0; j <= T; j++){
      dp[i + 1][j] = max( dp[i + 1][j], dp[i][j]);
      if(j > 0) dp[i + 1][j] = max( dp[i + 1][j], dp[i + 1][j - 1]);
      if(j - B[i] >= 0 && (j <= S || j - B[i] >= S)){
        dp[i + 1][j] = max( dp[i + 1][j], dp[i][j - B[i]] + A[i]);
      }
    };
  }
  cout << dp[N][T] << endl;
}

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

using namespace std;

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

    int odd_cnt = 0;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        if(a%2 != 0) odd_cnt++;
    }

    if(odd_cnt%2 == 0)  cout << "YES" << endl;
    else cout <<"NO" << endl;

}

Measured memory_bytes: 3600