akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N;
std::string S[210];
std::vector<ll> G[210];
ll d[210][210];

void warshallFloyd() {
  rep( i, N ) rep( j, N )
    d[i][j] = S[i][j] == '1' ? 1 : INF;

  rep( k, N ) rep( i, N ) rep( j, N )
    d[i][j] = std::min( d[i][j], d[i][k]+d[k][j] );

  return;
}

bool used[210];
ll depth[210];

void bfs( ll v ) {
  rep( i, N ) 
    used[i] = false;
  
  std::queue<P> que;
  que.emplace( v, 0 );
 
  used[v] = true;
 
  while( !que.empty() ) {
    P p = que.front(); que.pop();
    ll u = p.first, dist = p.second;
 
    depth[u] = dist;
 
    for( auto s : G[u] ) if( !used[s] ) {
      que.emplace( s, dist+1 );
      used[s] = true;
    }
  }
 
  return;
}

int main()
{
  std::cin >> N;

  rep( i, N ) {
    std::cin >> S[i];

    rep( j, i ) if( S[i][j] == '1' ) {
      G[i].emplace_back( j );
      G[j].emplace_back( i );
    }
  }

  bfs( 0 );

  rep( i, N ) rep( j, i ) if( S[i][j] == '1' ) {
    if( llabs(depth[i]-depth[j]) != 1 ) {
      std::cout << -1 << std::endl;

      return 0;
    }
  }

  warshallFloyd();

  ll ans = 0;

  rep( i, N ) rep( j, i ) if( d[i][j] != INF ) {
    chmax( ans, d[i][j] );
  }

  std::cout << ans+1 << std::endl;

  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
  ll n,m;
  cin>>n>>m;
  ll a=1;
  for(int i=1;i*i<=m;i++){
    if(m%i==0){
      ll b=1,c=1;
      if(i<=m/n)b=i;
      if(m/i<=m/n)c=m/i;
      a=max(a,max(b,c));
    }
  }
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

vector<string> a, b;
int n,m;

bool ch(int i, int j) {
    bool res = true;
    REP(p, m) {
        REP(q, m) {
            if (a[i+p][j+q] != b[p][q]) res = false;
        }
        if (!res) break;
    }
    return res;
}

int main() {
    cin >> n >> m;
    string input;
    REP(i, n) {
        cin >> input;
        a.push_back(input);
    }
    REP(i, m) {
        cin >> input;
        b.push_back(input);
    }

    bool isok = false;
    for(int i=0; i<(n-m+1); i++) {
        for(int j=0; j<(n-m+1); j++) {
            isok = ch(i, j);
            if (isok) break;
        }
        if (isok) break;
    }
    if (isok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=100005;

struct SHIT
{
    int id;
    int w;
}shit[505];

bool cmp(SHIT a,SHIT b)
{
    return a.w<b.w;
}
bool flag[505*505];
int ans[505*505];
int main()
{
    int n;
    memset(flag,0,sizeof(flag));
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&shit[i].w);
        shit[i].id=i;
        flag[shit[i].w]=1;
        ans[shit[i].w]=i;
    }

    sort(shit+1,shit+1+n,cmp);
    int l=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<shit[i].id;j++)
        {
            while(l<=n*n&&flag[l]==1)
                l++;
            if(l>n*n){
                printf("No\n");
                return 0;
            }
            if(l>shit[i].w){
                printf("No\n");
                return 0;
            }
            //printf("%d %d\n",l,shit[i].id);
            ans[l++]=shit[i].id;
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=shit[i].id;j<n;j++)
        {
            while(l<=n*n&&flag[l]==1)
                l++;
            if(l>n*n){
                printf("No\n");
                return 0;
            }
            if(l<shit[i].w){
                printf("No\n");
                return 0;
            }
            ans[l++]=shit[i].id;
        }
    }
    printf("Yes\n");
    for(int i=1;i<=n*n;i++)
        printf("%d%c",ans[i],i==n*n?'\n':' ');
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include<map>

using namespace std;

int X,i,j,k,memo[1000001];

int dp(int n)
{
  
  if(memo[n]!=-1)
  {
    return memo[n];
  }
  
  int t,s;
  t=0;
  for(s=100;s<=105;s++)
  {

    k=dp(n-s);
    t=max(t,k);

  }
  
  memo[n]=t;
  return t;
  
}

int main()
{
  
  cin >> X;

  for(i=0;i<=X;i++)
  {
    memo[i]=-1;
  }
  
  for(i=0;i<=99;i++)
  {
    memo[i]=0;
  }
  memo[100]=1;
  memo[101]=1;
  memo[102]=1;
  memo[103]=1;
  memo[104]=1;
  memo[105]=1;
    
  cout << dp(X);
  
  
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;

#define endl            "\n"
#define forn(i,x,n)     for(int i=x; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}



int32_t main() {

    zeus();

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

    char z[6][6];

    forn(i, 0, 6) {
        forn(j, 0, 6) {
            z[i][j] = '.';
        }
    }
    forn(i, 0, h) {
        forn(j, 0, w) {
            cin >> z[i][j];
        }
    }
    // cout << (1 << 0) << endl;
    int ans = 0;
    forn(i, 0, (int)pow(2, h)) {
        forn(j, 0, (int)pow(2, w)) {

            char x[6][6];
            forn(i2, 0, 6) {
                forn(j2, 0, 6) {
                    x[i2][j2] = z[i2][j2];
                    // cout << x[i2][j2];
                }
                // cout << endl;
            }

            forn(i1, 0, 6) {
                int y = 1 << i1;
                // cout << i << " " << y << " " << (i & y) << endl;
                if ((i & y) == y) {
                    forn(j1, 0, 6) {
                        // cout << i1 << " " << j1 << endl;

                        x[i1][j1] = '.';
                    }
                }
                // cout << j << " " << y << " " << (j & y) << endl;
                if ((j & y) == y) {
                    forn(j1, 0, 6) {
                        // cout << j1 << " " << i1 << endl;
                        x[j1][i1] = '.';
                    }
                }
            }
            int cnt = 0;
            forn(i1, 0, h) {
                forn(j1, 0, w) {
                    // cout << x[i1][j1];
                    if (x[i1][j1] == '#') {
                        cnt++;
                    }
                }
                // cout << endl;
            }
            if (cnt == k) {
                ans++;
            }
            // cout << endl;
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 4120
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vec dp(n+1,0);
  REP(i,n+1) dp[i] = i;

  REP(i,n){
    int x = 6;
    while(i+x <= n) dp[i+x] = min(dp[i+x],dp[i]+1), x*=6;
  }

  REP(i,n){
    int x = 9;
    while(i+x <= n) dp[i+x] = min(dp[i+x],dp[i]+1), x*=9;
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	//int D = 365;
	int D; cin >> D;

	vector<int> c(26,0);
	vector<vector<int>> s(D,vector<int>(26,0));
	vector<int> t(D,0);

	for (int i = 0; i < 26; i++) {
		cin >> c[i];
	}

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];	
		}
	}

	vector<int> MAX(D,0);
	for (int i = 0; i < D; i++) {
		int ans =0;
		int idx = 0;
		for (int j = 0; j < 26; j++) {
			if (MAX[i] < s[i][j]) {
				MAX[i] = s[i][j];	
				t[i] = j+1;	
			}
		}
	}

	int ANSER = 0;
	vector<int> last(26,0);
	for (int i = 0; i < D; i++) {
		ANSER += s[i][t[i]-1];	
		last[t[i]-1] = i+1;
		for (int j = 0; j < 26; j++) {
			ANSER -= c[j] * ((i+1) - last[j]) ;
		}
	}

	int cnt = 30000;
	while(cnt > 0) {
		vector<int> last(26,0);
		int d = (rand() % 365);
		int q = (rand() % 26) + 1;
		int old = t[d];
		t[d] = q;
		int ans = 0;
		for (int i = 0; i < D; i++) {
			ans += s[i][t[i]-1];	
			last[t[i]-1] = i+1;
			for (int j = 0; j < 26; j++) {
				ans -=	c[j] * ((i+1) - last[j]) ;
			}
		}
		if (ans < ANSER) {
			t[d] = old;	
		}else {
			ANSER = ans;
		}
		//cout << ANSER << endl;
		cnt--;
	}

	for (int i = 0; i < D; i++) {
		cout << t[i] << endl;
	}



	return 0;
}


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

using namespace std;
struct node{
	int date;
	int shang;
};
node a[200000+5];
int main(){
	int n,q;
	cin>>n>>q;
	a[1].shang=0;
	for(int i=1;i<=n-1;i++){
		int x,y;
		cin>>x>>y;
		a[i].date=0;
		a[y].shang=x;
	}
	for(int i=1;i<=q;i++){
		int x,y;
		cin>>x>>y;
		a[x].date=a[x].date+y;
	}
		for(int i=2;i<=n;i++){
			a[i].date=a[i].date+a[a[i].shang].date;
		
		}
			for(int i=1;i<=n;i++){
	
	cout<<a[i].date; if(i!=n) cout<<" ";
	}
} 

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}

int c(int n,int k){
    return (n&k)==k;
}
int32_t main(){

    int n;
    string s;
    cin>>n>>s;
    int e1=0;
    for(char&c:s){
        c--;
        if(c=='1')e1++;
    }
    if(!e1){
        int res=0;
        forn(i,n){
            if(s[i]=='2')res+=c(n-1,i);
        }
        if(res&1)cout<<"2\n";
        else cout<<"0\n";
    }else{
        int res=0;
        forn(i,n){
            if(s[i]=='1')res+=c(n-1,i);
        }
        if(res&1)cout<<"1\n";
        else cout<<"0\n";        
    }


    return 0;
}


Measured memory_bytes: 1948
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  int count = 0;
  cin >> N;
  for (int i = 0; i < N.size(); i++)
  {
    if (N.at(i) == '7')
    {
      count++;
    }
  }
  if (count == 0)
  {
    cout << "No" << endl;
  }
  else
  {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#include<math.h>
const double PI = acos(-1);
using namespace std;
int main()
{
  
  long long int t,a,b,c,d,i,l;
  cin>>a>>b>>c;
  l=0;
  for(i=a;i<=b;i++)
  {
      if(i%c==0)
      l++;
  }
  cout<<l;
  

      

    
}
     

Measured memory_bytes: 3592
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
//		for(;;) {
			int n = sc.nextInt();
//			if( n == 0 ) break;
			int cnt = 0, x = n;
			for(;x!=1;cnt++) x = (x/3)+(x%3==0? 0:1);
			System.out.println(cnt);
//		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b))<<endl;
    return 0;
    }


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

int main(){
		long int n,a,b;
		cin >> n >> a >> b;
		long int ans=(b-a+1)+(n-3)*b-(n-3)*a; 
		if(ans<=0){
				cout << 0 << endl;
		}else{
				cout << ans << endl;
		}
		return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int>VI;
map<int,int>en,de;
int N,A[100],D[100];
const int SIZE=5040;
int dp[2][SIZE];

int encode(vector<int>&v){
    int a=0;
    for(int i=0;i<7;i++)a=a*10+v[i];
    return en[a];
}

void decode(int a,vector<int>&v){
    v.resize(7);
    a=de[a];
    for(int i=6;i>=0;i--){
        v[i]=a%10;
        a/=10;
    }
}

void init(){
    VI p(7);
    for(int i=0;i<7;i++)p[i]=i;
    int idx=0;
    do{
        int val=0;
        for(int i=0;i<7;i++)val=val*10+p[i];
        en[val]=idx;
        de[idx]=val;
        idx++;
    }while(next_permutation(p.begin(),p.end()));
}

int start(){
    VI p(7);
    for(int i=0;i<7;i++)p[i]=i;
    int ret=0;

    do{
        int val=0;
        int cnt[7]={0};
        for(int i=0;i<7;i++){
            int id=p[i];
            val+=cnt[id];
            for(int j=max(0,id-D[id]);j<=min(6,min(N-1,id+D[id]));j++)cnt[j]+=A[id];
        }
        ret=max(ret,val);
        dp[0][encode(p)]=val;
 }while(next_permutation(p.begin(),p.end()));
    return ret;
}



int main(){
    cin>>N;
    for(int i=0;i<N;i++)cin>>D[i];
    for(int i=0;i<N;i++)cin>>A[i];
    init();
    start();
    if(N<=7){
        int ans=0;
        for(int i=0;i<SIZE;i++)ans=max(ans,dp[0][i]);
        cout<<ans<<endl;
        return 0;
    }
    int *prev=dp[0],*next=dp[1];

    for(int i=7;i<N;i++){
        for(int j=0;j<SIZE;j++){
            vector<int>a;
            decode(j,a);
            for(int k=0;k<8;k++){
                int val=0;
                for(int l=0;l<k;l++){
                    int d=7-a[l];
                    if(D[i-d]>=d)val+=A[i-d];
                }
                for(int l=k;l<7;l++){
                    int d=7-a[l];
                    if(D[i]>=d)val+=A[i];
                }
                vector<int>b;
                for(int l=0;l<k;l++){
                    if(a[l])b.push_back(a[l]-1);
                }
                b.push_back(6);
                for(int l=k;l<7;l++){
                    if(a[l])b.push_back(a[l]-1);
                }
                int idx=encode(b);
                next[idx]=max(next[idx],prev[j]+val);
            }
        }
        for(int j=0;j<SIZE;j++)prev[j]=0;
        swap(prev,next);
    }

    int ma=0;
    for(int i=0;i<SIZE;i++)ma=max(ma,prev[i]);

    cout<<ma<<endl;
    return 0;
}

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


void solve(long long N, std::string S){
    string X, Y;
    long long ans = 0;
    for(long long i = 0; i < N; ++i){
        X = S.substr(0, i);
        Y = S.substr(i, N-1);
        long long cnt = 0;
        for(char a = 'a'; a <= 'z'; ++a){
            if(X.find(a) != -1 && Y.find(a) != -1) cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) cin >> s[i][j];
  }
  string ans = "Yes";
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if(s[i][j] == '#') {
        if((0 < j && s[i][j-1] == '#') 
          || (j < w-1 && s[i][j+1] == '#') 
          || (0 < i && s[i-1][j] == '#') 
          || (i < h-1 && s[i+1][j] == '#')) {
          continue;
        }else {
          ans = "No";
          goto OUT;
        }
      }
    }
  }
  OUT:
  cout << ans;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

long mod=1e9+7;


int main() {
  double n;cin>>n;
  double x=n/1.08;
  int low=floor(x)*1.08;
  int high=ceil(x)*1.08;
  int ans=0;
  if(low==(int)n)ans=floor(x);
  if(high==(int)n)ans=ceil(x);
  cout<<(ans==0?":(":to_string(ans));
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
int n,lst,to[100002],cnt[100001];
char c[100002];
int main()
{
	scanf("%s",c+1);
	n=strlen(c+1);
	for(int i=1;i<=n;i++)
	{
		if(c[lst]!='R'&&c[i]=='R') lst=i;
		if(c[lst]=='R'&&c[i]=='L')
		{
			for(int j=lst;j<i;j++) to[j]=2*i-1;
			lst=i;
		}
	}
	lst=n+1;
	for(int i=n;i;i--)
	{
		if(c[lst]!='L'&&c[i]=='L') lst=i;
		if(c[lst]=='L'&&c[i]=='R')
		{
			for(int j=lst;j>i;j--) to[j]=2*i+1;
			lst=i;
		}
	}
	for(int i=1;i<=n;i++) cnt[((to[i]-1)/2-i)%2?((to[i]+1)/2):((to[i]-1)/2)]++;
	for(int i=1;i<=n;i++) printf("%d ",cnt[i]);
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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 main(){
    int n; cin >> n;
    vector<int> f(220000, 0LL);
    FOR(i,1,105){
        FOR(j,1,105){
            FOR(k,1,105){
                int x = i*i + j*j + k*k + i*j + j*k + k*i;
                if(x < 220000) f[x]++;
            }
        }
    }

    FOR(i,1,n+1){
        cout << f[i] << endl;
    }
}


Measured memory_bytes: 3948
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e4+50;
int n, vis[N];
char a[N],b[N],c[N];
struct _ {
	int p,l,r;
} L[N],R[N];
vector<pair<_*,_> > tag[N];
vector<int> tag2[N];

int solve(int d) {
	REP(i,0,n) tag[i].clear(),tag2[i].clear();
	int ans = 0, cnt = 0;
	REP(i,1,n) { 
		vis[i] = 0;
		int nxt = i-d;
		if (nxt<=0) nxt += n;
		c[nxt] = b[i]^a[i];
		if (b[i]) L[++cnt].p = i;
	}
	REP(i,1,n) ans += c[i];
	REP(i,1,cnt) { 
		L[i].l=i-1,L[i].r=i+1,R[i]=L[i];
	}
	L[0].r = 1, R[0] = L[0];
	if (!ans) return d;
	int tot = 0, pl = 0, pr = 0;
	REP(i,1,n) if (b[i]) { 
		vis[i] = 1;
		if (c[i]) ++tot;
	}
	if (tot==ans) return ans+d;
	auto add = [&](_ f[], int &p, int tp) {
		p += tp;
		for (int i=f[0].r; i!=cnt+1; i=f[i].r) {
			int nxt = f[i].p-tp;
			if (nxt==0) nxt=n;
			if (nxt>n) nxt=1;
			f[i].p = nxt;
			if (tp<0) {
				if (vis[nxt]) {
					tag[abs(p)].pb(pair<_*,_>(&f[f[i].l],f[f[i].l]));
					tag[abs(p)].pb(pair<_*,_>(&f[f[i].r],f[f[i].r]));
					f[f[i].l].r=f[i].r;
					f[f[i].r].l=f[i].l;
				}
				else { 
					tag2[abs(p)].pb(nxt);
					vis[nxt] = 1;
					if (c[nxt]) ++tot;
				}
			}
			else {
				if (vis[nxt]>=10) f[f[i].l].r=f[i].r,f[f[i].r].l=f[i].l;
				else {
					if (!vis[nxt]&&c[nxt]) ++tot;
					vis[nxt] += 10;
				}
			}
		}
	};
	while (tot<ans) add(L,pl,-1);
	int ret = min(abs(pl)+abs(pr-pl)+abs(d-pr),abs(pr)+abs(pl-pr)+abs(d-pl));
	do {
		for (auto &t:tag[abs(pl)]) *(t.x) = t.y;
		for (auto &t:tag2[abs(pl)]) {
			--vis[t];
			if (!vis[t]&&c[t]) --tot;
		}
		++pl;
		while (tot<ans) add(R,pr,1);
		ret = min(ret, min(abs(pl)+abs(pr-pl)+abs(d-pr),abs(pr)+abs(pl-pr)+abs(d-pl)));
	} while (pl);
	return ans+ret;
}


int solve() {
	int ans = 1e9;
	REP(d,0,n-1) {
		ans = min(ans, solve(d));
		char t = a[n];
		PER(i,2,n) a[i]=a[i-1];
		a[1] = t;
	}
	return ans;
}

char tmp[N];

int main() {
	scanf("%s%s",a+1,b+1);
	n = strlen(a+1);
	if (strcmp(a+1,b+1)==0) return puts("0"),0;
	if (*max_element(b+1,b+1+n)=='0') return puts("-1"),0;
	REP(i,1,n) a[i]-='0',b[i]-='0',tmp[i]=a[i];
	int ans = solve();
	REP(i,1,n) a[i]=tmp[i];
	reverse(a+1,a+1+n);
	reverse(b+1,b+1+n);
	ans = min(ans, solve());
	printf("%d\n", ans);
}






Measured memory_bytes: 896
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        long mod = (long)Math.pow(10,9)+7;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        int ans = 0;
        int chain = 0;
        for(int i = 0; i < n; i++){
            if(a[i] == i+1){
                chain++;
            }else{
                ans += (int)Math.ceil((double)chain/2d);
                chain = 0;
            }
        }
        System.out.println(ans + (int)Math.ceil((double)chain/2d));
    }
}

Measured memory_bytes: 50884
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
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; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    vector<vector<int>> G;
    ll N, X, Y;
    cin >> N >> X >> Y;
    X--; Y--;
    G.resize(N);
    rep(i,N-1){
        G[i].PB(i+1);
        G[i+1].PB(i);
    }
    G[X].PB(Y);
    G[Y].PB(X);
    map<ll, ll> ans;
    for(ll i=0; i<N; i++){
        VLL dist(N, -1);
        queue<ll> que;
        dist[i]=0;
        que.push(i);
        while(!que.empty()){
            ll v=que.front();
            que.pop();
            for(ll nv : G[v]){
                if(dist[nv]!=-1) continue;
                dist[nv]=dist[v]+1;
                if(i<nv){
                    ans[dist[nv]]++;
                }
                que.push(nv);
            }
        }
    }
    for(int i=1; i<N; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define sum(x) accumulate(all(x),0)
#define gll greater<ll>()


void solve(){
 ll d;
  cin >> d;
  vll c(26);
  rep(i,0,26) cin >> c[i];  
  
 vvll s(d,vll(26));
  rep(i,0,d){
    rep(j,0,26) cin >> s[i][j]; 
  }
  
  rep(i,0,d) cout << max_element(all(c))-c.begin()+1 << endl;
  
  
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3748
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
mod = 10**9 + 7
asum = 0
for i in range(N-1):
    for j in range(i+1,N):
        if A[i] > A[j]:
            asum += 1
asum = (asum*K)%mod
bsum = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            bsum += 1
bsum = (bsum*K*(K-1)//2)%mod
print((asum+bsum)%mod )

Measured memory_bytes: 3188
s = input()
n = len(s)

for i in range(n//2):
    if s[i] != s[-1-i]:
        print('No')
        exit()
tmp = s[:(n-1)//2]
for i in range(len(tmp)//2):
    if tmp[i] != tmp[-1-i]:
        print('No')
        exit()
tmp = s[(n+3)//2-1:]
for i in range(len(tmp)//2):
    if tmp[i] != tmp[-1-i]:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 38384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    char s[5];
    scanf("%s",s);
    if(s[0]=='S'){
        if(s[1]=='U'){
            printf("7");
            return 0;
        }
        printf("1");
        return 0;
    }
    if(s[0]=='M'){
        printf("6");
        return 0;
    }
    if(s[0]=='T'){
        if(s[1]=='U'){
            printf("5");
            return 0;
        }
        printf("3");
        return 0;
    }
    if(s[0]=='W'){
        printf("4");
        return 0;
    }
    printf("2");
    return 0;
}

Measured memory_bytes: 1640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(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()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    string s;
    int q;
    cin >> s >> q;
    int cnt=0;
    REP(i,q){
        int t;
        cin >> t;
        if(t==1)cnt=(cnt+1)%2;
        else{
            int f;string c;
            cin >> f >> c;
            if((cnt+f)%2==1) s.insert(0,c);
            else s+=c[0];
        }
    }
    if(cnt==1) reverse(ALL(s));
    cout << s;
    return 0;
}

Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG

int main() {
    int n;
    cin >> n;
    int ans = n;
    for(int i=n;i<=999;i++){
        if(ans == 111 || ans == 222 || ans == 333 || ans == 444 || ans == 555 || \
        ans == 666 || ans == 777 || ans == 888 || ans == 999)break;
        ans ++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/*input

*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main()
{
	IOS;
	int n;
	cin>>n;
	cout<<n*(n+1)/2;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections


def comb_count(n):
    return n * (n - 1) // 2

N = int(input().strip())
A = [int(str) for str in input().strip().split()]

c = collections.Counter(A)

comb_sum = sum([comb_count(n) for n in c.values()])
# print(comb_sum)
for a in A:
    print(comb_sum - (c[a] - 1))

Measured memory_bytes: 26772
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<stdio.h>
#include<vector>
#define rep(i,n)for(int i=0;i<n;i++)
//printf("%.yf\n",x); xを小数点以下y桁で
using namespace std;
int main() {
    int a, b,c;
    cin >> a >> b >> c;
    if (a == b&&b == c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,c=0;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>=k)
            c++;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 640
N, M = map(int, input().split())

i_like_these = input().split()
everyone_likes_these = set(i_like_these[1::])
for n in range(N-1):
    n_likes_these = input().split()
    n_likes_these = n_likes_these[1::]
    everyone_likes_these &= set(n_likes_these)

print(len(everyone_likes_these))

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

int main() {
    int a, b, m, i;
    int minref = INT_MAX, minren = minref;
    cin >> a >> b >> m;
    int ref[a], ren[b];
    for(i = 0; i < a; i++){
        cin >> ref[i];
        minref = min(ref[i], minref);
    }
    for(i = 0; i < b; i++){
        cin >> ren[i];
        minren = min(ren[i], minren);
    }
    int ans = minref + minren;
    for(i = 0; i < m; i++){
        int wa, wb, pri;
        cin >> wa >> wb >> pri;
        ans = min(ans, ref[wa - 1]+ren[wb - 1]-pri);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
import math

a, b, x = map(int, input().split())

if x < a * a * b / 2:
    h = 2 * x / (a * b)
    deg = math.degrees(math.atan(b / h))
else:
    h = 2 * (a * a * b - x) / (a * a)
    deg = math.degrees(math.atan(h / a))

print(deg)


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

int main(){
    int N;
    cin>>N;
    cout<<N*(N+1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	const clock_t begin_time = clock();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	vector<ll> a(1000,0);
  	a[4]=1;
  a[7]=1;
  for(i=8;i<1000;i++)
  {
   if(a[i-4]==1 or a[i-7]==1)
   {
    a[i]=1; 
   }
  }
  cin>>n;
  if(a[n]==1)
  {
   cout<<"Yes"<<endl; 
  }
  else
  {
   cout<<"No"<<endl; 
  }
      
      
      
	//cout << float( clock () - begin_time ) /  CLOCKS_PER_SEC<<endl;
	return 0;
}  	

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for xx in range(a+1):
    A = 500*xx
    for y in range(b+1):
        B = 100*y
        for z in range(c+1):
            C = 50*z
            if x == A+B+C:
                ans += 1
            else:
                continue


print(ans)

Measured memory_bytes: 3064
import java.util.*;

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

		double x1 = scanner.nextDouble();
		double x2 = scanner.nextDouble();
		double y1 = scanner.nextDouble();
		double y2 = scanner.nextDouble();

		System.out.println(Math.sqrt(Math.pow(y1 - x1, 2) + Math.pow(y2 - x2, 2)));
    }
}


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

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define INF (int)1e9
typedef long long int int64;

void print() {
    cout << endl;
}

void print(const char* s, bool endline = true) {
    cout << s;
    if (endline) print();
}

void print(char s, bool endline = true) {
    cout << s;
    if (endline) print();
}

void print(string s, bool endline = true) {
    cout << s;
    if (endline) print();
}

void print(int64 s, bool endline = true) {
    cout << s;
    if (endline) print();
}

void print(int s, bool endline = true) {
    cout << s;
    if (endline) print();
}

template <typename T, typename T2>
void print(pair<T, T2>& p, bool endline = true) {
    cout << "(";
    print(p.first, false);
    cout << ", ";
    print(p.second, false);
    cout << ")";

    if (endline) print();
}

template <typename T>
void print(T& t, bool endline = true) {
    cout << "[";
    for (auto it = t.begin(); it != t.end(); ++it) {
        if (it != t.begin()) cout << ", ";
        print(*it, false);
    }
    cout << "]";

    if(endline) print();
}

template <typename T>
vector<T> operator+(const vector<T> &a, const vector<T> &b)
{
    vector<T> ret;
    ret.reserve( a.size() + b.size() );                // preallocate memory
    ret.insert( ret.end(), a.begin(), a.end() );        // add A;
    ret.insert( ret.end(), b.begin(), b.end() );        // add B;

    return ret;
}

template <typename T>
vector<T> &operator+=(vector<T> &a, const vector<T> &b)
{
    a.reserve( a.size() + b.size() );                // preallocate memory without erase original data
    a.insert( a.end(), b.begin(), b.end() );         // add B;
    return a;
}

bool c(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    return (a.first + a.second > b.first + b.second); 
}

int main() {
    // g++ -Wall -Wextra -O2 -std=c++17 helloworld.cpp
    int n, k;
    cin >> n >> k;

    string s;
    cin >> s;

    int count = 0;
    int ret = 0;

    char prev = s[0];
    int cur = 0;

    for(int i = 0; i < n; ++i) {
        if((i < n - 1) and (((s[i] == 'L' and s[i + 1] == 'R') or (s[i] == 'R' and s[i + 1] == 'L')))) {
            count++;
        }

        if(s[i] == prev) {
            cur++;
        } else {
            ret += cur - 1;
            cur = 1;
            prev = s[i];
        }
    }

    ret += cur - 1;
    ret += min(k * 2, count);

    print(ret);

    return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define mp(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INFLL=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void solve(){
    string a,b;
    cin >> a >> b;
    
    static int dp[1001][1001];
    fill_n((int*)dp,1001*1001,INF);

    rep(i,0,a.size()+1) dp[i][0]=i;
    rep(j,0,b.size()+1) dp[0][j]=j;

    rep(i,1,a.size()+1){
        rep(j,1,b.size()+1){
            int cost=!(a[i-1]==b[j-1]);
            dp[i][j]=min({dp[i-1][j]+1,dp[i][j-1]+1,dp[i-1][j-1]+cost});
        }
    }
    
    cout << dp[a.size()][b.size()] << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 5104
import math
Q = int(input())

def sosuu(x):
  if x == 1:
    return False
  else:
    for i in range(1,int(math.sqrt(x))):
      if x % (i+1) == 0:
        return False
    return True

table=[0]*100001
for i in range(1,100001):
  if i%2==1 and sosuu(int((i+1)/2)) and sosuu(i):
    table[i]=table[i-1] + 1
  else:
    table[i]=table[i-1]
#print(table[0:10])
ans=[0]*Q
for i in range(Q):
  l,r=map(int,input().split())
  ans[i]=table[r] - table[l-1]
  
for i in range(Q):
  print(ans[i])



Measured memory_bytes: 8624
#include <algorithm>
// #include <cassert>
#include <cctype>
// #include <cmath>
#include <cstdio>
// #include <cstdlib>
#include <cstring>
// #include <ctime>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define fir first
#define sec second
#define pb push_back
#define pch putchar
#define rg register
#define SZ(_) (int)_.size()
#define SORT(_) std::sort(_.begin(), _.end())
#define LB(_, __) std::lower_bound(_.begin(), _.end(), __)
#define UB(_, __) std::upper_bound(_.begin(), _.end(), __)

typedef long long LL;
typedef std::pair<int, int> Pii;
typedef std::pair<LL, int> Pli;
typedef std::pair<int, LL> Pil;
typedef std::pair<LL, LL> Pll;
typedef std::vector<int> Vi;
typedef std::vector<LL> Vl;
typedef std::map<int, int> Mii;
typedef std::map<LL, int> Mli;
typedef std::map<int, LL> Mil;
typedef std::map<LL, LL> Mll;
typedef std::set<int> Si;
typedef std::set<LL> Sl;

const int kInf = 0x3f3f3f3f, kMod = 1e9 + 7;
const LL kInf64 = 0x3f3f3f3f3f3f3f3f;

template <typename T> inline
void UMin(T & x, const T & y) { if (x > y) x = y; }
template <typename T> inline
void UMax(T & x, const T & y) { if (x < y) x = y; }
inline int Add(int a, int b) { return (a += b) >= kMod ? a - kMod : a; }
inline int Sub(int a, int b) { return (a -= b) < 0 ? a + kMod : a; }
inline int Mul(int a, int b) { return 1ll * a * b % kMod; }
int FPow(int bs, int ex = kMod - 2) {
	int res = 1;
	for (; ex; bs = Mul(bs, bs), ex >>= 1)
		if (ex & 1) res = Mul(res, bs);
	return res;
}

int n;
char M[205];
int A[205][205], col[205];

void Dfs(int u);

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%s", M);
		for (int j = 0; j < n; ++j) {
			A[i][j] = M[j] == '1' ? 1 : kInf;
		}
	}
	memset(col, 0xff, sizeof col);
	col[1] = 1;
	Dfs(1);
	for (int i = 0; i < n; ++i) A[i][i] = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			for (int k = 0; k < n; ++k)
				UMin(A[j][k], A[j][i] + A[i][k]);
		}
	} int ans = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j)
			UMax(ans, A[i][j]);
	} printf("%d\n", ans + 1);
	return 0;
}

void Dfs(int u) {
	for (int i = 0; i < n; ++i) {
		if (A[u][i] == kInf) continue;
		if (~col[i]) {
			if (col[i] == col[u]) {
				puts("-1");
				exit(0);
			}
		} else {
			col[i] = col[u] ^ 1;
			Dfs(i);
		}
	}
}

Measured memory_bytes: 384
A=[]
flag=0
for i in range(3):
  A.append(list(map(int,input().split())))
n=int(input())
for i in range(n):
  s=int(input())
  for k in range(3):
    if s in A[k]:
      A[k][A[k].index(s)]=0

if A[0]==[0,0,0] or A[1]==[0,0,0] or A[2]==[0,0,0]:
  print("Yes")
  flag=1
elif A[1][1]==0 and A[2][2]==0 and A[0][0]==0:
  print("Yes")
  flag=1
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  flag=1
else:
  for i in range(3):
    if A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
      print("Yes")
      flag=1
      break
if flag == 0:
  print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  char h[8];
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<8;j++){
      cin>>h[j];
    }
    int hiku=0;
    int tasu=0;
    sort(h,h+8);
    int jou=1;
    for(int j=0;j<8;j++){
      tasu+=(h[j]-'0')*jou;
      jou=jou*10;
    }
    sort(h,h+8,greater<int>());
    jou=1;
    for(int j=0;j<8;j++){
      hiku+=(h[j]-'0')*jou;
      jou=jou*10;
    }
    cout<<tasu-hiku<<endl;
  }
}
    

Measured memory_bytes: 1180
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e12;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

ll N, K;

bool done[100100][2];
bool dp[100100][2];
ll a[100100];

bool solve(ll k, ll p){
    if(done[k][p] == true) return dp[k][p];
    if(k <= 0) {
        return false;
    }
    bool flag = false;
    REP(i, N){
        if(k-a[i] < 0) continue;
        if(!solve(k-a[i], 1-p)){
            flag = true; break;
        }
    }
    done[k][p] = true;
    dp[k][p] = flag;
    return flag;
}

int main(){
    cin >> N >> K;
    REP(i, N){
        cin >> a[i];
    }
    REP(i, 100100){
        done[i][0] = false;
        done[i][1] = false;
        dp[i][0] = false;
        dp[i][1] = false;
    }
    solve(K, 0);
    cout << (dp[K][0] ? "First" : "Second") << endl;
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    int arr[n];
   int counter=0;
    for(int i =1;i<=n;i++)
    {
        cin>>arr[i];
    }
    for(int i =0;i<=n;i++)
    {
      if(arr[i]%2!=0&&i%2!=0)
        counter++;
    }
    cout<<counter;
    return 0;
}


Measured memory_bytes: 3520