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

const long long MOD = 1e9 + 7;

long long modpow(long long a, long long n, long long mod) {
    if (n == 0) return 1;
    if (n == 1) return a % mod;
    
    if (n % 2 == 0) {
        long long half = modpow(a, n / 2, mod) % mod;
        return half * half % mod;
    }
    else return modpow(a, 1, mod) * modpow(a, n - 1, mod) % MOD;
}

int main() {
    long long n, x, y, z;
    cin >> n >> x >> y >> z;
    
    int l = x + y + z - 1;
    vector<vector<long long>> dp(n + 1, vector<long long>(1 << l));
    dp.at(0).at(0) = 1;

    long long xyz = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));
    long long mask = (1 << l) - 1;
    
    for (long long i = 1; i <= n; i++) {
        for (long long j = 1; j <= 10; j++) {
            for (long long bit = 0; bit < 1 << l; bit++) {
                long long b = ((bit << j) | (1 << (j - 1)));
                if ((b & xyz) == xyz) continue;
                dp.at(i).at(b & mask) += dp.at(i - 1).at(bit);
                dp.at(i).at(b & mask) %= MOD;
            }
        }
    }

    long long sum = 0;
    for (long long i = 0; i < 1 << l; i++) {
        sum += dp.at(n).at(i);
        sum %= MOD;
    }
    long long ans = modpow(10, n, MOD) - sum;
    if (ans < 0) ans += MOD;
    
    cout << ans << endl;
}

Measured memory_bytes: 21888
// https://atcoder.jp/contests/agc026/tasks/agc026_a
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, ans = 0;
    cin >> N;
    vector<int> v(N);
    for (auto &x : v)
        cin >> x;
    REP(i, N - 1) {
        if (v[i] == v[i + 1]) {
            v[i + 1] = -v[i + 1];
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <map>
using namespace std;
typedef pair<int ,int> P;
int h ,w;
int sx ,sy;
int nextx[2] = {1 ,0};
int nexty[2] = {0 ,1};
string   maps[52];
int total[52][52];
int bfs();

int main(){
  cin >> h >> w;
  for( int i=0 ; i<h ; i++ ){
    cin >> maps[i];
  }
  bfs();
  cout << total[h-1][w-1] << endl;
}

int bfs(){
  queue< P > route; // 縦 - 横
  memset( total ,-1 ,sizeof( total ) ); // mapの初期化
  route.push( P( 0 ,0 ) );
  total[0][0] = 0;
  while( !route.empty() ){
    P now = route.front();
    route.pop();
    for( int i=0 ; i<2 ; i++ ){
      int ny = now.first  + nexty[i];
      int nx = now.second + nextx[i];
      if( total[ny][nx] != -1 ){
	if( ny >= 0 && nx >= 0 && ny < h && nx < w && total[ny][nx] > ((total[now.first][now.second]) + (maps[ny][nx]-'0')) ){
	  total[ny][nx] = ( (total[now.first][now.second]) + (maps[ny][nx]-'0') );
	  route.push( P(ny ,nx) );
	}
      }
      else{
	if( ny >= 0 && nx >= 0 && ny < h && nx < w ){
	  total[ny][nx] = ( (total[now.first][now.second]) + (maps[ny][nx]-'0') );
	  route.push( P(ny ,nx) );
	}
      }	
    }
  }
  return 0;
}

// cicada.

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

int now = 0;
vector<int>tar,han;

/*void check(vector<int> ju){
  for(int i=0;i<ju.size();i++) cout << ju[i] << endl;
  cout << endl;
  }*/

int ind_m(int i,vector<int> ju){
  while(i < ju.size()){
    if(ju[i] > now) return i;
    i++;
  }
  return -1;
}

int main(){
  int n;
  while(cin >> n,n){
    int tmp; now = 0;
    bool c[2*n+1];
    fill(c,c+2*n+1,true);
    for(int i=0;i<n;i++){
      cin >> tmp; tar.push_back(tmp); c[tmp] = false;
    }
    for(int i=1;i<=2*n;i++){
      if(c[i]) han.push_back(i);
    }
    sort(tar.begin(),tar.end()); sort(han.begin(),han.end());
    //check(tar);
    now = tar[0]; tar.erase(tar.begin());

    while(!tar.empty()){
      int ind;
      //check(han);
      if(now > han[0]){
	ind = ind_m(1,han);
	if(ind == -1){ now = 0; goto e;}
	else{
	  now = han[ind]; han.erase(han.begin() + ind);
	}
      }
      
      else if(now < han[0]){
	now = han[0]; han.erase(han.begin());
      }
    e:
      if(han.empty()) break;

      //check(tar);

      if(now > tar[0]){
	ind = ind_m(1,tar);
	if(ind == -1){ now = 0; goto exit;}
	else{ 
	  now = tar[ind]; tar.erase(tar.begin() + ind);
	}
      } 

      else if(tar[0] > now){
	now = tar[0]; tar.erase(tar.begin());
      }
    exit:;
    }
    cout << han.size() << endl << tar.size() << endl;
    tar.resize(0); han.resize(0);
  }
}

Measured memory_bytes: 1220
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<iomanip>
#define ll long long 
using namespace std;

int main() {
	int N;
	cin >> N;
	int K;
	cin >> K;
	vector<int> ps(N + 1);
	ps[0] = 0;

	for (int i = 1; i < N + 1; i++) {
		int x;
		cin >> x;
		ps[i] = ps[i - 1] + x;
	}

	int max = 0;

	for (int j = 0; j + K < N + 1; j++) {
		if (max < (ps[j + K] - ps[j])) {
			max = (ps[j + K] - ps[j]);
		}
	}

	double ans = K + max;
	ans /= 2;
	printf("%.15f", ans);
}

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

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<pll> X(N);
	for (ll i = 0; i < N; ++i)
	{
		ll x, l; cin >> x >> l;
		X[i] = pll(x-l, x+l);
	}

	sort(X.begin(), X.end(), [](pll &a, pll &b)
							 {
								 return a.second < b.second;
							 });
	ll now{-(1ll<<60)}; 
	ll res{0};
	for (auto &p : X)
	{
		if (p.first < now) continue;
		now = p.second;
		++res;
	}
	std::cout << res << std::endl;
	
}


Measured memory_bytes: 1792
n, p = map(int, input().split())

def prime_factor(n):
	d = {}
	for i in range(2, int(n ** 0.5) + 1):
		while (n % i == 0):
			d[i] = d.get(i, 0) + 1
			n //= i
	if n != 1:
		d[n] = d.get(n, 0) + 1
	return d

if n == 1:
	print(p)
	exit()

res = 1
fac = prime_factor(p)
for p, c in fac.items():
	res *= p ** (c // n)
print(res)

Measured memory_bytes: 38640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in,"UTF-8");
		int n[] = {1,9,7,4};

		String[] inp = new String[4];

		for(int i=0;i<4;i++) {
			inp[i] = sc.next();
		}

		int cont=0;

		for(int i=0;i<4;i++) {
			for(int j=0;j<4;j++) {
				if(n[i] == Integer.parseInt(inp[j])) { 
					cont++;
					break;
				}
			}
		}

		if(cont == 4) {
			System.out.print("YES");

		}
		else if (cont != 4)
		{
			System.out.print("NO");
		}
		sc.close();
	}

}

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

int main() {
    int n;
    int t[100010]={0}, x[100010]={0}, y[100010]={0};
    cin >> n;
    for(int i=1; i<=n; i++) cin >> t[i] >> x[i] >> y[i];
    for(int i=1; i<=n; i++){
        int dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
        if(t[i]-t[i-1] < dist || (t[i]-t[i-1]-dist)%2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;
int c[26];
int main(){
	int i,j,n;	cin>>n;
	char s[n+1];	cin>>s;
	for(i=0;i<n;i++){
		c[s[i]-'a']++;
	}
	ll ans=1;
	for(i=0;i<26;i++){
		ans*=c[i]+1;	ans%=mod;
	}
	ans-=1;
	ans+=mod;	ans%=mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.lang.StringBuilder
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)
    val s = sc.nextLine()
    val q = sc.nextInt()
    var refl = 1
    var front = StringBuilder()
    var end = StringBuilder()
    for (i in 0 until q) {
        val t = sc.nextInt()
        if (t == 1) {
            refl *= -1
        } else {
            val f = sc.nextInt()
            val c = sc.next()
            if ((f == 1 && refl == 1) || (f == 2 && refl == -1)) {
                front.append(c)
            } else {
                end.append(c)
            }
        }
    }
    val ans = front.toString().reversed() + s + end.toString()
    if (refl == 1) {
        println(ans)
    } else {
        println(ans.reversed())
    }
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 55388
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e,f,g;
  cin >>a>>b;
  d=b,e=b;
  for(int n=1;n<a;n++){
    cin >>c;
    if(c<d) d=c;
    if(c>e) e=c;
  }
  cout <<e-d<<'\n';
  return 0;
}


Measured memory_bytes: 256
# フェルマーの小定理
X, Y = map(int, input().split())

m = 1000000007

if (X + Y) % 3 != 0:
    print(0)
    exit()

a = (2 * Y - X) // 3
b = (2 * X - Y) // 3

if a < 0 or b < 0:
    print(0)
    exit()

n = a + b
fac = [0] * (n + 1)
fac[0] = 1
for i in range(n):
    fac[i + 1] = fac[i] * (i + 1) % m


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


print(mcomb(n, a))


Measured memory_bytes: 35260
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void countingSort(int[] A, int[] B, int k, int n) {
		int[] C = new int[k];
		for (int j = 0; j < n; j++) {
			C[A[j]]++;
		}
		for (int i = 1; i < k; i++) {
			C[i] = C[i] + C[i - 1];
		}
		for (int j = n - 1; j >= 0; j--) {
			B[--C[A[j]]] = A[j];
		}
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int n = Integer.parseInt(br.readLine());
		//String[] input = br.readLine().split(" ");
		int[] A = new int[n];
		int[] B = new int[n];
		int k = 0;
		for (int i = 0; i < n; i++) {
			A[i]=scanner.nextInt();
			//A[i] = Integer.parseInt(input[i]);
			k=Math.max(k, A[i]);
		}
		k = k + 1;
		countingSort(A, B, k, n);
		StringBuilder sb=new StringBuilder();
		sb.append(B[0]);
		for (int i = 1; i < n; i++) {
			sb.append(" " + B[i]);
		}
		System.out.println(sb);
	}

}


Measured memory_bytes: 548952
#include<stdio.h>
#include <string.h>
#define N 50
#define M 100

int main(void){
  int n,i,sum=0,tmp;
  char name[N][M];
  int time[N];
  char x[M];
  
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%s %d",name[i],&time[i]);
  }
  scanf("%s",x);
  
  for(i=0;i<n;i++){
    if(strstr(name[i],x) != NULL){
    	tmp = i;
      	break;
    }
  }
  for(i=tmp+1;i<n;i++)
    sum+=time[i];
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 128
r, D, x = map(int, input().split())

a = r*x - D
b = r*a - D 
c = r*b - D
d = r*c - D
e = r*d - D
f = r*e - D
g = r*f - D
h = r*g - D
i = r*h - D
j = r*i - D

print(a)
print(b)
print(c)
print(d)
print(e)
print(f)
print(g)
print(h)
print(i)
print(j)

Measured memory_bytes: 3064
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int pm = 30000;
		boolean[] prime = new boolean[pm+1];
		for(int i=2;i<=pm;i++) prime[i] = true;
		for(int i=2;i<=pm+1;i++){
			for(int j=i+i;j<=pm;j+=i){
				prime[j]=false;
			}
		}
		int[] p = new int[3245];
		int cnt = 0;
		for(int i=2;i<=pm;i++){
			if(prime[i]){
				p[cnt] = i;
				cnt++;
			}
		}
		
		while(true){
			int t = sc.nextInt();
			if(t==0) break;
			
			cnt = 0;
			for(int i=0;i<3245;i++){
				if(p[i]>t) break;
				for(int j=i;j<3245;j++){
					if(p[i]+p[j]>t) break;
					int pp = t-p[i]-p[j];
					if(prime[pp] && pp>=p[j]){
						int[] a = new int[]{p[i], p[j], pp};
						Arrays.sort(a);
						if(a[0]+a[1]>a[2]) cnt++;
					}
				}
			}
			System.out.println(cnt);
		}	
	}
	
}

Measured memory_bytes: 61652
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    vector<ll> b(n);
    for(int i = 0; i < n; i++) {
        cin>>a[i]>>b[i];
    }

    ll ans=0;
    for(int d = 30; d >= -1; d--) {
        vector<bool> bit(31,true);
        for(int i = 30; i > d; i--) {
            bit[i]=(k&(1<<i));
        }
        for(int i = d; i >= 0; i--) {
            bit[i]=0;
            if(k&(1<<i)) break;
        }

        ll now=0;
        for(int i = 0; i < n; i++) {
            bool add=true;
            for(int j = 0; j <= 30; j++) {
                if(!bit[j] && (a[i]&(1<<j))) add=false;
            }
            if(add) now+=b[i];
        }
        chmax(ans,now);
        //cout<<now<<endl;
    }
    cout<<ans<<endl;
}

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

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var k = int.Parse(Console.ReadLine().Trim());
        var a = new List<string>();
        var sL = s.Length;
        for (int i = 0; i < k; i++)
            for (int j = 0; j < sL - i; j++)
                a.Add(s.Substring(j, i + 1));
        var b = a.Distinct().OrderBy(x => x).ToArray();
        Console.WriteLine(b[k - 1]);
    }
}

Measured memory_bytes: 15968
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b ? a:b;}
ll min(ll a, ll b) {return a<b ? a:b;}

int main() {
    ll N;
    cin >> N;
    ll i;
    ll dp[2][3]={};
    
    for(i=0; i<N; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        
        dp[1-i&1][0]=dp[1-i&1][1]=dp[1-i&1][2]=0;
        
        dp[1-i&1][0]=max(dp[i&1][1]+a, dp[i&1][2]+a);
        dp[1-i&1][1]=max(dp[i&1][2]+b, dp[i&1][0]+b);
        dp[1-i&1][2]=max(dp[i&1][0]+c, dp[i&1][1]+c);
    }
    
    pt(max(dp[N&1][0], max(dp[N&1][1], dp[N&1][2])));
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <bitset>
#include <numeric>
#include <math.h>
#include <tuple>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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; }


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

    int D;

    cin >> D;

    if (D == 25){
        cout << "Christmas" << endl;
    }else if(D == 24){
        cout << "Christmas Eve" << endl;
    }else if(D == 23){
        cout << "Christmas Eve Eve" << endl;
    }else{
        cout << "Christmas Eve Eve Eve" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=1,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  M A;
M B;
  REP(i,n){
  	IN(z);
  	A[z]++;
  }
  for(auto p:A){
  	if(p.second==0) continue;
        B[p.first] = A[p.first];
  	if(A[p.first+1]>0) B[p.first]+=A[p.first+1];
  	if(A[p.first-1]>0) B[p.first]+=A[p.first-1];
  }
  for(auto p:B){
  	x=max(x,p.second);
  }
  OUT(x);
}


Measured memory_bytes: 10112
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
const int InF=0x3f3f3f3f,maxn=2e6+2;
struct node{
  	int t,x,d;
    inline bool operator < (const node &x) const
	{
    	return t<x.t;
    }
}event[maxn];
int n, m;
int len;
multiset<int>msi;
int main()
{
	cin>>n>>m;
    int i;
    for(i=1;i<=n;i++)
	{
        int s,t,x;
       	cin>>s>>t>>x;
        event[++len].t=s-x;
        event[len].x=x;
        event[len].d=1;
        event[++len].t=t-x;
        event[len].x=x;
       	event[len].d=0;
   }
    sort(event+1,event+len+1);
    int k=1,d,w;
    for(i=1;i<=m;i++)
	{
        cin>>w;
        while(k<=len)
		{
            if(event[k].t<=w)
			{
                if(event[k].d)
					msi.insert(event[k].x);
                else
					msi.erase(msi.find(event[k].x));
                k++;
            }
			else
				break;
         }
        int ans=-1;
       if(msi.size()!=0)
			ans=*msi.begin();
       cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;


int main()
{
  int W, H, x, y;

  cin >> W >> H >> x >> y;

  cout << std::setprecision(27) << ((double)W * (double)H) /(double)2.0;

  if(x == (double)W/(double)2.0 && y == (double)H/(double)2.0)
    {
      cout << " 1" << endl;
    }
  else
    {
      cout << " 0" << endl;
    }

  return 0;
}


Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0 :
        break
    else:
        otsuri=1000-n
        a=otsuri//500
        b=otsuri%500//100
        c=otsuri%500%100//50
        d=otsuri%500%100%50//10
        e=otsuri%500%100%50%10//5
        f=otsuri%500%100%50%10%5
    print(a+b+c+d+e+f)


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

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string S = cin.nextString();

        int[] right = new int[N];
        int[] left = new int[N];

        left[0] = 0;
        for (int i = 1; i < N; i++)
        {
            left[i] = left[i - 1];
            if (S[i - 1] == 'W')
            {
                left[i]++;
            }
        }

        right[N - 1] = 0;
        for (int i = N - 2; i >= 0; i--)
        {
            right[i] = right[i + 1];
            if (S[i + 1] == 'E')
            {
                right[i]++;
            }
        }

        int ret = 100000000;
        for (int i = 0; i < N; i++)
        {
            ret = Math.Min(left[i] + right[i], ret);
        }

        Console.WriteLine(ret);
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

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

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

    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin >> p[i];
    }
    sort(p.begin(), p.end());

    int ans = 0;
    for(int i=0; i<k; i++){
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}

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

ll cache[100];
ll lyuca(int n) {
    if (cache[n] > 0) {
        return cache[n];
    }
    ll ret = lyuca(n - 1) + lyuca(n - 2);
    cache[n] = ret;
    return ret;
}

int main() {
    int N;
    cin >> N;
    cache[0] = 2;
    cache[1] = 1;
    cout << lyuca(N) << endl;
    return 0;
}

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

int gcd (int a, int b)
{
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main()
{
    int k;
    cin >> k;
    long long sum = 0;
    int a = 1;
    for (int i = 0; i < k; i++)
    {
        int b = 1;
        for (int j = 0; j < k; j++)
        {
            int c = 1;
            for (int l = 0; l < k; l++)
            {
                sum += gcd(a, gcd(b, c));
                c++;
            }
            b++;
        }
        a++;
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 3636
N, W = [int(i) for i in input().split()]
w, v = [0]*N, [0]*N
 
for i in range(N):
  w[i], v[i] = [int(_) for _ in input().split()]
V = sum(v)

dp = [[float('inf')] * (V+1) for _ in range(N+1)]
# dp[i][j] i番目までの荷物で価値がj以上になるように選んだときの重さの最小値
dp[0][0] = 0
for i in range(N):
  for j in range(V+1):
    if v[i] <= j:# 荷物v[i]の価値がjに足りてないのでi番目の荷物を入れる可能性がある
      dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]] + w[i])
    dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ans = 0
for j in range(V + 1):
  if dp[N][j] <= W:
    ans = j    
      
print(ans)

Measured memory_bytes: 311760
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LLI(): return [int(x) for x in sys.stdin.readlines()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        XST.append([x, s, t])
    XST.sort()
    D = LLI()
    ans = [-1] * Q
    nexts = [-1] * Q
    for x, s, t in XST:
        i = bisect_left(D, s - x)
        end = bisect_left(D, t - x)
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = end
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(y)
    return

main()


Measured memory_bytes: 65564
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

const int MAX=INT_MAX/100;
int dy[]={-1,0,1,0},dx[]={0,-1,0,1};
int bfs(vs &c,pii from,pii to,int h,int w){
	queue<pii> q;
	q.push(from);
	vvi cost(h,vi(w,MAX));
	cost[from.first][from.second]=0;
	while(!q.empty()){
		pii p=q.front();q.pop();
		REP(d,4){
			int y=p.first+dy[d];
			int x=p.second+dx[d];
			if(y>=0&&x>=0&&y<h&&x<w&&c[y][x]!='x'&&cost[y][x]==MAX){
				q.push(make_pair(y,x));
				cost[y][x]=cost[p.first][p.second]+1;
			}
		}
	}
	return cost[to.first][to.second];
}

int main(){
	int w,h;
	while(cin>>w>>h,w|h){
		vs c(h);
		vector<pii> targets;
		pii start;
		REP(i,h){
			cin>>c[i];
			REP(j,w){
				if(c[i][j]=='*'){
					targets.push_back(make_pair(i,j));
				}else if(c[i][j]=='o'){
					start=make_pair(i,j);
				}
			}
		}
		targets.push_back(start);
		int sz=targets.size();
		vvi cost(sz+1,vi(sz+1));
		REP(i,sz){
			FOR(j,i+1,sz){
				cost[i][j]=bfs(c,targets[i],targets[j],h,w);
				cost[j][i]=cost[i][j];
			}
		}

		vi order(sz-1);
		REP(i,sz-1){
			order[i]=i;
		}
		int ans=MAX;
		do {
			int dist=cost[sz-1][order[0]];
			REP(i,sz-2){
				dist+=cost[order[i]][order[i+1]];
			}
			ans=min(ans,dist);
		}while(next_permutation(ALL(order)));
		cout<<(ans==MAX?-1:ans)<<endl;
	}
}

Measured memory_bytes: 1248
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int x = 1;
    rep(i, N) {
        x = min(x + K, x * 2);
    }
    cout << x << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define length(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, length(a))cin >> a[i]
#define ccin(i, j, a) rep(i, length(a))rep(j, length(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define sqrtl sqrt
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-9;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
int main(){
    ld n;
    cin >> n;
    cout << fixed;
    cout << (n/3)*(n/3)*(n/3) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from bisect import bisect, bisect_left

def solve():
    input = sys.stdin.readline
    N = int(input())
    strN = str(N)
    maxDig = len(strN)
    count = 0
    for i in range(1, N + 1):
        a = str(i)
        low = int(a[-1])
        if low == 0: continue
        high = int(a[0])
        if low == high: count += 1 #一番上位と下位の桁の数字が同じ
        digb = 2
        while digb < maxDig:
            count += 10 ** (digb - 2)
            digb += 1
        if N >= 10:
            if low > int(strN[0]): continue
            elif low < int(strN[0]): count += 10 ** (digb - 2)
            elif N >= 10:
                DP = [[0, 0] for _ in range(maxDig)]
                DP[0][0] = 1
                for j in range(1, maxDig - 1):
                    DP[j][0] = 1
                    DP[j][1] = DP[j-1][1] * 10 + DP[j-1][0] * (int(strN[j]))

                count += DP[maxDig - 2][1] 
                #print(i, DP)
                if int(strN[maxDig - 1]) >= high: count += 1

    print(count)
        
        

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3316
#include<stdio.h>
int main(void){
  int h,w,i,k=0;
  while(1){
    scanf("%d %d",&h,&w);
  if(h==0&&w==0)break;
  for(k=0;k<h;k++){
    for(i=0;i<w;i++){
      printf("#");
    }
  printf("\n");
  }
  puts("");
  }
  return 0;
}



Measured memory_bytes: 2036
#include <iostream>
#include <map>

const int MAXN = (int)2e5 + 1;

int a[MAXN];
int64_t sum[MAXN];

int64_t solve(int n, int k) {
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= n; ++i) sum[i] = sum[i] % k - i;
  
  // for (int i = 1; i <= n; ++i) std::cout << sum[i] << std::endl;

  std::map<int, int> rem;
  rem[0] = 1;
  
  int64_t res = 0;
  for (int i = 1, pre = 2 - k; i <= n; ++i, ++pre) {
    int tmp = 0;
    if (rem.find(sum[i]) != rem.end()) {
      res += rem[sum[i]];
      tmp += rem[sum[i]];
    }
    // std::cout << "i = " << i << " num = " << tmp << std::endl;
    ++rem[sum[i]];
    ++rem[sum[i] - k];
    if (pre >= 0) --rem[sum[pre]];
    if (pre > 0) --rem[sum[pre] - k];
  }
  return res;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  for (int i = 1; i <= n; ++i) std::cin >> a[i];
  std::cout << solve(n, k) << std::endl;
  return 0;
}


Measured memory_bytes: 21376
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int N,D;
	cin>>N>>D;

	//vector<vector<int>> v(N,vector<int>(D));
	int v[20][20];
	For(i,N){
		For(j,D){
			cin>>v[i][j];
		}
	}
	int ant=0;
	For(i,N){
		for(int j=i+1;j<=N;j++){
			int sum=0;
			For(k,D){
				sum+=(v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
			}
			if(((int)sqrt(sum)*(int)sqrt(sum))==sum) ant++;
		}
	}
	cout<<ant<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int k;
	cin >> k;
	if(k % 2 == 0){
		cout << (k/2) * (k/2);
	}else{
		cout << ((k+1)/ 2) * (k/2) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll inf = 1e18;
ll mod = 1e9+7;

int main(){
    string n;
    cin >> n;
    for (int i = 0; i < 3; i++) {
        if (n[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3592
var
	N:String;
	K,i,j,lim,kk,l,nk,nj:Longint;
	dp:Array[0..103,0..1,0..3]of Longint;
begin
	readln(N);
	read(K);
	dp[0,0,0]:=1;
	for i:=0 to length(N)-1 do for j:=0 to 1 do begin
		if j=0 then lim:=ord(N[i+1])-48 else lim:=9;
		for kk:=0 to K do for l:=0 to lim do begin
			nk:=kk;
			if l<>0 then inc(nk);
			if nk<=K then begin
				nj:=j;
				if l<lim then nj:=1;
				inc(dp[i+1,nj,nk],dp[i,j,kk]);
			end;
		end;
	end;
	writeln(dp[length(N),0,K]+dp[length(N),1,K]);
end.


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

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

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

void solve(){

    int n;
    cin >> n;
    int a[n];
    int ans=1000005;

    rep(i,0,n) cin >> a[i];

    rep(i,-100,101){
    int cost=0;
        rep(j,0,n){
            cost += (a[j]-i)*(a[j]-i);
        }
        ans = min(ans , cost);

    }
    cout << ans;

    line
  	return;

}

int main(){
	fast
	int t=1;
	//cin >> t;
	while(t--){
             solve();
    }

	R 0;
}


Measured memory_bytes: 3540
#MLE注意！0や1のケースに注意

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    x = int(input())
    n = 100
    res = 0
    while n < x:
        res += 1
        n = n*101//100
    print(res)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9408
n = int(input())
s = dict()

for _ in range(n):
  value = input()
  key = ''.join(sorted(value))
  
  if key in s:
    s[key] += 1
  else:
    s[key] = 1
          
sum = 0

for value in s.values():
  sum += value*(value-1)//2
  
print(sum)

Measured memory_bytes: 60504
#include <iostream>
#include <string>

using namespace std;

int main(){
	int i, mozisu;
	string str;

	getline(cin, str);

	mozisu = str.size();

	for(i = 0; i < mozisu; i++){
		if(str[i] == 'a' && str[i + 1] == 'p' && str[i + 2] == 'p' && str[i + 3] == 'l' && str[i + 4] == 'e'){
			str[i] = 'p';
			str[i + 1] = 'e';
			str[i + 2] = 'a';
			str[i + 3] = 'c';
			str[i + 4] = 'h';
		}

		else if(str[i] == 'p' && str[i + 1] == 'e' && str[i + 2] == 'a' && str[i + 3] == 'c' && str[i + 4] == 'h'){
			str[i] = 'a';
			str[i + 1] = 'p';
			str[i + 2] = 'p';
			str[i + 3] = 'l';
			str[i + 4] = 'e';
		}
	}

	cout << str << endl;

	return 0;
}

Measured memory_bytes: 1172
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	in.pb(-1);
	int out=0;
	int co=0;
	rep(i,n){
		if(in[i]==in[i+1])co++;
		else{
			out+=(co+1)/2;
			co=0;
		}
	}
	cout<<out<<endl;
}







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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

string pc = "pairwise coprime";
string sc = "setwise coprime";
string nc = "not coprime";

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];

    ll g = a[0];
    map<int, int> dict;
    rep(i, n) {
        g = gcd(g, a[i]);
        int num = a[i];
        for (int x = 2; x * x <= num; x++) {
            if (num % x == 0) {
                while (num % x == 0) {
                    num /= x;
                }
                ++dict[x];
            }
        }
        if (num != 1) ++dict[num];
    }
    auto is_pc = [&]() {
        rep(i, 1000005) {
            if (dict[i] >= 2) return false;
        }
        return true;
    };
    if (is_pc()) {
        out(pc);
    } else if (g == 1) {
        out(sc);
    } else
        out(nc);

    return 0;
}


Measured memory_bytes: 53824
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
class E { static void Main() { new J(); } }
class J
{
	class Node { public int size; }
	int Size(Node t) => t?.size ?? 0;
	void F3() => Console.WriteLine();
	int F() { return int.Parse(Console.ReadLine()); }
	int[] G() { return Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); }
	public J()
	{
		Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
		var N = F();
		Console.WriteLine(800 * N - 200 * (N / 15));
		Console.Out.Flush();
	}
	long GCD(long a, long b)
	{
		var n = (ulong)Math.Abs(a); var m = (ulong)Math.Abs(b);
		if (n == 0) return (long)m; if (m == 0) return (long)n;
		int zm = 0, zn = 0;
		while ((n & 1) == 0) { n >>= 1; zn++; }
		while ((m & 1) == 0) { m >>= 1; zm++; }
		while (m != n)
		{
			if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; }
			else { n -= m; while ((n & 1) == 0) n >>= 1; }
		}
		return (long)n << Math.Min(zm, zn);
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int mex=2005;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
  int n,k,s;
  cin>>n>>k>>s;
  int j=1000000000;
  if(k)
  {
      fo(i,0,n)
      {
          if(i<k)
          cout<<s<<" ";
          else cout<<(s+1)%j<<" ";
      }
  }
  else
  {
      if(s==1000000000)
      {
          fo(i,0,n)
          cout<<'1'<<" ";
      }
      else
      fo(i,0,n)
      cout<<s+1<<" ";
  }
  
}

Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

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

int main() {

	char S[112345];
	scanf("%s", S);

	int N = strlen(S);

	while (N) {
		if (N >= 5 && !strcmp(S + N - 5, "dream")) {
			N -= 5;
			S[N] = '\0';
		}
		else if (N >= 7 && !strcmp(S + N - 7, "dreamer")) {
			N -= 7;
			S[N] = '\0';
		}
		else if (N >= 5 && !strcmp(S + N - 5, "erase")) {
			N -= 5;
			S[N] = '\0';
		}
		else if (N >= 6 && !strcmp(S + N - 6, "eraser")) {
			N -= 6;
			S[N] = '\0';
		}
		else {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");

	return 0;
}


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

int main(){
  int n;
  ll p=0;
  cin >> n;
  vector<int> a(n),b(n);
  r(i,n)cin >> a.at(i);
  r(i,n){
    cin >> b.at(i);
    if(a.at(i)>b.at(i))p+=a.at(i)-b.at(i);
    else p-=(b.at(i)-a.at(i))/2;
  }
  if(p<=0)cout << "Yes"<<endl;
  else cout << "No"<<endl;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){
    return *(ll *)a>*(ll *)b?1:*(ll *)a<*(ll *)b?-1:0;}

int main(void){
    ll n,i,ans=INF,hp=0,right=0,left=INF;
    scanf("%lld",&n);
    ll x[n];
    for(i=0;i<n;i++){
        scanf("%lld",&x[i]);
        right=max2(right,x[i]);
        left=min2(left,x[i]);
    }
    for(i=left;i<=right;i++){
        hp=0;
        for(ll j=0;j<n;j++){
            hp+=(x[j]-i)*(x[j]-i);            
        }
        ans=min2(hp,ans);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128