akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll ans=0,n,a[2][110];
void dfs(ll ans0,ll x,ll y){
    ans0+=a[x][y];
    //cout<<x<<" "<<y<<endl;
    if(x==1&&y==n-1){
        ans=max(ans,ans0);
        return;
    }
    if(y<n-1)dfs(ans0,x,y+1);
    if(x==0)dfs(ans0,x+1,y);
}
int main(void){
    // Your code here!
    cin>>n;
    rep(0,i,2)rep(0,j,n)cin>>a[i][j];
    dfs(0,0,0);
    cout<<ans;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

void YNout(bool check){
	if(check)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return;
}

void Yayout(bool check){
	if(check) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	
	return;
}

/*
template <typename T>
void vecout(vector<T>& vecout_vec){
	
	rep(i,0,vecout_vec.size()){
		cout << vecout_vec.at(i) << endl;
	}
	
	return ;
}

template <typename T>
void vecin(vector<T>& vecin_vec, ll n){
	
	ll temp ;
	
	rep(i,0,n){
		cin >> temp;
		vecin_vec.push_back(temp);
		
	}
}

template <typename T>
void in(T& literal_in, T& literal_in2, ...){
	cin >> literal_in;
	in(literal_in2, ...);
	
	return;
}

template <typename T>
void in(T& literal_in){
	
	cin >> literal_in;
	
	return;
}

template <typename T>
void out(T& literal_out, T& literal_out2, ...){
	cout << literal_out << endl;
	out(literal_out2, ...);
	
	return;
}

template <typename T>
void out(T& literal_out){
	
	cout << literal_out << endl;
	
	return;
}
*/
signed main(){
	ll k,n;
	
	cin >> n >> k;
	cout << n-k+1 << endl;
	
	
	
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(input())

if n == 1:
    print(0)
    exit(0)

r_count = 0
g_count = 0
b_count = 0
for idx, c in enumerate(s):
    if c == 'R':
        r_count += 1
    elif c == 'G':
        g_count += 1
    elif c == 'B':
        b_count += 1
# print(r_count, g_count, b_count)

i = 0
removed = 0
while True:
    i += 1
    if i > n // 2:
        break
    for j in range(n):
        if j + i * 2 >= n:
            break
        if s[j] != s[j + i] and s[j + i] != s[j + i * 2] and s[j] != s[j + i * 2]:
            # print(j, j + i, j + i * 2)
            removed += 1
    # print(i, removed)

print(r_count * g_count * b_count - removed)


Measured memory_bytes: 9260
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const int DEBUG = 0;


int gauss_elim(vector<vector<double> > &A,
			  vector<double> &b) {
  int n = A.size();
  int m = A[0].size();
  assert (b.size() == n);
  int c = 0;
  // TODO no pivoting
  REP(i, 0, n) {
    while (c < m && A[i][c] == 0) {
      c++;
    }
    if (c >= m) {
      return i;
    }
    double aic = A[i][c];
    A[i][c] = 1;
    REP(j, c + 1, m) {
      A[i][j] /= aic;
    }
    b[i] /= aic;
    REP(j, 0, n) {
      if (i == j) { continue; }
      double ajc = A[j][c];
      A[j][c] = 0;
      REP(k, c + 1, m) {
	A[j][k] -= ajc * A[i][k];
      }
      b[j] -= ajc * b[i];
    }
  }
  return n;
}


int solve(int d, const vector<double> &v) {
  REP(i, 0, d + 2) {
    vector<vector<double> > A(d + 1, vector<double>(d + 1, 0));
    vector<double> b(d + 1);
    int pos = 0;
    REP(j, 0, d + 2) {
      if (i == j) { continue; }
      // A[pos]
      double pw = 1;
      REP(k, 0, d + 1) {
	A[pos][k] = pw;
	pw *= j;
      }
      b[pos] = v[j];
      pos++;
    }
    int retval = gauss_elim(A, b);
    assert (retval == d + 1);
    double ex_val = 0;
    double pw = 1;
    REP(j, 0, d + 1) {
      ex_val += b[j] * pw;
      pw *= d + 2;
    }
    if (DEBUG) {
      cerr << "ex_val: " << ex_val <<
	"v[" << d + 2 << "]: " << v[d + 2] << endl;
    }
    if (abs(ex_val - v[d + 2]) <= 0.001) {
      return i;
    }
  }
  return d + 2;
}

int main(void){
  int d;
  while ((cin >> d) && d) {
    vector<double> v(d + 3);
    REP(i, 0, d + 3) {
      cin >> v[i];
    }
    cout << solve(d, v) << endl;
  }
}

Measured memory_bytes: 3260
#include <iostream>

using namespace std;

int cubic(int a,int b,int c,int d){
    if(a*b>c*d)return a*b;
    else return c*d;
}

int main(){
    int v,w,x,y;
    cin>>v>>w>>x>>y;

    cout<<cubic(v,w,x,y)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N;
  vector<long long> A;
  cin >> N;
  for(int n=0;n<N;n++){
    long long k;
    cin >> k;
    A.push_back(k-n);
  }
  sort(A.begin(),A.end());
  int b=N/2;
     b=A[b];
  if(N%2==1){
    unsigned long long sum=0;
   for(int n=0;n<N;n++){
   	sum+=abs(A[n]-b);
   }
    cout << sum <<endl;
  }else{
    unsigned long long sum=0;
   for(int n=0;n<N;n++){
   	sum+=abs(A[n]-b);
   }
   unsigned long long min=0;
   b=N/2+1;
   b=A[b];
   for(int n=0;n<N;n++){
   	min+=abs(A[n]-b);
   }
   if(min<sum){
   	cout << min <<endl;
   }else{
   	cout << sum <<endl;
   }
  }
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define INF 100000000000000007
#define int long long
typedef pair<int, int> P;

const int MAX_V = 1000010;

struct edge {
    int to, cost;
};

int V, E, start;
vector<edge> g[MAX_V];
int d[MAX_V];

void dijikstra(int s) {
    fill(d, d + V, INF);
    d[s] = 0;
    priority_queue< P, vector<P>, greater<P> > que;
    que.push(P(0, s));

    while(que.size()) {
        P p = que.top(); // cost, to
        que.pop();

        int v = p.second; // to
        if(d[v] < p.first) continue;

        for(int i = 0; i < g[v].size(); i++) {
            edge e = g[v][i];
            if(d[v] + e.cost < d[e.to]) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

signed main() {
    cin >> V >> E >> start; // 頂点数, 辺数, 起点
    for(int i = 0; i < E; i++) {
        int s;
        edge e;
        cin >> s >> e.to >> e.cost;
        g[s].push_back(e);
    }

    dijikstra(start);

    for(int i = 0; i < V; i++) {
        //cout << i << ": ";
        if(d[i] != INF) cout << d[i] << endl;
        else cout << "INF" << endl;
    }
}


Measured memory_bytes: 40492
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define int long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e6+5;



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


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
using vint = std::vector<int>;
using vvint = std::vector<std::vector<int>>;
using namespace std;
ll mod = 1e9 + 7;


int main(){


    int a, b, c, d; cin >> a >> b >> c >> d;
    if((abs(b - a) <= d && abs(c - b) <= d) || abs(c - a) <= d)cout << "Yes";
    else cout << "No";


    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE LambdaCase #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8

import qualified Data.Char as C
import qualified Data.List as L

main :: IO ()
main = readInts >>= output . solve

solve :: [Int] -> _
solve [1,y] = y==2 || y==4
solve [x,y] = or $ zipWith (\k1 k2 -> (k1*2)+(k2*4)==y) [0..x] (reverse [0..x])

output :: _ -> IO ()
output = \case
  True  -> putStrLn "Yes"
  False -> putStrLn "No"

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine

Measured memory_bytes: 3784
n = int(input())
As = [int(x) for x in input().split()]
As.sort(reverse=True)
mx = As[0]
i = 1
if n%2 == 0:
    for j in range(int((n-2)/2)):
        mx += As[i]*2
        i += 1
else:
    for j in range(int((n-2)/2)):
        mx += As[i]*2
        i += 1
    mx += As[i]
print(mx)

Measured memory_bytes: 31756
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;

int stoti(string s) {
    int res=0;
    rep(i,s.size()) {
        if (s[i]==':') continue;
        else {
            res*=10;
            res+=s[i]-'0';
        }
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);

    while (1) {
        int n;
        cin >> n;
        if (n==0) break;
        vector<P> p;
        rep(i,n) {
            string s,t;
            cin >> s >> t;
            p.push_back(make_pair(stoti(s),1));
            p.push_back(make_pair(stoti(t),-1));
        }
        sort(p.begin(),p.end());
        vector<int> a(2*n+1);
        int ans=0;
        rep(i,2*n) {
            a[i+1]=p[i].second;
            a[i+1]+=a[i];
            ans=max(ans,a[i+1]);
        }
        cout << ans << endl;
    }

    return 0;   
}



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

using namespace std;
int main()
{
    long long n,k;
    cin>>n>>k;
    long long arr[n];
    for (long long  i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    long long sum=n-k;
        unsigned long long sum2=0;
    for (long long i=0;i<sum;i++){
            sum2+=arr[i];
    }
    cout<<sum2<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> vec(4);
  vec[0]=N/1000;
  vec[1]=(N/100)%10;
  vec[2]=(N%100)/10;
  vec[3]=N%10;
  for(int i=0;(1<<3);i++){
    bitset<3> bit(i);
    int ans=vec[0];
    for(int j=0;j<3;j++){
      if(bit.test(j)){
        ans+=vec[j+1];
      }
      else{
        ans-=vec[j+1];
      }
    }
    if(ans==7){
      cout<<vec[0];
      for(int j=0;j<3;j++){
      if(bit.test(j)){
        cout<<"+";
      }
      else{
        cout<<"-";
      }
      cout<<vec[j+1];
      }
      cout<<"=7"<<endl;
      break;
    }
  }
}

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

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int a[1000000] = {0};

signed main(){
    
    int n,x;
    cin >> n >> x;

    cin >> a[0];
    int ans = 0;
    for(int i = 1;i < n;i++){
        cin >> a[i];
        if(a[i] + a[i-1] > x){
            ans += a[i] + a[i-1] - x;
            a[i] -= a[i] + a[i-1] - x;
            if(a[i] < 0 )a[i] = 0;
        }
    }
    cout << ans;


    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
const double pi=acos(-1.0);
int a[N],cnt[N];
using pii = pair<int,int>;
int main()
{
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i = 1;i <= n; ++i) scanf("%d",&a[i]);
    for(int i = 1;i <= n; i += 2) cnt[a[i]]++;
    vector<pii>v1,v2;
    for(int i = 1;i < N; ++i) if(cnt[i]) v1.push_back({cnt[i],i});
    memset(cnt,0,sizeof cnt);
    for(int i = 2;i <= n; i+=2) cnt[a[i]]++;
    for(int i = 1;i < N; ++i) if(cnt[i]) v2.push_back({cnt[i],i});   
    
    int ans = 1e9;
    sort(v1.begin(),v1.end(),greater<pii>());
    sort(v2.begin(),v2.end(),greater<pii>());
    //for(auto &u:v1) cout<<u<<" ";
    //puts("");
   // for(auto &u:v2) cout<<u<<" ";
  //  puts("");
    for(int i = 0;i <= 1&&i<v1.size();++i)
    for(int j = 0;j <= 1&&j<v2.size(); ++j)
    {
        if(v1[i].second!=v2[j].second) ans = min(ans,n-v1[i].first-v2[j].first);
    }
    if(ans==1e9) ans = n/2;
    printf("%d\n",ans);
    return 0;
}
/*

1
1 2
4 4
4 3

*/

Measured memory_bytes: 2168
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int dy=y1-y2;
    int dx=x2-x1;
    cout << x2 + dy << " " << y2 + dx << " " <<x1 + dy << " " << y1 + dx <<"\n";
}


Measured memory_bytes: 256
import sys
import itertools
wether = input()
if not ( wether == 'Sunny' or wether == 'Cloudy' or wether == 'Rainy'): sys.exit()

base = ['Sunny','Cloudy','Rainy']
print(base[base.index(wether)+1]) if wether != base[-1] else print(base[0])

Measured memory_bytes: 8936
#include <stdio.h>
int main(void)
{
    int a, b, i;

    scanf("%d%d", &a, &b);

    if(a<=0 && b>=0){
        printf("Zero\n");
        return 0;
    }

    if(a>0 && b>0) printf("Positive\n");
    else if((a-b+1)%2==0) printf("Positive\n");
    else printf("Negative\n");
    
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
char s[101],t[101];
int main(void)
{
	int n,flag,i,j;
	scanf("%d",&n);
	scanf("%s",s);
	scanf("%s",t);
	FOR(i,0,n+1){
		flag=1;
		FOR(j,i,n){
			if(s[j]!=t[j-i]){
				flag=0;
				break;
			}
		}
		if(flag){
			printf("%d\n",n+i);
			return 0;
		}
	}
	return 0;
}
    
    


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<int> a(3);
	rep(i,3) cin >> a.at(i);
	sort(revall(a));
	int ans = 0;
	if(!(a.at(0) % 2 == a.at(1) % 2 && a.at(1) % 2 == a.at(2) % 2)){
		if(a.at(0) % 2 == a.at(1) % 2){
			a.at(0)++;
			a.at(1)++;
		}
		else if(a.at(1) % 2 == a.at(2) % 2){
			a.at(1)++;
			a.at(2)++;
		}
		else{
			a.at(0)++;
			a.at(2)++;
		}
		ans++;
	}
	ans += (a.at(0) - a.at(1)) / 2 + (a.at(0) - a.at(2)) / 2;
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define M 1046527/* your task*/
#define L 14
char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
	else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

		int h1(int key){ return key % M;}
	int h2(int key){ return 1+(key %(M-1));
	}

int find(char str[]){

    /* your task */
    long long key,i,h;
    key=getKey(str);
    for(i=0;;i++)
    {
    	h=(h1(key)+i*h2(key))%M;
    	if(strcmp(H[h],str)==0)return 1;
    	else if(strlen(H[h])==0)return 0;
    	}
    return 0;
}

int insert(char str[]){

    /* your task */
	long long key, i, h;
	key= getKey(str);
	for(i=0;;i++){
	h=(h1(key)+i*h2(key))%M;
	if(strcmp(H[h],str)==0)return 1;
	else if(strlen(H[h])==0){
		strcpy(H[h],str);
		return 0;
		}
	}
	return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 16052
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int n;
    cin >> n;
    pair<pair<string, int>, int> r[110];
    rep(i,n) {
        string s;
        int id;
        cin >> s >> id;
        r[i] = make_pair(make_pair(s, -id), i);
    }

    sort(r, r+n);
    rep(i,n) {
        cout << r[i].second + 1 << endl;
    }
    return 0;
}


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

int main(){
	int l;
	cin>>l;
	string s;
	cin>>s;

	stack<char> st;
	
	for(int i=0;i<l;i++){
		if(st.empty()){
			st.push(s[i]);
		}
		else if(st.top()!=s[i]){
			st.push(s[i]);
		}
	}
	cout<<st.size()<<endl;
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt(), W = sc.nextInt();
		sc.close();

		if (W >= S)
			System.out.println("unsafe");
		else
			System.out.println("safe");
	}

}


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

namespace AtCoder
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            checked
            {
                var paramsList = Console.ReadLine().Split(' ').ToList();
                // HW
                var H = int.Parse(paramsList[0]);
                var W = int.Parse(paramsList[1]);

                paramsList = Console.ReadLine().Split(' ').ToList();
                // hw
                var h = int.Parse(paramsList[0]);
                var w = int.Parse(paramsList[1]);

                var res = H * W - h * W - (H - h) * w;
                Console.WriteLine(res);
            }
        }
    }

}


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

    using namespace std;

    const int INF=1e9+7;
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        long long n;
        cin>>n;
        vector<long long>h(n);
        for(int i=0;i<n;i++)
            cin>>h[i];
        vector<long long>dp(n,INF);
        dp[0]=0;
        for(long long i=0;i<n;i++){
            for(long long j=i+1;j<=i+2;j++){
                if(j<n)
                    dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
        cout<<dp[n-1];
        return 0;
    }


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	set<int> x;
	REP(i, n) {
		int a;
		cin >> a;
		x.insert(a);
	}
	if (x.size() == n) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, A, B;
  cin >> N >> A >> B;
  vector<pair<long,long>> data(N + 1);
  data.at(0).first = 1;
  long a;
  for(long i = 0; i < N; i++){
    cin >> a;
    for(long j = N - 1; j >= 0; j--){
      if(data.at(j).first >= 1){
        if(data.at(j + 1).second == data.at(j).second + a){
          data.at(j + 1).first += data.at(j).first;
        } else if(data.at(j + 1).second < data.at(j).second + a){
          data.at(j + 1).second = data.at(j).second + a;
          data.at(j + 1).first = data.at(j).first;
        }
      }
    }
  }
  map<double, long> mp;
  for(long i = A; i <= B; i++){
    if(data.at(i).second % i == 0)mp[data.at(i).second / i] += data.at(i).first;
    else mp[data.at(i).second / ((double)i)] += data.at(i).first;
  }
  auto c = mp.end();
  c--;
  cout << setprecision(100) << c->first << endl;
  cout << c->second << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(700000)
from itertools import product

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

h, w, k = l_in()
S = list(map(lambda _: s_in(), range(h)))

sums = [[0 for _ in range(w)] for _ in range(h)]

sums[0][0] = int(S[0][0])

for i in range(1, h):
    sums[i][0] = sums[i-1][0] + int(S[i][0])

for j in range(1, w):
    sums[0][j] = sums[0][j-1] + int(S[0][j])

for i in range(1, h):
    for j in range(1, w):
        sums[i][j] = sums[i][j-1] + sums[i-1][j] - sums[i-1][j-1] + int(S[i][j])

def sq(x1, x2, y1, y2):
    if x1 > 0 and y1 > 0:
        return -sums[x1-1][y2] - sums[x2][y1-1] + sums[x1-1][y1-1] + sums[x2][y2]
    if x1 > 0 and y1 == 0:
        return -sums[x1-1][y2] + sums[x2][y2]
    if x1 == 0 and y1 > 0:
        return -sums[x2][y1-1] + sums[x2][y2]
    if x1 == 0 and y1 == 0:
        return sums[x2][y2]

def exec(i, list):
    current = i
    while current < h:
        exec(current, )

        current += 1

res = h*w

# print(S)
# print(sums)

for ss in product('01', repeat=h-1):
    lis = []
    start = 0
    current = 0
    for s in ss:
        if s == '1':
            lis.append((start, current))
            start = current + 1
        current += 1
    lis.append((start, h-1))

    # print(lis)
    j1 = 0
    cut = 0
    for j2 in range(w-1):
        for i1, i2 in lis:
            if sq(i1, i2, j1, j2) <= k and sq(i1, i2, j1, j2+1) > k:
                # print("cut", j1, j2)
                cut += 1
                j1 = j2+1


    # for i1, i2 in lis:
    #     print(i1,i2,j1,w-1, sq(i1, i2, j1, w-1) <= k)
    # print(j1, all(sq(i1, i2, j1, w-1) <= k for i1, i2 in lis))
    if all(sq(i1, i2, j1, w-1) <= k for i1, i2 in lis):
        cut += 1
        res = min(res, cut-1+len(lis)-1)

print(res)


Measured memory_bytes: 47196
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine((int.Parse(rsa().Aggregate( (s,t) => s + t))) % 4 == 0 ? "YES" : "NO");
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11220
def calc(s, f):
    n = len(s)
    li = []
    t = ""
    for i in range(n):
        t += s[i]
        if f & 1:
            li.append(t)
            t = ""
        f >>= 1
    if t:
        li.append(t)
    return sum(map(int, li))


s = input()
ans = 0
for i in range(1 << (len(s) - 1)):
    ans += calc(s, i)
print(ans)


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

int main(){
  int N;
  cin >> N;
  int A[210];

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

  int count=0;
  bool even=true;

  while(1) {
    for (int i=0; i<N; i++){
      if (A[i]%2==1) {
        even=false;
      }
    }

    if (!even) break;
    for (int i=0; i<N; i++) {
      A[i]/=2;
    }
    count++;
  }
  cout << count << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

  ll n, m;
  cin >> n >> m;
  vector<ll> cnt(m);
  REP(i, n) {
    ll k;
    cin >> k;
    REP(j, k) {
      ll a;
      cin >> a;
      cnt[a-1]++;
    }
  }

  ll ret = 0;
  REP(i, m) if(cnt[i] == n) ret++;
  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int k,a,b; cin >> k >> a >> b;
    rep(i,a,b+1){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

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

using namespace std;

int main(){
    
    int a,b;

    scanf("%d %d", &a, &b);

    int c = a - b;
    int largest = max((a + b), (a * b));
    largest = max(largest, c);

    printf("%d\n", largest);
    return 0;
}

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

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

    if( (s.at(2)==49&&s.at(3)<=50) || (s.at(2)==48&&s.at(3)!=48) ){
        if((s.at(0)==49&&s.at(1)<=50)||(s.at(0)==48&&s.at(1)!=48)) cout<<"AMBIGUOUS"<<endl;
        else cout<<"YYMM"<<endl;
    }

    else if( (s.at(0)==49&&s.at(1)<=50) || (s.at(0)==48&&s.at(1)!=48) ) cout<<"MMYY"<<endl;

    else cout<<"NA"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
ll N, K;

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

	ll ans = 0;
	for(ll l=1; l<=2*N/K; l++){
		if(K%2==1 && l%2==1) continue;
		ll t = (2*N+K*l)/(2*K) - (2+K*l)/(2*K) + 1 - ((2+K*l)%(2*K)==0?0:1);
		ans += t*t;
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
    int n,ans = 0;
    cin >> n;
    vector<int> data(n);
    string s;
    cin >> s;
    for (int i = 0; i < n; i++){
        data.at(i) = s.at(i);
    }
    sort(data.begin(), data.end());//小さい順に並べる
    for (int i = 0; i < n; i++){
        if(data.at(i) != s.at(i)){
            ans ++;
        }
    }
    cout << ans / 2<< endl;
}

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


struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main(){
int H,W,N;

cin>>H>>W>>N;
map <pair<int,int>,int> mp;//考えられる中心の位置を入れていく。このvalueがカウント数
int a[N];
int b[N];
rep(i,N){
    cin>>a[i]>>b[i];
    for(int j=-1;j<2;j++){
        for(int k=-1;k<2;k++){
            mp[pair<int,int>(a[i]+j,b[i]+k)]++;//keyがない時は0が入る
        }
    }
}
ll ans[10]={};
ans[0]=(ll)(H-2)*(ll)(W-2);


for(const auto & e :mp){
if(e.first.first<2 || e.first.first >H-1 || e.first.second <2 || e.first.second>W-1){
    continue;
}
ans[0]--;
ans[e.second]++;
}
for(int j=0;j<10;j++){
cout<<ans[j]<<endl;
}



return 0;
}

Measured memory_bytes: 57344
local mod = 998244353
local mfl = math.floor
local function bmul(x, y)
  local x0, y0 = x % 31596, y % 31596
  local x1, y1 = mfl(x / 31596), mfl(y / 31596)
  return (x1 * y1 * 62863 + (x1 * y0 + x0 * y1) * 31596 + x0 * y0) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function modpow(src, pow)
  local res = 1
  while 0 < pow do
    if pow % 2 == 1 then
      res = bmul(res, src)
      pow = pow - 1
    end
    src = bmul(src, src)
    pow = mfl(pow / 2)
  end
  return res
end

local function modinv(src)
  return modpow(src, mod - 2)
end

local fact = {1}
local invs = {1}
local invfact = {1}
for i = 2, 201000 do
  fact[i] = bmul(fact[i - 1], i)
  invs[i] = bmul(mfl(mod / i), mod - invs[mod % i])
  invfact[i] = bmul(invfact[i - 1], invs[i])
end

local function getComb(n, k)
  if k == 0 or k == n then return 1 end
  return bmul(fact[n], bmul(invfact[k], invfact[n - k]))
end

local ret = 0
local n, m, k = io.read("*n", "*n", "*n")
if m == 1 then
  if k == n - 1 then
    print(1)
  else
    print(0)
  end
  os.exit()
end
for i = 0, k do
  local sep_num = n - 1 - i
  local rem = i--n - sep_num - 1
  local comb = getComb(sep_num + rem, rem)
  local mul = 1
  mul = bmul(m, modpow(m - 1, n - 1 - i))
  ret = badd(ret, bmul(mul, comb))
end
print(ret)


Measured memory_bytes: 9208
package main

import (
	"fmt"
)

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)
	d := []int{}
	for i := 1; i <= 100; i++ {
		if a%i != 0 {
			continue
		}
		if b%i != 0 {
			continue
		}
		d = append(d, i)
	}
	fmt.Println(d[len(d)-k])
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    cin >> s;
    int n = s.length(), k;
    cin >> k;

    ll dp[n+1][4][2]; // {idx, kをいくら消費したか？, s未満確定？}
    fill_n(dp[0][0], (n+1)*4*2, 0LL);
    if(s[0] != '0') {
        dp[0][1][1] += int(s[0]-'0')-1;
        dp[0][1][0] = 1;
        dp[0][0][1] = 1;
    } else {
        dp[0][0][0] = 1;
    }

    for(int i=1;i<n;++i) {
        for(int j=0;j<=k;++j) {
            // 1-9
            if(j < k) {
                dp[i][j+1][1] += 9*dp[i-1][j][1];
                if(s[i] != '0') {
                    dp[i][j+1][1] += (int(s[i]-'0')-1) * dp[i-1][j][0];
                    dp[i][j+1][0] += dp[i-1][j][0];
                }
            }
            // 0
            dp[i][j][1] += dp[i-1][j][1];
            if(s[i] != '0') {
                dp[i][j][1] += dp[i-1][j][0];
            } else {
                dp[i][j][0] += dp[i-1][j][0];
            }
            // cerr << i << "," << j << ": " << dp[i][j][0] << " " << dp[i][j][1] << endl;
        }
    }

    cout << dp[n-1][k][0]+dp[n-1][k][1] << endl;
}


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

int main() {
	int input=0;
	int n,m,i,cnt;
	int finish=0;

	scanf("%d",&input);
	
	while(finish==0){
	cnt=0;
	i=0;
	for(m=2;i==0;m++){
		n = input-((m-1)*m/2);
		if(n<m){i=1;}
		else if(n%m==0){cnt+=1;}
	}
	
	printf("%d\n",cnt);
	
	scanf("%d",&input);
	if(input==0){finish=1;}
	}
	return 0;
}

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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define sp printf(" ")
#define nl printf("\n")

typedef long long int lld;
typedef long double ldb;
int n, k;

int dfs(int i, int op){
    if(op == 0) return i;
    return min(dfs(i+k,op-1),dfs(i*2,op-1));
}

main(){
    cin >> n >> k;
    cout << dfs(1, n) << endl;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n = 3;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	int x = 0,y = 0;
	rep(i,n) x^=a[i];
	rep(i,n) if(x==a[i])y++;
	if(y==1) print("Yes");
	else print("No"); 
	return 0;
}


Measured memory_bytes: 256
N = int(input())
s = list(map(int,input().strip().split(" ")))
s.append(0)
c = [-1 for _ in range(N + 1)]
c[0] = 0
for i in range(N -1):
  if c[i+1] == -1 or c[i] + abs(s[i] - s[i + 1]) < c[i + 1]:
    c[i + 1] = c[i] + abs(s[i] - s[i + 1])
  if c[i+2] == -1 or c[i] + abs(s[i] - s[i + 2]) < c[i + 2]:
    c[i + 2] = c[i] + abs(s[i] - s[i +2])
print(c[N -1])

Measured memory_bytes: 13928
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, h, w;

string s[30];

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

void print() {
	REP(i, h) {
		REP(j, w) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
}

bool solve() {
	bool F = 1;
	string table[30];
	REP(i, h)table[i] = s[i];
	REP(j, w) {
		string t = "";
		for (int i = h - 1; i >= 0; i--) {
			if (table[i][j] != '.')t += table[i][j];
		}
		for (int i = h - 1; i >= 0; i--) {
			if (h - 1 - i < t.size())table[i][j] = t[h - 1 - i];
			else table[i][j] = '.';
		}
	}
	while (F) {
		bool f[30][30] = {};
		REP(i, h) {
			REP(j, w) {
				char c = table[i][j];
				if (c == '.')continue;
				REP(k, 4) {
					bool g = 1;
					REP(l, n) {
						int ny = i + dy[k] * l, nx = j + dx[k] * l;
						if (ny >= 0 && ny < h&&nx >= 0 && nx < w) {
							if (c != table[ny][nx])g = 0;
						}
						else g = 0;
					}
					if (g) {
						REP(l, n) {
							f[i + dy[k] * l][j + dx[k] * l] = 1;
						}
					}
				}
			}
		}

		F = 0;
		REP(i, h) {
			REP(j, w) {
				if (f[i][j]) {
					F = 1;
					table[i][j] = '.';
				}
			}
		}

		REP(j, w) {
			string t = "";
			for (int i = h - 1; i >= 0; i--) {
				if (table[i][j] != '.')t += table[i][j];
			}
			for (int i = h - 1; i >= 0; i--) {
				if (h - 1 - i < t.size())table[i][j] = t[h - 1 - i];
				else table[i][j] = '.';
			}
		}
		//REP(i, h) {
		//	REP(j, w) {
		//		cout << table[i][j] << " ";
		//	}
		//	cout << endl;
		//}
		//cout << endl;
	}
	bool res = 1;
	REP(i, h) {
		REP(j, w) {
			if (table[i][j] != '.')res = 0;
		}
	}
	return res;
}

int main() {
	cin >> h >> w >> n;
	REP(i, h)cin >> s[i];
	bool ok = 0;
	REP(i, h) {
		REP(j, w - 1) {
			swap(s[i][j], s[i][j + 1]);
			//cout << "!" << endl;
			//print();
			//cout << endl;
			ok |= solve();
			//cout << endl;
			swap(s[i][j], s[i][j + 1]);
		}
	}
	REP(i, h - 1) {
		REP(j, w) {
			swap(s[i][j], s[i][j + 1]);
			//cout << "!" << endl;
			//print();
			//cout << endl;
			ok |= solve();
			//cout << endl;
			swap(s[i][j], s[i][j + 1]);
		}
	}
	if (ok)cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

ll sum[202020], X[202020];

int main(){
  int N; cin>>N;
  ll A; cin>>A;
  rep(i,N){
    cin>>X[i];
    sum[i+1]=sum[i]+X[i];
  }
  if(N==1){
    cout<<2*A+X[0]<<endl;
    return 0;
  }
  ll ans=1e17;
  for(int i=1;i<=(N+1)/2;i++){
    ll tmp=(N+i)*A+5*(sum[N]-sum[max(0,N-i*2)]);
    if(tmp<0) continue;
    ll y=7;
    for(int j=N-i*2;j>=1;j-=i){
      tmp+=y*(sum[j]-sum[max(0,j-i)]);
      y+=2;
    }
    if(tmp<0) continue;
    ans=min(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

void sort(int *data, int n);

int main(void)
{
	int data[5];
	int i;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &data[i]);
	}
	
	sort(data, 5);
	
	for (i = 0; i < 5; i++){
		if (i != 0){
			printf(" ");
		}
		printf("%d", data[i]);
	}
	printf("\n");
	
	return (0);
}

void sort(int *data, int n)
{
	int i, j;
	int temp;
	
	for (i = 0; i < n; i++){
		for (j = n - 1; j > i; j--){
			if (data[j] > data[j - 1]){
				temp = data[j];
				data[j] = data[j - 1];
				data[j - 1] = temp;
			}
		}
	}
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<min(a,b)*c+max(0,a-b)*d<<endl;
}






Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	ans := 0
	for i := a; i <= b; i++ {
		arr := intToArray(i)
		if arr[0] == arr[4] && arr[1] == arr[3] {
			ans++
		}
	}
	fmt.Println(ans)
}

func intToArray(num int) []int {
	arr := make([]int, 0)
	for i := 0; num > 0; i++ {
		arr = append(arr, num%10)
		num /= 10
	}
	return arr
}


Measured memory_bytes: 5504
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
	int N;
	int K;
	
	int ans;

	scanf("%d",&N);
	scanf("%d",&K);

	ans = log(N)/log(K) + 1;

	printf("%d\n",ans);

	return 0;
}

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

using namespace std;

int main(){
    long long int N,ans=0;
    cin >> N;
    if(N%2==0){
        for(int i=1;i<N;i++){
            for(int j=i+1;j<=N;j++){
                if(i+j!=1+N){
                    ans++;
                }
            }
        }
    }else{
        for(int i=1;i<N;i++){
            for(int j=i+1;j<=N;j++){
                if(i+j!=N){
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;

    if(N%2==0){
        for(int i=1;i<N;i++){
            for(int j=i+1;j<=N;j++){
                if(i+j!=1+N){
                    cout << i << " " << j << endl;
                }
            }
        }
    }else{
        for(int i=1;i<N;i++){
            for(int j=i+1;j<=N;j++){
                if(i+j!=N){
                    cout << i << " " << j << endl;
                }
            }
        }
    }
    
}

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

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  map<int,int> m;
  for(int i=0;i<n;i++) cin >> v[i];
  for(int i=0;i<n;i++){
    m[i+1]=0;
  }
  for(int i=0;i<n;i++){
    m[v[i]]++;
  }
  for(int i=1;i<=n;i++){
    cout << m[i] << endl;
  }
}


Measured memory_bytes: 13560
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 1e6+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int main()
{
    ll n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m;

    vector<ll> np;

    for(ll i=2;i*i<=n;i++){
        if(!(n%i)){
            np.push_back(i);
            while(!(n%i))n/=i;
        }
    }

    if(n>1)np.push_back(n);
    np.push_back(1);

    for(ll i=2;i*i<=m;i++){
        if(!(m%i)){
            np.push_back(i);
            while(!(m%i))m/=i;
        }
    }

    if(m>1)np.push_back(m);
    np.push_back(1);

    ll res = (ll)np.size();

    sort(np.begin(),np.end());
    np.erase(unique(np.begin(),np.end()),np.end());

    res-=(ll)np.size();

    cout<<res<<"\n";

    return 0;
}


Measured memory_bytes: 256