akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;

    if ((A * B) % 2 == 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


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

using ll=long long;
using namespace std;

#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}

const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

char BigAlphaToSmall(char a){
    if (a >= 65 && a <= 90){
        return a + 32;
    }
    return a;
}

char SmallAlphaToBig(char a){
    if (a >= 97 && a <= 122){
        return a - 32;
    }
    return a;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n; cin >> n;
    vector<int> hoge(n);
    rep_i(i, n) cin >> hoge[i];
    
    int q; cin >> q;
    int b, e;
    rep_i(i, q){
        cin >> b >> e;
        reverse(&hoge[b], &hoge[e]);
    }
    
    rep_i(i, n){
        if(i == n - 1){
            cout << hoge[i] << endl;
            break;
        }
        cout << hoge[i] << " ";
    }
}


Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n, m; cin>>n>>m;
    vector<vector<int>> lang(m);
    for(int i=0; i<n; i++){
        int k; cin>>k;
        for(int j=0; j<k; j++){
            int l; cin>>l;
            l--;
            lang[l].eb(i);
        }
    }

    vector<vector<int>> adj(n);
    for(int i=0; i<m; i++){
        for(int j=0; j+1<lang[i].size(); j++){
            adj[lang[i][j]].eb(lang[i][j+1]);
            adj[lang[i][j+1]].eb(lang[i][j]);
        }
    }

    vector<bool> visited(n, false);
    visited[0]=true;
    queue<int> que;
    que.push(0);

    int cnt=1;
    while(que.size()){
        int cv=que.front(); que.pop();

        for(auto nv:adj[cv]){
            if(!visited[nv]){
                que.push(nv);
                visited[nv]=true;
                cnt++;
            }
        }
    }

    if(cnt==n) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
vector<vector<int>>G;
list<int>out;
vector<bool>V;
int N;
vector<int>indeg;

void bfs(int s) {
	queue<int>q;
	q.push(s);
	V[s] = true;
	while (!q.empty()) {
		int u = q.front(); q.pop();
		out.push_back(u);
		for (int i = 0; i < G[u].size(); i++) {
			int v = G[u][i];
			indeg[v]--;
			if (indeg[v] == 0 && !V[v]) {
				V[v] = true;
				q.push(v);
			}
		}
	}
}

void tsort() {
	indeg = vector<int>(N, 0);
	rep(u, 0, N) {
		rep(i, 0, G[u].size()) {
			int v = G[u][i];
			indeg[v]++;
		}
	}
	rep(u, 0, N) {
		if (indeg[u] == 0 && !V[u])bfs(u);
	}
	each(it,out)cout << *it << endl;
}
signed main() {
	int s, t, M;
	cin >> N >> M;
	V = vector<bool>(N, false); G = vector<vector<int>>(N, vector<int>());
	rep(i, 0, M) {
		cin >> s >> t;
		G[s].push_back(t);
	}
	tsort();
	return 0;
}

Measured memory_bytes: 3780
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

d = inn()
c = inl()
s = []
for i in range(d):
    s.append(inl())
t = []
for i in range(d):
    t.append(inn()-1)
last = [-1]*26
sm = 0
for i in range(d):
    tt = t[i]
    sm += s[i][tt]
    last[tt] = i
    for j in range(26):
        sm -= c[j]*(i-last[j])
    print(sm)


Measured memory_bytes: 68512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	double t,a;
	cin>>n>>t>>a;
	double h[n+1];
	double minn=10000;
	int ind;
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
		h[i]=t-h[i]*0.006;
		double cha=abs(h[i]-a);
		if(cha<minn)
		{
		   minn=cha;
		   ind=i;
		}   
	}
	cout<<ind<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n ;
    cin>>n;
    int arr[n][3],temp[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        cin>>arr[i][j];
    }
    temp[0][0]=arr[0][0];
    temp[0][1]=arr[0][1];
    temp[0][2]=arr[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            temp[i][j]=arr[i][j]+max(temp[i-1][(j+1)%3],temp[i-1][(j+2)%3]);
        }
    }

    int win;
    if(temp[n-1][0]>=temp[n-1][1]&&temp[n-1][0]>=temp[n-1][2])
        win=temp[n-1][0];
    else if(temp[n-1][1]>=temp[n-1][0]&&temp[n-1][1]>=temp[n-1][2])
        win=temp[n-1][1];
    else
        win=temp[n-1][2];

    cout<<win;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	ll n,i,key,j;
	
	cin>>n;
	
	vector<ll> a(n+1);
	
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	
	for(i=0;i<n;i++){
		key=a[i];
		j=i-1;
		while(j>=0 && a[j]>key){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=key;
		for(j=0;j<n-1;j++){
			cout<<a[j]<<" ";
		}
		cout<<a[n-1]<<"\n";
	}
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define ll                  long long
#define ld                  long double
#define pb                  push_back
#define mkp                 make_pair
#define f(i,l,h)            for(ll i=l;i<h;i++)
#define fr(i,h,l)           for(ll i=h;i>=l;i--)
#define mem(a,val)          memset(a,val,sizeof(a))
#define all(v)              (v).begin(),(v).end()
#define ff                  first
#define ss                  second
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
const ld pi=3.14159265359;
const ll mod=998244353;
const ll INF=(ll)(1e9+7);
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

bool check(ll arr[],ll n){
    bool flag=true;
    for(ll i=1;i<=n;i++){
        if(arr[i]!=n){
            flag=false;
            break;
        }
    }
    return flag;
}

void upd(ll bit[],ll n,ll index,ll val){
    while(index<=n){
        bit[index]+=val;
        index+=(index&(-index));
    }
}

ll getSum(ll bit[], ll n,ll index ){
    ll sum=0;
    while(index>0){
        sum+=bit[index];
        index-=index&(-index);
    }
    return sum;
}

int main()
{
    //cout << "Hello world!" << endl;
    ll n,k;
    cin>>n>>k;
    ll a[n+1];
    a[0]=0;
    f(i,1,n+1) cin>>a[i];
    ll cnt=0;



    while(!check(a,n) && cnt<k){
        ll bit[n+1];
        mem(bit,0);
        f(i,1,n+1){
            upd(bit,n,max(1ll,i-a[i]),1);
            if(i+a[i]<n) upd(bit,n,i+a[i]+1,-1);
        }
        f(i,1,n+1){
            a[i]=getSum(bit,n,i);
        }
        cnt++;
    }

    for(ll i=1;i<=n;i++){
        cout<<a[i]<<" ";
    }

    return 0;
}


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

using namespace std;

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

  string s;
  int k;
  cin >> s >> k;
  int n = s.size(), cnt = 0;
  bool one = true;
  for (int i = 0; i < n; ++i) {
    one &= s[i] == s[0];
  }
  if (one) {
    cout << 1ll * n * k / 2;
    return 0;
  }
  int cur = 1;
  vector<pair<int, char>> kek;
  for (int i = 1; i < n; ++i) {
    if (s[i] == s[i - 1]) {
      ++cur;
    }
    if (s[i] != s[i - 1] or i == n - 1) {
      kek.emplace_back(cur, s[i - 1]);
      cur = 1;
    }
  }
  long long ans = 0;
  for (int i = 0; i < kek.size(); ++i) {
    if (i == 0 and kek.front().second == kek.back().second) {
      ans += kek.front().first / 2;
      ans += 1ll * (kek.front().first + kek.back().first) / 2 * (k - 1);
    } else if (i == kek.size() - 1 and kek.front().second == kek.back().second) {
      ans += kek.back().first / 2;
    } else {
      ans += 1ll * kek[i].first / 2 * k;
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (r, g, b, n) = readIntegerList()
    var ans = 0L
    for (i in 0..n) {
        for (j in 0..n) {
            val k = n - (i * r) - (j * g)
            if (k >= 0 && k % b == 0) {
                ans++
            }
        }
    }
    println(ans)
}


fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 35948
#include <iostream>
#include <string>

using namespace std;

struct SE {
	int from;
	int to;
};

string s;
int A = 0;
int k = 0;
int L[10001];
SE se[10001];
int area;
int depth;
int length;

int tobasu(int from) {
	int i = from;
	while (i < length && s[i] != '\\') {
		++i;
	}
	return i;
}

int reverse_tobasu(int from, int to) {
	int i = from;
	while (to <= i && s[i] != '/') {
		--i;
	}
	return i;
}

int calc_area(int from, int to) {
	int d = 0;
	int a = 0;
	for (int l = from; l <= to; ++l) {
		if (s[l] == '\\') {
			a += (d + 1);
			d += 2;
		}
		else if (s[l] == '_') {
			a += d;
		}
		else {
			a += (d - 1);
			d -= 2;
		}
	}
	return a / 2;
}

int main() {
	int k2;
	cin >> s;
	//s = "\\/\\_/\\/__////////_/\\/_\\__\\\\\\/__/_/////\\/\\\\_\\\\_\\\\//////_/\\_//\\\\//___/___\\_\\\\/_//////\\_/\\/\\/_/\\//\\_///\\/_/_/\\\\/_/\\/_/\\//__\\//____///\\_/_///_///\\//_\\_\\//////_/\\//\\/\\//_//_/\\_\\/\\_\\\\/\\/////\\/\\_/_/___/__\\_/";
	length = s.size();
	int i = tobasu(0);

	if (i == length) {
		cout << 0 << endl;
		cout << 0 << endl;
		return 0;
	}

	int from, to;
	depth = 0;
	from = i;
	bool flag = false;

	while (i < length) {
		if (s[i] == '\\') {
			++depth;
		}
		else if (s[i] == '/') {
			--depth;
			flag = true;
		}

		if (depth == 0) {
			to = i;
			++k;
			se[k].from = from;
			se[k].to = to;
			++i;
			i = tobasu(i);
			from = i;
			flag = false;
		}
		else {
			++i;
		}
	}
	if (flag == false) {
		;
	}
	else {
		k2 = k;
		int from_here = from;
		i = length - 1;
		i = reverse_tobasu(i, from_here);
		depth = 0;
		to = i;
		while (from_here <= i) {
			if (s[i] == '/') {
				++depth;
			}
			else if (s[i] == '\\') {
				--depth;
			}

			if (depth == 0) {
				from = i;
				++k;
				se[k].from = from;
				se[k].to = to;
				--i;
				i = reverse_tobasu(i, from_here);
				to = i;
			}
			else {
				--i;
			}
		}
		int k3 = k - k2;
		k3 = k3 / 2;
		for (int k4 = 1; k4 <= k3; ++k4) {
			SE temp = se[k2 + k4];
			se[k2 + k4] = se[k - k4 + 1];
			se[k - k4 + 1] = temp;
		}
	}



	for (int j = 1; j <= k; j++) {
		L[j] = calc_area(se[j].from, se[j].to);
		A += L[j];
	}


	cout << A << endl;
	cout << k;
	for (int j = 1; j <= k; j++) {
		cout << " " << L[j];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1276
import java.util.Scanner;

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

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] a = new long[N];
		long answer = 0L;
		for (int i = 0; i < N; i++) {
			a[i] = sc.nextLong();
		}
		while(true) {
			long plus = 0L;
			for (int i = 0; i < N; i++) {
				long div = a[i] / N;
				plus += div;
				a[i] = (a[i] % N) - div;
			}
			if (plus == 0) {
				break;
			} else {
				answer += plus;
				for (int i = 0; i < N; i++) {
					a[i] += plus;
				}
			}
		}
		System.out.println(answer);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    ll ans = 0;
    for(int i = K+1;i <= N;i++){
        ans += max(0,(N / i) * (i - K));
        ans += max(0,(N % i) - K + 1);
    }
    if(K == 0)ans = (ll)N*N;
    cout << ans << endl;
}

Measured memory_bytes: 256
def actual(N: int, D1: list, D2: list) -> str:
    cnt = 0
    is_turkey = False
    for d1, d2 in zip(D1, D2):
        is_zoro = d1 == d2

        if is_zoro:
            cnt += 1
            if cnt == 3:
                is_turkey = True
        else:
            cnt = 0

    if is_turkey:
        return 'Yes'
    else:
        return 'No'
    
N = int(input())
D1, D2 = [],[]

for _ in range(N):
    d1,d2 = map(int, input().split())
    D1.append(d1)
    D2.append(d2)
    
    
print(actual(N,D1,D2))



Measured memory_bytes: 9204
class LazySegmentTreeBase
  def initialize(arr, l = 0, r = arr.size - 1)
    @l, @r = l, r
    @lazy = nil
    if l == r
      @agg = arr[l]
    else
      c = (l + r) / 2
      @left_child = self.class.new(arr, l, c)
      @right_child = self.class.new(arr, c + 1, r)
      @agg = aggregation_of(@left_child.agg, @right_child.agg)
    end
  end

  attr_reader :agg, :l, :r

  def update(l, r, x)
    if l == @l && r == @r
      defer(x)
    else
      force
      if r <= @left_child.r
        @left_child.update(l, r, x)
      elsif @right_child.l <= l
        @right_child.update(l, r, x)
      else
        @left_child.update(l, @left_child.r, x)
        @right_child.update(@right_child.l, r, x)
      end
      @left_child.force
      @right_child.force
      @agg = aggregation_of(@left_child.agg, @right_child.agg)
    end
  end

  def force
    return if !@lazy
    x = @lazy
    @lazy = nil
    whole_update(x)
    @left_child.update(@left_child.l, @left_child.r, x) if @left_child
    @right_child.update(@right_child.l, @right_child.r, x) if @right_child
  end

  def query(l, r)
    force
    return @agg if l == @l && r == @r
    if r <= @left_child.r
      return @left_child.query(l, r)
    elsif @right_child.l <= l
      return @right_child.query(l, r)
    else
      agg_left = @left_child.query(l, @left_child.r)
      agg_right = @right_child.query(@right_child.l, r)
      return aggregation_of(agg_left, agg_right)
    end
  end
end

class LazySegmentTree < LazySegmentTreeBase
  def defer(x)
    @lazy = x
  end

  def whole_update(x)
    @agg = x if @l == @r
  end

  def aggregation_of(x, y)
    nil
  end
end

n, q = gets.split.map(&:to_i)
seg = LazySegmentTree.new(Array.new(n, 2 ** 31 - 1))
q.times do
  c, x, y, z = gets.split.map(&:to_i)
  if c == 0
    seg.update(x, y, z)
  else
    puts seg.query(x, x)
  end
end


Measured memory_bytes: 34924
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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 n; //頂点数
vector<vector<int> > g;//グラフ
vector<int>d;//到着時刻を記録
vector<int>f;//終了時刻を記録
void dfs(int v,int& i) {
    if(d[v] == 0) {
        i++;
        d[v] = i;//到着時刻を記録
    }    
    
    for(int next_v : g[v]) {
        if(d[next_v]) continue;//訪問済みなら飛ばす
        dfs(next_v,i);//隣接頂点について探索
    }
    if(f[v] == 0) {
        i++;
        f[v] = i;//終了時刻を記録
    }
}
int main() {
    cin >> n;
    //nで初期化
    g.resize(n);
    f.resize(n);
    d.resize(n);
    rep(i,n) {
        int u; //頂点番号
        cin >> u;
        u--;
        int k; //出次数
        cin >> k;
        rep(j,k) {
            int v;//隣接する頂点
            cin >> v;
            v--;
            g[u].push_back(v);
        }
    }
    int count = 0;
    //各頂点からdfs
    for(int i = 0;i<n;i++) {
        dfs(i,count);
    }    
    //各頂点について到着時刻と終了時刻を出力
    for(int i = 0;i<n;i++) {
        cout << i+1 << " " << d[i] << " " << f[i] << endl;
    }
    return 0;
}


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

using namespace std;
#define ll long long
#define ld long double
const int N = 2e5 + 5;
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    for(int i = 1 ; i <= 5 ; i++) {

        int x;
        cin >> x;
        if (x == 0) return cout << i, 0;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#define INF 1000000000
using namespace std;

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

      long long ans = INF;
      for(int i = 0;(i+K-1)<N;i++){
            ans = min(ans, h[i+K-1] - h[i]);
      }
      cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main(){
  ll n; cin >> n;
  if(0 <= (n - 1) % 11  && (n - 1) % 11 <= 5)print((n + 10)/ 11 * 2 - 1);
  else print((n + 10) / 11 * 2);
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

ll sum[SIZE];

int main(){
  int n, m;
  ll suma = 0;
  map<pair<int,int>,int> mm;
  
  scanf("%d%d", &n,&m);

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

    scanf("%d%d", &a,&b);
    suma += a;
    mm[make_pair(a,b)]++;
  }

  
  for(auto it : mm){
    int a = it.first.first;
    int b = it.first.second;
    int c = it.second;
    
    for(int i=b-a;i<=n;i+=b){
      if(i) sum[i] -= (ll)c * b;
      //debug(i);
    }
  }

  for(int i=0;i<n;i++){
    suma += m + sum[i+1];    
    printf("%lld\n",suma);
  }
  
  return 0;
}



Measured memory_bytes: 9856
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    string s;
    cin >> s;
    bool good = true;
    for(int i=1;i<4;++i) {
        if(s[i] == s[i-1]) {
            good = false;
            break;
        }
    }

    cout << (good?"Good\n":"Bad\n");
}


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

typedef long long int ll;
ll n, m, a, b, digits[10];

int main() {
    cin >> n >> m;

    memset(digits, -1, sizeof(digits));

    for(ll i = 0; i < m; ++i) {
        cin >> a >> b;
        //cout << a << ' ' << b << endl;
        if(digits[a - 1] != -1 && digits[a - 1] != b) {
            cout << "-1" << endl;
            return 0;
        }

        if(a == 1 && b == 0 && n > 1) {
            cout << "-1" << endl;
            return 0;
        }

        digits[a - 1] = b;
        //cout << digits[a - 1] << endl;
    }

    if(digits[0] == -1 && n > 1) digits[0] = 1;

    for(ll i = 0; i < n; ++i) {
        if(digits[i] == -1) digits[i] = 0;
    }

    for(ll i = 0; i < n; ++i) cout << digits[i];
    return 0;
}

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

int main(){
    int a[10],b[10];
    int count[10]={0};
    for(int i=0;i<3;i++){
        cin>>a[i]>>b[i];
        count[a[i]]++;
        count[b[i]]++;
    }
    bool ok=true;
    for(int i=1;i<5;i++){
        if(count[i]>2) ok=false;
        else if(count[i]<1) ok=false;
    }
    if(ok) cout<<"YES";
    else cout<<"NO";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define min(X, Y) ((X) > (Y) ? (X) : (Y))

int main()
{
	int n;
	int s[105];
	int sum = 0;
	int ans;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &s[i]);

		sum += s[i];
	}

	ans = (sum % 10 == 0 ? 0 : sum);

	for (int i  = 0; i < n; i++) {
		ans = min(ans, ((sum - s[i]) % 10 == 0 ? 0 : (sum - s[i])));
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 128
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define pb push_back
#define eb emplace_back
#define mt make_tuple
#define MP make_pair
#define fs first
#define sc second
#define F first
#define S second
#define nl "\n"
#define asche cerr<<"Ekhane asche\n";
#define pf printf
#define sf scanf
#define mem(a,x) memset(a,x,sizeof(a))
#define SZ(v) (int)v.size()
#define all(v) v.begin(),v.end()
#define one(x) __builtin_popcount(x)
#define fout(x) fixed<<setprecision(x)
#define BeatMeScanf ios_base::sync_with_stdio(false)
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    deb(++it, args...);
}
//template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
namespace IO
{
    #define in() ( { int a ; scanf("%d",&a); a; } )
    #define LL() ( { ll a ; scanf("%lld",&a); a; } )
    #define ULL() ( { ull a ; scanf("%llu",&a); a; } )
    #define DD() ({ double a; scanf("%lf", &a); a;})
    #define CC() ( { char a ; scanf("%c",&a); a; } )
    #define pf1(a) printf("%d\n",a)
    #define pf1ll(a) printf("%lld\n",a)
}
using namespace IO;

const int mod=1e9+7;
const int N=3e5+9;
const double eps=1e-9;
const double PI=acos(-1.0);
ll qpow(ll n,ll k) {ll ans=1;assert(k>=0);n%=mod;while(k>0){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}


int32_t main()
{
    ///BeatMeScanf;
    string a,b;
    cin>>a>>b;
    int ans=0;
    for(int i=0;i<3;i++) ans+=a[i]==b[i];
    cout<<ans<<nl;
    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


Measured memory_bytes: 256
# -*-coding: utf-8 -*-
import heapq
def main():
    N, M = map(int, input().split())
    A = list(map(lambda x: int(x)*(-1), input().split()))
    heapq.heapify(A)

    for _ in range(M):
        tmp_min = heapq.heappop(A)
        heapq.heappush(A, (-1)*(-tmp_min//2))
    
    print(-sum(A))
if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int r, D;
	vector<int> x(11);
	cin >> r >> D >> x.at(0);

	for (int i = 1; i <= 10; i++)
	{
		x.at(i) = r * x.at(i - 1) - D;

		cout << x.at(i) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
/*
 * Author: RainAir
 * Time: 2019-10-08 16:33:35
 */
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define fi first
#define se second
#define U unsigned
#define P std::pair
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 1e5 + 5;
const int MAXM = 15 + 1;
int a[MAXN];
int n,ans;
int cnt[16];
int f[(1<<MAXM)+3];

inline int dfs(int S){
    int &ans = f[S];
    if(!S) return ans = 0;
    if(ans != -1) return ans;
    ans = 1e9;
    FOR(i,1,15){
        if(!(S&(1<<(i-1)))) continue;
        FOR(j,1,15){
            if(i == j) continue;
            if(!(S&(1<<(j-1)))) continue;
            int x = i^j,nS = S;
            if(S&(1<<(x-1))){
                nS ^= (1<<(i-1));
                nS ^= (1<<(j-1));
                nS ^= (1<<(x-1));
                ans = std::min(ans,2+dfs(nS));
            }
            else{
                nS |= (1<<(x-1));
                nS ^= (1<<(i-1));
                nS ^= (1<<(j-1));
                ans = std::min(ans,1+dfs(nS));
            }
        }
    }
    return ans;
}

int main(){
    scanf("%d",&n);
    FOR(i,1,n-1){
        int u,v,w;scanf("%d%d%d",&u,&v,&w);
        ++u;++v;
        a[u] ^= w;a[v] ^= w;
    }
    FOR(i,1,n) cnt[a[i]]++;
    FOR(i,1,15) ans += cnt[i]/2,cnt[i] %= 2;
    int S = 0;
    FOR(i,1,15) if(cnt[i]) S |= (1<<(i-1));
    CLR(f,-1);
    ans += dfs(S);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 896
#include <cstdio>
using namespace std;
long long a,b;
inline long long read()
{
    long long x=0;bool f=false;char ch=getchar();
    while(ch<48||ch>57)f|=(ch=='-'),ch=getchar();
    while(ch>47&&ch<58)x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
inline void Rem()
{
    a=read(),b=read();
	printf("%lld\n",((a*2+b)/4>b/2) ? b/2 : (a*2+b)/4);
}
int main()
{
	return Rem(),0;
}

Measured memory_bytes: 128
#include<vector>
#include <iostream>
#include<string>
#include <complex>

using namespace std;

int main(){
    int n;
    cin >> n;
    int v[n];
    int c[n];
    int a[n];

    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
        a[i] = v[i] - c[i];
    }

    int res = 0;
    for(int i = 0; i < n ; i++){
        if(a[i] > 0){
            res += a[i];
        }
    }

    cout << res << endl;

}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
int main(){
	int x1,x2,y1,y2;
	cin>>x1>>y1>>x2>>y2;
	int x3=y1-y2+x2;
	int y3=y2+x2-x1;
	int x4=y2-y3+x3;
	int y4=y3+x3-x2;
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

long long int gcd(long long int x, long long int y)
{
	if (y == 0) { return x; }
	return gcd(y, x % y);
}

int main(void)
{
	bool judge = true;	
	int n, tmp,max;
	vector<int> a;
	cin >> n;
	for (int i = 0; i < n; i++) { cin >> tmp; a.push_back(tmp); }

	max = a[0];
	for (int i = 1; i < n; i++)
	{
		if (max - 1 > a[i]) { judge = false; }
		else if (a[i] > max) { max = a[i]; }
	}
	if (judge) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}


Measured memory_bytes: 892
import sys
import math
from collections import defaultdict,deque

input = sys.stdin.readline
def inar():
    return [int(el) for el in input().split()]
def main():
    n=list(input().strip())
    if "7" in n:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()





Measured memory_bytes: 65264
#include<stdio.h>
 
int main(void){
  int i;
  int n;
  int m;
  int a[10000];
  scanf("%d%d",&n, &m);
  for(i = 0; i < m; i++){
    scanf("%d", &a[i]);
    n -= a[i];
  }
  if (n < -1)
    n=-1;
  printf("%d",n);
}

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

int main() {
    char s1,s2,s3,s4,s5,s6;
    cin >> s1 >> s2 >> s3;
    cin >> s4 >> s5 >> s6;
    if(s1 == s6 && s3 == s4 && s2 == s5){
        cout << "YES";
    } else {
        cout << "NO";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int main(){
  int n, k; cin >> n >> k;
  vector<ll> x(n);
  rep(i, n) cin >> x[i];

  ll res = INF;
  rep(l, n-k+1){
    int r = l+k-1;
    if(x[r] <= 0) chmin(res, -x[l]);
    else if(0 <= x[l]) chmin(res, x[r]);
    else{
      chmin(res, (x[r]-x[l]) + x[r]);
      chmin(res, (x[r]-x[l]) - x[l]);
    }
  } 

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>

//関数の宣言
void Determine(int x);

int main(){
	int num;
	int ans;

	std::cin >> num;

	Determine(num);
	
	return 0;
}

//関数の定義
void Determine(int x){
	for (int i = 1; i <= x; i++){
		if (i % 3 == 0){
			std::cout<<' '<<i;
		}
		else if (i % 10 == 3){
			std::cout << ' ' << i;
		}
		else if (i / 10==3||(i/10) % 10 == 3||(i/100)%10==3||i/100==3||i/1000==3||i/10000==3){
			std::cout << ' ' << i;
		}
	}std::cout << '\n';
}


Measured memory_bytes: 3100
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {

      Scanner sc = new Scanner(System.in);
      
      int k = sc.nextInt();
      long sum = 0;

      for(int i=1; i<=k; i++){
        for(int j=1; j<=k; j++){
          for(int m=1; m<=k; m++){
            int temp = gcd(i, j);
            sum += gcd(temp, m);
          }
        }
      }

      System.out.println(sum);

      sc.close();
   }

   public static int gcd(int a, int b) { 
        // Everything divides 0  
        if (a == 0) 
          return b; 
        if (b == 0) 
          return a; 
       
        // base case 
        if (a == b) 
            return a; 
       
        // a is greater 
        if (a > b) 
            return gcd(a-b, b); 
        return gcd(a, b-a); 
    }
}

Measured memory_bytes: 27452
n = int(input())
graph = [[] for i in range(n)]

for i in range(n-1):
    u, v, w = map(int, input().split())
    graph[u-1].append((v-1, w))
    graph[v-1].append((u-1, w))

colors = [-1] * n
colors[0] = 0
Me_Parent = [[0, -1]]
while Me_Parent:
    m, p = Me_Parent.pop()
    Child = graph[m]
    for c, w in Child:
        if c != p:
            colors[c] = (colors[m] + w) % 2
            Me_Parent.append([c, m])
            
for i in range(n):
    print(colors[i])

Measured memory_bytes: 38828
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; } value
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, i = 1, ans = 0;
  cin >> n >> k;
  while(i <= n) {
    ans++;
    i *= k;
  }
  cout << ans << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char str[10000];
	gets(str);
	int flag1=1;
	int flag2=1;
	int len=strlen(str);
	int i;
	for(i=0;i<len;i++)
	{
	if(i%2==0)//i是偶数，这是第奇数 个数字 
	{
		if(!(str[i]=='R'||str[i]=='U'||str[i]=='D'))
		{
			printf("No\n");
			flag1=0;
			break;
		}
	}
	if(i%2==1)
	{
		if(!(str[i]=='L'||str[i]=='U'||str[i]=='D'))
		{
			printf("No\n");
			flag2=0;
			break;
		}
	}
    }
    if(flag1==1&&flag2==1)
	{
		printf("Yes\n");
	 } 
	return 0;
 } 

Measured memory_bytes: 128
(let ((str (read-line))
      (count (make-array 26 :element-type 'fixnum :initial-element 0)))
  (loop :for c :across str
        :do (incf (aref count (- (char-code c) (char-code #\a)))))
  (format t "~a~%" (if (loop :for i :across count
                             :always (<= i 1))
                       "yes" "no")))
  


Measured memory_bytes: 17376
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int>cards(N);
  for(int i=0;i<N;i++){
    cin>>cards.at(i);
  }
  sort(cards.begin(),cards.end());
  int base=cards.at(0);
  int count=1;
  for(int i=0;i<N;i++){
    if(base<cards.at(i)){
      base=cards.at(i);
      count++;
    }
    else{
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vvi vector<vector<int>> 
#define vi vector<int> 
#define vpii vector<pair<int,int>> 
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ffor(i,n) for(int i = 0; i < n; ++i)
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    string s;
    cin >> s;
    vi dist(n + 1,1e18);
    dist[n] = 0;
    vi nxt(n + 1,-1);
    priority_queue<pair<int,int>> pq;
    pq.push({0,-(n)});
    
    for(int i = n - 1; i >= 0; --i)
    {
        if(s[i] == '1') continue;
        
        while(!pq.empty() && i + m < -pq.top().ss) pq.pop();
        if(!pq.empty())
        {
            nxt[i] = -pq.top().ss;
            dist[i] = 1 + -pq.top().ff;
        }
        else
        {
            cout << -1;
            return 0;
        }
        pq.push({-dist[i],-i});
    }
    
    int i = 0;
    while(i != n)
    {
        cout << nxt[i] - i << ' ';
        i = nxt[i];
    }

}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple


signed main() {
#ifdef LC
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a;
	int b;
	cin >> a >> b;
	b = 2 * b + 1;
	cout << (a + b - 1) / b << endl;

	return 0;
}


Measured memory_bytes: 256
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

s = input()
k = int(input())
if k == 1:
    print(s[0])
else:
    flag = True
    for i in range(k):
        if s[i] != "1":
            flag = False
            break
    if flag:
        print("1")
    else:
        for i in s:
            if i != "1":
                print(i)
                break
        else:
            print(s[0])


Measured memory_bytes: 5032
/*
	  Chase
	   Your
	  Legend

	英雄志逐传奇
*/

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

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

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	bool ans = false;
	if (s < t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  int cnt = 0;
  rep(i, 3) {
    if(s1.at(i) == s2.at(2-i)) {
      cnt++;
    }
  }
  if(cnt == 3) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3592
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
S = input()
'''
cnt = [0]*(N+1)
ans = N+1

for i in range(N):
    if S[i] == '.':
        cnt[i+1] += cnt[i] + 1
    else:
        cnt[i+1] += cnt[i]

for i in range(0, N+1):
    ans = min(ans, (i-cnt[i])+(cnt[N]-cnt[i]))

print(ans)
'''

dp = dp2(0, 2, N+1)

if S[0] == '.':
    dp[1][0] = 0
    dp[1][1] = 1
else:
    dp[1][0] = 1
    dp[1][1] = 0

for i in range(2, N+1):
    for j in range(2):
        if S[i-1] == '.':
            dp[i][0] = dp[i-1][0]
            dp[i][1] = min(dp[i-1][0]+1, dp[i-1][1]+1)
        else:
            dp[i][0] = dp[i-1][0] + 1
            dp[i][1] = min(dp[i-1][0], dp[i-1][1])

print(min(dp[N][0], dp[N][1]))

Measured memory_bytes: 66124
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;




int main(){	
	string s;cin>>s;
	string s1,s2;
	string ref="13";
	s1.pb(s[0]);
	s1.pb(s[1]);
	s2.pb(s[2]);
	s2.pb(s[3]);
	if(s1>=ref||s2>=ref){
		if(s1>=ref&&s2<ref){
			if(s2=="00")cout<<"NA"<<endl;
			else cout<<"YYMM"<<endl;
		}
		else if(s1<ref&&s2>=ref){
			if(s1=="00")cout<<"NA"<<endl;
			else cout<<"MMYY"<<endl;
		}
		else cout<<"NA"<<endl;
	}
	else{
		if(s1=="00"&&s2=="00"){
			cout<<"NA"<<endl;
			return 0;
		}
		if(s1=="00")cout<<"YYMM"<<endl;
		else if(s2=="00")cout<<"MMYY"<<endl;
		else cout<<"AMBIGUOUS"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define con_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define con_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>T gcd(T u,T v);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);

int main(){
    int n,ans=1,j;
    cin>>n;
    vector<int> vec(n);
    vector<bool> vec2(n,true);
    con_input(vec);
    rep(i,n-1){
        if(vec[i]-vec[i+1]>=2){
            ans=0;
            break;
        }
        if(vec[i]-vec[i+1]==1){
            vec[i]--;
            vec2[i]=false;
            j=i;
            while(j>=1&&vec[j-1]>vec[j]){
                if(vec2[j-1]){
                    vec[j-1]--;
                    vec2[j-1]=false;
                    j--;
                }else{
                    ans=0;
                    break;
                }
            }
        }
        if(ans==0)break;
    }
    cout<<(ans?"Yes":"No")<<endl;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

int n;
int a[100000];
int b[100000];
int debag = 0;

char c[100000];

void Qsort(int begins,int ends){
    int pivot = begins;//境目
    FOR(i,begins,ends){
        if(a[i] <= a[ends-1]){
            swap(a[i],a[pivot]);
            swap(b[i],b[pivot]);
            swap(c[i],c[pivot]);
            pivot++;
        }
    }
    bool sorted = 1;
    FOR(i,begins,ends-1){
        if(a[i]<=a[i+1])sorted = 0;
    }
    if(sorted)return;
    Qsort(begins,pivot-1);
    Qsort(pivot,ends);
    return ;
}

int main(){
    cin >> n;
    REP(i,n){
        cin >> c[i] >> a[i];
        b[i] = i;
    }
    Qsort(0,n);
    bool isStable = 1;
    REP(i,n-1){
        if(a[i] == a[i+1]){
            if(b[i] > b[i+1]){
                cout << "Not stable" << endl;
                isStable = 0;
                break;
            }
        }
    }
    if(isStable)cout << "Stable" << endl;
    REP(i,n)cout << c[i] << " " <<a[i] << endl;
}


Measured memory_bytes: 3936
#include <stdio.h>

#define max 100

int main(){
  int i,j,num,min,minj,ans=0;

  int data[max][max],flag[max],d[max];

  scanf("%d",&num);

  for(i = 0 ; i < num ; i++){
    flag[i] = 0;
    d[i] = 2001;
  }
  d[0] = 0;

  for(i = 0 ; i < num ; i++){
    for(j = 0 ; j < num ; j++){
      scanf("%d",&data[i][j]);
    }
  }

  for(i = 0 ; i < num-1 ; i++){
    min = 2001;
    
    for(j = 0 ; j < num ; j++){
      if(d[j] < min && flag[j] == 0 ){
	min = d[j];
	minj = j;
      }
    }
    flag[minj] = 1;
    for(j = 0 ; j < num ; j++){
      if(data[minj][j] != -1 && data[minj][j] < d[j] && flag[j] ==0){

	d[j] = data[minj][j];
      }
    }
  }
  for(i = 0 ; i < num ; i++){
    ans += d[i];
  }
  printf("%d\n",ans);

  return 0;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int s;
  cin>>s;
  int n=s;
  set<int> st;
  while(st.count(n)==0){
    st.insert(n);
    if(n%2==0) n/=2;
    else n=3*n+1;
  }
  cout<<(st.size()+1)<<endl;
}


Measured memory_bytes: 3580
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdint>
using namespace std;

int main() {
    cout << fixed << setprecision(9);

    constexpr int log2_1e5 = 17;

    auto log2 = [](int k, int p) {
        int c = 0, v = p;
        while (v < k) {
            ++c;
            v *= 2;
        }
        return c;
    };

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

    int64_t sum = 0;
    for (int i = 0; i < n; ++i) {
        sum += pow(2, log2_1e5 - log2(k, i + 1));
    }

    cout << (sum / (n * pow(2, log2_1e5))) << endl;
}



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

int main ()
{
  long long X, K, D;
  cin >> X >> K >> D;
  long long ans;
  if (X < 0) {
    X = -1 * X;
  }
  long count = X / D;  // 残り距離が正としたときの試行回数
  if (count > K) {
    ans = X - K * D;
    cout << ans << endl;
    return 0;
  }
  long distance = X%D;//X - D * count;  // 残り距離
  count = K - count;  // 残り試行回数
  if (count % 2 == 0) {
      ans = distance;
  } else {
      ans = D - distance;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define print(x) cout<<(x)<<'\n'
using ll=long long;
using pl=pair<ll,ll>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vs=vector<string>;

void solve() {
    ll H,W;
    cin >> H >> W;
    vvl cost(10, vl(10, 0));
    rng(i,0,10)
        rng(j,0,10)
            cin >> cost[i][j];

    //ワーシャルフロイド
    rng(k,0,10){
        rng(i,0,10){
            rng(j,0,10){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }

    ll ans = 0;
    ll a;
    rng(i,0,H){
        rng(j,0,W){
            cin >> a;
            if(a == -1) continue;
            if(a != 1) ans += cost[a][1];
        }
    }
    print(ans);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, N;
    cin >> H >> W >> N;
    int a[N], b[N];
    rep(i, N) cin >> a[i] >> b[i];
    ll ans[10] = {};
    map<pair<int, int>, int> ma;
    rep(i, N) {
        int x;
        int y;
        rep(k, 9) {
            x = a[i] + k % 3 - 1;
            y = b[i] + k / 3 - 1;
            if (x < 2 || x > H - 1 || y < 2 || y > W - 1) continue;
            else ma[make_pair(x, y)]++;
            //cout << x << ", " << y << endl;
        }

    }
    ans[0] = (ll)(H-2) * (W-2);
    rep(i, N) {
        int x;
        int y;
        rep(k, 9) {
            x = a[i] + k % 3 - 1;
            y = b[i] + k / 3 - 1;
            if (x < 2 || x > H - 1 || y < 2 || y > W - 1)  continue;
            else if (ma[make_pair(x, y)] != 0){
                ans[ma[make_pair(x, y)]]++;
                //dump(ma[make_pair(x, y)]);
            }
        }
    }
    rep(i, 9) ans[0] -= ans[i+1]/(i+1);
    rep(i, 10) cout << ans[i]/(max(1, i)) << endl;


    return 0;
}


Measured memory_bytes: 57344
#include <stdio.h>

void sca(int t){
    int n=t;
    while(1){
        if(n%10 == 3){
            printf(" %d",t);
            return;
        }
        if(n == 0)break;
        n /= 10;
    }
}

int main(void){
    int i,n,test;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        if(i%3 == 0)printf(" %d",i);
        else sca(i);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2064