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


struct segtree{
  vector<int> datasum;
  vector<int> delay;
 
  int n;
 
  //テ・ツ按敕ヲツ慊淌・ツ個?
  void init(int _n){
    n = 1;
    while( n < _n ) n*=2;
    datasum.resize( 2 * n );
    delay.resize( 2 * n );
  }
 
  //テ」ツつッテ」ツδェテ」ツつ「(テ、ツスツ陛・ツコツヲテ」ツつづ、ツスツソテ」ツ??・ツ?エテ・ツ青暗ッツシツ?
  void clear(){
    datasum.clear();
    delay.clear();
  }
  
  void delaycalc(int k,int l,int r){
    datasum[k] = datasum[k] + delay[k]*(r-l);
    if( k+1 < n ){
      for(int i=1;i<=2;i++){
	delay[2*k+i] = delay[2*k+i]+delay[k];
      }
    }
    delay[k] = 0;
  }   
 
  //テ・ツ個コテゥツ鳴禿」ツ??a,b)テ」ツ??」ツ?ォテ、ツクツ?ヲツァツ佚」ツ?ォテ」ツ??テ」ツ??」ツつ津ィツカツウテ」ツ??
  void add(int a,int b,int x,int k,int l,int r){
    delaycalc(k,l,r);
    if( r<=a || b<=l ) return;
    else if( a<=l && r<=b ){
      delay[k] = x;
      delaycalc(k,l,r);
    } else {
      add( a, b, x, 2*k + 1, l, (l+r)/2 );
      add( a, b, x, 2*k + 2, (l+r)/2, r );
      datasum[k] = datasum[2*k+1]+datasum[2*k+2];
    }
  }
 
  int querysum(int a,int b,int k,int l,int r){
    delaycalc(k,l,r);
    if( r<=a || b<=l ) return 0;
    if( a<=l && r<=b ){
      return datasum[k]+delay[k]*(r-l);
    } else {
      int vl = querysum( a, b, 2*k+1, l,(l+r)/2 );
      int vr = querysum( a, b, 2*k+2, (l+r)/2,r );
      return vl+vr;
    }
  }
 
  void add( int a,int b,int x){ add( a, b, x, 0,0,n); }
  int querysum(int a,int b){ return querysum(a,b,0,0,n); }
};
typedef pair<int,int> P;
segtree S[420];
vector<P> st[1001];
bool used[420];
int main(){
  int N;
  while(cin >> N && N ){
    for(int i=0;i<N;i++){
      int m,d,h,mi,no;
      char ex;
      scanf("%d/%d %d:%d %c %d",&m,&d,&h,&mi,&ex,&no);
      int dt = m*31+d;
      int mini = h * 60 + mi;
      st[no].push_back(P(dt,mini));
    }
    memset(used,0,sizeof(used));
    sort(st[0].begin(),st[0].end());
    assert( st[0].size() % 2 == 0 );
    for(int i=0;i<(int)st[0].size();i+=2){
      int dat = st[0][i].first;
      int sta = st[0][i].second;
      int ed = st[0][i+1].second;
      if( !used[dat] ){
	S[dat].init(60*24+1);
      }
      used[dat] = true;
      S[dat].add(sta,ed,1);
    }
    int res = 0;
    for(int i=1;i<1000;i++){
      assert( st[i].size() % 2 == 0 );
      sort(st[i].begin(),st[i].end());
      int r=0;
      for(int j=0;j<(int)st[i].size();j+=2){
	int dat = st[i][j].first;
	int sta = st[i][j].second;
	int ed = st[i][j+1].second;
	if( !used[dat] ) continue;
	r+=S[dat].querysum( sta, ed );
      }
      res = max( res, r );
    }
    cout << res << endl;
    for(int i=0;i<420;i++)
      S[i].clear();
    for(int i=0;i<1000;i++) st[i].clear();
  }
}

Measured memory_bytes: 6816
#include <stdio.h>

int main(void)
{
	char a[100000];
	int i;
	while (fgets(a, sizeof (a), stdin) != NULL){
		for (i = 0; a[i] != '\0'; i++){
			if ('a' <=  a[i] && a[i] <= 'z') a[i] += 'A' - 'a';
		}
		printf("%s", a);
	}
	return (0);
}

Measured memory_bytes: 524
def check():
    H, W = [int(i) for i in input().split(' ')]
    a = [input() for _ in range(H)]
    
    
    for h in range(H):
        for w in range(W):
            flag = [0,0,0,0]
            if a[h][w] == '#':
                if h != 0:
                    if a[h-1][w] != '#':
                        flag[0] = 1
                else:
                    flag[0] = 1
                if h != H-1:
                    if a[h+1][w] != '#':
                        flag[1] = 1
                else:
                    flag[1] = 1
                if w != 0:
                    if a[h][w-1] != '#':
                        flag[2] = 1
                else:
                    flag[2] = 1
                if w != W-1:
                    if a[h][w+1] != '#':
                        flag[3] = 1
                else:
                    flag[3] = 1 
            if sum(flag) == 4:
                    return 'No'
                    
    return 'Yes'
print(check())

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static void Main(string[] args)
        {
            var N = int.Parse(ReadLine());
            var ab = new List<long[]>();
            long cnt = 0;
            for(var i=0;i<N;i++)
            {
                ab.Add(Sarray());
            }
            for(var i=N-1;0<=i;i--)
            {
                ab[i][0] += cnt;
                var mo = ab[i][0] % ab[i][1];
                if (mo == 0) continue;
                cnt += ab[i][1] - mo;
            }
            WriteLine(cnt);
        }

    }
}


Measured memory_bytes: 25780
n = int(input())
s_ = [input() for i in range(n)]

s_list = [0, 0, 0, 0, 0]
for i in range(n):
    if s_[i][0] == 'M':
        s_list[0] += 1
    elif s_[i][0] == 'A':
        s_list[1] += 1
    elif s_[i][0] == 'R':
        s_list[2] += 1
    elif s_[i][0] == 'C':
        s_list[3] += 1
    elif s_[i][0] == 'H':
        s_list[4] += 1

import math
counter = 0
s_list_nonzero = []
for i in range(5):
    if s_list[i] != 0:
        counter += 1
        s_list_nonzero.append(s_list[i])

if counter < 3:
    print(0)
elif counter == 3:
    print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2])
elif counter == 4:
    print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +
            s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +
            s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +
            s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3])
elif counter == 5:
    print(s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[2] +
            s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[3] +
            s_list_nonzero[0] * s_list_nonzero[1] * s_list_nonzero[4] +
            s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[3] +
            s_list_nonzero[0] * s_list_nonzero[2] * s_list_nonzero[4] +
            s_list_nonzero[0] * s_list_nonzero[3] * s_list_nonzero[4] +
            s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[3] +
            s_list_nonzero[1] * s_list_nonzero[2] * s_list_nonzero[4] +
            s_list_nonzero[1] * s_list_nonzero[3] * s_list_nonzero[4] +
            s_list_nonzero[2] * s_list_nonzero[3] * s_list_nonzero[4])


Measured memory_bytes: 9784
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int diff(string a, string b) {
	if (a == b) {
		return -1;
	}
	int asz = a.size();
	int bsz = b.size();
	int Mmin = min(asz, bsz);
	int cc = 1;
	for (int i = 0; i < Mmin; i++) {
		if (a[i] == b[i]) {
			cc++;
		} else {
			break;
		}
	}
	return cc;
}

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		string s;
		vector<string> ss;
		for (int i = 0; i < n; i++) {
			cin >> s;
			string b = "";
			b += s[0];
			for (int j = 0; j < s.size(); j++) {
				if (j+1 != s.size()) {
					if (s[j] == 'a' || s[j] == 'e' || s[j] == 'i' || s[j] == 'o' || s[j] == 'u') {
						b += s[j+1];
					}
				}
			}
			ss.push_back(b);
			//cout << b << endl;
		}
		sort(ss.begin(), ss.end());
		int MAX = 0;
		for (int i = 0; i+1 < ss.size(); i++) {
			if (diff(ss[i], ss[i+1]) == -1) {
				MAX = -1;
				break;
			} else {
				MAX = max(MAX, diff(ss[i], ss[i+1]));
			}
		}
		cout << MAX << endl;
	}
	return 0;
}

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

#define rep(i,n) for(int i = 0;i < (int)(n);i++)
#define Rep(i,n,m) for(int i = (int)(n); i < (int)(m);i++)
#define rrep(i,n) for(int i = (int)(n); i > -1;i--)

#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V))

#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

template<typename T>
void swap(T*,T*);

int main()
{
    int N = 0;
    cin >> N;
    vector<int> v(N);
    rep(i,N)
    {
        cin >> v.at(i);
    }
    vector<double> v1(N);
    double sum = 0;
    rep(i,N)
    {
        v1[i] = (double)1 / (double)(v[i]);
        sum += v1[i];
    }
    cout << (double)1 / sum;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 500 + 5;
int a[MAX][MAX],n,m,q; 
ll dp[MAX][MAX];
int main()
{
	cin>>n>>m>>q;
	int l,r;
	while(m--) {
		scanf("%d%d",&l,&r);
		a[l][r]++;
	}
	for(int len = 1; len<=n; len++) {
		for(int l = 1; l+len-1<=n; l++) {//每一个起点 
			int r = l+len-1;
			if(l == r) dp[l][r]=a[l][r];
			else if(r-l==1) dp[l][r] = dp[l][l] + dp[r][r] + a[l][r];
			else dp[l][r] = dp[l][r-1] + dp[l+1][r] - dp[l+1][r-1]+a[l][r];
		}
	}
	while(q--) {
		ll ans = 0;
		scanf("%d%d",&l,&r);
		printf("%lld\n",dp[l][r]);
	}
	return 0 ;
 }


Measured memory_bytes: 3840
#include<vector>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<cctype>
#include<cassert>
#include<cmath>
#include<climits>

#define INF (1<<29)
#define all(c) (c).begin(),(c).end()
#define D(x) cout << #x " is " << (x) << endl
#define rep(i,n) for(int i = 0; i < n; i++)
#define x first
#define y second

using namespace std;

typedef pair<int,int>pii;
typedef long long ll;

ll dp[1002][1002],K[1002][1002];

int main(void){

  int n;
  cin >> n;

  vector<pii>v(n);
  rep(i,n)cin >> v[i].x >> v[i].y;


  fill(dp[0],dp[1001],INT_MAX);
  fill(K[0],K[1001],-1);
  rep(i,1001)dp[i][i]=0,K[i][i]=i;

  for(int w=1;w<n;w++){
    for(int i=0;i+w<=n;i++){
      for(int s=K[i][i+w-1];s<=K[i+1][i+w];s++){
        int cost=abs(v[i].x-v[s+1].x)+abs(v[s].y-v[i+w].y);
        if(dp[i][i+w]>dp[i][s]+dp[s+1][i+w]+cost){
          dp[i][i+w]=dp[i][s]+dp[s+1][i+w]+cost;
          K[i][i+w]=s;
        }
      }
    }
  }

  cout << dp[0][n-1] << endl;

  return 0;
}

Measured memory_bytes: 16876
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<set>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[100001];
char C[1200100];

ll num[524300];
int kazu[524300];
const int ma = (1 << 19) - 1;
int query(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 % 524287;
	}
	return 0;
}
void add(ll n, int b) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] |= b;
			return;
		}
		n2 = n2 * 61 % 524287;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';
	set<pair<int, char*>> ST;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			ST.insert(mp(n, s[i]));
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 100000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	for (auto p : ST) {
		auto S = p.second;
		int k[26] = {};
		ll are = 0;
		for (int i = p.first - 1; i >= 1; i--) {
			int tmp = query(are);
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

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

int main() {
    int n;
    cin >> n;
    // tmp = n;
    vector<vector<ll>> tbl(10, vector<ll>(10, 0LL));

    int md = 0;
    rep(i, n)
    {
        int num = i + 1;
        string nums = to_string(num);
        int md = nums[0] - '0';
        int ld = nums[nums.size() - 1] - '0';

        tbl[md][ld] += 1LL;
    }

    ll ans = 0LL;
    for (size_t i = 1; i < 10; i++)
    {
        for (size_t k = 1; k < 10; k++)
        {
            ans += tbl[i][k] * tbl[k][i];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  int n;
  cin>>n;
  int a[100];
  sa(a,n,d);
  sort(a,a+n);
  int c=0;
  rep(i,n){
      reps(j,i,n){
          reps(k,j,n){
              if(a[i]==a[j] || a[i]==a[k] || a[j]==a[k]) continue;
              if(a[i]+a[j]>a[k]) c++;
          }
      }
  }
  cout<<c;
  nline;
  return 0;
}


Measured memory_bytes: 3760
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scn = new Scanner(System.in);
        int N = scn.nextInt();
        int A[] = new int[N];
        for(int i=0; i<N; i++){
            A[i] = scn.nextInt();
        }
        
        Boolean ok = true;
        for(int x:A){
            if(x%2==0){
                if(x%3!=0&&x%5!=0) ok = false; 
            }
        }
        
        System.out.println(ok?"APPROVED":"DENIED");
    }
}


Measured memory_bytes: 36020
#include <iostream>
using namespace std;
int n, c[25], v, s;
int main() {
	int i;
	cin>>n;
	for(i=0; i<n; i++) cin>>c[i];
	for(i=0; i<n; i++) {
		cin>>v;
		if(v<c[i]) s += c[i] - v;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
// Numeric
#include<vector>

std::vector<bool> Eratosthenes(int n) {
    std::vector<bool> is_prime(n + 1, true);
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; is_prime[i] && i * i <= n; ++i)
        for(int j = i << 1; j <= n; j += i)
            is_prime[j] = false;
    return is_prime;
}

int mod_power(long long int m, long long int n, int mod) {
    if(!n) return 1;
    if(n & 1) return mod_power(m, n - 1, mod) * m % mod;
    return mod_power(m * m % mod, n >> 1, mod) % mod;
}

////////////////////////////////////////////////////////////////////////////////

#include<iostream>
using namespace std;

int main() {
    int m, n;
    cin >> m >> n;
    cout << mod_power(m, n, 1000000007) << endl;
}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

const Int INF = 1e15;
const Int MAX = 303;
Int p[MAX][MAX];
Int sm[MAX][MAX];

Int query(Int u,Int d,Int j){
  return sm[d+1][j]-sm[u][j]; 
}

signed main(){
  Int n;
  cin>>n;
  for(Int i=0;i<n;i++)
    for(Int j=0;j<n;j++)
      cin>>p[i][j];

  Int ans=-INF;
  for(Int i=0;i<n;i++)
    for(Int j=0;j<n;j++)
      chmax(ans,p[i][j]);

  // 1 * w, 2 * w
  for(Int i=0;i<n;i++){
    for(Int l=0;l<n;l++){
      Int sum=0,sum2=0;
      for(Int r=l;r<n;r++){
	sum+=p[i][r];
	if(i+1<n) sum2+=p[i+1][r];
	chmax(ans,sum);
	chmax(ans,sum+sum2);
      }
    }    
  }

  // h * 1, h * 2
  for(Int j=0;j<n;j++){
    for(Int u=0;u<n;u++){
      Int sum=0,sum2=0;
      for(Int d=u;d<n;d++){
	sum+=p[d][j];
	if(j+1<n) sum2+=p[d][j+1];
	chmax(ans,sum);
	chmax(ans,sum+sum2);
      }
    }
  }

  memset(sm,0,sizeof(sm));
  for(Int j=0;j<n;j++)
    for(Int i=0;i<n;i++)
      sm[i+1][j]=sm[i][j]+p[i][j];
  
  // larger than 3 * 3
  for(Int u=0;u<n;u++){
    for(Int d=u+2;d<n;d++){
      Int sum=query(u,d,n-1);
      for(Int j=n-3;j>=0;j--){
	chmax(sum,query(u,d,j+2));
	sum+=p[u][j+1]+p[d][j+1];	
	chmax(ans,query(u,d,j)+sum);
      }
    }
  }
    
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 4544
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N,X;
	cin >> N >> X;
	std::vector<int> v(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> v[i];
		X -= v[i];
	}
	sort(v.begin(), v.end());
	cout << (X / v[0]) + N << endl;

}

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

int main()
{
	int n;
	string s;
	cin >> n >> s;
	vector<int> a(n + 1), b(n + 1);
	for(int i = 0; i < n; i++){
		if(s[i] == '#') a[i + 1]++;
		if(s[n - i - 1] == '.') b[n - i - 1]++;
		a[i + 1] += a[i];
		b[n - i - 1] += b[n - i];
	}
	int ans = 100100100;
	for(int i = 0; i < n; i++){
		ans = min(ans, a[i] + b[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5204
from math import  *

input = int(input())

def getMoney(money):
    prices = [100, 101, 102, 103, 104, 105]
    rem = []
    for element in prices:
        rem.append(money - money * floor(money/element))
    bounds = [floor(money/element) + 1 for element in prices]
    for index1 in range(bounds[0]):
        for index2 in range(bounds[1]):
            for index3 in range(bounds[2]):
                for index4 in range(bounds[3]):
                    for index5 in range(bounds[4]):
                        for index6 in range(bounds[5]):
                            if (index1 * prices[0] + index2 * prices[1] +index3 * prices[2] + index4 * prices[3] + index5 * prices[4] + index6 * prices[5] == money):
                                return 1
    return 0

def getmoneyFast(money):
    prices = [105, 104, 103, 102, 101, 100]
    initialBounds = [floor(money/element) + 1 for element in prices]
    for index1 in range(initialBounds[0]):
        nmoney = money - index1 * prices[0]
        for index2 in range(getNewBound(nmoney,1)):
            nmoney = money - index1 * prices[0] - index2*prices[1]
            for index3 in range(getNewBound(nmoney, 2)):
                nmoney = money - index1 * prices[0] - index2*prices[1] - index3 * prices[2]
                for index4 in range(getNewBound(nmoney, 3)):
                    nmoney = money - index1 * prices[0] - index2*prices[1] - index3 * prices[2] - index4 * prices[3]
                    for index5 in range(getNewBound(nmoney, 4)):
                        nmoney = money - index1 * prices[0] - index2*prices[1] - index3 * prices[2] - index4 * prices[3] - index5 * prices[4]
                        index6 = ((money - (index1 * prices[0] + index2 * prices[1] + index3 * prices[2] + index4 * prices[3] + index5 * prices[4]))/prices[5])
                        if (index6.is_integer()):
                            if (money - index1 * prices[0] - index2*prices[1] - index3 * prices[2] - index4 * prices[3] - index5 * prices[4] - index6*prices[5] == 0):
                                return 1
    return 0



def getNewBound(nmoney, index):
    prices = [105, 104, 103, 102, 101, 100]
    return floor(nmoney/prices[index])+1


print(getmoneyFast(input))


Measured memory_bytes: 3192
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;

void input() {
  cin >> a >> b;
}

void solve1() {
  b += a * 3;

  cout << b / 2;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


Measured memory_bytes: 256
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n) for(int i=1;i<=n;i++)
#define Pn printf("\n");

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<utility>
#include<queue>

typedef long long lli;
using namespace std;

int main() {
	char s[100000];
	int x[100000];
	int l;
	scanf("%s", s);
	l = strlen(s);

	for (int i = 0;i < l;i++) {
		if ((i == 0 )|| (x[i-1] == 1)) {
			if (strncmp(&s[i], "dream", 5)==0 ){
				x[i + 4] = 1;
				if (strncmp(&s[i], "dreamer", 7) == 0) {
					x[i + 6] = 1;
				}
			}
			if (strncmp(&s[i], "erase", 5) == 0) {
				x[i + 4] = 1;
				if (strncmp(&s[i], "eraser", 6) == 0) {
					x[i + 5] = 1;
				}
			}
		}
	}
	if (x[l - 1] == 1)printf("YES\n");
	else printf("NO\n");

	return 0;
}

//改行注意

Measured memory_bytes: 768
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main()
{
	// 要素数
	int n, m;
	cin >> n >> m;

  static const int pathMax = 100001;
  int path[pathMax] = {0};

  for( int i = 0;i < m;++i )
  {
    int a, b;
    cin >> a >> b;
    path[a] += 1;
    path[b] += 1;
  }

  bool bSuccess = true;
  for( int i = 1;i < n;++i )
  {
    if( path[i] & 0x01 != 0 )
    {
      bSuccess = false;
      break;
    }
  }

	cout << ( bSuccess? "YES" : "NO" ) << endl;
}


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

typedef struct dice
{
	int front;		/* the front side of the dice. */
	int south;		/* the south side of the dice. */
	int east;		/* the  east side of the dice. */
	int west;		/* the  west side of the dice. */
	int north;		/* the north side of the dice. */
	int other;		/* the other side of the dice. */
} dice_t;

void turn(int *a, int *b, int *c, int *d);
dice_t turn_dice(dice_t dice, char side);
void answer_east_side(dice_t dice, int north, int front);

int main()
{
	dice_t dice;
	int q = 0;
	int front, north;
	char move[100];
	scanf("%d %d %d %d %d %d", 
		&dice.front, &dice.south, &dice.east,
		 &dice.west, &dice.north, &dice.other);
	scanf("%d", &q);
	while(q > 0)
	{
		if(scanf("%d %d",  &north, &front) == 2)
		{
			answer_east_side(dice, north, front);
		}
		q--;
	}
	
	return 0;
}


void turn(int *a, int *b, int *c, int *d)
{
	int tmp = *a;
	*a = *b;
	*b = *c;
	*c = *d;
	*d = tmp;
}

dice_t turn_dice(dice_t dice, char side)
{
	int side_int = side;
		
	switch(side_int)
	{
	case 'N':
		turn(&dice.front, &dice.south, &dice.other, &dice.north);
		break;
	case 'S':
		turn(&dice.front, &dice.north, &dice.other, &dice.south);
		break;
	case 'W':
		turn(&dice.front, &dice.east, &dice.other, &dice.west);
		break;
	case 'E':
		turn(&dice.front, &dice.west, &dice.other, &dice.east);
		break;
	}
	
	return dice;
}

void answer_east_side(dice_t dice, int north, int front)
{
	int *dice_p = &dice.front;
	int count = 0;
	
	/* set the north side before setting front side. */
	while(*dice_p != north){
		dice_p++;
		count++;		 /* count "How many check the number of side" of north. */
	}
	switch(count)
	{
	case 0:
		dice = turn_dice(dice, 'N');
		break;
	case 1:
		dice = turn_dice(dice, 'N');
		dice = turn_dice(dice, 'N');
		break;
	case 2:
		dice = turn_dice(dice, 'W');
		dice = turn_dice(dice, 'N');
		break;
	case 3:
		dice = turn_dice(dice, 'E');
		dice = turn_dice(dice, 'N');
		break;
	/* if count == 4, the number of 'north' is exist on the north side. */
	case 5:
		dice = turn_dice(dice, 'S');
		break;
	}
	
	/* set the front side. */
	dice_p = &dice.front;
	count = 0;
	while(*dice_p != front){
		dice_p++;
		count++;		 /* count "How many check the number of side" of front. */
	}
	switch(count)
	{
	/* if count == 0, the number of 'front' is exist on the front side. */
	/* count doesn't become 1(other side of the north side). */
	case 2:
		dice = turn_dice(dice, 'W');
		break;
	case 3:
		dice = turn_dice(dice, 'E');
		break;
	/* count doesn't become 4(the north side). */
	case 5:
		dice = turn_dice(dice, 'E');
		dice = turn_dice(dice, 'E');
		break;
	}
	
	/* answer the east side. */
	printf("%d\n", dice.east);
}

Measured memory_bytes: 596
local n, m = io.read("*n", "*n")
local t = {}
for i = 1, 8 do
  t[i] = {}
end
for i = 1, n do
  local a, b, c = io.read("*n", "*n", "*n")
  t[1][i] = a + b + c
  t[2][i] = a + b - c
  t[3][i] = a - b + c
  t[4][i] = a - b - c
  t[5][i] = -a + b + c
  t[6][i] = -a + b - c
  t[7][i] = -a - b + c
  t[8][i] = -a - b - c
end
local ret = 0
for i = 1, 8 do
  local tbl = t[i]
  table.sort(tbl, function(x, y) return x > y end)
  local z = 0
  for j = 1, m do
    z = z + tbl[j]
  end
  if i == 1 or ret < z then
    ret = z
  end
end
print(ret)

Measured memory_bytes: 2960
N, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
if a[0] > x:
    ans += a[0] - x
    a[0] = x
if a[-1] > x:
    ans += a[-1] - x
    a[-1] = x
for i in xrange(N - 1):
    if a[i] + a[i + 1] > x:
        ans += a[i + 1] - (x - a[i])
        a[i + 1] = x - a[i]
print ans


Measured memory_bytes: 11316
#include<vector>
#include<iostream>
using namespace std;
int main() {
	int code[4], line, hit, bro;
	while (cin>>code[0]) {
		hit = 0;
		bro = 0;
		for (int i = 1; i < 4; ++i) {
			cin >> code[i];
		}
		for (int i = 0; i < 4; ++i) {
			cin >> line;
			if (code[i] == line) {
				++hit;
			}
			else {
				for (int i2 = 0; i2 < 4; ++i2) {
					if (code[i2] == line) {
						++bro;
					}
				}
			}
		}
		cout << hit << " " << bro << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
const int maxm=2e5+5;
int num[45][45];
int a[maxm];
int n;
signed main(){
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;i++){//用字符串读,避免误差
        string s;cin>>s;
        int num=0;
        int cnt=-1;
        for(auto x:s){
            if(isdigit(x)){
                num=num*10+x-'0';
                if(cnt>0)cnt--;
            }else{//小数点
                cnt=9;
            }
        }
        if(cnt==-1)cnt=9;//如果没有小数点
        while(cnt-->0)num=num*10;
        a[i]=num;
    }
    for(int i=1;i<=n;i++){
        int c2=0,c5=0;
        while(a[i]%2==0){
            c2++;
            a[i]/=2;
        }
        while(a[i]%5==0){
            c5++;
            a[i]/=5;
        }
        num[c2][c5]++;
//        cout<<c2<<' '<<c5<<endl;
    }
    int ans=0;
    for(int i=18;i<=90;i++){
        for(int j=18;j<=90;j++){
            //结果数对为(i,j)
            for(int x=0;x<45&&x<=i;x++){
                for(int y=0;y<45&&y<=j;y++){
                    int xx=i-x,yy=j-y;
                    if(xx<0||xx>=45||yy<0||yy>=45)continue;
                    if(xx==x&&yy==y){//相等的情况特判一下,不能匹配自己
                        ans+=num[x][y]*(num[x][y]-1);
                    }else{
                        ans+=num[x][y]*num[xx][yy];
                    }
                }
            }
        }
    }
    ans/=2;
    cout<<ans<<endl;
    return 0;
}
/*
将每个数乘上1e9变成整数,
那么我们要找的是乘积是1e18的倍数的数对.

分解出每个数质因子2和5的个数,
那么可以计算出两个数相乘之后末尾有多少个0,
如果>=18则满足条件

然后每个数可以变为形如(cnt2,cnt5)的数对,
假设(a,b)和(c,d)相乘,那么0的个数为min(a+c,b+d)
我们要找的就是min(a+c,b+d)>=18的数对个数
因为n最大2e5,枚举数对肯定不行.

考虑到每个数对中2的个数最多log(1e4*1e9)<45,
那么直接开二维桶g[x][y]表示数对为(x,y)的数量,
枚举乘积的结果数对即可,复杂度O(70*70*45*45)<1e7
*/


Measured memory_bytes: 5152
def gcd(a, b)
    if a < b
        a,b = b,a
    end
    while b > 0
        r = a % b
        a = b
        b = r
    end
    return a
end

def lcm(a, b)
    if a == 0 || b == 0
        puts "Error"
        return 0
    end
    return (a * b / gcd(a, b)).to_i
end

while true do
    begin
        a, b = gets.split(" ").map(&:to_i)
        printf("%d %d\n", gcd(a, b), lcm(a, b))
    rescue
        break
    end
end

Measured memory_bytes: 8552
int main(void){
  char a[100];
  int i,s=0;
  
  scanf("%s",a);
  
  for(i=0; a[i]!=0; i++){
    if(i%2 == 0){
      if(a[i] == 'L')
      s = 1;
    }else{
      if(a[i] == 'R')
      s = 1;
    }    
  }
  
  printf("%s",s ? "No" : "Yes");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    REP(i, h){
        cin >> s[i];
    }
    int dx[4]={-1,1,0,0}, dy[4]={0,0,-1,1};
    REP(i, h){
        REP(j, w){
            bool flag = true;
            if(s[i][j] == '#') REP(k, 4){
                flag = false;
                int x = i + dx[k];
                int y = j + dy[k];
                if(0 <= x && x < h && 0 <= y && y < w){
                    if(s[x][y] == '#') {
                        flag = true;
                        break;
                    }
                }
            }
            if(!flag){
                pr("No");
                return 0;
            }
        }
    }
    pr("Yes");
}

Measured memory_bytes: 256
from sys import stdin
n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]
b_sta = 0
a_last = 0
b_a = 0
ab = 0
for i in li:
    ab += i.count("AB")
    if i[0] == "B" and i[-1] == "A":
        b_a += 1
    elif i[0] == "B":
        b_sta += 1
    elif i[-1] == "A":
        a_last += 1
if b_a == 0:
    print(ab+min(a_last,b_sta))
else:
    if a_last + b_sta > 0:
        print(ab+b_a+min(a_last,b_sta))
    else:
        print(ab+b_a-1)

Measured memory_bytes: 3700
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int cnt[] = new int[26];
        char a;
        while(sc.hasNext()){
            String S = sc.next();
            for(int i=0; i<S.length(); i++){
                if(S.charAt(i)-'a'>=0 && S.charAt(i)-'a'<26) cnt[S.charAt(i)-'a']++;
                else if(S.charAt(i)-'A'>=0 && S.charAt(i)-'A'<26) cnt[S.charAt(i)-'A']++;
            }
        }
        for(int i=0; i<26; i++){
            a = (char)('a' + i);
            System.out.printf("%s : %d\n", a, cnt[i]);
        }
    }
}


Measured memory_bytes: 26588
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define ll long long
typedef pair<int, int> pii;
ll mod=998244353;
ll p=1e9+7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    bool a[n+1]; memset(a,false,sizeof(a));
    for(int i=1; i<=k; i++){
        int d; cin>>d;
        for(int i=1; i<=d; i++){
            int x; cin>>x;
            a[x]=true;
        }
    }
    int ans=0;
    for(int i=1; i<=n; i++){
        if(!a[i]) ans++;
    }
    cout<<ans;
    
    return 0;
}



Measured memory_bytes: 3664
#include <stdio.h>

#define N 10000
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}Tree_t;

Tree_t T[N];
int n;

void preParse(int u){
if (u == NIL) return;
printf(" %d",u);
preParse(T[u].left);
preParse(T[u].right);
}

void inParse(int u){
if (u == NIL) return;
inParse(T[u].left);
printf(" %d",u);
inParse(T[u].right);
}

void postParse(int u){
if (u == NIL) return;
postParse(T[u].left);
postParse(T[u].right);
printf(" %d",u);
}

int main(){
  int id,left,right,root,i;

  scanf("%d",&n);

  for(i=0;i<n;i++){
     T[i].parent=NIL;
   }

for(i=0;i<n;i++){
  scanf("%d%d%d",&id,&left,&right);
  T[id].left=left;
  T[id].right=right;
  if(left!=NIL) T[left].parent=id;
  if(right!=NIL) T[right].parent=id;
}

for(i=0;i<n;i++){
if(T[i].parent==NIL) root = i;
}

printf("Preorder\n");
preParse(root);
printf("\n");

printf("Inorder\n");
inParse(root);
printf("\n");

printf("Postorder\n");
postParse(root);
printf("\n");

return 0;
}

Measured memory_bytes: 620
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <string>
#define LL long long
using namespace std;

const int N = 200010;
int a[N], b[N], c[N], n, cnt, cnt1;
LL t, t1, ans;

int main() 
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i];
	
	for(int i = 1; i <= n; i++)
	{
		if(a[i] < b[i])
		{
			t += b[i] - a[i];
			cnt ++;
		} 
		if(a[i] > b[i])
		{
			t1 += a[i] - b[i];
			c[++cnt1] = a[i] - b[i];
		}
	}
	if(cnt == 0) cout << 0 << endl;
	else if(t1 < t) cout << -1 << endl;
	else {
		sort(c + 1, c + cnt1 + 1);
		int i;
		for(i = cnt1; i >= 1; i--){
			ans += c[i];
			if(ans >= t) break;
		}
		cout << cnt + cnt1 - i + 1 << endl;
	}
	return 0;
}

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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0 ;i < 4;i++) {
    if (S.at(i) == '+') ans++;
    else ans--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import Control.Applicative
import Data.List
import Data.Char

getInt :: IO Integer
getInt = (\a -> read a :: Integer) <$> getLine

getIntArray :: IO [Integer]
getIntArray = ((map (\a -> read a :: Integer)) . words) <$> getLine

getStrArray :: Integer -> IO [String]
getStrArray 0 = return [] :: IO [String]
getStrArray n = (:) <$> getLine <*> (getStrArray (n - 1))

main = do
    putStrLn =<< (("ABC" ++) <$> getLine)


Measured memory_bytes: 380
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
ls=len(s)
kijun=s[ls//2]
if ls%2==0:
    tmp=0
    for i in range(ls//2):
        if kijun==s[ls//2+i]==s[ls//2-1-i]:
            tmp+=1
        else:
            break
    print(ls//2+tmp)
else:
    tmp=1
    for i in range(ls//2):
        if kijun==s[ls//2+1+i]==s[ls//2-1-i]:
            tmp+=1
        else:
            break
    print(ls//2+tmp)

Measured memory_bytes: 39536
puts([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][gets.to_i - 1])

Measured memory_bytes: 1788
# Nこの商品の中からM個選ぶ
N, M = list(map(int, input().split()))
# 商品iの得票数はA_i
A = list(map(int, input().split()))

A = sorted(A, reverse=True)

if A[M-1] >= sum(A)/(4*M):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9052
s = input()
t = input()
ans = 100000
for i in range(len(s) - len(t) + 1):
    lt = len(t)
    cnt = 0
    for a, b in zip(s[i:i+lt], t):
        if a != b:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

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

const int mod = 1e9+7;

int main(void){
  ll n;
  cin >> n;
  vector<ll> A(n);
  ll sum = 0;
  for (int i=0; i<n; i++){
    cin >> A[i];
    sum += A[i];
    sum %= mod;
  }
  ll ans = 0;
  for (int i=0; i<n; i++){
    sum -= A[i];
    if (sum < 0) sum+=mod;

    ans+=A[i]*sum;
    ans%=mod;
  }

  cout << ans << endl;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
#define SIZE 1000010
//status unsolved
long long fac[SIZE],finv[SIZE],inv[SIZE];
long long MOD=mod;

void make() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long modpow(long long a, long long n ) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// 二項係数計算
long long C(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 順列を求める
long long nPr(int n, int r) {
    if (n < 0 || r < 0 || n < r) return 0;
   return fac[n] * finv[n - r] % MOD;
}

int main(){
    long long n;
    cin>>n;
    make();
    long long answer=0;
    if(n<2){
        answer=0;
    }
    else{
    

        for(long long i=2;i<=n;i++){
            long long ans=1;
            ans*=C(n,i);
            ans%=mod;
            //cout<<ans<<endl;
            ans*=modpow(8,n-i);
            ans%=mod;
            //cout<<ans<<endl;
            ans*=modpow(2,i)-2;
            ans%=mod;
            answer+=ans;
            answer%=mod;
        }
        
    }
    cout<<answer<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 27068
N=int(input())
A=list(map(int,input().split()))
t=0
l=1
B=[]
for i in range(N):
    if t==A[i]:
        l+=1
    else:
        B.append(l)
        l=1
        t=A[i]
B.append(l)
ans=0
for i in B:
    ans+=i//2
print(ans)


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
using namespace std;
typedef pair<ll, ll>P;

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true, fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct etree { ll from, to, cost; };
bool comp(const etree& e1, const etree& e2) {
	return e1.cost < e2.cost;
}
#define ALL(x) (x).begin(),(x).end()


ll par[200010], Rank[200010];

void init(int n) {
	for (int i = 0;i < n;i++) {
		par[i] = i;
		Rank[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (Rank[x] < Rank[y])par[x] = y;
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}

int main() {
	int n;
	cin >> n;
	vector<P>x(n), y(n);
	etree es[250000];
	for (int i = 0;i < n;i++) {
		ll X, Y;
		cin >> X >> Y;
		x[i] = P(X, i);
		y[i] = P(Y, i);
	}
	sort(ALL(x));
	sort(ALL(y));
	for (int i = 0;i < n-1;i++) {
		es[i] = etree{ x[i].second,x[i + 1].second,abs(x[i].first - x[i + 1].first) };
		es[i + n - 1] = etree{ y[i].second,y[i + 1].second,abs(y[i].first - y[i + 1].first) };
	}
	sort(es, es + 2 * n - 2, comp);
	init(n);
	ll ans = 0;
	for (int i = 0;i < 2 * n - 2;i++) {
		etree e = es[i];
		if (!same(e.from, e.to)) {
			unite(e.from, e.to);
			ans += e.cost;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 10624
## atcoder problem 5 ever

try:
    import sys, r_std
    sys.stdin = open('inp.txt')
except:
    pass

MOD = 10**9 + 7
def solve(A, n, k):
    ## get comb dic
    dic = {}
    if k>n:
        return 0
    for i in range(k-2):
        dic[i] = 0

    dic[k-2] = 1
    for i in range(k-1, n-1):
        dic[i] = (dic[i-1] * i * pow(i-k+2, MOD-2, MOD)) % MOD

    cumm = {}
    cumm[0] = dic[0]
    for i in range(1,n-1):
        cumm[i] = cumm[i-1] + dic[i]

    ans = 0
    A.sort()
    for i in range(1, n+1):
        mul = cumm.get(i-2, 0) - cumm.get(n-i-1, 0)
        #print(mul, mul*A[i-1])
        ans = (ans + A[i-1]*mul) %MOD

    print(ans)
n, k = map(int, input().split())
arr = list(map(int, input().split()))

solve(arr, n, k)


Measured memory_bytes: 35740
#include<cstdio>
using namespace std;

int main(){
  int N;
  long long int ANS = 0;

  scanf("%d", &N);

  for (int i = 1; i <= N; i++){
    if (i % 3 != 0 && i % 5 != 0) ANS += i;
  }

  printf("%lld\n", ANS);

  return 0;
}

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

int main() {
    int n;
    int a = 0;
    int l, r;
    cin >> n;
    rep(i, n) {
        cin >> l >> r;
        a += (r - l + 1);
    }
    cout << a << endl;
}


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

int main(){
    int N,P;
    cin >> N;
    int X[N];
    double sum = 0;
    for(int i=0;i<N;i++) cin >> X[i];
    for(int i=0;i<N;i++){
        sum += X[i];
    }
    sum/=N;
    int p=floor(sum);
    int min_1 = 0;
    int min_2 = 0;
    for(int i=0;i<N;i++){
        min_1 += (X[i]-p) * (X[i]-p);
    }
    p = p+1;

    for(int i=0;i<N;i++){
        min_2 += (X[i]-p) * (X[i]-p);
    }
    int ans = min(min_1,min_2);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
int a[8]={0,1,2,4,8,16,32,64};
int n;
int main()
{

    cin>>n;
    for(int i=7;i>0;i--)
	{
        if(a[i]<=n)
		{
            cout<<a[i]<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;

  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P = std::pair<long long, long long>;

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

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

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

  ll h,w;
  std::cin>>h>>w;

  std::vector<std::vector<ll>> cost(h*w,std::vector<ll>(h*w,MOD));

  rep(i,0,h*w)cost[i][i]=0;

  std::vector<std::string> maze(h);

  rep(i,0,h)std::cin>>maze[i];

  rep(i,0,h){
    rep(j,0,w){
      if(maze[i][j]=='.'){
        rep(k,0,4){
          if(0<=i+dx[k]&&i+dx[k]<h&&0<=j+dy[k]&&j+dy[k]<w){
            if(maze[i+dx[k]][j+dy[k]]=='.'){
              cost[i*w+j][(i+dx[k])*w+j+dy[k]]=1;
            }
          }
        }
      }
    }
  }

  rep(k,0,h*w){
    rep(i,0,h*w){
      rep(j,0,h*w){
        chmin(cost[i][j],cost[i][k]+cost[k][j]);
      }
    }
  }

  ll max=0;

  rep(i,0,h*w){
    rep(j,0,h*w){
      if(cost[i][j]!=MOD)chmax(max,cost[i][j]);
    }
  }

  std::cout<<max<<"\n";

  return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	int n, m;
	cin >>n >>m;
	vector<VI> r(n);
	rep(i, m){
		int u, v; cin >>u >>v;
		r[u-1].push_back(v-1);
	}
	int s,t; cin >>s >>t; 
	s--; t--;
	
	vector<VI> dst(n, VI(3, MD));
	queue< pair<int, int> > que;
	que.emplace(s, 0); dst[s][0]=0;
	while(!que.empty()){
		int cy,cx; tie(cy,cx) = que.front();
		que.pop();
		for(auto x: r[cy]){
			int ny=x, nx=(dst[cy][cx] + 1)%3;
			if(dst[ny][nx] == MD ){
				que.emplace(ny, nx);
				dst[ny][nx] = dst[cy][cx] + 1;
			}
		}
	}
	//for(auto xl: dst){for(auto x :xl) cerr<<x<<" ";dbg();}
	cout <<(dst[t][0] <MD? dst[t][0]/3: -1) <<"\n";
	return 0;
}


Measured memory_bytes: 11136