akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> cnt(M,0);
    for(int i=0; i<N; i++){
        int K; cin >> K;
        for( int j=0; j<K; j++){
            int A; cin >> A; A--;
            cnt.at(A)++;
        }
    }

    int ans=0;
    for(int i=0; i<M; i++){
        if(cnt.at(i)==N){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);

    int a = s.nextInt();
    int b = s.nextInt();
    int c = s.nextInt();
    long k = s.nextLong();

    if (k % 2 == 0) {
      System.out.println(a - b);
    } else {
      System.out.println(b - a);
    }
  }
}


Measured memory_bytes: 21844
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
int main() {
	ll a, b, x;
	cin >> a >> b >> x;
	auto f = [&](ll b)->ll {
		if (b >= 0)return b / x + 1;
		else return 0;
	};
	cout << f(b) - f(a - 1);



	return 0;
}





Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

const string YES = "YES";
const string NO = "NO";

void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
    map<ll, ll> mp;
    REP(i, M){
        mp[a[i]]++;
        mp[b[i]]++;
    }
    for(auto x: mp){
        if(x.second % 2 == 1){
            cout << NO << endl;
            return;
        }
    }
    cout << YES << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, M, std::move(a), std::move(b));
    return 0;
}


Measured memory_bytes: 7168
//package ABC147A;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		
		//long startTime = System.currentTimeMillis();
		
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();
		int[][] c=new int[n][n];
		//int[] vector=new int[n];
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				c[i][j]=-1;
			}
		}
		
		for(int i=0;i<n;i++){
			int a=sc.nextInt();
			for(int j=0;j<a;j++){
				int x=sc.nextInt();
				int y=sc.nextInt();
				c[i][x-1]=y;
			}
		}
		
		int ans=0;
		
		for (int k=1; k<(1<<n); k++) {
			int tmp=0;
			int bits=k;
			//int bits=Integer.parseInt(Integer.toBinaryString(k));
			
			//System.out.println(bits);
			
			int[]vec=new int[n];
	
			for(int m=0;m<n;m++){
				vec[n-m-1]=0;
				if(((bits>>m)&1)==1){
					vec[n-m-1]=1;
				}
				
				//System.out.println((n-m-1)+" "+vec[n-m-1]);
			}
				

				for(int i=0;i<n;i++){
boolean check=true;
int[] honest =new int [n];

					for(int j=0;j<n;j++){
						if(c[i][j]==-1)continue;
						else if(c[i][j]!=vec[j]){check=false;break;}
					}
					if(check==true&&vec[i]==1){
					   tmp++;
					 }else if(vec[i]==1){
					 tmp=0;
					 break;
					 }
				}
				if(tmp>ans){
				  ans=tmp;
				  //System.out.println("update "+tmp);
				}
				tmp=0;
			}
		
		
		System.out.println(ans);
	}
}





Measured memory_bytes: 38356
import java.util.*;

public class Main{
	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		long[] A = new long[N];
		long result = 1;
		
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextLong();
			if(A[i] == 0)result = 0;
		}
		
		for(int i = 0; i < N; i++) {
			long temp = 1;
			temp = result * A[i];
			if(temp > (long)1e18 || result > temp) {
				result = -1;
				break;
			}
			result = temp;
		}
		
		System.out.println(result);
		
		sc.close();
	}
}

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

int main(){
	int a,b,x;
	cin >> a >> b >> x;
	double ans;
	if(a*a*b <= x*2.0){
		ans = abs(atan(2.0*b/a - 2.0*x/(a*a*a)));
	}else{
		ans = abs(atan(double(a*b*b)/(2.0*x)));
	}
	ans = 180.0*ans/M_PI;
	cout << setprecision(10) << ans << endl;
	return 0;
}

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

#define int long long

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;

	string s;
	unordered_map<string, int> mp;
	for (int i = 0; i < n; ++i) {
		cin >> s;
		++mp[s];
	}

	cout << "AC x " << mp["AC"] << '\n';
	cout << "WA x " << mp["WA"] << '\n';
	cout << "TLE x " << mp["TLE"] << '\n';
	cout << "RE x " << mp["RE"] << '\n';

	return 0;
}

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

using namespace std;

int main() {
    int d;
    cin >> d;
    if(d == 25)
        puts("Christmas");
    else if(d == 24) 
        puts("Christmas Eve");
    else if(d == 23)
        puts("Christmas Eve Eve");
    else if(d == 22)
        puts("Christmas Eve Eve Eve");
    else 
        puts("What a shame data");
    return 0;
}

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

int main() {
  
  string s;
  cin >> s;
  
  string ans;
  
  int size = s.size();
  
  
  cout << s[0] + to_string(size-2) + s[size-1]<< endl;
 
  
}


           

Measured memory_bytes: 256
import sys

K = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

# うまい方法がない気がするため、二分探索で攻める
l = 0
r = 2 * 10**15
ans1 = -1
while l != r:
    n = (l + r) // 2
    res = n
    for a in A:
        res = res - res % a
    if res >= 2:
        r = n
        if res == 2:
            ans1 = n
    else:
        l = n + 1

l = 0
r = 2 * 10**15
ans2 = -1
while l != r:
    n = (l + r) // 2
    res = n
    for a in A:
        res = res - res % a
    if res <= 2:
        l = n + 1
        if res == 2:
            ans2 = n
    else:
        r = n

if ans1 != -1:
    print(ans1, ans2)
    # print(n - n % A[0], A[0] * ((n - 1) // A[0] + 1) - 1)
else:
    print(-1)

Measured memory_bytes: 83920
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());

        Integer[] array = new Integer[n];
        for(int i = 0; i < array.length; ++i) {
            int tmp = sc.nextInt();
            array[i] = tmp;
        }

        int counter = 0;

        for(int i = 0; i < array.length; ++i) {
            if(array[i] >= k) ++counter;
            else continue;
        }

        System.out.println(counter);
    }
}

Measured memory_bytes: 64584
#include <stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
			printf("a < b\n");
	}
	if(a>b){
			printf("a > b\n");
	}
	if(a==b){
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
string S[51];
int T[51];
string X;

signed main(){
	cin>>N;
	REP(i,N){
		cin>>S[i]>>T[i];
	}
	cin>>X;
	bool flag=false;
	int ans=0;
	REP(i,N){
		if(S[i]==X){
			flag=true;
		}
		else if(flag==true){
			ans+=T[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int N;
  int sum = 0;
  cin >> N;
  for(int i ; i < N ; i++){
   int r , l ;
   cin >> r >> l;
   sum += l - r + 1;
  }
  cout << sum <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define ABS(a) ((a)>(0)?(a):-(a))

int gcd(int a,int b){
  int r=a%b;
  while(r>0){
    a=b;b=r;r=a%b;
  }
  return b;
}

void run(void){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  int dx=ABS(a-c);
  int dy=ABS(b-d);
  if(dx==0 || dy==0){
    puts("0");
    return;
  }
  int g=gcd(dx,dy);
  printf("%d\n",(dx/g+dy/g-1)*g);
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 128
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    char a[105][105];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
           
        }
    }
    vector<int> tate(h, 0);
    for (int i = 0; i < h; i++) {
        bool ok = true;
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') {
                ok = false;
                break;
            }
        }
        if (ok) {
            tate[i] = 1;
        }
    }
    vector<int>yoko(w, 0);
    for (int i = 0; i < w; i++) {
        bool ok = true;
        for (int j = 0; j < h; j++) {
            if (a[j][i] == '#') {
                ok = false;
                break;
            }
        }
        if (ok) {
            yoko[i] = 1;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (tate[i] == 0 && yoko[j] == 0) {
                cout << a[i][j];
            }
        }
        if(tate[i]==0)cout << endl;
    }
    return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 3644
#include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    
    int main(){
        ll n;
        cin >> n;
        ll a , b;
        ll ans;
        ll t;
        ans = n;
        for(ll i = 0 ; i <= n ; i++){
            t = 0;
            a = i;
            while(a > 0){
                t += a % 6;
                a /= 6;
            }
            a = n - i;
            while(a > 0){
                t += a % 9;
                a /= 9;
            }
            ans = min(ans , t);
        }
        cout << ans << endl;
        
        return 0;
        
    }

Measured memory_bytes: 256
N, K = map(int, input().split())

candy = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        candy[j - 1] += 1

count = 0
for i in candy:
    if i == 0:
        count += 1

print(count)

Measured memory_bytes: 9128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int N;
struct Tree{
	int num;
	int ch[3];
	bool rev;
}T[4000010];int tot=1;
void S(int x)
{
	T[x].rev^=1;
	swap(T[x].ch[1],T[x].ch[2]);
	return ;
}
void pushdown(int x)
{
	if(!T[x].rev)return ;
	if(T[x].ch[0])S(T[x].ch[0]);
	if(T[x].ch[1])S(T[x].ch[1]);
	if(T[x].ch[2])S(T[x].ch[2]);
	T[x].rev=0;return ;
}
void R(int x)
{
	pushdown(x);
	int y=T[x].ch[2];
	T[x].ch[2]=T[x].ch[1];
	T[x].ch[1]=T[x].ch[0];
	T[x].ch[0]=y;
	if(y)R(y);
	return ;
}
void insert(int x)
{
	int now=x,o=1;
	for(int i=1;i<=N;i++)
	{
		int t=now%3;
		if(!T[o].ch[t])T[o].ch[t]=++tot;
		o=T[o].ch[t];
		now/=3;
	}
	T[o].num=x;
	return ;
}
int getval(int x,int y)
{
	pushdown(x);
	int t=y%3;
	if(!T[x].ch[t])return T[x].num;
	return getval(T[x].ch[t],y/3);
}
char str[200010];
int ans[1000010];
int main()
{
	scanf("%d",&N);
	scanf("%s",str+1);
	int len=strlen(str+1);
	int m=1;
	for(int i=1;i<=N;i++)m*=3;
	for(int i=0;i<m;i++)insert(i);
	for(int i=1;i<=len;i++)
	{
		if(str[i]=='S')S(1);
		else R(1);
	}
	for(int i=0;i<m;i++)ans[getval(1,i)]=i;
	for(int i=0;i<m;i++)printf("%d ",ans[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 21868
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

const int MX=2000001;
ll fac[MX],inv[MX],finv[MX];

void COMinit(){
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[1]=finv[0]=1;
    FOR(i,2,MX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll COM(ll x,ll y){
    return ((fac[x]*finv[y])%MOD*finv[x-y])%MOD;
}
ll pow_mod(ll x,ll y){
    if(y==0){
        return 1;
    }
    if (y%2==1){
        return pow_mod(x,y-1)*x%MOD;
    }
    else{
        ll k=pow_mod(x,y/2);
        return k*k%MOD;
    }
}

int main() {
    ll k;st s;
    ll ans=0;
    cin >> k >> s;
    ll x=s.size();
    COMinit();
    FOR(i,x,x+k+1){
      ans+=(COM(k+x,i)*pow_mod(25,k+x-i)%MOD)%MOD;
      ans%=MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 51108
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int A, B, C;
	cin >> A >> B >> C;

	cout << (C >= A&&C <= B ? "Yes" : "No") << endl;


	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(A > 0 && C > 0) {
    
    C -= B;
    if(C <= 0) {
      cout << "Yes" <<endl;
      break;
    }
    
    A -= D;
    if(A <= 0) {
      cout << "No" <<endl;
      break;
    }
    
  }

}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cout<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;

// <---------------------- > //


// <------------- Start of main() -------------------> //

void MAIN() {
	ll x, n;
	cin >> x >> n;
	vll a(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(all(a));
	ll l, r;
	bool ist = binary_search(all(a), x) ;
	if (ist) {
		l = x;
		r = x;
		bool isl = true, isr = true;
		while (isl && isr) {

			l--;
			r++;

			isl =  binary_search(all(a), l) ;
			isr =  binary_search(all(a), r) ;
		}

		if(isl) x =r;
		else  x = l; 
	}
	cout << x;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3620
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int ans = 0;
		boolean flg = true;
		for(int i = a;i <= b;i++){
			String[] str = Integer.toString(i).split("");
			for(int j = 0;j < str.length;j++){
				if(str[j].equals(str[str.length-1-j])){

				} else {
					flg = false;
				}
			}
			if(flg){
				ans++;
			} else {
				flg = true;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int selectionSort(int A[], const int N)
{
    int cnt = 0;

    for( int i = 0; i < N; ++i ){
        int min = i;

    //iより後でA[i]より最も小さい値の添字を求める
        for( int j = i; j < N; ++j )
            if( A[j] < A[min] )
                min = j;

    //iとminが異なれば交換
        if( i != min ){
       swap(A[i], A[min]);
       ++cnt;
    }
    }

    return cnt;
}

int main()
{
    int N;
    scanf("%d", &N);
    int A[N];
    for( int i = 0; i < N; ++i )
        scanf("%d", &A[i]);

    int cnt = selectionSort(A, N);

    for( int i = 0; i < N; ++i ){
        if( i ) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", cnt);

    return 0;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
const int INF = 1e8;

int main() {
  int R;
  cin >> R;
  printf("%.12lf\n",2*R*M_PI);
}

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

int main() {
	string s1, s2;
	cin >> s1 >> s2;
	s1 = s1+s1;
	for(int i = 0;i < s2.size();i++){
		if(s1.substr(i,s2.size()) == s2){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)

#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007

void ayn(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

ll gcd(ll a, ll b)
{
    if (a == 0) return b;
    return gcd(b % a, a);
}
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }
ll mulmod(ll a, ll b, ll mod)
{
    ll res = 0;
    a = a % mod;
    while (b > 0)
    {
        if (b % 2 == 1) res = (res + a) % mod;
        a = (a * 2) % mod;
        b /= 2;
    }
    return res % mod;
}
int binCoeff(int n, int k)
{
    int C[n + 1][k + 1]; int i, j;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
    return C[n][k];
}

const int maxn = 100005;
int dfs(ll v, ll ans2, vector<bool>& visited, vector<vector<ll>>& vc){
    visited[v]=true;
    ans2++;
    for(auto z:vc[v])
    {
        if(!visited[z])
        {
           ans2+=dfs(z,0,visited,vc);
        }
    }
    return ans2;
}

ll conv(string n)
{
    string num = n;
    ll dec_value = 0;
    int base = 1;

    int len = num.length();
    for (int i=0; i<len; i++) {
        if (num[i] == '1') dec_value += base;
        base = base * 2;
    }
    return dec_value;
}

int main(){
    fastio;
    ayn();
    ll t; t=1;
    while(t--){
        ll n,m; cin>>n>>m;
        vector<ll> a[n];
        ll h[n];
        rep(i,n){
            cin>>h[i];
        }
        rep(i,m){
            ll x,y; cin>>x>>y;
            x--; y--;
            a[x].pb(y);
            a[y].pb(x);
        }
        ll c=0;
        rep(i,n){
            ll tp=h[i];
            bool p=true;
            rep(j,a[i].size()){
                if(tp<=h[a[i][j]]) p=false;
            }
            if(p) c++;
        }
        cout<<c;
    }
    return 0;
}


Measured memory_bytes: 10252
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}
};
typedef Point Vector;
Vector operator + (Vector A,Vector B){
    return Vector(A.x+B.x,A.y+B.y);
}
Vector operator - (Vector A,Vector B){
    return Vector(A.x-B.x,A.y-B.y);
}
Vector operator * (Vector A,double p){
    return Vector(A.x*p,A.y*p);
}
Vector operator / (Vector A,double p){
    return Vector(A.x/p,A.y/p);
}
bool operator < (const Point& a,const Point& b){
    return a.x<b.x||(a.x==b.x&&a.y<b.y);
}
const double eps = 1e-10;
int dcmp(double x){
    if(fabs(x)<eps) return 0; else return (x<0?-1:1);
}
bool operator == (const Point& a,const Point& b){
    return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y)==0;
}
//点积
double Dot(Vector A,Vector B){
    return A.x*B.x+A.y*B.y;
}
double Length(Vector A){
    return sqrt(Dot(A,A));
}
double Angle(Vector A,Vector B){
    return acos(Dot(A,B)/Length(A)/Length(B));
}
 
//叉积
double Cross(Vector A,Vector B){
    return (A.x*B.y-A.y*B.x);
}
//三角形面积的二倍的叉乘公式
double Area2(Point A,Point B,Point C){
    return Cross(B-A,C-A);
}
//向量旋转,rad是弧度
Vector Rotate(Vector A,double rad){
    return Vector(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
}
//计算向量的单位法线,先逆时针旋转90度，然后把长度归一化
Vector Normal(Vector A){
    double Len=Length(A);
    return Vector(-A.y/Len,A.x/Len);
}
//求两直线交点
//调用前请确保P+tv和Q+tw有唯一交点，当且仅当Cross(v,w)非0
Point GetLineIntersection(Point P,Vector v,Point Q,Vector w){
    Vector u=P-Q;
    double t=Cross(w,u)/Cross(v,w);
    return P+v*t;
}
//点到直线的距离
double DistanceToLine(Point P,Point A,Point B){
    Vector v1=B-A,v2=P-A;
    return fabs(Cross(v1,v2))/Length(v1);
}
//点到线段的距离
double DistanceToSegment(Point P,Point A,Point B){
    if(A==B) return Length(P-A);
    Vector v1=B-A,v2=P-A,v3=P-B;
    if(dcmp(Dot(v1,v2))<0) return Length(v2);
    else if(dcmp(Dot(v1,v3))>0) return Length(v3);
    else return fabs(Cross(v1,v2))/Length(v1);
}
//点在直线上的投影
Point GetLineProjection(Point P,Point A,Point B){
    Vector v=B-A;
    return A+v*(Dot(v,P-A)/Dot(v,v));
}
Point GetLineReflection(Point P,Point A,Point B){
    return GetLineProjection(P,A,B)*2-P;
}
int main(){
    int t;
    cin>>t;
    while(t--){
        Point A,B,C,D;
        cin>>A.x>>A.y>>B.x>>B.y>>C.x>>C.y>>D.x>>D.y;
        double cross=Cross(B-A,D-C);
        double dot=Dot(B-A,D-C);
        if(dcmp(dot)==0) cout<<1;
        else if(dcmp(cross)==0) cout<<2;
        else cout<<0;
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3232
//Try until you reach your goal
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define endl "\n"
# define str string
# define vll vector<ll>
# define pb push_back
# define mll map<ll,ll>
# define mp make_pair
# define ff first
# define ss second
# define pll pair<ll,ll>
# define f(x,y) for(int x=0;x<y;x++)
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll x;
    cin>>x;
    if(x==0){
        cout<<1;
    }
    else{
        cout<<0;
    }
    return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<string>
#include<iostream>

using namespace std;

int main(){
	char temp;
	int n;
	int m;
	
	while(1){
		cin >> n;
		if(n == 0)break;
		char data[n][2];
		string ans;

		for(int i=0;i<n;++i){
			cin >> data[i][0];
			cin >> data[i][1];
		}
		cin >> m;
		for(int i=0;i<m;++i){
			cin >> temp;
			for(int j=0;j<n;++j){
				if(temp == data[j][0]){
					temp = data[j][1];
					break;
				}
			}
			ans += temp;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1324
#include<iostream>
#include<map>
#include<cstring>
#include<vector>
#include<algorithm> 
#define PII pair<int,int>

typedef long long ll;

using namespace std;
int n; 
int main()
{
	cin>>n;
	n=n%10;
	if(n==0||n==1||n==6||n==8) cout<<"pon"<<endl;
	else if(n==3) cout<<"bon"<<endl;
	else cout<<"hon"<<endl;
	return 0; 
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

vector<int> graph[100010];

void add_edge(int a,int b){
	graph[a].push_back(b);
	graph[b].push_back(a);
}

int dfs(int v,int p){
	int grundy = 0;

	for(auto &v2:graph[v]){
		if(v2==p) continue;
		grundy^=(dfs(v2,v)+1);
	}
	
	return grundy;	
}	

int main(void){
	int n;
	cin >> n;
	rep(i,n-1){
		int x,y;
		cin >> x >> y;
		add_edge(x-1,y-1);
	}


	if(dfs(0,-1)!=0)
		puts("Alice");
	else
		puts("Bob");
	
	return 0;
}

Measured memory_bytes: 10368
N = 12
dx = [0,1,0,-1]
dy = [-1,0,1,0]

def dfs(y,x,vis,S):
    vis [y] [x] = True
    for i in range(len(dx)):
        ny = y + dy [i]
        nx = x + dx [i]
        if (ny >= 0 and ny < N and nx >= 0 and nx < N) == False:
            continue
        if S [ny] [nx] == '1' and vis [ny] [nx] == False:
            dfs(ny,nx,vis,S)

while True:
    S = []
    for i in range(N):
        S.append(input())
    
    ans = 0
    vis = [[False] * N for i in range(N)]
    for i in range(N):
        for j in range(N):
            if S [i] [j] == '1' and vis [i] [j] == False:
                dfs(i,j,vis,S)
                ans += 1

    print(ans)
    try:
        input()
    except EOFError:
        break

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

int main() {
  int N;
  cin >> N;
  
  long i = 2;
  long j = 1;
  long ans = 0;
  
  for(int k = 0; k<N-1 ; k++){
    ans = i + j;
    i = j;
    j = ans;
  }
  if(N == 1){
    cout << 1 << endl;
  }
  else{
  cout << ans << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;

int main(){
	int n, k; cin >> n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];

	vector<int> dp(1e5 + 1, -1);
	dp[0] = 0;
	for (int i = 1; i <= k; i++) {
		dp[i] = abs(h[0] - h[i]);
	}
	for (int i = k+1; i < n; i++) {
		int a = INF;
		for (int j = 1; j <= k; j++) {
			int b = dp[i-j] + abs(h[i] - h[i-j]);
			a = min(a, b);
		}
		dp[i] = a;
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val s = sc.next
  val l = s.length

  val ans = (for {
    i <- 0 until l - 2
  } yield ("" + s(i) + s(i + 1) + s(i + 2)).toInt)
    .map(i => math.abs(753 - i))
    .min

  println(ans)
}


Measured memory_bytes: 25400
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int n,m,sum=0,sum_cp=0;
  int t[101], p[101], x[101];
  cin >> n;
  rep(i,0,n){
    cin >> t[i];
    sum+=t[i];
  }
  cin >> m;
  rep(i,0,m){
    sum_cp=sum;
    cin >> p[i] >> x[i];
    sum_cp -= t[p[i]-1];
    sum_cp += x[i];
    cout << sum_cp << endl;
  }
}


Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)
typedef pair<int, int> P;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n+1, 0);
    rep(i, 1, n+1) cin >> a[i];
    
    map<ll, ll> mp;
    rep(i, 1, n+1) {
        mp[a[i]]++;
    }
    vector<ll> ans(n+1, 0);
    ll sum = 0;
    rep(i, 1, n+1) {
        ans[i] = mp[i]*(mp[i]-1)/2;
        sum += ans[i];
    }

    rep(i, 1, n+1) {
        //cout << ans[a[i]] << " " <<  ((mp[a[i]]-1)*(mp[a[i]]-2)/2) << endl;
        //if((mp[a[i]]-1)*(mp[a[i]]-2) < 0) cout << sum << endl;
        cout << sum-ans[a[i]]+((mp[a[i]]-1)*(mp[a[i]]-2)/2) << endl;
    }

}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007

int main() {
    int x ;
    cin >> x ;
    if(x == 0) {
        cout << 1 << endl ;
    }
    else {
        cout << 0 << endl ;
    }
} 

Measured memory_bytes: 3616
using System;
using System.Collections.Generic;

namespace First
{
    class Program
    {
        

        static void Main(string[] args)
        {
            List<string> a = new List<string>();
            List<int> a2 = new List<int>();

            string data = Console.ReadLine();
            String[] data2 = data.Split(' ');
            int n = Int32.Parse(data2[0]);
            int k = Int32.Parse(data2[1]);

            bool[] nSwitch = new bool[n];

            for(int i = 0; i<k;i++)
            {
                int d = Int32.Parse(Console.ReadLine());
                data = Console.ReadLine();
                a.AddRange(data.Split(' '));
                a2 = a.ConvertAll(Int32.Parse);

                foreach(int num in a2)
                {
                    nSwitch[num-1] = true;
                }
                a2.Clear();
            }

            int cnt = 0;

            for(int i = 0;i<nSwitch.Length;i++)
            {
                if (!nSwitch[i]) cnt++;
            }

            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 29940
use proconio::input;
use std::collections::HashMap;
fn main() {
    input! {
        mut n: usize,
    };
    let mut facts: HashMap<usize, i32> = HashMap::new();
    for i in 2..((n as f64).sqrt().floor() as usize)+1 {
        while n % i == 0 {
            n /= i;
            *facts.entry(i).or_insert(0) += 1;
        }
    }
    if n != 1 {
        facts.insert(n, 1);
    }
    let mut ans = 0;
    for v in facts.values_mut() {
        let mut i = 1;
        while i <= *v {
            *v -= i;
            i += 1;
            ans += 1;
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2688
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                ans+=1
                
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.s<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
const int inf = 1e9+10;
const ll INF = 1e18+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

void solve()
{
	int n;
	int d[MAXN];
	// cin>>a>>b;
	cin>>n;
	string s;
	cin>>s;
	// cin
	int i = 0,ans = 0;
	while(i<n){
		while(i<n && s[i]==s[i+1]) i++;
		if(i<n)
		ans++;
		i++;
	}

	cout<<ans<<endl;
}
int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;

}
    

Measured memory_bytes: 512
object Main {
  def main(args: Array[String]) = {
    
    val input: String = readLine()
    val sec: Int = input.toInt

    val devideAndMod = (a: Int, b: Int) => (a / b, a % b)

    var (hour: Int, remainMin: Int) = devideAndMod(sec, 3600)
    var (minute: Int, remainSec: Int) = devideAndMod(remainMin, 60)
    
    println(hour + ":" + minute + ":" + remainSec)
  }  
  
  //def readLine(): String = {"46979"}
}


Measured memory_bytes: 43716
def cin; gets.split.map(&:to_i) end

# exit if $0 != __FILE__

# n, *x = cin
# s = gets.chomp

# puts n

n = gets.to_i
ws = cin
m = 10**18

[*(0..(n-2))].each do |x|
  sa = ws[0..x].inject(:+) - ws[(x+1)..(n-1)].inject(:+)
  sa = sa.abs
  m = sa if m > sa
end

p m

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007

int main() {
    int n;
    cin >> n;
    int c = 0, a;
    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        c += a & 1;
    }
    cout << ((c & 1) ? "NO\n" : "YES\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	LL N;
	cin>>N;
	char str[20];
	sprintf(str,"%ld",N);
	char *p=str;
	int num=0;
	while (*p!='\0'){
		num+=*p-'0';
		p++;
	}
	if (N%num==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

[[maybe_unused]] constexpr ll LL_MAX = numeric_limits<ll>::max();
[[maybe_unused]] constexpr ll LL_MIN = numeric_limits<ll>::min();
[[maybe_unused]] constexpr ull ULL_MAX = numeric_limits<ull>::max();

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

template <typename T>
void chmin(T& x, T y) {
    x = min(x, y);
}

template <typename T>
void chmax(T& x, T y) {
    x = max(x, y);
}

ll csum(ll x, ll y) {
    if (x > 0 && y > 0 && x > LL_MAX - y) {
        return LL_MAX;
    }
    if (x < 0 && y < 0 && x < LL_MIN - y) {
        return LL_MIN;
    }
    return x + y;
}

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

int main() {
    ll K;
    cin >> K;
    string S;
    cin >> S;
    if (S.size() <= K) {
        cout << S << endl;
    } else {
        string out(S.begin(), S.begin() + K);
        cout << out << "..." << endl;
    }
}


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

typedef long long ll;

int32_t main(){
	int a[3] ;
	cin >> a[0] >> a[1] >> a[2] ;
	sort(a,a+3) ;
	cout << (a[0]*a[1]) /2 ;
 	return 0;
}



Measured memory_bytes: 256
import math
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.hypot(xb - xa, yb- ya)
    if d > ra + rb:
        print(0)
    elif abs(ra - rb) <= d:
        print(1)
    else:
        print(2 if rb < ra else -2)

Measured memory_bytes: 7640
S = input()
if len(S) == 1:
  print(int(S))
  exit()
else:
  def count(n):
    if len(n) == 1:
      return 0
    else:
      a = 0
      for i in range(1, len(n)):
        a += int(n[:i]) * 2 ** (len(n) - 1 - i) + int(n[i:]) + count(n[i:])
      return a
  ans = int(S) + count(S)
  print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
#ifdef LOCAL
	freopen("in.txt","r",stdin);
#endif
	string s;
	cin>>s;
	int n=s.length();
	if(s[n-1]=='s')s+="es";
	else s+="s";
	cout<<s;
	return 0;
}


Measured memory_bytes: 3624
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
	int N =	sc.nextInt();
	int sum	= 0;
        for(int i = 0; i<N; i++) {
            int	a = sc.nextInt();
            int	b = sc.nextInt();
            sum += b-a+1;
        }
	System.out.println(sum);
    }
}

Measured memory_bytes: 27368
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
	int n;
	long long a[10000];
	long long total = 0LL;
	long long maxn = -10000000LL;
	long long minn = 10000000LL;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
		total += a[i];
		if(a[i] < minn) minn = a[i];
		if(a[i] > maxn) maxn = a[i];
	}
	cout << minn << " " << maxn << " " << total << endl;
	return 0;
}


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

#ifndef DEBUG
#define endl '\n'
#define debug(...)
#else
#define debug(...) __VA_ARGS__
#endif
#define debugf(...) debug(printf(__VA_ARGS__);)

const int N = 1024;
int c[N][N];
int f[10];
int off[10];

int solve(int h, int w, int m, int k) {
    int cuts = __builtin_popcount(m);
    memset(f, 0, sizeof(f));
    for (int j = 0; j < w; j++) {
        int id = 0;
        int run = 0;
        for (int i = 0; i < h; i++) {
            f[id] += c[i][j];
            run += c[i][j];
            if (run > k)
                return 1e9;
            if (f[id] > k) {
                j--;
                cuts++;
                memset(f, 0, sizeof(f));
                break;
            }

            if ((m&(1<<i))) {
                run = 0;
                id++;
            }
        }
    }

    return cuts;
}


int (((((main)))))() <%
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

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

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char _c; cin >> _c;
            c[i][j] = _c - '0';
        }
    }

    int ans = 1e9;
    for (int m = 0; m < (1<<(h-1)) && ans > 0; m++) {
        ans = min(ans, solve(h, w, m, k));
    }

    cout << ans << endl;

    return 0;
%>

Measured memory_bytes: 256
N = int(input())

H = list(map(int, input().split()))

ans = 0
cnt = 0

now = H[0]

for i in range(1, N):
    if now >= H[i]:
        cnt += 1
        now = H[i]
    else:  # 右隣の方が大きかったら
        ans = max(cnt, ans)
        cnt = 0
        now = H[i]

ans = max(cnt, ans)

print(ans)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    ll N,K,min=INF;
    cin >> N >> K;

    vector<ll> h(N);

    for(ll i = 0;i < N;i++)
        cin >> h.at(i);

    sort(h.begin(),h.end());

    for(ll i = 0;i < N - K + 1;i++){
        if(min > abs(h.at(i) - h.at(i + K-1)))
            min = abs(h.at(i) - h.at(i + K - 1));
    }

    cout << min << endl;




}

Measured memory_bytes: 3972
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[103];
    cin>>s;
    int l=strlen(s),cnt=0;
    for(int i=0;i<l;i++)
    {
        if((i%2)==0&&(s[i]=='R'||s[i]=='U'||s[i]=='D'))
        {
            cnt++;
        }
        else if((i%2!=0)&&(s[i]=='L'||s[i]=='U'||s[i]=='D'))
                {
                    cnt++;
                }
    }
    if(cnt==l)
    {
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256