akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 
 
using namespace std;
using namespace __gnu_pbds;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
ordered_set<ll> ors;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ld PI=3.14159265359;
 
ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}
 
ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}
 
ll lp[1000001];
vector<ll> pr;
 
void prime()
{
    repf(i,1,1000001) lp[i]=i;
    repf(i,2,1000001)
    {
        if(lp[i]==i)
        {
            for(ll j=2*i;j<1000001;j+=i)
            {
                if(lp[j]==j) lp[j]=i;
            }
        }
    }
    // repf(i,2,1000001) if(lp[i]==i) pr.pb(i);
}

const ll MX=200001;

vector<ll> v[MX];
ll depth[MX];
ll D[MX][22];
 
void dfs(ll x, ll p, ll h=0) {
    D[x][0]=p;
    depth[x]=h;
    repf(i,1,22)
    {
        if(D[x][i-1]!=-1 && D[D[x][i-1]][i-1]!=-1)
        {
            D[x][i]=D[D[x][i-1]][i-1];
        }
    }
    for(auto i:v[x]) {
        if(i==p) continue;
        dfs(i,x,h+1);
    }
}

ll walk(ll x, ll k)
{
    repf(i,0,22)
    {
        if((1<<i)&k)
        {
            x=D[x][i];
        }
    }
    return x;
}

ll lca(ll x, ll y)
{
    if(depth[x]>depth[y]) x=walk(x,depth[x]-depth[y]);
    if(depth[y]>depth[x]) y=walk(y,depth[y]-depth[x]);
    if(x==y) return x;
    repb(i,21,0)
    {
        if(D[x][i]!=D[y][i])
        {
            x=D[x][i];
            y=D[y][i];   
        }
    }
    return D[x][0];
}

void init() {
    prime();
}

void solve(ll tt) {
    ll n;
    cin>>n;
    ll ans=0;
    repf(i,1,n) {
        ll c=1;
        ll v=n-i;
        while(lp[v]>1) {
            ll x=lp[v],ct=0;
            while(v%x==0) v/=x,ct++;
            c*=(ct+1);
        } 
        ans+=c;
    }
    cout<<ans<<endl;
} 
 
 
int main()
{
    // IOS;
    init();
    ll t=1;
    // cin>>t;
    repf(tt,1,t+1) {
        solve(tt);
    }
}     

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll ppow(ll a,ll b){
	a%=MOD;
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
class Fact{
	vector<ll>fact;
	vector<ll>inv;
public:
	Fact(){}
	Fact(int n){
		n=n*2+10;
		fact=inv=vector<ll>(n);
		fact[0]=inv[0]=1;
		for(int i=1;i<n;i++){
			fact[i]=(fact[i-1]*i)%MOD;
		}
		inv[n-1]=ppow(fact[n-1],MOD-2);
		for(int i=n-2;i>=0;i--){
			inv[i]=(inv[i+1]*(i+1))%MOD;
		}
	}
	ll get(int n){
		return fact[n];
	}
	ll get_inv(int n){
		return inv[n];
	}
	ll nPr(int n,int r){
		return fact[n]*inv[n-r]%MOD;
	}
	ll nCr(int n,int r){
		return nPr(n,r)*inv[r]%MOD;
	}
	ll nrP(int n,int r){
		return nPr(n+r,n);
	}
	ll nrC(int n,int r){
		return nCr(n+r,n);
	}
};
int a[200000];
int main(){
	int n,K;cin>>n>>K;
	Fact fac(n);
	rep(i,n)scanf("%d",&a[i]);
	sort(a,a+n);
	ll ans=0;
	rep(i,n){
		if(i+1>=K){
			(ans+=a[i]*fac.nCr(i,K-1))%=MOD;
		}
	}
	sort(a,a+n,greater<>());
	rep(i,n){
		if(i+1>=K){
			(ans+=MOD-a[i]*fac.nCr(i,K-1)%MOD)%=MOD;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3712
#include<iostream>
#include<cstdio>
#include<string>
#include<cstdlib>
using namespace std;
struct node{
	int key;
	node *right, *left, *p;
};

node *root, *NIL;

node * find(node *u,int k)
{
	while(u!=NIL&&k!=u->key)
	{
		if(k<u->key)u =u->left;
		else u=u->right;
	}
	return u;
}

void insert(int k)
{
	 node *y=NIL;
	 node *x=root;
	 node *z;
	 z=(node *)malloc(sizeof(node));
	 z->key=k;
	 z->left=NIL;
	 z->right=NIL;
	 while(x!=NIL)
	 {
	 	y=x;
	 	if(z->key < x->key)
	 	{
	 		x=x->left;
		 }
		 else {
		 	x=x->right;
		 }
	 }
	 z->p=y;
	 if(y==NIL)
	 {
	 	root=z;
	 }
	 else 
	 {
	 	if(z->key<y->key)
	 	{
	 		y->left=z;
		 }
		 else 
		 {
		 y->right=z;
		 }
	 }

}
void inorder(node *u)
{
	if(u==NIL)return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}

void preorder(node *u)
{
	if(u==NIL)return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main()
{
	int n,i,x;
	string com;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		cin>>com;
		if(com[0]=='f')
		{
			scanf("%d",&x);
			node *t=find(root,x);
			if(t!=NIL)printf("yes\n");
			else printf("no\n");
		}
		else if(com=="insert")
		{
		scanf("%d",&x);
		insert(x);
		}
		else if(com=="print")
		{
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	return 0;
}



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

struct card {
    char mark;
    int number;
};

void BubbleSort (card A[], int n){
    int  flag = 1;
    while (flag){
        flag = 0;
        for(int i=n-1;i>=1;i--){
            if(A[i].number < A[i-1].number){
                swap(A[i],A[i-1]);
                flag = 1;
            }
        }
    }
}

void SelectionSort (card A[], int n){
    int minj;
    for(int i=0;i<=n-1;i++){
        minj = i;
        for (int j=i;j<=n-1;j++){
            if (A[j].number < A[minj].number){
                minj = j;
            }
        }
        swap(A[i],A[minj]);
    }
}

bool isStable(card A[],card B[],int n){
    int flag = 1;
    for (int i=0;i<n;i++){
        if (!(A[i].mark == B[i].mark && A[i].number == B[i].number)){
            flag = 0;
        }
    }
    
    if (flag == 1){
        return 1;
    }else{
        return 0;
    }
}

int main(){

    card A[100],B[100],S[100];
    int n;
    cin >> n;
    for (int i=0;i<n;i++){
        scanf(" %c%d*c",&A[i].mark,&A[i].number);
        B[i] = A[i];
        S[i] = A[i];
    }

    BubbleSort(B,n);
    SelectionSort(S,n);

    for (int i=0;i<n;i++){
            if(i != n-1){
                cout << B[i].mark << B[i].number << " ";
            }else{
                cout << B[i].mark << B[i].number << endl;
            }
    }

    cout << "Stable" << endl;

    for (int i=0;i<n;i++){
            if (i !=n-1){
                cout << S[i].mark << S[i].number << " ";
            }else{
                cout << S[i].mark << S[i].number << endl;
            }
    }

    if (isStable(B, S, n)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }

    return 0;

}


Measured memory_bytes: 3144
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = sc.nextInt();
            long[] A = new long[N];
            int minusSum = 0;
            long tmp;
            for (int i = 0; i < N; i++) {
                tmp = sc.nextInt();
                if (tmp < 0) minusSum ++;
                A[i] = Math.abs(tmp);
            }

            if (minusSum%2 == 0) {
                System.out.println(Arrays.stream(A).sum());
            } else {
                System.out.println(Arrays.stream(A).sum() - 2*Arrays.stream(A).min().getAsLong());
            }


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private int gcd(int a, int b) {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a%b);
    }

    private int gcd(int[] param) {
        final int len = param.length;
        int g = gcd(param[0], param[1]);
        for (int i = 1; i < len - 1; i++) {
            g = gcd(g, param[i+1]);
        }
        return g;
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 47828
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i=0;i<n;i++) cin >> A[i];
    map<ll,ll> mp;
    for(int i=0;i<n;i++){
        mp[A[i]]++;
    }
    ll sum=0;
    for(auto p: mp){
        sum+=p.second*(p.second-1)/2;
    }
    for(int i=0;i<n;i++){
        cout << sum-(mp[A[i]]-1) << endl;
    }
}

Measured memory_bytes: 10240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;

int main() {
  ll n;
  string s;
  cin >> n >> s;
  vector<ll>cnt(3);
  rep(i,n){
    if(s[i]=='R') cnt[0]++;
    if(s[i]=='G') cnt[1]++;
    if(s[i]=='B') cnt[2]++;
  }
  ll ans = 1;
  rep(i,3) ans *= cnt[i];
  
  rep(j,n) rep(i,j){
    ll k = j + j - i;
    if(k<n){
      if(s[i]==s[j]) continue;
      if(s[i]==s[k]) continue;
      if(s[k]==s[j]) continue;
      ans--;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3616
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            if (String.valueOf(n).contains("9")) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }
}



Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))

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

// n?¬??????????????????????????¬¬????????°???????????????????????¨???????????????????????????
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}

signed main() {
	int n, m;

	scanf("%d %d", &n, &m);
	vector<vector<int>> dp(5002, vector<int>(5002));
	REP(i, m) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		dp[a-1][b-1] = max(dp[a-1][b-1],c+1);
	}
	int ans = 0;
	REP(i, n) {
		REP(j, n) {
			if (dp[i][j]) {
				ans++;
				dp[i + 1][j] = max(dp[i + 1][j],dp[i][j] - 1);
				dp[i + 1][j + 1] = max(dp[i + 1][j+1], dp[i][j] - 1);
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 100804
#include <iostream>
#include<math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
	double N, M;
	cin >> N >> M;
	int A[110];
	double total = 0;

	rep(i, N) {
		cin >> A[i];
		total += A[i];
	}

	int c = 0;
	double AA = (total / (4 * M));
	rep(i, N) {
		if (A[i] >= AA) {
			c++;
		}

	}

	if (c >= M)cout << "Yes" << endl;
	else cout << "No" << endl;
return 0;
} 

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

// THINGS TO REMEMBER
// ENDL is slow, '\n' is fast
// Clear everything (including graphs) between test cases
// use anti-anti-hash: https://codeforces.com/blog/entry/62393
// pb-ds: https://codeforces.com/blog/entry/11080
// check when to use LLONG_MAX/LLONG_MIN vs INT_MAX or INT_MIN
// You frequently suffer from confirmation bias - you trust your initial solution and miss simple things. 
// When you hit a roadblock, remember to rethink the solution ground up, not just try hacky fixes

int main(){
	
	#ifndef ONLINE_JUDGE
    	freopen("input", "r", stdin);
    	freopen("output", "w", stdout);
    	freopen("error", "w", stderr);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;

    if(s[0]>='a' && s[0]<='z'){
    	cout<<'a'<<endl;
    }
    else{
    	cout<<"A"<<endl;
    }

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(0); 
  cin.tie(0); 

  string s; cin >> s;

  string res = s.front() + to_string(s.size() - 2) + s.back();
  cout << res << "\n";
}


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

int main()
{long long int n,a,b,d,i,c[100000],sum=0;
cin>>n;
for(i=0;i<n;i++)
{cin>>a>>b;
d=b-a+1;
c[i]=d;}
for(i=0;i<n;i++)
{sum+=c[i];}
cout<<sum<<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++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
// typedef pair<int, int> P;
typedef pair<ll, int> P;
typedef vector<int> vi;
typedef vector<P> vp;
typedef vector<ll> vll;

struct edge { int to; ll cost; };

const ll inf = 1e15;
const int MAX_N = 100010;

int N, M;
int s;
vector<edge> G[MAX_N];
ll d[MAX_N];

//s: start
void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P>> que;   // cost, vertex
    rep(i, N) d[i] = inf;
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        rep(i, G[v].size()) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }

}

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

    cin >> N >> M >> s;
    rep(i, M) {
        int a, b;
        ll c;
        cin >> a >> b >> c;
        G[a].emplace_back((edge){b, c});
    }

    dijkstra(s);
    rep(i, N) {
        if (d[i] < inf) {
            cout << d[i] << endl;
        } else {
            cout << "INF" << endl;
        }
    }
}

Measured memory_bytes: 19360
#include<stdio.h>
#include<ctype.h>
int main(){
    char moji;
    int num, i, count[26] = {};

    for(; scanf("%c", &moji) != EOF;){
    //    scanf("%c", &moji);
  //      if( moji == '\n'){// scanf("%c", &moji) == EOF ){
//            break;
//        }
        if( islower( moji ) ){
        num = moji - 'a';
        count[ num ] += 1;

//        printf("%d", num);
        }else if( isupper( moji ) ){
            num = moji - 'A';
            count[ num ] += 1;
        }

    }
    for( i = 0; i < 26; i++ ){
        printf("%c : %d\n", i + 'a', count[i]);
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	string s;
	cin >> s;

	int k;
	cin >> k;

	int n = s.size();
	vector<string> v;

	FOR(i,1,min(k+1,n+1)){
		rep(j,n-i+1){
			//cout << i << " " << j << " " << s.substr(j,i) << endl;
			string a = s.substr(j,i);
			auto b = find(v.begin(), v.end(), a);
			if(b == v.end()) v.push_back(a);	
		}
	}

	// rep(i,v.size()) cout << v[i] << " ";
	// cout << endl;

	sort(v.begin(), v.end());
	cout << v[k-1] << endl;
}

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

using ll = long long;
#define NL '\n'
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(ii,aa,bb) for(ll (ii)=ll(aa);(ii)<(ll)(bb);++(ii))
#define _fastIO() ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

const int mxx = 1e5+9;
int n, k, a[mxx], dp[mxx];

int fun(int pos){
	if(pos + 1 == n) return 0;
	if(dp[pos] == -1){
		dp[pos] = INT_MAX;
		rep(i, 0, k+1){
			if(pos + i < n) dp[pos] = min(dp[pos], (abs(a[pos+i]-a[pos]) + fun(pos + i)));
		}
	}
	return dp[pos];
}

int main(){
	_fastIO();
	rep(i, 0, mxx) dp[i] = -1;
	cin >> n >> k; rep(i, 0, n) cin >> a[i];
	cout << fun(0) << NL;
}

Measured memory_bytes: 5760
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		double x=in.nextDouble(),y=in.nextDouble();
		double a=y/(x*2),b=y;
		List<position> S=new ArrayList<>();
		
		for(double i=0;i<=x*2;i+=2){
			position p=new position();
			p.x=i;
			p.y=b-(a*i);
			//System.out.println(p.x+" "+p.y);
			S.add(p);
		}
		
		for(double i=0;i<=y;i++){
			position p=new position();
			p.x=(b-i)/a;
			p.y=i;
			//System.out.println(p.x+" "+p.y);
			
			boolean jd=true;
			for(int j=0;j<S.size();j++){
				position c=S.get(j);
				if((p.x==c.x) || (p.y==c.y)){
					jd=false;
					break;
				}
			}
			if(jd)S.add(p);
		}
		
		System.out.println(S.size());
	}

}

class position{
	double x,y;
}



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

//https://atcoder.jp/contests/agc006/tasks/agc006_b

int n, x;

int main() {
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;

	int a = (n - 1 + x) % (2 * n - 1);
	for (int i = 0; i < 2 * n - 1; ++i)
		cout << (a + i) % (2 * n - 1) + 1 << endl;
}


Measured memory_bytes: 3604
n,k = map(int,input().split())
l = list(map(int,input().split()))

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
while ub-lb > 1:
    mid = (lb + ub) // 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

print(ub)

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

int main() {

  int N;
  int K;
  cin >> N >> K;

  vector<int> ansflg(N,0);

  for(int i=0; i<K; i++){
    int dsum;
    cin >> dsum;
    for(int j=0; j<dsum; j++){
      int ckindex;
      cin >> ckindex;
      ansflg.at(ckindex-1) = 1;
    }
  }

  int ans=0;

  for(int i=0; i<N; i++){
    if(ansflg.at(i)==0){
      ans++;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		//
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String[] inputStr = null;
		int[] inputInt = null;
		try {
			while(true) {
				inputStr = (input.readLine()).split("\\s");
				inputInt = new int[inputStr.length];
				for (int index = 0; index < inputInt.length; index++) {
					inputInt[index] = Integer.parseInt(inputStr[index]);
				}
				if(inputInt[0] == 0 && inputInt[1] == 0) {
					break;
				}
				for (int row = 0; row < inputInt[0]; row++) {
					for (int col = 0; col < inputInt[1]; col++) {
						System.out.print("#");
					}
					System.out.println();
				}
				System.out.println();
			}

		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}


	}

}



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

using namespace std;

const int sz = 3;
const int fav = 753;
 
int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

#ifdef LOCAL_DEFINE
	freopen("input.txt", "r", stdin);
#endif

	function<int(string)> stoint = [&] (string s) {
		int ret = 0;
		for (int i = 0; i < (int) s.size(); i++) {
			ret *= 10;
			ret += (s[i] - '0');
		}
		return ret;
	};

	string a;
	cin >> a;
	vector<int> vs;
	for (int i = 0; i < (int) a.size(); i++) {
		vs.push_back(stoint(a.substr(i, sz)));
	}
	int ans = 1e+9;
	for (auto el : vs) ans = min(ans, abs(fav - el));
	cout << ans << '\n';

#ifdef LOCAL_DEFINE
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll d,n;
    cin >> d >> n;
    if(n == 100) n++;
    cout <<(ll) pow(100,d) * n << endl;
}

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

using namespace std;

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


const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()


int main(){
    int N;
    cin>>N;
    vector<int> B(N);
    rep(i,N){
        int a;
        cin>>a;
        B[i]=(a-(i+1));
    }
    sort(B.begin(),B.end());

    //rep(i,N)cout<<B[i]<<" ";
    //cout<<endl;

    int mode;

    if(N%2==0){
        mode=(B[N/2-1]+B[N/2])/2;
    }else mode=B[(N-1)/2];

    ll ANS=0;
    rep(i,N){
        ANS+=abs(B[i]-mode);
    }

    cout<<ANS<<endl;


    return 0;
}

//a=97,z=122

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>

main(){
	int i,j,s,q,t,sum;
	int n[10000],m[500];
	for(i=0;i<10000;i++){
		n[i]=0;
	}
	scanf("%d",&s);
	for(i=0;i<s;i++){
		scanf(" %d",&j);
		n[i]=j;
	}
	scanf(" %d",&t);
	for(i=0;i<t;i++){
		scanf(" %d",&j);
		m[i]=j;
	}
	sum=0;
	for(j=0;j<t;j++){
		for(i=0;i<s;i++){
			if(n[i]==m[j]){
				sum++;break;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);

int main() {
    // source
    string s;
    cin >> s;
    string ans;
    rep(i, s.size()) {
        if (s[i] == '0') {
            ans.push_back('0');
        } else if (s[i] == '1') {
            ans.push_back('1');
        } else {
            if (ans.size() != 0)
                ans.erase(ans.size() - 1);
        }
    }

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

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
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; }

bool isOK(string s){
    bool can = false;
    string srev = s;
    reverse(srev.begin(), srev.end());
    if(s == srev) can = true;
    return can;
}

signed main(){
    int l;
    cin >> l;
    long double len = l / 3.0;

    long double ans = len * len * len;
    printf("%.7Lf\n", ans);
}

Measured memory_bytes: 3772
#include <iostream>
#include <string>
using namespace std;
int main(){
	string n;
	int sum = 0, num;
	cin >> n;
	for (int i = 0; i < n.size(); i++) {
		sum = sum + n.at(i) - '0';
	}
	if (sum % 9 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int i,a=0,z;
  string s;
  cin >> s;
  for (i=s.size()-1;i>=0;i--) if (s.at(i)=='A') a=i;
  for (i=0;i<s.size();i++) if (s.at(i)=='Z') z=i;
  cout << z-a+1 << endl;
  return 0;
}

Measured memory_bytes: 640
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
a.sort()
x = 1
for i in range(n):
    x *= a[i]
    # print(i,x)
    if x > 10**18:
        print(-1)
        quit()
print(x)

Measured memory_bytes: 23644
#include <iostream>
using namespace std;
int main()
{
  int n,l[15],e = 0,nd = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> l[i];
    if(l[i] > e){
      nd+=e;
      e = l[i];
    }else{
      nd+=l[i];
    }
  }
  if(nd > e){
    cout << "Yes" << endl;
  }else if(nd <= e){
    cout << "No" << endl;
  }
  return(0);
}


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

using namespace std;
using ll = long long;

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

int main() {
  int a, b;
  cin >> a >> b;
  cout << max(0, a - 2 * b) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>

using namespace std;

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

  int N;
  cin >> N;
  unordered_set<int> set;
  int a;
  for (int i = 0; i < N; ++i) {
    cin >> a;
    auto it = set.find(a);
    if (it == set.end())
      set.insert(a);
    else
      set.erase(a);
  }
  cout << set.size() << endl;

  return 0;
}


Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

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

  ll n;
  cin >> n;

  map<string, ll> mp;
  ll ans = 0;
  for(ll i = 0; i < n; i++){
    string s;
    cin >> s;

    sort(all(s));
    ans += mp[s]++;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n,m; cin>>n>>m;
  vector<int> a(m);
  rep(i, m) cin>>a[i];

  int sum=0;
  rep(i, m) sum+=a[i];
  int res=max(-1, n-sum);
  cout<<res<<endl;
}


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

double fun(ll i) {
	ll ii = i;
	ll ans = 0;
	while(i) {
		ans += i % 10;
		i /= 10;
	}
	return double(ii) / ans;
}

int main() 
{
	int n;
	cin >> n;
	ll k = 0, kk = 1;
	for(int i = 0; i < n; i++) {
		if( (k / kk) % 10 == 9 && fun(k + kk) > fun(k + 10*kk) ) kk *= 10;
		k += kk;
		cout << k << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>

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

using namespace std;

int main() {
    int k,x;
    cin >>k>>x;
    
    REP(i,k*2-1) {
        if (i == k*2-1) cout << x-k+i+1;
        else cout << x-k+i+1 << ' ';
    }
    cout << endl;    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int h = Integer.parseInt(sc.next());
		int n = Integer.parseInt(sc.next());
	
		int sum = 0;
		for (int i = 0 ; i < n ; i++) {
			
			sum += Integer.parseInt(sc.next());
			
		}
		
		if(h > sum) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
		
	}
	
	
	

}

Measured memory_bytes: 46112
#include <iostream>
#include <vector>
int main() {
	int n, k;
	std::cin >> n >> k;
	std::vector<int> nums(n);
	std::vector<int> counts(k, 0);
	for (auto &num : nums) {
		std::cin >> num;
	}
	int left{ 0 }, right{ 0 }, count{ 0 };
	int min_length = n + 1;
	while (true) {
		while (count < k && right < n) {
			if (nums[right] <= k && counts[nums[right] - 1]++ == 0) ++count;
			++right;
		}
		if (count == k) {
			while (count == k) {
				if (nums[left] <= k && --counts[nums[left] - 1] == 0) --count;
				++left;
			}
			if (min_length > right - left + 1) min_length = right - left + 1;
		}
		else break;
	}
	if (min_length == n + 1) std::cout << 0 << std::endl;
	else std::cout << min_length << std::endl;
}


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

char Grade(int a, int b, int c){
    int sum = a + b;
    char grade;
    if (a == -1 || b == -1){
        grade ='F';
    }else if( 80 <= sum){
        grade ='A';
    }else if (65 <=sum && sum <80){
        grade ='B';
    }else if (50 <=sum && sum <65){
        grade ='C';
    }else if (30<= sum && sum <50){
        if (50 <= c) grade ='C';
        else grade ='D';
    }else if (sum <30){
        grade= 'F';
    }
    return grade;
}

int main(){
    int a,b,c;
    while(1){
        cin >> a >> b >> c;
        if (a==-1 && b==-1 && c ==-1) break;
        cout << Grade(a,b,c) << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
fun main(args: Array<String>) {
    val a = readLine()!!.split(" ").map(String::toInt)
    val b = readLine()!!.split(" ").map(String::toInt)
    val c = readLine()!!.split(" ").map(String::toInt)
    val n = readLine()!!.toInt()
    val card = a + b + c
    var stat = Array(3, { arrayOfNulls<Int>(3)})

    for (i in 1..n) {
        when (readLine()!!.toInt()) {
            card[0] -> stat[0][0] = 1
            card[1] -> stat[0][1] = 1
            card[2] -> stat[0][2] = 1
            card[3] -> stat[1][0] = 1
            card[4] -> stat[1][1] = 1
            card[5] -> stat[1][2] = 1
            card[6] -> stat[2][0] = 1
            card[7] -> stat[2][1] = 1
            card[8] -> stat[2][2] = 1
        }
    }

    if ((stat[0][0] == 1 && stat[0][1] == 1 && stat[0][2] == 1) ||
        (stat[1][0] == 1 && stat[1][1] == 1 && stat[1][2] == 1) ||
        (stat[2][0] == 1 && stat[2][1] == 1 && stat[2][2] == 1) ||
        (stat[0][0] == 1 && stat[1][0] == 1 && stat[2][0] == 1) ||
        (stat[0][1] == 1 && stat[1][1] == 1 && stat[2][1] == 1) ||
        (stat[0][2] == 1 && stat[1][2] == 1 && stat[2][2] == 1) ||
        (stat[0][0] == 1 && stat[1][1] == 1 && stat[2][2] == 1) ||
        (stat[0][2] == 1 && stat[1][1] == 1 && stat[2][0] == 1)) {
        println("Yes")
    } else {
        println("No")
    }
}


Measured memory_bytes: 37724
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define PI 3.14159265359
typedef long long LL;

template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> void print_vector(vector<T> vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << vec[i] << " ";
	}
	cout << "]" << endl;
}
template<class T> void print_pair_vector(vector<pair<T, T> > vec) {
	cout << "[ ";
	for (int i = 0; i < vec.size(); i++) {
		cout << "(" << vec[i].first << "," << vec[i].second << ") ";
	}
	cout << "]" << endl;
}

const int INF = 1 << 30;

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

	vector<int> button(N+1);
	REP(i, 1, N + 1) cin >> button[i];

	int count = 0;
	int current_lighting_button = 1;
	for (int i = 1; i <= N - 1; i++) {
		current_lighting_button = button[current_lighting_button];
		count++;

		if (current_lighting_button == 2) {
			break;
		}
	}

	if (current_lighting_button == 2) {
		cout << count << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	private static final List<String> list = Arrays.asList("a", "e", "i", "o", "u");

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			String s = scanner.nextLine();
			System.out.println(list.contains(s) ? "vowel" : "consonant");
		}
	}
}


Measured memory_bytes: 22996
#include<iostream>
#include<cstdio>
using namespace std;
#define int long long
signed main(){
	int a1,b1,c1,d1;
	scanf("%lld %lld %lld %lld",&a1, &b1, &c1, &d1);
	int a2,b2,c2,d2;
	scanf("%lld %lld %lld %lld",&a2, &b2, &c2, &d2);
	int ans1 = a1 + b1 + c1 + d1;
	int ans2 = a2 + b2 + c2 + d2;
	if (ans1 > ans2) cout << ans1 << endl;
	else cout << ans2 << endl;
	return 0;
}

Measured memory_bytes: 3224
#include <cstdio>

using namespace std;

int main() {
  int N, L[105], ans = 0;

  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &L[i]);
  }

  for (int i=0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (j >= N) {
        break;
      }
      for (int k = j + 1; k < N; k++) {
        if (k >= N) {
          break;
        }
        if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) {
          //printf("%d %d %d\n", L[i], L[j], L[k]);
          ans++;
        }
      }
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 1736
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

li gcd(li a,li b) {
    return a % b == 0 ? b : gcd(b, a % b);
}

int main(void) {
    li A, B, K;
    cin >> A >> B >> K;

    FOR(i, 0, K) {
        if (i % 2 == 0) {
            // 偶数回目なので高橋くん
            if (A % 2 == 1) {
                A = A - 1;
            }
            A = A / 2;
            B = B + A;
        } else {
            // 奇数回目なので青木くん
            if (B % 2 == 1) {
                B = B - 1;
            }            
            B = B / 2;
            A = A + B;

        }
    }

    cout << A << " " << B;
     
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(const T a, const T b){return a>=0 ? a/b : (a+1)/b-1;}
template<class T> T div_ceil(const T a, const T b){return a>=0 ? (a-1)/b+1 : a/b;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    set<int> S;
    rep(i, 3){
        int a;
        scanf("%d", &a);
        S.insert(a);
    }
    puts(S.size() == 2 ? "Yes" : "No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int main() {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) {
    cin >>a.at(i);
  }
  int count = 0;
  rep(i,n) {
    if(a.at(i)>=k) {
      count++;
    }
  }
  cout << count <<endl;
}

Measured memory_bytes: 640
import java.util.*;
 
class Main {
  
   public static int findSumOfDigits (int n){
     int sum = 0;
     while(n>0){
       sum += n%10;
       n = n/10;
     } 
     return sum;
   }
  
  
    public static void main(String[] args) {
      
      
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int sum = findSumOfDigits(N);
		
       if(N%sum==0){
         System.out.print("Yes");
       }else{
         System.out.print("No");
       }
       
		
    }
}

Measured memory_bytes: 21332
import Control.Applicative
import Data.List

main = do
  l <- lines <$> getContents
  let w = map words l :: [[String]]
  let wi = map (map (read :: String -> Int) ) w :: [[Int]]
  let s = map sort $ takeWhile (/= [0,0]) wi :: [[Int]]
  let ss = map (map show) s :: [[String]]
  let ss_cat = map unwords ss :: [String]
  mapM_ putStrLn ss_cat




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

int main(){
    while(true){
        int n, m, a, h, p, q;
        vector<pair<int, int> > amida[1001];
        cin >> n >> m >> a;
        if(!(n || m || a)) break;
        for(int i=0;i<m;++i){
            cin >> h >> p >> q;
            amida[h].push_back(make_pair(p, q));
        }
        for(int i=1000;i>0;--i){
            for(int j=0;j<amida[i].size();++j){
                if(amida[i][j].first==a){
                    a=amida[i][j].second;
                    break;
                }else if(amida[i][j].second==a){
                    a=amida[i][j].first;
                    break;
                }
            }
        }
        cout << a << endl;
    }
}

Measured memory_bytes: 1240
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>
#include <unordered_set>

int main()
{
    int H, W, h, w;
    std::cin >> H >> W >> h >> w;

    std::cout << (H - h) * (W - w) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("trapv")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6, INF = 1e9 * 1e9 + 10, MOD = 1e9 + 7;
ll n;
vector<ll> vec;

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

void input() {
	cin >> n;
	vec.resize(n);

	for (int i = 0; i < n; i++) cin >> vec[i];
}

ll brute() {
	ll pw = (1ll << (n - 1));
	ll ans = 0;
	for (int i = 0; i < pw; i++) {
		set<ll> xs;
		ll curX = 0;
		for (int j = 0; j < n; j++) {
			curX ^= vec[j];
			if (j == n - 1 || ((1ll << j) & i)) {
				xs.insert(curX);
				curX = 0;
			}
		}
		ans += (xs.size() == 1);
	}

	return ans;
}

ll bpow(ll vl, ll pw, ll md = MOD) {
	if (pw == 0) {
		return 1;
	}
	else if (pw % 2 == 1) {
		ll a = bpow(vl, pw - 1, md);
		return (a * vl) % MOD;
	}
	else {
		ll b = bpow(vl, pw / 2, md);
		return (b * b) % MOD;
	}
}

ll sol() {
	ll x = 0, mx = 0;
	for (int i = 0; i < n; i++) {
		x ^= vec[i];
		mx = max(mx, vec[i]);
	}

	if (x == 0) {
		ll curInd = 0, pr = -1;
		vector<vector<ll>> cnt;
		cnt.resize((1ll << (21)));

		ll curX = 0;
		vector<pair<ll, ll>> bls;
		for (int i = 0; i < n; i++) {
			curX ^= vec[i];
			if (curX == 0) {
				bls.push_back({ pr + 1, i });
				pr = i;
			}
		}

		ll i = 0;
		for (auto cur : bls) {
			ll curX = 0;
			for (int j = cur.first; j <= cur.second; j++) {
				curX ^= vec[j];
				cnt[curX].push_back(i);
			}
			i++;
		}

		ll ans = 0;
		ans += bpow(2ll, ll(bls.size() - 1ll), MOD);
		ans %= MOD;

		ll dp[2];
		dp[0] = 1;
		dp[1] = 0;

		for (int i = 1; i < cnt.size(); i++) {
			dp[0] = 1;
			dp[1] = 0;
			vector<ll> vals;
			ll pr = -1;
			for (int j = 0; j < cnt[i].size(); j++) {
				if (pr + 1 == cnt[i][j]) {

				}
				else {
					vals.push_back(cnt[i][j] - pr - 1);
				}
				vals.push_back(0);
				vals.push_back(0);
				pr = cnt[i][j];
			}

			for (auto cur : vals) {
				ll pr1 = dp[0], pr2 = dp[1];
				if (cur == 0) {
					dp[1] = pr2 + pr1;
					dp[0] = pr2;
					pr = 0;
				}
				else {
					dp[0] = pr1 + (pr2 * cur) % MOD;
				}
				dp[0] %= MOD;
				dp[1] %= MOD;
			}

			ans += dp[1];
			ans %= MOD;
		}

		return ans;
	}
	else {
		ll curX = 0, cnt = 0, cnt2 = 0;
		vector<ll> vals;
		for (int i = 0; i < n; i++) {
			curX ^= vec[i];
			if (curX == 0) {
				cnt2++;
				vals.push_back(0);
			}
			else if (curX == x) {
				cnt++;
				vals.push_back(1);
				curX = 0;
			}
		}

		ll dp[2];
		dp[0] = 1;
		dp[1] = 0;
		ll pr = 0;
		for (auto cur : vals) {
			ll pr1 = dp[0], pr2 = dp[1];
			if (cur == 0) {
				dp[0] = pr1 + pr2;
			}
			else {
				dp[1] = pr2 + pr1;
				dp[0] = pr2;
				pr = 0;
			}
			dp[0] %= MOD;
			dp[1] %= MOD;
		}

		return dp[1];
	}
}

int main()
{
	fastInp;

	input();
	cout << sol();

	return 0;
}

Measured memory_bytes: 72024
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int mod=1e9+7;
int n;
vi a,L,R;

int main(){
	cin>>n;
	int N=2*n-1,M=1,res=0;
	a=vi(N);
	L=R=vi(n);
	for(auto& i:a) cin>>i;
	sort(a.begin(),a.end());
	for(int i=0;i<n-1;i++) if(a[i]<a[i+1]) L[n-i-1]++;
	for(int i=n;i<N;i++) if(a[i-1]<a[i]) R[i-n+1]++;
	vvi dp(1,vi(1));
	dp[0][0]++;
	for(int i=1;i<n;i++){
		int M_=M+L[i]+R[i];
		vvi DP(M_,vi(M_));
		for(int j=0;j<M;j++) for(int k=0;k<=j;k++) for(int I=0;I<=j+L[i]+R[i];I++){
			(DP[j+L[i]+R[i]-max(0,abs(I-L[i]-k)-1)][min(I,k+L[i]+1)]+=dp[j][k])%=mod;
		}
		dp=DP;M=M_;
	}
	for(auto i:dp) for(auto j:i) (res+=j)%=mod;
	cout<<res<<endl;
}

Measured memory_bytes: 384
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=((int)(x) - 1 * 100);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
using namespace std;
ll n;
ll a[100000];
int main() {
	cin >> n;
	ll tp = 0, sum = 0;
	rep(i, n) cin >> a[i];
	rep(i, n) {

		if (i % 2) {
			if (sum + a[i] >= 0) {
				tp += sum + a[i] + 1;
				sum = -1;
			}
			else {
				sum += a[i];
			}
		}
		else {
			if (sum + a[i] <= 0) {
				tp += abs(sum + a[i]) + 1;
				sum = 1;
			}
			else {
				sum += a[i];
			}
		}
	}
	ll ans = tp;
	tp = sum = 0;
	rep(i, n) {

		if (i % 2) {
			if (sum + a[i] <= 0) {
				tp += abs(sum + a[i]) + 1;
				sum = 1;
			}
			else {
				sum += a[i];
			}
		}
		else {
			if (sum + a[i] >= 0) {
				tp += sum + a[i] + 1;
				sum = -1;
			}
			else {
				sum += a[i];
			}
		}
	}
	cout << min(ans, tp) << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int d;
    int n;
    cin>>d>>n;
    int t[200];
    int a[200];
    int b[200];
    int c[200];
    int dp[200][200];
    for(int i=0;i<d;i++){
    cin>>t[i];
    }
    for(int i=0;i<n;i++){
    cin>>a[i]>>b[i]>>c[i];
    }
    for(int ii=0;ii<d;ii++){
    for(int i=0;i<n;i++){
        if(a[i]<=t[ii]&&b[i]>=t[ii]){
        dp[ii][i] = 0;
        }else{
            dp[ii][i] = -1;
        }
    }}
    for(int i=1;i<d;i++){
        for(int ii=0;ii<n;ii++){
        if(a[ii]<=t[i]&&b[ii]>=t[i]){
            for(int iii=0;iii<n;iii++){
            if(dp[i-1][iii]>=0){
                dp[i][ii] = max(dp[i][ii],dp[i-1][iii]+abs(c[ii]-c[iii]));
            }}
        }else{
            dp[i][ii] = -1;
        }
        }
        }
        int res=0;
        for(int i=0;i<n;i++){
            res = max(res,dp[d-1][i]);
        }
        cout<<res<<endl;
return 0;
}

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

int main(){
    int A,B,C,D;
    int sum1,sum2;
    cin >> A >> B >> C >> D;
    sum1 = A * B;
    sum2 = C * D;

    if (sum1 >= sum2){
        cout << sum1;
    }
    
    if (sum1 < sum2){
        cout << sum2;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cxxabi.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    ((ll)1ll<60)
#define INF     ((int)INT_MAX)
#define EPS     (1e-9)
#define MOD     (1000000007)
template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool b=1;for(auto s:t)os<<(exchange(b,0)||strlen(abi::__cxa_demangle(typeid(S).name(),0,0,0))>20?"":" ")<<s;return os<<endl;}

struct segTree{
	vi val;
	int N;
	segTree(int n){
		N=1;
		while(N<n)N*=2;
		val.resize(N*2);
		fill(all(val),INF);
	}
	
	void replace(int k, int a){
		k+=N;
		val[k]=a;
		while(k){
			k/=2;
			val[k]=min(val[k*2],val[k*2+1]);
		}
	}
	int minimum(int a, int b){return minimum(a,b,1,0,N);}
	int minimum(int a, int b, int k, int l, int r){
		if(r<=a or l>=b) return INF;
		if(a<=l and r<=b) return val[k];
		int m=(l+r)/2;
		return min(minimum(a,b,k*2,l,m),minimum(a,b,k*2+1,m,r));
	}	
};


int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n,q;
	while(cin>>n>>q){
		segTree st(n);
		rep(_,q){
			int c,x,y;
			cin>>c>>x>>y;
			if(c==0) st.replace(x,y);
			else cout<<st.minimum(x,y+1)<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 3852