akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int MOD = 1e9 + 7;

const int64 INF = 1000000000LL * 1000000000LL;

int main() {
  int64 A[3], m;
  cin >> A[0] >> A[1] >> A[2] >> m;
  int64 ret;
  if (m % 2 == 0) {
    ret = A[0] - A[1];
  } else {
    ret = A[1] - A[0];
  }
  if (abs(ret) > INF) {
    cout << "Unfair" << endl;
  } else {
    cout << ret << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>

#define rep(i,n) for(int i = 0; i < n; i++)
#define 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; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

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

  vector<int> height(n);
  rep(i,n) cin >> height[i];

  vector<int> dp(n, inf);
  dp[0] = 0;

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      chmin(dp[i+j], dp[i]+abs(height[i]-height[i+j]));
    }
  }

  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  cout << 180*(n-2) << endl;
}

Measured memory_bytes: 256
import scala.collection.immutable.Map
import scala.io.StdIn._

object Main{
  type UnitedStateOfAmerica = Map[Char, Char]
  val Data : UnitedStateOfAmerica = Map('A' -> 'T', 'T' -> 'A', 'C' -> 'G', 'G' -> 'C')
  def main(args: Array[String]): Unit ={
    val cr : Char = readChar()
    println(Data(cr))
  }
}

Measured memory_bytes: 25376
# AOJ 1114: Get a Rectangular Field
# Python3 2018.7.8 bal4u

s = [[0 for c in range(6)] for r in range(6)]
for k in range(int(input())):
	if k > 0: input()
	for r in range(5):
		a = list(map(int, input().split()))
		for c in range(5): s[r+1][c+1] = s[r+1][c]+a[c]
	ans = 0;
	for r in range(1, 6):
		for c in range(1, 6):
			for c2 in range(5, c-1, -1):
				w2 = w = c2-c+1
				if w2 > s[r][c2]-s[r][c-1]: continue
				ans = max(ans, w2)
				for r2 in range(r+1, 6):
					if w > s[r2][c2]-s[r2][c-1]: break
					w2 += w
					ans = max(ans, w2)
	print(ans)



Measured memory_bytes: 5612
n = int(input())
A = list(map(int, input().split()))
count = 1
ans = 0
if A.count(1) == 0:
    print(-1)
else:
    for i in range(n):
        if A[i] == count:
            count += 1
        else:
            ans += 1
    print(ans)

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

using ll = long long;
using ull = unsigned long long;

#define all(x) begin(x), end(x)



void solve() {
    ull a;
    cin >> a;
    
    cout << a + (a * a) + (a *a*a) << endl;
}







    
    
    
    
    
    
    
    
int main() {
    solve();
}

Measured memory_bytes: 3652
#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);
 
int main(void){
    int w, h; cin >> w >> h;
    int n; cin >> n;
    vi p(n);
    for(auto & e : p) cin >> e;

    int is = 0, os = 0, res = 0;
    for(auto & e : p){
        if(e == 0){
            os++;
        }
        else {
            is++;
        }

        if(os <= w - 2){
            if(is <= w - 2 and os == is)
                res++;
        }
        else if(os <= w + h - 3){
            if(w - 2 <= is and is <= w + h - 5 and os - 2 == is)
                res++;
        }
        else {
            if(w + h - 5 <= is and os - 4 == is){
                res++;
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


template<typename T>
struct BIT {
	int n;
	vector<T>dat;
	BIT(int n = 0) {
		initialize(n);
	}
	void initialize(int temp) {
		n = temp;
		dat.resize(n);
		rep(i, 0, n)dat[i] = 0;
	}
	T sum(int i) {
		T s = 0;
		while (i >= 0) {
			s += dat[i];
			i = (i & (i + 1)) - 1;
		}
		return s;
	}
	T sum_between(int i, int j) {
		if (i > j)return 0;
		return sum(j) - sum(i - 1);
	}
	void plus(int i, T x) {
		while (i < n) {
			dat[i] += x;
			i |= i + 1;
		}
	}
	int lower_bound(T x) {
		if (sum(n - 1) < x)return -1;
		else if (sum(0) >= x)return 0;
		int ng = 0, ok = n - 1;
		while (ok - ng > 1) {
			int mid = (ok + ng) / 2;
			if (sum(mid) >= x)ok = mid;
			else ng = mid;
		}
		return ok;
	}
};




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

	int N, Q;
	cin >> N >> Q;
	BIT<ll>bit;
	bit.initialize(N);

	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		bit.plus(i,a);
	}


	for (int i = 0; i < Q; i++) {
		int q;
		cin >> q;
		if (q == 0) {
			ll p, x;
			cin >> p >> x;
			bit.plus(p, x);
		}
		else {
			int l, r;
			cin >> l >> r;
			puts(bit.sum_between(l,r-1));
		}
	}
	return 0;
}

Measured memory_bytes: 8236
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 2e5 + 5;

int n, m;

int par[N], sz[N];

void make(int v) {
    par[v] = v;
    sz[v] = 1;
}

int find(int v) {
    if (v == par[v])
        return v;
    return par[v] = find(par[v]);
}

void unions(int u, int v) {
    u = find(u);
    v = find(v);
    if (u != v) {
        if (sz[u] < sz[v])
            swap(u, v);
        par[v] = u;
        sz[u] += sz[v];
    }
}


signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        for (int i = 0; i < N; i++)
            make(i);

        cin >> n >> m;
        while (m--) {
            int u, v;
            cin >> u >> v;
            unions(u, v);
        }

        int mx = 0;
        for (int i = 1; i <= n; i++)
            mx = max(mx, sz[i]);
        cout << mx << '\n';
    }
    
    return 0;
}



Measured memory_bytes: 6704
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    ll k, a, b;
    cin >> k >> a >> b;

    if (a >= k){
        cout << 1 << endl;
        return 0;
    }
    if (b >= a){
        cout << -1 << endl;
        return 0;
    }
    cout << (k - a + a - b - 1) / (a - b) * 2 + 1 << endl;


    return 0;
}




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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz 101
#define INF 200

int main(){
  int i,maxi=0,in,j = 0,k,res;
  int data[sz],out[sz];

  rep(i,sz) out[i] = INF;
  rep(i,sz) data[i] = 0;
  while(scanf("%d",&in) != EOF){
    data[in]++;
  }

  rep(i,sz){
    if(maxi == data[i]){
      out[j] = i;
      j++;
    }
    if(maxi < data[i]){
      maxi = data[i];
      rep(k,j) out[k] = 200;
      out[0] = i;
      j = 1;
    }
  }

  rep(i,sz) if(out[i] != INF) printf("%d\n",out[i]);

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

void swap(int *a, int *b);

int main(void)
{
	int w, n;
	int a, b;
	int ans[30];
	int i;

	scanf("%d", &w);
	scanf("%d", &n);

	for (i = 0; i < w; i++){
		ans[i] = i + 1;
	}

	for (i = 0; i < n; i++){
		scanf("%d,%d", &a, &b);
		swap(&ans[a - 1], &ans[b - 1]);
	}

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

	return (0);
}

void swap(int *a, int *b)
{
	*a += *b;
	*b = *a - *b;
	*a -= *b;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define ld(a) while(a--)
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define tcf(v,i) for(auto i : v)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define repd(i,start,lim) for(long long (i)=(start);i>=(lim);i--)
#define present(c,x) (find(all(c),x) != (c).end())
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator
#define INF 		0x3f3f3f3f
#define LLINF       1000111000111000111LL
#define PI 			3.14159265358979323
#define endl '\n'
#ifdef WIN32
#define getchar_unlocked getchar
#endif
#define gc getchar
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define N 1000006
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long int ll;
typedef vector<long long int> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<ii,vii,greater<ii> > spq;
const ll MOD=1000000007LL;
template<typename T> T sqr(T x){return x*x;}
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T>void read(T &x) { register T c = gc(); x = 0; int t = 0; if (c == '-') t = 1, c = gc(); for (; (c < 48 || c>57); c = gc()); for (; c > 47 && c < 58; c = gc()) { x = (x << 1) + (x << 3) + c - 48; }if (t) x = -x; }
template<typename T> T pow(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y%2==1) ans=(ans*x)%m;y/=2;x=(x*x)%m;}return ans%m;} //using this instead of inbuilt pow due to precision issues in that
template<typename T> ll roundp(T x){ll ans=x;if(x-floor(x)<=0.001) ans=floor(x);else if(ceil(x)-x<=0.001) ans=ceil(x);return ans;}
int main(){
	int n,m; cin>>n>>m;
	string s[n],b="",temp;
	rep(i,0,n) cin>>s[i];
	rep(i,0,m){
		cin>>temp; b+=temp;
	}
	string ans;
	for(int z=0;z+m-1<n;z++){
	for(int i=0;i+m-1<n;i++){
		ans=s[z].substr(i,m);
		rep(j,z+1,m+z){
			ans+=s[j].substr(i,m);
		}
		if(ans==b){
			cout<<"Yes"; return 0;
		}
	}		
	}

	cout<<"No";
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int32_t main(){
	cin.tie(0); ios::sync_with_stdio(0);
	
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];
	
	int dp[n][n];
	memset(dp, 0, sizeof dp);
	int r;
	for(int tam = 0; tam < n; tam++){
		for(int l = 0; l + tam < n; l++){
			r = l+tam;
			if(l == r)
				dp[l][r] = a[r];
			else
				dp[l][r] = max(a[l] - dp[l+1][r], a[r] - dp[l][r-1]);
		}
	}
	
	cout << dp[0][n-1] << endl;
}


Measured memory_bytes: 70656
#include <iostream>

using namespace std;

typedef struct {
	int x;
	int y;
} Point;

int main()
{
	Point p1, p2, p3, p4;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;

	Point d = { p2.x - p1.x, p2.y - p1.y };
	p3.x = p2.x - d.y;
	p3.y = p2.y + d.x;
	p4.x = p1.x - d.y;
	p4.y = p1.y + d.x;
	printf("%d %d %d %d\n", p3.x, p3.y, p4.x, p4.y);

	return 0;
}

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

Anum = [0] * N
for i in A:
    Anum[i - 1] += 1

cnt = 0
for i in Anum:
    cnt += i * (i - 1) // 2

for k in range(N):
    ans = cnt - (Anum[A[k] - 1] - 1)
    print(ans)

Measured memory_bytes: 25644
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int L[100];

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

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

	sort(L, L+N);

	int ans = 0;
	for (int i=0; i<N; i++) {
		for (int j=i+1; j<N; j++) {
			for (int k=j+1; k<N; k++) {
				if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;
				if (L[i] + L[j] <= L[k]) continue;
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  bool flag = 1;
  rep(i, 10000) {
    ll a = (i+1)*0.08, b = (i+1)*0.1;
    if (a==n && b==m) {
      cout << i+1 << endl;
      flag = 0;
      break;
    }
  }
  if (flag) {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);

  int kosha[4][3][10];
  for(int i = 0; i < 4; i++) for(int j = 0; j < 3; j++) for(int k = 0; k < 10; k++) kosha[i][j][k] = 0;

  for(int i = 0; i < n; i++){
    int b, f, r, v;
    scanf("%d%d%d%d", &b, &f, &r, &v);
    kosha[b - 1][f - 1][r - 1] += v;
  }

  for(int b = 0; b < 4; b++){
    for(int f = 0; f < 3; f++){
      for(int r = 0; r < 10; r++){
        printf(" %d", kosha[b][f][r]);
      }
      printf("\n");
    }
    if(b < 3){
      for(int i = 0; i < 20; i++) printf("#");
      printf("\n");
    }
  }
}



Measured memory_bytes: 2668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

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

  int n;
  cin >> n;
  int sum = 0;
  vector<int> A;
  rep(i, n) {
    int a;
    cin >> a;
    A.push_back(a);
    sum += a;
  }

  double hei = (double)sum / (double)n;
  int ans = -1;
  double dis = 10000;

  rep(i, n) {
    if (abs(A[i] - hei) < dis) {
      ans = i;
      dis = abs(A[i] - hei);
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main(void){

    int n, m, x, y;
    double xmax, ymin;

    cin >> n >> m >> x >> y;

    vector<int> xi(n), yi(m);

    for(int i = 0;i < n;i++) cin >> xi[i];
    for(int i = 0;i < m;i++) cin >> yi[i];

    xmax = *max_element(xi.begin(), xi.end());
    ymin = *min_element(yi.begin(), yi.end());

    if(xmax < ymin && x < ymin && xmax < y) cout << "No War" << endl;
    else cout << "War" << endl;

    return 0;
}

Measured memory_bytes: 256
Q, H, S, D = list(map(int, input().split()))
N = int(input())

t = min(4*Q, 2*H, S)
if D < 2 * t:
    if N % 2 == 0:
        ans = (N // 2) * D
    else:
        ans = (N // 2) * D + t
else:
    ans = N * t

print(ans)



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

int main(){
    char c;

    cin >> c;

    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define sec setprecision
#define Pair pair<ll,ll>
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	x %= mod;
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return (pow((x * x)%mod , n / 2)%mod);
	else
		return (x * pow(x, n - 1))%mod;
}
int main() {
	string s, t;
	cin >> s >> t;
	int k = s.size();
	int ans = 0;
	rip(i, k)if (s[i] != t[i])ans++;
	cout << ans << endl;
}

Measured memory_bytes: 3920
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


long long int Sint(long long int n) {
  long long int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  long long int n;
  cin>>n;
  if(n==10 || n==100 || n==1000 || n==10000 || n==100000){
    cout<<10<<endl;
  }else{
    cout<<Sint(n)<<endl;
  }
}

Measured memory_bytes: 384
import java.util.*;

public class Main{  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);   
    String s = sc.next();   
    if(s.equals("AAA") || s.equals("BBB")){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }   
  }  
}


Measured memory_bytes: 35688
#include <bits/stdc++.h>
using namespace std;
int main()
{
  // 列数取得
  int N;
  cin >> N;
  // マス作成, 各マスの値を取得
  int masu[2][N];
  for(int i = 0; i < 2; ++i)
  {
    for(int j = 0; j < N; ++j)
    {
      cin >> masu[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; ++i)
  {
    int tmp = 0;
    // 現在列までの1行目の合計飴数
    for (int j = 0; j <= i; ++j)
    {
      tmp += masu[0][j];
    }
    // 上の合計飴数+同列2行目の残りマスの合計飴数
    for (int j = i; j < N; ++j)
    {
      tmp += masu[1][j];
    }
    // 各ルートで一番飴数が多いルートの飴数を残す
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;

const ll MAX_N = 1e5 + 5, MAX_LOG_N = 20;
ll n, S, E, prv, M, K;
ll Arr[MAX_N];
ll Brr[MAX_N];
ll nxt[MAX_LOG_N][MAX_N];
ll Crr[MAX_N];
bool mark[MAX_N];
vector <ll> p;

void dfs (ll v) {
	p.push_back(v);
	mark[v] = true;
	if (!mark[nxt[0][v]])
		dfs(nxt[0][v]);
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> S; prv = S;
	n--;
	for (ll i = 0; i < n; i++) {
		ll tmp;
		cin >> tmp;
		Arr[i] = tmp - prv;
		prv = tmp;
	}

	cin >> M >> K;
	for (ll i = 0; i < n; i++)
		Brr[i] = i;

	for (ll i = 0; i < M; i++) {
		ll tmp;
		cin >> tmp;
		tmp -= 2;

		swap(Brr[tmp], Brr[tmp + 1]);
	}

	for (ll i = 0; i < n; i++) {
		nxt[0][Brr[i]] = i;
	}

	for (ll i = 1; i < MAX_LOG_N; i++)
		for (ll j = 0; j < n; j++)
			nxt[i][j] = nxt[i - 1][nxt[i - 1][j]];

	for (ll i = 0; i < n; i++) {
		if (!mark[i]) {
			dfs(i);
			ll tmp = K % p.size();
			for (ll v: p) {
				ll u = v;
				for (ll i = MAX_LOG_N; ~i; i--)
					if ((tmp >> i) & 1)
						u = nxt[i][u];

				Crr[u] = Arr[v];
			}
			p.clear();
		}
	}

	cout << S << " ";
	for (ll i = 0; i < n; i++) {
		S += Crr[i];
		cout << S << " ";
	}
	return 0;
}

Measured memory_bytes: 23412
N, M = map(int, input().split())
P_Y = []
for i in range(M):
    p, y = map(int, input().split())
    P_Y.append([p, y, i])

sorted_P_Y = sorted(P_Y)
rank = 1
prev_p = -1
for p, y, i in sorted_P_Y:
    if prev_p != p:
        rank = 1
    else:
        rank += 1
    P_Y[i].append(rank)
    prev_p = p
for p, _, _, rank in P_Y:
    print(str(p).rjust(6, '0') + str(rank).rjust(6, '0'))

Measured memory_bytes: 31676
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int r, g, b, n, i, j, counter;
    counter = 0;
	cin >> r >> g >> b >> n;
	for (i = 0; i <= n; i++) {
		for (j = 0; j <= n; j++) {
			if ((n - (r * i + g * j)) % b == 0&&(n - (r * i + g * j))>=0){counter++;}
		}
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <map>
#include <cstring>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int A, B, C;
    int X[4][4];
    cin >> X[1][1] >> X[1][2] >> X[2][2];
    X[3][3] = -(X[1][1] + X[2][2]);
    X[3][2] = -(X[1][2] + X[2][2]);
    X[3][1] = -(X[3][3] + X[3][2]);
    X[2][1] = -(X[3][1] + X[1][1]);
    X[1][3] = -(X[1][1] + X[1][2]);
    X[2][3] = -(X[1][3] + X[3][3]);
    int s = X[1][3] + X[2][2] + X[3][1];
    X[3][3] += s;
    X[3][2] += s;
    X[3][1] -= s;
    X[2][1] += s * 2;
    X[1][3] += s;
    X[2][3] -= s;
    
    for (int i = 1; i < 4; ++i) {
        for (int j = 1; j < 4; ++j) {
            cout << X[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
template <class T> int LIS(vector<T> &a) {
    T INF = numeric_limits<T>::max() / 2;
    vector<T> res(a.size()+1,INF);
    for (int i = 0; i < a.size(); i++) {
        *(lower_bound(res.begin(),res.end(),a[i])) = a[i];
    }
    for (int i = 0; i < a.size(); i++) {
        if (res[i] == INF) return i;
    }
    return (int) a.size();
}
 
 
int main() {
 
    ll x1,y1,x2,y2;
    ll N;
    vector<ll> X,Y;
 
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> N;
 
    X.resize(N);
    Y.resize(N);
    REP(i,N) cin >> X[i] >> Y[i];
 
    bool dir;
    if (x1 <= x2 && y1 <= y2) dir = true;
    if (x1 <= x2 && y1 > y2) dir = false;
    if (x1 > x2 && y1 <= y2) dir = false;
    if (x1 > x2 && y1 > y2) dir = true;
 
    ll u = max(y1,y2);
    ll d = min(y1,y2);
    ll l = min(x1,x2);
    ll r = max(x1,x2);
 
    vector< pair<ll,ll> > arr;
    REP(i,N) {
        if (X[i] >= l && X[i] <= r && Y[i] >= d && Y[i] <= u) {
            if (!dir) Y[i] *= -1;
            arr.push_back(make_pair(X[i],Y[i]));
        }
    }
 
    sort(arr.begin(), arr.end());
 
    vector<ll> lis;
    REP(i,arr.size()) lis.push_back(arr[i].second);
 
    ll cross = LIS<ll> (lis);
    ll t = abs(x1 - x2) + abs(y1 - y2);
 
    long double ans;
 
    if (x1 == x2 || y1 == y2) {
        ans = (long double) t * 100.0;
        if (cross > 0) {
            ans -= 20.0;
            ans += M_PI * 10.0;
        }
        cout << fixed << setprecision(15) << ans << endl;
        return 0;
    }
 
 
    ll over = min(abs(x1 - x2) + 1, abs(y1 - y2) + 1);
 
    ans = (long double) t * 100.0;
    ans -= 20.0 * (long double) cross;
    ans += M_PI * (long double) cross / 2.0 * 10.0;
 
 
    if (over == cross) {
        ans -= M_PI * (long double) 1.0 / 2.0 * 10.0;
        ans += M_PI * 10.0;
    }
 
    //cout << cross << endl;
 
    cout << fixed << setprecision(15) << ans << endl;
 
    return 0;
}


Measured memory_bytes: 11116
import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
	static int mod = (int)1e9+7;
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		String s1 = sc.next();
		String s2 = sc.next();
		int count=0;
		for(int i=0;i<s1.length();i++){
			if(s1.charAt(i)==s2.charAt(i))
				count++;
		}
		System.out.println(count);
		out.close();
	}
	
	public static int partition(int [] arr, int s, int e){
		
		int index=s;
		int pivot = arr[e];
		for(int i=s;i<=e-1;i++){
			if(arr[i]<=pivot){
				arr = swap(arr, index, i);
				index++;
			}
		}
		swap(arr,index,e);
		print(arr);
		return index;
	}
	
	public static int[] swap(int[] arr, int low, int high){
		int temp = arr[low];
		arr[low]=arr[high];
		arr[high]=temp;
		return arr;
	}
	
	
	public static long gcd(long a, long b){
		if(a==0)
			return b;
		
		return gcd(b%a,a);
	}
	
	public static void print(int[] arr){
		for(int i=0;i<arr.length;i++)
			System.out.print(arr[i]+" ");
		System.out.println();
	}
	
	public static class pair{
		int ai;
		int bi;
	}
	
	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			return o1.bi-o2.bi;
		}
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
}

Measured memory_bytes: 20564
//
// main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

struct Edge {
	ll i;
	ll from;
	ll to;
};

void dfs(vector<vector<Edge>>& graph, vector<bool>& visited, vector<bool>& is_odd, vector<bool>& state, bool& change, ll now) {
	visited[now] = true;
	for (Edge e : graph[now]) {
		if (visited[e.to]) {
			continue;
		}
		if (change) {
			state[e.i] = !state[e.i];
		}
		dfs(graph, visited, is_odd, state, change, e.to);
		if (change) {
			state[e.i] = !state[e.i];
		}
	}
	if (is_odd[now]) {
		change = !change;
	}
}

int main() {
	ll N, M;
	cin >> N >> M;
	struct Bomb {
		ll A;
		bool B;
	};
	vector<Bomb> bombs(N);
	rep(i,0,N) {
		cin >> bombs[i].A >> bombs[i].B;
	}
	sort(bombs.begin(), bombs.end(), [](Bomb lhs, Bomb rhs){
		return lhs.A < rhs.A;
	});
	struct Range {
		ll L;
		ll R;
	};
	vector<Range> ranges(M);
	rep(i,0,M) {
		cin >> ranges[i].L >> ranges[i].R;
	}
	vector<vector<Edge>> graph(N+1);
	rep(i,0,M) {
		Range r = ranges[i];
		auto pt = partition_point(bombs.begin(), bombs.end(), [r](Bomb b){
			return b.A < r.L;
		});
		ll a = distance(bombs.begin(), pt);
		pt = partition_point(bombs.begin(), bombs.end(), [r](Bomb b){
			return b.A <= r.R;
		});
		ll b = distance(bombs.begin(), pt);
		graph[a].push_back(Edge{i, a, b});
		graph[b].push_back(Edge{i, b, a});
	}
	vector<bool> is_odd(N+1);
	rep(i,0,N+1) {
		if (i == 0) {
			is_odd[0] = (false != bombs[i].B);
		} else if (i == N) {
			is_odd[N] = (bombs[i-1].B != false);
		} else {
			is_odd[i] = (bombs[i-1].B != bombs[i].B);
		}
	}
	vector<bool> visited(N+1);
	vector<bool> state(M);
	bool change = false;
	rep(i,0,N+1) {
		if (visited[i]) {
			continue;
		}
		dfs(graph, visited, is_odd, state, change, i);
		if (change != false) {
			cout << -1 << endl;
			return 0;
		}
	}
	vector<ll> ans;
	rep(i,0,M) {
		if (state[i]) {
			ans.push_back(i+1);
		}
	}
	cout << ans.size() << endl;
	rep(i,0,ans.size()) {
		cout << ans[i];
		if (i < ans.size()-1) {
			cout << " ";
		}
	}
	cout << endl;
}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N[30];

int main()
{
    string S;
    cin >> S;
    REP(i, S.length())
    {
        N[S[i] - 'a']++;
    }
    REP(i, 27)
    {
        if (N[i] % 2 != 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

bool sosuu[1000000];

int main(void)
{
	int n;
	int sq;
	int i,j;
	int count;
	bool flag;
	int m;

	for(i=2;i<=1000;i++)
	{
		for(j=2;j<=int(1000000/i);j++)
			sosuu[i*j]=true;
	}

	while(~scanf("%d",&n))
	{

		count=0;
		for(m=2;m<=n;m++)
		{
			if(sosuu[m] == false)
				count++;
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 1740
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  int N2 = N%100;
  N /= 100;
  bool ans1 = true;
  bool ans2 = true;
  if(N2==0)
  {
    ans2 = false;
  }
  if(N==0)
  {
    ans1 = false;
  }
  if(N2>12)
  {
    ans2 = false;
  }
  if(N>12)
  {
    ans1 = false;
  }

  if(ans1==true&&ans2==true)
  {
    cout << "AMBIGUOUS" << endl;
  }
  else if(ans1==true&&ans2==false)
  {
    cout << "MMYY" << endl;
  }
  else if(ans1==false&&ans2==true)
  {
    cout << "YYMM" << endl;
  }
  else
  {
    cout << "NA" << endl;
  }
  return 0;
}


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  vector<int> a(n);
  for (auto &i : a) cin >> i;
  sort(all(a));
  cout << a[n / 2] - a[n / 2 - 1] << '\n';
}


Measured memory_bytes: 3992
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def main():
    N = int(input().strip())
    ans = 0
    for i in range(1,N+1):
        for j in range(i,N+1,i):
            ans += j
    return ans

if __name__ == "__main__":
    print(main())

Measured memory_bytes: 73216
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<tuple<int, int, char, int, string>> v(n);
  rep(i, n) cin >> get<0>(v[i]) >> get<1>(v[i]) >> get<2>(v[i]) >> get<3>(v[i]) >> get<4>(v[i]);
  sort(all(v), [&](auto a, auto b) {
    if (get<0>(a) != get<0>(b)) return get<0>(a) < get<0>(b);
    if (get<1>(a) != get<1>(b)) return get<1>(a) < get<1>(b);
    if (get<2>(a) != get<2>(b)) return get<2>(a) < get<2>(b);
    if (get<3>(a) != get<3>(b)) return get<3>(a) < get<3>(b);
    return get<4>(a) < get<4>(b);
  });
  rep(i, n) cout << get<0>(v[i]) << " " //
                 << get<1>(v[i]) << " " //
                 << get<2>(v[i]) << " " //
                 << get<3>(v[i]) << " " //
                 << get<4>(v[i]) << endl;
}



Measured memory_bytes: 12936
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

template<typename T> bool InRange(T t, T l, T r){ return l <= t && t < r; }

int main(){
	
	char str[200];
	
	int N;
	cin >> N;
	double jpn = 0, btc = 0;
	string s, t;
	for(int i=0;i<N;i++){
		double d;
		cin >> s >> t;
		d = stod(s);
		if(t[0] == 'J') jpn += d;
		if(t[0] == 'B') btc += 380000.0 * d;
	}
	
	
	printf("%lf\n", jpn + btc);
	
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

const ll INF = 1LL << 50;

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

    ll sum = 0, minB = INF;
    bool same = true;
    // sum = Aの合計
    // minB = A[i] > B[i]で最小のB[i]

    for (int i = 0; i < N; ++i) {
        ll A, B;
        cin >> A >> B;
        sum += A;
        if (A > B) minB = min(minB, B);
        if (A != B) same = false;
    }

    // 全部同じだったら答えは0であることに注意
    cout << (same ? 0 : sum - minB) << endl;
    return 0;
}


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

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int l, r;
  cin >> l >> r;
  int n = r - l + 1;
  if(n > 2019) n = 2019 + n % 2019;
  int ans = 2019;
  r = l + n - 1;
  for(int i = l; i <= r; i++)
    for(int j = i + 1; j <= r; j++) ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if(S[0]==S[1]||S[1]==S[2]||S[2]==S[3]){
    cout << "Bad" <<endl;
  }  
  else{
    cout << "Good" <<endl;
  }
}

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

int main()
{
	int n;
	cin>>n;
	int a[3][n+1];
	
	for(int i=1;i<=2;i++)
		for(int j=1;j<=n;j++) cin>>a[i][j];
	int y=1;
	a[2][1]+=a[1][1]; 
	while(y<n){
		a[1][y+1]+=a[1][y];
		a[2][y+1]+=max(a[2][y],a[1][y+1]);
		y++;
	}
	cout<<a[2][n]<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(pow(10,6))

N = int(input())
Edges = list([] for _ in range(N))
for n in range (N-1):
    x, y = map(int, input().split())
    Edges[x-1].append(y-1)
    Edges[y-1].append(x-1)

def dfs(cur_node, parent_node):
    grundy = 0
    for child_node in Edges[cur_node]:
        if child_node != parent_node:
            grundy ^= (dfs(child_node, cur_node) + 1)
    return grundy

G = dfs(0, -1)
if G == 0:
    print("Bob")
else:
    print("Alice")

Measured memory_bytes: 114468
from sys import stdin, stdout
from itertools import repeat
def main():
    n, l = map(int, stdin.readline().split())
    a = map(int, stdin.read().split(), repeat(10, n))
    for i in xrange(n - 1):
	if a[i] + a[i+1] >= l:
            ans = range(1, i + 1) + range(n - 1, i + 1, -1) + [i + 1]
            stdout.write('Possible\n')
            stdout.write('\n'.join(map(str, ans)))
            stdout.write('\n')
            return
    print "Impossible"
main()


Measured memory_bytes: 15752
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


void solve() {
	int n;
	string s;
	cin >> n >> s;
	for(int i = 0; i < s.length(); ++i) {
		if((int)s[i] + n > (int) 'Z') s[i] = char(s[i] + n - (int)'Z' + (int)'A' - 1);
		else 
		s[i] = (char)((int)s[i] + n);
		}
		cout << s << endl;
		return;
}


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 


Measured memory_bytes: 3676
import kotlin.system.exitProcess
fun main(args:Array<String>) {
    val k:Long = readLine()!!.toLong()
    var s:Long = 100L
    var count:Int = 0
    while (true) {
        count++
        s = (s.toDouble() * 1.01).toLong()
        if (s >= k) {
            println(count)
            exitProcess(0)
        }
    }
}

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

#define MOD 998244353

using namespace std;

int powers2[201], x[200], y[200];

int main() {
  powers2[0] = 1;
  for (int i = 1; i <= 200; i++) powers2[i] = powers2[i - 1] * 2 % MOD;

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
  
  int res = powers2[n];
  res -= 1 + n + n * (n - 1) / 2;
  res %= MOD;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int counter = 2;
      int a = y[j] - y[i];
      int b = x[i] - x[j];
      int c = -a * x[i] - b * y[i];
      for (int k = 0; k < n; k++) {
        if (k == i || k == j) continue;
        if (a * x[k] + b * y[k] + c != 0) continue;
        if (k < j) break;
        counter++;
      }
      res -= powers2[counter];
      res += 1 + counter + counter * (counter - 1) / 2;
      res %= MOD;
    }
  }
  printf("%d\n", (res % MOD + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#define maxn 105
using namespace std;
typedef long long LL;
struct th { LL w,v;}a[maxn];
bool cmp(th a,th b){
	if(a.w==b.w)return a.v>b.v;
	else return a.w<b.w;
}
int n;
LL W;
LL b[4][maxn];
LL c[4];
LL d[4];
int main(){
	scanf("%d%lld",&n,&W);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&a[i].w,&a[i].v);
	}
	sort(a,a+n,cmp);
	d[0]=a[0].w;
	for(int i=0,j=0,k=0,lst=0;i<n;i++){
		if(a[i].w!=d[lst]){k++;lst++;d[lst]=a[i].w;c[k-1]=j;j=0;}
		b[k][++j]=b[k][j-1]+a[i].v;
		if(i==n-1)c[k]=j;
	//	printf("%d %d %lld\n",k,j,b[k][j]);
	}
/*	for(int i=0;i<4;i++){
		printf("%lld ",d[i]);
	}*/
	LL ans=0;
	for(int q1=0;q1<=c[0];q1++){
		for(int q2=0;q2<=c[1];q2++){
			for(int q3=0;q3<=c[2];q3++){
				for(int q4=0;q4<=c[3];q4++){
					LL sum=q1*d[0]+q2*d[1]+q3*d[2]+q4*d[3];
					LL sum1=b[0][q1]+b[1][q2]+b[2][q3]+b[3][q4];
				//	printf("%lld %lld\n",sum,sum1);
					if(sum<=W)ans=max(ans,sum1);
				}
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  ll N,H[100000];
  cin>>N;
  for (int i(0);i<N;i++)cin>>H[i];
  int maxi(0),cnt(0);
  for (int i(0);i<N-1;i++){
    if (H[i]>=H[i+1]) cnt++;
    else {
      maxi=max(maxi,cnt);
      cnt=0;
    }
    //cout << cnt << endl;
  }
  maxi=max(maxi,cnt);
  cout << maxi << endl;
  return 0;
}



Measured memory_bytes: 1024