akhauriyash/Code-Regression huggingface dataset:
/*
く__,.ヘヽ.　　　　/　,ー､ 〉
　　　　　＼ ', !-─‐-i　/　/´
　　　 　 ／｀ｰ'　　　 L/／｀ヽ､
　　 　 /　 ／,　 /|　 ,　 ,　　　 ',
　　　ｲ 　/ /-‐/　ｉ　L_ ﾊ ヽ!　 i
　　　 ﾚ ﾍ 7ｲ｀ﾄ　 ﾚ'ｧ-ﾄ､!ハ|　 |
　　　　 !,/7 '0'　　 ´0iソ| 　 |　　　
　　　　 |.从"　　_　　 ,,,, / |./ 　 |
　　　　 ﾚ'| i＞.､,,__　_,.イ / 　.i 　|
　　　　　 ﾚ'| | / k_７_/ﾚ'ヽ,　ﾊ.　|
　　　　　　 | |/i 〈|/　 i　,.ﾍ |　i　|
　　　　　　.|/ /　ｉ： 　 ﾍ!　　＼　|
　　　 　 　 kヽ>､ﾊ 　 _,.ﾍ､ 　 /､!
　　　　　　 !'〈//｀Ｔ´', ＼ ｀'7'ｰr'
　　　　　　 ﾚ'ヽL__|___i,___,ンﾚ|ノ
　　　　　 　　　ﾄ-,/　|___./
　　　　　 　　　'ｰ'　　!_,.
*/
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<fstream>
#include<sstream>
#include<stack>
#include<queue>
#include<map>
#include<deque>
#include<string>
#include<cstring>
#include<cmath>
#include<cctype>
#include<climits>
#include<algorithm>
#include<utility>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define fr front()
#define tp top()

typedef long long int ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> ppi;
typedef pair<int, pii> pip;

#define all(x) x.begin(),x.end()
#define CASE() for(int Case=1;Case<=Tc;Case++)
#define ITR(itr,it) for(__typeof((it).begin()) itr=(it).begin();itr!=(it).end();itr++)
#define iofast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define iofile freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)

const int adj[8][2]={{-1,0},{0,-1},{1,0},{0,1},{-1,-1},{-1,1},{1,1},{1,-1}};
const ll LLINF=9e18;
const int INF=2e9;
const int MOD=1e9+7;
const double EPS=1e-10;
const double PI=acos(-1);
const int SIZE=100005;

int main (){
	
	int a, b, c;
	
	scanf("%d %d %d", &a, &b, &c);
	double ans=(a*b)/2;
	printf("%.0lf\n", ans);
	
	return 0;
}

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

struct Fast{Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define SIZE(x) ll((x).size())
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)

/* REPmacro*/
#define FOR(i, a, b) for (ll i = (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (ll i = (a); i >= (ll)(b); --i)
#define RREP(i, n) RFOR(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* alias */
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vs = vector<string>;

/* const */
const int INF = 1001001001;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};

/* func */
template <typename T = int> inline T in(){T x; cin >> x; return x;}
template <typename T> inline void print(const T& x){cout << x << "\n";}
inline void printvec(const vi& vec){REP(i, SIZE(vec)) cout << vec.at(i) << ((i == SIZE(vec)) ? "\n" : " ");}
inline int lcm(int a, int b){return a / gcd(a, b) * b;}
bool is_prime(int n){if (n < 2) return false;FOR(i, 2, (int)(sqrt(n) + 1)){if (n % i == 0) return false;}return true;}


int calc(int i, int j, int X, int Y){
  int A = abs(j - i);
  int B = abs(X - i) + 1 + abs(j - Y);
  int C = abs(Y - i) + 1 + abs(j - X);
  return min({A, B, C});
}
int main(){
  int N = in(), X = in(), Y = in();
  vi A(N-1);
  FOR(i, 1, N+1){
    FOR(j, i+1, N+1){
      ++A.at(calc(i, j, X, Y)-1);
    }
  }
  EACH(x, A){
    print(x);
  }
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    string s, t;
    cin >> s >> t;
    int res = INF;
    for(int i = 0; i <= s.size() - t.size(); ++i) {
        int c = 0;
        for(int j = 0; j < t.size(); ++j) {
            if(s[i + j] != t[j]) ++c;
        }
        res = min(res, c);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<stdio.h>

int main(void){
    
    int i,j,n,maxv,minv;
    int R[200000];
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d",&R[i]);
    }
    
    maxv=R[1]-R[0];
    minv=R[0];
    for(j=1;j<n;j++){
        if(maxv<R[j]-minv){
            maxv=R[j]-minv;
        }
        
        if(minv>R[j]){
            minv=R[j];
        }
    }
    
    printf("%d\n",maxv);
    
    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    vector<double> vec(n);
    double del;
    for (int i = 0; i < n; i++) cin >> vec.at(i);

    for ( int i = 0; i < n - k; i++){
        del = vec.at(i + k) / vec.at(i);
        if (del <= 1) cout << "No"<< endl;
        else cout << "Yes" << endl;
    }

}

Measured memory_bytes: 4836
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  string ret;
  vector<string> seats(N, "");
  cout << 0 << endl;
  cin >> ret;
  if (ret == "Vacant") return 0;
  seats[0] = ret;
  cout << N - 1 << endl;
  cin >> ret;
  if (ret == "Vacant") return 0;
  seats[N - 1] = ret;
  int l = 0, r = N - 1;
  int mid;
  while (true) {
    mid = (l + r) / 2;
    cout << mid << endl;
    cout << flush;
    cin >> ret;
    if (ret == "Vacant") {
      return 0;
    } else {
      seats[mid] = ret;
      if ((((mid - l) % 2 == 1) && seats[l] == seats[mid]) ||
          (((mid - l) % 2 == 0) && seats[l] != seats[mid])) {
        r = mid;
      } else {
        l = mid;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 6380
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	string N;
	cin >> N;
	ll judge = 0;
	for(int i = 0; i < N.length(); i++){
		judge += N[i] - '0';
	}
	if(judge % 9 == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define ll long long  
#define pb push_back
#define mk make_pair
#define mod 998244353
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define all(x) x.begin(),x.end()
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0); 
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2)
    {
        cout<<"No"<<endl;
    }
    else
    {
        int j=n/2;
        int i=0;int flag=0;
        for(;i<n/2;i++,j++)
        {
            if(s[i]!=s[j])
            flag=1;
        }
        if(flag==1)
        cout<<"No";
        else
        cout<<"Yes";
    }
  
    
    
    return 0;
}
//make all values ll


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define reps(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define rrep(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define rreps(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1) << (n))
#define all(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
template <class T>
bool chmax(T& a, const T& b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b)
{
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;

std::vector<int> fac(200001);   //n!(mod M)
std::vector<int> ifac(200001);  //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

int mpow(int x, int n)
{  //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    int ans = 1;
    while (n != 0) {
        if (n & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        n = n >> 1;
    }
    return ans;
}

int comb(int a, int b)
{  //aCbをmod計算
    if (a == 0 && b == 0)
        return 1;
    if (a < b || a <= 0)
        return 0;
    int tmp = ifac[a - b] * ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    fac[0] = 1;
    ifac[0] = 1;
    for (int i = 0; i < 200000; i++) {
        fac[i + 1] = fac[i] * (i + 1) % MOD;                 // n!(mod M)
        ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;  // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (((i * (i + 1) / 2) * m % MOD) * m % MOD) * comb(n * m - 2, k - 2);
        sum %= MOD;
    }
    for (int i = 0; i < m; i++) {
        sum += (((i * (i + 1) / 2) * n % MOD) * n % MOD) * comb(n * m - 2, k - 2);
        sum %= MOD;
    }
    cout << sum << endl;
    return 0;
}

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

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

    if (a % 2 == 1 && b % 2 == 1){
        result = "Odd";
    } else {
        result = "Even";
    }
    
    cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=3e5+10;
const int mod=1e9+7;
ll a[N],p[N];
ll sum[N];
int n;
int main()
{
	//freopen("H:\\c++1\\in.txt","r",stdin);
	//freopen("H:\\c++1\\out.txt","w",stdout);
	p[0]=1;
	for(int i=1;i<=100;i++)p[i]=(p[i-1]*2)%mod;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	ll ans=0;
	for(ll i=0;i<=60;i++){
		for(int j=1;j<=n;j++){
			if((a[j]>>i)&1)sum[j]=sum[j-1]+1;
			else sum[j]=sum[j-1];
		}
		ll cnt=0;
		for(int j=1;j<n;j++){
			if((a[j]>>i)&1){
				cnt+=(n-j-(sum[n]-sum[j]));
			}else{
				cnt+=(sum[n]-sum[j]);
			}
		}
		cnt%=mod;
		ans=(ans+(1ll*cnt*p[i]%mod))%mod;
	}
	printf("%lld\n",ans);

	return 0;
}

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

using namespace std;

typedef long long ll;

ll a,b;
vector<int> va,vb;

int main(){
    cin >> a >> b;
    ll sum_a,sum_b,aa,bb;
    b++;
    aa = a;
    bb = b;
    ll mod = 2;
    while(aa > 0){
        ll r = a / mod;
        ll c = r * mod / 2;
        if(a % mod > mod / 2){
            c += a % mod - mod / 2;
        }
        va.push_back(c%2);
        aa /= 2;
        mod *= 2;
    }
    sum_a = 0;
    ll p = 1;
    for(int i=0;i<va.size();i++){
        sum_a += p * va[i];
        p *= 2;
    }
    mod = 2;
    while(bb > 0){
        ll r = b / mod;
        ll c = r * mod / 2;
        if(b % mod > mod / 2){
            c += b % mod - mod / 2;
        }
        vb.push_back(c%2);
        bb /= 2;
        mod *= 2;
    }
    sum_b = 0;
    p = 1;
    for(int i=0;i<vb.size();i++){
        sum_b += p * vb[i];
        p *= 2;
    }
    cout << (sum_a ^ sum_b) << endl;
    return 0;
}

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

int main(){
	int a, b, c, x, d = 0;
	cin >> a >> b >> c;
	
	for(x = a; x <= b; x++){
		if(c % x == 0){
			d++;
		}
	}
	cout << d << endl;
		return 0;
}

Measured memory_bytes: 3104
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

#define COMB_MAX (int)2000 + 10
ll f[COMB_MAX], rf[COMB_MAX];
ll inv(ll x) {
	ll res = 1;
	ll k = mod - 2;
	ll y = x;
	while (k) {
		if (k & 1) res = (res * y) % mod;
		y = (y * y) % mod;
		k /= 2;
	}
	return res;
}
void init() {
	f[0] = 1;
	rep(i, 1, COMB_MAX) f[i] = (f[i - 1] * i) % mod;
	rep(i, 0, COMB_MAX) rf[i] = inv(f[i]);
}
//---------------------------------------------------------------------------------------------------
ll C(int n, int k) {
	if (k<0 || k>n || n < 0)return 0;
	ll a = f[n]; // = n!
	ll b = rf[n - k]; // = (n-k)!
	ll c = rf[k]; // = k!

	ll bc = (b * c) % mod;

	return (a * bc) % mod;
}
int main() {
	int n, k;
	cin >> n >> k;
	init();
	rep(i, 1, k + 1) {
		ll r = C(n - k + 1, i) * C(k - 1, i - 1);
		printf("%lld\n", r % mod);
	}
	return 0;
}

Measured memory_bytes: 256
from operator import itemgetter
n=int(input())
p=[int(input()) for i in range(n)]
d=dict()
for i in range(n):
  if p[i]-1 not in d:
    d[p[i]]=1
  else:
    d[p[i]]=d[p[i]-1]+1
d=list(d.items())
d.sort(reverse=True,key=itemgetter(1))
print(n-d[0][1])

Measured memory_bytes: 43816
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    P = [0] * N
    for i in range(N):
        P[i] = int(input())

    dp = [0] * (N + 1)
    for p in P:
        dp[p] = dp[p - 1] + 1

    ans = N - max(dp)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 24536
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define F first
#define S second 
using namespace std;
const LL INF = (LL) 1e9 + 5;
const LL MOD = (LL) 1e9 + 7;
const int MAXN = 100005;

int qn, p1[MAXN], p2[MAXN];
string s, t;

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

	cin >> s >> t >> qn;
	for (int i = 0; i < s.size(); i++) {
		p1[i + 1] = (s[i] == 'A' ? 1 : -1);
		p1[i + 1] += p1[i];
	}
	for (int i = 0; i < t.size(); i++) {
		p2[i + 1] = (t[i] == 'A' ? 1 : -1);
		p2[i + 1] += p2[i];
	}
	
	for (int i = 0; i < qn; i++) {
		int l1, r1, l2, r2;
		cin >> l1 >> r1 >> l2 >> r2;
		
		int c1 = p1[r1] - p1[l1 - 1], c2 = p2[r2] - p2[l2 - 1];
		c1 = (c1 % 3 + 3) % 3;
		c2 = (c2 % 3 + 3) % 3;
		cout << (c1 == c2 ? "YES\n" : "NO\n");
	}

	return 0;
}

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

const int maxn=2e4+10;
int n,p[maxn],a[maxn],b[maxn];

int main(){
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>p[i];
	for(int i=1;i<=n;++i)
		a[i]=i*n,b[i]=(n+1-i)*n;
	for(int i=1;i<=n;++i)
		a[p[i]]+=i;
	for(int i=1;i<=n;++i)
		printf("%d ",a[i]);
	puts("");
	for(int i=1;i<=n;++i)
		printf("%d ",b[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 896
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n,k;
  cin>>n>>k;
  map<ll,ll> ma;
  rep(i,0,n){
    ll a;
    cin>>a;
    ma[a]++;
  }
  vector<pair<ll,ll> > v;
  map<ll,ll>::iterator itr = ma.begin();
  while(itr!=ma.end()){
    ll a = (*itr).fi;
    ll b = (*itr).se;
    v.pb(mp(b,a));
    itr++;
  }
  sort(all(v));
  ll c = v.sz;
  ll ans = 0;
  ll index = 0;
  rep(i,0,v.sz){
    if(c<=k)break;
    ll a = v[i].fi;
    ll b = v[i].se;
    ans += a;
    c--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 18416
#include <stdio.h>

int main( void )
{
	int n, x;
	int i, j, k, sum, cou;
	int ans[3][100] = {};
	
	while(1)
	{
		cou = 0;
		
		scanf( "%d %d", &n, &x );
		
		if( n < 3 || n == 0 && x == 0 )
		{
			break;
		}else
		{
			for( i = 1; i <= n; i++ )
			{
				sum = 0;
				
				for( j = i + 1; j <= n; j++ )
				{
					for( k = j + 1; k <= n; k++ )
					{
						sum = i + j+ k;
						
						if( sum == x )
						{
							cou++;
						}
					}
				}
			}
			printf( "%d\n", cou );
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <assert.h>

char buf[128];
int pos;
#define NOW (buf[pos])

bool isdigit(char c) {
	return ('0' <= c && c <= '9');
}

int digit() {
	if ( !isdigit(NOW) ) {
		fprintf(stderr, "%c: ", NOW);
		assert( isdigit(NOW) );
	}
	int ret = NOW - '0';
	pos++;
	
	return ret;
}
int number() {
	int ret = digit();
	while( isdigit(NOW) ) {
		ret = ret*10 + digit();
	}
	return ret;
}

int expression();
int factor() {
	if ( NOW=='(' ) {
		pos++;
		int ret = expression();
		assert(NOW==')');
		pos++;
		
		return ret;
	}
	
	return number();
}

int term() {
	int ret = factor();
	while ( NOW=='*' || NOW=='/' ) {
		char oper = NOW;
		pos++;
		int right = factor();
		if ( oper == '*' ) {
			ret *= right;
		} else {
			ret /= right;
		}
	}
	
	return ret;
}

int expression() {
	int ret = term();
	while ( NOW=='+' || NOW=='-' ) {
		char oper = NOW;
		pos++;
		int right = term();
		if ( oper == '+' ) {
			ret += right;
		} else {
			ret -= right;
		}
	}
	
	return ret;
}


int main(void) {

	int set;
	scanf("%d", &set);
	
	while(set--) {
		scanf("%s", buf);
		pos = 0;
		printf("%d\n", expression());
	}
	
}

Measured memory_bytes: 1024
// Beginner161.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

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

typedef  long long ll;

ll getResult(ll n, ll k)
{
	if (k == 1 || n == k) return 0;
	if (n > k)
	{
		auto div = n / k;
		return min(abs(n - div * k), abs(n - (div+1)*k));
	}
	else
	{	
		return min(n, k-n);
	}
}

int main()
{
    //A
	/*int a, b, c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << '\n';*/

	//B
	/*int n, m;
	cin >> n >> m;
	vector<int> a(n);

	int c = 0;
	double t = 1.0 / (4 * m);

	int sum = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		sum += a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		double aCoef = a[i] * 1.0 / sum;
		if (aCoef >= t) c++;
	}
	
	cout << (c >= m ? "Yes" : "No");*/


	//C
	ll n, k;
	cin >> n >> k;

	auto result = getResult(n, k);
	cout << result;
	
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
	ll n, ans = 0;
	cin >> n;
	for (ll i = 2; i*i <= n; i++) {
		ll x = i;
		while (n % x == 0) 
		{
			n /= x;
			x *= i;
			ans++;
		}
		while (n % i == 0) {
			n /= i;
		}
	}
	if (n != 1) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"

vector<pair<ld, int>>ps;

ld getdis(pair<ld, int>&f, pair<ld, int>&t) {
	return sqrt((f.first - t.first)*(f.first - t.first) + (f.second - t.second)*(f.second - t.second));
}
ld getdis(int from, int to) {
	return getdis(ps[from], ps[to]);
}

struct aa{
	int a;
	int b;
	ld time;
};
class Compare {
public:
	//aa?????????????????¶
	bool operator()(const aa&l, const aa&r) {
		return l.time> r.time;
	}
};

vector<int> getsta(const int now) {
	vector<int>sta;
	{

		int s;
		if (now == 0)s = -1;
		else if (ps[now - 1].second  < ps[now].second)s = 0;
		else if (ps[now - 1].second == ps[now].second)s = 1;
		else s = 2;
		sta.push_back(s);
	}
	sta.push_back(1);
	{

		int s;
		if (now == ps.size()-1)s = -1;
		else if (ps[now + 1].second < ps[now].second)s = 0;
		else if (ps[now  +1].second == ps[now].second)s = 1;
		else s = 2;
		sta.push_back(s);
	}
	return sta;
}
int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		ps.clear();
		{
			set<int>ys;
			vector<pair<ld, int>>or_ps;
			for (int i = 0; i < N; ++i) {
				int x, y; cin >> x >> y;
				or_ps.emplace_back(x, y);
				ys.emplace(y);
			}
			for (int i = 0; i < N - 1; ++i) {
				ps.emplace_back(or_ps[i]);
				for (auto y : ys) {
					if ((or_ps[i].second < y&&y < or_ps[i + 1].second) || (or_ps[i + 1].second < y&&y<or_ps[i].second)) {
						ld x = or_ps[i].first + (or_ps[i + 1].first - or_ps[i].first)*(ld(y - or_ps[i].second) / (or_ps[i + 1].second - or_ps[i].second));
						ps.emplace_back(ld(x), y);
					}
				}
			}
			ps.emplace_back(or_ps[N - 1]);
			sort(ps.begin(), ps.end());
		}
		priority_queue<aa, vector<aa>, Compare>que;
		que.push(aa{ 0, int(ps.size()) - 1, 0});
		map<pair<int, int>, ld>memo;
		memo[make_pair(0, ps.size()-1)] = 0;
		ld ans = 0;
		while (!que.empty()) {
			aa atop(que.top());
			que.pop();
			const int nowa = atop.a;
			const int nowb = atop.b;
			const ld nowtime = atop.time;
			if (nowa == nowb) {
				ans = nowtime;
				break;
			}
			vector<int>astatus, bstatus;
			astatus = getsta(nowa);
			bstatus = getsta(nowb);
			for (int i = 0; i < 3; ++i) {
				if (astatus[i] == -1)continue; 
				for (int j = 0; j < 3; ++j) {
					if (bstatus[j] == -1)continue;
					if (astatus[i] == bstatus[j]) {
						const int nexta = nowa + i - 1;
						const int nextb = nowb + j - 1;
						const ld nexttime = nowtime + getdis(nowa, nexta) + getdis(nowb, nextb);
						auto it = memo.find(make_pair(nexta, nextb));
						if (it == memo.end() || it->second>nexttime+eps) {
							memo[make_pair(nexta, nextb)] = nexttime;
							que.push(aa{ nexta,nextb,nexttime });
						}
					}
					
				}
			}
		}
		cout <<fixed<<setprecision(22)<< ans << endl;
		
	}
	return 0;
}

Measured memory_bytes: 5828
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n,m;
  cin >> n >> m;
  int x[n];
  int now = 0;
  x[0] = 0;
  REP(i,n-1) {
    int d;
    cin >> d;
    now += d;
    x[i+1] = now;
  }
  now = 0;
  int pre = 0;
  long long res = 0;
  REP(i,m) {
    int a;
    cin >> a;
    now += a;
    res = (res + abs(x[now]-x[pre])) % 100000;
    pre = now;
  }
  cout <<res << endl;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);
 
using OP = tuple<int, int, int>;

int main(void){
    int n; cin >> n;
    int a, d; cin >> a >> d;

    int m; cin >> m;
    vector<OP> ops(m);
    for(auto & e : ops){
        int x, y, z; cin >> x >> y >> z;
        y--, z--;
        e = tie(x, y, z);
    }

    int K; cin >> K;
    K--;

    rrep(i, m){
        int x, y, z; tie(x, y, z) = ops[i];
        if(x != 0) continue;

        if(K < y or z < K) continue;
        K = y + (z - K);
    }

    int res = a * K * d;
    rep(i, m){
        int x, y, z; tie(x, y, z) = ops[i];

        if(K < y or z < K) continue;

        if(x == 0){
            K = y + (z - K);
        }
        if(x == 1){
            res++;
        }
        if(x == 2){
            res /= 2;
        }
    }

    cout << res << endl;

    return 0;
}

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

using namespace std;

int main()
{
    int n;
    long long int prod=1;
    cin>>n;
    long long int a[100005];
    for(int i=0; i<n; i++)
        scanf("%lld", &a[i]);

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

    for(int i=0; i<n; i++)
    {
        if((a[i])<=(1000000000000000000/prod))
            prod*=a[i];
        else
        {
            cout<<-1;
            return 0;
        }
    }

    printf("%lld",prod);

    return 0;
}


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

using namespace std;

int main(void) {
	int t;
	scanf("%d", &t);
	char s[11];
	set<string> item;

	while(t) {
		scanf("%s", s);
		item.insert(s);
		t--;
	}

	printf("%lu\n", item.size());

	return 0;
}

Measured memory_bytes: 19356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
 template<class T> inline bool chmax(T&a,T&b){if(a<b){a=b;return true;}return false;}
 template<class T> inline bool chmin(T&a,T&b){if(a>b){a=b;return true;}return false;}
 const ll INF = 1LL<<60;
 const ll M = 1000000007;
 ll mpow(ll a,ll b) {ll res=1;while(b!=0){if(b&1)res=res*a%M;a=a*a%M;b=b>>1;}return res;}
 ll mcomb(ll n,ll k){if(k>n/2)return mcomb(n,n-k);ll res=1;for(ll i=0;i<k;i++){res=res*(n-i)%M;res=res*mpow(k-i,M-2)%M;}return res;}
 */

int main(){
    int a;cin>>a;
    cout<<a+a*a+a*a*a<<endl;
    return 0;
}


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


void solve(long long N, long long D, std::vector<long long> X, std::vector<long long> Y){
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if(D >= sqrt((pow(X[i],2) + pow(Y[i],2)))) ans++;
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long D;
    scanf("%lld",&D);
    std::vector<long long> X(N);
    std::vector<long long> Y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&Y[i]);
    }
    solve(N, D, std::move(X), std::move(Y));
    return 0;
}


Measured memory_bytes: 6488
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def dfs(A, already_use, value_list, vi):
    li = []
    for i in range(len(A)):
        if already_use[i] == True:
            break
        if A[i] == value_list[vi] :
            li.append(i)
    for i in range(len(li) - 1, -1, -1):
        print value_list[vi]
        already_use[li[i]] = True
        dfs(A[li[i] + 1:],  already_use[li[i] + 1:], value_list, vi + 1)

def dfs(A, x):
    li = []
    for i in range(len(A)):
        if already_use[i] == True:
            break
        if A[i] == value_list[vi] :
            li.append(i)
    for i in range(len(li) - 1, -1, -1):
        print value_list[vi]
        already_use[li[i]] = True
        dfs(A[li[i] + 1:],  already_use[li[i] + 1:], value_list, vi + 1)


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = [int(input_raw[i]) for i in range(N)]

    ans = []
    already_use = [False for i in range(N)]
    while 1:
        if len(A) <= 0:
            break
        is_NG = True
        for i in range(len(A) - 1, -1, -1):
            if A[i] == i + 1:
                is_NG = False
                ans.append(A[i])
                del A[i]
                break
        if is_NG == True:
            print -1
            return
    for i in range(len(ans)-1, -1, -1):
        print ans[i]




if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include "rail.h"
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define RE return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%Id",&x)
#define SF2(x,y) scanf("%Id%Id",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()

using namespace std;
const long long INF = 1e16;
const long long MOD = 1e9+7;
const int MX=200005;
int a[MX];
int p[MX];
int main(){
    int n,k;
    cin>>n>>k;
    int mn=1e9;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mn=min(mn,a[i]);
    }
    for(int i=0;i<n;i++){
        p[i]=(a[i]==mn);
        if(i)p[i]+=p[i-1];
    }
    for(int i=n;i<=n*2;i++)
        p[i]=p[i-1];
    int ind=0;
    int res=0;
    while(ind<n){
        if(a[ind]==mn){ind++;continue;}
//        cout<<ind<<" "<<p[ind]<<endl;
        if(p[n-1]==p[ind]){
//            cout<<ind<<endl;
            ind--;
            int seg=n-ind;
            res++;
            seg-=k;
            while(seg>0)seg-=k-1,res++;
            break;
        }
        if(p[ind+k-1]-p[ind]>0){
            res++;
            ind+=k;
        }
        else{
            res++;
            ind+=k-1;
        }
    }
    cout<<res;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	if (N % 2 == 0) N /= 2;

	cout << N * 2 << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	string s; cin >> s;
	
	SORT(s);

	if(s == "abc") cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		char[] ans=new char[s.length()];
		for(int i=0; i<s.length(); i++){
			ans[i]=(char)('A'+(s.charAt(i)+n-'A')%26);
			System.out.print(ans[i]);
		}
	}
}


Measured memory_bytes: 26452
#include <bits/stdc++.h>
using namespace std;
//FAZAL_AHMAD
#define rep(i,a,b) for(long long i = (a); i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define pb push_back
using ll = long long;

ll lcm(ll a,ll b){

	return (a*b)/(__gcd(a,b));
}


void solve()
{

double x;
cin>>x;

cout<<!x;

}



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


		solve();
	cout<<endl;


}






Measured memory_bytes: 3788
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto root = new RootNode!int;

  foreach (_; n.iota) {
    auto rd = readln.chomp.splitter(' '), cmd = rd.front;
    switch (cmd) {
    case "insert":
      rd.popFront;
      root.insert(rd.front.to!int);
      break;
    case "find":
      rd.popFront;
      writeln(root.find(rd.front.to!int) ? "yes" : "no");
      break;
    case "print":
      root.inorderWalk;
      root.preorderWalk;
      break;
    default:
      assert(0);
    }
  }
}

class Node(T)
{
  T key;
  Node l, r;

  this(T key)
  {
    this.key = key;
  }

  void insert(T val)
  {
    if (val < key) {
      if (l is null) l = new Node(val);
      else l.insert(val);
    } else {
      if (r is null) r = new Node(val);
      else r.insert(val);
    }
  }

  bool find(T val)
  {
    if (key == val) {
      return true;
    } else if (val < key) {
      if (l is null) return false;
      else return l.find(val);
    } else {
      if (r is null) return false;
      else return r.find(val);
    }
  }

  void inorderWalk()
  {
    if (l !is null) l.inorderWalk;
    write(" ", key);
    if (r !is null) r.inorderWalk;
  }

  void preorderWalk()
  {
    write(" ", key);
    if (l !is null) l.preorderWalk;
    if (r !is null) r.preorderWalk;
  }
}

class RootNode(T)
{
  Node!T n;

  void insert(T val)
  {
    if (n is null) n = new Node!T(val);
    else n.insert(val);
  }

  bool find(T val)
  {
    if (n is null) return false;
    else return n.find(val);
  }

  void inorderWalk()
  {
    if (n !is null) n.inorderWalk;
    writeln;
  }

  void preorderWalk()
  {
    if (n !is null) n.preorderWalk;
    writeln;
  }
}

Measured memory_bytes: 32212
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    

    string s;
    cin >> s;

    int a = 0,b = 0;
    rep(i,0,2){
	a *= 10;
	a += (int)(s[i] - '0');
    }
    rep(i,2,4){
	b *= 10;
	b += (int)(s[i] - '0');
    }

    if( 0 < a && a <= 12){
	if( 0 < b && b <= 12){
	    P("AMBIGUOUS");
	}else{
	    P("MMYY");
	}
    }else{
	if( 0 < b && b <= 12){
	    P("YYMM");
	}else{
	    P("NA");
	}
    }
    return  0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

vl yakusu(ll n){
    vl res;
    FOR(i, 1, ll(sqrt(n)+1)){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i){
                res.push_back(n/i);
            }
        }
    }
    return res;
}

int main() {
    ll X;
    cin >> X;
    auto y = yakusu(X);
    ll s = 0;
    ll a;
    for(ll i = 1; s < X; i++){
        s = i*i*i*i*i;
        a = i;
    }
    while(true){
        for(auto q : y){
            ll b = a - q;
            if(a*a*a*a*a - b*b*b*b*b == X){
                cout << a << " " << b;
                return 0;
            }
        }
        a--;
    }

}

Measured memory_bytes: 3736
#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 ull unsigned long long
#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; }
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    const double PI = 3.14159265358979;
    double a, b, x;
    cin >> a >> b >> x;
    double theta;
    if(x < a*a*b/2.) {
        theta = atan((a*b*b)/2/x);
    } else {
        theta = atan((2*(a*a*b - x)/a/a/a));
    }
    cout << PREC(10) << theta * 180. / PI << endl;
}

Measured memory_bytes: 384
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N, M = invr()
WA = [0] * (N+1)
AC = [0] * (N+1)
penalty = 0
for i in range(M):
    p, s = map(str, input().split())
    p = int(p)
    if s == "AC" and AC[p] == 0:
        AC[p] = 1
        penalty += WA[p]
    elif s == "WA" and AC[p] == 0:
        WA[p] += 1

print(sum(AC), penalty)


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X, Y; cin >> X >> Y;
  REP(i, X+1){ // i:鶴
    if(i*2 + (X-i)*4 == Y){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main(){
    int n, m, l;
    int A[100][100], B[100][100];
    
    // input
    cin >> n >> m >> l;
    // matrix A
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }
    // matrix B
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            cin >> B[i][j];
        }
    }
    
    // output
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            long sum = 0;
            for(int k = 0; k < m; k++){
                sum += A[i][k] * B[k][j];
            }

            if(j == (l - 1)){
                cout << sum << endl;
            }
            else{
                cout << sum << " ";
            }
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std; 
const int dx[]={1,0,-1,0,1,-1,-1,1}; 
const int dy[]={0,1,0,-1,1,1,-1,-1}; 
const int INF = 1e9; 
const long long LINF = 1e18; 
const double EPS = 1e-8; 
#define pb push_back
#define mk make_pair 
#define fr first 
#define sc second 
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); ++i) 
#define rep(i,j) reps(i,0,j) 
#define all(a) (a).begin(),(a).end() 
#define MOD 1000000007 
typedef pair<int,int> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
int N;
int A[300000];
int solve(int depth){
	int nxt = pow(2,(N-depth));
	if(depth == 0){
		return A[0];
	}
	for(int i = 0; i < pow(2,N); i+=nxt){
		if(A[i] < A[i+nxt]){
			A[i] = A[i+nxt]-A[i];
		}
		else if(A[i] > A[i+nxt]){
			A[i] = A[i] - A[i+nxt];
		}
	}
	return solve(depth-1);
}
int main(){
	
	cin >> N;

	rep(i,pow(2,N)){
		cin >> A[i];
	}	

	printf("%d\n",solve(N));

	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int>nag(n);
  for(int i=0;i<n;i++)
    cin >> nag.at(i);
  sort(nag.begin(),nag.end());
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      for(int k=0;k<n;k++){
        if(i!=j&&i!=k&&j!=k){
          if(nag.at(i)!=nag.at(j)&&nag.at(i)!=nag.at(k)&&nag.at(j)!=nag.at(k)){
            if(nag.at(i)+nag.at(j)>nag.at(k)&&nag.at(i)+nag.at(k)>nag.at(j)&&nag.at(k)+nag.at(j)>nag.at(i))
              ans++;
          }
        }
      }
    }
  }
  cout << ans/6 << endl;
  return 0;
}
    

Measured memory_bytes: 3600
#include <iostream>

using namespace std;

typedef unsigned long long ull;

ull mod_pow(ull m,ull n) {
	if (n == 0) {
		return 1;
	}
	
	ull res = mod_pow(m * m % 1000000007ll,n / 2);
	
	if (n % 2) {
		res = res * m % 1000000007ll;
	}
	return res;
}

int main() {
	ull m,n;
	cin >> m >> n;
	cout << mod_pow(m,n) << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

struct Event {
    ll time, type, value;
};

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

    vector<Event> events;
    rep(i, n) {
        int s, t, x;
        cin >> s >> t >> x;
        Event e1 = {s - x, -1, x};
        Event e2 = {t - x, 0, x};
        events.push_back(e1);
        events.push_back(e2);
    }

    rep(i, q) {
        int d;
        cin >> d;

        Event e = {d, 1, i};
        events.push_back(e);
    }

    sort(events.begin(), events.end(), [](Event &e1, Event &e2) {
        vector<ll>
                a = {e1.time, e1.type, e1.value},
                b = {e2.time, e2.type, e2.value};

        return a < b;
    });

    vector<ll> res(q);

    multiset<ll> se;

    for (auto &p : events) {
        ll x = p.time;
        ll t = p.type;
        ll value = p.value;
        if (t == -1) se.insert(value);
        else if (t == 0) se.erase(se.lower_bound(value));
        else res[value] = (se.empty() ? -1 : *(se.begin()));
    }

    for (auto v : res) cout << v << endl;

}

Measured memory_bytes: 27492
Scanf.scanf "%d %d %s" (fun n m s ->
    let trap = Array.make (n + 1) false in
    let rec loop cur hist =
        if cur = 0 then Some hist else
            let rec loop2 d =
                if d = 0 then (trap.(cur) <- true; None) else
                    match loop (cur - d) (d :: hist) with
                    | None -> loop2 (d - 1)
                    | x -> x
            in
            if s.[cur] = '1' || trap.(cur) then None else loop2 (min cur m)
    in
    match loop n [] with
    | None -> print_endline "-1"
    | Some best -> List.iter (Printf.printf "%d ") best; print_newline()
)

Measured memory_bytes: 16980