akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int H, W; cin >> H >> W;
  vector<string> a(H);
  for(int i = 0; i < H; i++) cin >> a[i];

  vector<vector<char>> red(H, vector<char> (W, '.'));
  auto blue = red;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(j == 0){
        red[i][j] = '#';
        continue;
      }
      if(j == W-1){
        blue[i][j] = '#';
        continue;
      }
      if(a[i][j] == '#'){
        red[i][j] = blue[i][j] = '#';
      }
      if(i % 2 == 0){
        red[i][j] = '#';
      }else {
        blue[i][j] = '#';
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << red[i][j];
    }
    cout << endl;
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << blue[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 1536
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> h(n), p(n);
    rep(i, n) {
        cin >> h[i] >> p[i];
    }
    vector<P> ps(n);
    rep(i, n) {
        ps[i] = make_pair(h[i], p[i]);
    }
    sort(all(ps), [&](P a, P b){return a.fr + a.sc < b.fr + b.sc;});
    vector<vector<int>> dp(n + 1, vector<int>(n + 1, INF));
    dp[0][0] = 0;
    for(int i = 1; i <= n; ++i) {
        for(int j = 0; j <= i; ++j) {
            chmin(dp[i][j], dp[i - 1][j]);
            if(j >= 1 && dp[i - 1][j - 1] <= ps[i - 1].fr) chmin(dp[i][j], dp[i - 1][j - 1] + ps[i - 1].sc);
        }
    }
    int ans = 0;
    for(int i = 0; i <= n; ++i) {
        if(dp[n][i] < INF) chmax(ans, i);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 195968
import java.util.*;
public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int red = Integer.parseInt(sc.next());
  int green = Integer.parseInt(sc.next());
  int blue = Integer.parseInt(sc.next());
  int ans = red*100 + green*10 + blue;
  if (ans%4 == 0){
    System.out.println("YES");
  }
  else {
    System.out.println("NO");
  }
  }
}


Measured memory_bytes: 21328
#include<limits.h>


#include<iostream>
using namespace std;

pair< int, int > cal[1000000 + 10];
#define h first
#define w second

pair< int, bool > state[1000000 + 10];
#define la first
#define ri second

int map[1000 + 5][1000 + 5];

#define LIMT 1001000

int main()
{
	int lh, lw;
	int i, j;

	cin >> lh >> lw;

	for (i = 0; i <= lw + 1; i++)
	{
		map[0][i] = LIMT;
		map[lh + 1][i] = LIMT;
	}
	for (i = 1; i <= lh; i++)
	{
		map[i][0] = LIMT;
		map[i][lw + 1] = LIMT;
	}

	for (i = 1; i <= lh; i++)
	{
		for (j = 1; j <= lw; j++)
		{
			cin >> map[i][j];

			cal[map[i][j]].h = i;
			cal[map[i][j]].w = j;
		}
	}


	int cnt = 0;

	int mh[] = {1,0,-1,0};
	int mw[] = {0,1,0,-1};
	int nh, nw;
	bool flg1 = true;
	int tol;
	for (i = 1; i <= lh*lw; i++)
	{
		nh = cal[i].h;
		nw = cal[i].w;

		flg1 = true;

		for (j = 0; j < 4; j++)
		{
			if (map[nh][nw] > map[nh + mh[j]][nw + mw[j]])
			{
				if (state[map[nh + mh[j]][nw + mw[j]]].ri)
				{
					state[map[nh][nw]].ri = true;
					break;
				}

				if (flg1)
				{
					tol = state[map[nh + mh[j]][nw + mw[j]]].la;
				}

				flg1 = false;

				if (tol != state[map[nh + mh[j]][nw + mw[j]]].la)
				{
					state[map[nh][nw]].ri = true;
					break;
				}
			}
		}


		if (flg1)
		{
			state[map[nh][nw]].la = map[nh][nw];
		}

		else if (j == 4)
		{
			state[map[nh][nw]].la = tol;
		}

		if (state[map[nh][nw]].ri)
		{
			cnt++;
		}
	}


	/*
	cout << "\n\n";
	for (i = 1; i <= lh; i++)
	{
		for (j = 1; j <= lw; j++)
		{
			cout << state[map[i][j]].ri;
		}
		cout << "\n";
	}
	cout << "\n\n";
	*/


	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 22628
#include <bits/stdc++.h>
//#include "mylib-cpp.h"

using namespace std;

int main(void){
    int p, q, r;
    cin >> p >> q >> r;
    int tmp1 = p+q, tmp2 = q+r, tmp3 = r+p;
    if(tmp1 <= tmp2 && tmp1 <= tmp3){
        cout << tmp1 << endl;
        return 0;
    } 
    if(tmp2 <= tmp1 && tmp2 <= tmp3){
        cout << tmp2 << endl;
        return 0;
    }
    if(tmp3 <= tmp1 && tmp3 <= tmp2){
        cout << tmp3 << endl;
        return 0;
    }
    return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define FILE "parade"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const ull ULLINF = numeric_limits<ull>::max();
const double PI = acos(-1.0);

long long f[410][410], r[410][410];
long long A[410], B[410];
long long mod = 1e9 + 7;

long long sqr(long long n)
{
    return n * n % mod;
}

long long binpow(long long a, long long n)
{
    if(!n)
        return 1;
    if(n & 1)
        return binpow(a, n - 1) * a % mod;
    else
        return sqr(binpow(a, n >> 1));
}

int main()
{
//    freopen(FILE".in", "r", stdin);
//    freopen(FILE".out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    for(int i = 0; i <= 400; i++)
    {
        r[0][i] = 0;
        for(int j = 1; j <= 400; j++)
        {
            r[j][i] = (r[j - 1][i] + binpow(j, i) + mod) % mod;
            assert(r[j][i] >= 0 && r[j][i] < mod);
        }
    }
    int n, c;
    cin >> n >> c;
    for(int i = 1; i <= n; i++)
        cin >> A[i];
    for(int i = 1; i <= n; i++)
        cin >> B[i];
    f[0][0] = 1;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 0; j <= c; j++)
        {
            for(int k = 0; k <= j; k++)
            {
                f[i][j] = (f[i][j] + (f[i - 1][j - k] * (r[B[i]][k] - r[A[i] - 1][k] + mod) % mod) % mod) % mod;
                assert(f[i][j] >= 0 && f[i][j] < mod);
            }
        }
    }
    cout << f[n][c];
    return 0;
}


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

// i => (i+1) or (i+2)
// cost = |hj - hi|

using ll = long long; 
const int INF = 1e9 + 5;

void solve(vector<int> &arr){
    vector<int> dp(arr.size(), INF);

    dp[0] = 0;
    for(int i=0; i<arr.size(); i++){
        for(int j : {i+1, i+2}){
            if(j < arr.size()){
                dp[j] = min(dp[j], dp[i] + abs(arr[j] - arr[i]));
            }
        }
    }

    cout << dp[arr.size()-1] << endl;
}

int main(){

    int n;
    cin >> n;

    vector<int> arr(n, 0);
    for(int i=0; i<arr.size(); i++)
        cin >> arr[i];

    solve(arr);

    return 0; 
}

Measured memory_bytes: 1024
/* author : akshatjai258 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define mod int(1e9 + 7)
#define inf int(1e9)
#define endl "\n"
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define fi first
#define mem0(a) memset(a, 0, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
#define memf(a) memset(a, false, sizeof(a))
#define all(v) v.begin(), v.end()
#define se second
#define mp make_pair
#define pb push_back
#define w(x)  \
	int x;    \
	cin >> x; \
	while (x--)
#define ps(x, y) fixed << setprecision(y) << x
void prep()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
}
int main()
{
	prep();
	int h,w;
	cin>>h>>w;
	vector<vector<char>>grid(h,vector<char>(w));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>grid[i][j];
		}
	}
	vvi dp(h,vi(w));
//	dp[i][j] is paths uptil here
	dp[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(grid[i][j]=='#'){
				dp[i][j]=0;
			}
			else{
				if(i-1>=0){
					dp[i][j]+=dp[i-1][j];
					dp[i][j]%=mod;
				}
				if(j-1>=0){
					dp[i][j]+=dp[i][j-1];
					dp[i][j]%=mod;
				}
			}
		}
	}
	cout<<dp[h-1][w-1]<<endl;
		
	return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = long long ;

int main(){
    int n; cin >> n;
    vi a(n),b,b1,b2;
    for(int ix=0;ix<n;ix++){
        cin >> a.at(ix);
    }
    for(int ix=0;ix<n;ix++){
        if(ix%2 == 0) b1.push_back(a.at(ix));
        else b2.push_back(a.at(ix));
    }
    if(n%2 == 1){
        reverse(b1.begin(),b1.end());
        copy(b1.begin(),b1.end(),back_inserter(b));
        copy(b2.begin(),b2.end(),back_inserter(b));
    }
    else{
        reverse(b2.begin(),b2.end());
        copy(b2.begin(),b2.end(),back_inserter(b));
        copy(b1.begin(),b1.end(),back_inserter(b));
    }
    for(int ix=0;ix<n-1;ix++) cout << b.at(ix) << " " ;
    cout << b.at(n-1) << endl;
}

Measured memory_bytes: 5872
n = int(input())
for i in range(1, n + 1):
  if i % 3 == 0:
    print(" {}".format(i), end = "")
  else:
    x = i
    while x:
      if x % 10 == 3:
        print(" {}".format(i), end = "")
        break
      x //= 10
print()


Measured memory_bytes: 5868
// Problem : D - Sum of Divisors
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_d
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define mk make_pair
#define fast                    \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define sz(x) (int)x.size()
#define mem(a, val) memset(a, val, sizeof(a))
#define deci(x) cout << fixed << setprecision(x);
#define bitcount(x) __builtin_popcountll(x)

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

const long long int mod = 1e9 + 7;
const long double EPS = 1e-12;
const int N = 1e7 + 20;

int spf[N];
ll d[N];

void solve() {
  // spf[1] = 1;
  // for (int i = 2; i < N; i++) {
  // if (spf[i] == 0) {
  // for (int j = i; j < N; j += i) spf[j] = i;
  // }
  // }
  // d[1] = 1;
  // for (int i = 2; i < N; i++) {
  // if (spf[i] == i) {
  // d[i] = 2;
  // } else {
  // int a = 1, cnt = 0;
  // int no = i;
  // while (no > 1 && no % spf[i] == 0) {
  // no /= spf[i];
  // a = a * spf[i];
  // cnt++;
  // }
  // if (no == 1) {
  // d[i] = cnt + 1;
  // } else {
  // int b = i / i;
  // d[i] = d[a] * d[b];
  // }
  // }
  // }
  // for (int i = 1; i < 20; i++) cout << d[i] << " ";
  for (int i = 1; i < N; i++)
    for (int j = i; j < N; j += i) d[j]++;
  ll ans = 0;
  int n;
  cin >> n;
  for (int i = 0; i <= n; i++) ans += (d[i] * i);
  cout << ans;
}
int main() {
  fast;
  ll t;
  t = 1;

  // cin>>t;

  while (t--) {
    solve();
  }

  return 0;
}


Measured memory_bytes: 81760
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll H, W;
const int MAX_HW = 1000;
string A[MAX_HW];

struct ct{
  int x, y, c;
};

int main(){
  cin >> H >> W;
  REP(i, H) cin >> A[i];

  queue<ct> q;

  bool used[H][W];

  REP(i, H) {
    REP(j, W) {
      used[i][j] = false;
      if(A[i][j] == '#') {
        used[i][j] = true;
        q.push(ct{i, j, 0});
      }
    }
  }

  int ans = 0;

  while(!q.empty()) {
    ct crt = q.front();
    q.pop();
    ans = max(ans, crt.c);
    REP(d, 4) {
      int nx = crt.x + dirx[d];
      int ny = crt.y + diry[d];
     
      if(nx >= 0 && nx < H && ny >= 0 && ny < W && !used[nx][ny]) {
        q.push(ct{nx, ny, crt.c + 1});
        used[nx][ny] = true;
      }
    }
  }

  cout << ans << endl;


  return 0;
}



Measured memory_bytes: 14352
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<long long int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MB 1000000007
#define NB 1000000000
#define ll long long int
int N,K;
VI H;

int main()
{

	cin >> N >> K;
	H.resize(N);
	REP(i,N){
		cin >>H[i];
	}
	sort(H.begin(),H.end());
	double ans = 0;
	REP(i,N-K){
		ans+=H[i];
	}
	cout << fixed << setprecision(0)<< ans;
}











Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;


int main() {
	int n; cin >> n;
	string s; cin >> s;
	if (s.substr(0, n / 2) == s.substr(n / 2)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int main(){

  int N, M;
  cin >> N >> M;
  vector<vector<int>> v;
  for(int i=0; i< M; i++){
    int k; cin >> k;
    vector<int> w(k);
    for(int j=0; j<k; j++){
      cin >> w[j];
    }
    v.push_back(w);
  }
  vector<int> p;
  for(int i=0; i < M; i++){
    int q; cin >> q;
    p.push_back(q);
  }

  vector<vector<int>> states;
  states.push_back({});
  for(int i=0; i < N; i++){
    vector<vector<int>> temp;
    for(int j=0; j < states.size(); j++){
      states[j].push_back(0);
      temp.push_back(states[j]);
      states[j].pop_back();
      states[j].push_back(1);
      temp.push_back(states[j]);
      states[j].pop_back();
    }
    states = temp;
  }

  // cout << N << endl;
  // cout << states.size() << endl;

  int ans = 0;
  for(int i=0; i<states.size(); i++){
    bool flag = false;
    for(int j=0; j < M; j++){
      int count = 0;
      for(int k=0; k < v[j].size(); k++){
        if(states[i][v[j][k]-1] == 1){
          count += 1;
        }
      }
      if(count % 2 != p[j]){
        flag = true;
        break;
      }
    }
    if(!flag){
      ans += 1;
    }
  }

  cout << ans << endl;

}

Measured memory_bytes: 384
def main():
    s = input()
    t = input()
    mincount = 1e9
    
    for i in range(len(s)-len(t)+1):
        count = 0
        for j in range(len(t)):
            if(s[i+j] != t[j]):
                count+= 1
        mincount = min(mincount,count) 
    print(mincount)
    return
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 72760
#include <iostream>
using namespace std;
int main(){
	int n;cin>>n;
  	string s;cin>> s;
    int ret=0,ans=0;
   for(auto&& u:s){
   	if(u=='I')ret++;
     else if(u=='D')ret--;
     ans=max(ans,ret);
   }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
x, k, d = map(int, input().split())

if abs(x) - (d * k) >= 0:
    print(abs(x) - (d * k))
elif (k - (abs(x) // d)) % 2 == 0:
    print(abs(abs(x) % d))
else:
    print(abs(abs(x) % d - d))


Measured memory_bytes: 9108
n, m = map(int, input().split())


root = list(range(n + 1))


# from collections import defaultdict
# d = defaultdict(set)
cnt = [1] * (n + 1)


def find(i):
    if i == root[i]:
        return i
    root[i] = find(root[i])
    return root[i]

def union(u, v):
    fu, fv = find(u), find(v)
    if fu == fv:
        return
    root[max(fu, fv)] = min(fu, fv)
    cnt[min(fu, fv)] += cnt[max(fu, fv)]



for i in range(m):
    u, v = map(int, input().split())
    union(u, v)



# print(d)
print(max(cnt))


Measured memory_bytes: 24356
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

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

    var(string, s);
    const int N = s.length();

    if (s == "keyence") {
        print("YES");
        return 0;
    }

    rep(i, N) {
        reps(j, i, N - 1) {
            string x = "";
            rep(k, N) {
                if (k < i || k > j) x += s[k];
            }
            if (x == "keyence") {
                print("YES");
                return 0;
            }
        }
    }

    print("NO");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	char cs[100000+2];
	int q;
	while(scanf("%100000[a-z]\n%d\n", cs, &q)==2)
	{
		deque<int> s;
		bool is_rev=false;

		for(int i=0;cs[i];i++)
		{
			s.push_back(cs[i]);
		}
		for(int i=0;i<q;i++)
		{
			int t;
			scanf("%d\n", &t);
			if(t==1)
			{
				is_rev=!is_rev;
			}
			else
			{
				int f;
				char c;
				scanf("%d %c\n", &f, &c);
				if(is_rev) f=3-f;
				if(f==1) s.push_front(c);
				else s.push_back(c);
			}
		}
		if(is_rev) reverse(s.begin(), s.end());
		for(int i=0;i<s.size();i++) printf("%c", s[i]);
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1920
#include <algorithm>
#include <cfloat>
#include <iostream>
#include <numeric>
#include <vector>

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

    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    double ave = (double)std::accumulate(a.begin(), a.end(), 0.0) / n;

    double min_diff = DBL_MAX;
    int min_idx = 0;
    for (int i = 0; i < n; i++) {
        double diff = ave - a[i];
        if (diff < 0) {
            diff = -diff;
        }
        if (min_diff > diff) {
            min_idx = i;
            min_diff = diff;
        }
    }
    std::cout << min_idx << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define se second
typedef long long ll;
const int maxn = 100005;
typedef pair<int, int>par;
const ll mod = 1e9+7;

int c[100][100], C[100], val[100];

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    #endif // acm

    int n, m, x;
    cin >> n >> m >> x;

    for( int i = 0; i < n; i++ ){
        cin >> C[i];
        for( int j = 1; j <= m; j++ )
            cin >> c[i][j];
    }


    int sol = 1 << 30;
    for( int mask = 0; mask < (1 << n); mask++ ){

        for( int i = 1; i <= m; i++ )
            val[i] = 0;

        int cost = 0;
        for( int i = 0; i < n; i++ ){
            if( (mask >> i)&1 ){
                cost += C[i];
                for( int j = 1; j <= m; j++ )
                    val[j] += c[i][j];
            }
        }

        int band = 1;
        for( int i = 1; i <= m; i++ )
            band &= (val[i] >= x);

        if( band )
            sol = min(sol, cost);
    }

    if( sol == 1 << 30 )cout << "-1\n";
    else cout << sol << "\n";

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
# define ll long long
# define ld long double
# define pb push_back
 
  
    // for(int i=0;i<n;i++){  
        
    //     int x,y;
    //     cin>>x>>y;
        
    //     v.pb({x,y});         //make pair in vector
    // }
 
using namespace std;
 
int main()
{
 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll  n,x;
    cin>>n>>x;
   

   ll ar[x];
   ll sum=0;
   for(int i=0;i<x;i++)
   	{ cin>>ar[i];}

   for(int i=0;i<x;i++)
   	{  sum+=ar[i];}

   ll p=n-sum;

   if(p>=0)
   	{ cout<<p;}
   else
   	{ cout<<"-1";}

}

Measured memory_bytes: 3688
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
 

int main() {
  int N,x=0; cin >> N;
  map<int, int> mp1,mp2;
  int D[N+10];
  for(int i=0; i<N; i++){
    cin >> D[i];
    mp1[D[i]]+=1;
  }
  int M; cin >> M;
  int T[M+10];
  for(int i=0; i<M; i++){
    cin >> T[i];
    mp2[T[i]]+=1;
  }
  if(N<M){
    cout << "NO" << endl;
    return 0;
  }
  for(int i=0; i<M; i++){
    x=T[i];
    if(mp2[x]>mp1[x]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 20608
#include<stdio.h>
int main()
{
    int n,i,j,k;
    scanf("%d", &n);
    i=n%10;
    j=n%100;
    j=j/10;
    k=n/100;
    if(i==7 || j==7 || k==7)
    printf("Yes");
    else
    printf("No");
}    

Measured memory_bytes: 1736
#include <iostream>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


//nCr,nPr,modの逆元
class Combination {
public:
	Array fact;//n！
	Array inv;//n!の逆元
	ll mod;
	Combination(ll n, ll _mod) {
		mod = _mod;
		fact.resize(n + 1);
		fact[0] = 1;
		REP(i, n) {
			fact[i + 1] = (fact[i] * (i + 1LL)) % mod;
		}
		inv.resize(n + 1);
		inv[n] = mod_inv(fact[n]);
		for (int i = n; i > 0; i--) {
			inv[i - 1] = inv[i] * i % mod;
		}
	}
	//modの逆元
	ll mod_inv(ll x) {
		ll n = mod - 2;
		ll res = 1LL;
		while (n > 0) {
			if (n & 1) res = res * x % mod;
			x = x * x % mod;
			n >>= 1;
		}
		return res;
	}
	ll nCr(ll n, ll r) {
		return ((fact[n] * inv[r] % mod) * inv[n - r]) % mod;
	}
	ll nPr(ll n, ll r) {
		return (fact[n] * inv[n - r]) % mod;
	}
	ll nHr(ll n, ll r) {
		//重複組み合わせ：n種類のものからr個取り出す組み合わせ
		return nCr(r + n - 1, r);
	}
};

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

	ll n, m;
	cin >> n >> m;

	if (abs(n - m) >= 2) {
		cout << 0 << endl;
		return 0;
	}
	Array fact(max(n, m) + 1, 1);
	for (int i = 1; i <= max(n, m); i++) {
		fact[i] = (i * fact[i - 1]) % MOD;
	}

	if (n == m) {
		cout << (((fact[n]*fact[m]) % MOD) * 2) % MOD << endl;
	}
	else {
		cout << (fact[n]*fact[m]) % MOD << endl;
	}


	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<set>
#include<cstring>

using namespace std;

set<int> se;

int N,K;

int card[10];
bool used[10];

void rec(int num,int k)
{
	if(k==K)
	{
		se.insert(num);
		return;
	}
	for(int i=0;i<N;i++)
	{
		if(used[i]==true) continue;
		used[i]=true;
		int nnum;
		if(card[i]<10) nnum=num*10+card[i];
		else nnum=num*100+card[i];
		rec(nnum,k+1);
		used[i]=false;
	}
}

int main()
{
	while(true)
	{
	scanf("%d%d",&N,&K);
	if(N==0&&K==0) break;
	se.clear();
	for(int i=0;i<N;i++)
	{
		scanf("%d",card+i);
	}
	memset(used,false,sizeof(used));
	rec(0,0);
	printf("%d\n",se.size());
	}
	return 0;
}

Measured memory_bytes: 1152
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import qualified Data.Map as Map
import Data.List

import Control.Monad
import Control.Monad.State

import Data.Char

getInts :: IO [Int]
getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main :: IO ()
main = do
  c <- getChar

  putStrLn $ [chr (ord c + 1)]


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {

	int n; cin >> n;
	string s; cin >> s;
	int left_need = 0;
	int right_need = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') right_need++;
		else { // s[i] == ')'
			if (right_need == 0) {
				left_need++;
			}
			else { // 1 <= right_need
				right_need--;
			}

		}
	}
	string ans = "";
	for (int i = 0; i < left_need; i++) {
		ans += '(';
	}
	ans += s;
	for (int i = 0; i < right_need; i++) {
		ans += ')';
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define mk make_pair
using namespace std;
int a[20],n;
int dfs(int d,int x,int y){
  if(d==n){if(y<x)swap(x,y);return y-x;}
  return min(dfs(d+1,x+a[d],y),dfs(d+1,x,y+a[d]));
}
int main(){
  while(cin>>n,n){
    for(int i=0;i<n;i++)cin>>a[i];
    cout<<dfs(0,0,0)<<endl;
  }
}

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

string e[12];
int idx[5010];
bool dp[5010][1 << 12];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int n, m;
	while(cin >> n >> m, n){
		map<string, int> sm;
		for(int i = 0; i < n; i++){
			cin >> e[i];
			sm[e[i]]++;
		}
		string s;
		for(int i = 0; i < m; i++){
			string t;
			cin >> t;
			s += t;
		}
		int L = s.size();
		for(int i = 0; i < L; i++){
			idx[i] = 0;
		}
		for(int i = 0; i < n; i++){
			int len = e[i].length();
			for(int j = 0; j + len <= L; j++){
				if(e[i] == s.substr(j, len)) idx[j] |= 1 << i;
			}
		}

		memset(dp, 0, sizeof dp);
		for(int i = 0; i < L + 1; i++){
			dp[i][0] = true;
		}
		for(int i = 0; i < L; i++){
			for(int j = 0; j < 1 << n; j++){
				if(!dp[i][j]) continue;
				for(int k = 0; k < n; k++){
					if(idx[i] >> k & 1){
						if(j >> k & 1) continue;
						int len = e[k].length();
						dp[i + len][j | (1 << k)] = true;
					}
				}
			}
		}

		ll ans = 0;
		for(int i = 0; i <= L; i++){
			ans += dp[i][(1 << n) - 1];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 23284
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

using ld=long double;
int main() {	
	pair<int,pair<int,int>>p1,p2;
	int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
	p1=make_pair(a,make_pair(b,c));
	p2=make_pair(d,make_pair(e,f));
	if(p1>p2)swap(p1,p2);
	
	int ysa=p2.first-p1.first;
	int ans=0;
	if (p1.second >= p2.second) {
		ans=ysa;
	}
	else {
		ans=ysa+1;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> ANS(N + 1);
	for (long long A = 1; ; A++) {
		if (A * A > N) break;
		for (long long B = 1; ; B++) {
			if (A * A + B * B + A * B > N) break;
			for (long long C = 1; ; C++) {
				long long X = A * A + B * B + C * C + A * B + B * C + C * A;
				if (X > N) break;
				ANS[X]++;
			}
		}
	}
	for (int i = 1; i <= N; i++) cout << ANS[i] << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int len=10000,maxlen=1000000;
const int mod=1e9+7;

int n,ans=0,lcm=1,cnt=0;
int a[len+5],p[maxlen+5],prime[maxlen+5],prime1[maxlen+5];

int quick_power(int a,int b)
{
	if (b==0)  return 1;
	
	int res=1;
	for (;b;b=b>>1,a=(a*a)%mod)
	{
		if (b&1)  res=(res*a)%mod;
	}
	return res;
}

int ny(int x)
{
	return quick_power(x,mod-2)%mod;
}

int divide(int a,int b)
{
	return (a*ny(b))%mod;
}

bool moid(int k)
{
	if (k==0||k==1)  return false;
	for (int i=2;i*i<=k;i++)
	{
		if (k%i==0)  return false;
	}
	return true;
}

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)  cin>>a[i];
	
	for (int i=1;i<=n;i++)
	{
		int k=a[i];
		if (moid(k))  p[k]=max(p[k],1ll);
		for (int j=2;j*j<=a[i];j++)
		{
			if (k%j==0)
			{
				int pos=0;
				while (k%j==0)
				{
					k=k/j;
					pos++;
				}
				p[j]=max(p[j],pos);
			}
		}
		p[k]=max(p[k],1ll);
	}
	for (int i=1;i<=maxlen;i++)  lcm=(lcm*quick_power(i,p[i]))%mod;
	for (int i=1;i<=n;i++)  ans=(ans+divide(lcm,a[i]))%mod;
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 8704
object Main {
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val r, g, b = sc.nextInt()

    val ans = if ((r * 100 + g * 10 + b) % 4 == 0) "YES"
    else "NO"


    println(ans)

  }
}

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



#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int>> vvi;
typedef vector<ll>     vl;
typedef vector<vector<ll>> vvl;
const int infi = numeric_limits<int>::max();
const ll  infl = numeric_limits<ll>::max();

const   double         eps = 0;
const   int            ms  = 0;



int main(){
    int n, x;
    cin >> n >> x;
    vi a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    int ans=0,sum=0;    
    rep(i, n){
        sum+=a[i];
        if(sum>x){
            cout << i << endl;
            return 0;
        }
        if(sum==x){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << n-1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define INF 1000000000000
#define MOD 1000000007
#define DEBUG(x) cerr<<'>'<<#x<<':'<<x<< endl
using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    ll len = s.length();
    for(ll i = 0; i < len; i++)
    {
        if(s[i] == '?')
            cout << 'D';
        else
        {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3704
#include<iostream>
#include<algorithm>
#include<vector>

#define INF 100000000

using namespace std;

int graph[400][400],n,dp[400];
bool visit[400];
vector<int>L;

void Tsort(int v){
  visit[v]=true;
  for(int i=0;i<n;i++)
    if(graph[v][i]>0 && !visit[i])Tsort(i);
  L.push_back(v);
}

int main(void){

  int m,a,b,c;

  cin >> n >> m;

  for(int i=0;i<m;i++){
    cin >> a >> b >> c;
    graph[a][b]=c;
  }
  
  Tsort(0);
  reverse(L.begin(),L.end());

  for(int i=1;i<L.size();i++)
    for(int j=0;j<L.size();j++)
      if(graph[L[j]][L[i]]>0)
	dp[L[i]]=max(dp[L[i]],dp[L[j]]+graph[L[j]][L[i]]);
  
  cout << dp[n-1] << endl;
  
  return 0;
}

Measured memory_bytes: 1844
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const long INF=1e18;
long N;
int root(int v,int w){
	if(v>w) swap(v,w);
	if(N==1||v==w) return v;
	int a=(v+N-2)/N,b=(w+N-2)/N;
	if(a==b) return a;
	return root(v,b);
}
int main(){
	int Q;cin>>N>>Q;
	long v,w;
	rep(i,0,Q){
		cin>>v>>w;
		cout<<root(v,w)<<endl;
	}
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(long long i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const ll mod = 1000000007;

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> s(n+1);
    s[0] = 0;
    rep(i, n) s[i+1] = s[i] + a[i];
    vector<ll> x(n+1);

    rep(i, n+1) {
        ll v = s[i] - k * i;
        x[i] = v;        
    }
    {
        map<ll, ll> mp;
        rep(i, n+1) mp[x[i]] = 0;
        int id = 0;
        for (auto& m: mp) {
            m.second = id++;
        }
        rep(i, n+1) {
            x[i] = mp[x[i]];
        }
    }

    BIT<ll> bit(n+1);
    ll ans = 0;
    rep(i, n+1) {
        ans += bit.sum(x[i]);
        bit.add(x[i]);
    }

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


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

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 1e5+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

string s;

void solve(){
    cin>>s;
    if(s == "Sunny"){
        cout<<"Cloudy\n";
    }else if(s == "Cloudy"){
        cout<<"Rainy\n";
    }else{
        cout<<"Sunny\n";
    }
    
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
#ifndef ONLINE_JUDGE
   // printf("%.10f\n",1.0*clock()/CLOCKS_PER_SEC);
#endif
    return 0;
}

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

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

    vector<string> ss;
    for (int i=0; i<n; i++) {
        string s;
        cin >> s;
        ss.push_back(s);
    }

    map<string, int> mp;
    for (int i=0; i<ss.size(); i++) {
        mp[ss[i]]++;
    }

    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 7448
s = input()
a = s[0:2]
b = s[2:4]
ans = ''
for i in [int(a), int(b)]:
        if 1 <= i <= 12:
                ans = ans + 'MM'
        else:
                ans = ans + 'YY'
if ans == 'YYYY':
        ans = 'NA'
elif ans == 'MMMM':
        ans = 'AMBIGUOUS'

print(ans)

Measured memory_bytes: 3064
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,m; cin >> n >> m;
  vvl graph(n,vl(n));
  
  rep(i,m){
    ll a,b; cin >> a >> b; a--; b--;
    graph[a][b] = 1;
    graph[b][a] = 1;
  }
  
  vl path(0);
  
  rep(i,n-1){
    path.push_back(i+1);
  }
  
  ll cnt = 0;
  
  do{
    ll now = 0; ll go = path[0];
    ll goin = 0;
    
    rep(i,n-1){
         
      if(graph[now][go] == 1) goin++;
      
      if(i != n-2){
        now = path[i]; go = path[i+1];
      }
    }
    
    if(goin == n-1) cnt++;
    
    }while(next_permutation(all(path)));
  
  cout << cnt << endl;
  
  
}
      
      

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;

int main(){
    string s;
    cin>>s;
    for(i=0;i<s.length()-1;i++){
        if(s[i]=='A'&&s[i+1]=='C'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
	"bufio"
	"os"
)

func selectionSort(elems []int) int {
	n := len(elems)
	var swapCount int
	for i := 0; i < n; i++ {
		minIndex := i
		for j := i+1; j < n; j++ {
			if elems[j] < elems[minIndex] {
				minIndex = j
			}
		}
		if minIndex != i {
			swapCount++
			elems[i], elems[minIndex] = elems[minIndex], elems[i]
		}
	}
	return swapCount
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	elems := make([]int, n)
	for i := 0; i < n; i++ {
		elem, err := nextInt(sc)
		if err != nil {
			panic(err)
		}
		elems[i] = elem
	}

	count := selectionSort(elems)
	fmt.Println(formatElems(elems))
	fmt.Println(count)

}

func formatElems(elems []int) string {
	n := len(elems)
	as := make([]string, n)
	for i := 0; i < n; i++ {
		as[i] = strconv.Itoa(elems[i])
	}
	return strings.Join(as, " ")
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	return strconv.Atoi(nextText(sc))
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
int A[maxn], B[maxn]; 
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &A[i]);
	for(int i = n; i; --i) scanf("%d", &B[i]);
	for(int i = 1; i <= n; ++i)
		if(A[i] == B[i])
		{
			bool f = 0; 
			for(int j = 1; j <= n; ++j)
				if(B[j] != A[i] && B[i] != A[j])
				{
					swap(B[i], B[j]);
					f = 1;
					break;
				} 
			if(!f)
			{
				puts("No");
				return 0;
			}
		}
	puts("Yes");
	for(int i = 1; i <= n; ++i) printf("%d ", B[i]);
	return 0;
}

Measured memory_bytes: 5388
//b
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] list = new int[N];

		long sum = 0;

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

			list[i] = sc.nextInt();

			sum += list[i];
		}

		sort(list);

		int a = list[N-1]/2;

		System.out.println(sum-a);

	}

	public static void sort(int[] a) {

		//System.out.println("A");
		int h;

		for(h=1; h<a.length/9; h=h*3+1);

		for(;h>0;h/=3) {

			for(int i=h; i<a.length; i++) {

				for(int j=i; j>=h && a[j-h]>a[j]; j-=h) {

					int temp = a[j];

					a[j] = a[j-h];

					a[j-h] = temp;
				}

			}
		}
	}

}


Measured memory_bytes: 23636
# coding: utf-8
# hello worldと表示する
import sys
#import numpy
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,c,d,e,f=MI()
wasser=[]
g=f//100
for i in range(int(f/a)+1):
    for j in range(int(f/a)+1):
        if a*i+b*j<=f//100:
            wasser.append(100*(a*i+b*j))
water=list(set(wasser))
water.sort()
#print(water)
sugar=[]
for x in water:
    sugar.append((min(f-x,e*x//100)))
#print(sugar)
sugmx=[]
for s in sugar:
    mx=0
    for i in range(s//c+1):
        for j in range(s//c+1):
            if mx<=c*i+d*j<=s:
                mx=c*i+d*j
    sugmx.append(mx)
#print(sugmx)
mix=-inf
for i in range(1,len(water)):
    u=sugmx[i]/water[i]
    #print(u)
    if u>=mix:
        mix=u
        ans1=sugmx[i]
        ans2=water[i]
print(ans2+ans1,ans1)



Measured memory_bytes: 41052
#include<bits/stdc++.h>
#define lli   long long int
#define pb push_back
#define rep(i,s,n) for(lli i=s;i<n;i++)
#define irep(i,n,s) for(lli i=n-1;i>=s;i--)
#define mp make_pair
#define mod 1000000007
using namespace std;

int check(string s, string t, int ind)
{
    int c = 0;
    for (int i = 0; i < t.length(); i++)
    {
        if (s[ind] != t[i])
        {
            c++;
        }
        ind++;
    }
    return c;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio;
    cin.tie(NULL);
    int i, j, k, m, n;
    // cin >> t;


    string s;
    string t;
    cin >> s >> t;
    int len_s = s.length();
    int len_t = t.length();
    int ans = INT_MAX;
    rep(i, 0, len_s - len_t + 1)
    {
        int p = check(s, t, i);
        ans = min(p, ans);
    }
    cout << ans;







}




Measured memory_bytes: 3628
s = input()

if s=='zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()

def youngest(str):
    cnt = [0]*26
    for c in str:
        cnt[ord(c)-ord('a')] += 1
    return chr(ord('a')+cnt.index(0))

if len(s)<26:
    print(s+youngest(s))
    exit()

# len(s)==26
suffix = ''
for i,c in enumerate(s[::-1]):
    if len(suffix)==0:
        suffix += c
    else:
        if suffix[i-1]>c:
            break
        else:
            suffix += c

c = 'z'
for i in suffix:
    if i>s[25-len(suffix)]:
        c = min(c,i)

print(s[:25-len(suffix)]+c)


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

#define N 10000


//stack
typedef struct{
  int num[N];
  int head;
}Stack;

 //add to head position
void push(int);
  //delete head position
void pop(void);
  //return head of stack
int top(void);


Stack stack;


 


int main(){

  string str;
  int x,y;
  stack.head=0;
  //load  and caluculation
  while(cin >> str){

    if(str=="+"){
      x=top();
      pop();
      y=top();
      pop();
      push(x+y);
    }
    else if(str=="-"){
      x=top();
      pop();
      y=top();
      pop();
      push(y-x); 
    }
    else if(str=="*"){
      x=top();
      pop();
      y=top();
      pop();
      push(x*y);
    }
    else{
      x = atoi(str.c_str());
      push(x);
    }
  }

  //print
  cout <<top()<<endl;
  
  return 0;
  
}

 //add to head position
  void push(int x){
    stack.head++;
    stack.num[stack.head]=x;
  }
  //delete head position
  void pop(void){
    stack.head--;
  }
  //return head of stack
  int top(void){
    return stack.num[stack.head];
  }

Measured memory_bytes: 0