akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 222222
#define M 222222
#define LL long long
using namespace std;
int n,i,T;LL an;char s[99];
void dfs(int x,LL z,LL v){
	if(x>n){
		an+=z+v;
		//printf("%lld\n",z+v);
		return;
	}
	dfs(x+1,s[x]-'0',v+z);
	if(x>1)dfs(x+1,z*10+s[x]-'0',v);
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	dfs(1,0,0);
	printf("%lld",an);
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <stdlib.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
using namespace std;


const int nmax =1225;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax]) {

	bool all_visited = true;

	//すべて訪問したかチェック
	for (int i = 0; i < N; i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}

	//すべて訪問可能なルートを数える為
	if (all_visited) {

		return 1;
	}

	int ret = 0; //ルートの数

				 //グラフ上でつながって
				 //まだ訪れたことがない
	for (int j = 0; j < N; j++) {

		//v==0からスタート
		if (graph[v][j] == false) {
			continue;
		}

		if (visited[j]) {
			continue;
		}

		visited[j] = true;
		ret += dfs(j, N, visited);
		

	}

	return ret;
}


int main(void) {
	int N, M;
	cin >> N >> M;
	
	//頂点記録用
	int a[50];
	int b[50];

	//二次元のグラフを作成
	for (int i = 0; i<M; ++i) {
		int A, B;
		cin >> A >> B;
		a[i] = A;
		b[i] = B;
		graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
	}

	int count = 0;
	
	for (int i = 0; i < M;i++) {

		//ルート削除
		graph[a[i] - 1][b[i] - 1] = graph[b[i] - 1][a[i] - 1] = false;

		//訪問先配列初期化
		bool visited[nmax];
		for (int i = 0; i<N; ++i) {
			visited[i] = false;
		}

		visited[0] = true;
		dfs(0, N, visited);

		//訪れたことのない頂点があれば消した辺は橋である
		int flag = false;
		for (int j = 0; j < N;j++) {
			if (visited[j] == false) {
				flag = true;
			}
		}
		
		if (flag) {
			count += 1;
		}

		graph[a[i] - 1][b[i] - 1] = graph[b[i] - 1][a[i] - 1] = true;
	}

	cout << count;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 1000000000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;


int main(){
    for(;;){
        string A;
        cin >> A;
        if(A=="#")break;
        map<char,int> t;
        t['a']=1;
        t['b']=1;
        t['c']=1;
        t['d']=1;
        t['e']=1;
        t['f']=1;
        t['g']=1;
        t['h']=2;
        t['i']=2;
        t['j']=2;
        t['k']=2;
        t['l']=2;
        t['m']=2;
        t['n']=2;
        t['o']=2;
        t['p']=2;
        t['q']=1;
        t['r']=1;
        t['s']=1;
        t['t']=1;
        t['u']=2;
        t['v']=1;
        t['w']=1;
        t['x']=1;
        t['y']=2;
        t['z']=1;
        int ch = 0;
        int times=0;
        for (int i=0; i<A.length(); i++) {
            int ho = t[A[i]];
            if(ch == 0){
                ch = ho;
                continue;
            }
            if (ch == ho) {
                continue;
            }else{
                times++;
                ch = ho;
            }
        }
        cout << times << endl;
    }
}

Measured memory_bytes: 1196
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n;
ll a[311][311];
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			geti(a[i][j]);
		}
	}
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ll mn=1ll*mod*mod;
			for(int k=1;k<=n;k++)
			{
				if(k==i||k==j)continue;
				mn=min(mn,a[i][k]+a[k][j]);
			}
			if(mn>a[i][j])sum+=a[i][j];
			if(mn<a[i][j])
			{
				puts("-1");
				return 0;
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cin(int, m);
    Cout((m-n)*(m-n-1)/2 - n);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	int N;
	int B[100010]={};

	cin >> N;
	for(int i=1;i<=N;i++)
	{
		int A;
		cin >> A;
		B[A]=i;
	}

	for(int i=1;i<=N;i++)
	{
		cout << B[i];
		if(i==N)cout << endl;
		else cout << " ";
	}
	
	return 0;
}



Measured memory_bytes: 1152
//%std
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
inline int read()
{
	int out = 0, fh = 1;
	char jp = getchar();
	while ((jp > '9' || jp < '0') && jp != '-')
		jp = getchar();
	if (jp == '-')
		fh = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * fh;
}
const ull Base = 137;
set<ull> S;
char s[100];
int main()
{
	int n = read();
	for (int i = 1; i <= n; ++i)
	{
		scanf("%s", s + 1);
		int len = strlen(s + 1);
		ull val = 0;
		for (int j = 1; j <= len; ++j)
			val = val * Base + (ull)(s[j] - 'a' + 1);
		S.insert(val);
	}
	cout << S.size() << '\n';
	return 0;
}


Measured memory_bytes: 13032
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
//C++11
#if __cplusplus == 201103L
#include <tuple>
#endif

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int n = 0, U = 0;
  while(scanf("%d %d", &n, &U) != EOF && n){
    int c[20];
    int need[20] = {};
    REP(i, n){
      int k;
      scanf("%d %d",&c[i], &k);
      need[i] |= 1<<i;
      REP(j, k){
        int a; cin>>a;
        need[i] |= (1<<a);
      }
    }
    /*
    for(int S = 0; S < 1<<n; S++){
      int cnt = __builtin_popcount(S);
      if(ans <= cnt) continue;
      bool ok = true;
      int sum = 0;
      for(int i = 0; i < n; i++)if(S >> i & 1){
        if(need[i] != (S & need[i])){
          ok = false;
          break;
        }
        sum += c[i];
      }
      if(ok && sum >= U) ans = cnt;
    }
    */
    int ans = n;
    for(int k = 1; k < n; k++){
      int comb = (1<<k) - 1;
      while(comb < (1 << n)){
        int S = comb;
        bool ok = true;
        int sum = 0;
        for(int i = 0; i < n; i++)if(S >> i & 1){
          if(need[i] != (S & need[i])){
            ok = false;
            break;
          }
          sum += c[i];
        }
        if(ok && sum >= U){
          ans = k;
          goto OUTPUT;
        }
        int x = comb & -comb, y = comb + x;
        comb = ((comb & ~y) / x >> 1) | y;
      }
    }

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

Measured memory_bytes: 912
#include <cstdio>
#include <iostream>
#include <algorithm> // sort, min, max, swap
#include <utility> // pair
#include <vector>
#include <queue>

using namespace std;

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

typedef pair<int,int> P;

#define ft first
#define sd second

int n, l;
P t[100000] = {};
int a[100002] = {};

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> l;
	
	rep(i, n) {
		cin >> t[i].ft;
		t[i].sd = i+1;
	}
	
	sort(t, t+n, greater<P>());
	
	rep(i, n) {
		if(a[t[i].sd-1] == 0 && a[t[i].sd+1] == 0)a[t[i].sd] = l - t[i].ft;
		else if(a[t[i].sd-1] > a[t[i].sd+1])a[t[i].sd] = a[t[i].sd-1] + l - t[i].ft;
		else if(a[t[i].sd+1] > a[t[i].sd-1])a[t[i].sd] = a[t[i].sd+1] + l - t[i].ft;
	}
	
	int s=0;
	rep(i, n) s = max(s, a[i+1]);
	
	cout << s << endl;
	
	return 0;
}

Measured memory_bytes: 2376
#ABC128C_Switches.rb
n,m = gets.split.map(&:to_i)
ans = 0
light = []
(1..m).each do |mm|
  ar = gets.split.map(&:to_i)
  light << ar[1...ar.size]
end
param = gets.split.map(&:to_i)

(0...(2**n)).each do |i|
  on = 0
  light.each_with_index do |sw,j|
    
    tmp = 0
    sw.each do |sw_num|
      tmp += i[sw_num-1]
    end

    if tmp%2==param[j]
      on += 1
    else
    end

  end
  
    if on == m
      ans += 1
    end
    
end
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;


int main(void) {
    ll X,K,D;
    cin >> X >> K >> D;
    
    X = abs(X);
    if (X/D > K) {
        cout << X - (K * D) << endl;
    }else{
        ll e = (X / D);
        K -= e;
        X -= e * D;
        if (K % 2 == 0)
            cout << X << endl;
        else
            cout << abs(X - D) << endl;
    }
    return 0;
}

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

using namespace std;

void setIO() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DEBUG
    //freopen("solution.out", "w", stdout);
    freopen("1.in", "r", stdin);
#endif
}
const int mod = 1e9 + 7;

int main() {
    setIO();
    int h, w;
    cin >> h >> w;
    char grid[h][w];
    int dp[h][w];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> grid[i][j];
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (grid[i][j] == '#') {
                continue;
            }
            if (i > 0) {
                dp[i][j] += dp[i - 1][j];
                dp[i][j] %= mod;
            }
            if (j > 0) {
                dp[i][j] += dp[i][j - 1];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp[h - 1][w - 1] << "\n";
    return 0;
}


Measured memory_bytes: 8396
#include <stdio.h>
int main()
{
  int i,j,n,m,cn;
  char c,s[5]={'S','H','C','D','\0'};
  static int card[4][13];
  scanf("%d\n",&n);
  for(i=0;i<n;i++)
  {
    scanf("%c %d\n",&c,&m);
    for(j=0;j<4;j++)
      if(s[j]==c)
        card[j][m-1]=1;
  }
  for(i=0;i<4;i++)
    for(j=0;j<13;j++)
      if(card[i][j]==0)
        printf("%c %d\n",s[i],j+1);
  return 0;
}
    



Measured memory_bytes: 2052
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

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

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()
#include <bitset>
using namespace std;


int main(){
    LL N, M;
    cin >> N >> M;
    LL h = (1LL<<N);
    vector<vector<LL>> tab(M+1, vector<LL>(h, INF));
    tab[0][0]=0;

    rep(i,M){
        LL a, b;
        cin >> a >> b;
        uint mask=0;
        rep(j,b){
            uint c;
            cin >> c;
            mask |= (1ull<<(c-1));
        }

        //std::bitset<12> y(mask);
        //cout << y << endl;

        rep(j,h){
            tab[i+1][j]=tab[i][j];
        }

        for(uint src=0; src<h; src++){
            uint dst = (src|mask);
            tab[i+1][dst] = min(tab[i+1][dst], tab[i][src]+a);
        }
    }

    /*
    rep(i,M+1){
        rep(j, h){
            cout << tab[i][j] << " ";
        }
        cout << endl;
    }*/

    LL ans = tab[M][h-1];
    cout << (ans < INF ? ans : -1) << endl;

    return 0;
}


Measured memory_bytes: 32384
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

int main() {
	ll x; cin >> x;
	ll ans = 2 * (x / 11);
	x %= 11;
	if (x > 6)ans += 2;
	else if(x!=0)++ans;
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/abc119/tasks/abc119_b

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 10

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int N;
double x[MAX];
string u[MAX];

int main() {
    cin >> N;

    double ans = 0;
    REP(i, N) {
        cin >> x[i] >> u[i];
        double price = 0;
        if (u[i]=="BTC") {
            price = x[i] * 380000;
        } else {
            price = x[i];
        }
        ans += price;
    }

    print(ans);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());

            var b = a * 800;
            int c = (int)(a / 15f);
            c *= 200;
            int d = b - c;
            Console.Write(d);
        }
    }
}


Measured memory_bytes: 11092
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args)throws IOException{
        int n, i;

        InputStreamReader isr =new InputStreamReader(System.in);
   		BufferedReader br =new BufferedReader(isr);
    	String buf = br.readLine();
        n = Integer.parseInt(buf);
        
        
        for (i = 1;i <= n;i++) {
            if (i % 3 == 0) System.out.printf(" %d", i);
            else if (i % 10 == 3) {
                System.out.printf(" %d", i);
            }
            else if (i / 10 > 0 && (i / 10) % 10 == 3) {
                System.out.printf(" %d", i);
            }
            else if (i / 100 > 0 && (i / 100) % 10 == 3) {
                System.out.printf(" %d", i);
            }
            else if (i / 1000 > 0 && (i / 1000) % 10 == 3) {
                System.out.printf(" %d", i);
            }
            else if (i / 10000 > 0 && (i / 10000) % 10 == 3) {
                System.out.printf(" %d", i);
            }
        }
        System.out.printf("\n");
    }
}

Measured memory_bytes: 35988
#include <bits/stdc++.h>
using namespace std;
int main() {
  int count=0;
  int tmp, max;
  
  int N; cin >> N; vector<int> vec(N);
  for(int i=0; i<N; i++) cin >> vec.at(i);

  for(int i=0; i<N; i++){
    max=i;
    for(int j=i; j<N; j++){
      if(vec.at(j) > vec.at(max)) max=j;
    }
    tmp=vec.at(i);
    vec.at(i)=vec.at(max);
    vec.at(max)=tmp;
  }
  
  for(int i=0; i<N-1; i++){
    if(vec.at(i)==vec.at(i+1)) count++;
  }
  
  cout << N-count << endl;
  
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        char[] arr1 = in.nextLine().toCharArray();
        char[] arr2 = in.nextLine().toCharArray();
        in.close();
        StringBuilder sb = new StringBuilder();
        int len1 = arr1.length, len2 = arr2.length, maxl = 0;
        
        int[][] dp = new int[len1+1][len2+1];

        
        for(int i = 1; i <= len1; i++)
        {
            for(int j = 1; j <= len2; j++)
            {
                if(arr1[i-1] == arr2[j-1])
                {   
                    dp[i][j] = 1 + dp[i-1][j-1];
                }
                else{
                    dp[i][j] = Math.max(dp[i][j-1], dp[i-1][j]);
                }
            }

        }
        //TO DO: constructing the path
        while(dp[len1][len2] > 0){
            if(arr1[len1-1] == arr2[len2-1]){
                sb.append(arr1[len1-1]);
                len1--;
                len2--;
            }
            else{
                if(dp[len1][len2] == dp[len1][len2-1]){
                    len2--;
                }
                else{
                    len1--;
                }
            }
        }
        System.out.println(sb.reverse().toString());
    }
}

Measured memory_bytes: 81092
N,K,Q = list(map(int,input().split()))

A = [int(input()) for i in range(Q)]

ans_list = [0]*N

for a in A:
    ans_list[a-1]+=1

S = sum(ans_list)

for i in range(N):
    if S-ans_list[i]>=K:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 56664
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int NM=(int)1e5;

int main(){
    int N;
    int A[NM];
    cin>>N;
    for(int i=0;i<N;++i) scanf("%d",&A[i]);

    int ans=1;
    for(int i=0;i+1<N;++i){
        bool up=true;
        if(A[i]>A[i+1]){
            up=false;
        }else if(A[i]<A[i+1]){
            up=true;
        }else{
            continue;
        }
        while(i+2<N){
            i++;
            if(up){
                if(A[i]>A[i+1]){
                    ans++;
                    break;
                }
            }else{
                if(A[i]<A[i+1]){
                    ans++;
                    break;
                }
            }
        }

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

Measured memory_bytes: 640
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  string s;
  cin >> s;
  int t = 0;
  for(auto c : s) t += c == 'x';
  cout << (t <= 7 ? "YES" : "NO") << endl;
  return 0;
}


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

const int MOD = (int)1e9+7;

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

	vector<int> x(4);
	for(int i=0;i<4;i++){
		x.at(i)=S.at(i)-'0';
	}
	int aa=x.at(0)*10+x.at(1);
	int bb=x.at(2)*10+x.at(3);
	if(1<=aa && aa<=12 && 1<=bb && bb<=12)	cout << "AMBIGUOUS" << endl;
	else if(1<=aa && aa<=12)	cout << "MMYY" << endl;
	else if(1<=bb && bb<=12)	cout << "YYMM" << endl;
	else	cout << "NA" << endl;

	return 0;
}


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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int n; // 荷物の個数
int k; // トラック台数
vector<ll> w; // 荷物の重さ

// トラック積載量がpのときに、荷物をいくつ搭載することができるか
ll check(ll p) {
    // ll limit = p * k;
    // ll sum = 0;
    // int i;
    // for (i = 0; i < w.size(); ++i) {
    //     sum += w[i];
    //     if (sum > limit) {
    //         break;
    //     }
    // }
    int i = 0;
    for (int j = 0; j < k; ++j) {
        ll s = 0;
        // トラックに空きあるかのチェック
        while (s + w[i] <= p) {
            s += w[i];
            i++;
            // 全部詰められたなら全部を返却
            if (i == n) return n;
        }
    }
    return i;
}

ll solve() {
    // 範囲は P
    ll left = 0;
    ll right = 100000 * 10000;
    ll mid;
    // 検索範囲が1つ以下になったら終了
    while (right - left > 1) {
        mid = (right - left) / 2 + left;

        ll v = check(mid);

        if (v >= n) right = mid;
        else left = mid;

    }
    return right;
}

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

    rep(i, n) {
        ll a;
        cin >> a;
        w.push_back(a);
    }

    ll ans = solve();

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3924
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


t = int(input())

def floor_sum(n,m,a,b):
    """sum(((a*i+b)//m) for i in range(n))
    """
    ans = 0
    if a>=m:
        ans += (n-1)*n*(a//m)//2
        a %= m
    if b>=m:
        ans += n*(b//m)
        b %= m
    y_max = (a*n + b) // m
    x_max = y_max*m - b
    if y_max==0:
        return ans
    ans += (n - (x_max+a-1)//a) * y_max
    ans += floor_sum(y_max, a, m, (a - x_max%a)%a)
    return ans
for _ in range(t):
    n,m,a,b = list(map(int, input().split()))
    print(floor_sum(n,m,a,b))

Measured memory_bytes: 77772
#include <bits/stdc++.h>
using namespace std;
typedef long int ll;
typedef unsigned long long ull;
 
 
int main()
    {
        int n;
        cin >> n;
        int arr[n][3] , dp[n][3];
       for(int i=0;i<n;i++){
       		for(int j=0;j<3;j++)cin>>arr[i][j];
       }
   		for(int i=0;i<3;i++){
   			dp[0][i] = arr[0][i];
   		}
   		for(int i=1;i<n;i++){
   			for(int j=0;j<3;j++){
 
 
   			dp[i][j] = max(dp[i-1][(j+1)%3] , dp[i-1][(j+2)%3]) + arr[i][j];
   			}
   		}
        int ans = 0;
        ans = max(dp[n-1][0] , dp[n-1][1]);
        ans = max( ans , dp[n-1][2]);
        cout<<ans;
    
	return 0;
}

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

int main() {
  int n,a,b;
  cin >> n >> a;
  b = n % 500;
  if(b-a <= 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}

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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 2 * (1e5 + 1);
const int INF = 1e9 + 5;
const long long MOD = 1e9 + 7;

int32_t main() {
    FAST_IO;
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int a1 = a * b;
    int a2 = c * d;
    cout << max(a1, a2);
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}



fn main() {
    let c: char = read();
    let ans = if c.is_uppercase() {"A"} else {"a"};
    println!("{}", ans);
}


Measured memory_bytes: 2080
#!/usr/bin/env python


def main():
    N, M = [int(a) for a in input().split()]
    A = [
        set([int(a) for a in input().split()][1:])
        for _ in range(N)
    ]

    r = A[0]
    for k in A[1:]:
        r = r.intersection(k)
    print(len(r))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
s = input()
temp = s[0]
k = 1
s = s[1:]
while True:
    if len(s) == 2 and s[0] == s[1]:
        k += 1
        break
    elif len(s) >= 1:
        if s[0] == temp:
            temp = s[0:2]
            s = s[2:]
            k += 1
        else:
            temp = s[0]
            s = s[1:]
            k += 1
    else:
        break
print(k)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define N 200005

using namespace std;

int n;
int a[N];
map < int , int > b;

bool ok(int mij)
{
    int i , k;

    b.clear();

    for(i = 2 ; i <= n ; i++)
        if(a[i] <= a[i - 1])
        {
            b.erase(b.upper_bound(a[i]) , b.end());
            k = a[i];
            ++b[k];

            while(k > 0 && b[k] == mij)
            {
                b.erase(k);
                ++b[--k];
            }

            if(!k)
                return false;
        }

    return true;
}

int main()
{
    int check = 0 , i;

    cin >> n;

    for(i = 1 ; i <= n ; i++)
    {
        cin>>a[i];
        check |= (a[i] <= a[i - 1]);
    }

    if(!check)
    {
        cout<<1;
        return 0;
    }

    int st = 2 , dr = n , mij = 0 , ans = 0;

    while(st <= dr)
    {
        mij = (dr - st) / 2 + st;

        if(ok(mij) == true)
        {
            ans = mij;
            dr = mij - 1;
        }
        else st = mij + 1;
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
const long double M_PI = 3.14159265358979323846265;
const ll INFL = 1LL << 60;//10^18 = 2^60
//ll MOD = 998244353;
void pres(long double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}


//Union Find
const ll MAX_V = 1000010;

ll par[MAX_V];//
ll Rank[MAX_V];
ll child[MAX_V];

void init_UF(){
  for(ll i = 0; i < MAX_V; i++){
    par[i] = i;
    Rank[i] = 1;
    child[i] = 1;
  }
}

ll find(ll x){
  if(par[x] == x) return x;
  else{
    return par[x] = find(par[x]);
  }
}

bool same(ll x, ll y){
  return find(x) == find(y);
}

void unite(ll x, ll y){
  ll rx = find(x), ry = find(y);
  if(rx != ry){
    if(Rank[rx] >= Rank[ry]){
      par[ry] = rx;
      if(Rank[rx] == Rank[ry]) Rank[rx]++;
      child[rx] += child[ry];
    }else{
      par[rx] = ry;
      child[ry] += child[rx];
    }
  }
}

void compress(vector<ll> &S){
  vector<ll> xs;
  rep(i, S.size()) xs.push_back(S[i]);
  sort(xs.begin(), xs.end());
  xs.erase(unique(xs.begin(), xs.end()), xs.end());
  rep(i, S.size()){
    S[i] = lower_bound(xs.begin(), xs.end(), S[i]) - xs.begin();
  }
}



int main(){
  init_UF();
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  ll Axor = 0, Bxor = 0;
  rep(i, N){
    cin >> A[i];
    Axor ^= A[i];
  }
  rep(i, N){
    cin >> B[i];
    Bxor ^= B[i];
  }
  bool same = 1;
  rep(i, N){
    if(A[i] != B[i]) same = 0;
  }
  if(same){
    cout << 0 << endl;
    return 0;
  }

  map<ll, ll> b;
  rep(i, N){
    b[B[i]]++;
  }
  b[Bxor]++;
  rep(i, N){
    b[A[i]]--;
  }
  b[Axor]--;
  rep(i, N){
    if(b[B[i]]){
      cout << -1 << endl;
      return 0;
    }
  }


  vector<ll> X, Y;
  rep(i, N){
    if(A[i] != B[i]){
      X.pb(A[i]);
      Y.pb(B[i]);
    }
  }


  //Axor, X, Y;
  X.pb(Axor);
  Y.pb(Bxor);
  compress(X);
  compress(Y);
  Axor = X.back();
  Bxor = Y.back();
  N = X.size();

  rep(i, N){
    unite(X[i], Y[i]);
  }

  ll con = 0;
  set<ll> used;
  rep(i, N-1){
    ll x = find(X[i]);
    if(used.count(x)) continue;
    used.insert(x);
    con++;
  }
  if(child[find(X[N-1])] != 1) con--;
  cout << N - 1 + con << endl;

}


Measured memory_bytes: 35404
n=int(input())
a=list(map(int,input().split()))
x=0
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            x=1
            break
if x==1:
    print('DENIED')
else:
    print('APPROVED')
        

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
const long long MOD = 1e9 + 7;

///////////////////////////////////////////////
// for template
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() {
    bool x; cin >> x;
    cout << !x << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int N;
int main(){
  cin>>N;
  int table[10][10];
  memset(table, 0, sizeof(table));
  rep(i,1,N+1){
    string s = to_string(i);
    int r = s.back() - '0';
    int l = s[0] - '0';
    if(r==0 || l==0) continue;
    table[r][l]++;
  }
  ll cnt=0;
  rep(i,1,10)rep(j,1,10){
    cnt += table[i][j] * table[j][i];
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct {
    int p, y, i;
} state;

int comp(state *a, state *b);

int id[2][100005];
int ken[100005];
state a[100005];

int main()
{
    int n, m;
    int i, j;

    scanf("%d %d", &n, &m);
    for (i = 0; i < m; i++) {
        scanf("%d %d", &a[i].p, &a[i].y);
        a[i].i = i;
    }

    qsort(a, m, sizeof(state), (int (*)(const void *, const void *))comp);

    for (i = 0; i < m; i++) {
        ken[a[i].p]++;

        id[0][a[i].i] = a[i].p;
        id[1][a[i].i] = ken[a[i].p];
    }
    
    for (i = 0; i < m; i++) {
        printf("%06d%06d\n", id[0][i], id[1][i]);
    }

    return 0;
}

int comp(state *a, state *b)
{
    if (a->y > b->y) {
        return 1;
    } else if (a->y == b->y) {
        return 0;
    } else if (a->y < b->y) {
        return -1;
    }
}


Measured memory_bytes: 3820
a, b = map(int, input().split())
num = 1
tap_num = a
new_b = b
if b == 1:
    print(0)
else:
    while True:
        if b - tap_num > 0:
            num += 1
            tap_num += (a - 1)
        else:
            print(num)
            break

Measured memory_bytes: 2940
//Anshul Gupta


#include<iostream>
#include <fstream>
#include<algorithm>
#include<vector>
#include<utility>
#include<climits>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<assert.h>
#include<iomanip>

using namespace std;
	
#define f first
#define s second
#define sz(a) int((a).size()) 
#define pb push_back 
#define mp make_pair
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef long long ll;

typedef struct node{
	ll val,more=0,less=0;
	bool operator <(const node& a){
		return val<a.val;
	}
}node;

typedef pair<int,int> pi;
typedef pair<pi,int> pii;
typedef pair<pi,pi > pi2;

typedef pair<ll,ll> pl;
typedef pair<pl,ll> pll;
typedef pair<pl,pl > pl2;

typedef vector<node> vn;

typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
typedef vector<pi2 > vpi2;

typedef vector<ll> vl;
typedef vector<pl> vpl;
typedef vector<pll> vpll;
typedef vector<pl2 > vpl2;

const int M=1000000007;


int main(){

	/*int n,k;
	cin>>n>>k;
	ll div=pow(n/k,3);
	if(k&1){
		return cout<<div,0;
	}
	ll fac=pow((n-1)/k+1,3);
	ll r=3*k/2;
	ll temp=(r+2)*(r+1)*r/6-3*(r-k+2)*(r-k+1)*(r-k)/6;
	temp*=fac;
	if(n%k==0){
		temp+=(r)
	}*/

	int l;
	cin>>l;

	if(l<60){
		cout<<2<<" "<<l<<"\n";
		for(int i=0;i<l;i++)
			cout<<1<<" "<<2<<" "<<i<<"\n";
		return 0;
	}
	int cnt=1,a=l,edges=0,wt;
	while(a>1){
		edges+=a&1;
		cnt++;
		a>>=1;
	}
	edges+=(cnt-1)<<1;
	cout<<cnt<<" "<<edges<<"\n";
	wt=1<<(cnt-2);
	for(int i=1;i<cnt;i++){
		cout<<i<<" "<<i+1<<" "<<wt<<"\n";
		cout<<i<<" "<<i+1<<" "<<0<<"\n";
		wt>>=1;
	}
	wt=1<<(cnt-1);
	int i=0;
	while(l>1){
		if(l&1){
			cout<<1<<" "<<cnt<<" "<<wt<<"\n";
			wt+=1<<i;
		}
		++i;
		l>>=1;
		cnt--;
	}
	return 0;
}

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

using namespace std;
int main()
{

    int n;
    cin>>n;
    int ac = 0; int wa = 0; int tle = 0; int re = 0;
    while(n--){
        string s;
        cin>>s;
        if(s.compare("AC")==0){
            ac++;
        }
        else if(s.compare("WA")==0){
            wa++;
        }
        else if(s.compare("TLE")==0){
            tle++;
        }
        else if(s.compare("RE")==0){
            re++;
        }
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;


}


Measured memory_bytes: 3636
s=int(input())
s1=s//100
s2=s%100
if 12>=s1>=1 and 12>=s2>=1:
    ans="AMBIGUOUS"
elif 12>=s1>=1 and not 12>=s2>=1:
    ans="MMYY"
elif 12>=s2>=1 and not 12>=s1>=1:
    ans="YYMM"
else:
    ans="NA"
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
using namespace atcoder;

using mint = modint998244353;

struct S {
    mint a;
    mint w;
};

struct F {
    mint d;
};

S op(S l, S r) { return  S{l.a*r.w + r.a, l.w*r.w};}

S e() { return S{0, 1}; }

S mapping(F l, S r) { 
    if(l.d == 0){
        return r;
    }else{
        return S{(l.d*(r.w - 1))/mint(9), r.w};
    }
}

F composition(F l, F r) {
    if(l.d == 0){
        return F{r.d};
    }
    return F{l.d}; 
}

F id() { return F{0};}

int main(){
    int N,Q;
    cin >> N >> Q;
    vector<int> L(Q),R(Q),D(Q);
    rep(i,Q){
        cin >> L[i] >> R[i] >> D[i];
        L[i]--;
    }
    vector<S> aaa(N);
    rep(i,N){
        aaa[i] = S{1,10};
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(aaa);
    //cout << seg.prod(0,2).a.val() << endl;
    rep(i,Q){
        seg.apply(L[i], R[i], F{D[i]});
        cout << seg.all_prod().a.val() << endl;
    }
    //cout << ans << endl;
}

Measured memory_bytes: 12272
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

total = (K + 1) * K // 2
count = 0
for i, Ai in enumerate(A):
    for j in range(i, len(A)):
        if Ai > A[j]:
            count += 1 
sortA = sorted(A, reverse=True)
sort_count = 0
for i, sortAi in enumerate(sortA):
    for j in range(i, len(sortA)):
        if sortAi > sortA[j]:
            sort_count += 1 
            
sub = (sort_count - count) * K
print((total * sort_count - sub) % (10**9 + 7))

Measured memory_bytes: 3188
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #ここにコード
    #input
    N, M, K = map(int, input().split())

    #output
    mod = 998244353

    n_ = 4*10**5 + 5
    fun = [1]*(n_+1)
    for i in range(1,n_+1):
        fun[i] = fun[i-1]*i%mod
    rev = [1]*(n_+1)
    rev[n_] = pow(fun[n_],mod-2,mod)
    for i in range(n_-1,0,-1):
        rev[i] = rev[i+1]*(i+1)%mod
    def cmb(n,r):
        if n <= 0 or r < 0 or r > n: return 0
        return fun[n]*rev[r]%mod*rev[n-r]%mod

    answer = 0
    for i in range(K+1):
        answer += M*pow(M-1, N-(i+1), mod)*cmb(N-1, i) % mod

    answer %= mod

    if N == 1:
        print(M)
        exit()

    print(answer)
    

if __name__ == "__main__":
    main()

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n;
    cin >> n;

    vi v(n), c(n);
    rep(i, 0, n) { cin >> v[i]; }
    rep(i, 0, n) { cin >> c[i]; }

    int ans = 0;
    rep(i, 0, n) { ans += max(0, v[i] - c[i]); }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
// <------------- Template -----------------------> //


#include<bits/stdc++.h>
using namespace std;

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(0);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
#define N 1000000007 // prime modulo value 

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	2 * 1e18;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAX5];

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, q, m, k;
string s, t, d;
ll sum = 0;
ll cou = 0;


// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n ;
	vll a(n);
	vll pre(n);
	vll suf(n);
	for(ll i=0;i<n;i++) cin>>a[i];
	pre[0] = a[0];
	for(ll i=1;i<n;i++) pre[i]+=pre[i-1]+a[i];
	suf[n-1] = a[n-1];
	for(ll i=n-2;i>=0;i--) suf[i]+=suf[i+1]+a[i];
	ll mini = INF;
	//DISP(pre);
	//DISP(suf);
	for(ll i=0;i<n-1;i++) {
		mini = min(mini,abs(pre[i]-suf[i+1]));
	}
	cout<<mini;
}

int main() {
	fastio; randomINT;
	//cin>>T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 10240
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
deque<ll> ans;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    ans.push_back(a[0]);
    if(n%2==0){
        rrep(i,1,n){
            if(i%2==1)ans.push_front(a[i]);
            else ans.push_back(a[i]);
        }
    }
    else{
        rrep(i,1,n){
            if(i%2==0)ans.push_front(a[i]);
            else ans.push_back(a[i]);
        }
    }
    rep(i,n){
        if(i==n-1)Cout(ans[i]);
        else cout<<ans[i]<<" ";
    }
    return 0;
}


Measured memory_bytes: 6012
/*************************************************************************
	> File Name: 4.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/9/19 20:03:00
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
struct node{
	int x,y;
}a[1100];
int c[1100];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int n=read();
	For(i,1,n){
		a[i].x=read(),a[i].y=read();
		if(a[i].x==a[i].y) c[i]=1;
		else c[i]=0;
	}
	For(i,3,n)
		if(c[i]==1 && c[i-1]==1 && c[i-2]==1){
			printf("Yes");
			return 0;
		}
	printf("No");
	return 0;
}


Measured memory_bytes: 3772