akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <stack>
#include <queue>
using namespace std;

int n,k,d[15];

bool solve(int i){
    while(i>0){
        for(int j=0;j<k;j++){
            if(i%10==d[j])return false;
        }
        i/=10;
    }
    return true;
}

int main(void){
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>d[i];
    }
    while(1){
        if(solve(n)){
            cout<<n<<endl;
            return 0;
        }
        n++;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main{
  static int n = 1000;
  static int[] A = new int[n];

  public static void main(String[] args){
    int j = 0;
    Scanner scan = new Scanner(System.in);
    int q = scan.nextInt();

    for(int i=0 ; i<q ; i++){
      String S1 = scan.next();
      String S2 = scan.next();
      A[j] = lcs(S1, S2);
      j++;
    }
    for(int i=0 ; i<j ; i++){
      System.out.println(A[i]);
    }
  }

  static int lcs(String S1, String S2){
    int ans = 0;
    int maxl = 0;
    int a[][] = new int[n+1][n+1];
    int sl1 = S1.length();
    int sl2 = S2.length();

    for(int i=1 ; i<=sl1 ; i++){
      for(int j=1 ; j<=sl2 ; j++){
        String str1 = String.valueOf(S1.charAt(i-1));
        String str2 = String.valueOf(S2.charAt(j-1));

        if(str1.equals(str2)){
          a[i][j] = a[i-1][j-1] + 1;
        }
        else{
          if(a[i-1][j] >= a[i][j-1]){
            a[i][j] = a[i-1][j];
          }
          else{
            a[i][j] = a[i][j-1];
          }
        }

        if(maxl >= a[i][j]){
          ans = maxl;
        }
        else{
          ans = a[i][j];
        }

      }
    }
    return ans;
  }

}



Measured memory_bytes: 295740
program knapsack_for_all_segments
  implicit none
  integer(8), parameter :: modu = 998244353
  integer :: n, s, a(3000) = 0, i, j, k, m = 0
  integer(8) :: dp(0:1, 0:3000) = 0, x = 0
  read(*,*) n, s
  read(*,*) a(1:n)
  do i = 1, n
    dp(m, 0) = dp(m, 0) + 1
    dp(1 - m, :) = 0
    do j = 0, s
      dp(1 - m, j) = mod(dp(1 - m, j) + dp(m, j), modu)
      k = j + a(i)
      if (k <= s) dp(1 - m, k) = mod(dp(1 - m, k) + dp(m, j), modu)
    end do
    x = mod(x + dp(1 - m, s), modu)
    m = 1 - m
  end do
  write(*,'(i0)') x
end program knapsack_for_all_segments

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

//#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rrep(i,a,b) for (int i = a; i >= b; i--)



int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int te=1;
	//cin>>te;
	while(te--){
        ll a,k,c,n,rem;
        string ans="";
        cin>>n;
        while(n>0){
            rem = n%26;
            if(rem==0) {ans += 'z'; n=(n/26)-1; }
            else{
                ans += (char)((rem-1) +'a');
                n = n/26;
            }

        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3640
import copy
slp = [map(int,raw_input().split()) for _ in range(int(raw_input()))]
nslp = []
for s in slp:
    if s not in nslp: nslp.append(s[:])
slp = copy.deepcopy(nslp)
dp = [0]*400
for s,l,p in slp:
    for i in range(s,l+1): dp[i] = max(dp[i],p)

for s,l,p in slp:
    for i in range(s,400-s):
        if dp[i]:
            for j in range(i+s,min(399,i+l+1)):
                dp[j] = max(dp[j],dp[i]+p)

ans = []
for roop in range(int(raw_input())):
    w = int(raw_input())
    if dp[w] == 0:
        print -1
        break
    ans.append(dp[w])
else:
    for a in ans: print a

Measured memory_bytes: 4476
#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 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 << 29;
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 a, b;cin >> a >> b;
  cout << max(0, a-b*2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

struct TV {
    int s;
    int t;
    int c;
};

bool cmp(const TV &a, const TV &b) {
    return (a.s < b.s);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, c;
    cin >> n >> c;
    vector<TV> tv(n);
    vector<pair<int, int>> r;
    
    rep(i, n) {
        cin >> tv[i].s >> tv[i].t >> tv[i].c;
    }
    
    sort(all(tv), cmp);
    
    rep(i, n) {
        bool f = false;
        
        rep(ii, sz(r)) {
            if (r[ii].second == tv[i].c) {
                if (r[ii].first <= tv[i].s) {
                    r[ii].first = tv[i].t;
                    f = true;
                    break;
                }
            }
            else {
                if (r[ii].first < tv[i].s) {
                    r[ii].first = tv[i].t;
                    f = true;
                    break;
                }
            }
        }
        
        if (!f) {
            r.emplace_back(tv[i].t, tv[i].c);
        }
    }
    
    cout << sz(r) << endl;
    return 0;
}

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


int main(){
	string S;
	cin >> S;
	vector<bool> alpha(26);
	int N = S.size();
	string s = "abcdefghijklmnopqrstuvwxyz";
	rep(i,N){
		alpha[S[i] - 'a'] = true;
	}
	rep(i,26){
		if(alpha[i] == false){
			cout << s[i] << endl;
			return 0;
		}
	}
	 cout << "None" << endl;
	 return 0;
}












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

int main(){
    int N;
    int n = 0;
    int counter = 0;
   while(1) {
       cin >> N;
       if (N == 0) break;
       
       for (int i = 1; i <= N/2; i++) {
           for (int j = i+1; j <= N/2 + 1; j++) {
                    // cout << "I " << i << " J " << j << "NUM " << (j-i+1) << endl;
                    if((j-i+1)<2) continue;
                    if(((j-i+1)*(i + j)) == 2 * N) {
                      
                        counter +=1;    
                    } 
                       
           }
           
           
           
       }
       cout << counter << endl;
       counter = 0;
       
   }
   
   
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#include "string"
#define ar array<int,3>

int32_t main() {
	boost;
	int t;
	cin >> t;
	while(t--) {
		int n;
		cin >> n;
		ar a[n];
		vector <int> l, r;
		int ans = 0;
		for(int i = 0; i < n; i++) { 
			cin >> a[i][0] >> a[i][1] >> a[i][2];
			if(a[i][1] > a[i][2])
				l.push_back(i);
			else if(a[i][1] < a[i][2])
				r.push_back(i);
			ans += min(a[i][1],a[i][2]);
		}

		sort(l.begin(), l.end(),[&](int p,int q){
			return a[p][0] < a[q][0];
		});
		
		multiset <int> taken;
		
		for(auto &i : l) {
			ar tt = a[i];
			if(taken.size() >= tt[0]) {
				int top = *taken.begin();
				if(top < tt[1] - tt[2]) {
					taken.erase(taken.begin());
					ans -=  top;
					ans += tt[1] - tt[2];
					taken.insert(tt[1] - tt[2]);
				}
			}
			else {
				ans += tt[1] - tt[2];
				taken.insert({tt[1] - tt[2]});
			}
		}

		taken.clear();
		sort(r.begin(),r.end(),[&](int p,int q){
			return a[p][0] > a[q][0];
		});

		for(auto &i : r) {
			ar tt = a[i];
			if(n - tt[0] == 0)
				continue;
			if(taken.size() >= n - tt[0]) {
				int top = *taken.begin();
				if(top < tt[2] - tt[1]) {
					taken.erase(taken.begin());
					ans -= top;
					ans += tt[2] - tt[1];
					taken.insert({tt[2] - tt[1]});
				}
			}
			else {
				ans += tt[2] - tt[1];
				taken.insert({tt[2] - tt[1]});
			}
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 14028
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int A[][] = new int[n][m];
		int b[] = new int[m];
		int i,j,c;
		for(i=0; i<n; i++){
			for(j=0; j<m; j++){
				A[i][j] = sc.nextInt();
			}
		}
		for(j=0; j<m; j++){
			b[j] = sc.nextInt();
		}
		for(i=0; i<n; i++){
			c = 0;
			for(j=0; j<m; j++){
				c += ( A[i][j] * b[j] );
			}
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 31872
n=int(input())
a=input()
b=input()
c=input()
cnt=0
for i in range(n):
    if a[i]==b[i]==c[i]:
        continue
    if a[i]!=b[i] and a[i]!=c[i] and b[i]!=c[i]:
        cnt+=2
    else:
        cnt+=1
print(cnt)

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

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        while (!(a & 1)) {
            a /= 2;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.*;

/**
 * created by naumov on 12/14/19
 */
public class Main {

// FROG 2
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int n = sc.nextInt();
//        int k = sc.nextInt();
//        int[] heights = new int[n];
//        for (int i = 0; i < n; i++) {
//            heights[i] = sc.nextInt();
//        }
//
//        int[] dp = new int[n];
//        for (int i = 0; i < n; i++) {
//            dp[i] = Integer.MAX_VALUE;
//        }
//
//        dp[0] = 0;
//
//        for (int i = 1; i < n; i++) {
//            for (int j=Math.max(i - k, 0); j < i; j++) {
//                dp[i] = Math.min(dp[i], dp[j] + Math.abs(heights[i] - heights[j]));
//            }
//        }
//        System.out.println(dp[n - 1]);
//    }

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

        int[][] cost = new int[n][3];
        int[][] res = new int[n][3];

        for (int d=0; d<n;d++) {
            for(int a = 0; a< 3; a++) {
                cost[d][a] = sc.nextInt();
            }
        }

        System.arraycopy(cost[0], 0, res[0], 0, 3);

        for(int d=1; d<n; d++) {
            for (int a = 0; a < 3; a++) {
                res[d][a] = cost[d][a];

                for (int pa=0; pa<3;pa++) {
                    if (pa == a)
                        continue;

                    res[d][a] = Math.max(res[d][a], res[d-1][pa]+cost[d][a]);
                }
            }

        }

        int totalMax = Integer.MIN_VALUE;

        for(int a =0; a<3;a++) {
            totalMax = Math.max(res[n-1][a], totalMax);
        }
        System.out.println(totalMax);
    }

}


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

using Int = unsigned long long;
using namespace std;

#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; };
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; };
template<class T> T th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

Int n, p;
std::string s;
Int r[212345];

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

	if(p == 2 || p == 5){
		Int ans = 0;
		RC(i, n){
			if((s[i] - '0') % p == 0){
				ans += i + 1;
			}
		}
		cout << ans << endl;
	}else{
		Int t = 1;
		ARC(i, 1, n + 1){
			r[i] = (r[i - 1] + (s[n - i] - '0') * t) % p;
			t = t * 10 % p;
		}
		// RC(i, n + 1) cout << r[i] << " "; cout << endl;

		vector<Int> cnt(p, 0);
		RC(i, n + 1){
			++cnt[r[i]];
		}

		Int ans = 0;
		RC(i, p){
			ans += cnt[i] * (cnt[i] - 1) / 2;
		}

		cout << ans << endl;
	}
}


Measured memory_bytes: 2180
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    long long H, W;
    vector<vector<long long>> A;

    cin >> H >> W;
    for (long long i = 0; i < H; i++)
    {
        vector<long long> tv;
        for (long long j = 0; j < W; j++)
        {
            long long t;
            cin >> t;
            tv.push_back(t);
        }
        A.push_back(tv);
    }

    long long h = 0;
    long long w = 0;
    long long d = 1;
    vector<vector<long long>> xy;
    for (long long i = 0; i < H; i++)
    {
        h = i;
        for (long long j = 0; j < W; j++)
        {
            xy.push_back(vector<long long>{h, w});
            w += d;
        }
        d *= (-1);
        w += d;
    }

    long long b = -1;
    vector<vector<long long>> output;
    for (long long i = 0; i < xy.size(); i++)
    {
        if (A[xy[i][0]][xy[i][1]] % 2 == 1)
        {
            if (b == -1)
                b = i;
            else
            {
                for (long long j = b; j < i; j++)
                    output.push_back(vector<long long>{xy[j][0], xy[j][1], xy[j + 1][0], xy[j + 1][1]});
                b = -1;
            }
        }
    }

    cout << output.size() << endl;
    for (long long i = 0; i < output.size(); i++)
    {
        cout << output[i][0] + 1 << ' ';
        cout << output[i][1] + 1 << ' ';
        cout << output[i][2] + 1 << ' ';
        cout << output[i][3] + 1 << endl;;
    }
}

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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> v[100005];
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--; b--;
    v[b].push_back(a);
  }
  int l=0,ans=0;
  rep(i,n-1){
    int ma=-1;
    for(int x:v[i+1]){
      ma=max(x,ma);
    }
    if(ma>=l){
      ans++;
      l=i+1;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ul H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;
  cout << (H - h) * (W - w) << endl;
}


Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string ans = "No";
    for(int i = 0; i <= 25; i++){
        for(int j = 0; j <=14; j++){
            if(i*4+j*7 == N){
                ans = "Yes";
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int bubbleSort(int A[], int N) 
{
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; ++i) 
	{
		flag = 0;
		for (int j = N - 1; j >= i + 1; j--) 
		{
			if (A[j] < A[j - 1])
			{
				std::swap(A[j], A[j - 1]);
				flag = 1;
				sw++;
			}
		}
	}
	return sw;
}

int main()
{
	int A[100], N, sw;
	std::cin >> N;
	for (int i = 0; i < N; i++)
	{
		std::cin >> A[i];
	}
	sw = bubbleSort(A, N);
	for (int i = 0; i < N; ++i) {
		if (i) std::cout << " ";
		std::cout << A[i];
	}
	std::cout << std::endl;
	std::cout << sw << std::endl;
	return 0;
 } 


Measured memory_bytes: 3112
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

void mainmain(){
	int a,b,c;
	while(cin>>a>>b>>c,a||b||c){
		queue<int> q;
		rep(i,a){
			q.push(i+1);
		}
		rep(i,c-1){
			q.push(q.front());
			q.pop();
		}
		while(--a){
			q.pop();
			rep(i,b-1){
				q.push(q.front());
				q.pop();
			}
		}
		cout<<q.front()<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1268
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using INT=mp::cpp_int;
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
INT LCM(INT x,INT y){
  INT z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
INT modinv(INT a, INT m) {
    INT b = m, u = 1, v = 0;
    while (b) {
        INT t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main() {
  cout << fixed << setprecision(30);
  ll n,k;
  cin>>n>>k;
  if(k%2!=0)putout((ll)pow(n/k,3));
  else{
    ll t=n/(k/2);
    if(t%2==0){
      putout((ll)(2*pow(t/2,3)));
    }
    else{
      putout((ll)(pow(t/2,3)+pow(t/2+1,3)));
    }
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>
 
#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll)ll_MAX
 
typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector<ll> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;
 
const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
 
using namespace std;

 

void solve()
{	
    ll n;
    cin>>n;
    if(n%1000==0) cout<<0;
    else cout<<1000-n%1000;

}
     
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    //cout<<"helo";
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    // cin>>t;
    ll ctr=0;
    while(t--)
    {   
        ctr++;
        if (ctr==14) cout<<1;
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
}

Measured memory_bytes: 3800
program abc111_c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32),parameter:: max_v = 100000
    integer(int32)::n,i
    integer(int32):: odd_ind(max_v), even_ind(max_v)
    integer(int32):: odd_ind_max1,even_ind_max1
    integer(int32):: odd_ind_max2,even_ind_max2
    integer(int32):: odd_ind_max_ind1,even_ind_max_ind1
    integer(int32):: odd_ind_max_ind2,even_ind_max_ind2
    integer(int32), allocatable:: v(:)

    read*, n
    allocate(v(n))
    read*, v(:)
    odd_ind(:) = 0; even_ind(:)=0

    do i=1,n,2
        odd_ind(v(i))=odd_ind(v(i))+1
        even_ind(v(i+1))=even_ind(v(i+1))+1
    end do

    call get_maxs(odd_ind,odd_ind_max1, odd_ind_max2,odd_ind_max_ind1,odd_ind_max_ind2)
    call get_maxs(even_ind,even_ind_max1,even_ind_max2,even_ind_max_ind1,even_ind_max_ind2)

    if (odd_ind_max_ind1 /= even_ind_max_ind1) then
        print'(i0)', n -  (odd_ind_max1 + even_ind_max1)
    else
        print'(i0)', n - max(odd_ind_max1+even_ind_max2, odd_ind_max2+even_ind_max1)
    end if
contains
    subroutine get_maxs(ar,m1,m2,ind_m1,ind_m2)
        integer(int32),intent(in):: ar(:)
        integer(int32),intent(out):: m1,m2,ind_m1, ind_m2
        integer(int32):: i

        m1=0; m2=0
        ind_m1=0;ind_m2=0
        do i=1,size(ar)
            if (ar(i) > m1) then
                m2 = m1
                m1 = ar(i)
                ind_m2 = ind_m1
                ind_m1 = i
                cycle
            end if

            if (ar(i) > m2)then
                m2 = ar(i)
                ind_m2 = i
            end if
        end do
    end subroutine
end program abc111_c

Measured memory_bytes: 4344
#include <iostream>
#include <iomanip>
#include<algorithm>
#include <map>
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <queue>

using namespace std;

using T=tuple<double, int>;

class Solver {
};

int main() {
	while (true) {
		int n;
		cin >> n;
		if (n == 0)break;

		vector<vector<double>> poses(n, vector<double>(4, 0));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 4; j++) {
				cin >> poses[i][j];
			}
		}
		vector<vector<T>> graph(n);
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				double dist = sqrt(
					pow(poses[j][0] - poses[i][0], 2)
					+ pow(poses[j][1] - poses[i][1], 2)
					+ pow(poses[j][2] - poses[i][2], 2))
					- poses[j][3] - poses[i][3];
				if (dist < 0)dist = 0;
				graph[i].emplace_back(make_tuple(dist,j));
				graph[j].emplace_back(make_tuple(dist,i));
			}
		}

		double res = 0;
		priority_queue<T, vector<T>, greater<T>> queue;
		queue.emplace(make_tuple(0, 0));
		vector<bool> checked(n, false);
		while (queue.size() > 0) {
			int index = get<1>(queue.top());
			double dist = get<0>(queue.top());
			queue.pop();
			if (checked[index])continue;

			checked[index] = true;
			res += dist;

			for (int i = 0; i < graph[index].size(); i++) {
				int to = get<1>(graph[index][i]);
				double d = get<0>(graph[index][i]);
				if (checked[to])continue;

				queue.emplace(make_tuple(d, to));
			}
		}

		printf("%.3f\n", res);
		//cout << setprecision(8) << res << endl;
	}
}


Measured memory_bytes: 3548
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                string[] sArr = Console.ReadLine().Split(' ');
                string command = sArr[0];
                int start = int.Parse(sArr[1]);
                int length = int.Parse(sArr[2]) - start + 1;
                string substr = str.Substring(start, length);
                switch (command)
                {
                    case "print":
                        Console.WriteLine(substr);
                        break;
                    case "reverse":
                        str = str.Substring(0, start) + new string(substr.Reverse().ToArray()) + str.Substring(start + length);
                        break;
                    case "replace":
                        str = str.Substring(0, start) + sArr[3] + str.Substring(start + length);
                        break;
                }
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9532
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int K; cin >> K;
    long long ans = 0;
    for (int i = 1 ; i <= K ; i++) {
        for (int j = 1 ; j <= K ; j++) {
            for (int k = 1 ; k <= K ; k++) {
                ans += __gcd(__gcd(i, j), k);
            }
        }
    }
    cout << ans << '\n';

}


Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <algorithm>
#include <stdio.h>
#include <functional>
using namespace std;

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

	int min, max;
	long long int sum;
	cin >> min;
	max = min;
	sum = min;

	for (int i = 1; i < n; i++)
	{
		int a;
		cin >> a;

		if (min > a)
		{
			min = a;
		}
		if (max < a)
		{
			max = a;
		}
		sum += a;
	}

	cout << min << " " << max << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 1164
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitsf(n) __builtin_popcount(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 1000000007;
const int MX = 1e5 + 6;

vector<int> v[MX];
bool vis[MX];
int X[MX], Y[MX], trash[MX], res;

void dfs(int s){
	vis[s] = 1;
	for(auto i : v[s]) if(!vis[i]) dfs(i);
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
	int n, m;
	cin >> n >> m;
	repp(i, 1, m) cin >> X[i] >> Y[i] >> trash[i];
	repp(i, 1, m) v[X[i]].pb(Y[i]), v[Y[i]].pb(X[i]);
	repp(i, 1, n) if(!vis[i]){
		dfs(i);
		res++;
	}
	cout << res;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout  << std::endl;
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2000000000;
const ll INF64 = 9223372036854775807ll;
//const ll INF64 = 9223372036854775ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;
namespace mp = boost::multiprecision;
int main(){
    int n;
    std::cin >> n;
    VEC(ll,a,n);
    //double d=1;
    //ll ans=1;
    sort(all(a));
    mp::cpp_int ans=1;
    mp::cpp_int d=1000000000000000000ll;
    rep(i,n){
        ans*=a[i];
        if(d<ans){
            std::cout << -1 << std::endl;
            exit(0);
        }
        
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 4472
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define endl '\n'
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define inf 1e18
#define pf push_front
#define pob pop_back
#define pof pop_front
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

typedef pair<int,int> pi;
typedef pair<int,pair<int,int>> piii;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;

int32_t main()
{
   // boost
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        cout<<1-n<<endl;
    }


    

}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
const int maxn = 1e7+5;
int pre[maxn],dis[maxn];
int find(int x){
    if(x==pre[x]){
        return x;
    }
    int r = find(pre[x]);
    dis[x] += dis[pre[x]];
    return pre[x] = r;
} 
bool merge(int x,int y,int d){
    int px = find(x);
    int py = find(y);
    if(px==py){
        return d==(dis[y]-dis[x]);
    }
    pre[py] = px ;
    dis[py] = dis[x]+d-dis[y];
    return true;
}
void init(){
    for(int i=0;i<maxn;i++){
        pre[i] = i;
    }
}
int main()
{
    init(); 
    int n,m,ans=1;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y,d;
        cin>>x>>y>>d;
        if(ans){
            ans = merge(x,y,d);
        }
    }
    if(ans){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl; 
    }
    return 0;
}

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

typedef long long int ll;

using namespace std;

int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if(a%2==1&&b%2==1&&c%2==1){
    ll ans=min(a*b,b*c);
      ans=min(ans,c*a);
    cout<<ans;
  }
  else{cout<<0;}
}

Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
A, B = (
    zip(*(map(int, input().split()) for _ in range(M))) if M else
    ((), ())
)
S, T = map(int, input().split())

G = [set() for _ in range(N + 1)]
for x, y in zip(A, B):
    G[x].add(y)

INF = 10**10

dp = [[INF for j in range(3)] for i in range(N + 1)]

q = deque()
q.append((S, 0))
dp[S][0] = 0

while q:
    i, k = q.popleft()
    L = (k + 1) % 3
    for x in G[i]:
        if dp[x][L] == INF:
            dp[x][L] = dp[i][k] + (1 if L%3==0 else 0)
            q.append((x, L))

ans = (
    -1 if dp[T][0] == INF else
    dp[T][0]
)

print(ans)


Measured memory_bytes: 61792
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int n, k, b[100000 + 5], gg[100000 + 5], tot;
char s[100000 + 5];
int main() {
	cin >> n >> k;
	scanf("%s", s + 1);
	int now = 1;
	for (int i = 2; i <= n + 1; ++i) {
		if (s[i] != s[i - 1]) {
			b[++tot] = now;
			gg[tot] = s[i - 1];
			now = 0;
		}
		++now;
	}
	LL ans = b[1] - 1;
	int i;
	for (i = 2; i <= tot; ++i) {
		if (!k) break ;
		if (gg[i] != gg[1]) {
			if (k) {
				ans += b[i];
				k--;
			}
		} else ans += b[i];
	}
	if (i <= tot && gg[i] == gg[1]) ans += b[i], ++i;
	for (; i <= tot; ++i) ans += b[i] - 1;
	cout << ans;
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define mp(x,y)          make_pair(x,y)
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto& i: a)
#define loop(n,i,a)      for(int i=a;i<n;i++)
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        loop(n,i,0){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define pp               pop_back
#define endl              "\n"
#define copy(a,b)         copy(all(a),back_inserter(b));
#define intersect(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
//int m=10000009;
//int arr[100000];
#define M                   1000000007
#define mm  998244353  
//set<int> st;
signed main()
{
    fast
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5])
        cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
   rep(i,n) cin>>a[i];
    sort(all(a));
    ll ans=0;
    ll count=1;
    ll x=a[0];
    rep2(i,1,n){    
       if(x==a[i]) count++;
      else if(x!=a[i]&&count%2==1) ans++;
      if(x!=a[i]){
            count=1;
            x=a[i];
        } 
    }
  if(count%2==1) ans++;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v, w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

ll extgcd(ll a, ll b, ll& x, ll& y) {
	if (b == 0) {
		x = (a >= 0) ? 1 : -1;
		y = 0;
		return abs(a);
	}
	else {
		ll res = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
		return res;
	}
}

ll mod_inverse(ll a, ll m) {
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}

ll fact[300000], fact_i[300000];

ll c(int n, int r) {
	return fact[n] * fact_i[r] % MOD * fact_i[n - r] % MOD;
}

ll f(int N, int k) {
	if (k == 0) return c(N + k * 2, k);
	else return ((c(N + k * 2, k) - c(N + k * 2, k - 1)) % MOD + MOD) % MOD;
}

int main() {
	fact[0] = fact_i[0] = 1;
	for (int i = 1; i <= 300000; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		fact_i[i] = mod_inverse(fact[i], MOD);
	}
	int N, M, K;
	cin >> N >> M >> K;
	ll ans = 0;
	for (int k = 0; k <= K; k++)
		ans += f(N, k) * f(M, K - k) % MOD * c(N + M + K * 2, N + k * 2) % MOD;
	cout << ans % MOD << endl;
}

Measured memory_bytes: 5848
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<int> one, two, three;
    for (int i = 0; i < a; i++) {
        int q;
        cin >> q;
        one.push_back(q);
    }
    for (int i = 0; i < b; i++) {
        int q;
        cin >> q;
        two.push_back(q);
    }
    for (int i = 0; i < c; i++) {
        int q;
        cin >> q;
        three.push_back(q);
    }
    sort(rall(one));
    sort(rall(two));
    sort(rall(three));

    vector<int> res;
    for (int i = 0; i < x; i++) res.push_back(one[i]);
    for (int i = 0; i < y; i++) res.push_back(two[i]);
    sort(all(res));
    int id = 0, ans = 0;

    for (int i = 0; i < res.size(); i++) {
        if (id < c && res[i] < three[id]) {
            ans += three[id];
            id++;
        }
        else {
            ans += res[i];
        }
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}

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

#define ll long long

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	char c;
	cin>>c;
	if(isupper(c))
		cout<<'A';
	else{
		cout<<'a';
	}
	
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<long> A(N);
  map<long, long> M;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    M[A[i]]++;
  }
  sort(A.begin(), A.end(), greater<long>());

  long target = 1;
  while (target <= A[0]) target *= 2;

  int ans = 0, i = 0;
  while (1 < target && i < N) {
    long a = A[i];
    if (M[a] == 0) {
      i++;
      continue;
    }
    if (a * 2 < target) {
      target /= 2;
      continue;
    }
    long b = target - a;
    if (M[b]) {
      if (a == b && M[a] < 2) {
        i++;
        continue;
      }
      ans++; M[a]--; M[b]--;
    }
    i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
using namespace std;
int N;
long long dp[100005],ans;
struct Node
{
	int w,s,v;
}pre[1000005];
int temp(Node x,Node y)
{
	return x.s+x.w<y.s+y.w;
}
int main()
{
	scanf("%d",&N);
	for (int i=1;i<=N;i++)
	  scanf("%d%d%d",&pre[i].w,&pre[i].s,&pre[i].v);
    sort(pre+1,pre+N+1,temp);
    for (int i=1;i<=N;i++)
      for (int j=pre[i].w+pre[i].s;j>=pre[i].w;j--)
      {
        dp[j]=max(dp[j],dp[j-pre[i].w]+pre[i].v);
        ans=max(ans,dp[j]);
      }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    REP(i,m){
        int a, b;
        cin >> a >> b;;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    bool ans = false;
    for(auto x:g[0]) {
        auto it = find(ALL(g[x]),n-1);
        if (it != g[x].end()) {
            ans = true;
            break;
        }
    }

    string s = ans ? "POSSIBLE" : "IMPOSSIBLE";
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 12016
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
using namespace std;
#define lol long long


int main()
{
	int N, K;
	string S;
	cin >> N >> S >> K;
	for (int i = 0; i < N; i++) {
		if (S[K - 1] != S[i]) {
			S[i] = '*';
		}
	}
	cout << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int c[110][110];
int main(){
	int h,w,n,a,x=0,y=0;
	cin>>h>>w>>n;
	for(int i=1;i<=n;i++){
		cin>>a;
		while(a--){
			c[y][x]=i;
			if(x%2==0){
				y++;
				if(y==h)y--,x++;
			}
			else{
				y--;
				if(y==-1)y++,x++;
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(j)cout<<" ";
			cout<<c[i][j];
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
string s;
int i=0;
int main()
{    
    getline(cin,s); 
    while(i<s.length())
	  {
	  	  if(s[i]!='0'&&s[i]!='1') 
			{
			    if(i>0) s.erase(i-1,2),i--;
				  else s.erase(i,1);
		    }
	  	    else i++;
      }
    cout<<s<<endl;
}

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

int main()
{
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	if (A > W / 2 || B > H / 2) {
		cout << "No" << endl;
	}
	else {
		for (int i = 0; i < B; i++) {
			for (int j = 0; j < A; j++) {
				cout << "1";
			}
			for (int j = 0; j < W - A; j++) {
				cout << "0";
			}
			cout << endl;
		}
		for (int i = 0; i < H - B; i++) {
			for (int j = 0; j < A; j++) {
				cout << "0";
			}
			for (int j = 0; j < W - A; j++) {
				cout << "1";
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1280