akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
 
long long int INF = 2e18;
const ll fact_table = 1200008;
double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
 
// const ll mod = 998244353ll;
const ll mod = 2000000011;
  
ll mypow(ll number1,ll number2, ll mod){
    if(number2 == 0){
        return 1ll;
    }else{
        ll number3 = mypow(number1,number2 / 2, mod);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k, l, r;

void solve(){
    cin >> a >> b >> c;
    pe(c);pe(a);p(b);
    return;
}

int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;

    if(multicase){
        cin >> q;
    }else{
        q = 1;
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    
    // solve();
    return 0;

}
















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int r, d, c; cin >> r >> d >> c;
	long long int x[12];
	x[0] = c;
	for(int i=1;i<11;i++){
		x[i] = x[i-1]*r-d;
	}
	for(int i=1;i<11;i++){
		cout << x[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 1<<20
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long int ll;
using ipair = pair<int,int>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
const int MOD=1000000007;
int main(){
    int n;cin>>n;
    priority_queue<ipair,vector<ipair>,greater<ipair>>b,cp;
    vector<ipair> r;
    ll x,y;
    rep(i,n){
        cin>>x>>y;
        r.push_back(make_pair(x,y));
    }
    rep(i,n){
        cin>>x>>y;
        b.push(make_pair(x,y));
    }
    sort(r.begin(),r.end());
    int cnt = 0,mx = -1,mxx=0;
    rep(i,n){
        int ok = 0;
        ipair ba = b.top();b.pop();
        mx = -1;mxx=0;
        for (int i = 0; i < r.size(); i++)
        {        
            if(ba.first<r[i].first)break;
            if(ba.second>r[i].second&&mx<r[i].second){
                //cout<<"r"<<r[i].second<<endl;
                ok = 1;
                mx =r[i].second;
                mxx = i;
            }
        }      
        if(ok){cnt++;
        r.erase(r.begin()+mxx);}
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b,k = map(int,input().split())
itr = 0
while(itr < k):
  if(itr % 2 == 0):
    a = a - (a % 2)
    c = a//2
    a = a - c
    b = b + c
  if(itr % 2 == 1):
    b = b - (b % 2)
    c = b//2
    b = b - c
    a = a + c
  itr += 1
print(a,b)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 2000005
using namespace std;
using namespace __gnu_pbds;  

double l;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	cin>>l;
	double length = l/(double)3.0;
	l-=length;
	double breadth = l/(double)2.0;
	double height = l-breadth;
	double ans = length*breadth*height;
	cout<<fixed<<setprecision(10)<<ans<<endl;
}

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

int n, k;
ll a[100010];
ll p[100010];

int main(){
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  ll sum = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] >= 0) {
      p[i] = a[i];
      sum += a[i];
    }
    p[i] += p[i - 1];
    a[i] += a[i - 1];
  }
  ll ans = 0;
  for (int i = k; i <= n; i++) {
    ll pls = p[i] - p[i - k];
    ll sm = a[i] - a[i - k];
    ll now1 = sum - pls + sm;
    ans = max(ans, now1);
    ll now2 = sum - pls;
    ans = max(ans, now2);
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int n;
	cin>>n;
	vector<int>v(n);
	int aux,sum;
	for(int i=0;i<n;i++)
	{
		cin>>aux;
		v[i]=aux;
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n-1;i++)
	{
		sum+=v[i];
	}
	if(v[n-1]<sum)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * 4 4 4 4 4
 * 9 3 3 3 3
 * 8 8 2 2 2
 * 7 7 7 1 1
 * 6 6 6 6 1
 * 5 5 5 5 5
 * 10 4 4 4 4
 * 9 9 3 3 3
 * 8 8 8 2 2
 * 7 7 7 7 2
 * 6 6 6 6 6
 */
int main() {
	//const ll MAX = 10000000000001000;
	ll k;
	cin >> k;
	int n = 50;
	vector <ll> A(n);
	for (int i = 0; i < n; i++) {
		A[i] = n - 1 + k / n;
	}
	k = k % n;
	while (k > 0) {
		int pos = -1;
		ll mn = INF;
		for (int i = 0; i < n; i++) {
			if (mn > A[i]) {
				mn = A[i];
				pos = i;
			}
		}
		for (int i = 0; i < n; i++) {
			if (pos == i) {
				A[i] += n;
			}
			else {
				A[i] -= 1;
			}
		}
		k--;
	}
	cout << n << "\n";
	for (int i = 0; i < n; i++) {
		cout << A[i] << " ";
	}
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
int main()
{
	int n,m,i,j,k;
	double t[100][100];
	while(scanf("%d%d",&n,&m),n)
	{
		double d[101][100]={0};
		for(i=0;i<n;++i)for(d[j=0][i]=1;j<n;++j)scanf("%lf",&t[i][j]);
		for(k=1;k<m;++k)
			for(i=0;i<n;++i)
				for(j=0;j<n;++j)
					d[k][j]=std::max(d[k][j],d[k-1][i]*t[i][j]);
		printf("%.2f\n",*std::max_element(d[m-1],d[m-1]+n));
	}
	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 1e6+ 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL counts[3];
LL num(int n){
	LL ans=0;
	while(n){
		ans+=n/2;
		n/=2;
	}
	return ans;
}

LL nCr(int n,int r){

	return num(n)-num(r)-num(n-r)==0;
}
bool exist[SIZE];
LL solve(){
	cin >> N;
	string s;
	cin >> s;
	REP(i,N){
		A[i]=s[i]-'0';
	}
	N--;
	REP(i,N){
		B[i]=abs(A[i]-A[i+1]);
	}
	REP(i,N){
		counts[B[i]]+=nCr(N-1,i);	
		exist[B[i]]|=1;
	}
	if(counts[1]%2) return 1;
	if(counts[2]%2 and exist[1]==0) return 2;
	return 0;
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;

	REP(i,T){
		DEFAULT;

	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


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

int main(){
	string s, t; cin >> s >> t;
	reverse(s.begin(), s.end());
	reverse(t.begin(), t.end());
	for(int i = 0; i <= (int)s.size() - (int)t.size(); ++i){
		string sub = s.substr(i, t.size());
		bool po = 1;
		for(int j = 0; j < sub.size(); ++j){
			if(sub[j] != '?' && sub[j] != t[j]){
				po = 0;
				break;
			}
		}
		if(po){
			string ans;
			for(int j = 0; j < i; ++j) ans += (s[j] == '?' ? 'a' : s[j]);
			ans += t;
			for(int j = i + t.size(); j < s.size(); ++j) ans += (s[j] == '?' ? 'a' : s[j]);
			reverse(ans.begin(), ans.end());
			cout << ans << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE\n";
	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 FOR(i, r, n) for (int i=(int)(r); i<=(int)(n); i++)
#define all(v) v.begin(), v.end()
#define INF 2147483647
#define INF64 9223372036854775807
#define MOD 1000000007

int main(){

    int D; cin>>D;
    vector<int> c(26);
    rep(i, 26) cin>>c[i];

    vector<int> fuman(26, 0);
    rep(i, D){
        rep(j, 26) fuman[j]+=c[j];
        int t, fuman_max=0;
        rep(j, 26){
            if(fuman_max<fuman[j]){
                t=j;
                fuman_max=fuman[j];
            }
        }
        
        cout<<t+1<<endl;
        fuman[t]=0;
    }

}

Measured memory_bytes: 3636
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

string u;
string v="CODEFESTIVAL2016";
int ret;

int main(void)
{
	cin>>u;
	for(int i=0 ; i<=15 ; i++)
	{
		if(u[i]!=v[i])
		{
			ret++;
		}
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
char c;
while(1){
scanf("%c",&c);
if(c=='\n'){
printf("\n");break;
}
else if('A'<=c&&c<='Z'){
c='a'+c-'A';printf("%c",c);
}
else if('a'<=c&&c<='z'){
c='A'+c-'a';printf("%c",c);
}else{printf("%c",c);}
}
return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000000000;
const int mod = 1000000007;
int test[12345678], cost[12345678];
signed main() {
	vector<int> v; map<string, int> mn;
	int n, m, a, b, cnt = 0, ans = 0; string s, t;
	cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> s;
		if (mn[s] == 0) { mn[s] = 1; ans++; }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19252
'''
Created on 2020/08/28

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M=map(int,pin().split())
  X=list(map(int,pin().split()))
  if N>=M:
    print(0)
    return
  X.sort()
  d=[]
  for i in range(M-1):
    d.append(abs(X[i]-X[i+1]))
  d.sort()
  print(sum(d[:M-N]))
  return 
main()
#解説AC

Measured memory_bytes: 20628
// きさま！ 見ているなッ！

#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;



int main()
{
	ll H, W;
	cin >> H >> W;

	if (H == 1 || W == 1)
	{
		cout << 1 << endl; return 0;
	}

	ll ans = (H / 2)*(W / 2) * 2;

	if (W % 2)
	{
		ans += (H+1) / 2;
	}
	if (H % 2)
	{
		ans += (W+1)/2;
	}
	if (H % 2 && W % 2)
	{
		--ans;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
m = int(input())
sm = m; C = []
for i in range(n):
    C.append(list(map(int, input().split())))
for i in C:
    m += i[0] - i[1]
    if m < 0:
        print(0)
        exit()
    sm = max(m, sm)
print(sm)


Measured memory_bytes: 6716
import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

count = 0
for i in range(len(A)):
    minj = i
    for j in range(i, len(A)):
        if int(A[j]) < int(A[minj]):
            minj = j
    if i != minj:
        a = A[i]
        b = A[minj]
        A[i] = b
        A[minj] = a
        count += 1

print " ".join(A)
print count

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

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


Measured memory_bytes: 3636
package main

import "fmt"

func main() {
	var b string
	fmt.Scan(&b)

	switch b {
	case "A":
		fmt.Println("T")
	case "T":
		fmt.Println("A")
	case "C":
		fmt.Println("G")
	case "G":
		fmt.Println("C")
	}
}

Measured memory_bytes: 512
#pragma GCC optimze("Ofast")
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define vp(x,y) vector< pair<x,y> >
#define mp make_pair
#define all(x) x.begin(),x.end()
#define Sort(x) sort(all(x));
#define DSort(x) sort(all(x), greater<>());
#define l_b lower_bound
#define u_b upper_bound
#define u_set unordered_set
#define u_map unordered_map
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)

const ll M=1e9+7;
const ld PI=3.14159265;
using namespace std;

int main(){
    fast_io;
    ll n;
    cin>>n;
    if(n>=30) cout<<"Yes";
    else cout<<"No";
}



Measured memory_bytes: 3644
#include <stdio.h>
#include <iostream>
using namespace std;
int main(void){
  int a,b;
  int ans = 0;
  cin >> a;
  cin >> b;
  int like[a][b];
  int hu[a];
  for(int i = 0;i < a; i++){
    cin >> hu[i];
    for(int s = 0;s < hu[i];s++){
      cin >> like[i][s];
    }
  }
  int ma[b] = {};
  for(int i = 0;i < a; i++){
    for(int s = 0;s < hu[i];s++){
      ma[like[i][s]-1] += 1;
    }
  }
  for(int i = 0;i < b;i++){
    if(ma[i] == a)
      ans++;
  }

  cout << ans << endl;
}


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

int main(){
	ll n;
	cin >> n;
	vector<int> a(n+1);
	rep(j, n+1){
		int n0 = j;
		for(int i=2; i*i<=n0; i++){
			while(n0%i == 0 && n0/i != 1){
				a.at(i)++;
				n0 /= i;
			}
		}
		a.at(n0)++;
	}
	vector<int> n3(0);
	rep(i, n+1){
		if(a.at(i) >= 2){
			n3.push_back(a.at(i));
		}
	}
	ll ans = 0;
	rep(i, n3.size()){
		for(int j=0; j<n3.size()-1; j++){
			for(int l=j+1; l<n3.size(); l++){
				if(i == j || i == l) continue;
				if(n3.at(j) < 4 || n3.at(l) < 4) continue;
				ans++;
			}
		}
		if(n3.at(i) >= 24){
			for(int j=0; j<n3.size(); j++){
				if(i == j) continue;
				ans++;
			}
		}
		if(n3.at(i) >= 14){
			for(int j=0; j<n3.size(); j++){
				if(i == j) continue;
				if(n3.at(j) < 4) continue;
				ans++;
			}
		}
		if(n3.at(i) >= 74) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int iRangeX;
	int iRangeY;
	int iCercleX;
	int iCercleY;
	int radius;

	scanf("%d %d %d %d %d",&iRangeX,&iRangeY,&iCercleX,&iCercleY,&radius);

	if (radius <= iCercleX && iCercleX <= iRangeX - radius)
	{
		if (radius <= iCercleY && iCercleY <= iRangeY - radius)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;

    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;

    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
    vector<pair<int, int>> vec(n);
    for (int i = 0; i < n; ++i) {
        cin >> vec[i].first;
        vec[i].second = i;
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < n; ++i) {
        cout << vec[i].second + 1 << ' ';
    }
    cout << '\n';
}

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

    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}


Measured memory_bytes: 1664
N = int(input())
E = [[] for _ in [0]*N]
for _ in [0]*(N-1):
    a,b = map(int,input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
V = [0]*N
V[0] = 1
V[-1] = -1
q = [0,N-1]
while q:
    qq = []
    for i in q:
        Vi = V[i]
        for j in E[i]:
            if not V[j]:
                V[j] = Vi
                qq.append(j)
    q = qq
print("Fennec" if sum(V)>0 else "Snuke")

Measured memory_bytes: 22688
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
void solve() {
   ll a,v; cin >> a >> v;
   ll b,w; cin >> b >> w;
   ll t; cin >> t;
   ll dist = abs(a-b);
   ll vw = w-v;
   dist += vw * t;
   if (dist <= 0)cout << "YES" << endl;
   else cout << "NO" << endl;
}
int main() {
   cin.tie(nullptr); ios::sync_with_stdio(false);
   solve();
}

Measured memory_bytes: 3652
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main() {
    string S;
    cin >> S;

    int count0,count1=0;

    for (int i = 0; i < S.size();i++) {
        if (S[i] == '1')count1++;
    }
    count0 = S.size() - count1;

    cout << min(count1,count0)*2;

}

Measured memory_bytes: 512
n, takahashi, aoki = gets.split.map(&:to_i)

graph = Array.new(n + 1) { Array.new }

(n-1).times do
  a, b = gets.split.map(&:to_i)
  graph[a] << b
  graph[b] << a
end

height = Array.new(n + 1, nil)
parent = Array.new(n + 1, nil)

queue = [[aoki, 0]]

while !queue.empty?
  top, h = queue.shift
  height[top] = h

  graph[top].each do |child|
    if height[child] == nil
      queue.push([child, h + 1])
      parent[child] = top
    end
  end
end

t = takahashi
ah = height[aoki]
th = height[takahashi]

while (th - ah) > 2
  t = parent[t]
  ah += 1
  th -= 1
end

# 頂点 t の下にある、最も深い頂点を探す
mx = 0
queue = [t]

while !queue.empty?
  top = queue.shift
  mx = [mx, height[top]].max

  graph[top].each do |child|
    if height[child] > height[top]
      queue.push(child)
    end
  end
end

p mx - 1


Measured memory_bytes: 13180
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/

int st[30];

int main(){

    string s;
    cin >> s;
    int k;
    cin >> k;
    set <string> se;
    for(int i = 0; i < s.size(); i++){
        string s2;
        for(int j = 0; j < 5; j++){
            if(i+j >= s.size()) break;
            s2 += s[i+j];
            se.insert(s2);
            //cout << s2 << endl;
        }
    }
    int cnt = 1;
    for(auto x:se){
        if(cnt == k){
                cout << x;
                return 0;
        }
        cnt++;
    }
}



Measured memory_bytes: 1664
parseInt(x) = parse(Int, x)

function main()
	n,k = map(parseInt, split(readline()))
	h = Array{Int}(n)
	for i in 1:n
		h[i] = parseInt(readline())
	end
	h = sort(h)
	dif = 1000000000
	for i in k:n
		dif = min(h[i]-h[i-k+1], dif)
	end
	print(dif)
end

main()

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
  }

  map<ll, ll> m;
  for (ll i = 0; i < a.size(); ++i) {
    if (m.count(a[i])) m[a[i]]++;
    else m[a[i]] = 1;
  }

  each(i, m) {
    if (i.second > 1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}

Measured memory_bytes: 14336
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
using namespace std;

const double ESP = 1E-9;
double x[300];
double y[300];

int main(){
	int n;
	while(cin >> n && n){
		for(int i = 0; i < n; i++){
			cin >> x[i];
			cin >> y[i];
		}
		int count = 1;
		for(int i = 1; i < n; i++){
			for(int j = 0; j < i; j++){
				double dx = x[j] - x[i];
				double dy = y[j] - y[i];
				double mx = (x[j]+x[i]) / 2;
				double my = (y[j]+y[i]) / 2;
				double dis = sqrt(dx*dx + dy*dy);
				if(dis > 2.0) continue;
				double mdis = dis / 2;
				double dis2 = sqrt(1-mdis*mdis);
				dx /= dis;
				dy /= dis;
				double px[2], py[2];
				px[0] = mx + dis2 * dy;
				px[1] = mx - dis2 * dy;
				py[0] = my - dis2 * dx;
				py[1] = my + dis2 * dx;
				for(int k = 0; k < 2; k++){
					int c = 0;
					for(int l = 0; l < n; l++){
						double dx2 = px[k] - x[l];
						double dy2 = py[k] - y[l];
						double dis3 = dx2 * dx2 + dy2 * dy2;
						if(dis3 < 1 + ESP) c++;
					}
					count = max(count, c);
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 968
#include<iostream>
#include <vector>
// #include "cxx-prettyprint/prettyprint.hpp"
#define MSG(x) std::cout << (x) << std::endl;

using namespace std;

int main() {
    int N, max, now;
    max = 0;
    now = 0;
    std::string S;
    char I = 'I', D = 'D';
    cin >> N >> S;
    for (int i=0; i < N; i++) {
        if (S[i] == I) {
            now++;
        }
        if (S[i] == D) {
            now--;
        }
        if (max <= now) {
            max = now;
        }
    }
    MSG(max);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
const int mod = 1000000007;
int n;
ll a = 1;
char c[10][1000];
int main (){
    int n;
    scanf("%d", &n);
    scanf("%s", c[1]);
    scanf("%s", c[2]);
    int flag;
    bool now;
    int cnt = 1;

    if(c[1][0] == c[2][0]) flag = 1, a = 3, now = 1;
    else a = 6, flag = 2, now = 0;

    for(int i = flag; i < n; ++i) {
        if(now) {
            if(c[1][i] == c[2][i]) {
                a = (a * 2) % mod;
                now = 1;
            }
            else {
                now = 0;
                a = (a * 2) % mod;
                i++;
            }
        }
        else {
            if(c[1][i] == c[2][i]) {
                a = (a * 1) % mod;
                now = 1;
            }
            else {
                now = 0;
                a = (a * 3) % mod;
                i++;
            }

        }
    }
    printf("%lld", a % mod);
}
// 805306368


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

ll n, m;
vector<vector<ll> > adj(100001);
vector<ll> dp, ans;

void dfs1(ll x, ll p) {
	for (ll c : adj[x]) {
		if (c == p) continue;
		dfs1(c, x);
		dp[x] *= dp[c] + 1; dp[x] %= m;
	}
	return;
}

void dfs2(ll x, ll p) {
	ll l = adj[x].size();
	vector<ll> cuml(l+2, 1);
	vector<ll> cumr(l+2, 1);
	for (ll i = 0; i < l; ++i) cuml[i+1] = (cuml[i] * (dp[adj[x][i]] + 1)) % m;
	for (ll i = l-1; i >= 0; --i) cumr[i+1] = (cumr[i+2] * (dp[adj[x][i]] + 1)) % m;
	ll pres_x = dp[x];
	for (ll i = 0; i < l; ++i)
	{
		ll c = adj[x][i];
		if (c == p) continue;
		ll pres_c = dp[c];
		dp[x] = (cuml[i] * cumr[i+2]) % m;
		dp[c] *= dp[x] + 1;
		dp[c] %= m;
		ans[c] = dp[c];
		dfs2(c, x);
		dp[x] = pres_x;
		dp[c] = pres_c;
	}
	return;
}

int main() {
	cin >> n >> m;
	dp.resize(n, 1);
	ans.resize(n, 0);
	for (ll i = 0; i < n-1; ++i)
	{
		ll a, b; cin >> a >> b;
		adj[a-1].push_back(b-1);
		adj[b-1].push_back(a-1);
	}
	dfs1(0, -1);
	ans[0] = dp[0];
	dfs2(0, -1);
	for (ll x : ans) cout << x << "\n";
	return 0;
}

Measured memory_bytes: 23168
n = int(input())
p = list(map(int, input().split()))

i=0
ans=0
while i<n-1:
    if p[i] == i+1 and p[i+1] == i+2:
        p[i],p[i+1] = p[i+1],p[i]
        ans+=1
    elif p[i] == i+1 and p[i+1] != i+2:
        p[i],p[i+1] = p[i+1],p[i]
        ans+=1
    i+=1
if p[n-1] == n and p[n-2]!=n-1:
    ans+=1
print(ans)

Measured memory_bytes: 52460
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

// 最大公約数
fn gcd(a: u128, b: u128) -> u128 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: u128, b: u128) -> u128 {
    a * b / gcd(a, b)
}

fn main() {
	input! {
		n: usize,
		t: [u128; n],
	}

	let mut z = t[0];
	for i in 1..n {
		z = lcm(z, t[i]);
	}
	println!("{}", z);
}



Measured memory_bytes: 2164
import sys,queue,math,copy,itertools,bisect,collections,heapq

def check(x0,y0,p,r):
    for x,y in p:
        if (x-x0)**2 + (y-y0)**2 > r*r + 10 ** (-9):
            return False
    return True


def main():
    eps = 10 ** (-10)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    dist = lambda x1,y1,x2,y2: math.sqrt((x1-x2)**2 + (y1-y2)**2)
    N = NI()
    p = [LI() for _ in range(N)]

    high = 1000
    low = 0

    while high > low + 10 ** (-8):
        mid = (high + low) / 2

        for (x1,y1),(x2,y2) in itertools.combinations(p,2):
            r = dist(x1,y1,x2,y2) / 2
            if r > mid :
                low = mid
                break

            x0 = (x1+x2) / 2
            y0 = (y1+y2) / 2
            h = math.sqrt(mid**2 - r**2)
            if y1 == y2:
                dx = 0
                dy = h
            else:
                d = -(x1-x2) / (y1-y2)
                v = math.sqrt(1+d*d)
                dx = h / v
                dy = h / v * d
            if check(x0+dx,y0+dy,p,mid) or check(x0-dx,y0-dy,p,mid):
                high = mid
                break
        else:
            low = mid

    print(low)


if __name__ == '__main__':
    main()

Measured memory_bytes: 77056
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using P = pair<int,int>;

int main(){
    int h, w, m;
    cin >> h >> w >> m;
    vi hs(h), ws(w);
    set<P> s;
    rep(i,m){
        int r, c;
        cin >> r >> c;
        --r, --c;
        hs[r]++;
        ws[c]++;
        s.emplace(r,c);
    }
    int mh = 0, mw = 0;
    rep(i,h) mh = max(mh,hs[i]);
    rep(j,w) mw = max(mw,ws[j]);
    vi is, js;
    rep(i,h) if (hs[i] == mh) is.push_back(i);
    rep(j,w) if (ws[j] == mw) js.push_back(j);
    int ans = mh+mw;
    for (int i : is) for (int j : js){
        if (s.count(P(i,j))) continue;
        cout << ans << endl;
        return 0;
    }
    ans--;
    cout << ans << endl;
}

Measured memory_bytes: 23788
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let mut a = read_as_vec::<u64>();

    a.sort();

    println!("{}", *a.last().unwrap() - *a.first().unwrap());
 }


Measured memory_bytes: 4352
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

//                 0 1   2   3
//                 L  D   U  R
const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX_W 4000
#define MAX_H 4000
#define INF 1000000000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

int H, W;
bool S[MAX_H][MAX_W];
int memo[MAX_H][MAX_W][8];

// L: 0
// D: 1
// U: 2
// R: 3
int dfs(int i, int j, int d)
{
  // 壁の場合ゼロを返す
  if (!S[i][j]) return 0;

  // すでに訪問済みならそれを返す
  if (memo[i][j][d] != INF) {
    return memo[i][j][d];
  }

  // 自分自身を数える
  int sum = 1;
  // ある方向dのすべてのマスを順番に数えていく
  sum += dfs(i + dy[d], j + dx[d], d);
  return memo[i][j][d] = sum;
}

void solve()
{
  // Init
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      for (int k = 0; k < 4; k++) memo[i][j][k] = INF;
    }
  }

  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (!S[i][j]) continue;
      int sum = 0;
      for (int k = 0; k < 4; k++) {
        // 各方向の成分を足す
        sum += dfs(i, j, k);
      }
      // 自分自身を４回数えてるので3減らす
      sum -= 3;
      ans = max(ans, sum);
    }
  }

  cout << ans << endl;
}

int main(void)
{
  cin >> H >> W;
  REP(i, H) REP(j, W)
  {
    char c;
    cin >> c;
    S[i][j] = (c == '.');
  }
  solve();
  return 0;
}


Measured memory_bytes: 260480
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

int n;
vector<vector<P>> G;
vl color;

void dfs(int i, int pre, int pre_c) {
	int cnt = 1;
	for (auto g : G[i]) {
		if (g.first == pre) continue;
		if (cnt == pre_c) {
			cnt++;	//親と同じ色なら変える
		}
		color[g.second] = cnt;
		dfs(g.first, i, color[g.second]);
		cnt++;		//次の辺も異なる色
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	cin >> n;
	G.resize(n);
	color.resize(n - 1);
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back({ b, i });
		G[b].push_back({ a, i });
	}

	int maxc = 0;	//最大の辺
	int start = 0;
	rep(i, n) {
		if (maxc < sz(G[i])) {
			chmax(maxc, sz(G[i]));
			start = i;	//最も辺が多い所から始める
		}
	}
	out(maxc);
	
	dfs(0, -1, -1);
	rep(i, n - 1) {
		out(color[i]);
	}

	return 0;
}

Measured memory_bytes: 9856
import java.util.Scanner;

public class Main {

	char [][] data;
	int black,white,temp;
	char state;

	final int []xdir = {0,1,0,-1};
	final int []ydir = {1,0,-1,0};

	private void solve(int x, int y){
		if(data[y][x] == '*'){
			return;
		}
		if(data[y][x] == 'W'){
			if(state == 'N')
				state = 'W';
			if(state == 'B')
				state = 'D';
			return;
		}
		if(data[y][x] == 'B'){
			if(state == 'N')
				state = 'B';
			if(state == 'W')
				state = 'D';
			return;
		}
		data[y][x] = '*';
		temp++;
		for(int i=0; i < 4; i++)
			solve(x + xdir[i], y + ydir[i]);
	}

	private void doIt() {
		Scanner sc = new Scanner(System.in);
		while(true){
			int w = sc.nextInt();
			int h = sc.nextInt();
			if(w == 0 && h == 0){
				break;
			}
			data = new char[h + 2][w + 2];
			black = 0;
			white = 0;
			temp = 0;
			state = 'N';
			for(int i=0; i <= h + 1; i++){
				data[i][0] = '*';
				data[i][w+1] = '*';
			}
			for(int i =0; i <= w + 1; i++){
				data[0][i] = '*';
				data[h+1][i] = '*';
			}
			for(int i=1; i < h + 1; i++){
				String str = sc.next();
				for(int j = 1; j < w + 1; j++){
					data[i][j] = str.charAt(j - 1);
				}
			}

			for(int i=1; i < h + 1; i++){
				for(int j=1; j < w + 1; j++){
					if(data[i][j] == '.'){
						solve(j,i);
						//System.out.println(temp + " " + black + " " + white+ " "+  i + " " + j);
						switch(state){
						case 'B':
							black += temp;
							temp = 0;
							state = 'N';
							break;
						case 'W':
							white += temp;
							temp = 0;
							state = 'N';
							break;
						default:
							temp = 0;
							state = 'N';
						}
					}
				}
			}
			System.out.println(black + " " + white);

			//debug
//			for(int i=0; i <= h + 1; i++){
//				for(int j = 0; j <= w + 1; j++){
//					System.out.print(data[i][j] + " ");
//				}
//				System.out.println("");
//			}
		}

	}

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

}

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

typedef long long ll;

#define F first 
#define S second 
#define PB push_back
#define MP make_pair 
#define rep(i,a,b) for (ll i=a;i<b;i++)
const ll INF = 1LL << 60;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pl;


int main()
{

    int a,b,c;
    cin>>a>>b>>c;
    
    if(a==b && a!=c) {
        cout<<"Yes"<<endl;
    } else if(a==c && a!=b) {
        cout<<"Yes"<<endl;
    } else if(b==c && b!=a) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
    return 0; 
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int temp, i=0;
  int t[101];
  
  while(scanf("%d",&temp)!=EOF)
    {
      if(temp!=0)
	{
	  t[i] = temp;
	  i++;
	}
      else
	{
	  printf("%d\n",t[i-1]);
	  i--;
	}
    }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 998244353;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);//, S(N+1), X(N+1);
    rep(i,N){
        cin >> A[i];
    }
    ll l=0,r=0;
    //ll s = 0;//A[0];
    //ll x = 0;//A[0];
    ll sum = 0;
    ll ans = 0;
    ll cnt = 0;
    //ll r = 1;
    for(ll l=0;l<N;l++){
        while(r < N && ((sum ^ A[r]) == (sum + A[r]))){
            sum ^= A[r];
            r++;
        }
        ans += r-l;
        //if(l == r){
            //r++;
        //}else{
            sum ^= A[l];
        //}
    }
    cout << ans << endl;
    /*
    while(r <= N){
        if(l >= r){
            s += A[r];
            x ^= A[r];
            r++;
            continue;
        }
        if(s == x){
            cnt++;
            //cout << s << endl;
            //if(r > N-1) break;
            s += A[r];
            x ^= A[r];
            r++;
        }else{
            l++;
            r = l+1;
            s = A[l];
            x = A[l];
            ans += cnt;//cnt*(cnt-1)/2 + cnt;
            cnt = 0;
        }
    }*/
    //ans += cnt*(cnt-1)/2 + cnt;
    //cout << ans << endl;
}

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

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

int main() {
    int n;
    cin >> n;
    int c = 0;
    int i = 11;
    while (c < n) {
        if (isprime(i)) {
            cout << i << " ";
            ++c;
        }
        i += 5;
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
mymin :: Int -> Int -> Int
mymin r l
    | r<l = r
    | otherwise = l

main :: IO ()
main = do
    input <- getContents
    let [a, b, c, d, e, f] = map read $ words input
        abcd = mymin (mymin a b) (mymin c d)
        ef = mymin e f
    putStrLn $ show $ a + b + c + d + e + f - abcd - ef
    return ()


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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0, h, w;
    cin >> n >> h >> w;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        ans += (a >= h && b >= w);
    }
    cout << ans;
}


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

int main(){
    
    // 1. 入力情報.
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    
    // 2. クッキーの交換回数を計算.
    function<int(int, int, int, int)> f = [&](int a, int b, int c, int d) {
        if((a & 1) || (b & 1) || (c & 1)) return d;
        int na = b / 2 + c / 2;
        int nb = c / 2 + a / 2;
        int nc = a / 2 + b / 2;
        if(na == a && nb == b && nc == c) return -1;
        return f(na, nb, nc, ++d);
    };
    int ans = f(A, B, C, 0);
    
    // 3. 出力.
    printf("%d\n", ans);
    return 0;
    
}

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

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

    string s = "";

    while (n != 0) {
        int a = n % 26;
        if (a == 0) {
            s.push_back('z');
            n--;
        } else
            s.push_back('a' + a - 1);

        n /= 26;
    }

    reverse(s.begin(), s.end());
    cout << s << endl;

    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,q; cin>>n>>q;
  string s; cin>>s;
  vll sum(n+1);
  irep(i,1,n){
    sum[i]=sum[i-1];
    if(s[i-1]=='A'&&s[i]=='C') sum[i]++;
  }
  rep(i,q){
    ll l,r; cin>>l>>r; l--,r--;
    cout<<sum[r]-sum[l]<<endl;
  }
}


Measured memory_bytes: 1872
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var x = n % 3;
            if (n<3)
            {
                WriteLine(0);
            }
            else if (x == 0)
            {
                WriteLine(n / 3);
            }
            else
            {
                WriteLine(n / 3);
            }
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
k,n = map(int,input().split())
a = list(map(int, input().split()))

root = k
for i in range(n):
    if(i != n-1):
        road = k - (a[i+1] - a[i])
    else:
        road = a[n-1] - a[0]
    if(root > road):
        root = road

print(root)

Measured memory_bytes: 26444
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;




long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n];
    ll num[60];
    ll m=1LL;
    ll ans=0LL;
    memset(num,0,sizeof(num));
    for(int i=0;i<n;i++){
        cin>>a[i];
        m=1;
        for(ll j=0LL;j<60;j++){
            if(a[i]&m)num[j]++;
            m*=2;
        }
    }
    for(ll i=0LL;i<n;i++){
        for(ll j=0LL;j<60;j++){
            if(a[i]&(1LL<<j)){
                ans+=((n-num[j])*((1LL<<j)%mod))%mod;
                ans%=mod;
            }
            else{
                ans+=((num[j])*((1LL<<j)%mod))%mod;
                ans%=mod;
            }
        }
    }
    ans*=modpow(2,mod-2);
    cout <<ans%mod <<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  string s,t,ans = "~";
  cin >> s >> t;

  auto f = [&](int x) {
    string ss = "";
    REP(i,s.size()) {
      if (i >= x && i-x < t.size()) {
        if (s[i] != '?' && s[i] != t[i-x]) return;
        ss.push_back(t[i-x]);
      } else {
        ss.push_back(s[i] == '?' ? 'a' : s[i]);
      }
    }
    ans = min(ans,ss);
  };

  REP(i,s.size() - (t.size()-1)) f(i);
  ans != "~" ? COUT(ans) : COUT("UNRESTORABLE");
  return 0;
}

Measured memory_bytes: 256
A, B, K = map(int, input().split())
Nt = A
Na = B
for i in range(K):
  if i%2==0:
    Nt, Na = Nt//2, Na + (Nt//2)
  else:
    Nt, Na = Nt + (Na//2), Na//2
print(Nt, Na)

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

int main()
{
    int H, N;
    cin >> H >> N;
    int A;
    for (int i = 1; i <= N; i++)
    {
        cin >> A;
        H -= A;
    }
    //cout << "H = " << H << endl;

    if (H <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()

ans = 3*(10**5)+1
right_E = S.count('E')
W_left = 0

for n in range(N):
  _ = S[n]
  if _ == 'E':
    right_E -= 1
    cnt = W_left+right_E
  elif _ == 'W':
    W_left += 1
    cnt = W_left+right_E-1
  ans = min(ans,cnt)

print(ans)

Measured memory_bytes: 3700