akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
        if i % 2 == 0:
                ans += A[i]
        else:
                ans -= A[i]
tmp = []
tmp.append(ans)
for j in range(1,N):
        tmp.append(A[j - 1] * 2 - tmp[j - 1])

for i in tmp:
        print(i)



Measured memory_bytes: 14092
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Washoum
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        inputClass in = new inputClass(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DKnapsack1 solver = new DKnapsack1();
        solver.solve(1, in, out);
        out.close();
    }

    static class DKnapsack1 {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int n = sc.nextInt();
            int w = sc.nextInt();
            int[] wei = new int[n];
            int[] v = new int[n];
            for (int i = 0; i < n; i++) {
                wei[i] = sc.nextInt();
                v[i] = sc.nextInt();
            }

            long[][] dp = new long[n + 1][w + 1];
            boolean[][] go = new boolean[n + 1][w + 1];
            go[0][0] = true;

            for (int i = 0; i < n; i++) {
                for (int j = 0; j <= w; j++) {
                    if (go[i][j]) {
                        dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
                        go[i + 1][j] = true;
                        if (j + wei[i] <= w) {
                            dp[i + 1][j + wei[i]] = Math.max(dp[i + 1][j + wei[i]], dp[i][j] + v[i]);
                            go[i + 1][j + wei[i]] = true;
                        }
                    }
                }
            }
            long max = 0;
            for (int i = 0; i <= w; i++) {
                max = Math.max(max, dp[n][i]);
            }
            out.println(max);
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 126292
N, A, B = list(map(int, input().split()))

if N == 1:
	if A == B:
		print(1)
	else:
		print(0)
else:
	if A > B:
		print(0)
	else:
		print(2 * A - 2 * B + N * (B - A) + 1)

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

int main() {
	int n,ans = 0;
	vector<int> a(200010,0),b(200010,0),c(200010,0);
	cin >> n;
	for (int i = 0;i < n;++i) cin >> a[i];
	for (int i = 0;i < n;++i) cin >> b[i];

	for (int i = 1;i < 30;++i) {
		int cnt = 0;
		for (int j = 0;j < n;++j) c[j] = b[j]%(1 << i);
		sort(c.begin(),c.begin()+n);
		for (int j = 0;j < n;++j) {
			cnt += lower_bound(c.begin(),c.begin()+n,(1 << i)-a[j]%(1 << i))-lower_bound(c.begin(),c.begin()+n,(1 << i-1)-a[j]%(1 << i));
			cnt += lower_bound(c.begin(),c.begin()+n,(1 << i+1)-a[j]%(1 << i))-lower_bound(c.begin(),c.begin()+n,(1 << i-1)*3-a[j]%(1 << i));
			cnt %= 2;
		}
		if (cnt) ans += (1 << i-1);
	}

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

Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	static int x;
	
	static void input() throws IOException {
		x = readInt();
	}
	
	static void process() {
	}
	
	static void output() {
		System.out.println(x * x * x);
	}
	
	//??\?????±?????¨???
	static BufferedReader in;
	
	static void initBufferedReader() {
		in = new BufferedReader(new InputStreamReader(System.in));
	}
	
	static String readString() throws IOException {
		return in.readLine();
	}
	
	static int readInt() throws NumberFormatException, IOException {
		return Integer.valueOf(readString());
	}
	
	static int[] readMultiInt() throws IOException {
		String input = readString();
		String[] values = input.split(" ");
		int[] result = new int[values.length];
		for (int i = 0; i < values.length; i++) {
			result[i] = Integer.valueOf(values[i]);
		}
		return result;
	}
	
	static String arrayToString(int[] data) {
		String result = "";
		for (int i = 0; i < data.length; i++) {
			if (i >= data.length - 1) {
				result += String.valueOf(data[i]);
			} else {
				result += String.valueOf(data[i]) + " ";
			}
		}
		return result;
	}
	
	static long factional(int n) {
		int result = 1;
		for (int i = 1; i <= n; i++) {
			result *= i;
		}
		return result;
	}
	
	public static void main(String[] args) throws IOException {
		initBufferedReader();
		input();
		process();
		output();
	}
	
}

Measured memory_bytes: 24144
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


fn main() {
    let n = read::<usize>();
    let k = read::<usize>();

    let mut h = vec![0; n];

    for i in 0..n {
        h[i] = read::<usize>();
    }

    let mut ans = 0;
    for i in 0..n {
        if h[i] >= k {
            ans += 1;
        }
    }
    println!("{}", ans)
}


Measured memory_bytes: 4352
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
x,y=map(int,input().split())
if a.count(x)==a.count(y) and b.count(x)==b.count(y) and c.count(x)==c.count(y):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 2940
def main():
    n, m = [int(v) for v in input().strip().split(' ')]
    heights = [int(v) for v in input().strip().split(' ')]
    max_neighbors_heights = [0 for _ in range(n)]

    for _ in range(m):
        a, b = [int(v) - 1 for v in input().strip().split(' ')]
        max_neighbors_heights[a] = max(max_neighbors_heights[a], heights[b])
        max_neighbors_heights[b] = max(max_neighbors_heights[b], heights[a])

    ans = 0
    for h, max_neighbors_h in zip(heights, max_neighbors_heights):
        if h > max_neighbors_h:
            ans += 1
    print(int(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 85312
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int k;
  cin>>k;
  int h[N];
  for(int i=0;i<N;i++){
    cin >> h[i];
  }
 
  vector<int> dp(111111,1e9);
  dp[1]=abs(h[1]-h[0]);
  dp[0]=0;
 
  for(int i=2;i<N;i++)
    for(int j=1;j<=k;j++)
      if(i-j>=0)
    dp[i]=min(dp[i],abs(h[i-j]-h[i])+dp[i-j]);
      
cout<< dp[N-1];
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1e9 +7;
signed main(){
    int a[5],k;
    cin >>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
  if(a[4]-a[0]>k)cout<<":(";
  else cout<<"Yay!";

   


    
   return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！

int main() {
    ll n, k, sum;
    //n個のボールをk色で塗る。隣り合ったボールは別の色で塗ること。
    cin >> n >> k;
    sum = k * pow((k - 1),(n - 1));
    cout << sum << endl;
}

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

#define N 1000

int A[N+1][N+1];

int LCS(char *,char *);
int max(int, int);

int main()
{
  int q,i;
  char X[N+1],Y[N+1];

  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%s",X);
      scanf("%s",Y);
      printf("%d\n",LCS(X,Y));
    }
  
  return 0;
}

int LCS(char *X,char *Y)
{
  int i,j,n1,n2;

  n1=strlen(X);
  n2=strlen(Y);

  for(i=1;i<=n1;i++)
    {
      for(j=1;j<=n2;j++)
        {
          if(X[i-1]==Y[j-1])
            {
              A[i][j]=A[i-1][j-1]+1;
            }
          else
            {
              A[i][j]=max(A[i-1][j],A[i][j-1]);
            }
        }
    }
  return A[n1][n2];
}
int max(int a,int b)
{
  if(a>=b)
    return a;
  else
    return b;
}

Measured memory_bytes: 4524
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
#define endl '\n'


using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    long int x, y;
    long int i,temp,result=0;
    cin >> x >> y;
    for (i = 0; i < y;i++){
        cin >> temp;
        result += temp;
    }
    if(x-result<0){
        cout << "-1";
    }else{
        cout << x - result;
    }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    /* ll t;
    cin>>t;
    while(t--) */
    {
        ll i,j,k,l,m,n,a,b,c,d,cnt=0,f=0;
        cin>>k;
        cin>>a>>b;
        for(i=a;i<=b;i++)
        {
            if(i%k==0)
            {
                f=1;
                break;
            }
        }
        if(f==1)
            cout<<"OK"<<endl;
        else
            cout<<"NG"<<endl;

    }

}


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

int main(void) {
	long int N; cin >> N;
	long int a[N+1];
	int i; 
	long int sum = 0;

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

	a[N] = 0;

	for (i = 0; i < N; i++) {
		sum += a[i] / 2;
		a[i] = a[i] % 2;
		if (a[i] == 1 && a[i + 1] > 0) {
			sum += 1;
			a[i + 1] -= 1;
		}
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1024
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define CIN2(x,y) int x,y;cin>>x>>y;
#define CIN3(x,y,z) int x,y,z;cin>>x>>y>>z;
#define SCIN(x) string x;cin>>x;
#define SCIN2(x,y) string x,y;cin>>x>>y;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i];
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())


#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    CIN(n);V a(n);VECCIN(a);

    set<int> s;
    int flag=0;
    FOREACH(x,a){
        if(x<400)s.insert(0);
        else if(x<800)s.insert(1);
        else if(x<1200)s.insert(2);
        else if(x<1600)s.insert(3);
        else if(x<2000)s.insert(4);
        else if(x<2400)s.insert(5);
        else if(x<2800)s.insert(6);
        else if(x<3200)s.insert(7);
        else flag++;
    }
    SCOUT(max(1,(int)s.size()));
    COUT((int)s.size()+flag);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(M);
	vector<int> b(M);
	vector<long long> c(M);
	for (int i = 0; i<M; i++)
		cin >> a[i] >> b[i] >> c[i],
		a[i]--, b[i]--;

	long long oo = 0x1000000000000000LL;
	vector<long long> d(N, -oo);
	d[0] = 0LL;
	long long d1, d2;
	for (int i = 0; i<5000; i++)
	{
		for (int j = 0; j<M; j++)
			d[b[j]] = max(d[b[j]], d[a[j]] + c[j]);
		if (i == N - 1)
			d1 = d[N - 1];
		if (i == 2 * N - 1)
			d2 = d[N - 1];
	}
	if (d1 == d2)
		cout << d1 << endl;
	else
		cout << "inf" << endl;
}

Measured memory_bytes: 384
#include<stdio.h>
main(){
  int sum=0,a,b,i=0;
  double hei=0;
  while(scanf("%d,%d",&a,&b)!=EOF){
    sum+=a*b;
    i++;
    hei+=b;
  }
  printf("%d\n%d\n",sum,(int)(hei/i+0.5));
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
    int n,c=0,j=1;
    cin>>n;
    int a;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        if(a==j)
        {
            ++j;
        }
        else
        {
            ++c;
        }
    }
    if(c==n)
    {
        cout<<-1;
    }
    else
    {
        cout<<c;
    }
}

Measured memory_bytes: 256
/*
** 不交集
*/

#include <iostream>
#include <vector>
using namespace std;

class DisjointSet
{
  public:
    vector<int> rank, p;

    DisjointSet() {}
    DisjointSet(int size)
    {
        rank.resize(size, 0);
        p.resize(size, 0);
        for ( int i = 0; i < size; i++ )
        {
            makeSet(i);
        }
    }

    void makeSet(int x) {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y) {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
        if ( rank[x] > rank[y] ) {
            p[y] = x;
        }
        else {
            p[x] = y;
            if ( rank[x] == rank[y] ) {
                rank[y]++;
            }
        }
    }

    int findSet(int x) {
        if ( x != p[x] ) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

void
solve()
{
    int n, a, b, q, t;

    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);

    for (int i = 0; i < q; i++)
    {
        cin >> t >> a >> b;
        if (t == 0)
        {
            ds.unite(a, b);
        }
        else if (t == 1)
        {
            if (ds.same(a, b))
            {
                cout << 1 << endl;
            }
            else
            {
                cout << 0 << endl;
            }
        }
    }
}

int main()
{
    // freopen("infile", "r", stdin);
    // freopen("outfile", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 3180
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    map<string, int> mp;
    for(int i = 0; i < N; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int mx = -1;
    for(auto it = mp.begin(); it != mp.end(); it++) {
        mx = max(mx, it->second);
    }

    vector<string> ans;
    for(auto it = mp.begin(); it != mp.end(); it++) {
        if(it->second == mx) {
            ans.push_back(it->first);
        }
    }

    sort(ans.begin(), ans.end());

    for(string s : ans) {
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 26868
#include<bits/stdc++.h>
using namespace std;
void *wmem;
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16]={0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T1, class T2> void sortA_L(int N, T1 a[], T2 b[], void *mem = wmem){
  int i;
  pair<T1, T2> *arr;
  walloc1d(&arr, N, &mem);
  for(i=0;i<(N);i++){
    arr[i].first = a[i];
    arr[i].second = b[i];
  }
  sort(arr, arr+N);
  for(i=0;i<(N);i++){
    a[i] = arr[i].first;
    b[i] = arr[i].second;
  }
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline T popLast(multiset<T> &a){
  T res;
  typename multiset<T>::iterator it;
  it = a.end();
  it--;
  res = *it;
  a.erase(it);
  return res;
}
template<class T> inline T popLast(set<T> &a){
  T res;
  typename set<T>::iterator it;
  it = a.end();
  it--;
  res = *it;
  a.erase(it);
  return res;
}
char memarr[96000000];
int N;
int M;
int A[100000];
int B[100000];
int main(){
  int i, j, k, res=0;
  multiset<int> s;
  wmem = memarr;
  rd(N);
  rd(M);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
      rd(B[Lj4PdHRW]);
    }
  }
  sortA_L(N,A,B);
  k = 0;
  for(i=(1);i<(M+1);i++){
    while(k < N && A[k] <= i){
      s.insert(B[k]);
      k++;
    }
    if(s.size()){
      res += popLast(s);
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190810-2

// --- original code ---
// int N, M, A[1d5], B[1d5];
// {
//   int i, j, k, res = 0;
//   multiset<int> s;
//   rd(N,M,(A,B)(N));
//   sortA(N,A,B);
// 
//   k = 0;
//   rep(i,1,M+1){
//     while(k < N && A[k] <= i){
//       s.insert(B[k]);
//       k++;
//     }
//     if(s.size()) res += popLast(s);
//   }
//   wt(res);
// }


Measured memory_bytes: 6400
class Heap
  attr_reader :size
  def initialize(up: false)
    @up = up
    @heap = []
    @size = 0
  end
  def sum
    x = 0
    @size.times do |i|
      x += @heap[i]
    end
    x
  end
  def push(n)
    n = -n if @up
    i = @size
    while i > 0
      pid = (i - 1) / 2
      break if n >= @heap[pid]
      @heap[i] = @heap[pid]
      i = pid
    end
    @heap[i] = n
    @size += 1
  end
  def pop
    return nil if @size == 0
    top = @heap[0]
    @size -= 1
    n = @heap[@size]
    i = 0
    while i * 2 + 1 < @size
      cid1 = i * 2 + 1
      cid2 = cid1 + 1
      if cid2 < @size && @heap[cid2] < @heap[cid1]
        cid1 = cid2
      end
      break if @heap[cid1] >= n
      @heap[i] = @heap[cid1]
      i = cid1
    end
    @heap[i] = n
    if @up
      -top
    else
      top
    end
  end
end

_, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
h = Heap.new(up: true)
a.each do |x|
  h.push(x)
end
m.times do
  x = h.pop
  h.push(x / 2)
end
puts -h.sum

Measured memory_bytes: 21768
#include <bits/stdc++.h>
using namespace std;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int main() {
	int n; read(n);
	for (int i = 1, x; i <= n; i++)
		{read(x); if (x&1) return puts("first"), 0;}
	return puts("second"), 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 1LL<<60;
/////////////////////////////////
int main(){
    int h,w;
    cin >> h >> w;
    string a[h];
    rep(i, h) cin >> a[i];
    rep(i,h+2){
        if(i==0 || i==h+1){
            rep(_, w + 2) cout << "#";
            cout << endl;
        }
        else{
            cout << "#";
            cout << a[i - 1];
            cout << "#" << endl;
            
        }
    }
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#define MAX_R 10
#define MAX_C 10000
using namespace std;

int a[MAX_R][MAX_C];
int b[MAX_R][MAX_C];

void copy(int m, int n) {
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			b[i][j] = a[i][j];
		}
	}
}

void bit_reverse(int n, int c) {
	for (int i = 0; i < c; i++) {
		if (b[n][i]) b[n][i] = 0;
		else b[n][i] = 1;
	}
}

int count_one(int r, int n) {
	int count = 0;
	for (int j = 0; j < r; j++) {
		if (b[j][n]) count++;
	}
	return count;
}

int main() {
	while (true) {
		int r, c;
		cin >> r >> c;
		if (r == 0 && c == 0) return 0;
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				cin >> a[i][j];
			}
		}
		
		int ans = 0;
		for (int i = 0; i < ((1 << r)); i++) {
			//cout << "i = " << i << endl;
			copy(r, c);
			for (int j = 0; j < r; j++) {
				if (i & (1 << j)) {
					bit_reverse(j, c);
				}
			}
			/*
			for (int i = 0; i < r; i++) {
				for (int j = 0; j < c; j++) {
					cout << b[i][j] << ' ';
				}
				cout << endl;
			}
			*/

			int count = 0;
			for (int j = 0; j < c; j++) {
				count += max(count_one(r, j), r - count_one(r, j));
			}
			ans = max(ans, count);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3860
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <functional>

using namespace std;

int main(void){
  char c;
  int n, maxNum, minNum;
  vector<int> v;

  cin >> n;
  for(int i=0; i<n; i++){
    v.clear();  maxNum = 0;  minNum = 0;

    for(int j=0; j<8; j++){
      cin >> c;
      v.push_back(c - '0');
    }

    sort(v.begin(), v.end());
    for(int j=0; j<8; j++){
      maxNum += v[j] * pow(10, j);
    }
    sort(v.begin(), v.end(), greater<int>());
    for(int j=0; j<8; j++){
      minNum += v[j] * pow(10, j);
    }

    cout << maxNum - minNum << endl;
  }

  return 0;
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int Maxn = 110;

int open[Maxn];
int p[Maxn][11];

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < 10; j++){
            int f;
            cin >> f;
            if (f == 1) open[i] |= (1 << j);
        }
    }

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

    ll ans = -MOD;
    for (int bit = 1; bit < 1<<10; bit++){
        ll cnt = 0;
        for (int i = 0; i < n; i++){
            int x = bitset<10>(bit & open[i]).count();
            cnt += p[i][x];
        }
        ans = max(ans, cnt);
    }

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

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int w;
    cin >> w;
    cout << w*32 << endl;
}



Measured memory_bytes: 3100
#include <iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;


int main()
{
	int i, a[3];
	int c5 = 0, c7 = 0;

	for (i = 0; i < 3; i++) {
		cin >> a[i];
	}
	for (i = 0; i < 3; i++) {
		if (a[i] == 5) {
			c5 += 1;
		}
		else if (a[i] == 7) {
			c7 += 1;
		}
	}
	if (c5 == 2 && c7 == 1) {
		cout << "YES" << endl;
	}
	else
		cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(long a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
static inline int Min(int a,int b){return a<b?a:b;}
const int N=2e5+1,M=(N<<2),oo=(~0u>>2);
int n,m,mn[M],z[M],t[M],g[M],ql,qr,qx;
static inline void pu(int x){z[x]=z[x*2];t[x]=t[x*2+1];mn[x]=Min(mn[x*2],mn[x*2+1]);}
void build(int x,int l,int r){
  if(l==r){
    z[x]=l;
    t[x]=l;
    return;
  }
  int m=(l+r)/2;
  build(x*2,l,m);
  build(x*2+1,m+1,r);
  pu(x);
}
static inline void pt(int x,int w,int r){g[x]=w;t[x]=w;z[x]=w;if(w<=m){mn[x]=w-r;}else{mn[x]=oo;}}
static inline void upd(int x,int l,int r)
{
  if(z[x]>qr||t[x]<ql){return;}
  if(z[x]>=ql&&t[x]<=qr){pt(x,qr+1,r);return;}
  int m=(l+r)/2;
  if(g[x]){pt(x*2,g[x],m);pt(x*2+1,g[x],r);g[x]=0;}
  upd(x*2,l,m);upd(x*2+1,m+1,r);pu(x);
}
int main()
{
  //https://atcoder.jp/contests/abc177/submissions/16378643
  n=IN(),m=IN();build(1,1,m);
  for(int i=0;i<n;i++){ql=IN(),qr=IN();upd(1,1,m);if(mn[1]>m){puts(""),puts("-1");}else{OUT(mn[1]+i+1);}}
}

Measured memory_bytes: 9824
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// mp::cpp_int
// mp::cpp_dec_float_100



int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  string s;
  ll n, k;
  cin >> n >> k;
  
  map<ll, ll> m;
  rep(i, 0, k) {
    ll d;
    cin >> d;
    rep(j, 0, d) {
      ll a;
      cin >> a;
      m[a]++;
    }
  }
  
  cout << n-m.size() << "\n";
  
  //cout << (  ?"Yes" :"No") << "\n";

}

Measured memory_bytes: 3656
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long llint;
typedef long double ldouble;
// 小大
int compare(const void *a, const void *b){return *(llint *)a - *(llint *)b;}
typedef struct{
    llint aa;
    llint bb;
}frequent;
// 小大
int cmp( const void *p, const void *q ) {
    return ((frequent*)p)->bb - ((frequent*)q)->bb;
}
/*GCD*/
llint gcd(llint a,llint b){return b?gcd(b,a%b):a;}
/*絶対値*/
llint ABS(llint a){return a>=0?a:(-a);}

int main(void){
    llint n,i,x,ans;
    scanf("%lld%lld",&n,&x);
    llint locate[n];
    for(i=0;i<n;i++){
       scanf("%lld",&locate[i]);
    }
    ans = ABS(locate[0]-x);
    for(i=1;i<n;i++){
        ans = gcd(ans,ABS(locate[i]-x));
    }



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

Measured memory_bytes: 896
#include <iostream>
//#include <stdio.h>
//#include <array>

int main()
{
    int age;
    std::cin >> age;
    if (age == 1) {
        std::cout << "Hello World" << std::endl;
    } else {
        int a, b;
        std::cin >> a >> b;
        std::cout << a + b << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_by_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	string s;
	cin>>s;
	if(((int)s.sz()) & 1)
	{
		cout<<"No\n";
		return;
	}
	bool ok = 1;
	for(int i=0;i<(int)s.sz();i+=2)
	{
		if(s[i] == 'h' && s[i+1] == 'i')
		continue;
		else
		{
			ok = 0;
			break;
		}	
	}
	if(ok)
	cout<<"Yes\n";
	else cout<<"No\n";
	return;	
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int a,b,c;
  std::cin >> a >> b >>c;

  if(a==b) std::cout << c << '\n';
  else if(c==b ) std::cout << a << '\n';
  else std::cout << b << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;

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

    vector<int> v(N);
    map<string, int> mp;

    rep(i, N) cin >> v.at(i);
    int red_cnt = 0;

    rep(i, N)
    {
        if(v.at(i) < 400)
        {
            if(!mp.count("Hai"))
                mp["Hai"] = 1;
        }
        else if(v.at(i) < 800)
        {
            if(!mp.count("Cha"))
                mp["Cha"] = 1;
        }
        else if(v.at(i) < 1200)
        {
            if(!mp.count("Mi"))
                mp["Mi"] = 1;
        }
        else if(v.at(i) < 1600)
        {
            if(!mp.count("Miz"))
                mp["Miz"] = 1;
        }
        else if(v.at(i) < 2000)
        {
            if(!mp.count("Ao"))
                mp["Ao"] = 1;
        }
        else if(v.at(i) < 2400)
        {
            if(!mp.count("Ki"))
                mp["Ki"] = 1;
        }
        else if(v.at(i) < 2800)
        {
            if(!mp.count("Dai"))
                mp["Dai"] = 1;
        }
        else if(v.at(i) < 3200)
        {
            if(!mp.count("Aka"))
                mp["Aka"] = 1;
        }
        else
        {
            red_cnt++;
        }
    }

    int ans = mp.size() + red_cnt;
    if(mp.size() == 0)
        cout << 1 << " " << ans << endl;
    else
        cout << mp.size() << " " << ans << endl;
}


Measured memory_bytes: 256
var
a:array[0..55] of integer;
n,m,i,j,t:integer;
s:longint;
begin
readln(n,m);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
  for j:=i+1 to n do
    if a[i]<a[j] then
      begin
        t:=a[i];
        a[i]:=a[j];
        a[j]:=t;
      end;
for i:=1 to m do s:=s+a[i];
write(s);
end.

Measured memory_bytes: 128
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define umap unordered_map

const int MOD = 1e9 + 7;

int madd(ll a, ll b){
	a += b;
	if (a >= MOD) a -= MOD;
	return a;
}

int msub(ll a, ll b){
	a -= b;
	if (a < 0) a += MOD;
	return a;
}

ll mul(ll a, ll b) {
  unsigned long long x = (long long) a * b;
  unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
  asm(
    "divl %4; \n\t"
    : "=a" (d), "=d" (m)
    : "d" (xh), "a" (xl), "r" (MOD)
  );
  return m;
}

vvll mat_mul(const vvll& A, const vvll& B){
	int n = isize(A);
	vvll C = vvll(n, vll(n, 0));
	rep(i, n){
		rep(j, n){
			rep(k, n){
				// C[i][k] = madd(C[i][k], mul(A[i][j], B[j][k]));
				C[i][k] = (C[i][k] + A[i][j] * B[j][k]) % MOD;
			}
		}
	}
	return C;
}

vvll mat_exp(vvll M, ll k){
	int n = isize(M);
	vvll ans = vvll(n, vll(n, 0));
	rep(i, n){
		ans[i][i] = 1;
	}
	while(k){
		if (k % 2) ans = mat_mul(ans, M);
		k /= 2;
		M = mat_mul(M, M);
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	ll k; cin >> k;
	vvll A = vvll(n, vll(n, 0));
	rep(i, n){
		rep(j, n){
			int x; cin >> x;
			if (x) A[i][j] = 1;
		}
	}
	ll ans = 0;
	vvll M = mat_exp(A, k);
	rep(i, n){
		rep(j, n){
			ans = madd(ans, M[i][j]);
		}
	}
	cout << ans;
}	

Measured memory_bytes: 3700
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Buying_Sweets
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = int.Parse(Console.ReadLine());
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());

            Console.WriteLine((x - a) % b);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
cin>>str;
int q;
cin>>q;
int val = 0;
vector<char> st;
vector<char> end;
while(q--){
	int x ;
	cin>>x;
	if(x == 1){
	 val++;
	}
	else{
	      int op ; char x;
	      cin>>op>>x;
	      if(val%2){
		       if(op == 1){
			      end.pb(x);
			   }
			   else{
			     st.pb(x);
			   }
		  }
		  else{
		        if(op == 1){
				 st.pb(x);
				}
				else{
				 end.pb(x);
				}
		  }
	}
 }
 reverse(st.begin() , st.end());
 if(val%2){
   for(int i = end.size() - 1; i >= 0 ; i--){
       cout<<end[i];
   }
   for(int i = str.size() - 1 ; i>= 0; i--){
    cout<<str[i];
   }
   for(int i =st.size() - 1 ; i >= 0 ; i--){
    cout<<st[i];
   }
   return 0;
 }
 else{
     for(int i = 0; i < st.size() ; i++)cout<<st[i];
     cout<<str;
     for(int i = 0 ; i < end.size() ; i++)cout<<end[i];
     return 0; 
 }
}




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


int main() {
  int M, N;
  int W[101];
  while(cin >> M >> N && (M|N)) {
    for(int i = 0; i < N; ++i) cin >> W[i];
    int l = W[0];
    for(int i = 1; i < N; ++i) l = max(l,W[i]);
    int r = 1500000;
    int ans = r;
    while(l < r) {
      int m = (l+r)/2;
      int h = 1;
      for(int i = 0, space = 0; i < N; ++i) {
	if(space+W[i] > m) {
	  ++h;
	  space = W[i];
	} else {
	  space += W[i];
	}
      }
      if(h <= M) {
	ans = m;
	r = m;
      } else {
	l = m+1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

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

    vector<long long> transportationCapacityVec;
    for (int i = 0; i < 5; ++i)
    {
        long long input;
        cin >> input;

        transportationCapacityVec.push_back(input);
    }

    long long prevMinCapacity = transportationCapacityVec.at(0) + 1;
    long long timeCount = 0;

    for (int i = 0; i < 5; ++i)
    {
        long long startTime = i;
        long long nowCapacity = transportationCapacityVec.at(i);

        if (prevMinCapacity <= nowCapacity)
        {
            timeCount += 1;
        }
        else
        {
            timeCount = ((n + nowCapacity - 1) / nowCapacity) + startTime;
        }

        prevMinCapacity = min(prevMinCapacity, nowCapacity);
    }

    cout << timeCount << endl;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    rep(i,n) cin >> v[i];
    sort(v.begin(),v.end());
    int now=1;
    int ans=0;
    repr(i,1,n){
        if(v[i-1]==v[i]) now++;
        else{
            if(now%2==1) ans++;
            now=1;
        }
    }
    if(now%2==1) ans++;
    
    cout << ans << endl;
    
    return 0;
}




Measured memory_bytes: 1024
n=int(input())
dp=[float("inf") for _ in range(n+1)]
dp[0]=0
for i in range(n):
    power=1
    while i+power <= n:
        dp[i+power] = min(dp[i+power],dp[i]+1)
        power*=6
    power=1
    while i+power <= n:
        dp[i+power] = min(dp[i+power],dp[i]+1)
        power*=9
print(dp[n])

Measured memory_bytes: 6296
n, k = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(k * 2)]
di = {}
for i in d[1:: 2]:
    for j in i:
        if j not in di:
            di[j] = None
        else:
            pass
print(n - len(di))

Measured memory_bytes: 9216
# coding:utf-8
n = int(input())
h = list(map(int, input().split()))

for i in range(0, n - 1):
    if h[i + 1] - h[i] >= 0:
        continue
    elif h[i + 1] - h[i] == -1:
        h[i + 1] += 1
    else:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 14396
import sys
from math import gcd

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def lcm(a, b):
    return a * b // gcd(a, b)


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    L = 1
    for a in A:
        L = lcm(L, a)

    res = 0
    for a in A:
        res += L * pow(a, mod - 2, mod)
        res %= mod
    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10084
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ff first
#define ss second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;



int32_t main()
{
    fast

   int test=1;
    //cin>>test;
  
   

  while(test--)
  {
    int n,x;
    cin>>n;
    vi a(n);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n<=2)
    {
        cout<<0;
        return 0;
    }

    sort(all(a));
    
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])ans++;
            }
        }
    }


    cout<<ans;

// while ending
   }
  

return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <iostream>
#include <algorithm>

#define MAX 36

struct Card{
	char suit,value;
};

void Bubble_sort(struct Card c[],int num){
	bool flag = true;
	for(int i = 0;flag;i++){
		flag = false;
		for(int j = num - 1;j >= i+1; j--){
			if(c[j].value < c[j-1].value){
				std::swap(c[j],c[j-1]);		
				flag = true;
			}
		}
	}
}

void Selection_sort(struct Card c[],int num){
	for(int i=0;i<num;i++){
		int mini = i;
		for(int j = i;j < num;j++){
			if(c[j].value < c[mini].value){
				mini = j;
			}
		}
		std::swap(c[i],c[mini]);
	}
}

void print(struct Card c[],int num){
	std::cout<<c[0].suit<<c[0].value;
	for(int i=1;i<num;++i){
		std::cout<<" "<<c[i].suit <<c[i].value;
	}
	std::cout<<std::endl;
}

bool isStable(struct Card c1[],struct Card c2[],int num){
	for(int i=0;i<num;++i){
		if(c1[i].suit != c2[i].suit)
			return false;
	}
	return true;
}


int main(){
	
	Card C1[MAX],C2[MAX];

	int n=0;

	std::cin>>n;

	for(int i=0;i<n;++i){
		std::cin >> C1[i].suit >> C1[i].value;
		C2[i] = C1[i];
	}
	Bubble_sort(C1,n);
	Selection_sort(C2,n);
	bool flag = isStable(C1,C2,n);
	
	print(C1,n);
	std::cout<<"Stable"<<std::endl;
	print(C2,n);
	if(flag)
		std::cout<<"Stable"<<std::endl;
	else
		std::cout<<"Not stable"<<std::endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;

ll nCr(ll n, ll r) {
	if (r > n) { return 0; }
	if (r * 2 > n) r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i) {
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
ll sumdigit(ll n) {
	ll dig = 0, sum = 0;
	while (n) {
		dig = n % 10;
		sum = sum + dig;
		n = n / 10;
	}
	return sum;
}



int main() {
	int a, b, c, d;
	std::cin >> a >> b >> c >> d;
	if (a*b >= c * d) {
		std::cout << a * b << std::endl;
	}
	else {
		std::cout << c * d << std::endl;
	}
}

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

typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vp;
const int inf = 1e9;
const ll INF = 1e18;
const db eps = 1e-10;

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ep emplace
#define mem(a) memset(a, 0, sizeof(a))
#define copy(a, b) memcpy(a, b, sizeof(b))
#define PA cout << "pass\n"
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define TM cout << db(clock()) / CLOCKS_PER_SEC << '\n'

ll n, a, b;

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> a >> b;
    if(b - a & 1){
        ll res = (a - 1) + 1 + (b - a - 1) / 2;
        res = min(res, n - b + 1 + (b - a - 1) / 2);
        cout << res << '\n';
    }
    else cout << (b - a >> 1) << '\n';
    return 0;
}

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

int main() {
  int X;
  cin >> X;
  int count = 0;
  
  if (X == 2 || X == 3){
    count++;
  }
  
  
  while (count == 0){
    for (int i = 2; i < X/2 + 1; i++) {
      if (X % i == 0){
        break;
      }
      else if (i == X/2){
        count++;
      }
    }
     if (count == 0){
       X++;
     }
  }
	
  cout << X << endl;
}
		



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

pair<ld, ld> p[10];

bool cmp(pair<ld, ld> a, pair<ld, ld> b) {
	if (b.second == 0)
		return 0;
	if (a.second == 0)
		return 1;
	return a.first / a.second > b.first / b.second;
}

int main() {
	for (int i = 0; i < 6; ++i)
		cin >> p[i].first, p[i].first /= 100;
	for (int i = 0; i < 6; ++i)
		cin >> p[i].second, p[i].second /= 100;
	sort(p, p + 6, cmp);

	ld l = 0;
	ld r = 1;
	for (int it = 0; it < 1000; ++it) {
		ld m = (l + r) / 2;
		int fl = 0;
		ld s0 = 0, s1 = 0;
		for (int i = 0; i < 6; ++i) {
			if (fl) {
				s1 += p[i].second;
				continue;
			}
			if (!fl) {
				if (s0 + p[i].first <= m) {
					s0 += p[i].first;
					continue;
				}
				fl = 1;
				ld nd = (m - s0);
				ld a = nd / p[i].first;
				s0 += nd;
				s1 += (1 - a) * p[i].second;
			}
		}
		if (s1 < m)
			r = m;
		else
			l = m;

	}
	cout.setf(ios::fixed);
	cout.precision(10);
	cout << l << "\n";
	return 0;
}




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

int main(){
long long H,T=1;
cin >> H;
rep(i,41){
    if(T>H){
        cout << T-1<<endl;
        break;
    }
    T*=2;
}

return 0;}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> c(4, 0);
  for(int i=0;i<n;i++) {
    char chr;
    cin >> chr;
    if(chr == 'P')
      c[0]++;
    if(chr == 'W')
      c[1]++;
    if(chr == 'G')
      c[2]++;
    if(chr == 'Y')
      c[3]++;
  }
  int cnt = 0;
  for(int i=0;i<4;i++) {
    if(c[i] > 0)
      cnt++;
  }

  if(cnt == 3)
    cout << "Three" << endl;
  else
    cout << "Four" << endl;
}


Measured memory_bytes: 256