akhauriyash/Code-Regression huggingface dataset:
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include<bits/stdc++.h>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>*/

#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define rep(a, b, c) for(int a = b; a <= c; ++a)
#define per(a, b, c) for(int a = b; a >= c; --a)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
//using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
/*typedef tree<pair<int, int>, 
null_type, less<pair<int, int>>, 
rb_tree_tag, tree_order_statistics_node_update>
ordered_set;*/
//find_by_order() order_of_key()

const double eps = 1e-7;
const int mod = 1e9+7, MXN = 5e5+17;
const int dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};

template<typename T>inline bool updmin(T &a, const T &b) {return a > b ? a = b,1 : 0;}
template<typename T>inline bool updmax(T &a, const T &b) {return a < b ? a = b,1 : 0;}

int n, a[MXN];

inline int calc(int x) {
	int res = 0;
	rep(i,1,n) res += (a[i]-x)*(a[i]-x);
	return res;
}

int32_t main() { _
#ifdef DanQQQQQ
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	cin >> n;
	rep(i,1,n) cin >> a[i];
	int l = -100, r = 100;
	while(r-l > 1) {
		int mid = (r+l)>>1;
		if(calc(mid-1) > calc(mid)) l = mid;
		else r = mid;
	}
	cout << min(calc(r),calc(l)) << endl;
//	cerr << calc(l) << " " << l << endl;
//	cerr << calc(r) << " " << r << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, w, s;
vector<int> p[4];
int f(int x, int y){
    if(x >= 4)return 0;
    int res = f(x+1, y);
    for(int i=0;i<p[x].size();i++){
        long long t = y + (i+1) * (x+s);
        if(t <= (long long)w){
            res = max(res, f(x+1, t) + p[x][i]);
        }else{
            break;
        }
    }
    return res;
}
int main(void){
    cin >> n >> w;
    for(int i=0;i<n;i++){
        int u, v;
        cin >> u >> v;
        if(i == 0)s = u;
        p[u-s].push_back(v);
    }
    for(int i=0;i<4;i++){
        sort(p[i].begin(), p[i].end(), greater<int>());
        for(int j=1;j<p[i].size();j++){
            p[i][j] += p[i][j-1];
        }
    }
    cout << f(0, 0) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void){
	int number, i, j, count=0, flag=0, d;
	
	while(scanf("%d", &number)!=EOF){
		count=0;
		int n[number];
		for(i=0; i<number; i++){
			n[i]=i+1;
		}
		
		n[0]=-1;
		for(i=0; i<number; i++){
			if(n[i]!=-1){
				d=i+1;
				for(j=d, flag=0; j<=number; j+=d, flag++){
					if(flag!=0){
						n[j-1]=-1;
					}
				}
			}
		}
	
		for(i=0; i<number; i++){
			if(n[i]!=-1){
				//printf("%d\n", n[i]);
				count++;
			}
		}
		printf("%d\n", count);
	}
	
	return 0;
}

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

int main()
{
 	int a,b,c,d;
  	int s,t;
  	cin >> a >> b >> c >> d;
  	s = a * b;
  	t = c * d;
  
  	s = (s>t) ? s : t;
  	cout << s << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

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

    bool ans = (N+1)/2 >= K;

    if(ans)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#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));}

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 = 200010;
ll n,y;
ll x[limit];

ll calc(ll num){
	ll cur = 1LL * (n + num) * y;
	rep(i,n){
		ll coef = i / num;
		if(coef == 0) cur += 2LL * x[i];
		cur += (2LL * coef + 3LL) * x[i];
	}
	return cur;
}

int main(void){
	cin >> n >> y;
	rep(i,n) cin >> x[i];
	reverse(x,x + n);

	ll ans = 1LL << 60;

	ll low = 1LL, high = n + 1;
	while(high - low > 10){
		const ll m1 = (2 * low + high) / 3LL;
		const ll m2 = (low + 2 * high) / 3LL;
		if(calc(m1) < calc(m2)){
			high = m2;
		} else {
			low = m1;
		}
	}

	rep(i,low,high) chmin(ans,calc(i));
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int T,D,L;
  while(1){
    cin>>T>>D>>L;
    if(T==0)
      break;
    vector<int> x(T,0);
    int ans=0,last=-1;
    
    for(int i=0;i<T;i++){
      cin>>x[i];
    }

    for(int i=0;i<T;++i){
      if(i-D<=last && last>=0)
        ans++;
      if(x[i]>=L)
        last=i;
    }

    cout<<ans<<endl;
  }
}



Measured memory_bytes: 3376
n,m=map(int,input().split())
if n>=m:
    lists=list(map(int,input().split()))
    print(0)
elif n<m:
        lists=list(map(int,input().split()))
        lists=sorted(lists)
        dislist=[0, 0]
        for i in range(m-1):
            dislist.append(lists[i+1]-lists[i])
        dislist=sorted(dislist)
        if n!=1:
            print(sum(dislist[:-(n-1)]))
        else:
            print(sum(dislist))

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

int main(void){

  int a[20000], b[20000];
  char op[20000];
  int i;

  for(i = 0; i < 20000; i++){
    scanf("%d %s %d", &a[i], &op[i], &b[i]);
    if(op[i] == '+'){
      printf("%d\n", a[i] + b[i]);
    }else if(op[i] == '-'){
      printf("%d\n", a[i] - b[i]);
    }else if(op[i] == '*'){
      printf("%d\n", a[i] * b[i]);
    }else if(op[i] == '/'){
      printf("%d\n", a[i] / b[i]);
    }else{
      break;
    }
  }
  
  return 0;
}


Measured memory_bytes: 2080
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt
    val b = sc.nextInt
    val c = sc.nextInt

    val list = List(a,b,c).sorted.map(_.toString)
    val ans = list.reduce((l,r) => l+ " " + r)

    println(ans)

  }
}

Measured memory_bytes: 45056
#include<bits/stdc++.h>//AGC011D
namespace my_std{
	using namespace std;
	#define reg register
	#define Rint register int
	#define FOR(i,a,b) for(register int i=(a),ed_##i=(b);i<=ed_##i;++i)
	#define ROF(i,a,b) for(register int i=(a),ed_##i=(b);i>=ed_##i;--i)
	#define FORit(templ,arr,i,a,b) for(register templ *i=(arr)+(a),*ed_##i=(arr)+(b)+1;i!=ed_##i;++i)
	#define ROFit(templ,arr,i,a,b) for(register templ *i=(arr)+(a),*ed_##i=(arr)+(b)-1;i!=ed_##i;--i)
	#define GO(x,p,e,i,v) for(register int i=p[x].head,v;i;i=e[i].link)
	#define MEM(x,v) memset(x,v,sizeof(x))
	#define fir first
	#define sec second
	#define pq priority_queue
	#define MP make_pair
	typedef long long LL;
	typedef double DB;
	typedef pair<int,int> PII;
	#define Templ(T) template<typename T>
	inline int read(){
		reg int ans=0,f=1; reg char c=getchar();
		while(!isdigit(c)) f^=(c=='-'), c=getchar();
		for(;isdigit(c);c=getchar()) ans=(ans<<1)+(ans<<3)+(c^48);
		return f?ans:-ans;
	}
	Templ(_Tp) inline int chkmin(_Tp &x,_Tp y){ return x>y?x=y,1:0; }
	Templ(_Tp) inline int chkmax(_Tp &x,_Tp y){ return x<y?x=y,1:0; }
	#define using_mod
	const int mod = 998244353;
	#ifdef using_mod
	inline void inc(int &x, const int &y){ x += y; if(x >= mod) x -= mod; }
	inline void dec(int &x, const int &y){ x -= y; if(x < 0) x += mod; }
	inline int ksm(int x,LL y){ int res=1; for(;y;y>>=1,x=1ll*x*x%mod) if(y&1) res=1ll*res*x%mod; return res;}
	#endif
	Templ(_Tp) inline _Tp gcd(_Tp x,_Tp y){ return y?gcd(y,x%y):x; }
	inline int VSC_Local(){
		#ifdef VSC_Compile
		while(getchar() != '\n');
		while(getchar() != '\n');
		#endif
		return 0;
	}
	#define FILE(s) freopen(s ".in", "r", stdin), freopen(s ".out", "w", stdout)
	#define PBTXDY
}
using namespace my_std;

const int N = 200010;
int n, m, a[N << 2], tag, fst;
char S[N];

int main(){
    n = read(), m = read();
	scanf("%s", S + 1);
	FOR(i, 1, n) a[i] = S[i] == 'A';
	fst = 1;
	function<void(void)> update = [&](){
		if(a[fst] ^ tag){
			a[fst] ^= 1;
			return;
		}
		tag ^= 1;
		a[fst + n] = tag ^ 1;
		fst++;
	};

	FOR(i, 1, min(m, n * 3)) update();
	if(m > n * 3){
		if(n & 1){
			Rint t = m - n * 3;
			if(t & 1) update();
			FOR(i, fst, fst + n - 1) putchar('B' - (tag ^ a[i]));
		}
		else{
			FOR(i, 1, n) putchar('A' + (i & 1));
		}
	}
	else{
		FOR(i, fst, fst + n - 1) putchar('B' - (tag ^ a[i]));
	}
	return VSC_Local();
}

Measured memory_bytes: 3328
import sys
from itertools import product
def input(): return sys.stdin.readline().rstrip()

def main():
    X, Y, Z, K = map(int, input().split())
    A, B, C = [sorted(map(int, input().split())) for _ in range(3)]

    AB = [a + b for a, b in product(A, B)]
    AB = sorted(AB, reverse=True)[:K]

    ABC = [ab + c for ab, c in product(AB, C)]
    ABC = sorted(ABC, reverse=True)[:K]
    for i in ABC:
        print(i)

if __name__ == '__main__':
    main()


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

char S[ 200010 ];

int main()
{
int i;
int X;
int iCnt;


	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> X;

	iCnt = 0;
	while( X > 0 )
	{
		if( X % 10 == 2 ) iCnt++;

		X /= 10;
	}

	cout << iCnt << endl;

	return 0;
}


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

int main(){
  int n;
  cin >> n;
  bool boo = true;
  while(boo){
    if(n%111 == 0){
      boo = false;
    }
    else{
	  n++;
    }
    
  }
  cout << n << endl;
}
    

Measured memory_bytes: 256
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn main() {
    let n: usize = read();
    let a: Vec<u64> = read_col(n);

    if a[0] != 0 {
        println!("-1");
        return;
    }

    let mut ans = 0;
    for i in 1..n {
        if a[i] == a[i - 1] + 1 {
            ans += 1;
        } else if a[i] <= a[i - 1] {
            ans += a[i];
        } else {
            println!("-1");
            return;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
ans = float("inf")
for i in range(1, n+1):
    if n%i==0:
        ans = min(ans, i+n//i)
    if i*i>n:
        break
print(ans-2)

Measured memory_bytes: 63816
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<random>
#include<math.h>
#include<limits.h>
#include<iterator>
#include<queue>
#include<functional>
#define rep(i,a) for(int i=0;i<a;i++)
#define nrep(i,a,b) for(int i=a;i<b;i++)
#define mrep(i,a) for(int i=a;i>=0;i--)
#define ll long long
#define vl vector<ll> 
#define vvl vector<vector<ll> > 
#define vb vector<bool> 
#define vvb vector<vector<bool> > 
#define INF 11234567890123456789
using namespace std;

int main(){
	ll N; cin >> N;
	for (int h = 1; h <= 3500; h++){
		for (int n = 1; n <= 3500; n++){
			double temp_d = n*h * 4 - N*n - N*h;
			ll temp_n = n*h * 4 - N*n - N*h;
			if (temp_d == 0 || temp_n == 0) break;
			double ans_d = (N*n*h) / (temp_d);
			ll ans_n = (N*n*h) / (temp_n);
			if (ans_d == ans_n && ans_n>0){
				cout << h << " " << n << " " << ans_n << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define mrp(i,n) for(int i=n-1;i>=0;i--)
#define mrep(i,m,n) for(int i=m;i>=n;i--)
#define mlrp(i,n) for(long long i=n;i>=0;i--)
#define mlrep(i,m,n) for(long long i=m;i>=n;i--)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
ll abs(ll a,ll b){
    return(a>b?a-b:b-a);
}

int main(){
    ll n,m;
    cin >> n >> m;
    if(abs(n,m)>=2){
        cout << 0 << endl;
    }else{
        ll ans=1;
        lrep(i,1,n){
            ans *= i;
            ans %= 1000000007;
        }
        lrep(i,1,m){
            ans *= i;
            ans %= 1000000007;
        }
        if(abs(n,m)==1){
            cout << ans << endl;
        }else if(abs(n,m)==0){
            cout << (2*ans)%1000000007 << endl;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
const ll mod=1000000007;

int countBits(int in){
  int res=0;
  for(int i=0;i<10;i++){
    int msk=1<<i;
    if((in&msk)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

int main() {
  int a,b,c;cin>>a>>b>>c;
  cout<<outputYesNo(a<=c&&c<=b)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1005;
int n,a[maxn][maxn],to[maxn][maxn],num[maxn],ans=0;
struct node{
	int x,y,t;
};
queue<node>q;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		for(int j=1,x;j<n;j++){
			scanf("%d",&x);
			a[i][x]=j,to[i][j]=x;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)if(a[i][j]==1&&a[j][i]==1)q.push((node)<%i,j,1%>);
	for(int i=1;i<=n;i++)num[i]=1;
	while(!q.empty()){
		node res=q.front();
		q.pop();
		int x=res.x,y=res.y,t=res.t;
		num[x]++,num[y]++;
		ans=max(ans,t);
		if(num[x]<n&&num[to[x][num[x]]]==a[to[x][num[x]]][x])q.push((node)<%x,to[x][num[x]],t+1%>);
		if(num[y]<n&&num[to[y][num[y]]]==a[to[y][num[y]]][y])q.push((node)<%y,to[y][num[y]],t+1%>);
	}
	bool flag=1;
//	for(int i=1;i<=n;i++)printf("%d\n",num[i]);
	for(int i=1;i<=n;i++)if(num[i]!=n)flag=0;
	if(!flag)puts("-1");
	else printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll k,a,b,n=1;

int main(){
	cin>>k>>a>>b;
	ll t=min(k,a-n);
	k-=t,n+=t;
	if(b-a>2) n+=k/2*(b-a)+k%2;
	else n+=k;
	cout<<n<<endl;
}

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 reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

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 x, n;
  cin >> x >> n;

  if (n == 0) { cout << x << endl; return 0; }

  map<int, int> p;
  rep(i,n) {
    int a;
    cin >> a;
    p[a]++;
  }

  int a, b;
  for (int i = x; true; i++) {
    if(!p.count(i)) { a = abs(x-i); break; }
  }
  for (int i = x; true; i--) {
    if(!p.count(i)) { b = abs(x-i); break; }
  }

  if (a == b) cout << x-b << endl;
  else if (a > b)  cout << x-b << endl;
  else cout << x+a << endl;
  return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define endl "\n"
#define sz(u) (int)(u.size())
#define L(x)(2*x)
#define R(x)(2*x+1)
#define M(x,y)((x+y)/2)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<a*b;
}


Measured memory_bytes: 3608
import java.util.Scanner;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		
		int [] cal = new int [n];
		int [] result = new int [n];
		
		int work=0,max=0,x=0;
		
		for(int i = 0; i < n; i++){
			cal[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				if(cal[i]>cal[j]){
					work = cal[j];
					cal[j] = cal[i];
					cal[i] = work;
				}
			}
		}
		for(int i = 0; i < n; i++){
			x = 0;
			for(int j = 0; j < i; j++){
				x += cal[j];
				}
				result[i] = (k+x)/(a+(b*i));
		}
		for(int i = 0; i < n; i++){
			if(result[i]>max){
				max = result[i];
			}
		}
		System.out.println(max);
		// TODO Auto-generated method stub

	}

}

Measured memory_bytes: 18212
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

using namespace std;
int main() {

    int i,a_pizza_yen,b_pizza_yen,ab_pizza_yen,a_pizza,b_pizza;
    int min_paid_yen = 0;
    int a_pizza_counter = 0;
    int b_pizza_counter = 0;
    int more_pizza = 0;


    cin >> a_pizza_yen >> b_pizza_yen >> ab_pizza_yen >> a_pizza >> b_pizza;

    if(a_pizza > b_pizza) {
        more_pizza = 1;
    } else if(a_pizza < b_pizza) {
        more_pizza = 2;
    }

    if(a_pizza_yen + b_pizza_yen >= ab_pizza_yen * 2){
        for(i = 0; i < min(a_pizza, b_pizza); i++){
            min_paid_yen += ab_pizza_yen * 2;
            a_pizza_counter++;
            b_pizza_counter++;
        }
    }
    //cout << min_paid_yen << endl;
   
        if(a_pizza_yen <= ab_pizza_yen * 2){
            for(i = a_pizza_counter ; i < a_pizza; i++) {
                min_paid_yen += a_pizza_yen;
            }   
        } else {
            for(i = a_pizza_counter ; i < a_pizza; i++) {
                min_paid_yen += ab_pizza_yen * 2;
            }  
        }
   


        if(b_pizza_yen <= ab_pizza_yen * 2){
            for(i = b_pizza_counter ; i < b_pizza; i++) {
                min_paid_yen += b_pizza_yen;
            }   
        } else {
            for(i = b_pizza_counter ; i < b_pizza; i++) {
                min_paid_yen += ab_pizza_yen * 2;
            }  
        }
   

    cout << min_paid_yen << endl;

    return 0;
}

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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);

const int N = 200005;
int n , ara[N];
int32_t main()
{
    cin >> n;
    FOR(i,1,n)cin >> ara[i];
    sort(ara + 1,ara + n + 1);
    LL ans = ara[n];
    int need = n - 2;
    for(int i = n - 1;i >= 1;i--){
        if(need >= 2){
            ans += ara[i] * 2;
            need -= 2;
        }else if(need == 1){
            ans += ara[i];
            need = 0;
        }
    }
    cout << ans << "\n";

}



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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 333;
int H,W;
int c[MC*2][MC*2];
int sh[MC*2][MC*2],sw[MC*2][MC*2];

int main(){
	cin >> H >> W;
	repp(i,0,H){
		string s; cin >> s;
		repp(j,0,W) c[i+1+j+1][i-j+MC] = sh[i+j+2][i-j+MC] = sw[i+j+2][i-j+MC] = (s[j]=='#'?1:0);
	}
	int z = W+H;
	W = H+MC;
	H = z;
	repp(i,0,H+1) repp(j,0,W+1){
		sh[i+1][j] += sh[i][j];
		sw[i][j+1] += sw[i][j];
	}
	LL ans = 0;
	repp(i,1,H+1) repp(j,1,W+1) repp(k,j+1,W+1){
		if(!c[i][j] || !c[i][k]) continue;
		int d = k-j;
		if(d < i) ans += sw[i-d][k] - sw[i-d][j-1];
		if(i+d <= H) ans += sw[i+d][k] - sw[i+d][j-1];
	}
	repp(j,1,W+1) repp(i,1,H+1) repp(k,i+1,H+1){
		if(!c[i][j] || !c[k][j]) continue;
		int d = k-i;
		if(d < j) ans += sh[k-1][j-d] - sh[i][j-d];
		if(j+d <= W) ans += sh[k-1][j+d] - sh[i][j+d];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5120
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int k;
    cin >> k;
    if (k % 2 == 0 || k % 5 == 0) {
        cout << -1 << endl;
        return 0;
    }
    int s = 7;
    int count = 0;
    while (true) {
        if (count >= 100000000000000000)
            return 0;
        count++;
        if (s % k == 0) {
            cout << count << endl;
            return 0;
        }
        s = (s % k) * 10 + 7;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

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

    if(n == 2){
        if(x == 2){
            cout << "Yes" << endl;
            REP(i, 3){
                cout << i + 1 << endl;
            }
        }else{
            cout << "No" << endl;
        }
        return 0;
    }

    if(x == 1 || x == 2*n - 1){
        cout << "No" << endl;
        return 0;
    }

    vector<int> v(2*n-1);
    REP(i, 2*n-1){
        v[i] = i + 1;
    }

    swap(v[n-1], v[x-1]);
    if(x < n){
        swap(v[x-2], v[n]);
    }else if(x > n){
        swap(v[n-2], v[x]);
    }

    cout << "Yes" << endl;
    for(int i : v){
        cout << i << '\n';
    }

    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
#define fifo ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define ll long long int
#define w(t) ll t; cin>>t; while(t--)
#define pb push_back
#define vll vector<long long int>
#define vi vector<int>
#define mp make_pair
/*
ll GCD(ll a,ll b)
{
	if(b==0)
	return a;
	else
	return GCD(b,a%b);
}


ll x,y,d;       //d is gcd x and y are coefficients
void exten_euclid(ll a,ll b)
{	ll temp;
	if(b==0)
	{
		d=a;
		x=1;
		y=0;	
	}
	else
	{
		exten_euclid(b,a%b);
		temp=x;
		x=y;
		y=temp-(a/b)*y;	
	}
return;
}

ll fastModExp(ll a,ll b)
{
	ll res=1;
	while(b>0)
	{
		if(b&1)
		res=(res*a)%m;
	a=(a*a)%m;
	b=b>>1;	
	}
return res;
}


bool isPrime(ll n) {
	if(n==1)
      return false;
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            return false;               //O(root(N))
        }
    }
    return true;
}

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

/*************FACTORIZE IN 0(LOG(N)) PROVIDED N IS INTEGER**************

int minPrime[100000];

void modified_sieve(int n){
for (int i = 2; i * i <= n; ++i) {
    if (minPrime[i] == 0) {         //If i is prime
        for (int j = i * i; j <= n; j += i) {
            if (minPrime[j] == 0) {
                minPrime[j] = i;
            }
        }
    }
}
for (int i = 2; i <= n; ++i) {
    if (minPrime[i] == 0) {
        minPrime[i] = i;
    }
}
}

vector<int> factorize(int n) {
    vector<int> res;
    while (n != 1) {
        res.push_back(minPrime[n]);
        n /= minPrime[n];
    }
    return res;
}

/*************************************************
void sieve(int N) {
        bool isPrime[N+1];
        for(int i = 0; i <= N;++i) {
            isPrime[i] = true;
        }
        isPrime[0] = false;
        isPrime[1] = false;
        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {                    
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }

ll binomialCoeff(ll n, ll k)  
{  
    ll res = 1;  
  
    // Since C(n, k) = C(n, n-k)  
    if ( k > n - k )  
        k = n - k;  
  
    // Calculate value of  
    // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]  
    for (ll i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
}  



*/
int main()
{
fifo;
string s1,s2,s3,p,q;
cin>>s1;
ll n=s1.length();
bool a=false,b=false,c=false;
string r=s1;
reverse(r.begin(),r.end());
if(s1.compare(r) ==0)
a =true;
s2=s1.substr(0,(n-1)/2);
p=s2;
reverse(p.begin(),p.end());
s3=s1.substr((((n+3)/2) -1),(((n-3)/2)+1));
q=s3;
reverse(q.begin(),q.end());
if(s2.compare(p)==0)
 b=true;


if(s3.compare(q)==0)
 c=true;
if(a && b &&c)
cout<<"Yes";
else
cout<<"No";
return 0;
}

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

using namespace std;

int main()
{
    string A,B;
    string result;
    cin >> A >> B;
    int L1,L2;
    L1 = A.length();
    L2 = B.length();
    if(L1 > L2){
        result = "GREATER";
    }
    if(L1 < L2){
        result = "LESS";
    }
    if(L1 == L2){
        for(int i = 0;i<L1;i++){
            if(A[i] > B[i]){
                result = "GREATER";
                break;
            }else if(A[i] < B[i]){
                result = "LESS";
                break;
            }if(A[L1-1] == B[L2-1]){
            result = "EQUAL";
            }
        }
        
    }
    cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
import collections
n, k = map(int, input().split())
s = input()
zero =[]
cnt = 0
d = collections.deque()
for i, j in enumerate(s):
    if j == '0':
        cnt += 1
    if j == '1' and i > 0:
        if cnt > 0:
            zero.append((cnt, i-1))
            cnt = 0
if cnt > 0:
    zero.append((cnt, n-1))
idx = n-1
one= []
while zero:
    d.append(zero.pop())
    if len(d) < k:
        continue
    if zero:    
        i, j = zero[-1]
        one.append(idx-j)
    else:
        one.append(idx +1)
    k, l = d.popleft()
    idx = l-k
if one == []:
    one.append(n)
print(max(one))
    

Measured memory_bytes: 8828
#include<stdio.h>
int main(void)
{
		int h,w,i,j;
		while(1) {
			scanf("%d %d",&h,&w);
			if(h==0 && w==0) break;
			for(i=0;i<h;i++){
//				printf("i=%d\n",i);
//				printf("h=%d w=%d\n",h,w);
				for(j=0;j<w;j++){
					printf("#");
				}
				printf("\n");
//				printf("i2=%d\n",i);
			}
			printf("\n");
		}
		return 0;
}


Measured memory_bytes: 2068
#include<iostream>
using namespace std;
int main()
{
    long n,i,f=0,c=0;
    long a[1002];
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            f++;
        }

    }
   for(i=0;i<n;i++)
   {
       if(a[i]%2==0)
       {
           if(a[i]%3==0||a[i]%5==0)
           {
               c++;
           }
       }

   }
   if(f==c)
   {
       cout<<"APPROVED";

   }
   else
   {
       cout<<"DENIED";
   }

}


Measured memory_bytes: 256
#標準入力
a,b,c = map(int,input().split())

#自分の持っていたお金で足りるなら0を出力する
if a >= c:print("0")

#自分とAのお金を足しても足りないならNAを出力する
elif a + b < c:print("NA")

#上記の2つ以外ならAにいくら借りるかを計算する
else:print(c - a)


Measured memory_bytes: 5592
n = int(input())
a = list(map(int,input().split()))
sa = sorted(a)
if a==sa:
  print("YES")
else:
  for ai,si,i in zip(a,sa,range(n)):
    if ai!=si:
      a[ai-1],a[i]=a[i],a[ai-1]
      break
  if a==sa:
    print("YES")
  else:
    print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
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;}

int main() {
    int n; cin >> n;
    int x[110];
    rep(i, n) cin >> x[i];
    double sum=0.0;
    rep(i, n) sum += x[i];
    sum = round(sum/(double)n);
    int ans=0;
    rep(i, n){
        ans += pow((sum-x[i]), 2);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1

n = readInt()
x = readInts()
x.sort()
ans = 100000000

for i in range(x[0],x[n-1]+1):
	tmp = 0
	for j in x:
		tmp+=(j-i)**2
	ans = min(ans,tmp)

print(ans)

Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
const ll MOD = 1000000007;
ll fact[100010];

ll modpow(ll x, ll y) {
	ll ans = 1;
	while (y) {
		if (y & 1)ans *= x;
		x *= x;
		ans %= MOD;
		x %= MOD;
		y /= 2;
	}
	return ans;
}

ll moddiv(ll x, ll y) {
	x %= MOD;y %= MOD;
	return x * modpow(y, MOD - 2) % MOD;
}

int main() {
	fact[0] = 1;
	for (ll i = 1;i < 100010;i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= MOD;
	}
	ll N, K, A;
	cin >> N >> K;
	vector<ll> B(N);
	for (ll i = 0;i < N;i++) {
		cin >> B[i];
	}

	sort(all(B));

	ll ans = 0, b;
	for (ll i = 0;i < N;i++) {
		b = N - i - 1;
		if (b >= K - 1) {
			ans -= moddiv(fact[b], fact[K - 1] * fact[b - K + 1]) * B[i];
			ans %= MOD;ans += MOD;ans %= MOD;
		}
		if (i >= K - 1) {
			ans += moddiv(fact[i], fact[K - 1] * fact[i - K + 1]) * B[i];
			ans %= MOD;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
using namespace std;
int main(){
//	freopen("D.in","r",stdin);
	long long A,B;
	if(scanf("%lld%lld",&A,&B)==EOF) return 0;
	int s=-1,t=-1;
	for(int i=60;i>=0;i--)
	{
		if((A&(1LL<<i))!=(B&(1LL<<i))){
			s=i;
			break;
		}
	}
	if(s==-1){
		printf("1\n");
		return 0;
	}
	for(int i=s-1;i>=0;i--)
	{
		if(B&(1LL<<i)){
			t=i;
			break;
		}
	}
	if(t==-1){
		long long ans=(B-A)<<1|1;
		if(!(A&((1<<s)-1))) ans--;
		printf("%lld\n",ans);
		return 0;
	}
	else{
		A=A&((1LL<<s)-1);
		if(A<=((1LL<<(t+1))-1)){
			printf("%lld\n",(1LL<<(s+1))-A);
			return 0;
		}
		long long ans=((1LL<<s)-A)<<1;
		ans=ans+(1LL<<(t+1));
		printf("%lld\n",ans);
	}
	return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


int main(){

    int n;
    cin>>n;
    vector<long long> A(n);

    rep(i,n)cin>>A[i];

    //sort(A.begin(),A.end());
    
    map<long long,int>mp;
    for(int i=n-1;i>-1;i--){
        long long l;
        l=A[i];
        if(mp.find(-l)==mp.end()){
            mp.emplace(make_pair(-l,1));
        }
        else{
            mp[-l]++;
        }
    }

    auto iter=mp.begin();
    long long ans=0;
    bool one=false;
    int now;
    
    while(iter!=mp.end()){
        
        if(iter->second>=4 && !one){
            ans=(iter->first)*(iter->first);
            break;
        }
        else if(iter->second>=2){
            
            if(one){
                ans=now*iter->first;
                break;
            }
            now=(iter->first);
            one=true;
        }
        //cout<<ans<<endl;
        iter++;
        
    }    
    cout<<ans<<endl;
    return 0;

}
/*


*/


Measured memory_bytes: 7296
S = input()
A = int(S[0:2])
B = int(S[2:4])
if(1<=A<=12):
    if(1<=B<=12):
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif(1<=B<=12):
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
// Aizu Vol0 0063: Palindrome
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

char *gets(char *);
char buf[150], *p, *q;

int main()
{
	int ans = 0;

	while (gets(buf) != NULL) {
		p = buf;
		q = p + strlen(p) - 1;
		while (1) {
			if (p >= q) {
				ans++;
				break;
			}
			if (*p != *q) break;
			p++, q--;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define EPS 1e-10

struct Point{
    double x,y;
    Point(){}
    Point(double _x,double _y){
        x=_x; y=_y;
    }
    Point operator +(const Point p)const{
        return Point(x+p.x,y+p.y);
    }
    Point operator -(const Point p)const{
        return Point(x-p.x,y-p.y);
    }
	Point operator *(const double d)const{
		return Point(x*d,y*d);
	}
};

struct Line{
    Point a,b;
    Line(){}
    Line(Point _a,Point _b){
        a=_a; b=_b;
    }
};

double dot(Point p,Point q){
    return p.x*q.x+p.y*q.y;
}

double cross(Point p,Point q){
    return p.x*q.y-q.x*p.y;
}

int ccw(Point a,Point b,Point c){
    if(cross(b-a,c-b)>0) return +1;
    if(cross(b-a,c-b)<0) return -1;
    return 0;
}

bool intersect_ss(Line l,Line m) {
    return ccw(l.a,m.a,l.b)*ccw(l.a,m.b,l.b)<=0 && ccw(m.a,l.a,m.b)*ccw(m.a,l.b,m.b)<=0;
}

bool crosspoint_ll(Line l,Line m,Point &p){
    Point a1,a2,b1,b2;
	a1 = l.b-l.a; a2 = m.b-m.a;
	b1 = m.a-l.a; b2 = m.b-l.a;
	double s1,s2;
	s1 = abs(cross(a1,b1)/2); s2 = abs(cross(a1,b2)/2);
	if(s1<EPS && s2<EPS) return false;
	p = Point(m.a.x+a2.x*s1/(s1+s2),m.a.y+a2.y*s1/(s1+s2));
	return true;
}

bool crosspoint_ss(Line l,Line m,Point &p){
    if(intersect_ss(l,m)==false) return false;
	return crosspoint_ll(l,m,p);
}

int main(){
	Line l[3];
	while(true){
		for(int i=0;i<3;i++){
			cin>>l[i].a.x>>l[i].a.y>>l[i].b.x>>l[i].b.y;
			if(l[i].a.x==0 && l[i].a.y==0 && l[i].b.x==0 && l[i].b.y==0) return 0;
		}
		Point p[3];
		bool kyo = false;
		for(int i=0;i<3;i++){
			if(crosspoint_ss(l[i],l[(i+1)%3],p[i])==false) kyo = true;
		}
		if(kyo==true){
			puts("kyo"); continue;
		}
		double s = abs(cross(p[1]-p[0],p[2]-p[0])/2);
		//printf("\t%lf\n",s);
		if(s<EPS) puts("kyo");
		else if(s<100000.0) puts("syo-kichi");
		else if(s<1000000.0) puts("kichi");
		else if(s<1900000.0) puts("chu-kichi");
		else puts("dai-kichi");
	}
    return 0;
}

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

void fnInput(llong& rnLow, llong& rnHigh, int& rnDivsor1, int& rnDivsor2)
{
  cin >> rnLow >> rnHigh >> rnDivsor1 >> rnDivsor2;
}

llong fnAntiDivCnt(llong nNum, int nDivsor1, int nDivsor2)
{
  int nDividend = max(nDivsor1, nDivsor2);
  int nDivisor  = min(nDivsor1, nDivsor2);

  while (nDividend % nDivisor)
  {
    int nRemndr = nDividend % nDivisor;
    nDividend = nDivisor;
    nDivisor  = nRemndr;
  }
  llong nDivLcm = (llong)nDivsor1 * (nDivsor2 / nDivisor);
  llong nDiv1Cnt = nNum / nDivsor1;
  llong nDiv2Cnt = nNum / nDivsor2;
  llong nDLcmCnt = nNum / nDivLcm;

  return nNum - (nDiv1Cnt + nDiv2Cnt - nDLcmCnt);
}
  
int main()
{
  llong nLow, nHigh;
  int nDivsor1, nDivsor2;

  fnInput(nLow, nHigh, nDivsor1, nDivsor2);
  cout << fnAntiDivCnt(nHigh, nDivsor1, nDivsor2) - fnAntiDivCnt(nLow - 1, nDivsor1, nDivsor2);
  cout << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin>>N;
    vector<int>A(N);
    vector<long long>count(200000);
    long long answer=0;
    for(int i=0; i<N; i++){
        cin>>A.at(i);
        count.at(A.at(i)-1)++;
    }
    for(int i=0; i<200000; i++){
        answer+=count.at(i)*(count.at(i)-1)/2;
    }
    for(int i=0; i<N; i++){
        if(2<count.at(A.at(i)-1)){
        cout<<answer-((count.at(A.at(i)-1))*(count.at(A.at(i)-1)-1)/2-(count.at(A.at(i)-1)-1)*(count.at(A.at(i)-1)-2)/2)<<endl;
        }
        else if(2==count.at(A.at(i)-1)){
            cout<<answer-1<<endl;
        }
        else if(count.at(A.at(i)-1==1)){
            cout<<answer<<endl;
        }
        else
        {
            cout<<answer<<endl;
        }
        
    }
}


Measured memory_bytes: 5624
#include<stdio.h>
 
int main(void){
    double a,b,c,d,e,f,g,x,y;
 
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
        y=(f-c*d/a)/(e-b*d/a);
        x=(f-c*e/b)/(d-a*e/b);
 
        if(-0.0004<x&&x<=0)x=0;
        if(-0.0004<y&&y<=0)y=0;
 
        printf("%.3f %.3f\n",x,y);
     
    }
 
    return 0;
 
}

Measured memory_bytes: 652
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <bitset>

const int MOD = 1e9 + 7;

using namespace std;

long long si = 0;

long long inq(long long a, long long b)
{
    if (b == 0) return 1;
    long long l = inq(a, b / 2);
    if (b % 2) return l * l % MOD * a % MOD;
    return l * l % MOD;
}

const int K = 10000;
vector<long long> dp(K);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            si = (si + j * inq(k + 1, n - 1)) % MOD;
        }
    }
    dp[0] = 1;
    for (int i = n; i >= 1; i--)
    {
        vector<long long> dp2(K);
        for (int a = 0; a <= k; a++)
        {
            for (int hv = 0; hv < K; hv++)
            {
                if (dp[hv] != 0)
                {
                    if (a <= i) dp2[hv + (hv + a) / i] = (dp2[hv + (hv + a) / i] + dp[hv]) % MOD;
                    else dp2[hv] = (dp2[hv] + dp[hv]) % MOD;
                }
            }
        }
        dp = dp2;
    }
    long long si2 = 0;
    for (int i = 0; i < K; i++) si2 = (si2 + dp[i] * i) % MOD;
    cout << (si + MOD - si2) % MOD;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int ar[M], dis[M];
int main()
{  
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++) cin >> ar[i];
	sort(ar, ar + m);
	for(int i = 0; i < m-1; i++) dis[i] = ar[i+1] - ar[i];
	sort(dis, dis + (m-1), greater<int>());
	int sum = 0;
	for(int i = n-1; i < m-1; i++) sum += dis[i];
	cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int a = 0;
    rep(i, 3) {
        int b;
        cin >> b;
        a *= 10;
        a += b;
    }
    if(a % 4 == 0){
        output("YES");
    }
    else{
        output("NO");
    }
    
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))

# print(max(x))
# print(min(x))

tsukare = [0 for i in range(max(x)-min(x)+1)]

# print(tsukare)
# print(len(x))

for i in range(min(x), max(x)+1):
    for k in range(len(x)):
        tsukare[i-min(x)] += (i-x[k])**2

print(min(tsukare))

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

int main(){
    int N,K;
    double p;
    cin >> N >> K;
    vector<double> vec(N);
    for(int i = 0;i < N;i++){
        cin >> p;
        vec.at(i) = (p + 1) / 2;
    }
    vector<double> vec2(N+1);
    vec2.at(0) = 0;
    for(int i = 1;i < N+1;i++){
        vec2.at(i) = vec2.at(i-1) + vec.at(i-1);
    }
    double X,X2 = 0;
    for(int i = 0;i < N-K+1;i++){
        X2 = vec2.at(i+K) - vec2.at(i);
        if(X2 > X){
            X = X2;
        }
    }
    printf("%lf\n", X);
}

Measured memory_bytes: 3328
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var ng bool
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if a%2 == 0 && a%3 != 0 && a%5 != 0 {
			ng = true
		}
	}
	if ng {
		fmt.Println("DENIED")
	} else {
		fmt.Println("APPROVED")
	}
}


Measured memory_bytes: 512
import re
N, A, B, C, D = map(int, input().split())
S = input().replace('.', 'x')

if C < D:
    if len(re.findall('##', S[A:C])) != 0:
        print('No')
    elif len(re.findall('##', S[B:D])) != 0:
        print('No')
    else:
        print('Yes')
else:
    if len(re.findall('##', S[A:C])) != 0:
        print('No')
    elif len(re.findall('xxx', S[B - 2:D + 1])) == 0:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 3764