akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

	int M, N;
	cin >> N >> M;
	multiset<int> A;
	int all = 0;
	for (int i = 0; i < N; i++) {
		int p;
		cin >> p;
		all += p;
		A.insert(p);
	}
	double t = (double)all / (4.0 * (double)M);

	int count = 0;
	for (auto it = A.begin(); it != A.end(); it++) {
		if (*it >= t) {
			count++;
		}
	}
	if (count >= M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N,X;cin>>N>>X;
    vector<int> m(N);
    REP(i, N) cin >> m[i];
    sort(All(m));
    int ans=0;
    REP(i,N){
        X-=m[i];
        ans++;
    }
    while(X-m[0]>=0){
        X-=m[0];
        ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int odd_cnt = 0;
    int even_cnt = 0;
    REP(i, n) {
        int a;
        cin >> a;
        if(a % 2 == 0) even_cnt = 1;
        else odd_cnt++;
    }
    
    if(odd_cnt > 1) { 
        even_cnt = 1;
        odd_cnt = odd_cnt % 2 == 0 ? 0 : 1;
    }

    cout << (even_cnt + odd_cnt == 1 ? "YES" : "NO") << endl;
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> V(N),W(N);
    for (int i=0 ; i<N ; i++)
        cin >> V.at(i);
    W=V;
    sort(W.begin(), W.end());
    int A=0;
    for (int i=0 ; i<N ; i++){
        if (V.at(i)==W.at(i))
        A++;
    }
    if (A==N||A==N-2)
    cout << "YES" << endl;
    else
    cout << "NO" << endl;
}

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

#define fast                     \
    ios::sync_with_stdio(false); \
    cin.tie(NULL);               \
    cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e3 + 77;

int32_t main()
{
    fast;
    int n;
    cin >> n;
    int ans = 0, a = 0, b = 0, c = 0;
    for (int i = 0; i < n; ++i)
    {
        string s;
        cin >> s;
        int l = s.length();
        for(int j = 0 ;j < l-1 ; ++j) if(s[j]=='A' && s[j+1]=='B') ans++;
        if(s[0]=='B' && s[l-1]=='A') a++;
        else if(s[0]=='B') b++;
        else if(s[l-1]=='A') c++;
    }
    ans += min(b,c);
    if(b+c>0) ans += a;
    else ans += max(a-1,0ll);
    cout << ans << endl;
    return 0;
}

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

int N;


int main(){
	cin>>N;
	for(int i=1;i<10;i++){
		if(N%i==0 && N/i<=9){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1e9;
using namespace std;

signed main() {
    double a,b,x; cin >> a >> b >> x;
    double ans;
    if(a*a*b/2.0 <= x) {
        ans = atan(2*(a*a*b-x)/(a*a*a));
    } else {
        ans = atan(a*b*b/(2*x));
    }
    ans = ans*180.0/M_PI; 
    cout << fixed << setprecision(8) << ans << endl;
}

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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  unsigned int ca = 0, cb = 0, cc = 0;
  char turn = 'a';
  bool next = true;
  while (next) {
    switch (turn) {
      case 'a':
        if (ca == a.size()) {
          next = false;
          break;
        }
        turn = a[ca];
        ca++;
        break;
      case 'b':
        if (cb == b.size()) {
          next = false;
          break;
        }
        turn = b[cb];
        cb++;
        break;
      case 'c':
        if (cc == c.size()) {
          next = false;
          break;
        }
        turn = c[cc];
        cc++;
        break;
    }
  }

  cout << char(turn - 'a' + 'A') << endl;

  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,i;
string s,t;
cin>>s;
cin>>t;
a=s.size();
long long c=0;
for(i=0;i<=a;i++){
    if(s[i] != t[i])
        c++;}
    cout<<c<<endl;

return 0;}


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

typedef long long LL;
const int M=1e5+5;
int a[M];
int n;

LL cnt(int v)
{
	LL ans=0;
	for(int i=n-1;i>=0;i--)
	{
		int p=lower_bound(a,a+n,v-a[i])-a;
		if(p>=n) return ans;
		ans+=n-p;
	}
	return ans;
}

LL psum[M];
LL sum(int v)
{
	for(int i=n-1;i>=0;i--)
		psum[i]=psum[i+1]+a[i];
	LL ans=0;
	for(int i=n-1;i>=0;i--)
	{
		int p=lower_bound(a,a+n,v-a[i])-a;
		if(p>=n) return ans;
		ans+=psum[p]+((LL)n-p)*a[i];
	}
	return ans;
}

int main()
{	
	LL m;
	scanf("%d%lld",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	int l=0,r=M*2;
	int mid,ans=0;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(cnt(mid)>=m)
		{
			ans=max(ans,mid);
			l=mid+1;
		}
		else
			r=mid-1;
	}
	printf("%lld\n",sum(ans)-(cnt(ans)-m)*ans);
	return 0;
}

Measured memory_bytes: 1408
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int bm = 100001;
ll BIT[bm];
void add(int A, ll B) {
	while (A > 0) {
		BIT[A] = min(BIT[A], B);
		A -= A & -A;
	}
}
ll query(int A) {
	ll kotae = 1e18;
	while (A < bm) {
		kotae = min(BIT[A], kotae);
		A += A & -A;
	}
	return kotae;
}

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


	int N = getint(), M = getint();

	int L[100000], R[100000], C[100000], L2[100000], R2[100000], C2[100000];
	int kazu[100001] = {};
	rep(i, M) {
		L[i] = getint();
		R[i] = getint();
		C[i] = getint();
		kazu[L[i]]++;
	}
	rep1(i, N - 1) kazu[i + 1] += kazu[i];
	rep(i, M) {
		int k = --kazu[L[i]];
		L2[k] = L[i];
		R2[k] = R[i];
		C2[k] = C[i];
	}

	rep(i, bm) BIT[i] = 1e18;
	add(1, 0);
	rep(i, M) {
		ll k = query(L2[i]);
		add(R2[i], k + C2[i]);
	}
	if (query(N) == 1e18) printf("-1");
	else printf("%lld", query(N));

	Would you please return 0;
}

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

#define INF INT_MAX
#define N 101
#define W 1000000009
#define V 100002

using namespace std;

int n, w;
int weight[N];
int value[N];
int dp[N][V];
int solve(int idx, int v){
    if(idx == n && v == 0)
        return 0;
    if(idx == n || v < 0)
        return W;
    if(~dp[idx][v])
        return dp[idx][v];
    int take = solve(idx+1, v-value[idx]) + weight[idx];
    int leave = solve(idx+1, v);
    return dp[idx][v] = min(take,leave);
}
int main()
{
    scanf("%d %d", &n, &w);
    for(int i=0; i<n; ++i)
        scanf("%d %d", &weight[i], &value[i]);
    memset(dp, -1, sizeof(dp));
    for(int i = V-1;  i>=1; --i){
        // int res = solve(0, i);
        // cout << res << endl;
        // if(res <= w){
        if(solve(0, i) <= w){
            // cout << i;
            printf("%d", i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 39680
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) (x.begin(),x.end())
#include<math.h>
using namespace std;

int main()
{
    int a;
    cin>>a;
    char b[100];
    scanf("%s",b);
    if(a<3200)
    {
        printf("red\n");
    }
    else
    {
        printf("%s\n",b);
    }
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 a, b;
int main() {
  cin >> a >> b;
  cout << max({ a + b, a - b, a * b }) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
// 11

using namespace std;



int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int n, a, b;
    ios::sync_with_stdio(false);
    cin >> n >> a >> b;
    if(b < a)
        swap(a, b);
    if((b - a) % 2 == 0)
        cout << "Alice";
    else
        cout << "Borys";
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#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(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

void solve() {
  int n; cin >> n;
  vi arr(n);
  rep(i,n) cin >> arr[i];

  int ans = arr[0];
  rep1(i,n) {
    int a = arr[i], b = ans, c = a % b;
    while (c != 0) {
      a = b;
      b = c;
      c = a % b;
    }
    ans = b;
  }

  cout << ans << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>


int main(){

 long long int N;
  scanf("%lld",&N);

/*
  char A[];
  scanf("%s",A);
  */

  /*
  long long int A[N+1];
  long long int i;
  for(i=1;i<=N;i++){
   scanf("%lld",&A[i]);
   }
  */
if(N%10 == 3){
  printf("bon");
}

else if(N%10 == 0 || N%10 == 1 ||N%10 ==6||N%10 == 8 ){
  printf("pon");
}

else{
  printf("hon");
}





 return(0);
 }


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

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

bool read(ll i){
	cout<<i<<endl;
    string str;
    cin>>str;
    if(str=="Vacant") {
		exit(0);
		return false;
	}
    else if(str=="Male") return false;
    else return true;
}

int main(){
	cin.sync_with_stdio(false);
	ll n; cin>>n;
    ll l = 0;
    ll r = (n+1)/2;
    bool lW = read(l);
    bool rW = read(r);
	if((lW==rW)!=((r-l+1)%2==0)){
        r = n;
        l = (n+1)/2;
        swap(lW,rW);
	}

    while(true){
        ll mid = (r+l+1)/2;
        ll mW = read(mid);
        if((mW==lW)==((mid-l+1)%2==0)){
            r = mid;
            rW = mW;
        } else {
			l = mid;
			lW = mW;
        }
    }

}


Measured memory_bytes: 852
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
ll dp[8][1005][1005]={0};
ll dat[1005][3]={0};
int main(){
  ll n,m;
  cin>>n>>m;
  for(int i=0;i<8;i++){
    for(int j=0;j<1005;j++){
      for(int k=0;k<1005;k++) dp[i][j][k]=-1744174417441744;
    }
  }
  for(int i=0;i<8;i++) dp[i][0][0]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++) cin>>dat[i][j];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=m;j++){
      for(int b=0;b<8;b++){
        ll val=0;
        for(int k=0;k<3;k++){
          if(((b>>k)&1)==1) val+=dat[i][k];
          else val-=dat[i][k];
        }
        dp[b][i+1][j]=max(dp[b][i][j],dp[b][i+1][j]);
        dp[b][i+1][j+1]=max(dp[b][i][j]+val,dp[b][i+1][j+1]);
      }
    }
  }
  ll ans=-1744174417441744;
  for(int i=0;i<8;i++){
    ans=max(ans,dp[i][n][m]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 63360
use strict;
use warnings;

my $str = <>;
chomp $str;
my @arr = split //, $str;
my ($n, $w, $s, $e) = (0, 0, 0, 0);
for(my $i = 0; $i <= $#arr; $i++) {
       	if($arr[$i] eq 'N') {
       		$n = 1;
       	} elsif($arr[$i] eq 'W') {
       		$w = 1;
       	} elsif($arr[$i] eq 'S') {
       		$s = 1;
       	} elsif($arr[$i] eq 'E') {
       		$e = 1;
       	}
}
$n -= $s;
$w -= $e;
if(($n == 0)&&($w == 0)) {
       	print "Yes\n";
} else {
       	print "No\n";
}

exit;

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

int main(){
    int N,T;
    cin >> N >> T;

    int m = 1500;
    for(int i=0;i<N;i++){
        int c,t;
        cin >> c >> t;
        if(t<=T){
            m = min(m,c);
        }
    }
    if(m>1000) cout << "TLE" << endl;
    else cout << m << endl;
}

Measured memory_bytes: 256
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let numbers: Vec<i32> = read_vec();
    let mut result: i32 = 0;

    if (numbers[0] >= 10 || numbers[1] >= 10)
    {
      println!("-1");
      return;
    }

    println!("{}", numbers[0] * numbers[1]);
}

Measured memory_bytes: 4352
import sys
s = input()
k = int(input())
k = min(k,len(s))
i = 0
f = 0
while i < k:
  if int(s[i]) != 1:
    print(s[i])
    f = 1
    sys.exit()
  i += 1
if f == 0:
  print(1)

Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int mod=1000000007;
const int N=3005;
int n,m,f[N][N][2];
inline void up(int &x,int y) {x+=y;if(x>=mod) x-=mod;}
int main( )
{
  int i,j,k,x;
  n=read( );m=read( );
  for(i=0;i<=n;i++) f[0][i][0]=1;
  for(i=0;i<m;i++)
    for(j=0;j<=n;j++)
      for(k=0;k<=1;k++)
	if(x=f[i][j][k])
	  {
	    if(j!=n) up(f[i+1][j+1][k|(!j)],x),up(f[i+1][j][k|(!j)],x);
	    if(j) up(f[i+1][j-1][k|(j==1)],x),up(f[i+1][j][k|(j==1)],x);
	  }
  int ans=0;
  for(i=0;i<=n;i++) up(ans,f[m][i][1]);
  printf("%d",ans);
  return 0;
}
	      
	   


Measured memory_bytes: 70656
s = input()
x, y = map(int, input().split())
edge = [[], []]
# delete first edge
firstedge = 0
for c in s:
    if c == 'T': break
    else: firstedge += 1
x -= firstedge
dir = 0
cur = 0
for c in s[firstedge:]:
    if c == 'T':
        if cur > 0:
            edge[dir].append(cur)
            cur = 0
        dir = (dir + 1) % 2
    else:
        cur += 1
if cur > 0:
    edge[dir].append(cur)
xtar = sum(edge[0]) + x
ytar = sum(edge[1]) + y
if xtar < 0 or ytar < 0 or x > sum(edge[0]) or y > sum(edge[1]):
    print('No')
    exit()
# partition dp
dx = [0] * (xtar + 1)
dy = [0] * (ytar + 1)
dx[0], dy[0] = 1, 1
for e in edge[0]:
    preone = []
    for i in range(xtar+1 - 2*e):
        if dx[i] == 1:
            preone.append(i)
    for i in preone:
        dx[i+2*e] = 1
    if dx[xtar]: break
for e in edge[1]:
    preone = []
    for i in range(ytar+1 - 2*e):
        if dy[i] == 1:
            preone.append(i)
    for i in preone:
        dy[i+2*e] = 1
    if dy[ytar]: break
if dx[xtar] and dy[ytar]: print('Yes')
else: print('No')

Measured memory_bytes: 44140
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int n;
	cin >> n;
	V<P<int>> p(n);
	V<int> r(n);
	double all = 1.0;
	REP(i, n) {
		cin >> p[i].first >> p[i].second;
		r[i] = i;
		all *= i + 1.0;
	}
	auto d = [](P<int> a, P<int> b){return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); };

	double ans = 0.0;
	do {
		double d0 = 0.0;
		REP(i, n - 1) {
			d0 += d(p[r[i]], p[r[i + 1]]);
		}
		ans += d0 / all;
	} while (next_permutation(ALL(r)));

	col(ans);
	return 0;
}

Measured memory_bytes: 3780
//#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>
#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)); }


int
main(void){  
  string o, e;
  cin >> o >> e;

  int len = 0;
  
  if(o.size() > e.size()) len = e.size();
  else len = o.size();

  int itr = 0;
  REP(i, len) {
    cout << o[i] << e[i];
    itr = i;
  }
  if(o.size() > e.size()) cout << o[itr+1] << endl;
  else if(e.size() > o.size()) cout << e[itr+1] << endl;
  else cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

int main() {
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    double ans = ceil((double)(n-1)/(k-1));
    cout << ans << endl;
}

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

using namespace std;
#define ll long long int


int main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int cnt=0;
    while(1){

        if(cnt%2==0){
            c-=b;
            if(c<=0){
                cout << "Yes" << endl;
                return 0;
            }
        }
        else{
            a-=d;
            if(a<=0){
                cout << "No" << endl;
                return 0;
            }
        }
        cnt++;

    }
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define COUT(x) cout<<x<<endl

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

//constant
//--------------------------------------------
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
const ULL INF= 1e20;

//function
//--------------------------------------------
LL gcd(LL, LL);
bool isEven(LL);

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d))COUT("Yes");
	else COUT("No");
	return 0;
}

LL gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}
bool isEven(LL a) {
	return !((bool)(a % 2));
}

Measured memory_bytes: 256
from itertools import permutations

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N, Q = mi()
    S = input()
    lr = [map(int, input().split()) for _ in range(Q)]
    l, r = [list(i) for i in zip(*lr)]

    dp = [0]*(N+1)
    for i in range(N):
        if S[i-1:i+1] == 'AC':
            dp[i+1] = dp[i] + 1
        else:
            dp[i+1] = dp[i]

    for i in range(Q):
        ans = dp[r[i]]-dp[l[i]]
        print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 91096
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001
#define PI 3.141592653589793

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> A(h);
    queue<pair<int, int>> q;
    vector<vector<ll>> d(h,vector<ll>(w,INF));
    rep(i,h) cin >> A[i];
    rep(i,h)rep(j,w){
        if(A[i][j] == '#'){
            q.push({i,j});
            d[i][j] = 0;
        }
    }
    while(!q.empty()){
        int now_y = q.front().first;
        int now_x = q.front().second;
        q.pop();
        for(int i = 0; i < 4; i++){
            int new_y = now_y + dy[i];
            int new_x = now_x + dx[i];
            if(new_y < 0 || h <= new_y || new_x < 0 || w <= new_x) continue;
            if(A[new_y][new_x] == '#') continue;
            else if(d[new_y][new_x] > d[now_y][now_x] + 1){
                d[new_y][new_x] = d[now_y][now_x] + 1;
                q.push({new_y,new_x});
            }
        }
    }
    ll ans = 0;
    rep(i,h)rep(j,w){
        ans = max(ans, d[i][j]);
    }
    cout << ans << endl;
} 

Measured memory_bytes: 20944
#include <bits/stdc++.h>
using namespace std;
int main() {
 	long long n, ans = 0, cnt = 1; cin >> n;
  	while (n) {
     	 ans += cnt;
      	 n >>= 1;
      	 cnt <<= 1;
    }
  	cout << ans << endl;
}

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

int main() {
  int W, H, N, x, y, a;
  scanf("%d %d %d", &W, &H, &N);
  int xmin = 0;
  int xmax = W;
  int ymin = 0;
  int ymax = H;
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d", &x, &y, &a);
    if (a == 1) xmin = max(xmin,x);
    else if (a == 2) xmax = min(xmax,x);
    else if (a == 3) ymin = max(ymin,y);
    else if (a == 4) ymax = min(ymax,y);
    if(xmax<=xmin || ymax<=ymin) {
      printf("%d\n",0);
      return 0;
    }
  }
  printf("%d\n",(xmax-xmin)*(ymax-ymin));
}

Measured memory_bytes: 256
import numpy as np
import sys

stdin = sys.stdin
 
sn = lambda : stdin.readline().rstrip()
an = lambda : map(int, stdin.readline().split())
ni = lambda : int(sn())

N = ni()
ABC = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for i in range(3)] for j in range(N+1)]

def chmax(a, b):
    if a > b:
        return a
    else:
        return b

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = chmax(dp[i+1][k], dp[i][j] + ABC[i][k])

ans = 0
for i in range(3):
    ans = max(ans,dp[N][i])

print(ans)

Measured memory_bytes: 56524
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

bool board[4][4];

int x[111],y[111];

int main(void){
	int n,i,j,a;
	fill(x,x+111,3);
	fill(y,y+111,3);
	for(i=0; i<3; ++i){
		for(j=0; j<3; ++j){
			cin >> a;
			x[a] = i; y[a] = j;
		}
	}
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		board[x[a]][y[a]] = true;
	}
	for(i=0; i<3; ++i){
		if(board[i][0]&&board[i][1]&&board[i][2]){
			cout << "Yes" << endl;
			return 0;
		}
		if(board[0][i]&&board[1][i]&&board[2][i]){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << (((board[0][0]&&board[1][1]&&board[2][2])||board[2][0]&&board[1][1]&&board[2][0])?"Yes":"No") << endl;
	return 0;
}


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

int main()
{
	int d;
	while(cin>>d)
	{
		//d=?¨?????????????e=????????¢????????°
		int e = 600 / d;
		int x = 0;
		for (int i = 0; i < e; i++) {
			x += d*i*d*d*i;
		}
		cout << x<<endl;
	}
	return 0;
}

Measured memory_bytes: 2968
import java.util.*;

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

        String s = sc.next();
        String t = sc.next();

        char[] cs = new char[s.length() + 1];
        for (int i=0; i<s.length(); i++) {
            cs[i] = s.charAt(i);
        }
        cs[s.length()] = 200;
        Arrays.sort(cs);
        cs[s.length()] = 0;

        char[] ts = new char[t.length() + 1];
        for (int i=0; i<t.length(); i++) {
            ts[i] = t.charAt(i);
        }
        Arrays.sort(ts);

        for (int i=0; i<s.length() + 1; i++) {
            if (cs[i] < ts[t.length() - i]) {
                System.out.println("Yes");
                return;
            } else if (cs[i] == ts[t.length() -i]) {
                continue;
            } else {
                System.out.println("No");
                return;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 21972
import java.io.*;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		
		String sz_input = br.readLine();
		String[] sz_number = sz_input.split(" ");
		
		for (int i = n-1; i>=0; i--) {
			System.out.print(sz_number[i]);
			if (i > 0) {
				System.out.print(" ");
			}
		}
		
		System.out.println();
	}
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;
const int MAX_N = 100000;
const int INF = 1000000;

int n, k;
int h[MAX_N + 102];
int dp[MAX_N + 102];

int dprec(int i){
  int res;
  if(dp[i] != -1){
      return dp[i];
      }
     if(i < k){
        res = 0;
      }else{
        res = dprec(i - 1) + abs(h[i] - h[i - 1]);
          if(k >= 2){
              FOR(j, 2, k+1){
                  res = min(res, dprec(i - j) + abs(h[i] - h[i - j])
            );
              }
          }
        }
      return dp[i] = res;
  }
void solve(){
    memset(dp, -1, sizeof(dp));
    cout << dprec(n + k - 1) << endl;
  }

int main(){
  cin >> n >> k;
  REP(c, n){
      cin >> h[c + k];
    }
    REP(p, k) h[p] = h[k];
    solve();
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, n) for (int i = (int)(n-1); i >= 0; i--)
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i, N)cin >> H[i];
    for (int i = N - 2; i >= 0;--i) {
        if (H[i + 1]+1 == H[i])H[i]--;
        else if (H[i] <= H[i + 1])continue;
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3

n = int(input())

dict_ = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

for _ in range(n):
    s = str(input())
    dict_[s] += 1


print("AC x {}".format(dict_["AC"]))
print("WA x {}".format(dict_["WA"]))
print("TLE x {}".format(dict_["TLE"]))
print("RE x {}".format(dict_["RE"]))


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i=0; i<N; i++) cin >> X[i];
    sort(X.begin(), X.end());

    int ans = 1000000;
    for(int P=X.front(); P<=X.back(); P++) {
        int cost = 0;
        for(int i=0; i<N; i++) {
            cost += (X[i]-P) * (X[i]-P);
        }
        if(cost < ans) {
            ans = cost;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int r[n];
  for(int i=0;i<n;i++) cin>>r[i];
  int s[n][3];
  for(int i=0;i<n;i++)
    for(int j=0;j<3;j++)
      cin>>s[i][j];
  int ans=1000;
  for(int j=0;j<3;j++){
    for(int k=1;k<100;k++){
      s[0][j]+=k;
      int sc[n];
      memset(sc,0,sizeof(sc));
      for(int l=0;l<3;l++){
	vector<int> v[1001];
	for(int i=0;i<n;i++)
	  v[s[i][l]].push_back(i);
	
	int ra=0;
	for(int i=1000;i>0;i--){
	  if(v[i].empty()) continue;
	  for(int x=0;x<(int)v[i].size();x++){
	    sc[v[i][x]]+=r[ra];
	  }
	  ra+=v[i].size();
	}
      }
      int ra[1001];
      memset(ra,0,sizeof(ra));
      for(int i=0;i<n;i++){
	ra[sc[i]]++;
      }
      int ran=0;
      for(int i=1000;i>sc[0];i--) ran+=ra[i];
      if(ran<8){
	ans=min(ans,k);
      }
      s[0][j]-=k;
    }
  }
  if(ans<1000) cout<<ans<<endl;
  else cout<<"Saiko"<<endl;
  return 0;
}

Measured memory_bytes: 3112
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n, k = readmi()
d = [0] * n
for i in range(k):
    t = readi()
    p = readl()
    for j in p:
        d[j - 1] = 1

print(n - sum(d))

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

using namespace std;
typedef long long ll;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=3e5+9;
int ok=0,ok1=0;
string s;
int main(){
    cin>>s;
    int x=(s[0]-'0')*10+s[1]-'0';
    int y=(s[2]-'0')*10+s[3]-'0';
    if(x<=12&&x>=1)ok=1;
    if(y<=12&&y>=1)ok1=1;
    if(ok&&ok1)puts("AMBIGUOUS");
    else if(ok)puts("MMYY");
    else if(ok1)puts("YYMM");
    else puts("NA");
}


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

using namespace std;

int n, m;
int A[15], B[15];

int check(int sbit)
{
    int C[15];
	
	for (int i = 0; i < n; i++){
	    C[i] = A[i];
	}
	
	int ans = 0;
	int h = 0;
	for (int i = 0; i < m; i++){
	    for (int j = 0; j < B[i]; j++){
	        if (C[h] != ((sbit + i) & 1)){
	            bool ok = false;
	            for (int k = h + 1; k < n; k++){
	                if (C[k] == ((sbit + i) & 1)){
	                    ok = true;
	                    ans += k - h;
	                    for (int l = k; l >= h + 1; l--){
	                        int tmp = C[l];
	                        C[l] = C[l - 1];
	                        C[l - 1] = tmp;
	                    }
	                    break;
	                }
	            }
	            if (!ok) return (9999);
	        }
	        h++;
	    }
	}
	
	return (ans);
}

int main()
{
	scanf("%d %d", &n, &m);
	
	for (int i = 0; i < n; i++) scanf("%d", A + i);
	
	for (int i = 0; i < m; i++) scanf("%d", B + i);
	
	int ans = 9999;
	
	ans = min(ans, check(0));
	ans = min(ans, check(1));
	
    printf("%d\n", ans);
    
    return (0);
}

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

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

    int left[300300] = {0}, right[300300] = {0};
    for (int i = 0; i < n; i++) {
        if (i == 0 && s[i] == 'W') {
            left[i]++;
            continue;
        }
        if (s[i] == 'W') left[i]++;
        left[i] += left[i - 1];
    }
    for (int i = n - 1; i >= 0; i--) {
        if (i == n - 1 && s[i] == 'E') {
            right[i]++;
            continue;
        }
        if (s[i] == 'E') right[i]++;
        right[i] += right[i + 1];
    }

    long long mn = 1e9;
    for (int i = 0; i < n; i++) {
        long long ans = 0;
        if (i == 0) {
            ans += right[i + 1];
        }
        else if (i == n - 1) {
            ans += left[i - 1];
        }
        else {
            ans += right[i + 1] + left[i - 1];
        }
        mn = min(mn, ans);
    }

    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 3076
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int p=sc.nextInt();
        String s=new StringBuffer(sc.next()).reverse().toString();
        long ans=0;
        if(p==2||p==5){
            for(int i=0;i<n;i++){
                if(Integer.parseInt(s.substring(i,i+1))%p==0){
                    ans+=n-i;
                }
            }
            System.out.println(ans);
            return;
        }
        int mod=1;
        int[] sum=new int[n+1];
        for(int i=0;i<n;i++){
            sum[i+1]=(sum[i]+Integer.parseInt(s.substring(i,i+1))*mod)%p;
            mod*=10;
            mod%=p;
        }
        Arrays.sort(sum);
        long count=1;
        for(int i=1;i<n+1;i++){
            if(sum[i-1]==sum[i])count++;
            else{
                ans+=count*(count-1)/2;
                count=1;
            }
        }
        ans+=count*(count-1)/2;
        System.out.println(ans);
        
        
 
    }



}


Measured memory_bytes: 37888
from collections import deque
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
l = IL()

ans = []
while l:
    for i in range(N-1,-1,-1):
        if l[i] == i+1:
            num = l.pop(i)
            ans.append(num)
            N -= 1
            break
    else:
        print(-1)
        exit()

for i in range(len(ans)-1,-1,-1):
    print(ans[i])

Measured memory_bytes: 12496
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N,A,B,C,D;cin>>N>>A>>B>>C>>D;
  string S;cin>>S;
  S='#'+S+'#';

  int tmp=0;
  REP(i,A,C){
    char c=S.at(i);
    if(c=='#'){
      tmp++;
    }
    else{
      tmp=0;
    }
    if(tmp==2){
      print("No");
      re 0;
    }
  }
  tmp=0;
  REP(i,B,D){
    char c=S.at(i);
    if(c=='#'){
      tmp++;
    }
    else{
      tmp=0;
    }
    if(tmp==2){
      print("No");
      re 0;
    }
  }
  if(C<D){
    print("Yes");
    re 0;
  }
  else{
    tmp=0;
    bool flg=false;
    REP(i,B,D+1){
      if(S.at(i-1)=='.'&&S.at(i)=='.'&&S.at(i+1)=='.')flg=true;
    }
    if(flg){
      print("Yes");
    }
    else {
      print("No");
    }
  }

}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int a[111111];
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n,ans=0,cnt=0;
  string s;
  cin>>n;
  for(int i=0;i<n;i++)
  {
  	long long x;
  	cin>>x;
	a[x]++;
  }
  for(int i=1;i<100000;i++)
  {
    cnt=a[i-1]+a[i]+a[i+1];
    ans=max(cnt,ans);
  }
  cout <<ans<<endl;
  return (0);
}

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

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

	vector<int> V(N), C(N);
	for (int i = 0; i < N; i++) {
		cin >> V.at(i);
	}
	for (int i = 0; i < N; i++) {
		cin >> C.at(i);
	}

	int ans=0;
	for (int i = 0; i < N; i++) {
		if (V.at(i) > C.at(i)) {
			ans += V.at(i) - C.at(i);
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())

t = [1] * 999
for i in range(1, 999):
    t[i] = t[i - 1] + (i + 1)
    if t[i - 1] - a > 0 and t[i - 1] - a == t[i] - b:
        print(t[i - 1] - a)
        break

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

int check(string s){
  if((int)s.find("iwi") == -1) return 0;
  for(int i = 0,j = (int)s.size()-1; i <= j; i++,j--){
    if(s[i] == '(') s[i] = ')';
    else if(s[i] == ')') s[i] = '(';
    else if(s[i] == '{') s[i] = '}';
    else if(s[i] == '}') s[i] = '{';
    else if(s[i] == '[') s[i] = ']';
    else if(s[i] == ']') s[i] = '[';
    if(s[i] != s[j]) return 0;
  }
  return (int)s.size();
}

int main(void){
  string s;
  cin >> s;
  int res = 0;
  for(int i = 0; i < 1<<(int)s.size(); i++){
    string t;
    for(int j = 0; j < (int)s.size(); j++){
      if(i & 1<<j) continue;
      t += s[j];
    }
    res = max(res,check(t));
  }
  cout << res << endl;
}

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

int len,n,temp;
int a[15],visited[15];

void change()
{
	int flag=1;
	for (int i=len;i>=1;i--)
	{
		if (a[i]!=9)
		{
			a[i]++;
			flag=0;
			for (int j=i+1;j<=len;j++)  a[j]=0;
			break;
		}
	}
	if (flag==0)  return;
	
	len++;
	a[1]=1;
	for (int i=2;i<=len;i++)  a[i]=0;
}

signed main()
{
	string s;
	cin>>s>>n;
	len=s.size();
	memset(visited,1,sizeof(visited));
	
	for (int i=1;i<=len;i++)  a[i]=s[i-1]-'0';
	for (int i=1;i<=n;i++)
	{
		cin>>temp;
		visited[temp]=0;
	}
	
	while (1)
	{
		int dog=1;
		for (int i=1;i<=len;i++)
		{
			if (visited[a[i]]==0)
			{
				dog=0;
				break;
			}
		}
		if (dog==1)  break;
		
		change();
	}
	for (int i=1;i<=len;i++)  cout<<a[i];
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

struct UF{
    const int node_num;
    vector<int> parent;
    vector<int> size;

    UF(int N) : node_num(N), parent(N), size(N, 1) {
        for(int i = 0; i < N; ++i) parent[i] = i;
    }

    //xの根を得る
    int root(int x){
        if(parent[x] == x) return x;
        return parent[x] = root(parent[x]);
    }

    //xが属する木とyが属する木を一つに合わせる
    void unite(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        if(root_x == root_y) return;
        parent[root_y] = root_x;
        size[root_x] += size[root_y];
    }

    //xとyが属する木が同じならtrueを返す
    bool same(int x, int y){
        int root_x = root(x);
        int root_y = root(y);
        return root_x == root_y;
    }

    //xと同じ木に属する要素の数を返す
    int same_size(int x){
        int root_x = root(x);
        return size[root_x];
    }
};

int main(){
    Stream io;
    
    string A, B, C;
    io.read(A, B, C);
    string ans = "NO";
    if(A.back() == B.front() && B.back() == C.front()){
        ans = "YES";
    }
    cout << ans;
    return 0;
}

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

int main() {
  int A, B, x, ans;
  cin >> A >> B;
  ans = 0;
  for(int i = 0; i < B - A + 1; i++){
    if( (A + i) / 10000 == (A + i) % 10 && (A + i) % 10000 / 1000 == (A + i) % 100 / 10 ){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
# frozen_string_literal: true
require 'set'

def array_to_puzzle(list)
  Array.new(9) { |i| list[i] << (i * 4) }.inject(:+)
end

def puzzle_point(puzzle, point)
  puzzle & (0xF << point)
end

def clear_point(puzzle, point_list)
  point_list.inject(puzzle) do |acc, point|
    acc & ~(0xF << point)
  end
end

def find_zero_point(puzzle)
  0.step(32, 4).find { |point| puzzle_point(puzzle, point).zero? }
end

checked_puzzles = Set.new
current_puzzles = Set.new

input_puzzle = array_to_puzzle(Array.new(3) { gets.split.map(&:to_i) }.flatten)
current_puzzles.add(input_puzzle)
count = 0

goal_puzzle = array_to_puzzle([1, 2, 3, 4, 5, 6, 7, 8, 0])

loop do
  next_puzzles = Set.new
  current_puzzles.each do |puzzle|
    if puzzle == goal_puzzle
      puts count
      exit
    end

    zero_point = find_zero_point(puzzle)
    y, x = (zero_point / 4).divmod(3)
    if x != 2
      next_puzzles.add(clear_point(puzzle, [zero_point, zero_point + 4]) |
                       (puzzle_point(puzzle, zero_point + 4) >> 4))
    end
    if x != 0
      next_puzzles.add(clear_point(puzzle, [zero_point, zero_point - 4]) |
                       (puzzle_point(puzzle, zero_point - 4) << 4))
    end
    if y != 2
      next_puzzles.add(clear_point(puzzle, [zero_point, zero_point + 12]) |
                       (puzzle_point(puzzle, zero_point + 12) >> 12))
    end
    if y != 0
      next_puzzles.add(clear_point(puzzle, [zero_point, zero_point - 12]) |
                       (puzzle_point(puzzle, zero_point - 12) << 12))
    end
  end
  checked_puzzles.merge(current_puzzles)
  current_puzzles = next_puzzles - checked_puzzles
  count += 1
end

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

int main() {
	long long int N, A, count = 1;
	cin >> N;
	for (long long int i = 1; i <= sqrt(N); i++) {
		if (N % i == 0) {
			A = N / i;
		}
	}
	while (A >= 10) {
		A /= 10;
		count++;
	}
	cout << count;
}

Measured memory_bytes: 256