akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

bool good = true;
char s[60][60];

void check(ll i, ll j, ll h, ll w){
  if(!good) return;
  //check corners
  if(i == 0 && j == 0)
    if(s[i+1][j] == '.' && s[i][j+1] == '.') good = false;
  if(i == 0 && j == w-1)
    if(s[i+1][j] == '.' && s[i][j-1] == '.') good = false;
  if(i == h-1 && j == 0)
    if(s[i-1][j] == '.' && s[i][j+1] == '.') good = false;
  if(i == h-1 && j == w-1)
    if(s[i-1][j] == '.' && s[i][j-1] == '.') good = false;

  //check sides
  if(i == 0 && j > 0 && j < w-1)
    if(s[i][j-1] == '.' && s[i][j+1] == '.' && s[i+1][j] == '.') good = false;
  if(i == h-1 && j > 0 && j < w-1)
    if(s[i][j-1] == '.' && s[i][j+1] == '.' && s[i-1][j] == '.') good = false;
  if(j == 0 && i > 0 && i < h-1)
    if(s[i+1][j] == '.' && s[i-1][j] == '.' && s[i][j+1] == '.') good = false;
  if(j == w-1 && i > 0 && i < h-1)
    if(s[i+1][j] == '.' && s[i-1][j] == '.' && s[i][j-1] == '.') good = false;

  if(i != 0 && i != h-1 && j != 0 && j != w-1)
    if(s[i][j+1] == '.' && s[i][j-1] == '.' && s[i+1][j] == '.' && s[i-1][j] == '.') good = false;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;

    ll h,w;
    cin >> h >> w;
    F0R(i,h) F0R(j,w) cin >> s[i][j];
    F0R(i,h) F0R(j,w) {
      if(s[i][j] == '#')
        check(i,j,h,w);
      if(!good) {
        cout << "No" << endl; return 0;
      }
    }

    cout << "Yes" << endl; return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vector<ll> a(n); rep (i, n) cin >> a[i];
    vector<vector<ll>> ans(2, vector<ll>(n));
    rep (i, n) ans[0][i] = a[i];
    rep (i, k) {
        int l = (1 + i) % 2;
        rep (j, n) ans[l][j] = 0;
        rep (j, n) {
            ans[l][max(0LL, j - ans[i % 2][j])]++;
            if (j + ans[i % 2][j] < n - 1) ans[l][j + ans[i % 2][j] + 1]--;
        }
        rep (j, n - 1) ans[l][j + 1] += ans[l][j];

        bool all_N = true;
        rep (j, n) all_N &= (ans[(1 + i) % 2][j] == n);
        if (all_N) {
            rep (j, n) cout << n << " \n"[j == n - 1];
            return 0;
        }

        eprintf("%d:\n", i);
        // rep (j, n) cout << ans[l][j] << " \n"[j == n - 1];
    }
    rep (i, n) {
        cout << ans[k % 2][i] << " \n"[i == n - 1];
    }
    return 0;
}

Measured memory_bytes: 9472
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;
	cout << (long long)(K*pow(K - 1, N - 1)) << endl;
endapp:
	//system("pause > nul");
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));

    ll ans = 0;
    rep(i, n) {
        ll bi = b[i];
        ll lower_than_bi = lower_bound(all(a), bi) - a.begin();
        ll upper_than_bi = c.end() - upper_bound(all(c), bi);
        ans += lower_than_bi * upper_than_bi;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>

using namespace std;
typedef long long  ll;

const int N = 100010;
int a[N], b[N];
map<pair<int, int> , int> myhash;
long long ans[10];

int cal(int x, int y) {
	int res = 0;
	for (int i = x; i <= x + 2; i++)
		for (int j = y; j <= y + 2; j++)
			if (myhash.find(make_pair(i, j)) != myhash.end()) {
				res++;
			}
	return res;
}

int main() {
	int m, n, k;
	scanf("%d %d %d", &m, &n, &k);
	for (int i = 1; i <= k; i++) {
		scanf("%d %d", &a[i], &b[i]);
		myhash[make_pair(a[i], b[i])] = 1;
	}
	for (int i = 1; i <= k; i++) {
		for (int x = max(1, a[i] - 2); x <= a[i]; x++)
			for (int y = max(1, b[i] - 2); y <= b[i]; y++) {
				if (x + 2 > m || y + 2 > n) continue;
				int d = cal(x, y);
				ans[d] ++;
			}
	}
	ans[0] = (long long)(m - 2) * (n - 2);
	for (int i = 1; i <= 9; i++) {
		ans[i] /= i;
		ans[0] -= ans[i];
	}
	for (int i = 0; i <= 9; i++)
		printf("%lld\n", ans[i]);
	return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

double x[110];
double y[110];
double z[110];
double r[110];

int par[110];
void init(){for(int i=0;i<110;++i)par[i]=i;}
int find(int x){return (par[x]==x)?x:find(par[x]);}
void unite(int a,int b){a=find(a),b=find(b),par[b]=a;}
bool same(int a,int b){return find(a)==find(b);}

inline double dist(int a,int b){
	double d=0;
	d+=(x[a]-x[b])*(x[a]-x[b]);
	d+=(y[a]-y[b])*(y[a]-y[b]);
	d+=(z[a]-z[b])*(z[a]-z[b]);
	return max(0.0,sqrt(d)-r[a]-r[b]);
}

typedef tuple<double,int,int> state;

int main(void){
	int n;
	while(cin >> n){
		if(n==0)
			break;
		rep(i,n) cin >> x[i] >> y[i] >> z[i] >> r[i];
		init();
		double ans=0.0;
		vector<state> edge;
		rep(i,n)rep(j,n){
			if(i>=j)
				continue;
			double d=dist(i,j);
			edge.pb(make_tuple(d,i,j));
		}
		sort(edge.begin(),edge.end());
		rep(i,edge.size()){
			double d;
			int a,b;
			tie(d,a,b)=edge[i];
			if(same(a,b))
				continue;
			ans+=d;
			unite(a,b);
		}
		cout.precision(3);
		cout << fixed << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1428
n = int(input())
memo = [0 for _ in range(n + 1)]
for x in range(1, int(n ** 0.5) + 1):
    for y in range(1, int(n ** 0.5) + 1):
        for z in range(1, int(n ** 0.5) + 1):
            num = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if num <= n:
                memo[num] += 1
            elif num > n:
                break
for i in range(1, n + 1):
    print(memo[i])

Measured memory_bytes: 69708
#include<iostream>
#include<cstdlib>
#include<sstream>
#include<cmath>
using namespace std;

class Parse
{
private:
  string message;
  int pos;
public:
  Parse():pos(0){}
  Parse(string message):message(message),pos(0){}

  int fact()
  {
    string p;
    while('0' <= message[pos] && message[pos] <= '9') 
      p += message[pos],pos++;
    return (atoi)(p.c_str());
  }

 
  int exp()
  {
    int p = fact();

    while(message[pos] == '+' || message[pos] == '-' || message[pos] == '*' || message[pos] == '/')
      {
	if(message[pos] == '+')
	  ++pos,p += fact();
	else if(message[pos] == '-')
	  ++pos,p -= fact();
	else if(message[pos] == '*')
	  ++pos,p *= fact();
	else if(message[pos] == '/')
	  ++pos,p /= fact();
      }
    return p;
  }

};

int main()
{
  string in;
  string exp;
  while(cin >> in)
    {
      exp += in;
    }
  Parse parse(exp);
  cout << parse.exp() << endl;
  return 0;
}

Measured memory_bytes: 1204
n, m = map(int, input().split())
a = 0
b = 10**5+1
for i in range(m):
    l, r = map(int, input().split())
    a = max(a, l)
    b = min(b, r)
print(b-a+1 if b-a+1>= 0 else 0)


Measured memory_bytes: 3060
import math
n,k= map(int,input().split())
m=min(n,k)
a=[0]*n
for i in range(1,m+1):
    a[i-1]=math.ceil(math.log2(k/i))
for i in range(m):
    a[i]=0.5**a[i]
print((sum(a)+max(n-k,0))/n)

Measured memory_bytes: 3828
N = int(input())
h = list(map(int, input().split()))
dp = [(10 ** 4) * N] * N
dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2, N):
    dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))

print(dp[N-1])

Measured memory_bytes: 13924
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;
 


int main()
{
   
    
   
    int a, b;
    cin >> a >> b;

    for (int i = 0; i <= a; i++) {

        if (i * 2 + (a - i) * 4 == b) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;


    return 0;

}

Measured memory_bytes: 3592
/*template date:2019/12/27*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<limits.h>
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
double to_deg(double r){return r*180.0/(atan(1.0)*4.0);}
typedef struct{
    int x;
    int y;
}pair_t;
int asc_cmp_t(const void* X,const void* Y){int x=(*(pair_t*)X).x,y=(*(pair_t*)Y).y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp_t(const void* X,const void* Y){int x=(*(pair_t*)X).x,y=(*(pair_t*)Y).y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    ull a,b,k;scanf("%llu %llu %llu",&a,&b,&k);
    if(a>=k){
        a-=k;
        k=0;
    }else{
        k-=a;
        a=0;
        
    }
    if(b>=k){
        b-=k;
    }else{
        b=0;
    }
    printf("%llu %llu\n",a,b);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
#define rep(a,b) for(int a = 0; a < b; a++)

int n;
ll dp[1<<18]{};
int arr[100000];
int size = 1;

void update(int index, ll num) {
  index += size-1;
  dp[index] = num;
  //cout << "  " << index << "," << dp[index] << endl;
  while(index>0) {
    int new_index = (index-1)>>1;
    dp[new_index] = max(dp[(new_index<<1)+1],dp[(new_index<<1)+2]);
    //cout << "  " << new_index << "," << dp[new_index] << endl;
    index = new_index;
  }
  //dp[index] = max(dp[index],dp[index^1]);
}

ll get_max(int a, int b, int k, int left, int right) {
  //cout << "gmax " << a << "," << b << "," << k << "," << left << "," << right << endl;
  if(right<a||b<=left||right<=left) return 0;
  if(a<=left&&right<=b) {
    //cout << "OK " << dp[k] << endl;
    return dp[k];
  }
  ll ret = 0;
  ret = max(ret,get_max(a,b,(k<<1)+1,left,(left+right)>>1));
  ret = max(ret,get_max(a,b,(k<<1)+2,(left+right+1)>>1,right));
  return ret;
}

int main() {
  cin >> n;
  for(int i = 1; i < n; i<<=1) size<<=1;
  rep(i,n) cin >> arr[i];
  rep(i,n) {
    int num = arr[i];
    ll _max = get_max(1,num,0,0,size);
    //cout << num << "," << _max << endl;
    update(num,_max+num);
  }
  ll ans = (ll)n;
  ans = ans*(ans+1)/2;
  //for(int i = 0; i < size<<1; i++) cout << dp[i] << endl;
  cout << ans-dp[0] << endl;
}



Measured memory_bytes: 5076
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin>>a>>b>>c;
    if(a<b){
        if(b<c){
            cout<<"Yes"<<endl;
        }
        else{
        cout<<"No"<<endl;
    }
    }
    else{
        cout<<"No"<<endl;
    }
}



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

int main() {
    long double W, H;
    cin >> W >> H;
    long double x, y;
    cin >> x >> y;
    cout << setprecision(28) << H * W / 2.0 << " ";
    if (x == W / 2.0 && y == H / 2.0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
<?php
   fscanf(STDIN, "%d %d", $n,$d);
  $ans=0;
  for($i=0;$i<$n;++$i){
    fscanf(STDIN, "%d %d", $x, $y);
    $cal=($x*$x)+($y*$y);
   //echo $cal."\n";
   $cal=sqrt($cal);
   //echo $cal."\n";
   if($cal<=$d){
   $ans=++$ans;
   }
}
echo $ans;
?>

Measured memory_bytes: 16124
n = int(input())
k = 0
buffer = []
ref = []
while k<n:
    x,y = map(str, input().split())
    buffer.append([x,y])
    k = k + 1



for i in range(13):
    ref.append(['S',str(i+1)])
for i in range(13):
    ref.append(['H',str(i+1)])
for i in range(13):
    ref.append(['C',str(i+1)])    
for i in range(13):
    ref.append(['D',str(i+1)])


for sample in ref:
    if sample not in buffer:
        print(sample[0]+' '+sample[1])


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP2(i,m,n) for (int i=m;i<(n);i++)
typedef long long ll;
typedef long double ld;

const ll MAX = 20000001;
ll N;
bool is_prime[MAX];

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

    cin >> N;

    REP(i, MAX) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;

    REP2(i, 2, MAX) if (is_prime[i]) {
        for (ll j = i + i; j < MAX; j += i) is_prime[j] = false;
    }

    ll ans = 0;
    REP2(i, 2, N+1) if (is_prime[i]) {
        if (is_prime[i + 2]) ans += 2;
    }

    cout << ans << endl;
}



Measured memory_bytes: 22764
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int)n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}
 
 

 
int main(){
	//in_o();
	int64 a,b;
	cin>>a>>b;
	if(a<=0 && b>=0)
		return cout<<"Zero"<<endl,0;
	if(a>0 || (b-a)%2)
		cout<<"Positive"<<endl;
	else
		cout<<"Negative"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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 qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n,m,a,b,c,d,h,w,x,y;
string str;

signed main(){

  cin >>a>>b;
  if(a+b==15) cout <<'+' fin;
  else if(a*b==15) cout <<'*' fin;
  else cout <<'x' fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  vector<string> w={"Sunny","Cloudy","Rainy"};
  
  string s;
  cin>>s;
  if( s==w[0] ) cout << w[1] << endl;
  else if(s==w[1]) cout << w[2] << endl;
  else cout << w[0] << endl;

  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int i,j,k,n,m,l,count1=0;
void ABC140(void);
void ABC141(void);
void ABC142(void);
void ABC143(void);
void ABC144(void);
void ABC145(void);
void ABC146(void);
void ABC147(void);
void ABC148(void);
void ABC149(void);

int main(void){
    ABC140();
}

void ABC140(){
    cin>>n;
    int sum=0;
    vector<int> a(n),b(n),c(n);
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        cin>>b[i];
    }
    for(i=0;i<n-1;i++){
        cin>>c[i];
    }
    for(i=0;i<n;i++){
        sum+=b[a[i]-1];
        if(i>=1&&a[i]-a[i-1]==1)sum+=c[a[i]-2];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    double d,b,c,sum=0;
    cin>>a;
    for(int i = 1; i<=a; i++)
    {
        cin>>d;
        b = 1/d;
        sum= sum+ b;
    }
    c = 1/sum;
    cout<<c<<endl;
    return 0;
}

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

int main(){
	float a, b, c, d, e, f, x, y;
	while(cin >> a >> b >> c >> d >> e >> f){
		x = (b * f - c * e) / (b * d - a * e);
		y = (c - a * x) / b;
		if(x == 0) x = 0;
		if(y == 0) y = 0;
		cout << fixed << setprecision(3) << x << ' ' << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
H,W = map(int,input().split())
src = [input() for i in range(H)]

del_r = []
for i in range(H):
    if all([c=='.' for c in src[i]]):
        del_r.append(i)

del_c = []
for i,col in enumerate(zip(*src)):
    if all([c=='.' for c in col]):
        del_c.append(i)

for i in range(H):
    if i in del_r: continue
    ans = ''
    for j in range(W):
        if j in del_c: continue
        ans += src[i][j]
    print(ans)

Measured memory_bytes: 3064
#include <iostream>

 using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = i / 60 - h * 60;
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl;

   return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int x;
    cin >> x;
    int ans = !x;
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 3648
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__

MOD = 10**9 + 7


def main():
    n, m = map(int, input().split())
    broken = [False] * (n + 2)
    for _ in range(m):
        broken[int(input())] = True

    dp = [0] * (n + 2)
    dp[n] = 1

    for x in reversed(range(n)):
        if not broken[x + 1]:
            dp[x] = (dp[x] + dp[x + 1]) % MOD
        if not broken[x + 2]:
            dp[x] = (dp[x] + dp[x + 2]) % MOD

    print(dp[0])


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 35100
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=s; i<(n); ++i)
#define ALL(n) begin(n),end(n)
using ll = long long;
const ll INF = 1e18;
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; }

int main(){
    int N; cin >> N;
    vector<pair<ll, ll>> A(2010);  // value, prev index
    int tmp;
    REP(i, 0, N){
        cin >> tmp;
        A[i] = make_pair(tmp, i);
    }

    sort(A.begin(), A.end(), greater<pair<ll, ll>>());  // 降順ソート

    vector<vector<ll>> dp(2010, vector<ll>(2010, 0));

	ll ans = 0;
    REP(l, 0, N){
        REP(r, 0, N){
 			if (l + r == N){  // 全ての幼児を右か左に移動するグループに分類し終えた場合（l+r=NはN個くらい組み合わせがあるのでansは逐次更新していく）
				chmax(ans, dp[l][r]);
                break;
			} else{
                chmax(dp[l + 1][r], dp[l][r] + A[l + r].first * (A[l + r].second - l));  // 残っている内で価値が最大の幼児を，左に移動させるグループとした場合
                chmax(dp[l][r + 1], dp[l][r] + A[l + r].first * ((N - 1 - r) - A[l + r].second));  // 残っている内で価値が最大の幼児を，右に移動させるグループとした場合
            }
		}
	}

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 34984
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
struct pzl{
    vector<int>PV;
    int zero,cnt;
    pzl(vector<int>PV_,int zero_,int cnt_){
        PV=PV_;zero=zero_;cnt=cnt_;
    }
};
pzl exswap(pzl a,int n){
    swap(a.PV[a.zero],a.PV[a.zero+n]);
    a.zero+=n;
    a.cnt++;
    return a;
}
int main(){
    map<vector<int>,int>M;
    vector<int>V(8);
    for(int i=0;i<8;i++)V[i]=i;
    queue<pzl>Q;
    pzl start(V,0,0);
    Q.push(start);
    while(!Q.empty()){

        pzl a=Q.front();
        Q.pop();
        if((a.PV==start.PV&&a.cnt!=0)||M[a.PV])continue;
        M[a.PV]=a.cnt;
        if(a.zero>3)Q.push(exswap(a,-4));
        if(a.zero<4)Q.push(exswap(a,4));
        if(a.zero!=0&&a.zero!=4)Q.push(exswap(a,-1));
        if(a.zero!=3&&a.zero!=7)Q.push(exswap(a,1));

    }
    vector<int>inp(8);
    while(cin>>inp[0]){
        for(int i=1;i<8;i++)cin>>inp[i];
        cout<<M[inp]<<endl;
    }
}

Measured memory_bytes: 3872
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> f(n,0);
	for(int i=0;i<n;i++)
		for(int j=0;j<10;j++)
		{
			int tmp; 
			cin >> tmp;
			if(tmp==1)f[i]+=(1<<j);
		}
	vector<vector<int> > p(n,vector<int>(11));
	for(int i=0;i<n;i++)
		for(int j=0;j<=10;j++)
			cin >> p[i][j];


	long long ans=-1000000000009;
	for(int i=1;i<(1<<10);i++)
	{
		//cout << bitset<10>(i) << " ";
		long long tmpans=0;
		for(int j=0;j<n;j++)
		{
			int tmp=(i&f[j]);
			int count=0;
			for(int k=0;k<=10;k++)
				if((tmp&(1<<k))!=0)count++;
			tmpans+=p[j][count];		
		}
		if(ans<tmpans)
		{
			for(int j=0;j<n;j++)
			{
				int tmp=(i&f[j]);
//				cout << "i&f[j] : " << "\n" << "\t" << bitset<10>(i) << "\n" << "\t" << bitset<10>(f[j]) << "\n" << "\t" << bitset<10>(tmp) << endl;
				int count=0;
				for(int k=0;k<=10;k++)
					if((tmp&(1<<k))!=0)count++;
//				cout << "count :" << count << "   point :" << p[j][count] << endl;
			}
//			cout << tmpans << endl;
			ans=tmpans;
		}
			
	}
	cout << ans << endl;



	
}

Measured memory_bytes: 256
use proconio::input;

#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::ops::*;

#[derive(Clone, Debug, Default)]
struct Struct;

//#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        qs: [(usize,usize);q],
    }

    let mut m1 = BTreeMap::new();
    let mut m2 = BTreeMap::new();
    m1.insert(n, n);
    m2.insert(n, n);

    let mut ans = (n-2) as u64 *(n-2) as u64;
    for (op, x) in qs {
        if op == 1 {
            // get depth
            let (_, &depth) = m1.range(x..).next().unwrap();
            //println!("1 x={} depth={}", x, depth);
            m2.entry(depth).and_modify(|e| *e = min(*e, x)).or_insert(x);
            ans -= depth as u64 - 2;
        } else {
            let (_, &depth) = m2.range(x..).next().unwrap();
            //println!("2 x={} depth={}", x, depth);
            m1.entry(depth).and_modify(|e| *e = min(*e, x)).or_insert(x);
            ans -= depth as u64 - 2;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 12140
#include <climits>
#include <fstream>
#include <cmath>
#include <iostream>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>

using namespace std;

int n, m, t, p;
typedef map<int, map<int, int>> mp;

const int getOrigValue(const mp& s, const int x, const int y)
{
	if (s.find(x) == s.end()) {
		return 0;
	}
	if (s.at(x).find(y) == s.at(x).end()) {
		return 0;
	}
	return s.at(x).at(y);
}

mp calc(const mp& sheet)
{
	int d, c;
	cin >> d >> c;

	mp new_sheet(sheet);
	
	const int xmax = sheet.size();
	const int ymax = sheet.at(0).size();
	if (d == 1) 
	{
		for (int y = 0; y < ymax; y++)
		{
			for (int x = 0; x < c; x++)
			{
				const int tx = 2 * c - x - 1;
				const int ty = y;
				new_sheet[tx][ty] = sheet.at(x).at(y) + getOrigValue(sheet, tx, ty);
				new_sheet[x][y] = 0;
			}
		}
	}
	else
	{
		for (int x = 0; x < xmax; x++)
		{
			for (int y = 0; y < c; y++)
			{
				const int tx = x;
				const int ty = 2 * c - y - 1;
				new_sheet[tx][ty] = sheet.at(x).at(y) + getOrigValue(sheet, tx, ty);
				new_sheet[x][y] = 0;
			}
		}
	}

	mp ret;

	int xmin = INT_MAX, ymin = INT_MAX;
	for (const auto& xitr : new_sheet) {
		for (const auto& yitr : xitr.second) {
			if (yitr.second != 0) {
				xmin = min(xmin, xitr.first);
				ymin = min(ymin, yitr.first);
			}
		}
	}

	for (const auto& xitr : new_sheet) {
		for (const auto& yitr : xitr.second) {
			if (yitr.second != 0)
				ret[xitr.first-xmin][yitr.first-ymin] = yitr.second;
		}
	}

	return ret;
}

void solve(const mp& s)
{
	int x, y;
	cin >> x >> y;
	cout << s.at(x).at(y) << endl;
}


int main(void)
{
	while (true) {
		cin >> n >> m >> t >> p;
		if (!(n | m | t | p)) { break; }
		mp sheet;
		for (int y = 0; y < m; y++)
			for (int x = 0; x < n; x++)
				sheet[x][y] = 1;
		for (int i = 0; i < t; i++)
			sheet = calc(sheet);
		for (int i = 0; i < p; i++)
			solve(sheet);
	}
	return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<string>
using namespace std;
int main(){
  int bell,hess,aizu,money=0;
  string s;
  for(int i=0;i<9;i++){
    cin >> s >> bell >> hess;
    money+=bell*200;
    money+=hess*300;
    aizu=bell+hess;
    cout << s << " " << aizu << " " << money << endl;
    money=0;
  }
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <string.h>

int main(){
	int n;
	scanf("%d", &n);
	int m = 100000;
	for(int i=0;i<n;i++){
		m *= 1.05;
		if(m%1000 != 0) m = (m/1000+1)*1000;
	}
	printf("%d\n", m);
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
long gcd(long a,long b){
	if (a < b) swap(a, b);
	if (a%b == 0) return b;
	return gcd(b,a%b);
}
int main(){
	long x, y; cin >> x >> y;
	cout << gcd(x, y) << '\n';
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int64 n;
    cin >> n;
    vector<int> name;
    while(n > 0) {
        n--;
        name.push_back(n%26+1);
        n /= 26;
    }
    for (int i=name.size()-1; i>=0; i--) {
        cout << (char)('a'+name[i]-1);
        // cout << (name[i]==0? 'z' : (char)('a'+name[i]-1));
    }
    cout << endl;
}


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

int main(){
  string s;
  cin >> s;
  int n = s.length();
  int d;
  cin >> d;
  vector<vector<vector<ll>>> dp(2,vector<vector<ll>>(n+1,vector<ll>(d,0)));
  dp[0][0][0] = 1;
  rep(i,n) {
    int a = s[i] - '0';
    rep(j,d) (dp[0][i+1][(j+a)%d] += dp[0][i][j]) %= mod;
    rep(j,a) {
      rep(k,d) (dp[1][i+1][(k+j)%d] += dp[0][i][k]) %= mod;
    }
    rep(j,10) {
      rep(k,d) (dp[1][i+1][(k+j)%d] += dp[1][i][k]) %= mod;
    }
  }
  ll ans = (((dp[0][n][0] + dp[1][n][0] - 1) % mod) + mod) % mod;  
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 24832
#include<iostream>
#include<set>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<string>
using namespace std;

int main(){
    long N;
    cin >> N;
    string S;
    cin >> S;
    vector<set<int> > m(26);
    for(long i=0; i<S.size();i++){
        char c = S.at(i);
        m[c - 'a'].insert(i);
    }
    int Q;
    cin >> Q;
    for(int i=0; i<Q;i++){
        int a;
        cin >> a;
        if(a == 1){
            int b;
            cin >> b;
            b--;
            char y = S[b];
            m[y - 'a'].erase(b);
            char c;
            cin >> c;
            m[c - 'a'].insert(b);
            S[b] = c;
        }else{
            int b, c;
            cin >> b >> c;
            b--;
            c--;
            int r = 0;
            for(int j=0; j<26;j++){
                auto bp = m[j].lower_bound(b);
                auto cp = m[j].lower_bound(c);
                if (bp != cp || S.at(b) - 'a' == j || S.at(c) - 'a' == j){
                    r += 1;
                }
            }
            cout << r << endl;
        }
    }
}



Measured memory_bytes: 24196
S =  input()
countA =0
countB =0
for i in range(len(S)):
    if i % 2 == 0:
        if int(S[i]) == 1:
            countA += 1
        else:
            countB += 1
    else:
        if int(S[i]) == 1:
            countB += 1
        else:
            countA += 1            
if countA > countB:
    print(countB)
else:
    print(countA)

Measured memory_bytes: 3316
#include<iostream>
#include<stdio.h>
#include<ios>
#include<cmath>
#include<string>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<assert.h>
#include<bitset>
#include<tuple>
#include<climits>
#include<deque>
#include<utility>
#include<unordered_map>
#include<unordered_set>
#include<iterator>
#include<sstream>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define l     long
#define ll    long long
#define nitro ios_base::sync_with_stdio(false);cin.tie(0);
#define vi    vector<int>
#define pub   push_back
#define puf   push_front
#define pob   pop_back
#define pof   pop_front
#define PI    3.1415926535897932384626433
#define endl  '\n'
#define gap   ' '
int main()
{
    nitro
    ll int a,b,m,best1=INT_MAX,best2=INT_MAX;cin>>a>>b>>m;
    ll int r[a],mi[b];
    for(auto& x :r) {cin>>x;if(x<best1) best1=x;}
    for(auto&x : mi) {cin>>x;if(x<best2) best2=x;}
    best1+=best2;
    while(m--)
    {
        ll int q,w,e;cin>>q>>w>>e;
        best1=min(r[q-1]+mi[w-1]-e,best1);
    }
    cout<<best1;
    return 0;
}


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

typedef long long ll;
ll MOD = 1000000007;

int dp[21][51][51];

bool check(char c, char d) {
	return c == d || (c != '`' && d == '?');
}

int main() {
	int n; cin >> n;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		for (; s[i].size() < 20; s[i].push_back('`'));
	}
	for (int i = 0; i <= n; i++)
		dp[20][i][i] = 1;
	for (int i = 0; i + 1 <= n; i++)
		dp[20][i][i + 1] = 1;
	for (int k = 19; k >= 0; k--)
		for (int l = 0; l <= n; l++) {
			vector<int> a(n + 1);
			a[l] = 1;
			for (char c = '`'; c <= 'z'; c++)
				for (int i = n; i >= l; i--)
					for (int j = i + 1; j <= n; j++) {
						if (!check(c, s[j - 1][k])) break;
						a[j] = (a[j] + (ll)a[i] * dp[k + 1][i][j]) % MOD;
					}
			for (int r = l; r <= n; r++)
				dp[k][l][r] = a[r];
		}
	cout << dp[0][0][n] << endl;
}

Measured memory_bytes: 3392
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const int MAX=5e5+10;
const ll mod=1e9+7;
int main()
{
	int a,b,c,d;
	while(~scanf("%d%d%d%d",&a,&b,&c,&d))
	{
		if(a+b>c+d) puts("Left");
		else if(a+b==c+d) puts("Balanced");
		else puts("Right");
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n+1);
    for(int i = 1; i <= n; i++) cin >> v[i];

    int ans = 0;
    for(int i = 1; i < v.size(); i++) {
        if(v[i] == i) {
            if(i != v.size()-1) swap(v[i], v[i+1]);
            else swap(v[i], v[0]);
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;
typedef vector<pp> vpp;
typedef unsigned int i64;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define bye(x) return void (cout <<(x) << endl);
#define all(e) (e).begin(), (e).end()
#define pb push_back

template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}


template <typename T>
void printV(vector<T> A) {
  if (A.empty()) cerr << "EMTPY\n";
  else { 
    cerr << "[";
    for (int i = 0; i < A.size() -1 ; ++i) {
      cerr << A[i] << ", ";
    }
    if (A.size()) cerr << A.back() << "]\n";
  }
}


template <typename T>
void printVV(vector<vector<T>> A) {
  cerr << "[";
  for (auto v : A) {
    printV<T>(v);
  }
  cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

int main(int argc, char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t; cin >> s >> t;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    cnt += (s[i] != t[i]);
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 3752
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <set>
#include <queue>
#include <assert.h>
#include <cmath>
#include <map>


using std::cerr;
using std::cin;
using std::cout;
using std::pair;
using std::string;
using std::vector;
//region
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b); i >= (b); --i)
#define rep(i, n) for (unsigned i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n)-1; i >= 0; --i)
#define repr1(i, n) for (int i = (n); i > 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define sz(x) (int((x).size()))
#define mset(v, n) std::memset((v), n, sizeof(v))
#define BIT(N) (1LL << (N))
#define each(i, v) for (auto&& i : (v))
#define unless(f) if(!(f))
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using vint = vector<int>;
using vlong = vector<ll>;
using vstr = vector<string>;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpll = vector<pll>;
using vvi = vector<vint>;
using vvl = vector<vlong>;
vector<string> split(const string &s, const string &delim) {
  vector<string> res;
  uint pos = 0;
  while (true) {
    const size_t found = s.find(delim, pos);
    if (found < 0) {
      res.push_back(s.substr(pos));
      break;
    }
    res.push_back(s.substr(pos, found - pos));
    pos = found + delim.size();
  }
  return res;
}
template<typename T> string join(vector<T> &vec, const string &sep) {
  size_t size = vec.size();
  if (!size) return "";
  std::stringstream ss;
  for (int i = 0; i < size - 1; i++)
    ss << vec[i] << sep;
  ss << vec[size - 1];
  return ss.str();
}
template<typename T> std::istream &operator>>(std::istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template<typename Iter> inline void print(const Iter &first, const Iter &last, const std::string &d, bool endline) {
  cout << *first;
  for (Iter iter = first + 1; iter < last; ++iter) {
    cout << d << *iter;
  }
  if (endline) cout << "\n";
}
constexpr ll powmod(ll a, ull b, uint p) {
  ll res = 1;
  while (b > 0) {
    if (b % 2) res = res * a % p;
    a = a * a % p;
    b >>= 1u;
  }
  return res;
}
template<class T> bool chmax(T &a, const T &b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, const T &b) { return a > b ? (a = b, true) : false; }
template <typename T> void bsort(vector<T>& v) { std::sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T>& v) { std::sort(v.begin(), v.end(), std::greater<T>()); }
struct iii {
    iii() {
      cin.tie(nullptr); cout.tie(nullptr);
      std::ios::sync_with_stdio(false);
      cout << std::fixed << std::setprecision(16);
    }
} init;
//endregion

void solve();

int main() {
  int t = 1;
  // scanf("%d", &t);
  // cin >> t;
  rep(i, t) solve();
  return 0;
}

void solve() {
  string S;
  cin >> S;

  vint a(2);
  each(c,S)a[c-'A']++;
  cout << (a[0] && a[1] ? "Yes" : "No") << std::endl;


  return;
}


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

int main()
{
    int n,d,x,a[n],b=0,c=1;
    cin>>n>>d>>x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        b=0;
        while(b<d){
            b+=a[i];
            c++;
        }
    }
    std::cout << c+x-1 << std::endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=1;i<s.size();i++){
    if(s[i-1]!=s[i]) ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512