akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;

ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

bool vector_find(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) {
        return true;
    }
    else {
        return false;
    }
}

vector<string> split(const string& src, const char* delim = ":") {
    vector<string> vec;
    string::size_type len = src.length();
    
    for (string::size_type i = 0, n; i < len; i = n + 1) {
        n = src.find_first_of(delim, i);
        if (n == string::npos) {
            n = len;
        }
        vec.push_back(src.substr(i, n - i));
    }
    
    return vec;
}

bool lengthComp(const std::string& x, const std::string& y) {
    return x.length() < y.length();
}

int main(int argc, char *argv[]){
    ll result = 0;
    ll A, P;
    cin >> A >> P;
    result = (A * 3 + P) / 2;
    
    cout << result << endl;
}


Measured memory_bytes: 256
{-
C++??????????§????
/*
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2104
?????????: Country Road
????????????: ??¶?????¨??¨????????§????????????????¢?????????????????????¢?????????????????????????¶????????????????
??????????????¨: ?§?????????????????????¨?????????Haskell??§????????¨????????????????????¬??????
*/
-}
import Data.List(sort)
import Control.Applicative((<$>))

toInts :: String -> [Int]
toInts = map read . words

main = do
 t <- read <$> getLine
 sequence_ . replicate t $ do
  [n,k] <- toInts <$> getLine
  xs <- toInts <$> getLine
  print . sum . drop (k-1) . reverse . sort . makeDiff $ xs

makeDiff [_] = []
makeDiff (x:y:xs) = (y-x) : makeDiff (y:xs)

Measured memory_bytes: 38904
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	string s;
	cin >> s;
	rep(i, s.size()) {
		cout << "x";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a1=0,a2=0,a4=0,a;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		if(a%4==0)	a4++;
		else if(a%2==0)	a2++;
		else a1++; 
	}
	if(a2==0&&a1<=a4+1){
		printf("Yes\n");return 0;
	}	
	if(a1<=a4&&a2>0){
		printf("Yes\n");return 0;
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    cum_A = [0]*(N+1)
    for i in range(N):
        cum_A[i+1] = cum_A[i] + A[i]

    dp = [[1<<60]*(N+1) for _ in range(N+1)]
    for i in range(N+1):
        dp[i][i] = 0

    for l in range(2, N+1):
        # right = left + len - 1でrightが[0, N - 1]のように
        for left in range(N-l+1):
            right = left + l-1
            #if right>= N: continue
            cost = cum_A[right+1] - cum_A[left]
            for k in range(left, right):
                tmp = dp[left][k] + dp[k+1][right] + cost
                dp[left][right] = min(dp[left][right], tmp)

    return print(dp[0][N-1])

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 42604
import copy

s=input()
l=len(s)
ans=0

if l==1:
  ans+=int(s)
  print(ans)
  
else:
  for i in range(2**(l-1)):
    t=copy.deepcopy(s)
    f=[]
    ch=0
    for j in range(l-1):
      if ((i>>j)&1):
        t=t[:j+1+ch]+'+'+t[j+1+ch:]
        ch+=1
     
    if '+' in t:
      
      y=list(map(int,t.split('+')))
      for u in y:
        ans+=u
    else:
      ans+=int(t)
      
  print(ans)

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

using namespace std;

void doc() {
}

void solve() {
    int kt[4][4];
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) kt[i][j] = 0;
    }
    for (int i = 0; i < 3; i++) {
        int u,v;
        cin >> u >> v;
        u--; v--;
        kt[u][v] = kt[v][u] = 1;
    }
    int p[4];
    for (int i = 0; i < 4; i++) p[i] = i;
    do {
        bool Res = 1;
        for (int i = 0; i < 3; i++) {
            Res &= kt[p[i]][p[i + 1]];
        }
        if (Res) {
            cout << "YES";
            return;
        }
    }
    while (next_permutation(p,p + 4));
    cout << "NO";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    doc();
    solve();
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

        int m = Integer.parseInt(n);
        int a = Character.getNumericValue(n.charAt(0));
        if (a * 111 >= m) {
            System.out.println(a * 111);
        } else {
            System.out.println((a + 1) * 111);
        }
    }
}


Measured memory_bytes: 22612
S = gets.chomp.chars
T = gets.chomp.chars

ss = S.size
ts = T.size
index = nil
(0..(ss - ts)).each do |i|
  s = S[i, ts]
  is_ok = s.zip(T).all? do |_s, _t|
    _s == '?' || _s == _t
  end
  index = i if is_ok
end
unless index
  puts 'UNRESTORABLE'
  exit 0
end
T.each.with_index do |t, i|
  S[index + i] = t
end
ans = S.map do |s|
  s == '?' ? 'a' : s
end.join('')
puts ans


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

int main()
{
	int A,B;
	cin>>A>>B;
	if(A>B)
	{
		if(B==1)
		{
			cout<<"Bob";
		}
		else
		{
		cout<<"Alice";
		}
	}
	else if(B>A)
	{
		if(A==1)
		{
			cout<<"Alice";
		}
		else
		{
		cout<<"Bob";
		}
	}
	else
		cout<<"Draw";
	return 0;
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;

pii dfs(vector<vi>& g, vector<int>& isVisited, int u, int cnt){
    if(isVisited[u] != -1) return {u, cnt};

    isVisited[u]=cnt;
    ++cnt;

    for(auto& v: g[u]){
        return dfs(g, isVisited, v, cnt);
    }
}

void solve(){

    int n;
    cin >> n;
    ll k;
    cin >> k;

    vi a(n, 0);
    vector<vi> g(n);
    rep(i,0,n){
        cin >> a[i];
        g[i].pb(a[i]-1);
    }

    vi isVisited(n, -1);
    pii c = dfs(g, isVisited, 0, 0);

    if(k > 10000000){
        k -= isVisited[c.first];
        k = (k+c.second-isVisited[c.first])%(c.second-isVisited[c.first])+isVisited[c.first];
    }

    int s = 0;
    while(k--){
        s = a[s]-1;
    }

    cout << s+1 << "\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 15916
N = int(input())
A = [int(input()) for i in range(N)]
cnt = {}
for a in A:
   if a in cnt:
      cnt[a] +=1
   else:
      cnt[a] = 1
ans = 0
for value in cnt.values():
   if value % 2:
        ans+=1
print(ans)

Measured memory_bytes: 16268
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int n;
ll a[200010],h[200010],dp[200010],bit[200010];
inline int lowbit(int x){
	return x&(-x);
}
void upd(int x,ll d){
	while(x<=n){
		bit[x]=max(bit[x],d);
		x+=lowbit(x);
	}
}
ll getmax(int x){
	ll ans=0;
	while(x>0){
		ans=max(ans,bit[x]);
		x-=lowbit(x);
	}
	return ans;
}
int main(int argc,char** argv){
	cin>>n;
	forn(i,n){
		cin>>h[i];
	}
	forn(i,n){
		cin>>a[i];
	}
	forn(i,n){
		dp[i]=getmax(h[i]-1)+a[i];
		upd(h[i],dp[i]);
	}
	cout<<getmax(n)<<endl;
	return 0;
}

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

namespace abc057
{
    class Program
    {
        static void Main(string[] args)
        {
            //var line1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = long.Parse(Console.ReadLine());

            int ans = int.MaxValue;
            for (int i = 1; i <= Math.Sqrt(N); i++)
            {
                if (N % i != 0) continue;

                long temp = N / i;
                if ( ans > F(temp,i))
                {
                    ans = F(temp, i);
                }
            }
            Console.WriteLine(ans);
            //Console.ReadKey();
        }

        static int F(long a,long b)
        {
            var ans = Math.Max(a, b);
            return ans.ToString().Length;
        }
    }
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

vector<PLL> G[112345];
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N, M, s, t;
	cin >> N >> M >> s >> t;
	s--; t--;
	REP(i, M){
		int32 a, b, c, d;
		cin >> a >> b >> c >> d; a--; b--; c--;
		G[a].push_back({d, b});
		G[b].push_back({d, a});
		G[a].push_back({d, c});
		G[c].push_back({d, a});
		G[b].push_back({d, c});
		G[c].push_back({d, b});
	}

	vector<int64> d(N+1, INF_LL);
	d[s] = 0;
	priority_queue<PLL, vector<PLL>, greater<PLL>> pq;
	pq.push({0, s});
	while(pq.size()){
		int64 v, dd;
		tie(dd, v) = pq.top(); pq.pop();
		if(dd > d[v]) continue;
		REP(i, G[v].size()){
			if(d[G[v][i].sc] > d[v]+G[v][i].fs){
				d[G[v][i].sc] = d[v]+G[v][i].fs;
				pq.push({d[G[v][i].sc], G[v][i].sc});
			}
		}
	}
	cout << d[t] << endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> p(n + 1, 0);
    rep(i, n) {
        int tmp;
        cin >> tmp;
        p[tmp] = 1;
    }

    int ans_upper = 0, cnt_upper = 0;
    for (int i = x; i <= 10000; i++) {
        if (p[i] != 1) {
            ans_upper = i;
            break;
        }
        cnt_upper++;
    }

    int ans_low = 0, cnt_low = 0;
    for (int i = x; i >= -10000; i--) {
        if (p[i] != 1) {
            ans_low = i;
            break;
        }
        cnt_low++;
    }

    // cout << cnt_low << " " << cnt_upper << endl;
    if (cnt_low <= cnt_upper) {
        cout << ans_low << endl;
    } else {
        cout << ans_upper << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main(){
  int r,D,x;
  int a[11];
  int i;
  
  scanf("%d %d %d",&r,&D,&x);
  a[0]=x;
  for(i=1;i<=10;i++){
    a[i]=r*a[i-1]-D;
    printf("%d\n",a[i]);
  }
  return 0;
}
  

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

const ll mod = 1e9+7;

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n%2 != 0)
      res = res * a % mod;
    a = a * a % mod;
    n /= 2;
  }
  return res;
}

int main() {
  int n; cin >> n;
  vector<ll> a(n); rep(i, n) cin >> a[i];
  vector<ll> m(61);
  rep(i, n) {
    rep(j, 61) {
      m[j] += a[i] % 2;
      a[i] /= 2;
    }
  }
  ll ans = 0;
  rep(i, 61) {
    ans += (m[i] * (n - m[i])) % mod * modpow(2, i, mod);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 30;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> rate(9, 0);
  rep(i, n) {
    if(a[i] < 400) ++rate[0];
    else if(a[i] < 800) ++rate[1];
    else if(a[i] < 1200) ++rate[2];
    else if(a[i] < 1600) ++rate[3];
    else if(a[i] < 2000) ++rate[4];
    else if(a[i] < 2400) ++rate[5];
    else if(a[i] < 2800) ++rate[6];
    else if(a[i] < 3200) ++rate[7];
    else ++rate[8];
  }

  int min = 0;
  rep(i, 8) if(rate[i]) ++min;
  int max = min+rate[8];
  chmax(min, 1);
  cout << min << " " << max << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define repd(i, n) for (ll i = (n)-1; i >= 0; --i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    bool flag = false;
    set<int> st;
    int tmp = a;
    do
    {
        if (tmp % b == c)
            flag = true;
        st.insert(tmp % b), tmp += a;
    } while (st.find(tmp % b) == st.end());
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 3548
import functools
import fractions


N = int(input())
a = list(map(int, input().split()))
A = list(set(a))
ans = [functools.reduce(fractions.gcd, A)]
if len(A) == 1:
    print(A[0])
    exit()
else:
    for i in A:
        b = sorted(A)
        b.remove(i)
        if a.count(i) == 1:
            ans.append(functools.reduce(fractions.gcd, b))
print(max(ans))

Measured memory_bytes: 16156
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define enter "\n"

typedef long long ll;


int dp_a(){
    //入力
    int n;
    cin >> n;
    vector<ll> h;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        h.push_back(tmp);
    }
    ll cntdp[110000];
    
    //処理
    REP(i,n){
        cntdp[i]=-1;
    }
    cntdp[0]=0;
    cntdp[1]=abs(h[1]-h[0]);
    REP(i,n){
        if(cntdp[i]==-1){
            cntdp[i] = min(cntdp[i-1]+abs(h[i]-h[i-1]) , cntdp[i-2]+abs(h[i]-h[i-2]));
        }
    }
    
    //出力
    cout << cntdp[n-1] << enter;
    return 0;
}

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


Measured memory_bytes: 1908
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#define MOD (int)1e9+7
using namespace std;

int main(void){
  int N;
  int A[111111];
  map<int,int> mp;
  cin>>N;
  int a,i;
  for(i=1;i<=N;i++){
    cin>>a;
    if(mp.find(a)==mp.end()) mp[a]=1;
    else mp[a]++;
  }
  int res=1;
  for(auto itr=mp.begin();itr!=mp.end();itr++){

    if((itr->first==0&&itr->second>1)||itr->second>2){
      res=0;
      break;
    }
    if(itr->second==2)res*=2;
    res%=MOD;
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 3200
N, Q = list(map(int, input().split()))
S = input()
pre = [0]*N
for i in range(1, len(S)):
    if S[i] == 'C' and S[i-1] == 'A':
        pre[i] = pre[i-1] + 1
    else:
        pre[i] = pre[i-1]
for q in range(Q):
    l, r = list(map(int, input().split()))
    l-=1
    r-=1
    print(pre[r] - pre[l]) 

Measured memory_bytes: 6188
flag = 1
data = []
query = []
while True:
    try:
        while flag:
            n,s = map(int, raw_input().split(","))
            if n == 0 and s == 0:
                flag = 0
                break
            data.append([s,n])
        query.append(int(raw_input()))
    except:
        break
    
data.sort(); data.reverse()

rank = 0
rslt = {}
mx = 31
for i in data:
    if i[0] < mx:
        rank += 1
        mx = i[0]
    rslt[i[1]] = rank

for i in query:
    print rslt[i]

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

int main(void){
	int A,B;
	cin >> A >> B;
	int ans=0;
	if(A>B){
		ans+=A;
		A-=1;
	}
	else{
		ans+=B;
		B-=1;
	}
	ans+=max(A,B);
	cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int N, ans = 0;
	cin >> N;

	ans = N / 11;
	ans *= 2;

	N %= 11;

	if(N==0){

	}else if(N<=6){
		ans++;
	}else{
		ans += 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N, M, X = map(int, input().split())
books = [list(map(int, input().split())) for _ in range(N)]

default = 10 ** 5 * 12 + 1
min_money = default

for bits in range(1 << N):
    money = 0
    algo = [0] * M
    for i in range(N):
        if bits >> i & 1 == 1:
            money += books[i][0]
            for j in range(M):
                algo[j] += books[i][j + 1]

    if min(algo) >= X:
        min_money = min(min_money, money)

print('-1' if min_money == default else min_money)


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

using namespace std;

int main()
{
   int N,X,T;
   cin>>N>>X>>T;
   int count = 0;
   
   while(true)
   {
       N=N-X;
       count++;
       if(N<=0)
        break;
       
   }
   
   cout<<count*T;

}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long

using namespace std;
ll n,m,k,sum,ans;
const ll mmm=1e9+7;
const int maxn=1e5+5;
ll a[maxn];
ll fix[maxn];
int main()
{
    fix[0]=1;
    fix[1]=1;
    fix[2]=2;
    for(int i=3;i<maxn;i++)
    {
        fix[i]=(fix[i-1]+fix[i-2])%mmm;
    }
    scanf("%lld%lld",&n,&m);
    if(m==0)
    {
        printf("%lld\n",fix[n]);
        return 0;
    }

    for(ll i=1;i<=m;i++)
    {
        scanf("%lld",&a[i]);
    }
    ll sum=1;
    sum=fix[a[1]-1];
    for(ll i=2;i<=m;i++)
    {
        if(a[i]==a[i-1]||(a[i]-a[i-1]-2)==0)
            continue;
        if(a[i]-a[i-1]==1)
        {
            printf("0\n");
            return 0;
        }
        else
        {
            sum=(sum*fix[a[i]-a[i-1]-2])%mmm;
        }
    }
    sum=(sum*fix[n-a[m]-1])%mmm;
    printf("%lld\n",sum);
}

Measured memory_bytes: 1792
import math
l = int(input())

# l -= 1
n = math.floor(math.log2(l)) + 1
edge = []
for i in range(1, n):
    edge.append((i, i+1, 0))
for j, i in enumerate(reversed(range(1, n))):
    edge.append((i, i+1, 2**j))

l2 = l - 2**(n-1)
c = 2**(n-1)
# print("test", c, l2)
while l2 > 0:
    l_mini = 1
    while l_mini * 2 <= l2:
        l_mini *= 2
    # print("test", c, l2, int(math.log2(l_mini)))
    edge.append((1, n-int(math.log2(l_mini)), c))
    l2 -= l_mini
    c += l_mini

print(n, len(edge))
for i in range(len(edge)):
    print(*edge[i])


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

int main(){
  int x,y;
  cin >> x >> y;
  int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  if(a[x] == a[y]) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
//submitted by HimJ
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define be begin
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  int t=1;
 // cin>>t;
    while(t--){
            int n,a,b;
    cin>>n>>a>>b;
    if((abs(b-a))%2)
        cout<<"Borys";
    else
        cout<<"Alice";

  }
  return 0;
  }



Measured memory_bytes: 256
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for(int t,i,c;(t=s.nextInt())>0;){long[]a=new long[t],b=null;for(i=c=0;i<t;++i)a[i]=s.nextInt();for(;!Arrays.equals(a,b);++c){Map<Long,Long>m=new HashMap<Long,Long>();b=a.clone();for(i=0;i<t;m.put(a[i],m.get(a[i++])+1))if(!m.containsKey(a[i]))m.put(a[i],0L);for(i=0;i<t;++i)a[i]=m.get(a[i]);}String r=--c+"\n";for(long j:a)r+=j+" ";System.out.println(r.replaceAll(" $", ""));}}}

Measured memory_bytes: 12000
main=do
    line1<-getLine
    line2<-getLine
    let c1= sum [if z `mod` 2>0 then 1 else 0|z<-[read x ::Int|x<-words line2]]
    let c2= sum [if z`mod`4 >0 && z `mod` 2==0 then 1 else 0|z<-[read x ::Int|x<-words line2]]
    let c4= sum [if z `mod` 4==0 then 1 else 0|z<-[read x ::Int|x<-words line2]]
    solve c1 c2 c4

solve :: Int ->Int ->Int ->IO()
solve c1 0 c4 = if c1<=c4+1 then putStrLn "Yes" else putStrLn "No"
solve c1 _ c4 = if c1<=c4 then putStrLn "Yes" else putStrLn "No"



Measured memory_bytes: 111228
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define sort_v(a) sort(a.begin(), a.end())

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

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

    int ans = 0;
    rep(i, 1, n + 1)
    {
        if (i % 2 == 0)
            continue;
        int cnt = 0;
        rep(j, 1, i + 1)
        {
            if (i % j == 0)
                cnt++;
        }
        if (cnt == 8)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
let m = 2019
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m
let inv10 = 202
let rec power ( * ) e m n =
  if n <= 0 then e
  else power ( * ) (if n land 1 = 0 then e else m * e) (m * m) (n lsr 1)

let () =
  let s = read_line () in
  let n = String.length s in
  let acc = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    acc.(i + 1) <- 10 *^ acc.(i) +^ (Char.code s.[i] - Char.code '0')
  done;
  let a = Array.make 2019 0 in
  Array.iteri (fun i n ->
    let j = power ( *^ ) n inv10 i in
    a.(j) <- 1 + a.(j)) acc;
  Printf.printf "%d\n" @@
  Array.fold_right (fun a -> ( + ) @@ a * (a - 1) / 2) a 0




Measured memory_bytes: 5860
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF() { return std::numeric_limits<T>::max() / 16; }
std::mt19937 mt{std::random_device{}()};
int main()
{
    int N, K;
    std::cin >> N >> K;
    std::vector<ll> a(N);
    for (int i = 0; i < N; i++) { std::cin >> a[i]; }
    std::sort(a.begin(), a.end());
    auto ok = [&](const int ind) {
        std::vector<bool> dp(K + 1, false);
        dp[0] = true;
        for (int i = 0; i < N; i++) {
            if (i == ind) { continue; }
            auto tmp = dp;
            for (int j = 0; j <= K - a[i]; j++) {
                if (dp[j]) {
                    tmp[j + a[i]] = true;
                }
            }
            dp = tmp;
        }
        for (int i = std::max(0LL, K - a[ind]); i < K; i++) {
            if (dp[i]) { return false; }
        }
        return true;
    };
    int inf = -1, sup = N;
    while (sup - inf > 1) {
        const int mid = (inf + sup) / 2;
        (ok(mid) ? inf : sup) = mid;
    }
    std::cout << sup << std::endl;
    return 0;
}


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

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

	int res = 0;
	for (int i = 1; i < N; i++) {
		if (a[i] == a[i - 1]) {
			res++;
			a[i] = 0;
		}
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int progA[] = new int[n];
		int progB[] = new int[n];
		for(int i = 0; i < n; i++) {
			progA[i] = sc.nextInt();
			progB[i] = progA[i];  //progBにもprogAと同じ値を入れておく
		}

		int q = sc.nextInt();

		for(int i = 0; i < q; i++) {
			int b = sc.nextInt();
			int m = sc.nextInt();
			int e = sc.nextInt();
			for(int k = 0; k < e - b; k++) {
				progB[b + ((k + (e - m)) % (e - b))] = progA[b + k];
			}
			for(int k = 0; k < e - b; k++) {
				progA[b + k] = progB[b + k];
			}
		}

		for(int j = 0; j < progB.length; j++) {
			if(j != 0) System.out.print(" ");
			System.out.print(progB[j]);
		}
		System.out.println();
	}

}



Measured memory_bytes: 37868
#include<bits/stdc++.h> 
using namespace std; 
   
int countFreq(string &pat, string &txt) 
{ 
    int M = pat.length(); 
    int N = txt.length(); 
    int res = 0; 
    
    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++) 
    {  
        /* For current index i, check for  
           pattern match */
        int j; 
        for (j = 0; j < M; j++) 
            if (txt[i+j] != pat[j]) 
                break; 
   
        // if pat[0...M-1] = txt[i, i+1, ...i+M-1] 
        if (j == M)   
        { 
           res++; 
           j = 0; 
        } 
    } 
    return res; 
} 
    
/* Driver program to test above function */
int main() 
{ 
int n;
cin>>n;
   string txt;
   cin>>txt; 
   string pat = "ABC"; 
   cout << countFreq(pat, txt)<<endl;; 
   return 0; 
} 

Measured memory_bytes: 256
N = int(input())
s = ["" for _ in range(N)]
for i in range(N):
    s[i] = input()
M = int(input())
t = ["" for _ in range(M)]
for i in range(M):
    t[i] = input()
cost = [1 for i in range(N)]
for i in range(N):
    for j in s[i+1:]:
        if s[i] == j :
            cost[i] += 1
    for j in t:
        if s[i] == j:
            cost[i] -= 1

ans = max(cost)
if ans > 0 :
    print(ans)
else :
    print(0)



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

int main(void){
  int a[200];
  int counter = 0, n;
  bool flag = true;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while(flag) {
    for(int i = 0; i < n; i++) if(a[i] % 2 == 1) flag = false;
    if(flag) {
      for(int i = 0; i < n; i++) a[i] /= 2;
      counter++;
    }
  }
  cout << counter;
}

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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=1e5+5;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	string s; cin >> s;
	int n=s.length();
	bool ok=0;
	for(int i=0; i<n; i++){
		if(s[i]=='1')ok=1;
	}
	if(s[n-1]=='1')ok=0;
	for(int i=0; i<n/2; i++){
		if(s[i]!=s[n-i-2])ok=0;
	}
	if(!ok){
		cout << -1 << endl;
		return 0;
	}
	map<ii,bool>mp;
	int prev = -1;
	for(int i=0; i<n-1; i++){
		mp[{prev,i}]=1;
		if(s[i]=='1')prev=i;
	}
	for(auto x:mp){
		cout << x.fi.fi+2 << ' ' << x.fi.se+2 << endl;
	}
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


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

int main(){
  ll n, m;
  cin >> n >> m;
  vector<bool> a(n+3, false);
  for(ll i=0; i<m; i++){
  	ll tmp;
    cin >> tmp;
    a[tmp] = true;
  }
  vector<int> v(n+3, 0); 
  v[0] = 1;
  for(ll i=0; i<n; i++){
  	if(a[i]) continue;
    if(!a[i+1]) v[i+1] += v[i]%MOD;
    if(!a[i+2]) v[i+2] += v[i]%MOD;
  }
  
  cout << v[n]%MOD << endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
    int N;
    int A[300][300];
    bool flag;
    long long ans = 0;
    cin >> N;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            cin >> A[i][j];
        }
    }

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(A[i][j] != A[j][i]){
                cout << -1 << endl;
                return 0;
            }
            flag = true;
            for(int k=0;k<N;k++){
                if(k == i||k == j) continue;
                if(A[i][j] > A[i][k] + A[k][j]){
                    cout << -1 << endl;
                    return 0;
                }
                if(A[i][j] == A[i][k] + A[k][j]) flag = false;
            }
            if(flag) ans += A[i][j];
        }
    }

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


Measured memory_bytes: 1148
fun main(args: Array<String>) {
    val (n,y) = readLine()!!.split(" ").map(String::toInt)
    for (i in 0..n) {
        if (i * 10000 > y) continue
        for (j in 0..n) {
            if (i * 10000 + j * 5000 > y) continue
            val sa = y - (i * 10000 + j * 5000)
            val k = sa / 1000
            if (i + j + k == n) {
                println("$i $j $k")
                return
            }
        }
    }
    println("-1 -1 -1")
}

Measured memory_bytes: 37916
/*
	@・ω・@ <だれだろうね
*/

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long long, long long>;
template<class T> using pr = pair<T, T>;
template<class T> using vec = vector<T>;

#define debug(x) (std::cerr << (x) << "\n")
#define debug_tab(n, x) (std::cerr << strMulti("\t",n) << (x) << "\n")
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << (h) << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << (h) << " : " <<  (x) << "\n")

#define str(n)	(n.toString())

#define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(ll i=(n)-1; i >= 0; --i)
#define rrep1(i, n) for(ll i=(n); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = math_P(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool cmp_2nd(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T mod_pow(T x, T n, const T& p) { T ret = 1; while (n > 0) { if (n & 1) { (ret *= x) %= p; } (x *= x) %= p; n >>= 1; } return ret; }

/*****/

string S;

void Main()
{
	cin >> S;
	int N = S.size();

	bool yes = true;
	rep(i, N / 2)
	{
		if (S[i] != S[N - i - 1])
			yes = false;
	}

	debug_cout(yes);

	rep(i, N / 4)
	{
		debug_cout(N / 2 - i - 1);
		debug_tabcout(1, S[N / 2 - i - 1]);
		if (S[i] != S[N / 2 - i - 1])
			yes = false;
	}

	debug_cout(yes);

	rep(i, N / 4)
	{
		if (S[i + N / 2 + 1] != S[N - i - 1])
			yes = false;
	}

	cout << (yes ? "Yes" : "No");
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);

	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/

	Main();
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename T>inline void read(T &x){
	int p=1;x=0;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')p=-1;
		c=getchar();
	}
	while(isdigit(c)){
		x=(x<<3)+(x<<1)+(c^'0');
		c=getchar();
	}
	x*=p;
}
ll n,ans;
int a[100005];
int main(){
	read(n);
	for(register int i=1;i<=n;++i)
		read(a[i]),ans+=abs(a[i]-a[i-1]);
	ans+=abs(a[n]);
	int p=ans;
	for(register int i=1;i<=n;++i){
		ans=p;
		ans-=abs(a[i-1]-a[i]);
		ans-=abs(a[i+1]-a[i]);
		ans+=abs(a[i+1]-a[i-1]);
		cout<<ans<<endl;
	}
	return 0;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   std::vector<std::pair<long, long>> compress(const LI &xs) {
      std::vector<std::pair<long, long>> res;
      long n = xs.size();
      for(long i = 0; i < n; ++i) {
         if( i == 0 or xs[i-1] != xs[i] ) {
            res.push_back(std::make_pair(xs[i], 1));
         }
         else {
            res.back().second += 1;
         }
      }
      return res;
   }
   void solve() {
      Int n; scan(n);
      LI xs(n); scan(xs);
      std::sort(xs.begin(), xs.end());
      auto ys = compress(xs);
      Int res = 0;
      for(auto y : ys) {
         res += y.second % 2;
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 3188
n = int(input())
l = [0] + list(map(int,input().split())) + [0]

s = 0
for i in range(n+1):
  s += abs(l[i+1]-l[i])

for i in range(1,n+1):
  if (l[i-1] <= l[i] and l[i] <= l[i+1]) or (l[i-1] >= l[i] and l[i] >= l[i+1]):
    print(s)
  elif l[i-1] < l[i] and l[i] > l[i+1]:
    print(s - 2*abs(l[i] - max(l[i-1],l[i+1])))
  else:
    print(s - 2*abs(l[i] - min(l[i-1],l[i+1])))

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL mod=1e9+7;
const int maxn=2e5+10;
const LL inf=1e18;
typedef pair<LL,int> P;
int main()
{
    LL n;
    scanf("%lld",&n);
    LL res=0;
    for(LL i=1;i<=n;i++){
        if(i%3==0)continue;
        if(i%5==0)continue;
        res+=i;
    }
    printf("%lld\n",res);
    return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n),c(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) cin>>c[i];
  sort(ALL(a));
  sort(ALL(c));
  long long da,dc,ans=0;
  rep(i,n){
    ans+=distance(a.begin(),lower_bound(ALL(a),b[i]))
      *distance(upper_bound(ALL(c),b[i]),c.end());
  }
  cout<<ans<<endl;  
}

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

int main() {
  string s,t;
  cin >> s >> t;
  if(s.size()+1!=t.size()) {
    cout << "No" << endl;
    return 0;
  }
  for(int i=0; i<s.size(); i++) {
    if(s.at(i)!=t.at(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main(){
	lld q, h, s, d, n; cin>>q>>h>>s>>d>>n;
	n*=4;
	double r1=q/1., r2=h/2., r3=s/4., r4=d/8.;
	if(min({r1, r2, r3, r4})==r1){
		cerr<<"1\n";
		cout<<n*q<<'\n';
	}else if(min({r1, r2, r3, r4})==r2){
		cerr<<"2\n";
		cout<<n/2*h + n%2*q<<'\n';
	}else if(min({r1, r2, r3, r4})==r3){
		cerr<<"3";
		if(min(r1, r2) == r1){
			cerr<<" 1\n";
			cout<<n/4*s + n%4*q<<'\n';
		}else{
			cerr<<" 2\n";
			cout<<n/4*s + ((n%4)/2)*h + (n%2)*q<<'\n';
		}
	}else{
		cerr<<"4";
		if(min({r1, r2, r3})==r1){
			cerr<<" 1\n";
			cout<<n/8*d + n%8*q<<'\n';
		}else if(min({r2, r2, r3})==r2){
			cerr<<" 2\n";
			cout<<n/8*d + ((n%8)/2)*h + (n%2)*q<<'\n';
		}else{
			cerr<<" 3";
			if(min(r1, r2) == r1){
				cerr<<" 1\n";
				cout<<n/8*d + (n%8)*q<<'\n';
			}else{
				cerr<<" 2\n";
				cout<<n/8*d + ((n%8)/4)*s + ((n%4)/2)*h + (n%2)*q<<'\n';
			}
		}
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int a = 0;
	int b = n;
	while (b != 0) {
		a += b % 10;
		b = (b - b % 10) / 10;
	}
	if (n%a == 0) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

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

using namespace std;

//#define PRAGMA 448
#ifdef PRAGMA
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

#ifdef LUCARIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif

typedef int intt;
typedef pair<long long,long long> pll;
typedef pair<int,int> pii;

#define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define int long long
#define pb push_back
#define bs binary_search
#define up upper_bound
#define fs first 
#define sd second 
#define mp make_pair    
#define endl "\n"

#define fore(i,a,b) for(ll i = a; i < b; i++)
#define rfore(i, a, b) for(ll i = a - 1; i >= b; i--)
#define forev(a,b) fore(i,0,b)cout<<a[i]<<" "; 
#define ing(g,u,v)  g[u].pb(v); g[v].pb(u);
#define ingp(g,u,v,c) (g[u].pb({v,c});g[v].pb({u,c});)
#define mm(a,b) memset(a , b , sizeof a) 
#define ALL(a) a.begin(),a.end() 
#define SZ(n) ((ll) (n).size())
#define sfind(s,t) (s.find(t) != string::npos)

#define infll (ll)1e15
#define infi  (int)(1e9+1)
#define PI 3.14159265359 
#define mod (ll)(1e9+7)
#define eps  1e-6

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


int n,m;
char a[1001][1001];
int dp[1001][1001];
bool is_balid(int i,int j){return (i < n &&  j < m && a[i][j] != '#');}

int solve(int i, int j){
    if(i == n-1 && j == m-1)return 1;
    int &r = dp[i][j];
    if(~r)return r;
    r = 0;
    if(is_balid(i+1,j))r =(r+solve(i+1,j))%mod;
    if(is_balid(i,j+1))r =(r+solve(i,j+1))%mod;
    return r;
}


int32_t main(int32_t argc, char const *argv[]){
    FIN;
    mm(dp,-1);
     cin>>n>>m;
    fore(i,0,n){
        string s;cin>>s;
        fore(j,0,m)a[i][j]=s[j];
    }
    cout<<solve(0,0)<<endl;



    return 0;
}



















Measured memory_bytes: 9216
#https://atcoder.jp/contests/yahoo-procon2019-qual/tasks/yahoo_procon2019_qual_d
#2019-02-10

#DP

L = int(input())
A = [int(input()) for i in range(L)]

DP = [[0 for i in range(5)] for j in range(L+1)]

def cost(s, i, a):
    if s == 0 or s == 4:
        return a
    elif s == 1 or s == 3:
        if a > 0:
            return a%2
        else:
            return 2
    else:
        return (a+1)%2

for i in range(L):
    DP[i+1][0] = min(DP[i][:1]) + cost(0, i, A[i])
    DP[i+1][1] = min(DP[i][:2]) + cost(1, i, A[i])
    DP[i+1][2] = min(DP[i][:3]) + cost(2, i, A[i])
    DP[i+1][3] = min(DP[i][:4]) + cost(3, i, A[i])
    DP[i+1][4] = min(DP[i][:5]) + cost(4, i, A[i])



print(min(DP[L]))

Measured memory_bytes: 74104
#include<cstdio>

int n;
struct edge {
    int cost;
    bool judge = false;
};
edge e[300][300];

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            scanf("%d", &e[i][j].cost);
        }
    }

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (e[i][j].cost > e[i][k].cost + e[k][j].cost) {
                    printf("-1\n");
                    return 0;
                }
                if (k != i && k != j && e[i][j].cost == e[i][k].cost + e[k][j].cost) e[i][j].judge = true;
            }
        }
    }
    
    long ans = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            if (!e[i][j].judge) ans += e[i][j].cost;
        }
    }

    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 896
using System;

class Program
{
	static void Main()
	{
		string D;
		while ((D = Console.ReadLine()) != "0 0")
		{
			string s = "", t = "";
			string[] sD = D.Split(' ');
			int H = int.Parse(sD[0]), W = int.Parse(sD[1]);
			for (int i = 0; i < W; i++)
			{
				t += "#";
				s += ".";
				i++;
				if (i < W)
				{
					t += ".";
					s += "#";
				}
			}
			for (int i = 0; i < H; i++)
			{
				Console.WriteLine(t);
				i++;
				if (i < H)
				{
					Console.WriteLine(s);	
				}	
			}
			Console.WriteLine();
		}
	}
}

Measured memory_bytes: 5380
#include<bits/stdc++.h>
 
using namespace std;
typedef unsigned long long int ll;
const ll hell = 100005; 

bool comp( vector<ll> a, vector<ll> b )
{
    return a[0]<b[0];
}
ll binpow(ll a,ll b) 
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res*=a;
        a*=a;
        b >>= 1;
    }
    return res;
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
    return 0;
}


Measured memory_bytes: 256