akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static exMath;
using static exReadLine;


class Program
{
    static void Main(string[] args)
    {
        long X;
        longReadLine(out X);
        long a = X / 500;
        long b = X % 500 / 5;
        WriteLine(a * 1000 + b * 5);
        
    }
}

static class exReadLine
{
    public static void intReadLine(out int a)
    {
        a = int.Parse(ReadLine());
    }
    public static void intReadLine(out int a, out int b)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void intReadLine(out int a, out int b, out int c)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void intReadLine(out int a, out int b, out int c, out int d)
    {
        int[] input = ReadLine().Split().Select(int.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }

    public static void longReadLine(out long a)
    {
        a = long.Parse(ReadLine());
    }
    public static void longReadLine(out long a, out long b)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
    }
    public static void longReadLine(out long a, out long b, out long c)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
    }
    public static void longReadLine(out long a, out long b, out long c, out long d)
    {
        long[] input = ReadLine().Split().Select(long.Parse).ToArray();
        a = input[0];
        b = input[1];
        c = input[2];
        d = input[3];
    }
    
    public static int[] intArrayReadLine()
    {
        return ReadLine().Split().Select(int.Parse).ToArray();
    }

    public static long[] longArrayReadLine()
    {
        return ReadLine().Split().Select(long.Parse).ToArray();
    }

    public static List<int> intListReadLine()
    {
        return ReadLine().Split().Select(int.Parse).ToList();
    }

    public static List<long> longListReadLine()
    {
        return ReadLine().Split().Select(long.Parse).ToList();
    }
}

static class exMath
{
    // 最大公約数
    public static int Gcd(int a, int b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
    public static long Gcd(long a, long b)
    {
        if (a < b) return Gcd(b, a);
        while (b != 0)
        {
            var r = a % b;
            a = b;
            b = r;
        }
        return a;
    }

    // 最小公倍数
    public static long Lcm(int a, int b)
    {
        return BigMul(a, b) / Gcd(a, b);
    }
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n;
    cin >> n;
    vll a(n);
    REP(i, n) cin >> a[i];
    vll ball(n);
    for(ll i = n - 1; i >= 0; i--){
        ll k = 1, cnt = 0;
        while(k * (i + 1) <= n){
            if(ball[k * (i + 1) - 1]) cnt++;
            k++;
        }
        if((a[i] + cnt) % 2) ball[i] = 1;
    }
    ll rr = 0;
    REP(i, n){
        if(ball[i]) rr++;
    }
    cout << rr << endl;
    REP(i, n){
        if(ball[i]) cout << i + 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <iomanip>
#include <queue>
#include <deque>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <bitset>

#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x, y) memset(x, y, sizeof(x))
#define pb push_back
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

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

using namespace std;
using ll = long long;

const int kInf = 2e9;
const ll kLInf = 2e18;

int gcd (int a, int b) {
   return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int N,M;
multiset<int> A;

int main()
{
   cout << fixed << setprecision(10);
   cin >> N >> M;
   int a;
   REP(i, N) {
      cin >> a;
      A.insert(a);
   }
   ll ans = 0;
   while (M) {
      auto itr = A.end();
      itr--;
      int tmp = *itr / 2;
      eprintf("%d, %d\n", *itr, tmp);
      A.erase(itr);
      A.insert(tmp);
      M--;
   }
   auto itr = A.begin();
   while (itr != A.end()) {
      ans += *itr;
      eprintf("ans += %d\n", *itr);
      itr++;
   }
   cout << ans << endl;
   return 0;
}



Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n,k[100];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>k[i];
  }
  sort(k,k+n);
  int ans=n;
  for(int i=1;i<n;i++){
    if(k[i-1]==k[i]) {
      ans-=1;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import math
def main():
    judge_l = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
    l = int(input().rstrip())
    for i in range(l):
      judge = input().rstrip()
      judge_l[judge] += 1
    
    print('AC x {}'.format(judge_l['AC']), end='\n')
    print('WA x {}'.format(judge_l['WA']), end='\n')
    print('TLE x {}'.format(judge_l['TLE']), end='\n')
    print('RE x {}'.format(judge_l['RE']), end='')
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 9212
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    std::string S;

    std::cin >> S;

    if (S == "ABC") {
        std::cout << "ARC" << std::endl;
    } else {
        std::cout << "ABC" << std::endl;
    }

    return 0;
}


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

using namespace std;

#define run_forest_run ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define vi vector <int>
#define sz(a) (int)a.size()
#define fi first
#define se second
#define si set <int>
#define all(x) (x).begin(),(x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);} 

const int inf = 1e9;	
const int mod = inf + 7;

const int N = 205000;
vector <int> g[N];
vector <bool> visited(N);
vector <int> color(N);


int n, m, q, x, y, k;
int dp[100001];

int main()
{                   
	run_forest_run;
	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}	
	dp[0] = 0;
	for (int i = 1; i < n; i++)
	{
		for (int j = 1; j <= min(i,k); j++)
		{	
		    if(j==1) dp[i] = abs(a[i]-a[i-j]) + dp[i-j];
            else dp[i] = min(dp[i],abs(a[i]-a[i-j]) + dp[i-j]);
		}
	}
	cout << dp[n-1];



}


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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
#define pii pair<int, int>

int main(){
    int n;
    cin >> n;
    int s=0;
    for(int i=0; i<n; ++i){
        int x;
        cin >> x;
        while(x%2==0){
            ++s;
            x/=2;
        }
    }
    cout << s;
}


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

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

    vector<vector<int> > mao(n, vector<int>(2));
    for(int i=0; i<n; i++) {
        cin>>mao.at(i).at(0)>>mao.at(i).at(1);
    }

    double sum = 0;
    for(int i=0; i<n-1; i++) {
        for(int j=i+1; j<n; j++) {
            double x = mao.at(i).at(0)-mao.at(j).at(0);
            double y = mao.at(i).at(1)-mao.at(j).at(1);
            sum += sqrt(x*x + y*y);
        }
    }

    cout<<setprecision(10)<<2*sum/n<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[105];
int ans;
int main(){
	int n,d,x;
	cin>>n>>d>>x;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		for(int j=1;j<100;j++){
			if(j*a[i]+1<=d) ans++;
			else break;
		}
	}
	ans+=n+x;
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main() {
  int N, K;
  cin >> N >> K;

  vi ans(N + 1, 0);
  REP(tmp, K) {
    int d;
    cin >> d;
    REP(i, d) {
      int p;
      cin >> p;
      ans[p]++;
    }
  }

  int ret = 0;
  for (int i = 1; i <= N; i++) {
    if (ans[i] == 0) ret++;
  }

  cout << ret << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int t1=0,t2=0;
	string s;
	getline(cin,s);
	for(int i=0;i<s.size();i++)
	{
	  if(s[i]=='C')
	    t1=1;
	  if(t1==1&&s[i]=='F')
	  {
	  	cout<<"Yes"<<endl;
	  	return 0;
	  }
	} 
	cout<<"No"<<endl;
	return 0;
}

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

int h, w;
string s[50];

int getScore( int div1, int div2 ){
	int i, j;
	int ret = 0;
	for( i = 0; i < h; i++ ){
		char c;
		//Hamming with W[0, div1]
		if( i <= div1 ){
			c = 'W';
		}
		//Hamming with B[div1+1, div2]
		else if( i <= div2 ){
			c = 'B';
		}
		//Hamming with R[div2+1, h-1]
		else{
			c = 'R';
		}
		for( j = 0; j < w; j++ ){
			if( s[i][j] != c )
				ret++;
		}
	}
	return ret;
}

int main()
{
	int i, j;
	int ans = 114514;
	cin >> h >> w;
	for( i = 0; i < h; i++ )
		cin >> s[i];
	
	for( i = 0; i < h - 2; i++ ){
		for( j = i + 1; j < h - 1; j++ ){
			ans = min(ans, getScore(i, j));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1208
N = int(input())
L = list(map(int,input().split()))

l_1 = []
l_2 = []
for i in L:
    if i%2 == 0:
        l_1.append(i)
for i in l_1:
    if i%3 == 0 or i%5 == 0:
        l_2.append(i)
if len(l_1) == len(l_2):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second 
const int INF=1<<29;
typedef pair<int,int> pii;
int N,M;
int a[200004];
bool vis[200004];
vector <pii> g[200004];
int maxn,minn;
void dfs(int x){
	minn=min(a[x],minn);
	maxn=max(a[x],maxn);
	for (int i=0;i<g[x].size();i++){
		int n=g[x][i].f;
		if (vis[n]){
			if (a[n]!=a[x]+g[x][i].s){
				puts("No");
				exit(0);
			}
		}
		else{
			vis[n]=1;
			a[n]=a[x]+g[x][i].s;
			dfs(n);
		}
	}
}
int main(){
	cin>>N>>M;
	for (int i=0;i<M;i++){
		int x,y,d;
		cin>>x>>y>>d;
		g[x].push_back(pii(y,d));
		g[y].push_back(pii(x,-d));  
	}
	for (int i=1;i<=N;i++){
		if (vis[i]) continue;
		maxn=-INF,minn=INF;
		vis[i]=1;
		a[i]=0;
		dfs(i);
		if (maxn-minn<=1e9);
		else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 14464
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000


int main(void) {
	ll n; cin >> n;
	string s;

	ll x;
	while (n>0) {
		x = n % 26;
		n /= 26;
		if (x == 0) {
			x = 26;
			n--;
		}
		s.push_back('a'-1 + x	);
	}


	reverse(all(s));
	cout << s << endl;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int n, i, j, k, s;
	cin >> n >> k >> s;
	for (i = 0; i < k; i++) cout << s << " ";
	if (s == 1000000000) s--;
	else s++;
	for (; i < n; i++) cout << s << " ";
	cout << "\n";

	return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

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


  



 int main(){
     int n; cin >> n;
     vector<int> p(n), P(n);
     rep(i,n) {
         int a; cin >> a;
         p[i] = a;
         P[i] = a;
     }
     
     sort(P.begin(), P.end());
     int count = 0;
     rep(i,n){
         if(p[i] != P[i]){
             count++;
         }

     }
     if(count == 2 || count == 0){
         cout << "YES"<< endl;
         return 0;
     }
     cout << "NO" << endl;
     return 0;
     
     
     

 }



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

using namespace std;

int main(){
  int i,j,k;
  int ans;

  string s;
  string tmp;

  cin >> s;
  ans = abs(atoi(s.substr(0, 3).c_str()) - 753);
  for(i=3; i < s.size(); i++){
    ans = min(abs(atoi(s.substr(i-2, 3).c_str()) - 753), ans);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
 
class P
{
    static void Main()
    {
        int[] nq = Console.ReadLine().Split().Select(int.Parse).ToArray();
        UnionFind uf = new UnionFind(nq[0]);
        for (int i = 0; i < nq[1]; i++)
        {
            int[] pab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (pab[0] == 0) uf.TryUnite(pab[1], pab[2]);
            else Console.WriteLine(uf.Find(pab[1]) == uf.Find(pab[2]) ? "1" : "0");
        }
    }
}



class UnionFind
{
    public int Size { get; private set; }
    public int GroupCount { get; private set; }
    List<int> Sizes;
    List<int> Parent;
    public UnionFind(int count)
    {
        Size = 0;
        GroupCount = 0;
        Parent = new List<int>(count);
        Sizes = new List<int>(count);
        ExtendSize(count);
    }
    public bool TryUnite(int x, int y)
    {
        int xp = Find(x);
        int yp = Find(y);
        if (yp == xp) return false;
        if (Sizes[xp] < Sizes[yp])
        {
            var tmp = xp;
            xp = yp;
            yp = tmp;
        }
        GroupCount--;
        Parent[yp] = xp;
        Sizes[xp] += Sizes[yp];
        return true;
    }
    public IEnumerable<int> AllRepresents => Parent.Where(x => x == Parent[x]);
    public int GetSize(int x) => Sizes[Find(x)];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int Find(int x)
    {
        while (x != Parent[x])
        {
            Parent[x] = Parent[Parent[x]];
            x = Parent[x];
        }
        return x;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void ExtendSize(int treeSize)
    {
        if (treeSize <= Size) return;
        Parent.Capacity = treeSize;
        Sizes.Capacity = treeSize;
        while (Size < treeSize)
        {
            Parent.Add(Size);
            Sizes.Add(1);
            Size++;
            GroupCount++;
        }
    }
}




Measured memory_bytes: 22540
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int H, W;
  cin >> H >> W;
  
  vector<string> pixel(H);
  for(int i = 0; i < H; i++){
    cin >> pixel.at(i);
  }
  
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  }
  cout << endl;
  
  for(int i = 0; i < H; i++){
    cout << '#' << pixel.at(i) << '#' << endl;
  }
  
  for(int i = 0; i < W + 2; i++){
    cout << '#';
  }
  cout << endl;
  
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	string S, T;
	cin >> S >> T;
	rep(i, 0, SZ(S))
	{
		cout << S[i];
		if (i < SZ(T))cout << T[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
from math import sqrt


def Calc_Divisors(num):
    divisors = []
    for i in range(1, int(sqrt(num)) + 1):
        if num % i == 0:
            divisors.append(i)
            if i != num // i:
                divisors.append(num//i)
    # divisors.sort()
    return divisors


if __name__ == "__main__":
    n = int(input())

    div = Calc_Divisors(n)

    ans = n - 1
    for d in div:
        tmp = (d - 1) + (n // d - 1)
        if tmp < ans:
            ans = tmp

    print(ans)


Measured memory_bytes: 3268
import collections
N = int(input())
A = [None for i in range(N)]
for i in range(N):
    A[i] = int(input())
count = collections.Counter(A)
count = count.most_common()
ans = 0
for i in range(len(count)):
    if count[i][1] % 2 == 1:
        ans += 1

print(ans)


Measured memory_bytes: 21348
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
typedef long long ll;
typedef pair<int, int> P;

int main() {
    string s; cin >> s;
    int n = sz(s);
    rep(i, n) {
        if (i%2 == 0) {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
        if (i%2 == 1) {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

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

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, 3) {
        if ( s[i] == t[i] ) ++ans; 
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define fr(i,n) for(lli i=0;i<n;++i)
#define rep(i,a,b) for(lli i=a;i<=b;++i)
#define per(i,a,b) for(lli i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b))) 
#define sz(x) (lli)(x).size()
#define endl '\n'
typedef long long lli;        typedef long double ld;
typedef pair<lli,lli> ii;     typedef vector<lli> vi;
typedef vector<ii> vii;       typedef vector<vi> graph;
long long MOD=1000000007;     long double EPS=1e-9;
#define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
lli binpow(lli b,lli p,lli mod){lli ans=1;b%=mod;for(;p;p>>=1){if(p&1)ans=ans*b%mod;b=b*b%mod;}return ans;}

void pre(){

}
lli knap[100+1][100000+1];
void solve(){
	lli N,W;
	cin>>N>>W;
	lli w[N],v[N];
	fr(i,N){
		cin>>w[i]>>v[i];
	}
	rep(i,0,N)rep(j,0,100000){
		knap[i][j]=MOD*MOD;
	}
	knap[0][0]=0;
	fr(i,N){
		rep(j,0,100000){
			if(knap[i][j]<=MOD*MOD){
				remin(knap[i+1][j],knap[i][j]);
				if(j+v[i]<=100000){
					remin(knap[i+1][j+v[i]],knap[i][j]+w[i]);
				}
			}
		}
	}
	lli ans=0;
	rep(j,0,100000){
		if(knap[N][j]<=W)remax(ans,j);
	}
	cout<<ans<<endl;
}	

signed main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);
	pre();lli t=1;//cin>>t;
	for(lli i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long  n,m;
	long long ac = 0;
	long long wa = 0;
	
	cin>>n>>m;
	
	vector<long long> p(m);
	vector<string> s(m);
	vector < pair < bool, long > > rlt( n , { 0 , 0 } );

	for(long long i = 0 ; i < m ; i++){
		cin>>p.at(i)>>s.at(i);
	}
	
	for(long long j = 0 ; j < m ; j++){
		if(rlt.at( p.at( j ) - 1 ).first == 0){
			if( s.at( j ) == "AC"){
			ac++;
			rlt.at( p.at( j ) - 1 ).first = 1;
			}
			else if(s.at( j ) == "WA"){
			wa++;
            ( rlt.at( p.at( j ) - 1 ).second )++;
			}
		}
	}
	for(long long k = 0 ; k < n ; k++){
		if( ( rlt.at( k ).first == 0 ) && (( rlt.at( k ).second != 0 ) ) ) wa-=rlt.at( k ).second;
	}
	cout<<ac<<" "<<wa;
}

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

int main(){
  int K;
  cin >> K;
  int A[] = {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};
  // for(int i = 0; i < 32; ++i) cin >> A[i];
  cout << A[K-1] << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using lint = long long;
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (lint i = 0; i < lint(n); ++i)
#define Rep(i, n) for (lint i = lint(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
using P = pair<lint, lint>;
using D = pair<double, double>;
using DI = pair<double, int>;
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

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

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

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

lint lcm(lint a, lint b) { return a / gcd(a, b) * b; }

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c < 22) cout << "win\n";
	else cout << "bust\n";
}

Measured memory_bytes: 384
#include <stdio.h>

int main (void)
{
  long n = 0;
  long res = 0;
  char line[100];

  fgets(line, sizeof(line), stdin);
  sscanf(line, "%ld", &n);

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

  printf("%ld\n", res);

  return 0;
}

Measured memory_bytes: 1768
#include <climits>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
using namespace std;
typedef unsigned char byte;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<llong, llong> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }

int main()
{
    int a, b;
    cin >> a >> b;
    cout << ((a + b >= 10) ? "error" : to_string(a + b)) << endl;
    return 0;
}

Measured memory_bytes: 256
/*input
3
abc
arc
agc
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long lol;

set<string> s;
string now;

int main() {
	int n, ok = 1;
	cin >> n >> now;
	n--;
	s.insert(now);
	while (n--) {
		string nxt;
		cin >> nxt;

		if (s.count(nxt) || now[now.length() - 1] != nxt[0]) ok = 0;
		s.insert(nxt);

		now = nxt;
	}
	cout << (ok ? "Yes" : "No");
	return 0;
}

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

    
    int main(){
    
    std::fstream myfile("D:\\CodeBlocks\\c++\\input.txt.c", std::ios_base::in);
 
    ll q;
    cin>>q;
    
   // while(q--){
        string a="ACL";
       // myfile>>n;
       for(ll i=0;i<q;i++)
        cout<<a;
    //}
        
    
    
    return 0;
}
 


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

def get_first(n):
	return int(str(n)[0])

def check(n):
	# x99..99かどうか
	s = str(n)
	for i in range(1, len(str(n))):
		if str(s[i]) != '9':
			return False
	return True

if check(n):
	res = get_first(n) + 9 * (len(str(n)) - 1)
else:
	res = (get_first(n) - 1) + 9 * (len(str(n)) - 1)

print(res)

Measured memory_bytes: 38416
#include<stdio.h>
int main(){
  char a;
  scanf("%s",&a);
  if(a== 'A')
    printf("T\n");
  if(a== 'T')
    printf("A\n");
  if(a== 'G')
    printf("C\n");
  if(a== 'C')
    printf("G\n");
  return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Abhas Jain
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABallDistribution solver = new ABallDistribution();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABallDistribution {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.ni(), k = in.ni();
            if (k == 1) out.print(0);
            else out.print(n - k);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    int mod = 1000000007;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        sum %= mod;
    }
 
    long ans = 0;
 
    //i について全探索する
    for (int i = 0; i < N; i++)
    {
        //A[i+1] ... A[N] の値を更新する
        sum -= A[i];
        if (sum < 0) sum += mod;
 
        ans += A[i] * sum;
        ans %= mod;
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define linf (1LL<<60)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

ll w[110];
ll v[110];
ll dp[110][110000];

int main() {
  ll n, W;
  cin >> n >> W;
  for(int i = 1; i<=n; i++) cin >> w[i] >> v[i];
  dp[0][0] = 0;
  for(int i = 1; i<110000; i++) dp[0][i] = linf;
  for(int i = 1; i<=n; i++) {
    for(int j = 0; j<110000; j++) {
      dp[i][j] = dp[i-1][j];
      if(j-v[i]>=0) {
        dp[i][j] = min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
      }
    }
  }
  int ans = 0;
  for(int i = 0; i<=100010; i++) {
    if(dp[n][i] <= W) ans = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 88320
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let x = scan!(i64);

    let n = ((x + 10) / 11) * 2;
    if (n / 2) * 11 - 5 < x {
        println!("{}", n);
    } else {
        println!("{}", n - 1);
    }
}


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

int main() {
  int A ,B;
  cin>>A>>B;
  if((A+B)%2==0){
    cout<<(A+B)/2<<endl;
  }
  else{
    cout<<"IMPOSSIBLE"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String [] Args)
	{
		Scanner in=new Scanner(System.in);		
		int n=in.nextInt();
		int flag=0;
		if(n>81)
		{
			System.out.println("No");
		}
		else
		{
			for(int i=1;i<=9;i++)
			{
				if(n%i==0&&n/i<10)
				{
					System.out.println("Yes");
					flag=1;
					break;
				}
			}
			if(flag==0)
				System.out.println("No");
		}
	}
}
	

Measured memory_bytes: 21844
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	string S;
	cin >> S;
	if(S[0] == S[1]){
		if(S[2] == S[3] && S[0] != S[2]){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	else{
		if(S[0] == S[2] && S[1] == S[3]){
			cout << "Yes" << endl;
		}
		else if(S[0] == S[3] && S[1] == S[2]){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = [iss() for _ in range(N)]
    B = [iss() for _ in range(M)]

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            t = i
            for b in B:
                # if t > M: break
                # if j + M > N: break
                if A[t][j:j+M] == b:
                    t += 1
                else:
                    break
            else:
                print('Yes')
                exit()
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10136
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
const int INF = 1e9;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

void solve(){

}

int main(){
	load;
	int x;
	cin >>x;
	int t = x%10;
	if (t==3){
		cout << "bon";
	}else if (t==0 || t==1 || t==6 || t==8) cout << "pon";
	else cout << "hon";

    return 0;
}



Measured memory_bytes: 3620
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    char buf[1<<4];
    scanf("%s", buf);
    string W(buf);
    transform(W.begin(), W.end(), W.begin(), [](char c)->char {
        return c |= 0x20;
    });

    int res=0;
    string T;
    for (char c; scanf("%c", &c)!=EOF;) {
        if (((c|0x20)>='a'&&(c|0x20)<='z') || c=='-' || c=='_') {
            T += c;
            continue;
        }

        if (T == "END_OF_TEXT") break;
        if (!T.length()) continue;

        transform(T.begin(), T.end(), T.begin(), [](char c)->char {
            return c |= 0x20;
        });

        if (W == T)
            ++res;

        T = "";
    }

    printf("%d\n", res);
    return 0;
}       

Measured memory_bytes: 2780
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define MP make_pair

int r, c, n;
vector<pii> Left, Up, Right, Down;

bool corner_check(int x, int y) {
    return (x == 0 || x == c || y == 0 || y == r);
}

void corner_push(int x, int y, int num) {
    if (x == 0 && y < r) Left.push_back(MP(y, num));
    else if (y == r && x < c) Up.push_back(MP(x, num));
    else if (x == c && y > 0) Right.push_back(MP(-y, num));
    else if (y == 0 && x > 0) Down.push_back(MP(-x, num));
}

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

    cin >> r >> c >> n;
    for (int i = 1; i <= n; ++i) {
        int x1, y1, x2, y2;
        cin >> y1 >> x1 >> y2 >> x2;
        if (corner_check(x1, y1) && corner_check(x2, y2)) {
            corner_push(x1, y1, i);
            corner_push(x2, y2, i);
        }
    }

    sort(Left.begin(), Left.end());
    sort(Up.begin(), Up.end());
    sort(Right.begin(), Right.end());
    sort(Down.begin(), Down.end());

    vector<int> v;
    for (auto p : Left) v.push_back(p.second);
    for (auto p : Up) v.push_back(p.second);
    for (auto p : Right) v.push_back(p.second);
    for (auto p : Down) v.push_back(p.second);

    stack<int> stk;

    for (auto a : v) {
        if (!stk.empty() && stk.top() == a) stk.pop();
        else stk.push(a);
    }

    cout << (stk.empty() ? "YES" : "NO") << endl;
    return 0;
}



Measured memory_bytes: 3796
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1e18;

int a[10001];

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++)cin >> a[i];
	int res = 0;
	int tmp = 0;
	for(int i = 1; i < n; i++){
			if(a[i] == a[i-1]){
					tmp++;
					if((tmp % 2) == 1)res++;
			}else{
					tmp = 0;
			}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut day = String::new();
    io::stdin().read_line(&mut day).expect("Failed to read line");
    let num = (*day).trim().parse::<u32>().unwrap();
    match num {
        25 => println!("Christmas"),
        24 => println!("Christmas Eve"),
        23 => println!("Christmas Eve Eve"),
        22 => println!("Christmas Eve Eve Eve"),
        _  => println!("Invalid Input"),
    }
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int W,H,x,y,r;
		W = sc.nextInt();
		H = sc.nextInt();
		x = sc.nextInt();
		y = sc.nextInt();
		r = sc.nextInt();
		
		if (x>0&&y>0) {
			if ((W >= x + r && 0 <= x + r) && (H >= y + r && 0 <= y + r))
				System.out.println("Yes");
			else
				System.out.println("No");
		}else
			System.out.println("No");
	}

}

Measured memory_bytes: 26348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const ll MAX_N = ll(2e5 + 5);
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
    ll n, Q, a[MAX_N];
    cin >> n >> Q;
    REP(i,n) cin >> a[i];
    REP(i,Q){
        ll x;
        cin >> x;
        ll r = 0, sum = 0, ans = 0;
        for(ll l = 0; l < n; l++){
            while(r < n && sum + a[r] <= x){
                sum += a[r];
                r++;
            }
            ans += r-l;
            sum -= a[l];
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3880
#include <bits/stdc++.h>
#define LL long long

int main() {
	LL a, b, c;
	scanf("%lld %lld %lld", &a, &b, &c);
	if (1LL * (c - a - b) * (c - a - b) > 4LL * a * b && c - a - b > 0)
		puts("Yes");
	else
		puts("No");
	return 0;
}


Measured memory_bytes: 256
// マニ

#include<bits/stdc++.h>
#define ll            long long 
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define rrep(i,a,b) for(ll int i=a;i>=b;i--)
#define all(a)      (a).begin(),(a).end()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define PI 3.14159265358979323846
#define tr(i, cont) for(auto i=cont.begin();i!=cont.end();i++)
#define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define trace(x)                 cerr << #x << ": " << x << "\n";
#define trace1(x)                cerr << #x << ": " << x << "\n";
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << "\n";
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << "\n";
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << "\n";
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << "\n";
#define ar array
#define endl "\n"
using namespace std;

int main(){
    ios;
    ll a;
    cin>>a;
    cout<<a+a*a+a*a*a;    
}


Measured memory_bytes: 3656
n, k, q = map(int, input().split())
l = [k-q for i in range(n)]
for i in range(q):
  a = int(input()) - 1
  l[a] += 1
for i in range(n):
  if l[i] > 0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 7860
#include<stdio.h>
int main(void)
{
  int n;
  int a,b;
  int p,q;
  
  scanf("%d %d %d",&n,&a,&b);
  
  p=n*a;
  if(p<=b)
    printf("%d",p);
  else
    printf("%d",b);
  return 0;
  
  
}

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

#define MOD 1000000007
#define rep(i, N) for(int i = 0;i < N;i++)
#define ll long long
#define int long long

using namespace std;

class Fact {
public:
	vector<ll> f;
	Fact(ll n) {
		f = vector<ll>(n+1);
		f[0] = 1;
		f[1] = 1;
		for (int i = 2; i <= n; i++)f[i] = f[i - 1] * i;
	}
	ll get(ll n) { return f[n]; }
	ll comb(ll n, ll r) {
		return get(n) / (get(n - r) * get(r));
	}
};


signed main(void) {
	int N; cin >> N;
	Fact f(N + 1);
	vector<int> A(N), cnt(N);
	int totComb = 0;
	rep(i, N) {
		cin >> A[i];
		A[i]--;
		cnt[A[i]]++;
	}

	rep(i, N)if (cnt[i] >= 2)totComb += (cnt[i] * (cnt[i] - 1)) / 2;

	rep(i, N) {
		cout << totComb - (cnt[A[i]] - 1) << endl;
	}

	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K; cin >> K;
  string S; cin >> S;
  if(S.size() > K) {
    S = S.substr(0,K) + "...";
  }
  cout << S << endl;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=1e5+3;
vector<int>v;
bool c[N];
int a[N];
int z[]= {6,9};
int main()
{
    ft
    int t,i,j,n,m,x,l,r;
    cin>>n;
    v.pb(1);
    for(i=0; i<2; i++)
    {
        m=z[i];
        while(m<=n)
        {
            if(c[m]==0)
            {
                v.pb(m);
                c[m]=1;
            }
            m*=z[i];
        }
    }
    sort(v.begin(),v.end());
    m=v.size();
    for(i=1;i<=n;i++)
    {
        a[i]=INT_MAX;
    }
    for(i=1;i<=n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(v[j]>i)
            {
                break;
            }
            l=i-v[j];
            a[i]=min(a[i],a[l]+1);
        }
    }
    cout<<a[n]<<"\n";
    return 0;
}



Measured memory_bytes: 640