akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pii pair<ll,ll>
const int sz=1e5+7;
int main()
{
    boost;
    int n,x,ans=0;
    cin>>n;
    int arr[n];map<int,int> m1;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        m1[arr[i]]++;
    }
    for(int i=0;i<=sz;i++)
    {
        int p=m1[i+1];
        int q=m1[i-1];
        ans=max(ans,p+q+m1[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5376
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x[5];
    for(int i=0;i<5;i++){
        cin >> x[i];
    }
    
    for(int i=0;i<5;i++){
        if(x[i]==0){
            cout << i+1 << endl;
            break;
        }
    }
}


Measured memory_bytes: 3624
module Main where

import Data.Functor
import Data.List

main :: IO ()
main =  do
 { [n,m,l] <- getInts
 ; mat1 <- loop n
 ; mat2 <- loop m
 ; mapM_ printInts (mxm mat1 mat2)
 }

loop :: Int -> IO [[Int]]
loop 0 = return []
loop n = do
  { l <- getInts
  ; ls <- loop (n-1)
  ; return (l:ls)
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

printInts :: [Int] -> IO ()
printInts = putStrLn . unwords . map show

dot :: [Int] -> [Int] -> Int
dot = (sum .) . zipWith (*)

mxv :: [[Int]] -> [Int] -> [Int]
mxv m v = [dot v' v | v' <- m ]

mxm :: [[Int]] -> [[Int]] -> [[Int]]
mxm m m' = transpose [mxv m v | v <- m'']
  where
    m'' = transpose m'

Measured memory_bytes: 12268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const ll LINF = 1LL<<60;
const int MOD = 1e9+7;

const int mxN = 1001;

int h, w;
char grid[mxN][mxN];
int dp[mxN][mxN];

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    if (fopen("input.in", "r")) {
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }

    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
        }
    }

    dp[0][0] = 1;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (grid[i][j] == '#') continue;
            if (i+1 < h && grid[i+1][j] == '.') dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD;
            if (j+1 < w && grid[i][j+1] == '.') dp[i][j+1] = (dp[i][j+1] + dp[i][j]) % MOD;
        }
    }

    cout << dp[h-1][w-1]%MOD << endl;

    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	double r;
	double area;
	double cir;//circumference
	
	cin >> r;
	
	area = r*r*M_PI;
	cir = 2*r*M_PI;
	
	cout << fixed << area << " " << fixed << cir << " " ;
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3276
#include <iostream>
#include <vector>
#include <queue>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define INF 100000000
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;

struct state {
  int n, m, t;
  bool operator<(const state &s) const {
    return t > s.t;
  }
};

int N, M, L, K, A, H, V, X, Y, T;
bool P[200];
vector<pii> E[200];
int dp[200][200];

int main(void) {
  while(cin >> N >> M >> L >> K >> A >> H, N) {
    REP(i, 0, 200) P[i] = false;
    REP(i, 0, L) {
      cin >> V;
      P[V] = true;
    }

    REP(i, 0, 200) E[i].clear();
    REP(i, 0, K) {
      cin >> X >> Y >> T;
      E[X].push_back(pii(Y, T));
      E[Y].push_back(pii(X, T));
    }

    REP(i, 0, 200) REP(j, 0, 200) dp[i][j] = INF;
    priority_queue<state> q;
    q.push((state) { A, M, 0 });

    int ans = -1;
    while(q.size()) {
      state c = q.top();
      q.pop();

      if(c.n == H) {
        ans = c.t;
        break;
      }

      if(dp[c.n][c.m] <= c.t) continue;
      dp[c.n][c.m] = c.t;

      if(P[c.n] && c.m < M) q.push((state) { c.n, c.m + 1, c.t + 1 });
      REP(i, 0, E[c.n].size()) if(c.m >= E[c.n][i].se) {
        int nn = E[c.n][i].fi;
        int nm = c.m - E[c.n][i].se;
        int nt = c.t + E[c.n][i].se;
        if(dp[nn][nm] > nt) q.push((state) { nn, nm, nt });
      }
    }

    if(ans == -1) cout << "Help!" << endl;
    else cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 4128
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a, b = nm()

print(max([a + b, a - b, a * b]))

Measured memory_bytes: 3700
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <sstream>
#include <climits>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef pair<int, int> pii;
/*
bool memo[1000000] = {};
vector<int> pri;

void calc()
{
	for (int i = 2; i < 1000000; i++)
	{
		if (memo[i] == false)
		{
			pri.push_back(i);
			for (int l = i; l < 1000000; l += i)
			{
				memo[l] = true;
			}
		}
	}
}
*/
int main()
{
	double a;
	while (cin >> a)
	{
		printf("%.7lf\n", 633.0 / 81 * a);
	}
}

Measured memory_bytes: 1236
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
#define F first
#define S second
constexpr auto INF = 1000000000;
constexpr auto LLINF = 9223372036854775807;
constexpr auto mod = 1000000007;
int main() {

	int n;
	string s;
	cin >> n >> s;
	map<char, int> m;
	FOR(i, n)m[s[i]]++;
	ll ans = 1;
	for (auto itr = m.begin(); itr != m.end(); itr++) {
		if (itr->second > 0) {
			ans *= itr->second + 1;
			ans %= 1000000007;
		}
	}
	cout << ans - 1 << endl;

	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
    int a,b,c,t;

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

    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    if (c < a){
        t = c;
        c = b;
        b = a;
        a = t;
    }
    else if (c >= a && b > c){
        t = c;
        c = b;
        b = t;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}



Measured memory_bytes: 2104
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
typedef pair<int, P> T;

int s[1000];
int n,m,h,k;
int order[1000];
int num[1000];
int main() {
while(1){
	vector<int> path[1000];
	vector<int> p[1000];
	scanf("%d%d%d%d",&n,&m,&h,&k);
	if(n==0)return 0;
	for(int i=0;i<n;i++){
		scanf("%d",s+i);
		order[i]=i;
	}
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		p[b].push_back(a);
	}
	for(int i=1;i<h;i++){
		for(auto j:p[i]){
			path[order[j]].push_back(order[j-1]);
			path[order[j-1]].push_back(order[j]);
			swap(order[j],order[j-1]);
		}
	}
	for(int i=0;i<n;i++){
		num[order[i]]=s[i];
	}
	/*
	for(int i=0;i<n;i++){
		cout << num[i] << ", " ;
	}
	cout << endl;
	*/
	priority_queue<T> q;
	int sum=0;
	int ret=INT_MAX;
	for(int i=0;i<k;i++){
		sum+=num[i];
		for(auto j:path[i]){
			if(num[i]>num[j]){
				q.push(T(num[i]-num[j],P(i,j)));
			}
		}
		if(i==k-1){
			while(q.size()){
				auto t=q.top();
				if(t.second.first<i-k+1){
					q.pop();
					continue;
				}
				if(i-k-1<=t.second.second&&t.second.second<=i){
					q.pop();
					continue;
				}
				/*
				if(sum-t.first==70){
					cout << sum << ", " << i << ", " << t.second.first << ", " << t.second.second << ", " << t.first << endl;
				}*/
				ret=min(ret,sum-t.first);
				break;
			}
			ret=min(ret,sum);
			sum-=num[i-k+1];
			for(auto j:path[i-k+1])
			{
				if(num[j]>num[i-k+1]&&i-k-1<j&&j<=i){
					q.push(T(num[j]-num[i-k-1],P(j,i-k+1)));
				}
			}
		}
	}
	printf("%d\n",ret);
}
}

Measured memory_bytes: 3756
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
// U    0
//L R  3 1
// D    2
int n;
char d[200][200];
int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
void ff(int y,int x,int dir){
	d[y][x]=' ';
	if(d[y+dy[dir]*2][x+dx[dir]*2]=='#'&&y+dy[dir]*2>=0&&y+dy[dir]*2<n&&x+dx[dir]*2>=0&&x+dx[dir]*2<n)
		ff(y+dy[dir],x+dx[dir],dir);
	else
	if(d[y+dy[(dir+1)%4]][x+dx[(dir+1)%4]]!=' '&&d[y+2*dy[(dir+1)%4]][x+2*dx[(dir+1)%4]]=='#'){
		ff(y+dy[(dir+1)%4],x+dx[(dir+1)%4],(dir+1)%4);
	}
}
int main(){
	int s;
	cin>>s;
	while(s--){
		cin>>n;
		rep(i,n)
		rep(j,n)
		d[i][j]='#';
		ff(n-1,1,0);
		rep(i,n){
		rep(j,n)
			cout<<d[i][j];
			cout<<endl;
		}
		if(s!=0)
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <queue>

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> v(n);
    for (int i = 0; i < n; i++) {
        int m;
        cin >> m;
        for (int j = 0; j < m; j++) {
            int c;
            cin >> c;
            v[i].push_back(c);
        }
    }

    ll ret = 0;
    priority_queue<int> que;
    for (int i = n - 1; i >= 0; i--) {
        for (auto x:v[i])que.push(x);
        ret += que.top();
        que.pop();
    }

    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 19120
#include<cstdio>
#include<cstring>
#include<vector>
static const int kMax = 16001;
using namespace std;

int CoordinateToId(int coordinate){
	return coordinate + 8000;
}

int main(){
	bool is_accessible_x[kMax];
	bool is_accessible_y[kMax];
	for (int i = 0; i < kMax; ++i) {
		is_accessible_x[i] = false;
		is_accessible_y[i] = false;
	}
	is_accessible_x[CoordinateToId(0)] = is_accessible_y[CoordinateToId(0)] = true;
	char s[8010];
	int begin, end = 0;
	scanf("%s", s);
	if(s[0] == 'F'){
		while(s[end] == 'F') end++;
		is_accessible_x[CoordinateToId(0)] = false;
		is_accessible_x[CoordinateToId(end)] = true;
	}
	begin = end;
	while(end < strlen(s)) {
		while(s[end] == 'T') end++;
		if(end == strlen(s)) break;
		static int nmbr_of_T = 0;
		nmbr_of_T += end - begin;
		begin = end;
		while(s[end] == 'F') end++;
		int nmbr_of_F = end - begin;
		begin = end;
		if(nmbr_of_T % 2 == 0){
			vector<int> accessible_x;
			for(int i = 0; i < kMax; ++i){
				if(is_accessible_x[i]){
					accessible_x.push_back(i);
					is_accessible_x[i] = false;
				}
			}
			for(vector<int>::iterator it = accessible_x.begin(); it != accessible_x.end(); ++it){
				is_accessible_x[*it + nmbr_of_F] = true;
				is_accessible_x[*it - nmbr_of_F] = true;
			}
			accessible_x.clear();
		} else {
			vector<int> accessible_y;
			for(int i = 0; i < kMax; ++i){
				if(is_accessible_y[i]){
					accessible_y.push_back(i);
					is_accessible_y[i] = false;
				}
			}
			for(vector<int>::iterator it = accessible_y.begin(); it != accessible_y.end(); ++it){
				is_accessible_y[*it + nmbr_of_F] = true;
				is_accessible_y[*it - nmbr_of_F] = true;
			}
			accessible_y.clear();
		}
	}
	int x, y;
	scanf("%d %d", &x, &y);
	if(is_accessible_x[CoordinateToId(x)] && is_accessible_y[CoordinateToId(y)])
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
int n;
char op[15], s[15];
map<ll,int> mp;
ll parse(char *s)
{
    ll sum=0;
    int sub=0;
    int flag=1;
    while(flag)
    {
        char c=*s++;

        switch(c)
        {
        case 'A':
        {
            sub=1;
            break;
        }
        case 'C':
        {
            sub=2;
            break;
        }
        case 'G':
        {
            sub=3;
            break;
        }
        case 'T':
        {
            sub=4;
            break;
        }
        default:
        {
            flag=0;
            break;
        }
        }
        sum=5*sum+sub;
    }
    return sum;
}
int main()
{
//    freopen("in.txt","r",stdin);
    scanf("%d",&n);
    while(n--)
    {
        getchar();
        scanf("%s%s",op,s);
        ll key=parse(s);
        switch(op[0])
        {
        case 'i':
        {
            mp[key]=1;
            break;

        }
        case 'f':
        {
            if(1==mp[key]) printf("yes\n");
            else printf("no\n");
            break;
        }
        }
    }

    return 0;
}

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

void solve(long long L) {
  double side = L / 3.0;
  cout << setprecision(10) << side * side * side << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long L;
  scanf("%lld", &L);
  solve(L);
  return 0;
}


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

int main() {
  int n, a[210], c=0;
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  while(true) {
    for(int i = 0; i < n; i++) {
      if(a[i] % 2 == 0){
     	a[i] /= 2;
      }else{
    	cout << c << endl;
    	return 0;
      }
    }
    c++;
  }
}
  


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
  solve(sc)
}

fun solve(sc: java.util.Scanner) {
  val A = sc.nextInt()
  val B = sc.nextInt()
  val C = sc.nextInt()
  println(if (A + B >= C) "Yes" else "No")
}


Measured memory_bytes: 31260
/*
I am not somebody you can put inside a box
And I am not somebody who will let you take my spot
It's written on my face I'm somebody who never stop
I do it because I gotta I don't do it for you props
Nah, you can keep those
I'm aiming way higher than planes in Heathrow
And I'm sorry to say but my game can't be sold
And look to be honest either you got it or don't
But if you got a dream and a vision
Put it in your mind that you gotta go out and get it
People try to stop you it's so hard in the beginning
But you said that you a winner so keep going ain't no quiting
I'm giving you the words that out me in this posotion
Some people hear and some people listen
Wanna be the best then you gotta learn the difference
*/
#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 int long long	
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define ll long long
#define vi vector < int >
#define pii pair < int, int > 
#define sz(s) (int)s.size()
#define all(x) x.begin(), x.end()                                                                    
#define pb push_back   
#define ppb pop_back
#define mp make_pair
#define s second
#define f first                                               
	
   
typedef tree < int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > ordered_set;   
   
const int N = 2e5 + 13, inf = 1e9, mod = 1e9 + 7, block = 444;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
const ll INF = 1e18;
//fucking constants
 

string s;
int n; 

main () {
	cin >> s;
	for (auto c : s)
		n += (c - '0');

	if (n % 9)
		cout << "No";
	else
		cout << "Yes";
}

Measured memory_bytes: 3684
def main
  loop do
    str,pattern = gets.chomp.split(' ')
    break if pattern.eql?('X')

    case pattern
    when 'U'
      puts conversion_to_upper_camel_case(str)
    when 'L'
      puts conversion_to_lower_camel_case(str)
    when 'D'
      puts conversion_to_snake_case(str)
    end
  end
end

def split_word str
  words = []
  word = ''
  str.length.times do |i|
    if str[i].match(/_/)
      words << word
      word = ''
    elsif str[i].match(/[A-Z]/)
      words << word unless i == 0
      word = str[i]
    else
      word << str[i]
    end
  end
  words << word
  words
end

def conversion_to_upper_camel_case str
  words = split_word(str)
  words.map{|word|word.capitalize}.join
end

def conversion_to_lower_camel_case str
  conversion_word = ''
  words = split_word(str)
  words.each_with_index do |word, i|
    if i == 0
      conversion_word << word.downcase
    else
      conversion_word << word.capitalize
    end
  end
  conversion_word
end

def conversion_to_snake_case str
  words = split_word(str)
  words.each.map{|word|word.downcase}.join('_')
end

main

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

using namespace std;

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;

#define rep(i,a,b) for(int i =a;i<b;i++)


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

    int n; cin>>n;

    int arr[n][3];

    rep(i, 0, n){
        rep(j, 0, 3){
            cin>>arr[i][j];
        }
    }

    int dp[n][3] = {0};

    rep(i, 0 , 3){
        dp[0][i]= arr[0][i];
    }

    rep(t, 1, n){

        rep(i, 0 , 3){
            rep(j, 0, 3){
                if(i!= j){
                    dp[t][i] = max(dp[t][i], dp[t-1][j]+ arr[t][i]);
                }
            }
        }
    }

    cout<<*max_element(dp[n-1], dp[n-1]+3)<<endl;


    return 0 ;
}



Measured memory_bytes: 5884
import java.util.*;

class Main {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
    
    int A = sc.nextInt();
    int B = sc.nextInt();
    int H = sc.nextInt();
    int M = sc.nextInt();

    //時間合計
    int th = 60*H + M;
    //時間の角度
    double hr =  th*0.5;
    //分の角度
    double mr = (th%60)*6;
    //角度（小さいほう）

    double r = Math.abs(hr-mr);

    if (r > 180){
      r = 360 - r;
    }
	
    double ans;
    ans = Math.sqrt(A*A+B*B-2*A*B*Math.cos(Math.toRadians(r)));

    System.out.println(ans);


  }
}


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

using namespace std;

#define ll long long

void solve() { 

  string s, t;
  cin >> s >> t;
  int mn = INT_MAX;
  for(int i = 0; i + t.length() <= s.length(); i++) {
    int cur = 0;
    for(int j = 0; j < t.length(); j++) {
      if(s[i + j] != t[j]) cur++;
    }
    mn = min(mn, cur);
  }   
  cout << mn;
  return; 
}

int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  int t = 1;
  // cin >> t;
  while (t--) solve();
  return 0;
}

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

namespace D3
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] As = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int max = As.Max();
            int[] unique = new int[max+1];

            foreach(int a in As)
            {
                for(int i = 1; i * a <= max; i++)
                {
                    unique[i * a] += 1;
                    
                }
            }
            int cnt = 0;
            foreach(int a in As)
            {
                if(unique[a] == 1)
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }
    }
}


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

#define ll long long

const int bzmax = 60;

typedef class LinearBasis {
  public:
    ll a[bzmax];
  
    void insert(ll x) {
      for (int i = bzmax; i-- && x; ) {
        if ((x >> i) & 1) {
          x ^= a[i];
        }
        if ((x >> i) & 1) {
          a[i] = x;
          break;
        }
      }
    }
    bool query(ll x) {
      for (int i = bzmax; i-- && x; ) {
        if ((x >> i) & 1) {
          x ^= a[i];
        }
      }
      return !x;
    }
    
    void reset() {
      memset(a, 0, sizeof(a));
    }
} LinearBasis;

const int N = 205;

int T, n;
ll a[N];
char s[N];
LinearBasis lb;

void solve() {
  lb.reset();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  scanf("%s", s + 1);
  for (int i = n; i; i--) {
    if (s[i] == '1') {
      if (!lb.query(a[i])) {
        puts("1");
        return;
      }  
    } else {
      lb.insert(a[i]);
    }
  }
  puts("0");
}

int main() {
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
#define    ss   second
#define    ff   first
#define    pb   push_back
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
#define FIO ios_base::sync_with_stdio(false);  cin.tie(NULL);


int main() {
    FIO;
   double r;
   cin >> r;
   cout <<fixed << setprecision(15) << 2 * pi * r << endl;
   return 0;
}



Measured memory_bytes: 3792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    cout << s1[0] << s2[0] << s3[0];
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x_dire = {0,0,-1,1};
vector<int> y_dire = {-1,1,0,0};
int main(){
    int h,w;
    cin >> h >> w;
    int sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    sx--;
    sy--;
    gx--;
    gy--;
    vector<vector<char>> field(h,vector<char>(w));
    rep(i,0,h){
        rep(j,0,w){
            cin >> field[i][j];
        }
    }
    vector<vector<int>> cnt(h,vector<int>(w,-1));
    queue<pair<int,int>> cities;
    queue<pair<int,int>> next_cities;
    cities.push(make_pair(sx,sy));
    cnt[sx][sy]=0;
    int n = 0;
    //int ans = -1;
    while(!next_cities.empty()||n==0){
        if(n!=0){
            //cities = next_cities;
            while(!next_cities.empty()){
                int x = next_cities.front().first;
                int y = next_cities.front().second;
                if(cnt[x][y]==-1){
                    cities.push(make_pair(x,y));
                    cnt[x][y]=n;
                }
                next_cities.pop();
            }
        }
        
        while(!cities.empty()){
            int now_x = cities.front().first;
            int now_y = cities.front().second;
            //cout<<now_x<<now_y<<endl;
            cities.pop();
            // if(gx==now_x&&gy==now_y){
            //     ans = n;
            // }
            rep(i,0,4){
                int new_x = now_x+x_dire[i];
                int new_y = now_y+y_dire[i];
                if(new_x>=0&&new_x<h&&new_y>=0&&new_y<w){
                    if(field[new_x][new_y]=='.'&&cnt[new_x][new_y]==-1){
                        cities.push(make_pair(new_x,new_y));
                        cnt[new_x][new_y]=n;
                    }
                }
                
            }
            rep(i,-2,3){
                rep(j,-2,3){
                    int new_x = now_x+i;
                    int new_y = now_y+j;
                    if(new_x>=0&&new_x<h&&new_y>=0&&new_y<w){
                        if(field[new_x][new_y]=='.'&&cnt[new_x][new_y]==-1){
                            next_cities.push(make_pair(new_x,new_y));
                            //cout<<new_x<<new_y<<endl;
                            //cnt[new_x][new_y]=n;
                        }
                    }

                }
            }

            
        }
        n++;
    }
    cout<<cnt[gx][gy]<<endl;
    
    
    

}

Measured memory_bytes: 8888
N = int(input())
dp = [i for i in range(N + 1)]

for i in range(N + 1):
    index = 1
    while 6 ** index <= i:
        dp[i] = min(dp[i], dp[i - (6 ** index)] + 1)
        index += 1

    index = 1
    while 9 ** index <= i:
        dp[i] = min(dp[i], dp[i - (9 ** index)] + 1)
        index += 1

print(dp[N])

Measured memory_bytes: 12688
import numpy as np

def main():
    c = np.array([list(map(int, input().split())) for i in range(3)])

    for i in range(3):
        c[i] -= min(c[i])
    
    for i in range(3):
        c[:,i] -= min(c[:,i])
    
    if np.sum(c) == 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


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

int main()
{
    int A,B,C;

    cin >> A >> B >> C;
    if((A+B+C) >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def solve(height, width, h, w)
  height * width - (h * width + w * height - h * w)
end

def each_case(sin)
  height, width = sin.gets.chomp.split(" ").map(&:to_i)
  while ln = sin.gets
    h, w = ln.chomp.split(" ").map(&:to_i)
    yield height, width, h, w
  end
end

each_case(STDIN) do |*args|
  puts solve(*args).to_s
end




Measured memory_bytes: 1788
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int A=sc.nextInt(), B=sc.nextInt();
    if(A%2== B%2) System.out.println((A+B)/2);
    else System.out.println("IMPOSSIBLE");
  }
}

Measured memory_bytes: 35652
let () = Scanf.scanf "%d %d" @@ fun l r ->
  Printf.printf "%d\n" @@
  if
    l = 0 ||
    1 <= r / 673 - (l - 1) / 673 &&
    1 <= r / 3 - (l - 1) / 3
  then 0
  else
    Array.fold_left (Array.fold_left min) max_int @@
    Array.init (r - l + 1) @@ fun i ->
      Array.init (r - l + 1) @@ fun j ->
        let i = i + l in
        let j = j + l in
        if j <= i
        then max_int
        else (i * j) mod 2019



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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT

using ll = long long;
using ii = pair<int, int>;
using ld = long double;
using D = double;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using vs = vector<string>;

template<typename T> T abs (T x) { re x < 0 ? -x : x; }
template<typename T> T sgn (T x) { re x < 0 ? -1 : (x > 0 ? 1 : 0); }
template<typename T> T sqr (T x) { re x * x; }
template<typename T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }

const int mod = 1000*1000*1000+7;

int n;
int m;
int x[100001];
int rev[100001];
int f[100001];
int rf[100001];

int power (int a, int b) {
	int c = 1;
	while (b) {
		if (b & 1) c = ((ll)c * a) % mod;
		a = ((ll)a * a) % mod;
		b /= 2;
	}
	re c;
}

int cnk (int n, int k) {	
	if (n < 0 || k < 0 || k > n) re 0;
	re ((ll)f[n] * rf[k]) % mod * rf[n - k] % mod;
}

int main () {
	f[0] = rf[0] = 1;
	for (int i = 1; i <= 100000; i++) {
		f[i] = ((ll)f[i - 1] * i) % mod;
		rf[i] = power (f[i], mod - 2);
	}
	scanf ("%d", &n);
	for (int i = 0; i < n; i++) scanf ("%d", &x[i]);
	int sum = 0;
	rev[0] = 0;
	for (int i = 1; i <= n; i++) {
		sum = (sum + power (i, mod - 2)) % mod;
		rev[i] = sum;
	}
	int ans = 0;
	for (int i = 0; i < n; i++)	{
		ans = (ans + (ll)(rev[i + 1] + rev[n - i] - 1) * f[n] % mod * x[i]) % mod; 
	}	
	printf ("%d\n", ans);
	return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/10/22  Problem: codefestival2017_qual_b D  / Link:   ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;
struct info {
	vector<int>c[26];
	int ok = 0;
};
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string s;
	cin >> s;
	int state = 0;
	VI dp(1 << 26, INF);
	dp[0] = 0;
	FOR(i, 0, SZ(s)) {
		state ^= 1 << (s[i] - 'a');
		dp[state] = dp[state]; //%2==0
		FOR(j, 0, 26) {// %2==1
			int temp = (state ^ (1 << j));
			dp[state] = min(dp[state], dp[temp] + 1);
		}
	}
	cout << (dp[state] ? dp[state] : 1) << endl;

	return 0;
}

Measured memory_bytes: 262804
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x; cin >> n >> x;
    vector<ll> xs(n);
    rep(i, n) cin >> xs[i];
    sort(ALL(xs));
    vector<ll> diff(n);
    rep(i, n) diff[i] = abs(xs[i]-x);
    ll g = gcd(diff[0], diff[1]);
    for (int i=2; i<n; ++i) g = gcd(g, diff[i]);
    cout << g << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
#define F first
#define S second
const int MAX_N = 1<<18;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> P;
 
int n;
int minX[2*MAX_N-1],maxX[2*MAX_N-1];
int minY[2*MAX_N-1],maxY[2*MAX_N-1];
 
struct Data{
    int x,y,b;
    Data(){}
    Data(int x,int y,int b) : x(x),y(y),b(b) {}
    bool operator < (const Data &d)const{
        return b < d.b;
    }
};
 
void init(ll n_){
    n = 1;
    while(n < n_) n *= 2;
    for(int i = 0 ; i < 2*n-1 ; i++){
        minX[i] = minY[i] = INT_MAX;
        maxX[i] = maxY[i] = INT_MIN;
    }
}
 
void update(int k,pii p){
    k += n - 1;
    minX[k] = min(minX[k],p.first);
    maxX[k] = max(maxX[k],p.first);
    minY[k] = min(minY[k],p.second);
    maxY[k] = max(maxY[k],p.second);
    while(k > 0){
        k = (k - 1) / 2;
        minX[k] = min(minX[2*k+1],minX[2*k+2]);
        maxX[k] = max(maxX[2*k+1],maxX[2*k+2]);
        minY[k] = min(minY[2*k+1],minY[2*k+2]);
        maxY[k] = max(maxY[2*k+1],maxY[2*k+2]);
    }
}
 
P query(int a,int b,int k,int l,int r){
    if(r <= a || b <= l){
        return P(pii(INT_MAX,INT_MIN),pii(INT_MAX,INT_MIN));
    }
    if(a <= l && r <= b){
        return P(pii(minX[k],maxX[k]),pii(minY[k],maxY[k]));
    }else{
        P vl = query(a,b,2*k+1,l,(l+r)/2);
        P vr = query(a,b,2*k+2,(l+r)/2,r);
        return P(pii(min(vl.F.F,vr.F.F),max(vl.F.S,vr.F.S)),
                 pii(min(vl.S.F,vr.S.F),max(vl.S.S,vr.S.S)));
    }
}
 
ll getArea(P p){
    return (ll)(p.F.S-p.F.F)*(ll)(p.S.S-p.S.F);
}
 
int main(){
    int N,d,x,y,b;
    cin >> N >> d;
    vector<Data> v(N);
    for(int i = 0 ; i < N ; i++){
        cin >> x >> y >> b;
        v[i] = Data(x,y,b);
    }
    sort(v.begin(),v.end());
    init(N);
    for(int i = 0 ; i < N ; i++){
        update(i,pii(v[i].x,v[i].y));
    }
    ll res = 0;
    for(int i = 0, j = 0 ; i < N ; i++){
        int s = v[i].b, t = v[j].b;
        while(j < N && t - s <= d) j++, t = v[j].b;
        j--;
        P p = query(i,j+1,0,0,n);
        res = max(res,getArea(p));
    }
    cout << res << endl;
    return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    int h[n];
    rep(i,n) cin >> h[i];
    long long dp[110000];
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        dp[i] = INF;
        for (int j = 1; j <= k; j++) {
            if (i-j < 0) {
                continue;
            }
            dp[i] = min(dp[i-j] + abs(h[i-j] - h[i]), dp[i]);
        }
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 4760
#include <iostream>

using namespace std;

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

    if(S == "Sunny"){
        cout << "Cloudy";
    }
    else if(S == "Cloudy"){
        cout << "Rainy";
    }
    else if(S == "Rainy"){
        cout << "Sunny";
    }
}


Measured memory_bytes: 256
x1,a1,b1=input().split()
x2,a2,b2=input().split()
x3,a3,b3=input().split()
x4,a4,b4=input().split()
x5,a5,b5=input().split()
x6,a6,b6=input().split()
x7,a7,b7=input().split()
x8,a8,b8=input().split()
x9,a9,b9=input().split()

a1=int(a1)
a2=int(a2)
a3=int(a3)
a4=int(a4)
a5=int(a5)
a6=int(a6)
a7=int(a7)
a8=int(a8)
a9=int(a9)

b1=int(b1)
b2=int(b2)
b3=int(b3)
b4=int(b4)
b5=int(b5)
b6=int(b6)
b7=int(b7)
b8=int(b8)
b9=int(b9)

def cal(a,b):
    m=a+b
    n=a*200+b*300
    return m,n

m1,n1=cal(a1,b1)
m2,n2=cal(a2,b2)
m3,n3=cal(a3,b3)
m4,n4=cal(a4,b4)
m5,n5=cal(a5,b5)
m6,n6=cal(a6,b6)
m7,n7=cal(a7,b7)
m8,n8=cal(a8,b8)
m9,n9=cal(a9,b9)


print(x1,m1,n1)
print(x2,m2,n2)
print(x3,m3,n3)
print(x4,m4,n4)
print(x5,m5,n5)
print(x6,m6,n6)
print(x7,m7,n7)
print(x8,m8,n8)
print(x9,m9,n9)


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
    if (b <= 0) { return 1; } if (b == 1) { return a % mod; } if (b == 2) { return (a * a) % mod; }
    return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) % mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
    return (a * mpow(b, mod - 2, mod)) % mod;
}

int main() {
    int n; cin >> n;
    int64_t ans = 1;
    while (n--) {
        int64_t t; cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3620
#include <iostream>
#include <queue>
#include <tuple>
#include <algorithm>

using namespace std;

int main() {

	int n, m;
	cin >> n >> m;

	if (n == m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

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

int main(void){
  int N; cin >> N;
  N--;
  vector<int> B(N);
  vector<int> A(N+1);
  for(int i = 0; i < N; i++) cin >> B[i];
  A[0] = B[0];
  for(int i = 0; i < (int)B.size(); i++){
    A[i+1] = min(B[i], B[i+1]);
  }
  A[N] = B[N-1];
  int ans = 0;
  for(int i = 0; i < N+1; i++){
    ans += A[i];
  }
  cout << ans << endl;
}


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

void lcs(int x, int y, string s1, string s2){
    
    vector<vector<int>> dp(x+1,vector<int>(y+1));
    for(int i=0;i<=y;i++){
        dp[0][i] = 0;    
    }
    for(int i=0;i<=x;i++){
        dp[i][0] = 0;
    }
    for(int i=1;i<=x;i++){
        for(int j=1;j<=y;j++){
            if(s1[i-1]==s2[j-1]){
                dp[i][j] = 1 + dp[i-1][j-1];
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }    
        }
    }
    int i=x,j=y;
    string ans = "";
    while(i>0 && j>0){
        if((s1[i-1] == s2[j-1]) && dp[i][j] == (dp[i-1][j-1]+1)){
            ans += s1[i-1];
            i--;
            j--;
        }else if(dp[i][j] == dp[i-1][j]){
            i--;
        }else{
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}


int main(){
    string s1,s2;
    cin>>s1;
    cin>>s2;
    int x = s1.length();
    int y = s2.length();
    lcs(x,y,s1,s2);
}



Measured memory_bytes: 35584
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)
	passwordMap := map[string]bool{}
	var count int
	iMap := map[string]bool{}
	for i := 0; i < n-2; i++ {
		if len(iMap) == 10 {
			break
		}
		if iMap[s[i:i+1]] {
			continue
		}
		iMap[s[i:i+1]] = true

		jMap := map[string]bool{}
		for j := i + 1; j < n-1; j++ {
			if len(jMap) == 10 {
				break
			}
			if jMap[s[j:j+1]] {
				continue
			}
			jMap[s[j:j+1]] = true

			kMap := map[string]bool{}
			for k := j + 1; k < n; k++ {
				if len(kMap) == 10 {
					break
				}
				password := s[i:i+1] + s[j:j+1] + s[k:k+1]
				if passwordMap[password] {
					continue
				}
				kMap[s[k:k+1]] = true
				passwordMap[password] = true
				count++
			}
		}
	}
	fmt.Println(count)
}


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

int main(){
    int N;
    cin >> N;
    ll ans = 1;
    vector<ll> a(N);
    rep(i, N){
        cin >> a[i];
        ans *= a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    ll an = ans;
    rep(i, N){
        an /= a[i];
    }
    if(ans > 1000000000000000000){
        cout << -1 << endl;
        return 0;
    }

    if(an == 1){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 4040
#include <iostream>
#include <cstdio>

using namespace std;

typedef struct{
	int a;
	int v;
}member;

void swap(int *x, int *y){
	int temp=*x;
	*x=*y;
	*y=temp;
}

int main(){
	int n, max=0;
	member m[20];
	
	cin >> n;
	for(int i=0; i<n; ++i){
		scanf(" %d %d", &m[i].a, &m[i].v);		
		if(max < m[i].v) max=m[i].v;
	}
	
	for(int i=0; i<n; ++i){
		for(int j=i; j<n; ++j){
			if(m[i].v < m[j].v){
				swap(&m[i].a, &m[j].a);
				swap(&m[i].v, &m[j].v);
			}
		}
	}

	int count=0;
	for(int i=0; i<n; ++i)
		if(max==m[i].v) ++count;

	int index=0;
	for(int i=0; i<count; ++i)
		if(m[index].a > m[i].a) index = i;

	printf("%d %d\n", m[index].a, m[index].v);

	return 0;
}

Measured memory_bytes: 1224
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#define inf pow(10, 9)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

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

int main() {
  int N;
  ci(N);
  ve<int> a(N);
  rep(i, N){
    ci(a.at(i));
  }
  int ans = 0, c = 1;
  rep(i, N - 1){
    if(a.at(i) == a.at(i + 1)){
      c ++;
    }
    else{
      ans += c / 2;
      c = 1;
    }
  }
  ans += c / 2;
  co(ans);
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;

struct pq {
    INT64 val;
    int i;
    int j;
    int k;

    bool operator<(const pq& lhs) const{
        return val < lhs.val;
    }
    
    bool operator==(const pq& lhs) const {
        if (i != lhs.i) return false;
        if (j != lhs.j) return false;
        if (k != lhs.k) return false;
        return true;
    }
    
};

int main(void)
{
    IOS
    //const int KMAX = 3000;
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<INT64> a(x), b(y), c(z);
    REP(x) cin >> a[i];
    REP(y) cin >> b[i];
    REP(z) cin >> c[i];

    sort(RALL(a));
    sort(RALL(b));
    sort(RALL(c));
    
    //int ai , bi , ci = 0;
    priority_queue<pq> p;
    vector<pq> v;
    int ki = 0;
    pq f = {a[0]+b[0]+c[0],0,0,0};
    p.push(f);

    pq top;
    pq tmp;
    while(ki < k) {
        top = p.top();
        p.pop();ki++;
        cout << top.val << endl;

        if (top.i < x-1) {
            tmp = {a[top.i+1]+b[top.j]+c[top.k],top.i+1,top.j,top.k};
            auto itr = find(ALL(v),tmp);
            if (itr == v.end()) {
                //cerr << "i:" << aq.i << " j:" << aq.j << " k:" << aq.k << endl;
                v.emplace_back(tmp);
                p.emplace(tmp);
            }
        }
        if (top.j < y-1) {
            tmp = {a[top.i]+b[top.j+1]+c[top.k],top.i,top.j+1,top.k};
            auto itr = find(ALL(v),tmp);
            if (itr == v.end()) {
                //cerr << "i:" << bq.i << " j:" << bq.j << " k:" << bq.k << endl;
                v.emplace_back(tmp);
                p.emplace(tmp);
            }
        }
        if (top.k < z-1) {
            tmp = {a[top.i]+b[top.j]+c[top.k+1],top.i,top.j,top.k+1};
            auto itr = find(ALL(v),tmp);
            if (itr == v.end()) {
                //cerr << "i:" << cq.i << " j:" << cq.j << " k:" << cq.k << endl;
                v.emplace_back(tmp);
                p.emplace(tmp);
            }
        }
        //cerr << p.size() << endl;
    }


    return 0;
}


Measured memory_bytes: 768
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

ll S;

int main() {
  cin >> S; 
  int n = (int)log10(S) + 1;
  vector<int> A;
  for(int i=n-1;i>=0;i--){
    A.push_back(S/((int)pow(10,i)));
    S = S - S/((int)pow(10,i))* pow(10,i);
  }
  ll a=0;
  vector<int> SS;
  for (int bit = 0; bit < (1<<(n-1)); ++bit) {
    ll ans =0;
    ll curr = 0;
    for (int i = 0; i < n; ++i) {
      curr = curr*10+A[i];
      if (bit & (1<<i)||i==n-1) { // i が bit に入るかどうか
	ans += curr;
	curr = 0;
      }
    }
    a+=ans;
  }
  cout << a << endl;
}


Measured memory_bytes: 888
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
using namespace std;
typedef long long ll;

int main(){
    int Q;cin>>Q;
    ll a,b,ans;
    for(int q=0;q<Q;q++){
        cin>>a>>b;
        ll c=a*b;
        ll root=sqrt(c)/1;
        if(pow(root,2)==c){
            if(a==b)ans=2*(root-1);
            else ans=2*root-3;
        }
        else if(root*(root+1)<c)ans=2*root-1;
        else ans=2*(root-1);
        
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B;
  cout << (B-A)*(B-A-1)/2-A << endl;


}


Measured memory_bytes: 256