akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;


int main(){
    long long N;
    long long K;
    cin >> N >> K;
    vector<double> C;
    for (int i = 0; i < N;i++){
        long long a;
        cin >> a;
        C.emplace_back((a+1)/2.0);
    }
    double tmp = 0;
    for (int i = 0;i < K;i++)
        tmp += C[i];
    double ans = tmp;
    for (int i = K; i < N;i++){
        tmp -= C[i - K], tmp += C[i];
        ans = max(ans, tmp);
    }
    cout << std::fixed << std::setprecision(15);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
lli a[11];
lli n,m;
lli p[11];//m
vl te[11];
lli ans=0;
void rec(lli i){
	if(i==n){
		bool ani=true;
		//for(lli i=0;i<m;i++)cout<<a[i];
		//cout<<endl;
		for(lli i1=0;i1<m;i1++){
			lli y=0;
			for(lli j=0;j<te[i1].size();j++)
				{//cout<<te[i1][j]<<" ";
			if(a[te[i1][j]]==1)y++;}
			//cout<<endl;
			//cout<<y<<endl;
			if(y%2!=p[i1]%2)ani=false;

		}
		if(ani)ans++;
		return;
	}
	a[i]=0;
	rec(i+1);
	a[i]=1;
	rec(i+1);
	return;
}



int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    for(lli i=0;i<m;i++){
    	lli k;
    	cin>>k;
    	for(lli j=0;j<k;j++){
    		lli x;
    		cin>>x;
    		te[i].pb(x-1);
    	}
    }
    for(lli i=0;i<m;i++)cin>>p[i];
    rec(0);
	cout<<ans;


    return 0;
}




Measured memory_bytes: 256
N, A, B = list(map(int, input().split()))
S = list(input())
a = 0
b = 0
ps = 0
for i in range(N):
	if S[i] == "a":
		if ps < A + B:
			print("Yes")
			ps += 1
		else:
			print("No")
		a += 1
	elif S[i] == "b":
		if ps < A + B and  b < B:
			print("Yes")
			b += 1
			ps += 1
		else:
			print("No")
		
	else:
		print("No")


Measured memory_bytes: 4712
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll long long
#define pb(a) push_back(a)
#define MAX (int)(pow(10,2) + 10)

ifstream in;
ofstream out;

// #define cin in
// #define cout out





void deal(){
	ll m, d;
	cin>>m>>d;
	ll sy = 0;
	for(ll k = 1; k<=m; k++)
		for(ll i = 2; i<=9; i++)
			for(ll j = 2; j <= 9; j++)
				sy+=(((i*j) == k)  && (i*10 + j <= d) );
	cout<<sy;
}





int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}



























































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

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

class topological_sort {
private:
	int V;
	vector<vector<int>> edges;
	vector<int> in;
public:
	topological_sort(int n) :V(n), edges(n), in(n) {}
	topological_sort(vector<vector<int>> &edges) :V(edges.size()), in(edges.size()) { this->edges = edges; }

	void add_edge(int from, int to) { edges[from].emplace_back(to); }

	int build() {

		for (int i = 0; i < V; i++) for (const auto &e : edges[i]) in[e]++;
		vector<int> used(V), res;
		res.reserve(V);

		queue<int> que;
		for (int i = 0; i < V; i++) {
			if (in[i] == 0 && !used[i]) {
				used[i] = 1;
				que.emplace(i);
			}
		}

		while (!que.empty()) {
			int now = que.front();
			DMP(now, in);
			que.pop();
			res.emplace_back(now);
			for (const auto &e : edges[now]) {
				in[e]--;
				if (in[e] == 0) {
					if (used[e]) return -INF; // unable to sort
					used[e] = used[now] + 1;
					que.emplace(e);
				}
			}
		}

		if (res.size() != V) return -1;
		else return *max_element(used.begin(), used.end());
	}

};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	auto id = [&](int l, int r) { return min(l, r)*N + max(l, r); };

	auto rid = [&](int id) {
		int row = id / N, col = id % N;
		if (row >= col) return make_pair(-1, -1);
		else return make_pair(row, col);
	};

	topological_sort ts(N * N);
	for (int i = 0; i < N; i++) {
		vector<int> A(N - 1);
		for (int j = 0; j < N - 1; j++) cin >> A[j];
		for (int j = 0; j < N - 2; j++) ts.add_edge(id(i, A[j] - 1), id(i, A[j + 1] - 1));
	}

	cout << ts.build() << "\n";

	return 0;
}


Measured memory_bytes: 53032
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define F first
#define s second
#define int long long		
int x[214514];
double y[214514];
string z[214514];
int sum[214514];
signed main(){
	ic(a) ic(b)
	if(b==1){
		c(0)
		return 0;
	}	
	c((b-2)/(a-1)+1)
}		


Measured memory_bytes: 2688
#include<bits/stdc++.h>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
 
using namespace std;
//...
struct Edge { 
  int src,dst,w; 
  bool operator < ( const Edge& e ) const {
    if( w != e.w ) return w < e.w;
    if( src != e.src ) return src < e.src;
    return dst < e.dst;
  }
};
const int MAX_V = 510; //
int V,E; //
vector<Edge> G[MAX_V]; // undirected graph
vector<int> dfs_num,dfs_low,dfs_parent,articulation_vertex;
int dfsNumberCounter, dfsRoot, rootChildren;
int cost[MAX_V][MAX_V];
 
//O(V+E)
int base_weight;
vector<Edge> bridges;
#define UNVISITED -1
void articulationPointAndBridge(int u){
  dfs_low[u] = dfs_num[u] = dfsNumberCounter++;
  rep(j,(int)G[u].size()){
    Edge &v = G[u][j];
    if( dfs_num[v.dst] == UNVISITED ) {
      dfs_parent[v.dst] = u;
      if( u == dfsRoot ) rootChildren++;
 
      articulationPointAndBridge(v.dst);
 
      if( dfs_low[v.dst] >= dfs_num[u] ) articulation_vertex[u] = true;
      if( dfs_low[v.dst] >  dfs_num[u] ) {
        if( base_weight == cost[u][v.dst] ) {
          bridges.push_back((Edge){u,v.dst,base_weight});
        }
        //printf("Edge (%d,%d) is a bridge\n",u,v.dst);
      }
      dfs_low[u] = min(dfs_low[u],dfs_low[v.dst]);
    } else if( v.dst != dfs_parent[u] ) {
      dfs_low[u] = min(dfs_low[u],dfs_num[v.dst]);
    }
  }
}
 
void calculateArticulationPointAndBridge(){
  dfsNumberCounter = 0;
  dfs_num.assign(V,UNVISITED);
  dfs_low.assign(V,0);
  dfs_parent.assign(V,0);
  articulation_vertex.assign(V,0);
   
  rep(i,V) {
    if( dfs_num[i] == UNVISITED ) {
      dfsRoot = i, rootChildren = 0;
      articulationPointAndBridge(i);
      articulation_vertex[dfsRoot] = ( rootChildren > 1 );
    }
  }
}
 
int par[MAX_V];
 
int find(int x){
  if( x == par[x] ) return x;
  return par[x] = find(par[x]);
}
 
void unit(int x,int y){
  x = find(x), y = find(y);
  if( x != y ) par[x] = y;
}
 
 
void compute(vector<Edge> edges){
  set<int> weights;
  rep(i,V) par[i] = i;
  sort(edges.begin(),edges.end());
  rep(i,E){
    Edge &e = edges[i];
    if( find(e.src) != find(e.dst) ) {
      unit(e.src,e.dst);
      weights.insert(e.w);
    }
  }
  int cnt=0,sum=0;
  int cur = 0;
  for(set<int>::iterator it=weights.begin();it!=weights.end();it++){
    int w = *it;
    while( cur < E && edges[cur].w < w ) ++cur;
    if( cur >= E ) break;
    if( edges[cur].w > w ) continue;
    base_weight = w;
    while( cur < E && edges[cur].w == w ) {
      Edge &e = edges[cur++];
      G[e.src].push_back((Edge){e.src,e.dst,e.w});
      G[e.dst].push_back((Edge){e.dst,e.src,e.w});
    }
    bridges.clear();
    calculateArticulationPointAndBridge();
    cnt += (int)bridges.size();
    sum += (int)bridges.size() * w;
  }
  printf("%d %d\n",cnt,sum);
}
 
int main(){
  memset(cost,-1,sizeof(cost));
  vector<Edge> edges;
  scanf("%d %d",&V,&E);
  {
    int s,t,w;
    rep(i,E){
      scanf(" %d %d %d",&s,&t,&w);
      --s, --t;
      edges.push_back((Edge){s,t,w});
      cost[s][t] = cost[t][s] = w;
    }
  }
  compute(edges);
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    int n,m;
    cin>>n>>m;
    vector<string> a(n),b(m);
    REP(i,n){
        cin>>a[i];
    }
    REP(i,m){
        cin>>b[i];
    }
    REP(i,n-m+1){
        REP(j,n-m+1){
            bool flag=true;
            REP(k,m){
                if(a[i+k].substr(j,m)!=b[k]){
                    flag=false;
                    break;
                }
            }
            if(flag){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

bool check(ll x, ll n, ll a, ll b, v64 &h)
{
	ll cnt = 0, c = a - b;
	for (int i = 0; i < n; i++)
		cnt += (max(0ll, h[i] - x * b) + c - 1) / c;
	return (cnt <= x);
}

void solve()
{
	ll n, a, b;
	cin >> n >> a >> b;
	v64 h(n, 0);
	for (int i = 0; i < n; i++)
		cin >> h[i];
	ll lo = 0, hi = 1e9 + 10, ans = 0;
	while (hi - lo > 1)
	{
		ll mid = (lo + hi) / 2;
		if (check(mid, n, a, b, h))
			hi = ans = mid;
		else
			lo = mid;
	}
	cout << ans << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <string>
#include <map>
using namespace std;

char buf[1000];
map<string, int> cnt;

int main() {
  while (1) {
    int _;
    if (scanf("%d,", &_) != 1) break;
    scanf("%s", buf);
    cnt[buf]++;
  }

  printf("%d\n", cnt["A"]);
  printf("%d\n", cnt["B"]);
  printf("%d\n", cnt["AB"]);
  printf("%d\n", cnt["O"]);
}

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

void solve(){
    string A, B, C;
    cin >> A >> B >> C;
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    reverse(C.begin(), C.end());
    char curr = 'a';
    while(1){
        if(curr == 'a'){
            if(A.size() == 0){
                cout << "A\n";
                return;
            }
            curr = A.back();
            A.pop_back();
        } else if(curr == 'b'){
            if(B.size() == 0){
                cout << "B\n";
                return;
            }
            curr = B.back();
            B.pop_back();
        } else{
            if(C.size() == 0){
                cout << "C\n";
                return;
            }
            curr = C.back();
            C.pop_back();
        }
    }
}

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

    bool multitest = false;
   // multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

#define MAX_V 1000

struct edge{
	long long int to;
	long long int cost;
};

long long int INF = 1000000000000000;

typedef pair<long long int, long long int> P; // first??????????????¢???second??????????????????

vector<edge> G[MAX_V];
long long int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(long long int s, long long int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(long long int i = 0; i < V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	
	que.push(P(0, s));
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		long long int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(long long int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

int main(){
	
	while(true){
		
		long long int n, m, s, g1, g2;
		
		cin >> n >> m >> s >> g1 >> g2;
		
		s--;
		g1--;
		g2--;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < MAX_V; i++){
			G[i].erase(G[i].begin(), G[i].end());
		}
		
		for(int i = 0; i < m; i++){
			edge e1;
			int from, to, cost;
			cin >> from >> to >> cost;
			from--;
			to--;
			e1.to = to;
			e1.cost = cost;
			G[from].push_back(e1);
		}
		
		long long int ans = INF;
		
		for(int i = 0; i < n; i++){
			shortest_path(s, n);
			long long int cost_sum = d[i];
			shortest_path(i, n);
			cost_sum += d[g1] + d[g2];
			if(ans > cost_sum){
				ans = cost_sum;
			}
		}
		
		cout << ans << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
int main()
{
    ll i,x,p=0,k,j=0;
    string str;
    cin>>str;
    cin>>k;
    for(i=0;i<str.size();i++)
    {
        x=(str[i]-48);

        if(x==1){
            p++;
        }
        else{
                j=i;
            break;
        }
    }

    if(k<=p)
        cout<<1<<endl;
    else
        cout<<str[j]<<endl;
    return 0;
}


Measured memory_bytes: 3572
N,A,B = map(int,input().split())
def power_func(a,n,p=10**9+7):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
            res=(res*a) %p
    return res

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y
#ans = power_func(2,N) - 1 - combination(N,A) - combination(N,B)
ans = power_func(2,N) - 1
ans = ans if ans >= 0 else ans + 10 ** 9 + 7
ans = ans - combination(N,A)
ans = ans if ans >= 0 else ans + 10 ** 9 + 7
ans = ans - combination(N,B)
ans = ans if ans >= 0 else ans + 10 ** 9 + 7
print(ans)

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

int main(){
	string s;
	cin >> s;
	
	int a = 0;
	for (int i=0; i<s.length(); i++){
		a += stoi(s.substr(i, 1));
	}
	
	if (stoi(s) % a == 0) cout << "Yes";
	else cout << "No";
	 
}

Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int m[3];

int main() {
    memset(m, 0, sizeof(m));
    int n = gi();
    int a = gi();
    int b = gi();
    for (int i = 0; i < n; i++) {
        int x = gi();
        if (x <= a)
            m[0]++;
        else if (x <= b)
            m[1]++;
        else
            m[2]++;
    }

    printf("%d\n", MIN(MIN(m[0], m[1]), m[2]));

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    string s,s1;
    cin>>s>>s1;
    int c=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)==s1.at(i)){
            c++;
        }
    }
    cout<<c<<endl;





}




Measured memory_bytes: 256
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) (((a) + (b) - 1) / (b))
#define tomax(a, b) ((a) = max((a), (b)))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

int main(){
    StarBurstStream

    int h, w;
    cin >> h >> w;

    vector<vector<int>> a(h + 1, vector<int>(w + 1));
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++) cin >> a[i][j];
    }

    vector<pair<pii, pii>> ans;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j < w; j++){
            if(a[i][j] % 2 == 0) continue;
            ans.eb(mp(mp(i, j), mp(i, j + 1)));
            a[i][j]--;
            a[i][j + 1]++;
        }
    }

    for(int i = 1; i < h; i++){
        if(a[i][w] % 2 == 0) continue;
        ans.eb(mp(mp(i, w), mp(i + 1, w)));
        a[i][w]--;
        a[i + 1][w]++;
    }

    cout << ans.size() << "\n";
    for(auto i : ans){
        cout << i.F.F << " " << i.F.S << " " << i.S.F << " " << i.S.S << "\n";
    }

    return 0;
}

Measured memory_bytes: 5236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef set<int> si;
typedef set<string> ss;
typedef map<int,int> mii;
typedef map<string,int>msi;
typedef map<string,string>mss;
void solve(){
    string inp,weeks[7];
    weeks[0]="MON";
    weeks[1]="TUE";
    weeks[2]="WED";
    weeks[3]="THU";
    weeks[4]="FRI";
    weeks[5]="SAT";
    weeks[6]="SUN";
    cin>>inp;
    int n;
    for(int i=0;i<7;i++){
        if(weeks[i]==inp){
            n=i;
        }
    }
    int res = 6-n;
    if(res==0){
        res=7;
    }
    cout<<res<<endl;
}
int main(){
    int t;
    t=1;
    while(t--){
       solve();
    }
    return 0;
}


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

int cnt_digits(ll N){
  int digits = 0;
  while(N>0){
    digits++;
    N /= 10;
  }
  return digits;
}

int main(){
  ll N;
  cin >> N;
  
  int ans = cnt_digits(N);
  
  for(ll A=1LL; A*A<=N; A++){
    if(0 != N%A){
      continue;
    }
    const ll B = N/A;
    
    int tmp = max(cnt_digits(A), cnt_digits(B));
    
    if(ans > tmp){
      ans = tmp;
    } 
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}


int main(){
  ll N, M, K; cin >> N >> M >> K;
  if(N==1){
    cout << M << endl;
    return 0;
  }
  if(M==1){
    if(K==N-1){
      cout << 1 << endl;
      return 0;
    }
    cout << 0 << endl;
    return 0;
  }
  mint ans=0;
  mint start=M;
  mint Choose=choose(N-1,K);
  if(K==0){
    for(int i=0;i<N-1;i++){
      start*=M-1;
    }
    cout << start.x << endl;
    return 0;
  }
  if(N-1!=K){
    for(int i=0;i<N-1-K;i++){
      start*=M-1;
    }
  }
  for(ll i=K;i>=0;i--){
    if(i!=K){
      start*=M-1;
      Choose*=i+1;
      Choose/=(N-i-1);
    }
    ans+=start*Choose;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

using f64 = double;
using i64 = long long;
using pii = pair<int, int>;

const int N = 105;

int n;	

int dp[3][N];

int main() {
#ifdef HOME
	freopen("arc.in", "r", stdin);
	freopen("arc.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	cin >> n;
	for (int i = 1; i <= 2; ++i)
	for (int j = 1; j <= n; ++j)
		cin >> dp[i][j];

	for (int i = 1; i <= n; ++i)
		dp[1][i]+= dp[1][i - 1];
	for (int i = 1; i <= n; ++i)
		dp[2][i]+= max(dp[1][i], dp[2][i - 1]);

	cout << dp[2][n] << endl;

	return 0; }


Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
arr = gets.split.map(&:to_i)

@map = Array.new(n, -1)

nextn = 0
cnt = 1

loop do
	break if k == 0
	nn = arr[nextn] - 1
	#puts "#{cnt} #{nextn+1} #{arr[nextn]} #{k}"
	if @map[nn] != -1 
		#puts "--#{k} #{cnt} #{@map[nn]}"
		if((cnt - @map[nn]) == 1)
			k = 1
		else
			k = k % (cnt - @map[nn])
		end
	    #puts "--#{k}"
	end
    @map[nn] = cnt
    nextn = nn
    cnt += 1
    k -= 1
end

puts nextn+1

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;

#define pll pair<ll,ll>


ll N;
ll w_dam[1000001];
ll r_mou[1000001];

vector<int> ans;
int main(){
    cin>>N;
    ll x = 0;
    for(int i=1;i<=N;++i){
        cin >> w_dam[i];
        if(i%2==1){ x += w_dam[i]; }
        else{ x -= w_dam[i]; }
    }
    w_dam[0] = w_dam[N];
    
    r_mou[1] = x/2;
    for(int i=2;i<=N;++i){
        r_mou[i] = w_dam[i-1] - r_mou[i-1];
    }
    
    for(int i=1;i<=N;++i){
        r_mou[i] *= 2;
        if(i<N){
            cout << r_mou[i] << " ";
        }else{
            cout << r_mou[i] << "\n";
        }
    }
    

}


Measured memory_bytes: 6144
import math

N = int(input())
X, Y = map(int, input().split())
for i in range(N - 1):
    T, A = map(int, input().split())
    if T >= X and A >= Y:
        X = T
        Y = A
    else:
        if X % T == 0:
            t = X // T
        else:
            t = X // T + 1
        if Y % A == 0:
            a = Y // A
        else:
            a = Y // A + 1
        X = T * max(a, t)
        Y = A * max(a, t)
print(X + Y)


Measured memory_bytes: 3192
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<unistd.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ST first
#define ND second
#define ll long long
#define ld long double
using namespace std;
using namespace __gnu_pbds;
 
// replace ll with pair if multiset needed
typedef tree<pair<int,int>, null_type, greater<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set secik;
 
const ll INF = 1e9 + 9;
const ll MOD = 1e9 + 7;
const long long LINF = (ll)1e18 + 3;
 
// secik.insert({x, t++});
// secik.erase(secik.lower_bound({x,-1}));
// *secik.find_by_order(x)).first << "\n";
// secik.order_of_key(x)
 
//random_device device;
//mt19937 gener(device());
//uniform_int_distribution<int> gen(0,n-1);

const int SIZE = 1e5 + 6;

vector<int> adj[SIZE];

int in[SIZE];
int dp[SIZE];

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

	int n,m; cin >> n >> m;	
	
	for(int i = 0; i < m; i++){
		int a,b; cin >> a >> b;
		adj[a].push_back(b);
		in[b]++;
	}

	queue<int> q;
	for(int i = 1; i <= n; i++){
		if(in[i] == 0) q.push(i);
	}	

	int res = 0;

	while(!q.empty()){
		int x = q.front();
		res = max(res,dp[x]);
		q.pop();
		for(auto it : adj[x]){
			dp[it] = max(dp[it],dp[x] + 1);
			in[it]--;
			if(in[it] == 0) q.push(it);
		}
	}

	cout << res;



}

Measured memory_bytes: 6528
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
  int W, H;
  int w, h;
  cin >> H >> W;
  cin >> h >> w;
  cout << (W-w)*(H-h) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;

int main(){
    int n,x,y;
    cin >> n >> x >> y;
    vector<int> ans(n,0);
    x--;
    y--;
    Graph G(n);
    G[0].push_back(1);
    G[n-1].push_back(n-2);
    for(int i=1;i<n-1;i++){
        G[i].push_back(i-1);
        G[i].push_back(i+1);
    }
    G[x].push_back(y);
    G[y].push_back(x);

    /*
    for(int i=0;i<n;i++){
        for(auto x:G[i]){
            cout << x << " ";
        }
        cout << endl;
    }
    */

    for(int i=0;i<n;i++){
        vector<int> dist(n,-1);
        queue<int> que;
        dist[i] = 0; //座標iからの距離
        que.push(i);
        while(!que.empty()){
            int v = que.front();
            que.pop();
            for(int nv : G[v]){
                if(dist[nv] != -1) continue;

                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }
        for(int j=0;j<n;j++){
            ans[dist[j]]++;
        }
    }
    for(int i=1;i<n;i++){
        cout << ans[i] / 2 << endl;
    }

}

Measured memory_bytes: 384
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = s_inpl()   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import math
import copy
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
from bisect import bisect_left, bisect_right
# import numpy as np

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]

def i_inpl(): return int(input())
def s_inpl(): return map(int,input().split())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

############
############
############

A, P = l_inpl()

print((A*3+P)//2)

Measured memory_bytes: 3672
N, M = [int(i) for i in input().split()]
food = [[False for _ in range(N)] for _ in range(M)]

for i in range(N):
    favorite = [int(j)-1 for j in input().split()][1:]
    for f in favorite:
        food[f][i] = True

ans = 0
for f in food:
    if sum(f) == N:
        ans += 1

print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] ss = s.toCharArray();
		String ans = "2018";
		for(int i=4; i<s.length(); i++) {
			ans += ss[i];
		}
		System.out.println(ans);
	}
	
	static int binarySearch(int[] A, int x) {
		int l = 0;
		int r = A.length;
		while(l<r) {
			int mid = (l+r)/2;
			if(A[mid] == x) return mid;
			else if(x<A[mid]) r = mid;
			else l = mid+1;
		}
		return -1;
	}
	
	static long upper_bound(int[] A, int b) {
		// bよりおおきい値がはじめて出てくるindexを返す
		return lower_bound(A, b+1);
	}

	static long lower_bound(int[] A, int b) {
		// b以上の値がはじめて出てくるindexを返す
		int lb=0;
		int ub=A.length;
		while(ub>lb) {
			int mid = (lb+ub)/2;
			if(A[mid]>=b) ub = mid;
			else lb = mid+1;
		}
		return lb;
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] ary1 = new char[3];
        char[] ary2 = new char[3];
        ary1 = s.toCharArray();
        ary2 = t.toCharArray();
        int ans = 0;
        for (int i = 0; i < 3; i++) {
            if (ary1[i] == ary2[i]) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int x=sc.nextInt();
        if(x==2*n-1 || x==1){
            out.println("No");
        }
        else {
            out.println("Yes");
            int ans[]=new int[2*n-1];
            for (int i=0; i<2*n-1; i++) {
                ans[(i+n-x+2*n-1)%(2*n-1)]=i+1;
            }
            for (int i=0; i<2*n-1; i++)
                out.println(ans[i]);
        }

        // out.println(ans);
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  

    static long gcd(long a, long b){
        if(min(a,b) == 0)return max(a,b);
        return gcd(max(a,b) % min(a,b),min(a,b));
    }
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


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

int main(){
  int A,B;
  cin>>A>>B;
  vector<vector<char>> C(A,vector<char>(B));
    for(int i=0;i<A;i++){
     for(int j=0;j<B;j++){
        cin>>C.at(i).at(j);
     }
    }
    for(int i=0;i<A;i++){
      for(int l=0;l<2;l++){
     for(int j=0;j<B;j++){
       if(j!=B-1)
       cout<<C.at(i).at(j);
       if(j==B-1)
       cout<<C.at(i).at(j)<<endl;
     }
}
    }
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 200005;

int n;
char s[N];
int pre[N], suf[N];

int main() {
	read(n);
	readStr(s + 1);
	for (int i = 1; i <= n; ++i) {
		pre[i] = pre[i - 1] + (s[i] == '#');
	}
	for (int i = n; i; --i) {
		suf[i] = suf[i + 1] + (s[i] == '.');
	}
	int ans = n;
	for (int i = 0; i <= n; ++i) {
		ans = std::min(ans, pre[i] + suf[i + 1]);
	}
	print(ans);
}


Measured memory_bytes: 5556
N,M=map(int,input().split())
n=[]
m=[]
for i in range(N):
  n.append(list(map(int,input().split())))
for l in range(M):
  m.append(list(map(int,input().split())))
L=[]
for i in n:
  M=[]
  for l in m:
    A=abs(i[0]-l[0])+abs(i[1]-l[1])
    M.append(A)
  print(M.index(min(M))+1)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char c[101][101];
int main()
    {
    int a,b;
    cin>>a>>b;
    for(int i=0;i<a;i++)
        for(int j=0;j<b;j++)
        {
        cin>>c[i][j];
        }
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++)
            {
            int sum=0;
            if(c[i][j]=='#') cout<<'#';
            if(c[i][j]=='.')         
                {
                if(c[i-1][j+1]=='#') sum++;
                if(c[i][j+1]=='#') sum++;
                if(c[i+1][j+1]=='#') sum++;
                if(c[i-1][j]=='#') sum++;
                if(c[i+1][j]=='#') sum++;
                if(c[i-1][j-1]=='#') sum++;
                if(c[i][j-1]=='#') sum++;
                if(c[i+1][j-1]=='#') sum++;
                cout<<sum;
                }
            }
            cout<<endl;
    }   
    return 0;     
    }

Measured memory_bytes: 256
#import numpy as np
import sys
import math
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
coordinate = []
[coordinate.append(list(map(int,input().split()))) for _ in range(N)]

foactorial = 1
for i in range(1,N):
    foactorial *= i

ans = 0.0
for i in range(N):
    for j in range(N):
        ans = ans + math.sqrt( (coordinate[i][0] - coordinate[j][0]) ** 2 + (coordinate[i][1] - coordinate[j][1]) ** 2)
print(ans * foactorial / (foactorial * N) )

Measured memory_bytes: 3316
#include<stdio.h>
#include<math.h>
int main()
{
    long long a,b,c,n,i;
    scanf("%lld",&n);
    for(i=n;i>0;i--)
    {
        b=sqrt(i);
        c=pow(b,2);
        if(i==c)
          {
                printf("%lld",i);
        break;
          }

    }
}



Measured memory_bytes: 128
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 1005
#define MAXM 2005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
ll x;
struct edge{int to,cost;};
struct edge2{int u,v,w;};
edge2 a[MAXM];
vector<edge> G[MAXN];
vector<edge> tree[MAXN];
int fa[MAXN],dep[MAXN],cost[MAXN];
map<P,int> mp;
void add(int &a,int b) {a+=b; if(a>=MOD) a-=MOD;}
void dec(int &a,int b) {a-=b; if(a<0) a+=MOD;}
bool cmp(edge2 p,edge2 q)
{
    return p.w<q.w;
}
void add_edge(int u,int v,int w)
{
    G[u].push_back((edge){v,w});
    G[v].push_back((edge){u,w});
}
void add_tree_edge(int u,int v,int w)
{
    tree[u].push_back((edge){v,w});
    tree[v].push_back((edge){u,w});
}
int p[MAXN],r[MAXN];
void init(int n)
{
    for(int i=1;i<=n;i++)
    {
        p[i]=i;
        r[i]=0;
    }
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
void unite(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) p[x]=y;
    else
    {
        p[y]=x;
        if(r[x]==r[y]) r[x]++;
    }
}
bool same(int x,int y)
{
    return find(x)==find(y);
}
int pow_mod(int a,int i)
{
    int s=1;
    while(i)
    {
        if(i&1) s=1LL*s*a%MOD;
        a=1LL*a*a%MOD;
        i>>=1;
    }
    return s;
}
ll kruskal()
{
    sort(a,a+m,cmp);
    init(n);
    ll ret=0;
    for(int i=0;i<m;i++)
    {
        if(!same(a[i].u,a[i].v))
        {
            ret+=a[i].w;
            unite(a[i].u,a[i].v);
            mp[P(a[i].u,a[i].v)]=1;
            add_tree_edge(a[i].u,a[i].v,a[i].w);
        }
    }
    return ret;
}
void dfs(int v,int p,int d,int c)
{
    fa[v]=p;dep[v]=d;cost[v]=c;
    for(auto e:tree[v])
    {
        if(e.to==p) continue;
        dfs(e.to,v,d+1,e.cost);
    }
}
int find_max(int u,int v)
{
    int ans=0;
    if(dep[u]<dep[v]) swap(u,v);
    while(dep[u]>dep[v])
    {
        ans=max(ans,cost[u]);
        u=fa[u];
    }
    while(u!=v)
    {
        ans=max(ans,cost[u]);ans=max(ans,cost[v]);
        u=fa[u];v=fa[v];
    }
    return ans;
}
int main()
{
    scanf("%d%d",&n,&m);
    scanf("%lld",&x);
    for(int i=0;i<m;i++)
    {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        if(u>v) swap(u,v);
        add_edge(u,v,w);
        a[i].u=u;a[i].v=v;a[i].w=w;
    }
    ll res=kruskal();
    if(res>x)
    {
        puts("0");
        return 0;
    }
    ll d=x-res;
    int less=0,equal=0,greater=0;
    dfs(1,0,0,0);
    for(int i=0;i<m;i++)
    {
        if(mp[P(a[i].u,a[i].v)]) continue;
        ll now=res-find_max(a[i].u,a[i].v)+a[i].w;
        if(now==x) equal++;
        else if(now>x) greater++;
        else less++;
    }
    assert(equal+greater+less==(m-(n-1)));
    int ans=0;
    if(d==0)
    {
        ans=pow_mod(2,n-1);dec(ans,2);
        ans=1LL*ans*pow_mod(2,m-(n-1))%MOD;
        add(ans,2LL*(pow_mod(2,equal)-1)*pow_mod(2,m-(n-1)-equal)%MOD);
        printf("%d\n",ans);
    }
    else
    {
        assert(d>0);
        ans=2LL*(pow_mod(2,equal)-1)*pow_mod(2,greater)%MOD;
        printf("%d\n",ans);
    }
    return 0;
}



Measured memory_bytes: 512
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    long long int n=0;
    long long int a[10000];
    long long int d=0;
    long long int c=0;
    long long int i=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    while(1)
    {
        for(i=0;i<n;i++)
        {
            if(a[i]==0|| a[i]%2!=0)
            {
                d=d+1;
                break;
            }
            else
            
            {
                a[i]=a[i]/2;
            }
        }
        if(d==1)
        {
            break;
        }
        else
        {
            c=c+1;
        }
    }
    cout<<c;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	for (int ii = 0; ii < s.size(); ++ii){
		if (ii % 2 == 1) continue;
		cout << s[ii];
	}

	cout << "\n";

	return 0;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> S(N + 1);
    for(int i = 0; i < N; ++i) {
        int A;
        cin >> A;
        S[i + 1] = (S[i] + A) % K;
    }

    map<int, int> mp;
    int j = 0;
    ll ans = 0;
    for(int i = 0; i <= N; ++i) {
        if(i - j >= K) {
            mp[((S[j] - j) % K + K) % K]--;
            j++;
        }
        int tmp = ((S[i] - i) % K + K) % K;
        ans += mp[tmp];
        mp[tmp]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	string a,b,e;
	int c,d;
	cin>>a>>b;
	cin>>c>>d;
	cin>>e;
	if(e==a)
	{
		cout<<c-1<<" "<<d<<endl;
	}
	if(e==b)
	{
		cout<<c<<" "<<d-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256