akhauriyash/Code-Regression huggingface dataset:
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion

void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


void Main(){
    int A, B;
    cin >> A >> B;
    cout << max({A+B, A-B, A*B}) << el;
}



Measured memory_bytes: 256
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall

H, W = map(int, input().split())
C = np.array([list(map(int, input().split())) for _ in range(10)])
A = [list(map(int, input().split())) for _ in range(H)]

C_new = np.where(C == 0, 10**9, C)
G = csgraph_from_dense(C_new, null_value=10**9)
d = floyd_warshall(G)

ans = 0
for line in A:
  for i in line:
    if i != -1:
      ans += d[i, 1]
      
print(int(ans))


Measured memory_bytes: 18384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc175/abc175_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;
  
  ll ans = 0;
  int N = S.size();
  rep(i, N) {
    if (S[i] == 'R') ans++;
  }
  if (ans == 2 && S[1] == 'S') ans = 1;

  cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long d,n,sa,nizyouwa,ans;
  cin>>n>>d;
  ans=0;
  vector<vector<long>> vec(n,vector<long>(d));
  for(long i=0; i<n; i++){
    for(long j=0; j<d; j++){
      cin>>vec.at(i).at(j);
    }
  }
  for(long i=0; i<n-1; i++){
    for(long j=i+1; j<n; j++){
      nizyouwa=0;
      for(long k=0; k<d; k++){
        sa=vec.at(i).at(k)-vec.at(j).at(k);
        nizyouwa=nizyouwa+sa*sa;
      }
      for(int a=1; a*a<=nizyouwa; a++){
        if(a*a==nizyouwa){
          ans=ans+1;
          break;
        }
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/

void build(){

}
LL a , b , c;
void init(){
  a = getint();
  b = getint();
  c = getint();
}
void solve(){
  if( a % 2 == 0 || b % 2 == 0 || c % 2 == 0 )
    puts( "0" );
  else{
    LL ans = min( a * b , min( a * c , b * c ) );
    printf( "%lld\n" , ans );
  }
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int ans=0;
string getstr(string &_s,int _l,int _r){
	string ret="";
	for(int _i=_l;_i<=_r;_i++)ret.push_back(_s[_i]);
	return ret;
}
int a[200005],r[200005];
void msort(int s,int t){
    if(s==t) return ;
    int mid=s+t>>1;
    msort(s,mid),msort(mid+1,t);
    int i=s,j=mid+1,k=s;
    while(i<=mid&&j<=t)
        if(a[i]<=a[j]) r[k++]=a[i++];
        else r[k++]=a[j++],ans+=(ll)mid-i+1;
    while(i<=mid) r[k]=a[i],k++,i++;
    while(j<=t) r[k]=a[j],k++,j++;
    for(int i=s;i<=t;i++) a[i]=r[i];
}
void solve(string s){
	for(int i=1;i<=s.size();i++)a[i]=(s[i-1]=='A');
	msort(1,s.size());
}
string ss;
string s;
signed main(){
	cin>>ss;
	int i;
	for(i=0;i<ss.size();i++){
		if(i+1!=ss.size()&&ss[i]=='B'&&ss[i+1]=='C'){
			i++;
			s.push_back('D');
		}else{
			s.push_back(ss[i]);
		}
	}
	int l=0;
	for(;l<s.size();){
		while(l<s.size()&&s[l]!='A'&&s[l]!='D')l++;
		if(l==s.size())break;
		int r=l;
		while(r<s.size()&&(s[r]=='A'||s[r]=='D'))r++;
		solve(getstr(s,l,r-1));
		l=r;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4108
x1, y1, x2, y2 = map(int, input().split())
hokox = x2 - x1
hokoy = y2 - y1
x3 = x2 - hokoy
y3 = y2 + hokox
x4 = x3 - hokox
y4 = y3 - hokoy
print(x3, end = ' ')
print(y3, end = ' ')
print(x4, end = ' ')
print(y4)

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

using namespace std;

int main() {
  string o, e;
  cin >> o >> e;
  size_t es = e.size();
  for (int i = 0; i < es; i++) {
    cout << o[i] << e[i];
  }
  if (es < o.size()) {
    cout << o[es];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int t = in.nextInt();
            int ans = (t / a) * b;
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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


const int N = 26;

int main(){

    string S, T;
    cin >> S;
    cin >> T;


    vector<int> s[N+1], t[N+1]; //アルファベットがどの位置に何個あるか
    int trans[N+1] = {}; // T -> Sの変換則
    bool identity = true; //SをTに一致させられるかどうか

    for( int i = 1; i <= N ; i++ ){
        for( int j = 0; j < T.size(); j++ ){
            if( S[j] == (char)( i + '`' ) ) s[i].push_back( j );
            if( T[j] == (char)( i + '`' ) ){
                t[i].push_back( j );
                trans[i] = S[j] - '`';
            }
        }
    }

    for( int i = 1; i <= N ; i++ ){
        if( t[i] != s[trans[i]] ) identity = false;
    }

    if( identity ) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;

}

Measured memory_bytes: 2640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    string S;
    cin >>N>>K;
    cin>>S;
    int ans=0;
    for(int i=0;i<N-1;i++){
        if(S.at(i)==S.at(i+1)){
            ans++;
        }
    }
    ans=ans+K*2;
    if(ans>N-1){
        ans=N-1;
    }
    cout << ans <<endl;
}


Measured memory_bytes: 512
#include<iostream>

int main()
{
	int x, res;
	std::cin >> x;
	if (x <= 111)
		res = 111;
	else if (x <= 222)
		res = 222;
	else if (x <= 333)
		res = 333;
	else if (x <= 444)
		res = 444;
	else if (x <= 555)
		res = 555;
	else if (x <= 666)
		res = 666;
	else if (x <= 777)
		res = 777;
	else if (x <= 888)
		res = 888;
	else if (x <= 999)
		res = 999;
	std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define MOD 1000000007
#define MAX 510000

long int FAC[MAX],FINV[MAX],INVE[MAX];
long int SUM(long int a,long int b){return (a%MOD+b%MOD+MOD)%MOD;}//a+b
long int PROD(long int a,long int b){return a%MOD*(b%MOD)%MOD;}//a*b
long int POW(long int a,long int b){//a^b
  long int c=1;
  for(a%=MOD;b;a=PROD(a,a),b>>=1)if(b&1)c=PROD(a,c);
  return c;
}
long int INV(long int a){return a<MAX?INVE[a]:POW(a,MOD-2);}//a^-1
long int QUOT(long int a,long int b){return PROD(a,INV(b));}//a/b
void init_inv(long int a){//make inv list
  INVE[1]=1;
  for(long int i=2;i<=a;i++)INVE[i]=SUM(0,-PROD(INVE[MOD%i],MOD/i));
}
void init_com(long int a){//make fac and facinv list
  FAC[0]=FAC[1]=1;
  FINV[0]=FINV[1]=1;
  init_inv(a);
  for(long int i=2;i<=a;i++){
    FAC[i]=PROD(FAC[i-1],i);
    FINV[i]=PROD(FINV[i-1],INV(i));
  }
}
long int COM(long int a,long int b){return PROD(PROD(FAC[a],FINV[a-b]),FINV[b]);}

int main(){
  long int n;
  scanf("%ld",&n);
  init_com(n);
  printf("%ld",FAC[n]);

}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  int n;
  cin>>n;
  int tmp=0;
  int maxi=0;
  rep(i,n){
    int x,y;
    cin>>x>>y;
    if(x==y)
      tmp++;
    else{
      maxi=max(maxi,tmp);
      tmp=0;
    }
  }
  maxi=max(maxi,tmp);
  if(maxi>=3)
    cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <complex>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

string ret;

void query(int l, int r, int ls, int rs){
	int m = (l+r)/2;
	cout << m << endl;
	cin >> ret;
	if(ret[0] == 'V')
		return;
	if(ret[0] == 'F'){
		if(1-(m-l)%2 == ls)
			query(m, r, 1, rs);
		else
			query(l, m, ls, 1);
	}else{
		if((m-l)%2 == ls)
			query(m, r, 0, rs);
		else
			query(l, m, ls, 0);
	}
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int l = 0, r = N;
	cout << 0 << endl;
	cin >> ret;
	if(ret == "Vacant")
		return 0;
	if(ret == "Male")
		query(0, N, 0, 0);
	else
		query(0, N, 1, 1);
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(void) {
    long long n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
 
    long long ans;
    ans = max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5;
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

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

	for (int i = 0; i <= K; i++) {
		if (i < a[0])continue;
		else {
			set<int> found;
			for (int j = 0; j < N; j++) {
				if (i - a[j] < 0)break;
				found.insert(grundy[i - a[j]]);
			}
			for (int j = 0;; j++) {
				if (found.count(j) == 0) {
					grundy[i] = j;
					break;
				}
			}
		}
	}
	
	if (grundy[K] == 0)cout << "Second" << endl;
	else cout << "First" << endl;
	return 0;
}

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

using namespace std;

vector<int> Shuffle(int, int, vector<int>);

int main(){
  int i, n, r, p, c;
  vector<int> data;

  while(1){
    cin >> n >> r;
    if(n == 0 && r == 0) break;

    for(i=n; i>0; --i)
      data.push_back(i);

    for(i=0; i<r; ++i){
      cin >> p >> c;
      data = Shuffle(p, c, data);
    }

    cout << data[0] << endl;
    data.clear();
  }

  return 0;
}

vector<int> Shuffle(int p, int c, vector<int> x){
  vector<int> y;

  copy(x.begin()+p-1, x.begin()+p+c-1, back_inserter(y));
  copy(x.begin(), x.begin()+p-1, back_inserter(y));
  copy(x.begin()+p+c-1, x.end(), back_inserter(y));

  return y;
}

Measured memory_bytes: 0
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b,x] <- getIntList
    let b' = b `div` x
        (a',m) = a `divMod` x
    print $ b' - a' + if m == 0 then 1 else 0

Measured memory_bytes: 380
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const int INF=1e9;
const long double PI=acos(-1);



void solve(int T){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ans=0;
    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1])ans++;
    }
    cout<<ans+1<<"\n";
}

int main() {
    //fastio

    int T=1;
    //cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3740
N=int(input())
h=list(map(int,input().split()))
h=[0]+h+[0]
ans=0

for i in range(max(h)):
    zero=0
    for j in range(N+1):
        if h[j]==0:
            if h[j+1]==0:
                pass
            else:
                zero+=1
        else:
            h[j]-=1
    ans+=zero

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
//g++ -std=c++11
//g++ -std=c++1z 

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector< pair<int,int> > vp;

int main() {
 
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
 
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);

   	ll n,m,x;
    ll sum = 0;
    cin >> n >> m;
    for (int i=0; i<m; i++) {
      cin >> x;
      sum += x;
    }

    if(n-sum >= 0)
      cout << n-sum << endl;
    else
      cout << -1 << endl;

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  vector<string> v = {"Sunny", "Cloudy", "Rainy"};
  map<string, int> mp;
  rep(i, 3) mp[v[i]] = i;
  string s; cin >> s;
  int num = mp[s];
  num = (num+1)%3;
  cout << v[num] << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int L;
    cin >> L;
    double l = L / 3.0;
    write(l * l * l);
}

Measured memory_bytes: 256
inpl = lambda: list(map(int,input().split()))
M, D = inpl()
ans = 0
for d in range(2,D+1):
    d1 = d % 10
    d10 = d // 10
    if d1 >= 2 and d10 >= 2 and d1*d10 <= M:
        ans += 1
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.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 popcount(n) (__builtin_popcountll(n))

using namespace std;

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 ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

const int limit = 100010;

int main(void){
	int n;
	cin >> n;
	vector<int> a(n);

	rep(i, n) cin >> a[i];
	sort(begin(a), end(a));

	vector<int> add;
	vector<int> sub;

	int m = 0;

	sub.push_back(a[0]);
	m -= a[0];

	rep(i, 1, n - 1){
		if(a[i] >= 0){
			add.push_back(a[i]);
			m += a[i];
		}else {
			sub.push_back(a[i]);
			m -= a[i];
		}
	}

	add.push_back(a[n - 1]);
	m += a[n - 1];

	cout << m << endl;

	int cur = sub.back();
	sub.pop_back();

	while(add.size() >= 2){
		const int val = add.back();
		cout << cur << " " << val << endl;
		add.pop_back();
		cur = cur - val;
	}

	{
		const int val = add.back();
		cout << val << " " << cur << endl;
		add.pop_back();
		cur = val - cur;
	}

	while(sub.size() >= 1){
		const int val = sub.back();
		cout << cur << " " << val << endl;
		sub.pop_back();
		cur = cur - val;
	}


	return 0;
}

Measured memory_bytes: 2808
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n,q;
	cin>>n>>q;
	string s;
	cin>>s;
	vector<char> cc,dd;
	int l=0,r=n-1;

	FOR(i,0,q){
		string t,d;
		cin>>t>>d;
		int dd2=-1;
		char c=t[0];
		if(d[0]=='R')dd2=1;
		cc.PB(c);
		dd.PB(dd2);
	}
	FORD(i,q,0){
		if(l>r)break;
		if(cc[i]==s[r]){
			if(dd[i]==1){
				r--;
			}
		}
		if(r<n-1&&cc[i]==s[r+1]){
			if(dd[i]==-1){
				r++;
			}
		}
		if(cc[i]==s[l]){
			if(dd[i]==-1){
				l++;
			}
		}
		if(l>0&&cc[i]==s[l-1]){
			if(dd[i]==1){
				l--;
			}
		}
	}
	if(l>r)cout<<0<<endl;
	else cout<<r-l+1<<endl;

    return 0;
}


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

using namespace std;
using ll = long long;

class Rolling_Hash {
  private:
    ll n;
    static constexpr ll base1 = 1007, base2 = 2009;
    static constexpr ll mod1 = (1e9+7), mod2 = (1e9+9);
    vector<ll> hash1, hash2, mpow1, mpow2;
  public:
    Rolling_Hash(const string& s) {
        n=s.size();
        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        mpow1.assign(n + 1, 1);
        mpow2.assign(n + 1, 1);
        for(int i = 0; i < n; i++) {
            hash1[i + 1] = (hash1[i]*base1+s[i])%mod1;
            hash2[i + 1] = (hash2[i]*base2+s[i])%mod2;
            mpow1[i + 1] = (mpow1[i]*base1) % mod1;
            mpow2[i + 1] = (mpow2[i]*base2) % mod2;
        }
    }

    auto get(ll l, ll r) {
        ll lefval = hash1[r] - hash1[l]*mpow1[r-l]%mod1;
        ll rigval = hash2[r] - hash2[l]*mpow2[r-l]%mod2;
        if(lefval<0)lefval += mod1;
        if(rigval<0)rigval += mod2;
        return make_pair(lefval,rigval);
    }

  auto get_LCP(ll a,ll b){
    ll len = min( n-a+1,n-b+1 );
    ll low=0,high=len;
    while( high-low>1 ){
      ll mid=(high+low)/2;
      if(get(a,a+mid)!=get(b,b+mid))high=mid;
      else low=mid;
    }
    return low;
  }
};



int main(){
 
  ll n;
  string s;
  cin>>n>>s;
 
  Rolling_Hash rh(s);
  ll ans=0;
  for(int i = 0; i < n; i++){
    for(ll j=i+1;j<n;++j){
      ll lcp=rh.get_LCP(i,j);
      ans=max(ans,min(lcp,j-i));
    }
  }
  cout<<(ans)<<endl;
 
}


Measured memory_bytes: 3760
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		for (String line; (line = tec.readLine()) != null;) {
			boolean[] arr = new boolean[4];
			line=line.toUpperCase();
			for (int i = 0; i < line.length(); i++) {
				switch (line.charAt(i)) {
				case 'S':
					arr[0] = true;
					break;
				case 'N':
					arr[1] = true;
					break;
				case 'W':
					arr[2] = true;
					break;
				case 'E':
					arr[3] = true;
					break;
				}
			}
			if(arr[0]==arr[1]&&arr[2]==arr[3]){
				out.println("Yes");
			}else{
				out.println("No");
			}

		}
		out.close();
	}

}

Measured memory_bytes: 21204
#include<cstdio>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<int,int>P;
int main()
{
	int n,m,k,a,b,l,s;
	vector<P>v[3001];
	for(scanf("%d%d%d",&n,&m,&k);m--;)
	{
		scanf("%d%d%d",&a,&b,&l);
		v[a].push_back(P(l,b));
		v[b].push_back(P(l,a));
	}
	priority_queue<P,vector<P>,greater<P> >q;
	while(k--)
	{
		scanf("%d",&s);
		q.push(P(0,s));
	}
	int d[3001];
	fill(d,d+3001,(int)1e9);
	while(!q.empty())
	{
		P p(q.top());
		q.pop();
		if(d[p.second]<=p.first)
			continue;
		d[p.second]=p.first;
		vector<P>&r=v[p.second];
		for(int i=0;i<r.size();++i)
			q.push(P(p.first+r[i].first,r[i].second));
	}
	int i,j;
	double r=0;
	for(i=1;i<=n;++i)
	{
		for(j=0;j<v[i].size();++j)
		{
			a=d[i];
			b=d[v[i][j].second];
			l=v[i][j].first;
			int diff=max(a,b)-min(a,b);
			if(diff>l)
				r=max(r,(double)max(a,b));
			else
				r=max(r,max(a,b)+(l-diff)/2.);
		}
	}
	printf("%.0f\n",r+1e-8);
	return 0;
}

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

int main(void)
{
	bool judge = true;
	int s, count = 0;
	vector<int> a;
	vector<int>::iterator vec;
	cin >> s;
	a.push_back(s);
	int ans = 0;
	while (judge) {
		vec = a.end() - 1;
		ans++;
		int tmp;
		if (*vec % 2 == 0) tmp = *vec / 2;
		else tmp = *vec * 3 + 1;
		for (vec = a.begin(); vec != a.end(); vec++) {
			if (*vec == tmp) {
				ans++;
				judge = false;
				break;
			}
		}
		a.push_back(tmp);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  sm=0
  for x in l:
    sm+=1/x

  return 1/sm

# main()
print(main())


Measured memory_bytes: 6480
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = a-1;
    if(a<=b){
      count++;
    }
    System.out.println(count);
  }
}

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

using namespace std;
int main()
{
    string a,b,c;
    cin>>a>>b>>c;
    char d,e,f;
    d = a[0]-32;
    e  =b[0]-32;
    f = c[0]-32;
    cout<<d<<e<<f<<endl;
}


Measured memory_bytes: 3508
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var S = Console.ReadLine().ToCharArray();
        var K = Int64.Parse(Console.ReadLine());
        var count = 0L;
        for (int i=0;i<S.Count();++i)
        {
            if (S[i] == '1') count++;
            else break;
        }
        Console.WriteLine(K<=count?'1':S[count]);
    }
}

Measured memory_bytes: 11220
n = int(input())

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n < 1000:
    print(9 + n  - 99)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(909 + n - 9999)
elif n == 100000:
    print(90909)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
 
 
 
int main(){
    ll n; cin >> n;
    map<ll,ll> mp;
    ll a;
    ll cnt = 0;
    rep(i,n){
        cin >> a;
        if(mp.find(a) != mp.end()) cnt++;
        mp[a]++;
    }
    if(mp.size() >= 3){
        if(cnt % 2 == 0) cout << mp.size() << endl;
        else cout << mp.size()-1 << endl;
    }else{
        if(n==3) cout << 1 << endl;
        else cout << mp.size() << endl;
    }
}

Measured memory_bytes: 6528
N=int(input())
s=[]
for i in range(N):
  S=input()
  s.append(S)
m=0
a=0
r=0
c=0
h=0
for i in range(N):
  if s[i][0]=="M":
    m+=1
  if s[i][0]=="A":
    a+=1
  if s[i][0]=="R":
    r+=1
  if s[i][0]=="C":
    c+=1
  if s[i][0]=="H":
    h+=1
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)

Measured memory_bytes: 9776
case=0
while True:
    try:
        case+=1
        W=input()
        if W==0:
            break
        N=input()
        data=[[0 for i in range(2)] for j in range(N)]
        for i in range(N):
            data[i][0],data[i][1]=map(int,raw_input().split(","))
        table=[[-1 for i in range(W+1)] for j in range(N)]
        table[0][0],table[0][data[0][1]]=0,data[0][0]
        for i in range(1,N):
            for j in range(W+1):
                table[i][j]=table[i-1][j]
            for j in range(W+1):
                if table[i-1][j]!=-1 and j+data[i][1]<=W and\
                   table[i-1][j]+data[i][0]>table[i][j+data[i][1]]:
                    table[i][j+data[i][1]]=table[i-1][j]+data[i][0]
        print "Case "+str(case)+':'
        m=max(table[N-1])
        print m
        print table[N-1].index(m)
    except:
        break

Measured memory_bytes: 15344
N,M,K = input().split()

N = int(N)
M = int(M)
K = int(K)

A = list(input().split())
A = [int(c) for c in A]

Sum_A = [0]
ele_A = 0
a = 0

while Sum_A[-1] + A[a] <= K:
    ele_A += A[a]
    a += 1
    Sum_A.append(ele_A)
    if a == len(A):
        break

B = list(input().split())
B = [int(c) for c in B]

Sum_B = [0]
ele_B = 0
b = 0

while Sum_B[-1] + B[b] <= K:
    ele_B += B[b]
    b += 1
    Sum_B.append(ele_B)
    if b == len(B):
        break

h = len(Sum_A) - 1
i = 0
j = 0

while h >= 0:
    while Sum_A[h] + Sum_B[i] <= K:
        j = max(j,h + i)
        if i == len(Sum_B) - 1:
            break
        i += 1
    if h == 0:
        break
    h -= 1

print(j)

Measured memory_bytes: 48528
N = int(input())
ans = []
for i in range(1, N+1):
    s, p = input().split()
    ans.append((s, int(p), i))
X = sorted([(k,v,i) for k,v,i in ans], key=lambda x: (x[0], -x[1]))
[print(x[2]) for x in X]


Measured memory_bytes: 3060
def GCD(a, b):
  if a < b:
    a = a+b
    b = a-b
    a -= b
  q = a//b
  r = a%b
  if r == 0:
    return b
  else:
    return GCD(b, r)

A, B = map(int, input().split())
g = GCD(A, B)
tmp = g
m = 1
ps = []
while m**2 <= g:
  if tmp % m == 0:
    ps.append(m)
    tmp //= m
    m = 2
  else:
    m += 1
ps.append(tmp)
ps = list(set(ps))
print(len(ps))

Measured memory_bytes: 3064
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#define gc() getchar()
typedef long long LL;
const int N=4005,INF=2e9;

char A[N],B[N];

int Solve(int n)
{
	static int L[N],R[N],mxR[N];
	for(int i=1; i<=n; ++i) B[i+n]=B[i];
	for(L[1]=0; B[n-L[1]+1]=='0'; ++L[1]);
	for(int i=2; i<=n; ++i) L[i]=B[i]=='1'?0:L[i-1]+1;
	for(R[n]=0; B[n+R[n]]=='0'; ++R[n]);
	for(int i=n-1; i; --i) R[i]=B[i]=='1'?0:R[i+1]+1;

	int ans=1e9;
	for(int i=0; i<n; ++i)
	{
		int cnt=0;
		memset(mxR,0,sizeof mxR);
		for(int j=1; j<=n; ++j)
			if(A[j]!=B[i+j]) ++cnt, mxR[L[j]]=std::max(mxR[L[j]],R[j]-i);//<<i 右移L[j]次时，除左移i次外还需左移mxR[L[j]]次 
		for(int j=n-1,mx=0; ~j; --j)
			ans=std::min(ans,2*j+2*mx+i+cnt), mx=std::max(mx,mxR[j]);
	}
	return ans;
}

int main()
{
	scanf("%s%s",A+1,B+1); int n=strlen(A+1),f=0;
	for(int i=1; i<=n; ++i) if(B[i]=='1') {f=1; break;}
	if(!f)
	{
		for(int i=1; i<=n; ++i) if(A[i]=='1') return puts("-1"),0;
		return puts("0"),0;
	}
	int ans=Solve(n);
	std::reverse(A+1,A+1+n), std::reverse(B+1,B+1+n);
	ans=std::min(ans,Solve(n));
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int a,b,c,x,y,ans=0; cin>>a>>b>>c>>x>>y;
    ans+=min(a+b,2*c)*min(x,y);
    if(x<=y) ans+=(y-x)*min(b,2*c);
    else ans+=(x-y)*min(a,2*c);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,t,ct;
    cin>>a>>b>>t;
    ct=0;
    if(a>t) cout<<0<<endl;
    else
    {
        for(int i=0;i<=t;i+=a) ct++;
        cout<<(ct-1)*b<<endl;
    }
    return 0;
}




Measured memory_bytes: 256
N, X = map(int, input().split())
L = list(map(int, input().split()))

from itertools import groupby, accumulate, product, permutations, combinations
def solve(N,X,L):
    L = accumulate(L)
    ans = 1
    for i,l in enumerate(L):
        if l>X:
            ans += i
            break
    else:
        ans += N
    return ans
print(solve(N,X,L))

Measured memory_bytes: 38384
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // a-z(97-122), A-Z(65-90)
            var c = ReadLineStr();
            if(97 <= c[0] && c[0] <= 122)
            {
                Console.WriteLine("a");
            }
            else
            {
                Console.WriteLine("A");
            }
        }

        #region 使いまわし
        static string ReadLineStr() { return Console.ReadLine(); }
        static int ReadLineInt() { return Convert.ToInt32(Console.ReadLine()); }
        static (int, int) ReadLineInt2()
        {
            var temp = Console.ReadLine().Split(' ');
            return (Convert.ToInt32(temp[0]), Convert.ToInt32(temp[1]));
        }
        #endregion
    }
}


Measured memory_bytes: 25780
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define N 100010

ll n, a[N], q0[N], q1[N];

int main() {
	while(scanf("%lld", &n)!=EOF){
		for(int i=0; i<n; i++){
			scanf("%lld", &a[i]);
		}
		ll max0=0, max1=0;
		memset(q0, 0, sizeof(q0));
		memset(q1, 0, sizeof(q1));
		for(int i=0; i<n; i+=2){
			q0[a[i]]++;
			q1[a[i+1]]++;
		}
		int c0=-1, c1=-1;
		for(int i=1; i<=100000; i++){
			if(q0[i] > max0){
				max0 = q0[i];
				c0 = i;
			}
		}
		for(int i=1; i<=100000; i++){
			if(q1[i] > max1){
				max1 = q1[i];
				c1 = i;
			}
		}
		if(c1!=c0){
			printf("%d\n", n-max1-max0);
			continue;
		}
		//c1==c0
		int max01=0, max11=0;
		for(int i=1; i<=100000; i++){
			if(i!=c0){
				if(q0[i] > max01){
					max01 = q0[i];
				}
			}
		}
		for(int i=1; i<=100000; i++){
			if(i!=c1){
				if(q1[i] > max11){
					max11 = q1[i];
				}
			}
		}
		printf("%d\n", min(n-max0-max11, n-max01-max1));	
	}
	return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <limits.h>
#include <algorithm>

#define ll long long
#define in(params) cin >> (params);
#define p(params) cout << params << endl;
#define mod 1000000007LL

using namespace std;

int main()
{
    ll N, M;
    cin >> N >> M;

    map<ll, ll> m;
    pair<ll, ll> p[N];

    int A, B;
    for (ll i = 0; i < N; i++)
    {
        cin >> A >> B;

        p[i] = make_pair(A, B);
    }

    sort(p, p + N);

    ll c = 0;
    ll buyNum = 0;
    for (ll i = 0; i < N; i++)
    {
        // p(p[i].first << " " << p[i].second);
        buyNum = min(M, p[i].second);
        c += buyNum * p[i].first;

        M -= buyNum;
    }

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353,INF=1e18;



int main() {
    int S;
    cin>>S;
    int a=S/100,b=S%100;
    if(0<a && a<13 && 0<b && b<13){
        cout<<"AMBIGUOUS"<<endl;return 0;
    }
    if(0<a && a<13){
        cout<<"MMYY"<<endl;return 0;
    }
    if(0<b && b<13){
        cout<<"YYMM"<<endl;return 0;
    }
    cout<<"NA"<<endl;
}

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

int main() {
    int l, r, d; cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; ++i) {
        if (i % d == 0) ++ans;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3592
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("C:\\Users\\BOG\\Desktop\\path.txt");ofstream out("C:\\Users\\BOG\\Desktop\\crd.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); //uid<int> u1(5, 10); u1(rnd);

int main(){
    fast;
    ll a,b; cin>>a>>b;
    cout<<6-a-b;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
l = gets.chomp.split.map(&:to_i)
l.sort!
result = 0
0.upto(n-3) do |a|
  (a+1).upto(n-2) do |b|
    t = l[a] + l[b]
    c = l.bsearch_index{|x| x >= t}
    result += (c ? c : n) - b - 1
  end
end
p result

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

int main()
{
	int x;
	int i = 1;

	while (1) {
		cin >> x;

		if (x == 0) {
			break;
		}

		cout << "Case " << i << ": " << x << endl;
		i++;
	}

	return 0;
}

Measured memory_bytes: 3080
#include<iostream>
#define MAX (256)
using namespace std;

int N, M;
char field[MAX][MAX];
int sx, sy;
int ans = 0;

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

void dfs (int x, int y){
	if(0 <= x && x < N && 0 <= y && y < M && field[x][y] == '.'){
		field[x][y] = '#';
		ans++;
		
		for(int i =0; i < 4; i++){
			int nx = x + dx[i], ny = y + dy[i];
			dfs(nx, ny);
		
		}
	}
}

int main(){

	while(1){
	ans = 0;
	cin >> M >> N;
	
	if(M == 0 && N == 0) break;
	
	for(int i =0; i < N; i++){
		for(int j =0; j < M; j++){
			cin >> field[i][j];
		}
	}
	
	for(int i =0; i < N; i++){
		for(int j =0; j < M; j++){
			if(field[i][j] == '@'){
				sx = i;
				sy = j;
				field[sx][sy] = '.';
			}
		}
	}
		
	dfs(sx, sy);
	
	cout << ans << endl;
	}
	return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for (int i=0; i<N; ++i) {
        cin >> a[i];
    }

    int count = 0;
    int n = 0;
    bool flag = false;
    for (int i=0; i<N; ++i) {
        ++count;
        if (a[n] == 2) {
            flag = true;
            break;
        }
        n = a[n] - 1;
    }

    if (flag) cout << count << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

int main()
{
    int H, W;
    cin >> H >> W;

    vector<string> S(H);

    for (int i = 0; i < H; ++i) {
        cin >> S[i];
    }

    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            if (S[i][j] == '#') {
                cout << '#';
                continue;
            }

            int count = 0;

            for (int k = -1; k <= +1; ++k) {
                for (int l = -1; l <= +1; ++l) {
                    int y = i + k;
                    int x = j + l;

                    if (y < 0 || H <= y) {
                        continue;
                    }

                    if (x < 0 || W <= x) {
                        continue;
                    }

                    if (S[y][x] == '#') {
                        ++count;
                    }
                }
            }

            cout << count;
        }

        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
long long a,b;
string s;
int main(){
    ios::sync_with_stdio(0);
    cin>>a>>s>>b;
    if (s=="+") cout<<a+b<<endl;
    else cout<<a-b<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define sz() size()
#define fr first
#define sc second
#define int long long
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

int n,a[200005],ans;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    for(int i=1;i<n;i++){
        if(a[i] > a[i+1]){
            ans += (a[i] - a[i+1]);
            a[i+1] = a[i];
        }
    }
    cout << ans;
}


Measured memory_bytes: 5212
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int h,w;
char s[2100][2100];
int a[2100][2100],b[2100][2100],c[2100][2100],d[2100][2100];

main(){
  cin>>h>>w;
  rep(i,h){
    cin>>s[i];
  }

  rep(i,h){
    int t=-1;
    rep(j,w){
      if(s[i][j]=='#'){
        t=-1;
      }else{
        t++;
      }
      a[i][j]=t;
    }
  }

  rep(i,h){
    int t=-1;
    rrep(j,w-1){
      if(s[i][j]=='#'){
        t=-1;
      }else{
        t++;
      }
      b[i][j]=t;
    }
  }

  rep(j,w){
    int t=-1;
    rep(i,h){
      if(s[i][j]=='#'){
        t=-1;
      }else{
        t++;
      }
      c[i][j]=t;
    }
  }

  rep(j,w){
    int t=-1;
    rrep(i,h-1){
      if(s[i][j]=='#'){
        t=-1;
      }else{
        t++;
      }
      d[i][j]=t;
    }
  }

  int ans=0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='#') continue;
      ans=max(ans,a[i][j]+b[i][j]+c[i][j]+d[i][j]+1);
    }
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 142208
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
#define mod 998244353 
#define int long long
#define ll long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A) memset(A,0,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000005
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define PI M_PI
#define lower(s) transform(all(s),s.begin(),::tolower)
#define endl "\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, 
         tree_order_statistics_node_update> pbds;
int add(int a, int b) {a=(a%mod + b%mod)%mod;return a;}
int sub(int a, int b) {a =(a%mod - b%mod + mod)%mod ;return a;}
int mul(int a, int b) {return (a%mod * b%mod) % mod;}


void solve()
{  
   int n,m,k,ans=0,s=0;
   cin >> n >> m >> k;vi v;
   vi A(n);vi B(m);
   for(int i=0;i<n;i++){cin>>A[i];if(i!=0)A[i]+=A[i-1];}
   for(int i=0;i<m;i++){cin>>B[i];if(i!=0)B[i]+=B[i-1];}
   
    int x=lb(all(B),k+1) - B.begin();
    ans=max(ans,x);
   for(int i=0;i<n;i++)
   {
       if(A[i]<=k)
       {
           s=i+1;
          x=lb(all(B),(k+1-A[i])) - B.begin();
         ans=max(ans,s+x);
        //cout <<k+1-A[i]<<" "<<  x <<endl;
       }
   }
   cout << ans << endl;
}

signed main()
{ 
    boost
    int test=0,t;
    //cin >> t ;
    t=1;
   while(test++ <t){
	  //cout<<"Case #"<<test<<": ";
	   solve();}
  
}

Measured memory_bytes: 6356