akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/


map< int, int > prime_factor(int n) {
	map< int, int> ret;
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1; //素数だった時の
	return ret;
}

VI num(1000005,0);
/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int N;
	cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];
	int g = A[0];
	REP(i, N)g = gcd(g, A[i]);
	if (g != 1) {cout << "not coprime" << endl; return 0;}

	else {

		REP(i, N) {
			if (A[i] == 1)continue;
			map<int, int> mp = prime_factor(A[i]);
			for (auto m : mp) {
				num[m.first]++;
			}
		}
	}

	bool isPair = true;
	FOR(i, 0, 1000005) {
		if (num[i] > 1) {isPair = false;}
	}
	if(isPair)cout<<"pairwise coprime"<<endl;
	else cout<<"setwise coprime"<<endl;

	return 0;
}


Measured memory_bytes: 11064
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]

L = [0] * 26

ans = 0
for i in range(D):
  ans += s[i][t[i] - 1]
  for j in range(26):
    if t[i] - 1 == j:
      L[j] = 0
    else:
      L[j] += 1
      ans -= L[j] * c[j]
  print(ans)

Measured memory_bytes: 68368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	set<string> st;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 19116
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=1000010;
int p[N],a[N],n,k,d[N],tot,ans[N];
vector<int>G[N];
priority_queue<int,vector<int>,greater<int> >q;
void Add(int u,int v){G[u].push_back(v);d[v]++;}
int t[N<<1];
void modify(int o,int l,int r,int pos,int v){
	if(l==r){t[o]=v;return;}
	int mid=(l+r)>>1;
	if(pos<=mid)modify(o<<1,l,mid,pos,v);
	else modify(o<<1|1,mid+1,r,pos,v);
	t[o]=min(t[o<<1],t[o<<1|1]);
}
int query(int o,int l,int r,int posl,int posr){
	if(posl>posr)return t[0];
	if(posl<=l && r<=posr)return t[o];
	int mid=(l+r)>>1,ret=t[0];
	if(posl<=mid)ret=min(ret,query(o<<1,l,mid,posl,posr));
	if(mid<posr)ret=min(ret,query(o<<1|1,mid+1,r,posl,posr));
	return ret;
}
int main(){
	n=gi();k=gi();
	for(int i=1;i<=n;i++)p[i]=gi(),a[p[i]]=i;
	memset(t,63,sizeof(t));
	for(int i=n;i;i--){
		int x=query(1,1,n,a[i]+1,min(n,a[i]+k-1));
		if(x<t[0])Add(a[i],a[x]);
		x=query(1,1,n,max(1,a[i]-k+1),a[i]-1);
		if(x<t[0])Add(a[i],a[x]);
		modify(1,1,n,a[i],i);
	}
	for(int i=1;i<=n;i++)if(!d[i])q.push(i);
	while(!q.empty()){
		int u=q.top();q.pop();ans[u]=++tot;
		for(int v:G[u]){d[v]--;if(!d[v])q.push(v);}
	}
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 64256
n = gets.to_s.to_i
a = gets.to_s.split.map{|t|t.to_i}.sort

if n == 1
  puts 1
  exit
end

if a[0] == 1 && a[1] != 1
  puts 1
  exit
end

if a[0] == 1 && a[1] == 1
  puts 0
  exit
end

# p a
hantei = [true] * ( 10 ** 6 + 1)

i = 0
while i < n
  
  t = a[i]
  if t == a[i+1]
    hantei[t] = false
  end
  
  s = t
  while s + t <= 1_000_000
    s += t
    hantei[s] = false
  end
  
  i += 1
end
# p hantei[18]
ans = 0
a.each do |t|
  ans += 1 if hantei[t]
end

puts ans

Measured memory_bytes: 38584
n = int(input())
w = list(map(int, input().split()))
center = sum(w)//2
sml = 0
i = 0
while sml < center:
    sml += w[i]
    i += 1
i -= 1
smr = sum(w)-sml
if sml-smr > smr+w[i]-(sml-w[i]):
    print(smr+w[i]-(sml-w[i]))
else:
    print(sml-smr)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n;
	cin>>n;
	vector<ll> v(n);
	for(ll i=0;i<n;i++)
			cin>>v[i];
	ll ans=*max_element(v.begin(),v.end());
	ll ind=-1;
	for(ll i=0;i<n;i++)
	{
		if(v[i]==ans)
			ind=i;
	}
	ll k=-1;
	ll a1=0,a2=0;
	for(ll i=0;i<n;i++)
	{
		if(i!=ind){
		ll j=min(ans-v[i],v[i]);
		if(j>k)
			{a1=v[i];k=j;}
	}
		
	}
	
	cout<<ans<<" "<<a1;
}

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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef double ld;
typedef pair<ll, ll> pll;

int main()
{

    //ifstream cin("input.txt");
    //freopen("input.txt", "r", stdin);

    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n, m;
    scanf("%d%d", &n, &m);

    vector<int> cnt(n, 1);
    vector<char> red(n, false);
    red[0] = true;

    while (m--) {
        int u, v;
        scanf("%d%d", &u, &v);
        --u, --v;
        if (!red[u]) {
            --cnt[u];
            ++cnt[v];
            continue;
        }
        if (cnt[u] == 1) {
            red[u] = false;
            cnt[u] = 0;
            ++cnt[v];
            red[v] = true;
        } else {
            --cnt[u];
            red[v] = true;
            ++cnt[v];
        }
    }

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

}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long a, b, k;
	cin >> a >> b >> k;
	cout << max(a - k, (long long)0) << " " << max(b - max(k - a, (long long)0), (long long)0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
long long mod=1e9+7;
#define int long long

signed main(){
  int n;
  cin>>n;
  vector<vector<int> > a(n,vector<int>(n));
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)cin>>a[i][j];
  }
  vector<vector<int> > wf(n,vector<int>(n,1));
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        if(k!=i&&k!=j){
          if(a[i][j]>a[i][k]+a[k][j]){
            cout<<-1<<endl;
            return 0;
          }else if(a[i][j]==a[i][k]+a[k][j]){
            wf[i][j]=0;
          }
        }
        //wf[i][j]=min(wf[i][j],wf[i][k]+wf[k][j]);
      }
    }
  }
/*
  //vector<vector<int> > ans()
  vector<tuple<int,int,int> > cvu;

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cvu.push_back(make_tuple(a[i][j],i,j));
    }
  }
  sort(cvu.begin(),cvu.end());
*/
  int ans=0;
  /*
  for(int i=0;i<cvu.size();i++){
    int x=get<0>(cvu[i]);
    int y=get<1>(cvu[i]);
    int z=get<2>(cvu[i]);
    if(wf[y][z]<x){
      cout<<-1<<endl;
      return 0;
    }
    if(wf[y][z]>x){
      ans+=x;
    }
  }
  */
  for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
      if(wf[i][j])ans+=a[i][j];
    }
  }
  cout<<ans<<endl;
}


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

#define debug(...) fprintf(stderr,__VA_ARGS__)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long LL;
const int MAXN=1e5+10; 
int n,sx[MAXN];
char s[100];
bool Legal(int l, int r){
	return (sx[l]^sx[r])==((r-l)&1);
}
int Ask(int i){
	printf("%d\n", i); fflush(stdout);
	scanf("%s",s);
	if ( s[0]=='V') exit(0);	else
	if ( s[0]=='M') return 1;	else
	return 0;
}
int main(){
//	freopen("input.txt","rt",stdin);
//	freopen("output.txt","wt",stdout);
	scanf("%d", &n);
	if ( n<=20){
		for (int i=0; i<n; i++) sx[i] = Ask(i);
	}
	for (int i=0; i<n; i++) sx[i] = -1;
	int l=0, r= n/2;
	sx[0]=sx[n]=Ask(0); sx[n/2]=Ask(n/2);
	if (Legal(l,r)){
		l=n/2;
		r=n;
	}
	while ( l+1<r){
		int mid= (l+r)>>1;
		if ( sx[mid]==-1) sx[mid] =Ask(mid);
		if ( Legal(l,mid)) l=mid;
			else r=mid;
	}
	return 0;
}


Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define pb push_back
#define tam 200120
#define offset 320000
#define se second
#define fi first
#define pitem item*
#define ptr tre*
#define forr(i,p,n) for(ll i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000009 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
vector<int> on[tam];
struct tre{
    ptr iz;
    ptr der;
    int lazy;
    int marca;
    tre(){}
    tre(int M)
    {
        marca=M;
        lazy=0;
        iz=der=NULL;
    }
};
tre trees[24000000];
int cuniv=0;
ptr getnode()
{
    trees[cuniv]=tre(0);
    return &trees[cuniv++];
}
void push(ptr nodo)
{
    if (nodo==NULL)
        return;
    if (nodo->marca!=0)
        {
            nodo->lazy=0;
            return;
        }
    if (!nodo->iz)
        nodo->iz=getnode();
    if (!nodo->der)
        nodo->der=getnode();
    if (nodo->lazy!=0)
    {
        nodo->marca=nodo->lazy;
        if (nodo->iz)
            nodo->iz->lazy=nodo->lazy;
        if (nodo->der)
            nodo->der->lazy=nodo->lazy;
        nodo->lazy=0;
    }
}
void update(ptr nodo,int iz,int der,int riz,int rder,int marca)
{
    push(nodo);
    if (iz>rder|| der<riz)
        return;
    if (nodo->marca!=0)
        return;
    //<<iz<<" "<<der<<endl;
    if (iz>=riz&& rder>=der)
    {
        //<<iz<<" "<<der<<" ";
        nodo->lazy=marca;
        push(nodo);
        //<<nodo->marca<<endl;    
        return;
    }
    int mid=(iz+der)/2;
    update(nodo->iz,iz,mid,riz,rder,marca);
    update(nodo->der,mid+1,der,riz,rder,marca);
    //<<iz<<" "<<der<<" "<<(nodo->marca)<<endl;
}
int query(ptr nodo,int iz,int der,int pos)
{
    push(nodo);
    if (iz==der)
    {
        return nodo->marca;
    }
    int mid=(iz+der)/2;
    if (pos<=mid)
        return query(nodo->iz,iz,mid,pos);
    else
        return query(nodo->der,mid+1,der,pos);
}
int ans[tam];
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ptr root;
    root=getnode();
    int n,queries;
    cin>>n>>queries;
    int iz,der,pos;
    const int tamder=1e9+5;
    vector<iii> v;
    forr(i,0,n)
    {
        cin>>iz>>der>>pos;
        v.pb(iii(pos,ii(iz,der)));
    }
    sort(v.begin(),v.end());
    ans[0]=-1;
    forr(i,0,n)
    {
        iz=v[i].se.fi;
        der=v[i].se.se;
        pos=v[i].fi;
        ans[i+1]=pos;
        der--;
        iz-=pos;
        der-=pos;
        iz=max(iz,0);
        if (der>=iz)
        {
            update(root,0,tamder,iz,der,i+1);
        }
    }   
    forr(i,0,queries)
    {
        cin>>pos;
        pos=query(root,0,tamder,pos);
        cout<<ans[pos]<<"\n";
    }
}

Measured memory_bytes: 303088
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
using namespace std;
signed main(){
    int n,h; cin>>n>>h;
    vector<int> a(n),b(n),strong;
    int maxa=0,ans=0;
    rep(i,n){
        cin>>a.at(i)>>b.at(i);
        maxa=max(a.at(i),maxa);
    }
    rep(i,n){
        if(b.at(i)>maxa) strong.push_back(b.at(i));
    }
    sort(all(strong),greater<int>());
    rep(i,strong.size()){
        h-=strong.at(i);
        ans++;
        if(h<=0){
            cout<<ans<<endl;
            return 0;
        }
    }
    cout<<ans+(h-1)/maxa+1<<endl;
}

Measured memory_bytes: 2936
void main() {
	auto n = ri;
	auto a = readAs!(int[]);

	// +, -, +, ...
	long res;
	long tmp;
	foreach(i, v; a) {
		tmp += v;
		if(i % 2 == 0) {
			if(tmp <= 0) {
				res += -tmp + 1;
				tmp = 1;
			}
		} else {
			if(tmp >= 0) {
				res += tmp + 1;
				tmp = -1;
			}
		}
	}

	long res2;
	tmp = 0;

	// -, +, -, ...
	foreach(i, v; a) {
		tmp += v;
		if(i % 2 == 0) {
			if(tmp >= 0) {
				res2 += tmp + 1;
				tmp = -1;
			}
		} else {
			if(tmp <= 0) {
				res2 += -tmp + 1;
				tmp = 1;
			}
		}
	}
	
	debug writefln("%d %d", res, res2);
	min(res, res2).writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++)
#define all(v) v.begin(), v.end()
#define pr(x) cout << x << endl


int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i, n){
        cin >> c.at(i);
        rep(j, m){
            cin >> a.at(i).at(j);
        }
    }

    int min_c = 10000000;
    rep(i, (1 << n)){
        int sum = 0;
        vector<int> sum_a(m, 0);
        bitset<12> s(i);
        rep(j, n){
            if(s.test(j)){
                sum += c.at(j);
                rep(k, m){
                    sum_a.at(k) += a.at(j).at(k);
                }
            }
        }

        bool not_sat = false;
        rep(k,m){
            if(sum_a.at(k) < x){
                not_sat = true;
                break;
            }
        }
        if(not_sat) continue;

        if(sum < min_c) min_c = sum;
    }
    if(min_c == 10000000) pr(-1);
    else pr(min_c);

    return 0;
}



Measured memory_bytes: 3632
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    int N,M;
    cin >> N >> M;
    int X[M];
    REP(i,M) cin >> X[i];
    sort(X,X+M);
    if(M<=N){
        cout << 0 << endl;
    }
    else{
        int tmp[M-1];
        for(int i=0;i<M-1;++i){
            tmp[i]=abs(X[i+1]-X[i]);
        }
        sort(tmp,tmp+M-1,greater<int>());
        int limit=X[M-1]-X[0];
        int num=0;
        for(int i=0;i<N-1;++i){
            num+=tmp[i];
        }
        cout << limit-num;
    }
}

Measured memory_bytes: 1024
/* atcoder */
#include "bits/stdc++.h"
using namespace std;

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<vector<int>> vvi;           // intの2次元vector
typedef vector<vector<double>> vvd;        // doubleの2次元vector
typedef vector<vector<ll>> vvll;           // llの2次元vector
typedef vector<vector<ld>> vvld;           // ldの2次元vector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* stringstream */
stringstream ss;
stringstream init_ss; // save default formatting

/* main */
void Main(void)
{
    int h, w;
    cin >> h >> w;
    vvi a;
    a.resize(h);
    for (int rv1 = 0; rv1 < h; rv1++)
    {
        for (int rv2 = 0; rv2 < w; rv2++)
        {
            int vv_set_num;
            cin >> vv_set_num;
            a[rv1].push_back(vv_set_num);
        }
    }
    vi b;
    b.resize(w);
    for (int rv = 0; rv < w; rv++)
    {
        cin >> b[rv];
    }
    vi c;
    c.resize(h);
    for (int i = 0; i < h; i++)
    {
        c[i] = 0;
        for (int j = 0; j < w; j++)
        {
            c[i] += (a[i][j] * b[j]);
        }
    }
    c.resize(h);
    for (int rv = 0; rv < h; rv++)
    {
        cout << c[rv] << endl;
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



Measured memory_bytes: 3256
#include <stdio.h>

int main(){
  int n;
  scanf("%d\n", &n);
  int a[n];
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  int ans[n];
  for(int i = 0; i < n; i++){
    ans[a[i] - 1] = i + 1;
  }
  for(int i = 0; i < n; i++){
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 1536
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;
#define DUMPR(v) REP(_i,v.size()){std::cerr<< #v << "[" << _i << "] = " << (v[_i]) << std::endl;}
#define CIN_VEC(v,N) {v.clear(); v.reserve(N); REP(i,N){typename decltype(v)::value_type x; cin>>x; v.emplace_back(x);}};

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

static const int NMAX = 100;
static const int VMAX = 1000;
static const ull WMAX = 100000000;
int w[NMAX];
int v[NMAX];
int N,W;

// dp[i+1][j] ... 品物iまでを使って価値jときの重量の最小値
long long dp[NMAX+1][VMAX*NMAX+1];

static const ull INF = NMAX*WMAX+1;

int main() {
  cin>>N>>W;
  REP(i,N) cin>>w[i]>>v[i];
  fill(dp[0], dp[0] + NMAX*VMAX+1, INF);

  // 何も入れてない状態
  dp[0][0]=0;
  for(int i=0;i<N;i++) {
    for(int j=0; j<=NMAX*VMAX; j++) {
      if(j < v[i])
        dp[i+1][j] = dp[i][j];
      else
        dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i]);
    }
  }
  int ans;
  for(int v=NMAX*VMAX; v>=0; v--) {
    if(dp[N][v] <= W) {
      ans = v;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 79104
// Author - Sumit 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("avx")
 
#define ll long long 
#define int ll
#define ps push
#define pb emplace_back
#define INF 10000000000000LL
#define MOD 1000000007
#define mp make_pair
#define rep(i,a,b) for (int i = a; i < b; i++)
#define repd(i,a,b) for (int i = a; i >= b; i--)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pair<int,int>>
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define lower(v,x) (lower_bound(all(v),x)-v.begin())
#define upper(v,x) (upper_bound(all(v),x)-v.begin())
#define debug(x) cout << x << "\n";
#define debug2(x,y) cout << x << " " << y << "\n";
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

template<typename T, typename U> inline void remin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void remax(T &x, U y) { if(x < y) x = y; }
template<typename T> T pow(T a,T b, int m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }
 

void solve(){
	int n,m;
    cin>>n>>m;
    int a[n];
    rep(i,0,n) cin>>a[i];
    int sum=accumulate(a,a+n,0);
    int mn=ceil(1.0*sum/(4*m));
    int cnt=0;
    rep(i,0,n){
        if(a[i]>=mn) cnt++;
    }
    if(cnt>=m){
        debug("Yes");
    }else{
        debug("No");
    }
}
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);



    clock_t clk=clock();
    
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    cerr<<((long double)(1.00*clock()-clk)/CLOCKS_PER_SEC)<<"\n";
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    x = get_int()
    print(x ** 3)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()



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

char field[8][8];
int sx, sy;

void dfs(int x, int y){
	if(0 <= x && x < 8 && 0 <= y && y < 8){
		field[x][y] = '0';
		for(int i=1; i <= 3; i++){
			if(field[x][y+i] == '1') dfs(x, y+i);
			if(field[x][y-i] == '1') dfs(x, y-i);
			if(field[x+i][y] == '1') dfs(x+i, y);
			if(field[x-i][y] == '1') dfs(x-i, y);
		}
	}
}

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

	for(int l=0; l < n; l++){
		for(int i=0; i < 8; i++){
			for(int j=0; j < 8; j++){
				cin >> field[i][j];
			}
		}
		cin >> sx >> sy;

		dfs(sy-1, sx-1);

		cout << "Data " << l+1 << ":" << endl;
		for(int i=0; i < 8; i++){
			for(int j=0; j < 8; j++){
				cout << field[i][j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define d(x) cerr<<#x<<"="<<x<<endl;

string str;
int main(void){
    cin>>str;
    int ans=0;
    rep(i,str.size()-1)if(str[i]!=str[i+1])ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n, a[100000], b;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a, a+n);
    b = a[0];
    for(int i=1;i<n-1;i++){
        if(abs(a[i]-a[n-1]/2) <= abs(b-a[n-1]/2))b = a[i];
    }
    cout << a[n-1] << " " << b << endl;
}


Measured memory_bytes: 640
package main
 
import(
  "fmt"
	"bufio"
	"os"
	"strings"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}
 
func abc057a(a int, b int){
	a = a + b
	if a-24 >= 0{
		fmt.Println(a-24)
	}else{
		fmt.Println(a)
	}
}
 
func main(){
	a := 0
	b := 0
	fmt.Scan(&a)
	fmt.Scan(&b)
	abc057a(a,b)
}

Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
#include <algorithm>
using namespace std;
int main(void){
    int N, M; cin >> N >> M;
    int i = 0;
    vector<int> x(M);
    vector<int> d(M-1);
    while(M > i){
        cin >> x[i];
        i++;
    }
    sort(x.begin(), x.end());
    i = 1;
    while (M > i) {
        d[i-1] = abs(x[i] - x[i-1]);
        i++;
    }
    sort(d.begin(), d.end());
    i = 0;
    int ans = 0;
    for (int count = 0; count < M - N; count++) {
        ans += d[count];
    }
    cout << ans << endl;
}


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

int list[] = {1000, 961, 900, 841, 784, 729, 676, 625, 576, 529, 512, 484, 441, 400, 361, 343, 324, 289, 256, 243, 225, 216, 196, 169, 144, 128, 125, 121, 100, 81, 64, 49, 36, 32, 27, 25, 16, 9, 8, 4, 1, -1};

int main(){
  int x;
  cin >> x;
  for(int i=0; list[i]>0; i++){
    if(list[i]<=x){
      cout << list[i];
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int a, b, c, cnt;
	int i;
	
	cnt = 0;
	
	scanf("%d %d %d", &a, &b, &c);
	
	for (i = a; i <= b; i++){
		if (c % i == 0){
			cnt++;
		}
	}
	
	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 596
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
 
const long INF = (1l << 30);
const long LINF = (1l << 60);

long p, q, r;

int main(){
	scanf("%ld%ld%ld", &p, &q, &r);
	printf("%ld\n", std::min(p+q, std::min(q+r, r+p)));
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

signed main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> vec[10];
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < 10;j++) {
            if(S.at(i) == '0' + j) {
                vec[j].push_back(i);
                break;
            }
        }
    }
    int ret = 0;
    for(int i = 0;i < 10;i++) {
        for(int j = 0;j < 10;j++) {
            for(int k = 0;k < 10;k++) {
                if(!vec[i].empty() && !vec[j].empty() && !vec[k].empty()) {
                    bool cnt = true;
                    int A = vec[i].at(0);
                    auto itr = upper_bound(vec[j].begin(),vec[j].end(),A);
                    int B = itr - vec[j].begin();
                    if(B == vec[j].size()) {
                        continue;
                    }
                    else {
                        int D = vec[j].at(B);
                        auto itr2 = upper_bound(vec[k].begin(),vec[k].end(),D);
                        int C = itr2 - vec[k].begin();
                        if(C == vec[k].size()) {
                            continue;
                        }
                        else {
                            ret++;
                        }
                    }
                }
            }
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define pb push_back
#define FastIO cin.sync_with_stdio(false),cin.tie(NULL)
#define file freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 
 
ll max(ll a, ll b){
    if(a>b) return a;
    return b;}
 
ll min(ll a, ll b){
    if(a<b) return a;
    return b;}
 
ll ceil_div(ll a, ll b){return (a+b-1)/b;}
 
const ll N = 3e5 + 5, INF = 2e9+2, MOD = 998244353, M = 6000, K = 20;
int a[N], segment[3*N], b[N];

void build(int ind, int l, int r){
	if(r<=l)return;
	if(r-l == 1){segment[ind] = a[l]; return;}
	int mid = (l+r)/2;
	build(2*ind, l , mid); build(2*ind+1, mid, r);
	segment[ind] = max(segment[2*ind], segment[2*ind+1]);
}

void update(int ind, int l ,int r, int i, int v){
	int mid = (l+r)/2;
	if(r-l == 1){segment[ind] = v; return;}
	if(i < mid)update(2*ind, l, mid, i, v);
	else update(2*ind+1, mid, r, i, v);
	segment[ind] = max(segment[2*ind], segment[2*ind+1]);
}

int ql , qr;
ll query(int ind, int l, int r){
	int mid = (l+r)/2;
	if(l >= ql && r <= qr)return segment[ind];
	if(r <= ql || l >= qr || r <= l)return 0;
	ll ans = 0;
	ans = max(query(2*ind, l, mid), query(2*ind+1, mid, r));
	return ans;
}

int main(){
	//FastIO;
	int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++)cin >> b[i];
	a[b[0]] = 1;
	if(n == 1){
		cout << 1 << "\n";
		return 0;
	}
	build(1, 0, N);

	ll tp;
	for(int i = 1; i < n; i++){
		ql = max(0, b[i]-k); qr = min(N, b[i]+k+1);
		tp = query(1, 0, N);
		a[b[i]] = tp+1;
		update(1, 0, N, b[i], tp+1);
	}

	cout << segment[1] << "\n";


 
	return 0;
}


Measured memory_bytes: 9472
ls = list(map(str,input()))
lsa = ls[0::2]
lsb = ls[1::2]
flag = 0
for i in range(len(lsa)):
  if lsa[i] == 'L':
    flag += 1
for i in range(len(lsb)):
  if lsb[i] == 'R':
    flag += 1
if flag != 0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3064
def func(a, b):
    a_plus_b = a + b
    a_minus_b = a - b
    a_times_b = a * b
    print(max(a_plus_b, a_minus_b, a_times_b))

if __name__ ==  '__main__':
    a, b = map(int, input().split())
    func(a, b)


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

int main()
{
	list<int> L;
	int N,M,Q;
	int a;
	int q;
	int b[200001];
	
	cin >> N;
	cin >> M;
	cin >> Q;
	
	L.push_front(0);
	b[0]=1;
	for(int i=1;i<=N-1;i++) 
	{
		L.push_back(i);
		b[i]=1;
	}
	for(int i=0;i<=M-1;i++)
	{
		cin >> a;
		if(a%2==0)
		{
			for(int j=0;j<=a-1;j++)
			{
				L.push_back(L.front());
				L.pop_front();
			}
		}
		else
		{
			for(int j=0;j<=a-1;j++)
			{
				L.push_front(L.back());
				L.pop_back();
			}
		}
		b[L.front()]=0;
		L.pop_front();
	}
	for(int i=0;i<=Q-1;i++)
	{
		cin >> q;
		cout << b[q] << endl;
	}
	return 0;
}

Measured memory_bytes: 10108
import scala.io._

// e.g
// 1 2 3
// val Array(a, b) = readLine.split(" ").map(_.toInt) => Array(1, 2, 3)
// 5
// 1 2 3
// 4 5 6
// 7 8 9
// val lines = Source.stdin.getLines()
// データ個数読み取り
// val n = lines.next().toInt
// データ行n個読み取り
// val data = lines.take(n).map{ line => line.split(" ").map(_.toInt).toList }.toList => List(List(1, 2, 3), List(4, 5, 6), List(7, b, 9))

object Main {
  def main(args: Array[String]): Unit = {
    val Array(a, b) = readLine.split(" ").map(_.toInt).sorted
    val ans = if (a == b) a + b
              else b + b - 1
    println(ans)
  }
}


Measured memory_bytes: 27584
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll N, W;
    cin >> N >> W;

    vec<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vec<vec<vec<ll>>> dp(N+1, vec<vec<ll>>(N+1, vec<ll>(301, 0)));
    rep(i, N) {
        ll wp           = w[i] - w[0];
        dp[i + 1][1][wp] = max(dp[i + 1][1][wp], v[i]);
        rep(j, N) rep(k, 2*N+2) {
            dp[i + 1][j][k] = max(dp[i + 1][j][k],dp[i][j][k]);
            if (dp[i][j][k] != 0) {
                dp[i + 1][j + 1][k + wp] =
                    max(dp[i + 1][j + 1][k + wp], dp[i][j][k] + v[i]);
            }
        }
    }

    ll ans = 0;
    rep(j,N+1)rep(k,250){
        if(j*w[0]+k<=W) ans = max(ans,dp[N][j][k]);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 27772
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
struct data{
    int h,a,b;
    bool operator<(const data &d)const{
        return h<d.h;
    }
};
int main(){
    int n,m,s;
    while(scanf("%d%d%d",&n,&m,&s),n||m||s){
        vector<data>V;
        for(int i=0;i<m;i++){
            int h,a,b;
            scanf("%d%d%d",&h,&a,&b);
            V.push_back((data){h,a,b});
        }
        sort(V.rbegin(),V.rend());
        for(int i=0;i<m;i++){
            int a=V[i].a,b=V[i].b;
            if(s==a)s=b;
            else if(s==b)s=a;
        }
        printf("%d\n",s);
    }
    return 0;
}

Measured memory_bytes: 1076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e18,MOD=1e9+7;
const int iINF=1e9;
int main(){
    double sum=0;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        double tos;
        cin>>tos;
        sum+=1/tos;
    }
    sum=1/sum;
    printf("%.8f\n",sum);
}

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

using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  int ans = a * x + b * y;
  for (int i = 0; i <= max(x, y); i++) {
    int na = max(0, x - i);
    int nb = max(0, y - i);
    ans = min(ans, na * a + nb * b + 2 * i * c);
  }
  
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define start ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#pragma GCC optimize ("Ofast")
int main()
{
    //start;
    ll i,j,k,l,m,n,h,w,a,b;
    cin>>n>>m>>k;
    getchar();
    char arr[10][10];
    for(i=0;i<n;i++){
        for(j=0;j<m;j++)
        {
            arr[i][j]=getchar();
        }
        getchar();
           }
    ll p = 1 << n, q = 1 << m; ll cnt=0;
    for(a=0;a<p;a++)
    {
        for(b=0;b<q;b++)
        {
            ll blx=0;
            for(i=0;i<n;i++)
            {
                for(j=0;j<m;j++)
                {
                    if(a&(1<<i) || b&(1<<j))
                        continue;

                    blx += (arr[i][j] == '#');
                }
            }
            cnt+=(blx==k);
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3600
# coding: utf-8
origin = input()
loops = int(input())

for _ in range(loops):
    command = input().split()
    start = int(command[1])
    end = int(command[2]) + 1

    # print('before : {}'.format(origin))
    if 'replace' in command:
        rep_str = command[3]
        origin = list(origin)
        for i, index in enumerate(range(start, end)):
            origin[index] = rep_str[i]
        origin = ''.join(origin)

    elif 'reverse' in command:
        rev_str = origin[start:end][::-1]
        origin = origin.replace(origin[start:end], rev_str)

    else:
        print(origin[start:end])
    
    # print('after  : {}'.format(origin))



Measured memory_bytes: 5620
n = int(input())
a = list(map(int, input().split()))

t = a[0]
ge, le = False, False
i = 0
ans = 1
while i < n:
    if a[i] == t:
        pass
    if a[i] > t:
        if ge:
            pass
        else:
            if le:
                le = False
                ans += 1
            else:
                ge = True
    if a[i] < t:
        if le:
            pass
        else:
            if ge:
                ge = False
                ans += 1
            else:
                le = True
#   print(i, ge, le, ans)
    t = a[i]
    i += 1
print(ans)    

Measured memory_bytes: 14224
/* package whatever; // don't place package name! */
 
import java.util.*;
import java.lang.*;
import java.io.*;
 
import java.util.ArrayList;
import java.util.List;
 
/* Name of the class has to be "Main" only if the class is public. */
class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        //文字列読込み
        Scanner sc = new Scanner(System.in);
 
        //結果格納
        int scInt;
        int[] check  = new int[3];

        while (sc.hasNext()) {
            //1行読込み
            scInt = sc.nextInt();
	
	if (check[0] < scInt) {
		check[2] = check[1];
		check[1] = check[0];
		check[0] = scInt;
	} else if (check[1] < scInt) {
		check[2] = check[1];
		check[1] = scInt;
	} else if (check[2] < scInt) {
		check[2] = scInt;
	} else {
	}
        }

	System.out.println(check[0]);         
	System.out.println(check[1]);         
	System.out.println(check[2]);         

    }
}


Measured memory_bytes: 25952
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>
#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}
using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
int sum(vector<int>);
int min(vector<int>);
int max(vector<int>);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

vector<vector<ll>> memo;

ll get(int x, int y) {
	if (memo[x][y] != -1)
		return memo[x][y];

	if (x == 0) return 1;
	if (y < x) return 0;

	memo[x][y] = get(x, y - 1) + get(x - 1, y - 1);
	return memo[x][y];
}

ll mpow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; i < b; i++) {
		ans *= a;
		ans %= 1000000007;
	}
	return ans;
}

ll nCr(ll n, ll r) {
	ll res = 1;
	for (int i = 0; i < r; i++) {
		res *= (n - i);
	}
	for (int i = 1; i <= r; i++) {
		res /= i;
	}
	return res;
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}
int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}
int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

ll _gcd(ll A, ll B) {
	return (B == 0) ? A : gcd(A % B, B);
}

vector<bool> to_binary(int x) {
	vector<bool> res;
	while (x != 0) {
		res.push_back(x % 2);
		x /= 2;
	}
	return res;
}

template<int index>
bool comp(tuple<ll, ll, ll, ll> a, tuple<ll, ll, ll, ll> b) {
	return get<index>(a) < get<index>(b);
}

int vector_finder(std::vector<ll> vec, ll number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return index;
	}
	else { // 発見できなかったとき
		return 0;
	}
}


int len(int x) {
	return (int)log10(x) + 1;
}

int same_vec(vector<int> a, vector<int> b) {
	int res = 1, num = a.size();
	for (int i = 0; i < num; i++) {
		if (a[i] != b[i]) {
			res = 0;
			break;
		}
	}
	return res;
}


ll fibs[100] = { 0 };
ll fib(int n) {
	if (fibs[n] == 0) {
		return fibs[n] = fib(n - 1) + fib(n - 2);
	}
	return fibs[n];
}



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

	int N;
	cin >> N;
	string S;
	cin >> S;

	char prev = '_';
	ll ans = 0;
	for (auto it = S.begin(); it != S.end();it++) {
		if (prev != *it) ans++;
		prev = *it;
	}

	cout << ans << endl;


ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 712
N = int(input())
X = []
Y = []
P = []
for _ in range(N):
    x, y, p = map(int, input().split())
    X.append(x)
    Y.append(y)
    P.append(p)

DX = [[0] * (1 << N) for _ in range(N)]
DY = [[0] * (1 << N) for _ in range(N)]

for i, x in enumerate(X):
    for k in range(1 << N):
        d = abs(x)
        for j, xx in enumerate(X):
            if k & (1 << j):
                d = min(d, abs(xx - x))
        DX[i][k] = d * P[i]
for i, y in enumerate(Y):
    for k in range(1 << N):
        d = abs(y)
        for j, yy in enumerate(Y):
            if k & (1 << j):
                d = min(d, abs(yy - y))
        DY[i][k] = d * P[i]

ANS = [1 << 100] * (N + 1)
PC = [0] * (1 << N)
for i in range(1, 1 << N):
    j = i ^ (i & (-i))
    PC[i] = PC[j] + 1

mm = (1 << N) - 1
RA = [[] for _ in range(1 << N)]
for i in range(1 << N):
    t = []
    for j in range(N):
        if i & (1 << j):
            t.append(j)
    RA[i^mm] = tuple(t)

for i in range(1 << N):
    m = i ^ mm
    j = m
    while 1:
        ans = 0
        for k in RA[i^j]:
            ans += min(DX[k][i], DY[k][j])
        
        pc = PC[i] + PC[j]
        ANS[pc] = min(ANS[pc], ans)
        
        if not j:
            break
        j = m & (j - 1)

print(*ANS, sep = "\n")


Measured memory_bytes: 85372
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Da;
		decimal a=(decimal)s[0];
		decimal b=(decimal)s[1];
		Console.WriteLine("{0}",(long)(a*b));
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define Min(...) min({__VA_ARGS__})
#define Max(...) max({__VA_ARGS__})
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
static inline ll sgn(ll x) { return (x>0)-(x<0); }
static inline bool vowel(char c) { c = (char)tolower(c); return c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u' or c == 'y'; }
static inline vi rvi(int N) { vi res(N); rep(i,0,N) cin >> res[i]; return res; }
static inline int ri() { int N; cin >> N; return N; }
static inline void pvi(const vi& r) { trav(it,r) cout << it << " "; cout << endl; }
template<class S, class T> static inline void smax(S& s, const T& t) { if (t > s) s = t; }
template<class S, class T> static inline void smin(S& s, const T& t) { if (t < s) s = t; }
template<class S> static inline void in(S& s) { cin >> s; }
template<class S> static inline void ut(const S& s) { cout << s << " "; }
static inline void nl() { cout << endl; }

signed main() {
	cin.sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	string s;
	cin >> s;
	string ns = s;
	reverse(all(ns));
	if (s == ns) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256