akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
//DEFINE and TYPEDEF--------------------------------------------------------------
 
#define timeKyaHorhaH 1.0 * clock() / CLOCKS_PER_SEC

#define FORG(i,a,n) for(lld i=a;i<n;i++) //for - general
#define FORZ(i,n) for(lld i=0;i<n;i++) //for - zero
#define FORGI(i,a,n,inc) for(lld i=a;i<n;i+=inc) //for - general incremental
#define FORZI(i,n,inc) for(lld i=0;i<n;i+=inc) //for - zero incremental
#define SPEEDUP ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define MEM(a,val) memset(a,val,sizeof(a));
 
#define SORTall(m) sort(m.begin(),m.end());
 
#define st first
#define nd second
#define pb push_back
 
typedef long long int lld;
typedef unsigned long long int ulld;
 
//DEBUGGER------------------------------------------------------------------------
// #define DEBUG(x) cerr<<(#x)<<" is "<<(x)<<"\n" //to debug values of variables
// #define DEBUGON
#define ZINDA cerr<<"\nIdhar-ich hai apun!!\n"; //to debug if code reached that point

vector<string> vec_splitter(string s) {
	for(char& c: s) c = c == ',' ?  ' ': c;
	stringstream ss; ss << s;
	vector<string> res;
	for(string z; ss >> z; res.push_back(z));
	return res;
}

void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
	void debug_out(vector<string> args, int idx, Head H, Tail... T) {
		if(idx > 0) cerr << ", ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, T...);
	}

#ifdef DEBUGON
	#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);
	#define DEBUG(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__);	
#else
	#define debug(...) 320;
	#define DEBUG(...) 320;
#endif

lld power(lld b, lld e)
{
    if(e==0)
        return 1;
    if(e%2==1)
        return b*power(b*b,(e-1)/2);
    else
        return power(b*b,e/2);
}
 
lld power(lld b, lld e, lld m)
{
	if(e==0)
		return 1;
	if(e%2==1)
		return b*power(((b%m)*(b%m))%m,(e-1)/2,m)%m;
	else
		return power(((b%m)*(b%m))%m,e/2,m)%m;
}
 
int nDig(lld n)
{
	if(n<0) 
		n*=-1;
	if(n==0)
		return 1;

    return floor(log10(n) + 1);
}

#define endl '\n'
#define mod 1000000007

//endl : changed to '\n', to flush comment that definition
//--------------------------------------------------------------------------------

void swagWaalaFunction()
{
	string s,t;
	cin>>s>>t;

	FORZ(i,s.length())
	{
		if(s[i]!=t[i])
		{
			cout<<"No";
			return;
		}
	}

	cout<<"Yes";
	return;
}

int main()
{
    SPEEDUP;
 	lld t=1;
 	//cin>>t;

 	while(t--)
 		swagWaalaFunction();
	
	// cerr<<"\n"<<timeKyaHorhaH; 	
 	return 0;
}

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

map<ll , int > mp;

int main(){
    int n;ll m;
    cin>>n>>m;
    ll s=0;
    mp[0]++;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        //a=a%m;
        s=(s+a)%m;
        mp[s]++;
    }

    ll cnt=0;
    map<ll ,int >::iterator it=mp.begin();
    for(;it!=mp.end();it++){
        cnt+=((it->second*(it->second-1LL))/2);
    }

    cout<<cnt;
    
    return 0;

}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int N;cin >>N;
    vi t(N),x(N),y(N);
    rep(i,N){
        cin >>t[i]>> x[i] >> y[i];
    }
    
    int c=0,a=0,b=0;
    rep(i,N){
        
        
        int d = abs(a-x[i])+abs(b-y[i]);
        int dt = t[i]-c;
        
        if(dt < d){
            out("No");
            return 0;
        }
        if((dt-d)%2!=0){
            out("No");
            return 0;
        }
        
        c = t[i],a=x[i],b=y[i];
        
    }

    out("Yes");

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
 
using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

ll cnt(const vecll& a, int mid) {
  int n=a.size();
  ll ans = 0;
  auto itr = begin(a);
  for(int i=n-1; i>= 0; --i) {
    while (itr != end(a) && *itr + a[i] < mid) ++itr;
    if (itr == end(a)) break;
    ans += end(a) - itr;
  }
  return ans;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m;
  cin>>n>>m;
  vecll a(n);
  for(auto&& e:a)cin>>e;
  boost::sort(a);
  int hi=1<<18;
  int lo=0;
  while((hi-lo) > 1) {
    int mid=(hi+lo) / 2;
    if (cnt(a, mid) > m) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  vecll psum(n+1, 0);
  boost::partial_sum(a, next(begin(psum)));
  ll total = psum.back() * 2 * n;
  auto itr = begin(a);
  for(int i=n-1; i>=0; --i) {
    while (itr != end(a) && *itr + a[i] < hi) ++itr;
    total -= psum[itr - begin(a)];
    total -= a[i] * (itr - begin(a));
  }
  ll rem = m - cnt(a, hi);
  cout<<total+rem*lo<<endl;
  return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  char a[n][n], b[m][m];
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++) cin >> a[i][j];
  }
  for(int i = 0; i < m; i++){
    for(int j = 0; j < m; j++) cin >> b[i][j];
  }
  
  bool exist = false;
  for(int sy = 0; sy < n-m+1; sy++){
    for(int sx = 0; sx < n-m+1; sx++){
      bool match = true;
      for(int y = 0; y < m; y++){
        for(int x = 0; x < m; x++){
          if(b[y][x] != a[sy+y][sx+x]) match = false;
        }
      }
      if(match) exist = true;
    }
  }
  
  if(exist) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N; cin >> N;
  vector<ll> A(N); rep(i,N) cin >> A[i];
  ll ans = 0;
  rep(i,N-1){
    ans += max(0LL,A[i]-A[i+1]);
    A[i+1]=max(A[i],A[i+1]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define VFOR(x,begin,num) for(int x=(begin);x<((begin)+(num));x++)
#define INF__ ((long long)1 << 60)
int main(){
    int N, Q; string S;
    cin >> N >> S >> Q;
    S.insert(S.begin(),' ');
    set<int> CharPlace[26];
    VFOR(i,0,26){CharPlace[i].insert(-1); CharPlace[i].insert(98765432);}
    VFOR(i,1,N) CharPlace[(int)(S[i]-'a')].insert(i); 
    VFOR(i,0,Q){
        int q; cin >> q;
        if(q == 1){
            int a; string b,c="  ";
            cin >> a >> b;
            c[0] = S[a]; 
            S[a] = b[0];
            //{auto it = CharPlace[(int)(c[0]-'a')].begin();while(it != CharPlace[(int)(c[0]-'a')].end()  ) {cout<<*(it++) << " ";} cout << endl;}
            //{auto it = CharPlace[(int)(b[0]-'a')].begin();while(it != CharPlace[(int)(b[0]-'a')].end()  ) {cout<<*(it++) << " ";} cout << endl;}
            CharPlace[(int)(c[0]-'a')].erase(a);//{auto it = CharPlace[(int)(c[0]-'a')].begin();while(it != CharPlace[(int)(c[0]-'a')].end()  ) {cout<<*(it++) << " ";} cout << endl;}
            CharPlace[(int)(b[0]-'a')].insert(a);//{auto it = CharPlace[(int)(b[0]-'a')].begin();while(it != CharPlace[(int)(b[0]-'a')].end()  ) {cout<<*(it++) << " ";} cout << endl;}
        }
        else{
            int a, b,cnt=0;
            cin >> a >> b;
            VFOR(j,0,26){
                //if( lower_bound(CharPlace[j].begin(),CharPlace[j].end(),b) != lower_bound(CharPlace[j].begin(),CharPlace[j].end(),a-1)) cnt++;
                //if( distance(CharPlace[j].lower_bound(CharPlace[j].begin(),CharPlace[j].end(),b) , CharPlace[j].lower_bound(CharPlace[j].begin(),CharPlace[j].end(),a) ) ) cnt++;
                //{auto it = CharPlace[j].begin();while(it != CharPlace[j].end()  ) {cout<<*(it++) << " ";} cout << endl;}
                auto it = CharPlace[j].lower_bound(a);
                if(  *it <= b && it != CharPlace[j].end()) cnt++;
            }
            printf("%d\n", cnt);//cout << cnt << endl;
        }
    }
}

Measured memory_bytes: 24196
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
/*
░░░░░░░░░░░░░░░░░░░░░░░░░
░░█▀▀▄░░░░░░░░░░░▄▀▀█░░░░
░░█░░░▀▄░▄▄▄▄▄░▄▀░░░█░░░░
░░░▀▄░░░▀░░░░░▀░░░▄▀░░░░░
░░░░░▌░▄▄░░░▄▄░▐▀▀░░░░░░░
░░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█░
░░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█░
░▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█░
░█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀░
░░▀▄░░▀░░▀▀▀░░▀░░░▄█▀░░░░
░░░░█░░░░░░░░░░░▄▀▄░▀▄░░░
░░░░█░░░░░░░░░▄▀█░░█░░█░░
░░░░█░░░░░░░░░░░█▄█░░▄▀░░
░░░░█░░░░░░░░░░░████▀░░░░
░░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░
*/
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 2005;
ll a[MAXN];
ll coun[MAXN];
ll coun2[MAXN];
const ll MOD = 1e9 + 7;

void solve(){
    ll n,k; cin>>n>>k;

    FOR(i,1,n) cin>>a[i];

    FOR(i,1,n){
        FOR(j,1,n){
            if(a[j] > a[i]) coun[i]++;
        }
    }    

    FOR(i,1,n){
        FOR(j,1,i-1){
            if(a[j] > a[i]) coun2[i]++;
        }
    }

    
    ll ans = 0;

    ll temp = k*(k-1)/2; temp = (temp%MOD);
    FOR(i,1,n) ans = (ans + (temp*coun[i])%MOD)%MOD;
    FOR(i,1,n) ans = (ans + (k*coun2[i])%MOD)%MOD;
    
    cout<<ans<<endl;
} 
 
signed main(){
 
   FastRead;    
 
 
    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 256
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val N= sc.nextInt
  val W = List.fill(N)(sc.next)
  val joken1 = W.size == W.distinct.size
  val joken2 = (0 to N-2).map(i=>W(i).last == W(i+1).head).reduce(_&_)
  val ans = if(joken1 & joken2){"Yes"}else{"No"}
  println(ans)
}



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

int main(){
    int n,F[45];
    cin>>n;
    for(int i=0;i<=n;i++){
        if(i==0||i==1) F[i]=1;
        else{
            F[i]=F[i-1]+F[i-2];
        }
    }
    cout<<F[n]<<endl;
}


Measured memory_bytes: 3116
#include <stdio.h>
#define N 10000

int main(void)
{
	int a[N],b[N];
	int i=0, j;
	
	do{
		scanf("%d %d", &a[i], &b[i]);
		i++;
	}while(a[i-1]!=0 || b[i-1]!=0);
	
	for(j=0; j<i-1; j++){
		if(a[j] <= b[j]){
			printf("%d %d\n", a[j], b[j]);
		}
		else{
			printf("%d %d\n", b[j], a[j]);
		}
	}
	return 0;
}


Measured memory_bytes: 1924
use proconio::input;

fn main(){
    input!{
        mut a:i32,
        b:i32,
        mut c:i32,
        d:i32,
    }
    println!("{}",loop{
        c -= b;
        if c <= 0{
            break "Yes"
        }
        a -= d;
        if a <= 0 {
            break "No"
        }
    } )
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
#define For(i,j,k)	for(int i=j;i<=k;++i)
#define Dow(i,j,k)	for(int i=k;i>=j;--i)
#define ll long long
#define PI acos(-1)

using namespace std;

inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(!isdigit(c))	{if(c=='-')	f=-1;c=getchar();}
	while(isdigit(c))	t=t*10+c-48,c=getchar();
	return t*f;
}
inline void write(ll x){if(x<0)	{putchar('-');x=-x;}	if(x>=10)	write(x/10);putchar(x%10+48);}
inline void writeln(ll x){write(x);puts("");}
inline void write_p(ll x){write(x);putchar(' ');}

const int N=500006;
char s[N];
int jump[N],nxt[N],Fa[N][22],n,que,to[N][31],q[N],trans[N][31];
int main()
{
//	freopen("fusion.in","r",stdin);freopen("fusion.out","w",stdout);
	scanf("\n%s",s+1);
	n=strlen(s+1);que=read();
	to[n][s[n]-'a']=n;
	Dow(i,1,n-1)
	{
		to[i][s[i]-'a']=i;
		int now=i+1,nc=s[i]-'a';
		while(1)
		{
			int tmp=now,top=0;
			while(!to[now][nc]&&nxt[now])	
			{
				q[++top]=now;
				now=nxt[now]+1;
			//	if(trans[now][nc])	now=trans[now][nc];
			}
			if(!to[now][nc])	break;
			For(j,1,top)	trans[q[j]][nc]=now;
			now=to[now][nc]+1;nc++;to[i][nc]=now-1;
			if(nc>'z'-'a')	break;
		}
		nxt[i]=to[i]['z'-'a'+1];
	}
	For(i,1,n-1)	if(nxt[i])	Fa[i][0]=nxt[i]+1;
	For(j,1,21)	
		For(i,1,n-1)	
				if(Fa[i][j-1])	Fa[i][j]=Fa[Fa[i][j-1]][j-1];
	
	For(i,1,que)
	{
		int l=read(),r=read();
		bool cg=0;
		Dow(j,0,21)
		{
			if(Fa[l][j])	if(Fa[l][j]<=r)	l=Fa[l][j];else	if(Fa[l][j]-1==r)	{puts("Yes");cg=1;break;}
		}
		if(!cg)	puts("No");
	}
}
/*
xxyzzwwxzzyz
1
6 12
*/

Measured memory_bytes: 171008
n,m=map(int,input().split())
dic =[0]*(n+1)
for _ in range(m):
	dic[int(input())]+=1

mod=10**9+7
if n==1:
	print(1)
	exit()
dp = [0]*(n+1)
dp[0]=1
dp[1]=1 if dic[1]!=1 else 0

for i in range(2,n+1):
	if dic[i]:
		continue
	dp[i] = dp[i-2]+dp[i-1]
	dp[i]%=mod
print(dp[n])


Measured memory_bytes: 7668
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
typedef long long ll;
int n;
ll k, a[N];


vector<ll>positive, negative;

bool judge(ll x){
    ll ans = 0;
    for(int i = 0; i < negative.size(); i++){
        ll l = i + 1, r = negative.size() - 1;
        ll res = r + 1;
        while(l <= r){
            ll m = (l + r) / 2;
            if(negative[m] * negative[i] <= x){
                r = m - 1;
                res = m;
            }else{
                l = m + 1;
            }
        }
        ans += negative.size() - res;
    }
  
    for(int i = 0; i < positive.size(); i++){
        ll l = i + 1, r = positive.size() - 1;
        ll res = -1;
       // cout <<"l " << l << " r " << r << endl;
        while(l <= r){
            ll m = (l + r) / 2;
         //   cout <<"AA " << positive[i] * positive[m] << endl;
            if(positive[i] * positive[m] <= x){
                
                l = m + 1;
                res = m;
            }else{
                r = m - 1;
            }
        }
        if(res != -1){
         //   cout <<"res " << res - i << endl;
            ans += res - i;
        }
        
    }
  //  cout <<"ans " << ans << endl;
    for(int i = 0; i < positive.size(); i++){
        ll l = 0, r = negative.size() - 1;
        ll res = -1;
        while(l <= r){
            ll m = (l + r) / 2;
            if(positive[i] * negative[m] <= x){
                l = m + 1;
                res = m;
            }else{
                r = m - 1;
            }
        }
        ans += res + 1;
    }
  //  cout <<"m " << x << "ans " << ans << endl;
    if(ans >= k)return true;
    return false;
}

map<ll, int>q;
int main(){
    scanf("%d %lld", &n, &k);
    for(int i = 1; i <= n; i++){
        scanf("%lld", &a[i]);
        if(a[i] >= 0)positive.push_back(a[i]);
        else negative.push_back(a[i]);
       
    }
    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());
    ll l = -1000000000000000000;
    ll r = 1000000000000000000;
    ll ans;
    //judge(r);
    while(l <= r){
        ll m = (l + r) / 2;
        if(judge(m)){
            r = m - 1;
            ans = m;
        }else{
            l = m + 1;
        }
    }
    printf("%lld\n", ans);
}
/*
10 40
5 4 3 2 -1 0 0 0 0 0
*/

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

typedef long long ll;

int main()
{
    int MOD = 1e9+7;
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    vector<int> digit(61,0);
    ll t = 1;
    for(i = 0;i < n;++i){
        for(j = 0;j < 61;++j){
            if(a.at(i) & (t << j)){
                ++digit.at(j);
            }
        }
    }
    ll ans = 0;
    for(i = 0;i < 61;++i){
        ans += digit.at(i)*(n-digit.at(i))%MOD*((t << i)%MOD);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  if(s[1]==s[2]){
    if(s[0]==s[1] || s[2]==s[3]) {
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	LD R;
	cin >> R;
	cout << 2 * R * PI << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

int main() {
  int M,D;
  cin >> M >> D;
  int ans = 0;

  rep(i,M){
    rep(j,D){
      int a = (j+1) / 10;
      int b = (j+1) % 10;
      if(a >= 2 && b >= 2 && (i+1) == a*b)
        ans++;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

main(){
	int a,b;
	while(cin>>a>>b){
		if(a==0 && b==0)break;
		
		vector<int> data;
		data.resize(4);
		int mins=a*a+b*b;
		for(int i=1;i*i<=a;i++){
			if(a%i==0){
				for(int j=1;j*j<=b;j++){
					if(b%j==0){
						data[2]=b/j;
						data[3]=j;
						data[0]=a/i;
						data[1]=i;
						sort(data.begin(),data.end());
						int i=data[0]-data[1],j=data[1]-data[2],k=data[2]-data[3];
						if(mins>i*i+j*j+k*k)mins=i*i+j*j+k*k;
					}
				}
			}
		}
		
		cout<<mins<<endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 998244353;

struct ftree {
  vector<int> bit;
  ftree (int _n) {
    bit.assign(_n + 5, 0);
  }

  void update(int x, int val) {
    while (x < (int)bit.size()) {
      bit[x] += val;
      x += x&-x;
    }
  }

  int query(int x) {
    int ret=0;
    while (x > 0) {
      ret += bit[x];
      x -= x&-x;
    }
    return ret;
  }
};

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

  int n, k;
  cin >> n >> k;

  vector<pair<int, int>> p(k);
  for (int i = 0; i < k; ++i) {
    cin >> p[i].first >> p[i].second;
  }

  ftree bit(n);
  bit.update(1, 1);  

  for (int i = 2; i <= n; ++i) {
    int cur = 0;
    for (int j = 0; j < k; ++j) {
      int l = i - p[j].second, r = i - p[j].first;
      l = max(1ll, l);
      if (r < 1) continue;
      cur += (bit.query(r) - bit.query(l-1) + M) % M;
      cur %= M;
    }
    bit.update(i, cur);
  }
  
  cout << (bit.query(n) - bit.query(n-1) + M) % M << '\n';
}


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

long long n,m,fakt[100005];

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

    cin>>n>>m;
    if(abs(n-m)>1)
    {
        cout<<0<<endl;
        return 0;
    }
    else
    {
        fakt[0]=1;
        fakt[1]=1;
        for(int i=2;i<100005;i++)
        {
            fakt[i]=fakt[i-1]*i;
            fakt[i]%=1000000007;
        }
        if(n%2==m%2)
            cout<<2*fakt[m]*fakt[n]%1000000007<<endl;
        else
            cout<<fakt[m]*fakt[n]%1000000007<<endl;
        return 0;
    }

}


Measured memory_bytes: 4400
#include <stdio.h>

int calc(int i){
    if(i==0)
        return 1;
    return 2*calc(i-1);
}


int main(int argc, const char * argv[]) {
    int weight,i=0,wfl[10]={},w[10]={},j;
    
    while(scanf("%d",&weight)!=EOF){
        while(1){
            if(weight==1){
                wfl[i]=1;
                break;
            }
            wfl[i]=weight%2;
            weight/=2;
            i++;
        }
        for(j=i;j>=0;j--){
            //printf("wfl[%d]=%d\n",j,wfl[j]);
            if(wfl[j]==1)
                w[j]=calc(j);
        }
        for(j=0;j<=i;j++){
            if(wfl[j]==1){
                printf("%d",w[j]);
            if(j!=i)
                printf(" ");
            }
            w[j]=0;
            wfl[j]=0;
        }
        printf("\n");
        i=0;
    }
    
    return 0;
}

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

#define rep0(i, n) for(int i=0; i<(int)(n);i++)
#define rep1(i, n) for(int i=1; i<=(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;
using namespace std;

//lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;


    string s;

    cin >> s;

    rep0(i, s.length())
    {
        cout << 'x';
    }

    

    cout << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    long long int a,b,sum=1;
    cin>>a>>b;
    for(int i=a;i<=b;i++){
       	if(i<0) sum*=-1;
       	if(i==0){
       		cout<<"Zero";
			return 0;	
		}
    }
    if(sum>0) cout<<"Positive"<<endl;
    else if(sum==0) cout<<"Zero"<<endl;
    else cout<<"Negative"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 10005;
const int MM = 998244353;

ll F[MX], I[MX], IF[MX];

const int L = 1<<15, HL = L/2;

typedef vector<int> poly;

bool dir;

ll pw(ll a, ll b = MM-2){
	ll r = 1;
	while(b){
		if( b&1 ) r = r*a % MM;
		a = a*a % MM; b /= 2;
	}
	return r;
}

ll w[L+1];
ll primitive_root = pw(3, (MM-1)>>15); // 3 ** ((MM-1) / 2**19) % MM

void priproc()
{
	w[0] = 1;
	for(int i = 1; i <= L; i++) w[i] = primitive_root * w[i-1] % MM;
}

void DFT(poly &p, int n) {
	if (n == 1) return;
	int Hn = n>>1;
	poly p0(Hn), p1(Hn);
	for (int k = 0; k < Hn; k++) {
		p0[k] = p[k<<1];
		p1[k] = p[(k<<1)|1];
	}

	DFT(p0, Hn);
	DFT(p1, Hn);
	int dif = L/n;
	if( dir ){
		for (int i = 0, j = Hn, k = 0; k < HL; k += dif, i++, j++) {
			p[i] = (p0[i] + w[k] * p1[i]) % MM;
			p[j] = (p0[i] + MM - w[k] * p1[i]%MM) % MM;
		}
	}
	else{
		for (int i = 0, j = Hn, k = L; k > HL; k -= dif, i++, j++) {
			p[i] = (p0[i] + w[k] * p1[i]) % MM;
			p[j] = (p0[i] + MM - w[k] * p1[i]%MM) % MM;
		}
	}
}

void poly_multi(poly X, poly Y, poly &Z)
{
	dir = true; DFT(X, L); DFT(Y, L);
	for(int i = 0; i < L; i++)
		Z[i] = (ll)X[i] * Y[i] % MM;
	dir = false; DFT(Z, L);
	for(int i = 0; i < L; i++) Z[i] = Z[i] * pw(L) % MM;
	for(int i = L/2-5; i < L; i++) Z[i] = 0;
}

int main()
{
	priproc();
	I[1] = 1;
	for(int i = 2; i < MX; i++) I[i] = (MM - MM/i) * I[MM%i] % MM;
	F[0] = IF[0] = 1;
	for(int i = 1; i < MX; i++){
		F[i] = F[i-1] * i % MM;
		IF[i] = IF[i-1] * I[i] % MM;
	}

	string A, B;
	cin >> A >> B;

	int a = 0, b = 0;
	for(int i = 0; i < A.size(); i++){
		if( A[i] == '1' && B[i] == '1' ) a++;
		if( A[i] != B[i] ) b++;
	} b /= 2;
	poly X(L, 0), Y(L, 0);
	for(int i = 0; i <= 10000; i++) X[i] = IF[i+1] % MM;
	Y[0] = 1;
	int n = b;
	while(n){
		if( n&1 ) poly_multi(X, Y, Y);
		poly_multi(X, X, X); n /= 2;
	}

	ll ans = 0;
	for(int i = 0; i <= a; i++){
		ans = (ans + Y[i]) % MM;
	}
	ans = ans * F[a+b] % MM * F[a] % MM * F[b] % MM;
	printf("%lld\n", ans);
}


Measured memory_bytes: 1596
from sys import setrecursionlimit
setrecursionlimit(10**7)
lst = dict({0: 1, 1: 1, 2: 2})
def calc(n):
    if (n in lst):
        return lst[n]
    else:
        lst[n] = calc(n-1) + calc(n-2)
        return lst[n]

N, M = [int(x) for x in input().split()]
if (M != 0):
    a_list = [int(input()) for _ in range(M)]
    span_list = [a_list[0]-1]
    for i, a in enumerate(a_list[:-1]):
        if (a_list[i+1] - a) == 1:
            print(0)
            exit()
        else:
            span_list.append(a_list[i+1] - 2 - a)
    span_list.append(N - a_list[-1] -1)
else:
    span_list = [N]
max_span = max(span_list)
for i in range(max_span+1):
    calc(i)
ans = 1
for span in span_list:
    ans = (ans * lst[span]) % (10**9+7)
print(ans)


Measured memory_bytes: 480900
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll gcd( ll m, ll n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

ll lcm(ll a, ll b){
  if( (a==0) || (b==0)) return 0;

  return (a/gcd(a,b)*b);
}

int
main(void){  
  int n;
  cin >> n;
  ll X;
  cin >> X;
  
  ll x[n];
  ll s_x[n+1];

  REP(i, n){
    cin >> x[i];
    s_x[i] = x[i];
  }
  s_x[n] = X;  
  
  if(n == 1){
    cout << abs(x[0]-X) << endl;
    return 0;
  }
  
  SORT(s_x, n+1);
  SORT(x, n);


  ll diff[n];
  REP(i, n){
    diff[i] = s_x[i+1]-s_x[i];
    //cout << diff[i] << endl;
  }

  REP(i, n-1){
    diff[i+1] = gcd(diff[i], diff[i+1]);
    //cout << diff[i+1] << endl;
  }

  cout << diff[n-1] << endl;
  
  /*
  ll bfr, afr;
  int itr = 0;
  FOR(i, 1, n){
    itr = i;
    if(s_x[i] == X){
      bfr = abs(s_x[i]-s_x[i-1]);
      afr = abs(s_x[i]-s_x[i+1]);
      break;
    }    
  }

  //cout << bfr << " " << afr << endl;
  int D = 0;
  ll pvt = 0;
  if(bfr < afr) pvt = itr-1;
  else pvt = itr;
  D = min(bfr, afr);
  //cout << pvt << endl;

  ll diff[n-1];
  
  REP(i, pvt){
    diff[i] = abs(x[i]-x[i+1]);
    //cout << "a " << abs(x[i]-x[i+1]) << endl;
  }
  FOR(i, pvt, n-1){
    diff[i] = abs(x[i]-x[i+1]);    
    //cout << "b " << abs(x[i]-x[i+1]) << endl;
  }

  //cout << "D " << D << endl;

  bool f, f2=false;
  ROF(i, D, 1){
    f = true;
    REP(i, n-1){
      //cout << diff[i] << endl;
      if(diff[i]%D != 0) f=false;
    }
    if(f) {
      cout << i << endl;
      f2=true;
      break;
    }
  }

  if(!f2) cout << "1" << endl;

  */
  return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<algorithm>
typedef long long int ll;
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    int A,B,C;
    int N,M;
    string ans,en;
    bool f=true;

int main(){
    cin>>en;
    for(auto x:en){
        if(x=='0'){
            ans.push_back('0');
        }
        if(x=='1'){
            ans.push_back('1');
        }
        if(x=='B'&&ans.size()!=0){
            ans.pop_back();
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// ビット数を取得 
ll bitcount(ll bitPtn)
{
	ll res = 0;
	for (ll i = 0; i < 60; ++i)
	if (bitPtn & ((ll)1 << i)) {
		++res;
	}
	return res;
}

int main()
{
	ll H, W, K;
	cin >> H >> W >> K;
	string S[10];
	REP(i, H) cin >> S[i];

	ll ans = INF;
	ll bitMax = (ll)1 << (H - 1);
	REP(bitPtn, bitMax) {
		ll divCnt = 0;
		ll bitNum = bitcount(bitPtn);
		vector<ll> wcCntAll(bitNum + 1, 0);
		REP(j, W) {
			ll idx = 0;
			vector<ll> wcCntOne(bitNum + 1, 0);
			REP(i, H) {
				if (S[i][j] == '1') {
					wcCntOne[idx]++;
					wcCntAll[idx]++;
				}
				if (bitPtn & (ll)1 << i) {
					idx++;
				}
			}

			for (auto all : wcCntAll) {
				if (K < all) {
					for (auto one : wcCntOne) {
						if (K < one) {
							divCnt = INF;
							goto FIN;
						}
					}
					divCnt++;
					wcCntAll = wcCntOne;
					break;
				}
			}
		}

	FIN:
		ll ansOne = bitNum + divCnt;
		ans = min(ans, ansOne);
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline().strip()


def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    for i in range(2, n):
        dp[i] = min(abs(h[i] - h[j]) + dp[j] for j in range(max(0, i - k), i))
    print(dp[n - 1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 13976
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;

int main () {
    int a,b,c;
    cin >> a>>b>>c;
    if(a==b&&b!=c||a==c&&b!=c||b==c&&a!=b) cout << "Yes\n";
    else cout <<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
  int t;
  for(;cin>>t,t;)
    {
      int n;
      cin>>n;
      int sum=0;
      for(int i=0;i < n;i++)
	{
	  int s,f;
	  cin>>s>>f;
	  sum+=(f-s);
	}
	    if(t>sum)
	      cout<<t-sum<<endl;
	      else
		cout<<"OK"<<endl;
	    
    }
}

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

#define MODULUS 1000000007

int main()
{

    int n;
    cin>>n;

    long long int a[n];
    long long int sum[n],ans[n],totalsum = 0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        totalsum = (totalsum + a[i])%MODULUS;
        sum[i] = totalsum;
    }

    for(int j=0;j<n;j++)
    {
        ans[j] = ((totalsum - sum[j])%MODULUS + MODULUS)%MODULUS;
    }

    long long int finalans = 0;
    for(int k=0 ;k<n-1;k++)
    {
        finalans = (finalans+ ((a[k])%MODULUS*(ans[k]%MODULUS)))%MODULUS;
    }
    cout<<finalans<<endl;
    return 0;
}

Measured memory_bytes: 8304
double x[100],y[100],t,u,a,b,s;
n,i,j,k,c;
main(m){
	for(;scanf("%d",&n),i=j=n;printf("%d\n",m)){
		for(m=1;i--;scanf("%lf,%lf",x+i,y+i));
		for(i=n;--i;)
			for(j=i-1;j--;)
				if((u=acos(hypot(x[j]-x[i],y[j]-y[i])/2))<9)
					for(s=1,t=atan2(y[j]-y[i],x[j]-x[i]);c=0,s+3;s-=2)
						for(a=x[i]+cos(t+s*u),b=y[i]+sin(t+s*u),k=n;k--;)
							hypot(a-x[k],b-y[k])<1.001&&++c>m?m=c:0;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int x, y, z, k; cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    rep(i,x) cin >> a[i];
    rep(i,y) cin >> b[i];
    rep(i,z) cin >> c[i];

    vector<ll> ab;
    rep(i,x) rep(j,y) {
        ab.push_back(a[i]+b[j]);
    }

    sort(ab.begin(), ab.end(), greater<ll>());
    sort(c.begin(), c.end(), greater<ll>());
    
    vector<ll> ans;
    rep(i,z) rep(j,min(k,x*y)) {
        ans.push_back(c[i]+ab[j]);
    }
    sort(ans.begin(), ans.end(), greater<ll>());
    rep(i,k) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 43240
N, M = gets.split.map &:to_i
PY = $<.map.with_index{|s, i|[*s.split.map(&:to_i), i]}
puts PY.group_by{|p, _, _| p }.map{|k, v|
  v.sort_by{|_, y, _| y }.map.with_index(1){|(_, _, i), j| ["%06d%06d"%[k, j], i] }
}.flatten(1).sort_by{|s, i| i }.map{|s, i| s }


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

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

    for (int i = 0; i < s.size(); i += 2)
    {
        cout << s[i];
    }

    cout << endl;
    return (0);
}


Measured memory_bytes: 3676
/// 5:22 PM 10/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    ll ans = 0;
    if(a >= k) {
        ans += k;
        cout << ans;
        return 0;
    } else {
        ans += a;
        k-=a;
    }
    if(b >= k) {
        cout << ans;
        return 0;
    } else {
        k-=b;
    }
    ans += -1 * k;
    cout << ans;
    return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

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

    int cnt = 0;
    char k = s[0];
    for (char c : s) {
        if (k != c) {
            cnt++;
            k = c;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
		int[] p = new int [N];
		int P = 0;
		int sum = 0;
		for (int i = 0; i < N; i++){
		    p[i] = sc.nextInt();
		    if (p[i] > P){
		        sum += p[i]/2 + P/2;
		        P = p[i];
		    }else{
		        sum += p[i];
		    } 
		}
		System.out.println(sum);
	}
}




Measured memory_bytes: 21844
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

signed main()
{
    string S;
    cin >> S;
    string ans = S;
    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] == '9')
        {
            ans[i] = '1';
        }
        else
        {
            ans[i] = '9';
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

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

  // problem statement guarantees a finding
  int index_a = -1;
  int index_z = 0;

  for (int i = 0; i < s.size(); ++i) {
    if (s.at(i) == 'A') {
      if (index_a == -1) {
        index_a = i;
      }
    }

    if (s.at(i) == 'Z') {
      index_z = i;
    }
  }

  cout << index_z-index_a+1 << endl;
  return 0;
}


Measured memory_bytes: 640
# atcoder https://atcoder.jp/contests/dp/tasks/dp_c

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()

DP = [[0] * 3 for _ in range(N)]


for i in range(N):
    abc = LIST()
    if i == 0:
        DP[0] = abc
        continue
    for j in range(3):
        DP[i][j] = max(DP[i-1][(j+1)%3] + abc[j],
                       DP[i-1][(j+2)%3] + abc[j])


print(max(DP[-1]))

Measured memory_bytes: 57452
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let mut a: Vec<(i32, usize)> = (0..n).map(|i| (read(), i)).collect();
    a.sort();

    println!(
        "{}",
        a.iter()
            .map(|ref x| (x.1 + 1).to_string())
            .collect::<Vec<_>>()
            .join(" ")
    );
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main() {
    int n,count=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(arr[i]%2==0)
        {
            if(arr[i]%3==0 || arr[i]%5==0)
            count++;
        }
        else if(arr[i]%2!=0)
        count++;
    }
    if(count==n)
    cout<<"APPROVED";
    else
    cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto D = RD;
	auto N = RD;

	writeln(N == 100 ? (N+1) * 100^^D : N * 100^^D);
	stdout.flush();
	debug readln();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int k;
  cin >> k;

  cout << (k/2)*((k+1)/2) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std ; 

int main ( ) 
{ 
	long long  a , b ,x ;
	scanf("%lld%lld%lld" , &a,&b,&x);

	
	if ( a%x ==0  )
	
		cout <<  ((b/x) - ((a)/x) ) +1 ; 
		else 
		cout << (b/x) - ((a)/x) ; 
			return 0 ; 
}


Measured memory_bytes: 256
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    s = s_input()

    if s[0] == 'R':
        if s[1] == 'R':
            if s[2] == 'R':
                print(3)
            else:
                print(2)
        else:
            print(1)
    else:
        if s[1] == 'R':
            if s[2] == 'R':
                print(2)
            else:
                print(1)
        else:
            if s[2] == 'R':
                print(1)
            else:
                print(0)

if __name__ == '__main__':
    main()


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

print(0, flush=True)
s = input()
if s == 'Vacant':
  quit()

root = 0
num = N - 1 # root以外の席数 (<- 偶数)
while True:
  n = num // 2
  print((root + n)%N, flush=True)
  _s = input()
  if _s == 'Vacant':
    quit()
  if (s==_s and n%2==0) or (s!=_s and n%2==1):
    root += n
    s = _s
    num = n + (n%2==1)
  else:
    num = n - 1 + (n%2==0)

Measured memory_bytes: 3660