akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  
  string S; cin >> S;
  
  int L = S.size();
  
  for (int i = 1; i < L; i++) {
    
    string tmp = S.substr(0, L - i); int tmpL = tmp.size();
    
    if (tmpL % 2 == 1) continue;
    
    string leftSide = tmp.substr(0, tmpL / 2);
    
    string rightSide = tmp.substr(tmpL / 2, tmpL / 2);
    
    if (leftSide == rightSide) {
      cout << tmpL << endl;
      return 0;
    }
    
  }
  
}

Measured memory_bytes: 256
D, N = map(int, input().split())

if N < 100:
    if D == 0:
        A = N
    elif D == 1:
        A = N * 100
    else:
        A = N * 10000
else:
    if D == 0:
        A = 101
    elif D == 1:
        A = 10100
    else:
        A = 1010000
    
print(A)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if(b>=100)a=a*1000+b;
	else if(b>=10)a=a*100+b;
	else a=a*10+b;
	b=sqrt(a);
	if(a==b*b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

int main() {
	int h, w;
	while (cin >> h >> w) {
		if (h == 0 && w == 0) break;
		for (int i = 0; i < h; i++) {
			if (i == 0 || i == h - 1) for (int j = 0; j < w; j++) cout << "#";
			else {
				for (int j = 0; j < w; j++) {
					if (j == 0 || j == w - 1) cout << "#"; else cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3004
R = lambda: list(map(int, input().split()))
n = int(input())
a, b = R(), R()
r = 0
for i in range(n):
    x = min(a[i], b[i])
    y = min(a[i + 1], b[i] - x)
    a[i + 1] -= y
    r += x + y
print(r)


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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

ll balance0;
ll balance9;
ll X0,X9;

void interest(void){
  ll b1,b2,b3;
  b1 = balance0/100;
  b2 = balance9%100;
  b3 = balance9/100;
  
  balance0 += b1;
  balance0 += b2*10000000;
  balance9 += b3;
  
  ll kuri = balance0/1000000000;
  if(kuri>0){
    balance9 += kuri;
    balance0%=1000000000;
  }
}

int main(void){
  string X;
  cin >> X;
  
  if(X.length()<10){
    X0 = atoi(X.c_str());
    X9 = 0;
  }else{
    X0 = atoi(X.substr(X.length()-9,9).c_str());
    X9 = atoi(X.substr(0,X.length()-9).c_str());
  }
  
  balance9 = 0;
  balance0 = 100;
  
  ll cnt=0;
  if(X9>0){
    cnt = 1677;
    balance0=1009377;
    balance9=1;
  }
  while(1){
    //cout << balance9<<balance0<<"\n";
    if(balance9>X9){
      break;
    }else if(balance9==X9){
      if(balance0>=X0){
        break;
      }
    }
    interest();
    cnt++;
    if(cnt>1600){
      //cout<< balance9<<" "<<balance0<<"\n";
    }
  }
  //cout << balance9<<" "<<balance0<<"\n";
  //cout << X9 << " " << X0 << "\n";
  cout << cnt;
  
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long k = sc.nextLong();
		System.out.println(n*k);







	}

	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(1000000000+7);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 35708
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	int a, b;
	while ( cin >> a >> b )
	{
		int num = a + b;
		cout << (int)log10( num ) + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

constexpr int INF = 1e9+7;
constexpr ll INFL = 9*1e18;

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

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

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}


// TODO: write
int main() {
  int n,m,x;cin>>n>>m>>x;
  vector<vector<int>> a(n,vector<int>(m));
  vector<int> c(n);
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  }

  int ans = INF;
  rep(bit,1<<n){
    auto bs = bitset<12>(bit);
    vector<int> tmp(m,0);
    int res = 0;
    rep(i,n){
      if(!bs[i])continue;

      res += c[i];
      rep(j,m){
        tmp[j] += a[i][j];
      }
      
    }
    bool ok = true;
    rep(i,m){
      if(tmp[i] < x)ok = false;
    }
    if(ok){
      chmin(ans,res);
    }
  }
  if(ans == INF)print(-1);
  else print(ans);
  return 0;
}

Measured memory_bytes: 3632
import math
a, b, h, m = map(int, input().split())
#分針はm/60 * 360
#時針は12時間*60分で一周するので(h*60+m)/720 * 360
#それぞれの先端座標を求めて差分
minuterad = m/60*360
hourrad = (h*60+m)/720*360
minx, miny = b*math.cos(math.radians(minuterad)), b*math.sin(math.radians(minuterad))
hourx, houry = a*math.cos(math.radians(hourrad)), a*math.sin(math.radians(hourrad))
ans = math.sqrt((minx-hourx)**2 + (miny-houry)**2)

print(ans)


Measured memory_bytes: 9568
#include<bits/stdc++.h>
using namespace std;
bool kai(int n){
    if((n/10000==n%10)&&((n/10)%10==(n/1000)%10)){
        return true;
    }
    else{return false;}
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,ans=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++){
        if(kai(i)){ans++;}
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int m,n,i,j,k,cnt,t;
	while(1){
		scanf("%d %d",&m,&n);
		if(m==0) break;
		cnt=0;
		for(i=m;i<=n;i++){
			t=i;
			for(;;t/=2) if(t%2!=0) break;
			for(;;t/=3) if(t%3!=0) break;
			for(;;t/=5) if(t%5!=0) break;
			if(t==1) cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;



int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	map<ll, ll> m;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		ll x;
		cin >> x;
		m[x]++;
		a[i] = x;
	}
	ll ans = 0;
	for (auto i : m) {
		ll v = i.second;
		ans += (v - 1) * v / 2;
	}
	ll copy = ans;
	for (int i = 0; i < n; i++) {
		ll v = m[a[i]];
		ans -= (v - 1) * v / 2;
		v--;
		ans += (v - 1) * v / 2;
		cout << ans << "\n";
		ans = copy;
	}
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
#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++)

int ctoi(char);

struct btn{
    int next;
    int flag;
};

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

    vector<int> list;

    rep(i, N)
    {
        int tmp;
        cin >> tmp;
        list.push_back(tmp);
    }
    stable_sort(list.begin(),list.end(), greater<int>());
    int alice = 0;
    rep(i, N)
    {
        if(i%2==0)
        {
            alice += list[i];
        }
        else
        {
            alice -= list[i];
        }
    }
    cout << alice << endl;

}


int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c -'0';
    }
    return -1;
}


Measured memory_bytes: 256
from heapq import heappush, heappop
H, W = map(int, input().split())
s = [input() for _ in range(H)]

dist = [[float('inf')] * W for _ in range(H)]
q = [(0, 0, 0)]
while q :
    cost, cx, cy = heappop(q)
    if cost >= dist[cy][cx] :
        continue
    dist[cy][cx] = cost
        
    for dx, dy in ((0, 1), (0, -1), (1, 0), (-1, 0)) :
        if 0 <= cx + dx < W and 0 <= cy + dy < H and s[cy+dy][cx+dx] != '#' :
            heappush(q, (cost+1, cx+dx, cy+dy))
            
if dist[H-1][W-1] == float('inf') :
    print(-1)
else :
    ret = 0
    for s_ in s :
        ret += s_.count('#')
    print(H * W - ret - dist[H-1][W-1] - 1)


Measured memory_bytes: 44912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define PRINT(x) cout<<(x)<<endl
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair

const int MAX_N = 100009;

int N, A[MAX_N];

int same_hat[MAX_N]; // same_hat[i]: 同色の帽子をi人が被っているような色の種類数

int main() {
    cin >> N;
    REP(i, N) cin >> A[i];

    REP(i, N) same_hat[i] = 0;
    same_hat[0] = 3;

    ll num_comb = 1;

    REP(i, N) {
        num_comb = num_comb * same_hat[A[i]] % MOD;
        same_hat[A[i]]--;
        same_hat[A[i] + 1]++;
    }

    PRINT(num_comb);

    return 0;
}

Measured memory_bytes: 4400
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    int N;
    vector<string> W;
    cin >> N;
    for (size_t i = 0; i < N; i++) {
        string w;
        cin >> w;
        W.push_back(w);
    }

    for (size_t i = 0; i < W.size()-1; i++) {
        if(*(W[i].end()-1) != *W[i+1].begin()) {
            cout << "No" << endl;
            return 0;
        }
    }

    set<string> Wset(W.begin(), W.end());

    if(Wset.size() != N) {
        cout << "No";
    } else {
        cout << "Yes";
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt[200003],n,k;
long long ans;
map<int,int>mp;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		cnt[i]=(cnt[i-1]+a-1)%k;
	}
	mp[0]=1;
	for(int i=1;i<=n;i++)
	{
		if(i>=k)mp[cnt[i-k]]--;
		ans+=mp[cnt[i]],mp[cnt[i]]++;
	}
	cout<<ans;
}

Measured memory_bytes: 10368
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    int x=0;
    int y=1;
    x=a;
    while(1)
    {
        if(b==1)
        {
            y=0;
            break;
        }
        if(x>=b)
        {
            break;
        }
        if(a==1)
        {
            y=0;
            break;
        }
        x+=(a-1);
        y++;
    }
    cout<<y;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] dlm = " ".ToCharArray();
            string[] str = Console.ReadLine().Split(dlm);

            int W = int.Parse(str[0]);
            int H = int.Parse(str[1]);
            int x = int.Parse(str[2]);
            int y = int.Parse(str[3]);
            int r = int.Parse(str[4]);

            if (x >= r && x <= W - r && y >= r && y <= H - r)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}



Measured memory_bytes: 17932
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)

	s := getNextString(scanner)
	ww := make([]int, n+1)
	ee := make([]int, n+1)
	for i := 0; i < n; i++ {
		ww[i+1] = ww[i]
		ee[i+1] = ee[i]
		if s[i] == 'W' {
			ww[i+1]++
			continue
		}
		ee[i+1]++
	}

	ans := math.MaxInt32
	for i := 0; i < n; i++ {
		if ans > ww[i]+ee[n]-ee[i+1] {
			ans = ww[i] + ee[n] - ee[i+1]
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 6272
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int N,M,T;
	cin >> N >> M >> T;

	std::vector<int> a(N);
	std::vector<int> dis(N);

	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < N; i++) {
		if (i == N-1) {
			dis[i] = 10001;
		}
		else {
			dis[i] = a[i+1] - a[i];
		}
	}

	int nst = 2 * M * N;
	for (int i = 0; i < N; i++) {
		if (i != N-1) {
			if (dis[i] < 2*M) {
				nst -= 2 * M;
				nst += dis[i];
			}
		}
		else {
			if (a[i]+M >= T) {
				nst -= (a[i] + M) - T;
			}
		}
	}
	cout << (T - nst) << endl;

	return 0;
}

Measured memory_bytes: 3088
N,Q = map(int,input().split())
S = input()
a = [0]*N
t = 0
for i in range(1,N):
    if S[i-1] == "A" and S[i] == "C":
        t+=1
    a[i] = t
for _ in range(Q):
    l,r = map(lambda x:int(x)-1,input().split())
    print(a[r]-a[l])

Measured memory_bytes: 6084
from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n

while remain>=l[-1]:
    remain-=l[-1]
    l.pop()
print(*list(set(l)-set([remain])),sep="\n")

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

int main() {

    int a, b;
    while (cin >> a >> b){
    if (a == 1) a += 13;
    if (b == 1) b += 13;

    if (a > b) cout << "Alice" << endl;
    else if (a < b) cout << "Bob" << endl;
    else cout << "Draw" << endl;
}
    return 0;
}

Measured memory_bytes: 256
K,N = map(int,input().split(" "))
A = [int(i) for i in input().split(" ")]
a1 = [i for i in A if i<=K/2]
a2 = [j for j in A if j>K/2]

Max = 0
if len(a1)==0:
    print(a2[-1]-a2[0])
elif len(a2)==0:
    print(a1[-1]-a1[0])
else:
    for i in range(len(a1)-1):
        if a1[i+1] - a1[i] > Max:
            Max = a1[i+1] - a1[i]
            
    for j in range(len(a2)-1):
        if a2[j+1] - a2[j]>Max:
            Max = a2[j+1] - a2[j]
            
    if a1[0]+K-a2[-1]>Max:
        Max = a1[0]+K-a2[-1]
        
    if a2[0]-a1[-1]>Max:
        Max = a2[0]-a1[-1]
        
    print(K-Max)

Measured memory_bytes: 26444
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll INF=1e9;


int main(){
  int n;
  cin>>n;
  int ans=0;
  rep(i,n){
    int a;
    cin>>a;
    if(i%2==0 && a%2==1){
      ans++;
    }
  }
cout<<ans;

}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}



signed main() {

    int n, m;
    cin >> n  >> m;
    vector<int> a(n);

    int lcm = 1, gcd;

    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(!i) gcd = a[i];
        lcm = lcm / __gcd(lcm, a[i]/2) * a[i]/2;
        gcd = __gcd(gcd, a[i]);
    }
    
    cout << m/lcm - m/(lcm / __gcd(lcm, gcd) * gcd) << endl;


  
    return 0;
}



Measured memory_bytes: 1024
#include<cmath>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int N=1010,INF=1000000007;
vector<int>s[N],w[N],back[N];
int cur[N],vis[N],d[N],q[N];
int g[N],A[N],B[N],a[N];
int notprime[10101010],pri[10101010];
int cnt,cntt;
void cl(int n)
{
	int i;
	for(i=0;i<=n;i++)
		s[i].clear(),w[i].clear(),back[i].clear();
}
void jiantu(int x,int y,int l)
{
    s[x].push_back(y);
    s[y].push_back(x);
    w[x].push_back(l);
    w[y].push_back(0);
    back[x].push_back(s[y].size()-1);
    back[y].push_back(s[x].size()-1);
}
int bfs(int st,int en)
{
    int h=0,t=1,x,c,i,y;
    memset(cur,0,sizeof(cur));
    memset(d,0,sizeof(d));
    memset(vis,0,sizeof(vis));
    vis[st]=1,q[h]=st;
    while(h<t)
    {
        x=q[h++];
        if(x==en)
            continue;
        c=s[x].size();
        for(i=0;i<c;i++)
        {
            y=s[x][i];
            if(w[x][i]==0||vis[y]==1)	
                continue;
            vis[y]=1;
            d[y]=d[x]+1;
            q[t++]=y;
        }
    }
    return d[en];
}
int dfs(int x,int en,int f)
{
    if(x==en) return f;
    int tmp,ans=0,c,i,y;
    c=s[x].size();
    for(i=cur[x];i<c;i++)
    {
        cur[x]=i;
        y=s[x][i];
        if(w[x][i]==0||d[y]!=d[x]+1)
            continue;
        tmp=dfs(y,en,min(f-ans,w[x][i]));
        ans+=tmp;
        w[x][i]-=tmp;
        w[y][back[x][i]]+=tmp;
        if(ans==f)
            return ans;
    }
    d[x]=-1;
    return ans;
}
int dinic(int st,int en)
{
    int ans=0;
    while(bfs(st,en))
        ans+=dfs(st,en,INF);
    return ans;
}
void sieve(int n)
{
	int i,j;
	notprime[1]=1;
	for(i=2;i<=n;i++)
	{
		if(!notprime[i])
			pri[++cntt]=i;
		for(j=1;j<=cntt;j++)
		{
			if(i*pri[j]>n)
				break;
			notprime[i*pri[j]]=1;
			if(i%pri[j]==0)
				break;
		}
	}
}
int main()
{
	int T,n,i,j,sum1,sum2,st,en,ans;
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
//	scanf("%d",&T);
	T=1;
	sieve(10000000);
	while(T--)
	{
		cnt=0;
		scanf("%d",&n);
		for(i=1;i<=n;i++)
			scanf("%d",&a[i]);
		a[n+1]=1e9,a[0]=-1e9;
		for(i=1;i<=n;i++)
		{
			if(a[i]!=a[i-1]+1)
				g[++cnt]=a[i];
			if(a[i]+1!=a[i+1])
				g[++cnt]=a[i]+1;
		}
		sum1=sum2=0;
		for(i=1;i<=cnt;i++)
		{
			if(g[i]&1)
				sum1++,A[sum1]=g[i];
			else
				sum2++,B[sum2]=g[i];
		}
//		printf("%d %d\n",sum1,sum2);
		st=0,en=cnt+1;
		for(i=1;i<=sum1;i++)
			jiantu(st,i,1);
		for(i=1;i<=sum2;i++)
			jiantu(i+sum1,en,1);
		for(i=1;i<=sum1;i++)
			for(j=1;j<=sum2;j++)
				if(!notprime[abs(A[i]-B[j])])
					jiantu(i,j+sum1,1);
		ans=dinic(st,en);
		cl(en);
		printf("%d\n",ans+((sum1-ans)/2)*2+((sum2-ans)/2)*2+((sum1-ans)&1)*3);
	}
	return 0;
}


Measured memory_bytes: 44288
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

void addary( vector< PII > &ary, int n )
{
	REP( i, 0, n )
	{
		int a, b;
		cin >> a >> b;
		ary.PB( MP( a, b ) );
	}

	return;
}

struct Tsort
{
	int N;
	VVI G;

	VI order;
	vector< bool > used;

	Tsort( VVI G ) : N( G.size() ), G( G ), used( vector< bool >( N, false ) )
	{
		return;
	}

	VI solve()
	{
		REP( i, 0, N )
		{
			rec( i );
		}
		
		reverse( ALL( order ) );

		return order;
	}

	void rec( int v )
	{
		if ( used[v] )
		{
			return;
		}

		used[v] = true;

		REP( i, 0, G[v].size() )
		{
			rec( G[v][i] );
		}

		order.PB( v );
	}
};

int solve( vector< PII > ary )
{
	const int N = ary.size();

	VVI G( N );

	REP( i, 0, N )
	{
		REP( j, 0, N )
		{
			if ( i == j )
			{
				continue;
			}

			if ( ary[i].fst < ary[j].fst && ary[i].snd < ary[j].snd )
			{
				G[i].PB( j );
			}
		}
	}

	VI order = Tsort( G ).solve();

	VI dp( N, 1 );

	REP( i, 0, N )
	{
		int cur = order[i];

		REP( j, 0, G[ order[i] ].size() )
		{
			int next = G[ cur ][j];

			dp[ next ] = max( dp[ next ], dp[ cur ] + 1 );
		}
	}

	return dp[ order.back() ];
}

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

	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		vector< PII > ary;
		addary( ary, n );

		cin >> n;
		addary( ary, n );

		cout << solve( ary ) << endl;
	}

	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N;
	cin >> N;
	vector<pair<string, int>> K;
	fx(N) {
		string s;
		int t;
		cin >> s >> t;
		pb(K,make_pair(s,t));
	}

	string X;
	cin >> X;
	fx(N) {
		if (K[x].first==X) {
			int ans = 0;
			fyg(N, x + 1) {
				ans += K[y].second;
			}
			ce(ans);
			return 0;
		}
	}


    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<set>
#include<vector>
#define INF 100000000

#define MAX_H 300
#define MAX_W 301

typedef long long int ll;
using namespace std;



int main(){

	int H,W;

	while(true){
	
		scanf("%d %d", &H, &W);

		if(H == 0 && W == 0)
			break;
		else{
		
			for(int i = 0; i < H; i++){
				for(int j = 0; j < W; j++){
					printf("#");
				}
				printf("\n");
			}
		
			printf("\n");
		
		}
	
	}


	return 0;

}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <assert.h>
#include <cstring>
#include <set>
using namespace std;

typedef long long ll;

int main()
{
    int len;
    cin >> len;
    int ac, tle, wa, re;
    ac = tle = wa = re = 0;
    for(int i = 0; i < len; i++)
    {
        string s;
        cin >> s;
        if(s == "AC")ac++;
        if(s == "WA")wa++;
        if(s == "TLE")tle++;
        if(s == "RE")re++;
    }
    cout << "AC x " << ac << "\n";
    cout << "WA x " << wa << "\n";
    cout << "TLE x " << tle << "\n";
    cout << "RE x " << re << "\n";
}

Measured memory_bytes: 3632
/* 
 * File:   main.c
 * Author: s1252007
 *
 * Created on June 26, 2018, 11:39 AM
 */

#include <stdio.h>
#include <stdlib.h>
#define NIL -1

/*
 * 
 */

int BinarySearch(int *S, int n, int key);

int main(int argc, char** argv) {
    int n, q, checkSearch, counter = 0;
    int *S, *T;
    scanf("%d", &n);
    S = (int *)malloc(sizeof(int) * n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    T = (int *)malloc(sizeof(int) * q);
    for (int j = 0; j < q; j++)
    {
        scanf("%d", &T[j]);
    }
    
    for (int ix = 0; ix < q; ix++)
    {
        checkSearch = BinarySearch(S, n, T[ix]);
        if (checkSearch != NIL) counter++;
    }
    printf("%d\n", counter);
    return (EXIT_SUCCESS);
}

int BinarySearch(int *S, int n, int key)
{
    int left = 0, counter = 0, right = n;
    while (left < right)
    {
        int mid = (left + right)/2;
        if (key == S[mid]) return mid;
        if (key > S[mid]) left = mid + 1;
        else if (key < S[mid]) right = mid;
    }
    return NIL;
}






Measured memory_bytes: 2416
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k=1,a,b,x;
   cin>>x>>a>>b;
   if(b-a<=0)
   {
       cout<<"delicious"<<endl;
   }
   else if(b-a<=x)
   {
       cout<<"safe"<<endl;
   }
   else
    cout<<"dangerous"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll n;
  cin >> n;
  string s[n];
  map<string, ll> mp;
  ll ma = 0;
  for(ll i = 0; i < n; i++){
    cin >> s[i];
    mp[s[i]]++;
    ma = max(mp[s[i]], ma);
  }

  for(auto m : mp){
    if(m.second == ma) cout << m.first << endl;
  }


  return 0;
}

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

int yakusu(int x){
    int y=1;
    for(int a=3;a*a<=x;a+=2){
        if(x%a==0){
            y++;
        }
    }
    return y;
}

int main(void){
    // Your code here!
    int N;cin>>N;
    int count,ans;count=ans=0;
    for(int i=1;i<=N;i+=2){
        if(yakusu(i)==4){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N; cin >> N;
	vi L(2 * N);
	REP(i,2 * N) cin >> L[i];
	sort(ALL(L));
	int res = 0;
	for (int i = 0; i < 2 * N; i += 2) res += L[i];
	cout << res << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int lh,lm,h,m;
	cin>>lh>>lm>>h>>m;
	double Hour=h*30.0+m*0.5;
	double Minute=m*6.0;
	if(Hour<Minute)
		swap(Hour,Minute);
	double Angle=min(360-Hour+Minute,Hour-Minute);
	double CosAngle=cos(Angle*3.141592653589793/180.000);
	double First=lh*lh;
	double Second=lm*lm;
	double Third=2.00*lh*lm*CosAngle;
	cout<<fixed<<setprecision(20)<<sqrt(First+Second-Third);
	return 0;
}

Measured memory_bytes: 4240
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <map>
#include <unordered_set>
using namespace std;

using Weight = int;
using Capacity = int;
struct Edge {
	int src, dst; Weight weight; Capacity cap;
	Edge(int s, int d, Weight w, Capacity c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

struct Dinic {
	int n, s, t;
	vector<int> level, prog, que;
	vector<vector<Capacity>> cap, flow;
	vector<vector<int>> g;
	Capacity inf;
	Dinic(const Graph &graph)
		: n(graph.size()),
		cap(n, vector<Capacity>(n)), flow(n, vector<Capacity>(n)),
		g(n, vector<int>()), inf(numeric_limits<Capacity>::max() / 8) {
		for(int i = 0; i < n; i++) {
			for(auto &e : graph[i]) {
				int u = e.src, v = e.dst;
				Capacity c = e.cap;
				cap[u][v] += c; cap[v][u] += c; flow[v][u] += c;
				g[u].push_back(v); g[v].push_back(u);
			}
		}
	}
	inline Capacity residue(int u, int v) { return cap[u][v] - flow[u][v]; }
	Capacity solve(int s_, int t_) {
		this->t = t_, this->s = s_;
		que.resize(n + 1);
		Capacity res = 0;
		while(levelize()) { prog.assign(n, 0); res += augment(s, inf); }
		return res;
	}
	bool levelize() {
		int l = 0, r = 0;
		level.assign(n, -1); level[s] = 0; que[r++] = s;
		while(l != r) {
			int v = que[l++]; if(v == t) break;
			for(const int &d : g[v]) if(level[d] == -1 && residue(v, d) != 0) {
				level[d] = level[v] + 1; que[r++] = d;
			}
		}
		return level[t] != -1;
	}
	Capacity augment(int v, Capacity lim) {
		Capacity res = 0;
		if(v == t) return lim;
		for(int &i = prog[v]; i < (int)g[v].size(); i++) {
			const int &d = g[v][i];
			if(residue(v, d) == 0 || level[v] >= level[d]) continue;
			const Capacity aug = augment(d, min(lim, residue(v, d)));
			flow[v][d] += aug; flow[d][v] -= aug;
			res += aug; lim -= aug;
			if(lim == 0) break;
		}
		return res;
	}
};

typedef pair<int, int> Pii;

vector<int> RG[2][1010];
unordered_set<int> visit[2];

int a[10010];
int b[10010];
bool used[1010];

void dfs(int v, int gi) {
	used[v] = true;
	visit[gi].insert(v);
	for(int c : RG[gi][v]) {
		if(!used[c]) dfs(c, gi);
	}
}

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

	int N, M, S, T;
	while(cin >> N >> M >> S >> T, N) {
		S--, T--;
		Graph G(N);
		for(int i = 0; i < M; i++) {
			cin >> a[i] >> b[i];
			a[i]--, b[i]--;
			G[a[i]].push_back(Edge(a[i], b[i], 1, 1));
		}

		Dinic dinic(G);
		int flow = dinic.solve(S, T);

		for(int i = 0; i < N; i++) {
			RG[0][i].clear();
			RG[1][i].clear();
		}
		visit[0].clear();
		visit[1].clear();

		for(int u = 0; u < N; u++) {
			for(int v : dinic.g[u]) {
				if(dinic.residue(u, v) != 0) {
					RG[0][u].push_back(v);
					RG[1][v].push_back(u);
				}
			}
		}

		memset(used, 0, sizeof used);
		dfs(S, 0);
		memset(used, 0, sizeof used);
		dfs(T, 1);

		int num = 0;
		for(int i = 0; i < M; i++) {
			if(visit[0].find(b[i]) != visit[0].end() && visit[1].find(a[i]) != visit[1].end()) {
				num++;
			}
		}

		cout << flow + (num > 0) << " " << num << endl;
	}
}

Measured memory_bytes: 11884
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag,                    //if  using ll change ll to ll
        tree_order_statistics_node_update> pbset;
#define fob(x) find_by_order(x)

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	n%=10;
	if (n == 3)
		cout << "bon";
	else if (n == 0 || n == 1 || n == 6 || n == 8)
		cout << "pon";
	else
		cout << "hon";
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
using namespace std;
int main(){	
	string a;
	int i,x=0;
	cin>>a;
	for(i=0;i<3;i++){
		if(a[i]==a[i+1])x=1;
	}
	
	if(x==1)cout<<"Bad";
	else cout<<"Good";
}
	

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

int main() {
    long long n,a,b;
    cin >> n >> a >> b;
    if(b-a < 0 || (n == 1 && a != b)){
        cout << 0 << endl;
        return 0;
    }
    if(n == 1 && a == b){
        cout << 1 << endl;
        return 0;
    }

    if(n >= 2){
        cout << (b-a)*(n-2) + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Queue;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;



public class Main{
	
	static int posx;
	static int posy;
	static int type;
	static int diff;
	static int INF = Integer.MAX_VALUE;
	static int[][] d;
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 long N=sc.nextLong();
     Set<Long> list=new HashSet<Long>();
     
     for(long i=0;i<N;i++) {
    	 long temp=sc.nextLong();
    	 
    	 if(list.contains(temp)) {
    		 list.remove(temp);
    	 }else {
    		 list.add(temp);
    	 }
     }
     
     System.out.println(list.size());
 }
	


}


Measured memory_bytes: 64848
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  REP(i, n)
  {
    cin >> a[i];
  }
  REP(i, n)
  {
    cin >> b[i];
  }
  REP(i, n)
  {
    cin >> c[i];
  }
  sort(ALL(a));
  sort(ALL(b));
  sort(ALL(c));
  vector<ll> num(n, 0);
  vector<ll> ruiseki(n + 1);
  REP(i, n)
  {
    num[i] = std::distance(a.begin(), lower_bound(ALL(a), b[i]));
    ruiseki[i + 1] = ruiseki[i] + num[i];
  }
  ll res = 0;
  REP(i, n)
  {
    num[i] = ruiseki[std::distance(b.begin(), lower_bound(ALL(b), c[i]))];
    res += num[i];
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 4224
#include <iostream>

using namespace std;

int main()
{
	long long n, a, b;
	cin >> n >> a >> b;
	
	long long t, s, min = n;

	if (((a + b) % 2) == 0) {
		cout << b - (a + b) / 2 << endl;
	}
	else {
			t = (2 * n - b + 1) - ((2 * n - b + 1 + a) / 2);
			s = b - ((-a + 1 + b) / 2);
			if (min > t) {
				min = t;
			}
			if (min > s) {
				min = s;
			}
			if (min > n - a) {
				min = n - a;
			}
			if (min > b - 1) {
				min = b - 1;
			}
			cout << min << endl;
	}

	return 0;
}

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

#define rep(i, N) for(ll i = 0;i < N;i++)

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	ll x, y; cin >> x >> y;
	ll lxl = abs(x), lyl = abs(y);
	bool pos = (x >= 0);

	int ans = 0;
	if (lxl < lyl && !pos) {
		ans++;
		pos = true;
	}
	if (lxl > lyl&& pos) {
		ans++;
		pos = false;
	}

	ans += abs(lxl - lyl);

	if (pos && y < 0) {
		ans++;
	}
	if (!pos && y > 0) {
		ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	srand(time(NULL));
	std::chrono::system_clock::time_point start = std::chrono::system_clock::now();
	int nowtime=0;
	int TIMEMAX=2950;
	nowtime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start).count();
	int D,c[27],s[366][27];
	scan(D);
	rep(i,26) scan(c[i]);
	rep(i,D){
		rep(j,26){
			scan(s[i][j]);
		}
	}
	rep(i,D){
		prin(i%26+1);
	}
	return 0;
}


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

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

const int MAXSUM = 15'000;

void run() {
	int nrow, ncol;
	cin >> nrow >> ncol;
	vvi A(nrow, vi(ncol, 0LL));
	REP(i, nrow) REP(j, ncol) cin >> A[i][j];
	REP(i, nrow) REP(j, ncol) {
		int x;
		cin >> x;
		A[i][j] = abs(A[i][j] - x);
	}

	vector<bitset<MAXSUM*2>> canmake(ncol, bitset<MAXSUM*2>());
	REP(i, nrow) REP(j, ncol) {
		if (i == 0 && j == 0) {
			canmake[0].set(MAXSUM + A[i][j]);
			canmake[0].set(MAXSUM - A[i][j]);
			continue;
		}
		if (j > 0) canmake[j] |= canmake[j-1];
		canmake[j] = (canmake[j] << A[i][j]) | (canmake[j] >> A[i][j]);
	}

	int ans = 0;
	while (!canmake[ncol-1].test(MAXSUM + ans)) ans++;
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int a,b,k;
  cin >> a >> b >> k;
  int cnt = 0;
  REPR(i,min(a,b)){
    if(a%i==0 && b%i==0) cnt++;
    if(cnt==k){
      cout << i << endl;
      break;
    }
  }

}

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

static const int N = 100;
static const long long INFTY = (1 << 21);

int main() {
    int n, p[N + 1], m[N + 1][N + 1];
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i - 1] >> p[i];
    }

    for (int i = 1; i <= n; i++) {
        m[i][i] = 0;
    }
    for (int l = 2; l <= n; l++) {
        for (int i = 1; i <= n - l + 1; i++) {
            int j = i + l - 1;
            m[i][j] = INFTY;
            for (int k = i; k <= j - 1; k++) {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }

    cout << m[1][n] << endl;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
#define INF 0x7fffffff
typedef long long ll;
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pb push_back
#define enter printf("\n");
#define outn(x) std::cout<<(x)<<"\n";

#define Mem(x) memset(x,0,sizeof(x));

#define fori(x) for (int i = 0; i < (x); i++)
#define fori1(x) for (int i = 1; i <= (x); i++)
#define forj(x) for (int j = 0; j < (x); j++)
#define fork(x) for (int k = 0; k < (x); k++)
#define in(x) scanf("%d",&(x));
#define outc(x) printf("%c",(x));
#ifndef ONLINE_JUDGE
	#define out(x) std::cout<<#x" = "<<(x)<<std::endl;
	#define out2(x,y) std::cout<<#x" = "<<(x)<<" "<<#y" = "<<(y)<<std::endl;
	#define outset(x) for(auto ii8i: (x)) cout<<(ii8i)<<" ";outc(10);
	#define outarr(x,fir) for(int ii9i=0;ii9i<fir;ii9i++) cout<<(x)[ii9i]<<" ";outc(10)
	#define out2arr(x,fir,sec) fori(fir){ outarr((x)[i],sec) outc(10)}
#endif // ONLINE_JUDGE

#define outline(x) printf("%d%c",(x),i==N-1?10:32);
#define REP(i,a,b) for(register int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(register int i=(a),_end_=(b);i>=_end_;i--)
const double eps = 1e-9;
template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
using namespace std;
const int maxn=10+200000;
int T,l,N,M,x,y,t1,t2,t;

int main(){
	in(x)in(y)
		if(y>=x)
			printf("%d\n",x);
		else
			printf("%d\n",x-1);

}

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

a = [int(input()) for _ in range(n)]
l_new = sorted(a,reverse=True)
m = max(a)

b = a.count(m)

if b >= 2 :
    for i in range(n) :
        print(m)

else :
    for i in range(n) :
        if a[i] != m :
            print(m)
        else :
            print(l_new[1])


Measured memory_bytes: 19024