akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

#define debug(x) cerr<<#x<<'='<<x<<'\n'

namespace T {
	int l[50000], r[50000];
	int size[50000];
	long long v[50000];
	int root=0, tot=0;
	int merge(int x, int y) {
		if (!x || !y) {
			return x+y;
		}
		if (v[x]<v[y]) {
			swap(x, y);
		}
		r[x]=merge(r[x], y);
		size[x]+=size[y];
		if (size[l[x]]<size[r[x]]) {
			swap(l[x], r[x]);
		}
		return x;
	}
	inline long long top(void) {
		if (!root) {
			return -0x3f3f3f3f;
		} else {
			return v[root];
		}
	}
	inline void pop(void) {
		root=merge(l[root], r[root]);
	}
	inline void insert(long long x) {
		++tot;
		l[tot]=r[tot]=0;
		size[tot]=1;
		v[tot]=x;
		root=merge(root, tot);
	}
}

long long a[66];

int main(void) {

	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		scanf("%lld", a+i);
		T::insert(a[i]);
	}
	long long k=0;
	while (T::top()+k>=n) {
		long long p=T::top()+k;
	//	debug(p);
		T::pop();
		k+=p/n;
	//	debug(k);
		p%=n;
	//	debug(p);
		T::insert(p-k);
	}
//	debug(T::tot);
	cout<<k;
	return 0;
}
/*
50
10000000000000008
10000000000000000
10000000000000233
10000000000000666
10000000000000777
10000000000000888
10000000000000999
10000000000000345
10000000000000000
10000000234000004
10000000003240001
10000000002300003
10000000000000567
10000000000000977
10000000000000891
10000000000012345
10000000000023456
10000000000034567
10000000000045678
10000000000056789
10000000000067891
10000000000078912
10000000000087654
10000000000098765
10000000000019876
10000000000000008
10000000000000000
10000000000000233
10000000000000666
10000000000000777
10000000000000888
10000000000000999
10000000000000345
10000000000000000
10000000234000004
10000000003240001
10000000002300003
10000000000000567
10000000000000977
10000000000000891
10000000000012345
10000000000023456
10000000000034567
10000000000045678
10000000000056789
10000000000067891
10000000000078912
10000000000087654
10000000000098765
10000000000019876

*/

Measured memory_bytes: 1152
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

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

    if(N >= 10){
        cout << R << endl;
    }else{
        cout << R + 100 * (10 - N) << endl;
    }
}

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

int main(){

    int n,A[100];
    int flag = 1;
    int count = 0;

    cin >> n;

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

    while (flag){

        flag = 0;

        for (int j = n - 1; j >= 1; j--){

            if(A[j] < A[j - 1]){

                swap(A[j],A[j - 1]);
                count += 1;
                flag = 1;

            }
        }
    }

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

    cout << count << endl;

    return 0;

}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cerr<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n;cin >> n;
    n %= 10;
    if(n == 3){
        cout << "bon\n";
    }else if(n == 0 || n == 1 || n == 6 || n == 8){
        cout << "pon\n";
    }else{
        cout << "hon\n";
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <math.h>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)

using namespace std;

int main(){
	int n;
	double d;
	cin >> n >> d;
	int count = 0;
	vector<int> x(n), y(n);
	rep(i, 0, n){
		cin >> x.at(i) >> y.at(i);
		double tmp = (double)x.at(i) * (double)x.at(i) + (double)y.at(i)*(double)y.at(i);
		if(sqrt(tmp) <= d){
			count++;
		}
	}
	
	cout << count << endl;
	
}

Measured memory_bytes: 4960
#include <cassert>
#include <cmath>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int x[n], y[n]; for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    int p = abs(x[0] + y[0]) % 2;
    for (int i = 1; i < n; i++) if (p != abs(x[i] + y[i]) % 2) { cout << "-1\n"; return 0; }
    vector<long long> ds;
    for (int i = 31; i >= 0; i--) ds.push_back(1LL << i);
    if (!p) ds.push_back(1);
    cout << ds.size() << endl;
    for (long long d : ds) cout << d << ' ';
    cout << endl;
    for (int i = 0; i < n; i++) {
        long long a = 0, b = 0;
        const int dx[] = { 1, -1, 0, 0 }, dy[] = { 0, 0, 1, -1 };
        char dirs[] = "RLUD";
        for (long long d : ds) {
            for (int j = 0; ; j++) {
                assert (j < 4);
                long long a1 = a + dx[j] * d, b1 = b + dy[j] * d;
                if (abs(a1 - x[i]) + abs(b1 - y[i]) <= d) {
                    a = a1; b = b1;
                    cout << dirs[j];
                    break;
                }
            }
        }
        assert (a == x[i]);
        assert (b == y[i]);
        cout << endl;
    }
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int SIZE=2010;
int L[SIZE][SIZE],R[SIZE][SIZE];
int U[SIZE][SIZE],D[SIZE][SIZE];

signed main()
{
    int H,W; cin>>H>>W;
    vector<string> s(H);
    for(int i=0;i<H;i++){
	cin>>s[i];
    }

    for(int i=0;i<H;i++){
	for(int j=0;j<W;j++){
	    L[i][j]=R[i][j]=-1;
	    U[i][j]=D[i][j]=-1;
	}
    }
    for(int i=0;i<H;i++){
	int cnt=0;
	for(int j=0;j<W;j++){
	    if(s[i][j]=='#') cnt=0;
	    else{
		L[i][j]=cnt;
		cnt++;
	    }
	}
    }
    for(int i=0;i<H;i++){
	int cnt=0;
	for(int j=W-1;j>=0;j--){
	    if(s[i][j]=='#') cnt=0;
	    else{
		R[i][j]=cnt;
		cnt++;
	    }
	}
    }
    for(int j=0;j<W;j++){
	int cnt=0;
	for(int i=0;i<H;i++){
	    if(s[i][j]=='#') cnt=0;
	    else{
		U[i][j]=cnt;
		cnt++;
	    }
	}
    }
    for(int j=0;j<W;j++){
	int cnt=0;
	for(int i=H-1;i>=0;i--){
	    if(s[i][j]=='#') cnt=0;
	    else{
		D[i][j]=cnt;
		cnt++;
	    }
	}
    }

    int ans=0;
    for(int i=0;i<H;i++){
	for(int j=0;j<W;j++){
	    if(s[i][j]=='#') continue;
	    ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]+1);
	}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 130432
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var sum = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray().Sum();
        Console.WriteLine(sum >= 22 ? "bust" : "win");
    }
}

Measured memory_bytes: 13396
'use strict';
(function(stdin) {
  var lines  = stdin.toString().split('\n');
  var result = (function(data) {
    return new Deck().filter(function(v) {
      return this.indexOf(v) === -1;
    },data).join('\n');

    function Deck() {
      var deck = [];
      ['S','H','C','D'].forEach(function(v) { 
        for (var i = 0; i < 13;i++)
          deck.push([v,i + 1].join(' '));
      });
      return deck;
    }
  }(lines.slice(0,lines.shift())
    ));

  if(result.length !== 0) console.log(result);
  
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7648
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cmath>
#include<map>
#include<set>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-9;

typedef long long ll;

#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

string S;
int a,b,c,d;
int main(int argc, char * argv[])
{
    ios::sync_with_stdio(false);
	cin >> S;
	rep(i,S.size()){
		if (S[i]=='S') a++;
		if (S[i]=='N') b++;
		if (S[i]=='W') c++;
		if (S[i]=='E') d++;
	}
	if ((a==0 && b!=0) || (a!=0 && b==0)) cout << "No" << endl;
	else if ((c==0 && d!=0) || (c!=0 && d==0)) cout << "No" << endl;
	else cout << "Yes" << endl;


    return 0;
}




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

public static partial class Program
{
    public static void Main()
    {
        var n = CRL().ToInt();
        CWL(180 * (n - 2));
    }
}

public static partial class Program
{
    //テンプレここから
    public static int Sigma(int n, int next = 1, int val = 0) => next > n ? val : Sigma(n, next + 1, val + next);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int LCM(int a, int b) => a * b / GCD(a, b);
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static readonly int[] Dx = new[] {0, -1, 0, 1};
    public static readonly int[] Dy = new[] {-1, 0, 1, 0};
    public const int Mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToLong();
    public static int ToInt(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    public static string JoinToStr(this IEnumerable<int> array, string sep = "")
        => array.Select(x => x.ToString()).Join(sep);

    //テンプレここまで
}

Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	double ans = 0;
	int N, K; cin >> N >> K;
	FOR(i, 1, N + 1) {
		int res = i;
		int cnt = 0;
		while (res < K) {
			res *= 2;
			cnt++;
		}
		ans += powl((1 / 2.0), cnt)*(1.0 / N);
	}
	cout << setprecision(10) << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

vector<pair<bool, int>> visited;
vector<int> edge[100010];

int main(){
    int n, m;
    cin >> n >> m;
    visited = vector<pair<bool, int>>(n, make_pair(false, -1));
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        edge[a-1].push_back(b-1);
        edge[b-1].push_back(a-1);
    }
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v = que.front(); que.pop();
        for(auto x : edge[v]){
            if(visited[x].first) continue;
            visited[x] = make_pair(true, v);
            que.push(x);
        }
    }

    for(int i = 1; i < n; i++){
        if(!visited[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < n; i++)
        cout << visited[i].second + 1 << endl;
}

Measured memory_bytes: 10600
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int A,B,C,K;
	cin>>A>>B>>C>>K;
	if(K<=A)
	cout<<K*1;
	if(K>A and K<=A+B)
	cout<<A*1+(K-A)*0;
	if(K>A+B and K<=A+B+C)
	cout<<A*1+B*0-(K-A-B)*1;
	return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> p(N);
    for(int i= 0; i < N; i++) {
        cin >> p[i];
    }
    int count = 0;
    for(int i = 0; i < N-1; i++) {
        if(i + 1 == p[i]) {
            count++;
            swap(p[i], p[i+1]);
        }
    }
    if(p[N-1] == N) {
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main( void )
{
	vector <int> T;
	map<int,int> P;

	int ac, no;
	string in;
	while ( 1 )
	{
		cin >> in;
		replace( in.begin(), in.end(), ',', ' ' );
		istringstream is( in );
		is >> no >> ac;
		if ( no == 0 && ac == 0 )
			break;

		P[no] = ac;
		T.push_back( no );
	}

	for ( int i = 0; i < T.size() - 1; i++ )
	{
		for ( int j = i+1; j < T.size(); j++ )
		{
			if ( P[T[i]] < P[T[j]] )
			{
				swap( T[i], T[j] );
			}
		}
	}

	vector <int> R( T.size() );
	for ( int i = 0; i < T.size(); i++ )
	{
		R[i] = i + 1;
	}

	for ( int i = 1; i < T.size(); i++ )
	{
		if ( P[T[i]] == P[T[i-1]] )
			R[i] = R[i-1];
		else if ( R[i-1] - R[i] != 1 )
			R[i] = R[i-1] + 1;
	}

	map <int, int> rank;
	for ( int i = 0; i < T.size(); i++ )
	{
		rank[T[i]] = R[i];
	}

	int team;
	while ( cin >> team )
	{
		cout << rank[team] << endl;
	}

	return 0;
}

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

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    for(int i=0; i<k; i++){
        if(s.at(i) != '1'){
            cout << s.at(i) << endl;
            return 0;
        }
        if(i==k-1){
            cout << '1' << endl;
        }
    }
}

Measured memory_bytes: 3564
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[] s = new int[M];
    for (int i = 0; i < M; i++) {
      int k = scanner.nextInt();
      for (int j = 0; j < k; j++) {
        int ss = scanner.nextInt() - 1;
        s[i] |= (1 << ss);
      }
    }
    int[] p = new int[M];
    for (int i = 0; i < M; i++) p[i] = scanner.nextInt();

    int count = 0;
    for (int i = 0; i < (1 << N); i++) {
      boolean possible = true;
      for (int j = 0; j < M; j++) {
        possible &= Integer.bitCount(s[j] & i) % 2 == p[j];
      }
      if (possible) count++;
    }
    System.out.println(count);
  }
}


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

int n;

int f(vector<int> B, vector<int> T){
    sort(B.begin(), B.end());
    int idx = 0;
    do {
        bool f = true;
        for(int i = 0; i < n; i++){
            if(B[i] == T[i]);
            else{
                f = false;
                break;
            }
        }
        if(f){
            break;
        }
        idx++;
    } while(next_permutation(B.begin(), B.end()));
    
    return idx;
}

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

    cin >> n;
    vector<int> P(n), Q(n), A(n);
    for(int i = 0; i < n; i++){
        cin >> P[i];
    }
    for(int i = 0; i < n; i++){
        cin >> Q[i];
        A[i] = i + 1;
    }

    int ans = abs(f(A, P) - f(A, Q));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int cnt[100100][3];

int main(void){
	int n,i,a,m,ans;
	std::cin >> n >> m;
	for(i=0; i<n; ++i){
		std::cin >> a;
		++cnt[a][0];
		++cnt[a%m][1];
	}
	for(i=1; i<=100000; ++i){
		cnt[i%m][2] += cnt[i][0]/2;
	}
	ans = cnt[0][1]/2;
	for(i=1; i<m; ++i){
		if(cnt[i][1]<cnt[m-i][1]){
			continue;
		}
		if(i==m-i){
			ans += cnt[i][1]/2;
			continue;
		}
		if(cnt[i][1]==cnt[m-i][1] && i>m-i){
			continue;
		}
		ans += cnt[m-i][1]+std::min((cnt[i][1]-cnt[m-i][1])/2,cnt[i][2]);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 4848
//Author- VMAX


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long int
#define YES cout<<"YES"<<"\n";
#define NO cout<<"NO"<<"\n";
#define ld     long double 
#define yes cout<<"yes"<<"\n";
#define no cout<<"no"<<"\n";
#define No cout<<"No"<<"\n";
#define Yes cout<<"Yes"<<"\n";
#define f(i,a) for(i=0;i<a;i++)
#define fo(i,a) for(i=1;i<=a;i++)
#define fa(i,a) for(auto i:a)
#define r(i,a) for(auto i=a.rbegin();i!=a.rend();i++)
#define en cout<<"\n";
#define ull unsigned long long int
#define o(x) cout<<x<<"\n";
#define o1(x) cout<<x<<" ";
#define pb push_back
#define F first
#define in insert
#define mp make_pair
#define S second
#define pre(n) cout<<fixed<<setprecision(n);
#define      gcd(a,b)    __gcd(a,b)
#define bs            binary_search
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
const ll Mod = 998244353;
#define mod 1000000007
#define pi 3.14159265358979323846
#define all(x) x.begin(),x.end()
#define re return 0;
// *#######################################################################################*
/*
ll prf(ll n)
{
    ll c=0,i;
    while(n%2==0)
    {
        n=n/2;
        c++;
    }
    for(i=3;i*i<=n;i++)
    {
        while(n%i==0)
    }
    
    
    
}
*/
//vector<ll>a(26);
int main()
{
     
      

ll a[5],i;
ll p;
 f(i,5)
{
    cin>>a[i];
    if(a[i]==0)
    {
        p=i;
    }
}

o(p+1)

















      
  
     re
}

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

typedef long long ll;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
#define rep(i, n) for(int i = 0; i < n; i++)
#define fogg(i,a,b) for(int i = (a); i <= (b); i++)
#define ford(i,a,b) for(int i = (a); i >= (b); i--)
#define test int t; cin >> t; while(t--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair



int main() {
	
	string s;
	cin >>s;
	int flag=0;
	if(s[2]==s[3]) {
		flag=1;
	}


	if(flag ==1 && s[4]==s[5]) {
		flag=1;
	}
	else {
		flag=0;
	}

	if(flag==1) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a;
  cin>>a;
  int n,w,e,s;
  n=0;
  w=0;
  e=0;
  s=0;
  for(int i=0;i<a.size();i++){
    if(a[i]=='N'){
      n++;
    }
    else if(a[i]=='S'){
      s++;
    }
    else if(a[i]=='E'){
      e++;
    }
    else{
      w++;
    }
  }
  if(n>0){
    n=1;
  }
  if(e>0){
    e=1;
  }
 if(s>0){
    s=1;
  }
  if(w>0){
    w=1;
  }
  if(n==s&&e==w){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
    
    
}

Measured memory_bytes: 256
a = input()
m = len(a)
if m % 2 == 0:
  ind = int(m/2)
else:
  ind = int((m-1)/2)

a1 = a[:ind]
a2 = a[-ind:][::-1]

ans = len(list(filter(lambda x: x[0] != x[1], zip(a1, a2))))

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
// #include<unordered_map> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include "boost/algorithm/string.hpp"
#define fio ios_base::sync_with_stdio(false)
#define mod 1000000007
#define mod1 mod
#define mod2 100000009
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 1000000000000000000
#define MINN -1000000000000000000
#define pii pair<ll,ll> 
#define pdd pair<double,double>
#define pic pair<int,char>
#define N 200100
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 3.1415926535
#define lgn 20


// #define INTMAX 200000000

// using namespace boost;
// #define si short int

using namespace std;
using namespace __gnu_pbds;             
// typedef priority_queue<ll, vector<ll> > max_pq;
// typedef priority_queue<pii, vector<pii> , greater<pii >  > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}

// typedef priority_queue<pair < ll , pair < pii , ll > >  , vector<pair < ll , pair < pii , ll > >  > ,greater<pair < ll , pair < pii , ll > >  > > min_pq;

typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
typedef priority_queue< pii , vector<pii> > max_pq;
typedef priority_queue<pii, vector<pii> , greater <pii>  > min_pq;

set < ll > s;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    for ( ll i = 1; i <= n ; i ++)
    {
        ll p;
        cin >> p;
        if ( s.find(p)!=s.end() )
            s.erase(p);
        else
            s.insert(p);
    }
    cout << s.size();













}                       

Measured memory_bytes: 4992
#include<stdio.h>
int main(void)
{
int S,s,h,m;
scanf("%d",&S);
h=0;
s=S;
m=0;
if(s>=60){
s=S%60;
S=S-s;
m=S/60;
S=m;
}
if(S>=60){
m=S%60;
S=S-m;
h=S/60;
}
printf("%d:%d:%d\n",h,m,s);
return 0;
} 

Measured memory_bytes: 592
x, k, d = map(int, input().split())

x = abs(x)
# 絶対値が最小になる場所
# つまり x から 0 に向かう
# 移動距離(dマス * k回) >= 0 以上であればそれが答え 
#  x - k*d  が答え
#  Python では問題ながい、型付の言語ではオーバフローを注意する必要あり
#  ストレートにやるといかになるが k*d がオーバフローするため式を変形させる
#  x - k*d = 0 -> x >= k*d -> x/k >= d -> d <= x/k
# if (x - k*d) >= 0:
if d <= x/k:
    print(x -k*d)
    exit()

# 1. そうでない場合は、一旦 0 に近いところまでの回数を計算する（つまり x/d回）
#    また、0に近い位置とは x/d のあまり（x%d）になる
# 2. 元の回数から1.の回数を引いた値が偶数の場合往復ができるため実質0
# 3. 2.と同様に奇数の場合 1. の位置から d を引いた絶対値が答えになる 
p = x%d
rem = k - x//d
if rem%2 == 0:
   print(p)
else:
    print(abs(p -d))


Measured memory_bytes: 9000
n=int(input())

class Point:
    def __init__(self,x,y):
        self.x=x
        self.y=y


points=[]

for i in range(n):
    x,y=[int(i) for i in input().split()]
    points.append(Point(x+y,x-y))

min_x=100000000000
max_x=-100000000000
min_y=100000000000
max_y=-100000000000

for point in points:
    if point.x<min_x:
        min_x=point.x
    if point.x>max_x:
        max_x=point.x
    if point.y<min_y:
        min_y=point.y
    if point.y>max_y:
        max_y=point.y

x_abs=max_x-min_x
y_abs=max_y-min_y
print(max(x_abs,y_abs))

Measured memory_bytes: 105388
w, h, n = map(int, input().split())
xya = [list(map(int, input().split())) for _ in range(n)]
xwyh = [0, w, 0, h]

for i in range(n):
    x = xya[i][0]
    y = xya[i][1]
    a = xya[i][2]
    if a == 1:
        xwyh[0] = max(x, xwyh[0])
    if a == 2:
        xwyh[1] = min(x, xwyh[1])
    if a == 3:
        xwyh[2] = max(y, xwyh[2])
    if a == 4:
        xwyh[3] = min(y, xwyh[3])

dw = max(xwyh[1] - xwyh[0], 0)
dh = max(xwyh[3] - xwyh[2], 0)

print(dw * dh)

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

const int INF = 1001001001;
int dp[1000005][2];

int main(){
	string s;
	cin >> s;
  
  	reverse(s.begin(), s.end());
  	s += '0';
  	int n = s.size();
  	rep(i, n + 1) rep(j, 2) dp[i][j] = INF;
  	dp[0][0] = 0;
  	
  	rep(i, n) rep(j, 2){
    	int x = s[i] - '0';
      	x += j;
      	rep(a, 10){
        	int ni = i + 1, nj = 0;
          	int b = a - x;
          	if(b < 0){
            	nj = 1;
              	b += 10;
            }
            dp[ni][nj] = min(dp[ni][nj], dp[i][j] + a + b);
        }
    }
  
	int ans = dp[n][0];
 	cout << ans << endl;
}

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105,M=18,p=998244353,inf=0x3f3f3f3f;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,ga[1<<(M+1)];
int *g[M+1];
bitset<N> bit[N];
unordered_map<bitset<N>,int> h[N];
void check(int &x,int y){x=(x+y<p) ? (x+y) : (x+y-p);}
int pl(int x,int y){return (x+y<p) ? (x+y) : (x+y-p);}
char ch[N];
void reset(){
	n=100;
	for (int i=0;i<=M;i++) g[i]=ga+(1<<i);
	for (int i=1;i<n;i++)
	for (int j=0;j<i;j++) bit[i][j]=1;
	n=0;
}
int calc(int n,bitset<N> a){
	if (n<=M){
		int t=0;
		for (int i=0;i<n;i++)
		if (a[i]) t+=1<<i;
		return g[n][t];
	}
	if (h[n].count(a)) return h[n][a];
	int ans=calc(n-1,a>>1)*(1+a[0])%p;
	bitset<N> cur,res;
	for (int d=1;d*2<=n;d++){
		cur=a&bit[d];res=a>>d;int l=n-d;
		while (l>=d){
			l-=d;
			cur&=res;res>>=d;
			check(ans,(ll)calc(d,cur)*calc(l,res)%p);
		}
	}
	return h[n][a]=ans;
}
int main(){
	reset();
	g[0][0]=1;
	for (int i=1;i<=M;i++)
	for (int k=0;k<(1<<i);k++){
		check(g[i][k],g[i-1][k>>1]*((k&1)+1)%p);
		for (int d=1;d*2<=i;d++){
			int cur=k&((1<<d)-1),res=k>>d,l=i-d;
			while (l>=d){
				l-=d;
				cur&=res;res>>=d;
				check(g[i][k],(ll)g[d][cur]*g[l][res]%p);
			}
		}
	}
	
	scanf("%s",ch);
	n=strlen(ch);
	
	bitset<N> t;t.reset();
	for (int i=0;i<n;i++) t[i]=(ch[i]=='1');
	printf("%d\n",calc(n,t));
	return 0;
}

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

int main() {
 int N;
 cin >> N;
 vector<int> A(N);
 for(int i = 0; i < N; i++){
     cin >> A.at(i);
 }
 sort(A.begin(), A.end());
 reverse(A.begin(), A.end());

 int count = 0;
 for(int i = 0; i < N-1; i++){
    if(A.at(i) > A.at(i+1)){
        count++;
    }
 }
 cout << count+1;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 5;

void solve(){
    int n; cin>>n;
    vi v(n+1);
    vi ind;
    for(int i = 1; i <= n; i++){
        cin>>v[i];
        if(v[i]!=i) ind.pb(i);
    }
    if(ind.size()==0) {
        cout<<"YES";
        return;
    }
    else if(ind.size()!=2){
        cout<<"NO";
        return;
    }
    if(ind[0]==v[ind[1]] && ind[1]==v[ind[0]]){
        cout<<"YES";
    }
    else cout<<"NO";
    
    
}
int main(){
    int T=1;        //! COMMENT IF THERE IS NO TEST CASES
    //cin>>T;             
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    char c;
    cin >> n;
    while (n--) {
        cin >> c;
        if (c == 'Y') {
            cout << "Four";
            return 0;
        }
    }
    cout << "Three";
}


Measured memory_bytes: 256
#include<cstdio>
#define MAX 10000
#define NIL -1

struct Node{int parent,left ,right;};

Node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int u,int d){
	if(u==NIL)return;
	D[u]=d;
	setDepth(T[u].left,d+1);
	setDepth(T[u].right,d+1);
}

int setHeight(int u){
	int h1=0,h2=0;
	if(T[u].left!=NIL)
		h1=setHeight(T[u].left)+1;
	if(T[u].right!=NIL)
		h2=setHeight(T[u].right)+1;
	return H[u]=(h1>h2 ? h1:h2);
}

int getSibling(int u){
	if(T[u].parent==NIL)return NIL;
	if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL)
		return T[T[u].parent].left;
	if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL)
		return T[T[u].parent].right;
	
	return NIL;
}
void print(int u){
	printf("node %d: ",u);
	printf("parent = %d, ",T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	int deg=0;
	if(T[u].left!=NIL)deg++;
	if(T[u].right!=NIL)deg++;
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	
	if(T[u].parent==NIL){
		printf("root\n");
	}
	else if(T[u].left==NIL && T[u].right==NIL){
		printf("leaf\n");
	}
	else{
		printf("internal node\n");
	}
}

int main(){
	int v,l,r,root=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)T[i].parent=NIL;
	
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&v,&l,&r);
		T[v].left=l;
		T[v].right=r;
		if(l!=NIL)T[l].parent=v;
		if(r!=NIL)T[r].parent=v;
	}
	for(int i=0;i<n;i++)if(T[i].parent==NIL)root=i;
	
	setDepth(root,0);
	setHeight(root);
	
	for(int i=0;i<n;i++)print(i);
	
	return 0;
}


Measured memory_bytes: 2768
a = gets.chomp
m = a[0..1].to_i
n = a[2..3].to_i

x = (1 <= m && m <= 12)? 2:0
y = (1 <= n && n <= 12)? 1:0
w = %w(NA YYMM MMYY AMBIGUOUS)
puts w[x+y]

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

typedef long long ll;
typedef pair<ll, ll> P;
using Graph = vector<vector<int>>;

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const int int_inf = 100000000;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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; }

struct Edge {
    int to;     // 辺の行き先
    int cost; // 辺の重み
    Edge(int t, int c) : to(t), cost(c) { }
};

vector<ll> dijkstra(vector<vector<Edge>> &g, int s) {
    vector<ll> dist(g.size(), inf);

    using Pli = pair<ll, int>;
    priority_queue< Pli, vector<Pli>, greater<Pli> > que;
    dist[s] = 0;
    que.emplace(dist[s], s);

    while (!que.empty()) {
        ll cost;
        int idx;
        tie(cost, idx) = que.top();
        que.pop();
        if (dist[idx] < cost) continue;

        for (auto &e: g[idx]) {
            auto next_cost = cost + e.cost;
            if (dist[e.to] <= next_cost) continue;
            dist[e.to] = next_cost;
            que.emplace(dist[e.to], e.to);
        }
    }
    return dist;
}

int main()
{   
    int n;
    cin >> n;
    vector<vector<Edge>> G(n);

    int a, b, c;
    for (int i = 0; i < n-1; i++) {
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back(Edge(b, c));
        G[b].push_back(Edge(a, c));
    }

    int q, k, x, y;
    cin >> q >> k;
    k--;
    vector<ll> cost = dijkstra(G, k);
    
    for (int i = 0; i < q; i++) {
        cin >> x >> y;
        cout << cost[x-1] + cost[y-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 9460
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int ans = 0;
    ans += min(a,k);
    k -= ans;
    k -= b;
    if(k<=0){
        cout<<ans;
    }else{
        ans-=k;
        cout<<ans;
    }

    return 0;
}


Measured memory_bytes: 3628
K = int(input())

if K % 2 == 0 or K % 5 == 0:
  print(-1)
else:
  ans = 1
  t = 0
  while True:
    t = (10 * t + 7) % K
    if t == 0:
      print(ans)
      break
    ans += 1

Measured memory_bytes: 9164
#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}


 
int main()
{
  _FI 
  int n;
  cin>>n;
  int d;
  cin>>d;
  int count=0;
    d=d*1.0;
  
  for(int i=0;i<n;i++)
  {
    int x,y;
    cin>>x>>y;
    double dist= sqrt( (1l*x*x) + (1l*y*y));
    cerr<<"The dist is: "<<dist<<endl;
    if(dist<=d)
    {
      count++;
    }
  }
  cout<<count<<endl;

  return 0;
}















Measured memory_bytes: 4532
#include<bits/stdc++.h>
int main(){
    const int RMAX = 100000;
    std::array<bool, RMAX> prime;
    for(int i = 0; i <= RMAX; i++){
        prime[i] = true;
    }
    prime[0] = prime[1] = false;
    for(int i = 2; i < RMAX; i++){
        if(!prime[i])
            continue;
        for(int j = 2*i; j < RMAX; j += i){
            prime[j] = false;
        }
    }
    
    for(int i = RMAX - 1; i >= 3; i -= 2){
        if(!prime[(i + 1)/2])
            prime[i] = false;
    }
    
    std::vector<int> primeIdx;
    for(int i = 3; i < RMAX; i++){
        if(prime[i])
            primeIdx.push_back(i);
    }
    int q;
    std::cin >> q;
    for(int i = 0; i < q; i++){
        int l, r;
        std::cin >> l >> r;
        auto lp = std::lower_bound(primeIdx.begin(), primeIdx.end(), l);
        auto rp = std::lower_bound(primeIdx.begin(), primeIdx.end(), r + 1);
        std::cout << rp - lp << std::endl;
    }
    return 0;
}

Measured memory_bytes: 768
package main

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

func main() {
	w := getInt()
	a := getInt()
	b := getInt()

	fmt.Println(max(0, abs(a-b)-w))
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

int main() {
  int N;
  string S, T;

  cin >> N >> S >> T;

  rep(i, N) {
    cout << S[i] << T[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
int main()
{
    int n, q;
    cin >> n >> q;
    fenwick_tree<ll> ft(n);
    for(int i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        ft.add(i, a);
    }
    for(int i = 0; i < q; i++)
    {
        ll t, x, y;
        cin >> t >> x >> y;
        if(t == 0)
        {
            ft.add(x, y);
        }
        else
        {
            cout << ft.sum(x, y) << endl;
        }
    }
}


Measured memory_bytes: 8224
#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>
#define int long long
using namespace std;
const int INF = 10000000000000000;
const int mod = 1000000007;
int test[345678];
signed main() {
	int n, m, a, cnt = 0; cin >> n >> m;
	for (int h = 0; h < n; h++) {
		cin >> test[h]; cnt += test[h];
	}
	sort(test, test + n);
	if (test[n - m] >= (double)cnt / (double)(4 * m)) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a[300];
    int N,i,x=0,y=0,z;
    cin>>N;
    for(i=0;i<N;i++)
    {
        cin>>a[i];
    }
    sort(a,a+N);
    reverse(a,a+N);
    for(i=0;i<N;i++)
    {
        if(i%2==0)
        {
            x=x+a[i];
        }
        else if(i%2==1)
        {
            y=y+a[i];
        }
    }
    z=x-y;
    cout<<z<<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 sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  vector<P> p;
  rep(i,n) {
    int a;
    cin >> a;
    p.push_back({a,i+1});
  } 
  sort(p.begin(),p.end());
  for (auto e : p) {
    cout << e.second << " ";
  }
  cout << endl;
  return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	int k;
	cin >> k;
	cin >> s;
	if((int)s.length() > k){
		for(int i = 0; i < k; i++){
			cout << s[i];
		}
		cout << "..." << endl;
	}else{
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  long N,M,ans;
  cin>>N>>M;
  if(M%2 == 0){
    long x,y;
    x = N/M;
    y = (N*2/M) - (N/M);
    ans = x*x*x + y*y*y;
  }
  else{
    long z;
    z = N/M;
    ans = z*z*z;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int a[N];
vector<int>v;
vector<int>v1;

int p;
int check(int mid)
{
	int sum=0;
	for(int i=0;i<v.size();i++)
	{
		int z=mid/v[i];
		int k=upper_bound(all(v1),z)-v1.begin();
	
		sum+=k;
	}
	return sum>=p;
}
int k;
int check1(int mid)
{
	int sum=0;
	for(int i=0;i<v.size();i++)
	{
		int z=mid/v[i];
		int k1=upper_bound(all(v),z)-v.begin();
		if(k1==v.size()||v[k1]>z)
			k1--;
		sum+=max(0LL,k1-i);
	}
	for(int i=0;i<v1.size();i++)
	{
		int z=mid/v1[i];
		int k1=upper_bound(all(v1),z)-v1.begin();
		if(k1==v1.size()||v1[k1]>z)
			k1--;
		sum+=max(0LL,k1-i);
	}
	return sum>=k;
}
int32_t main()
{
	IOS;
	int n;
	cin>>n>>k;
	vector<int>pos,neg,zero;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i]>0)
			pos.pb(a[i]);
		else if(a[i]==0)
		{
			zero.pb(0);
		}
		else
		{
			neg.pb(a[i]);
		}
	}
	// vector<int>ans1;
	// for(int i=1;i<=n;i++)
	// {
	// 	for(int j=i+1;j<=n;j++)
	// 		ans1.pb(a[i]*a[j]);
	// }
	// sort(all(ans1));
	// cout<<ans1[k-1]<<endl;
	// for(int i=0;i<ans1.size();i++)
	// 	cout<<ans1[i]<<" ";
	// cout<<endl;
	p=pos.size()*neg.size();
	int z=zero.size();	
	sort(all(pos));
	sort(all(neg));
	z=p+z*(pos.size()+neg.size())+z*(z-1)/2;

	if(k<=p)
	{
		p-=k;
		p+=1;
		for(auto it:neg)
			v.pb(-it);
		sort(all(v));
		for(auto it:pos)
			v1.pb(it);
		
		int lo=1;
		int ans;
		int hi=1e18;
		while(hi>=lo)
		{
			int mid=(hi+lo)/2;
			if(check(mid))
			{
				ans=mid;
				hi=mid-1;
			}
			else
				lo=mid+1;
		}
		cout<<-1*ans<<endl;
	}
	else if(k<=z)
	{
		cout<<"0"<<endl;
	}
	else
	{
		k-=z;
		for(auto it:neg)
			v.pb(-it);
		sort(all(v));
		for(auto it:pos)
			v1.pb(it);
		int lo=1;
		int ans;
		int hi=1e18;
		while(hi>=lo)
		{
			int mid=(hi+lo)/2;
			if(check1(mid))
			{
				ans=mid;
				hi=mid-1;
			}
			else
				lo=mid+1;
		}
		cout<<ans<<endl;


	}


	
}

Measured memory_bytes: 6768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N;
    cin >> N;
    if (N==1)cout << "Hello World" << endl;
    else {
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
    }
}

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

typedef pii P;
P f(int x) {
    int b = x%10;
    while (x > 9) x /= 10;
    int a = x;
    return P(a, b);
}

int main(){
    int n;
    cin >> n;
    vector<vi> c(10, vi(10));
    rep1(i, n) {
        P ret = f(i);
        c[ret.first][ret.second]++;
    }
    ll ans = 0;
    rep(i, 10) rep(j, 10) {
        ans += (ll)c[i][j] * c[j][i];
    }
    cout << ans << endl;
    return 0;
}


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

typedef long int lint;
typedef long long int llint;
#define rep(i, f, n) for (int (i) = (f); i < (n); i++)

int main()
{
  string word;
  int page;
  map<string, vector<int> > index;

  while (cin >> word >> page){
    index[word].push_back(page);
  }

  for (map<string, vector<int> >::iterator it = index.begin(); it != index.end(); ++it){
    cout << it->first << endl;
    vector<int>& pages = it->second;
    sort(pages.begin(), pages.end());
    for (int i = 0; i < pages.size(); i++){
      if (i != 0){
        cout << ' ';
      }
      cout << pages[i];
    }
    cout << endl;
  }
}

Measured memory_bytes: 1244
N, M = gets.split.map(&:to_i)
S = gets.strip

(puts -1; exit ) if S =~ /1{#{M}}/
t = N
is = [t]
loop do
  j = t - M
  break if j <= 0
  j += 1 while S[j] == '1'
  is << t = j
end
puts (is.push(0)).reverse.each_cons(2).map{|a, b| b - a}.join(' ')

Measured memory_bytes: 4860
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[3];
    for(int i=0;i<3;i++){
        scanf("%1d",&a[i]);
    }
    if(a[0]==7 ||a[1]==7||a[2]==7){
        cout<<"Yes";
    }
    else cout<<"No";
}


Measured memory_bytes: 3752
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>
#include <queue>

using namespace std;

string s;
int d[111][3][5];

int dp(int pos, int f, int k) {
    if (pos == s.size() && k == 0) {
        return 1;
    }

    if (k < 0 || pos == s.size()) {
        return 0;
    }
    
    if (d[pos][f][k]) {
        return d[pos][f][k];
    }

    int ans = 0;
    int mx = s[pos] - 48;
    if (f == 0) {
        mx = 10;
    }
    for (int i = 1; i < mx; i++) {
        ans += dp(pos + 1, 0, k - 1);
    }
    if (f == 1) {
        if (mx) {
            ans += dp(pos + 1, 1, k - 1);
            ans += dp(pos + 1, 0, k);
        } else {
            ans += dp(pos + 1, 1, k);
        }
    } else {
        ans += dp(pos + 1, 0, k);
    }
    return d[pos][f][k] = ans;
}

void solution() {
    cin >> s;
    int k;
    cin >> k;
    cout << dp(0, 1, k) << endl;
}

/*-------------------*/

int main()
{
#ifdef Files
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    /*Test*/
    //freopen("input.txt", "w", stdout);

    double OcZ2X = clock();
#else
    //freopen("joke.in", "r", stdin);
    //freopen("joke.out", "w", stdout);
#endif

/*
　　     　 　          ∧_,,∧　　　
    　            ♪　  (・ω・)　♪
               ＿＿＿＿○＿＿つヾ＿＿＿＿＿
             /δ⊆・⊇ 。/†: :† /δ ⊆・⊇｡ /|
            |￣￣￣￣￣￣￣￣￣￣￣￣￣ | |
            |　　　*/solution();/* 　　| |
            |　　　　　　　　　　　　　 |
*/

#ifdef Time
    double P2HxQ = clock();
    printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}

Measured memory_bytes: 256