akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
using namespace std;
int main(void){
  int a,b;
  std::cin >> a >> b;
  std::vector<std::string> str(1000000);
  for(int i=0;i<a;++i){
  	std::cin >> str.at(i);
  }
  for(int i=0;i<a+2;++i){
  	for(int j=0;j<b+2;++j){
    	if(i==0 || i==a+1){
        	std::cout << '#';
        }
    }
    if(0<i && i<a+1){ std::cout<<'#'<<str.at(i-1)<<'#';}
    std::cout << std::endl; 
  }
return 0;
}

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

void program(); 
int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    program();
}

#define INF 0x7fffffffffffffff
#define UINF 0xffffffffffffffff
#define MOD 1000000007

#define int long long
#define unsigned unsigned long long
#define double long double

#define endl "\n"

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

class UF{
public:
    int n;
    vector<int> par, sz;
    UF(int size) : n(size), par(size), sz(size){
        for(int i=0; i<n; i++){
            par[i] = i;
            sz[i] = 1;
        }
    }
    void join(int x, int y){
        if ((x = find(x)) == (y = find(y))) return;
        if (sz[y] < sz[x]) std::swap(x, y);
        par[x] = y;
        sz[y] += sz[x];
        sz[x] = 0;
    }
    int find(int x){ return par[x] = (x == par[x] ? x : find(par[x])); }
    bool connected(int x, int y){ return find(x) == find(y); }
};

template<class Iter> void _print_range(ostream& o, Iter s, Iter e){
    for(;s != e;s++) o << *s << " ";
    o << endl;
} 
template<class T> std::ostream& operator<<(ostream& o, const std::vector<T> &ds)
{
    _print_range(o,ds.begin(),ds.end()); 
    return o;
}
template<class T> std::ostream& operator<<(ostream& o, const std::set<T> &ds)
{
    _print_range(o,ds.begin(),ds.end()); 
    return o;
}
template<class T, class U> std::ostream& operator<<(ostream& o, const std::pair<T,U> &ds)
{
    o << "<" << ds.first << "," << ds.second << ">" << endl;
    return o;
}
template<typename ...Args>
void print(Args&&... args) {
    for(auto&& x: {args...})
        cout << x << " ";
    cout << endl;
}

#define debug(x) cout << "DEBUG    " <<  #x << ": " << x << endl;

#define fr(i, a, b) for(int i = a; i != (b); i += (a<b ? 1 : -1))
#define rep(i, a) for(int i = 0; i < (a); i++)

#define trav(x, a) for(auto& x : a)
#define all(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define vi vector<int>
#define si set<int>
#define pii pair<int,int>

#define N 100005
int a[N], dp[N];
void program(){
    int n,k;
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    fill(dp,dp+n,INF);
    dp[0]=0;
    for(int i=1;i<n;i++)
        for(int j=1;j<=k&&i-j>=0;j++)
            dp[i] = min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
    cout << dp[n-1] << endl;
}

/*
WA:
-bounds on loops
-truncating
-intialization
-0 vs 1 indexing

TLE:
-might need unordered_set/map
-infinite while loop

Stuck:
-bruteforce?
-reduce dimensionality with problem contraints?
*/


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
    int x1, y1, x2, y2, x3, y3, x4, y4;
    int tmpx, tmpy;
    cin >> x1 >> y1 >> x2 >> y2;
    tmpx = x2 - x1;
    tmpy = y2 - y1;
    x3 = x2 - tmpy;
    y3 = y2 + tmpx;
    x4 = x3 - tmpx;
    y4 = y3 - tmpy;
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;


}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int nums[12][12];
int main()
{
    int n;
    while(cin>>n)
    {
        if(n==0){break;}
        memset(nums,0,sizeof(nums));
        rep(j,n)rep(i,n)
        {
            cin>>nums[i][j];
            nums[i][n] += nums[i][j];
            nums[n][j] += nums[i][j];
        }
        rep(i,n){nums[n][n] += nums[i][n];}
        
        rep(j,n+1)
        {
            rep(i,n+1)
            {
                printf("%5d",nums[i][j]);
            }
            cout << endl;
        }

    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int k,a,b;
	cin >> k >> a >> b;
	if(b-a > 1){
		k -= (a-1);
		if(k&1)cout << (k/2)*(b-a)+1+a << endl; 
		else cout << (k/2)*(b-a)+a << endl;
	}else{
		cout << k+1 << endl;
	}
}

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	std::cout << std::setprecision(15); std::cout << std::fixed;
	int t; t = 1;
	// cin >> t;
	FE(i,1,t)
		solve();
	return 0;
}


Measured memory_bytes: 256
n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i]
print(score)

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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr u32 INFTY = std::numeric_limits<u32>::max();

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	u32 n;
	u32 m;
	std::cin >> n >> m;

	std::string s;
	std::cin >> s;

	std::vector<u32> path;

	u32 pos = n;
	while(pos != 0)
	{
		bool ok = false;
		for(u32 d = m; d > 0 ; --d)
		{
			if(i64(u64(pos)-d) >= 0 && s[pos-d] == '0')
			{
				path.push_back(d);
				pos-=d;
				ok = true;
				break;
			}
		}
		if(!ok && pos != 0)
		{
			std::cout << "-1\n";
			return 0;
		}
	}

	for(auto it=path.rbegin(); it!=path.rend(); it++)
	{
		std::cout << *it << " ";
	}
	std::cout << "\n";
	
	return 0;
}

Measured memory_bytes: 1096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) 
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

const double PI = 3.1415926535897932384;

// 1次元vectorの出力
template <class S>
void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}

// 2次元vectorの出力
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int main(void){
	string s; cin >> s;
	map<int, int> c;
	int a = s.size();
	int t = s[a-1] - '0';
	c[0]++;
	c[t]++;
	int d = 10;
	for(int i = a-2; i>=0; i--){
		int tmp = s[i] - '0';
		t += tmp * d;
		t %= 2019;
		d = (d * 10) % 2019;
		c[t]++;
	}
	ll ans = 0;
	for(auto[x, y] : c){
		ans += (ll)y * (y-1) /2;
	}
	cout << ans << endl;
}

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

int main(void){
    string move_pos;
    cin >> move_pos;

    // 奇数
    for (unsigned int i = 0; i < move_pos.length(); i+=2){
        // 偶数
        if(move_pos[i] == 'L') {
            cout << "No" << endl;
            return 0;
        }
        for (unsigned int j = 1; j < move_pos.length(); j+=2){
            if (move_pos[j] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <string>
#include <random>
#include <map>
#include <math.h>
#pragma warning(disable : 4996)


int main(void) {
	long long n, m;
	scanf("%lld %lld", &n, &m);
	if (n * 2 > m) {
		printf("%lld", m / 2);
	}
	else {
		long long cnt = 0;
		cnt = n;
		m -= n * 2;
		cnt += m / 4;
		printf("%lld", cnt);
	}


	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    
    int n;
    cin>>n;
    cout<<n*n*n<<endl;
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
inline int read(){
	int x=0,f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');
	return x*f;
}
const int N=100010;
int x[N];
int main(){
	int n=read(),k=read(),tip;
	printf("%d\n",(n-2)/(k-1)+1);
//	for (int i=1;i<=n;++i){
//		x[i]=read();
//		if (x[i]==1) tip=i;
//	}
//	int num1=(tip-2)/(k-1)+1;
//	
	return 0;
}

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

using namespace std;


int main() {
  int a, b, c;
  
  cin >> a >> b >> c;
   
  if ((a == 7 && b == 5 && c == 5) ||
      (a == 5 && b == 7 && c == 5) ||
      (a == 5 && b == 5 && c == 7)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

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

int main() {
  long long a, b;
  cin >> a >> b;

  long long temp = a;

  map<long long, long long> mp;
  for(long long i = 2; i < a * a; i++){
    if(a <= 1){
      break;
    }

    while(a % i == 0){
      a /= i;
      mp[i]++;
    }
  }

  for(long long i = 2; i < b * b; i++){
    if(b <= 1){
      break;
    }

    while(b % i == 0){
      if(b > 1){
        b /= i;
        mp[i]--;
      }
    }
  }
  
  for(auto p : mp){
    if(p.second < 0){
      for(long long i = 0; i < (-p.second); i++){
        temp = temp * p.first;
      }
    }
  }

  cout << temp << endl;

  return 0;  
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

string S, T;

int Solve(){
  int N = S.length(), M = T.length();
  bool flag = false;
  for (int i = N - M; i >= 0; i--){
    flag = true;
    for (int j = 0; j < M; j++){
      if (S[i + j] != '?' && S[i + j] != T[j]){
        flag = false; break;
      }
    }
    
    if (flag == true){
      for (int j = 0; j < M; j++){
        S[i + j] = T[j];
      }
      break;
    }
  }

  for (int i = 0; i < N; i++){
    if (S[i] == '?') S[i] = 'a';
  }
  
  if (flag == true) cout << S << endl;
  else cout << "UNRESTORABLE" << endl;
  return 0;
}

int main(){
  cin >> S >> T; Solve();
  return 0;
}


Measured memory_bytes: 256
/*░░░░░░░▄▄▄▀▀▀▄▄███▄
░░░░░▄▀▀░░░░░░░▐░▀██▌
░░░▄▀░░░░▄▄███░▌▀▀░▀█
░░▄█░░▄▀▀▒▒▒▒▒▄▐░░░░█▌
░▐█▀▄▀▄▄▄▄▀▀▀▀▌░░░░░▐█▄
░▌▄▄▀▀░░░░░░░░▌░░░░▄███████▄
░░░░░░░░░░░░░▐░░░░▐███████████▄
░░░░░le░░░░░░░▐░░░░▐█████████████▄
░░░░toucan░░░░░░▀▄░░░▐██████████████▄
░░░░░░has░░░░░░░░▀▄▄████████████████▄
░░░░░arrived░░░░░░░░░░░░█▀██████*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
int dp[100007];
string s;
string t[] = {"dream", "dreamer", "erase", "eraser"};
int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	string s;
	cin >> s;
	dp[0] = 1;
	for (int i = 0; i < (int)s.length(); i++)
	{
		if (!dp[i]) continue;
		for (int j = 0; j < 4; j++)
		{
			if (s.substr(i, t[j].length()) == t[j])
			{
				dp[i + t[j].length()] = true;
			}
		}
	}
	if (dp[s.length()])
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 896
use std::cmp::Ordering;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let v: Vec<isize> = (0..n).map(|_| read()).collect();

    let (sorted, cnt) = selection_sort((&v).iter().collect());
    let st: String = sorted
        .iter()
        .map(|i| i.to_string())
        .collect::<Vec<String>>()
        .join(" ");
    println!("{}\n{}", st, cnt)
}

fn selection_sort<T: Ord + Copy>(v: Vec<T>) -> (Vec<T>, usize) {
    match v.get(0) {
        Some(&e) => {
            let (a, p, c) = step(v, e);
            let (pp, cc) = selection_sort(p[1..].into());
            return (insert_head(a, pp), c + cc);
        }
        None => (vec![], 0),
    }
}

fn step<T: Ord + Copy>(v: Vec<T>, s: T) -> (T, Vec<T>, usize) {
    match v.get(0) {
        Some(&e) => {
            let (a, p, _) = step(v[1..].into(), s);
            match e.cmp(&a) {
                Ordering::Greater => (a, insert_head(e, p), 1),
                _ => (e, insert_head(s, v[1..].into()), 0),
            }
        }
        None => (s, v, 0),
    }
}

fn insert_head<T>(e: T, mut v: Vec<T>) -> Vec<T> {
    v.insert(0, e);
    v
}



Measured memory_bytes: 5068
#include <cstdio>

using namespace std;

int main(void){
	int i,N,s=0;
	scanf("%d",&N);

	for(i=0;i<N;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		s+=r-l+1;
	}
	printf("%d",s);

	return 0;
}

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

using namespace std;

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

struct Node {
	Node* parent = NULL;
	vector<Node*> child;
	long long value = 0;
};
struct Edge {
	int parent = 0;
	int child = 0;
	bool operator <(const Edge& right) const { return parent < right.parent; }
};
struct Tree {
	vector<Node> node;
	Tree(int, vector<Edge>);
};
Tree::Tree(int nodeNum, vector<Edge> edge) {
	node.resize(nodeNum);
	for (Edge& it : edge) {
		node[it.child].parent = &node[it.parent];
		node[it.parent].child.push_back(&node[it.child]);
	}
}

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	long long m_module = 1000000007;
	vector<struct Memo> memo;
public:
	long long calculate(int, int);
	Combination1(int, long long);
};
long long Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, long long module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Circle_Pond(void) {

	double R; cin >> R;

	cout << R * 2.0 * 3.141592 << endl;
	return;
}

int main(void) {

	A_Circle_Pond();
	return 0;
}


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

using namespace std;

int main()
{
  int N, M; cin >> N >> M;
  vector<int> a(N), b(N), c(M), d(M);
  for (int i = 0; i < N; ++i) cin >> a[i] >> b[i];
  for (int i = 0; i < M; ++i) cin >> c[i] >> d[i];

  for (int i = 0; i < N; ++i) {
    int min_distance = 1e9, ans = 0;
    for (int j = 0; j < M; ++j) {
      int distance = abs(a[i]-c[j])+abs(b[i]-d[j]);
      if (distance < min_distance) {
        min_distance = distance;
        ans = j+1;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Program
{
    public class ABC054D
    {
        static class Console_
        {
            private static Queue<string> param = new Queue<string>();
            public static int NextInt() => int.Parse(NextString());
            public static long NextLong() => long.Parse(NextString());
            public static string NextString()
            {
                if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item);
                return param.Dequeue();
            }
        }
        static public void Main(string[] args)
        {
            var N = Console_.NextInt();
            var Ma = Console_.NextInt();
            var Mb = Console_.NextInt();
            var dp = new int[N + 1][][];
            for (int i = 0; i < N + 1; ++i)
            {
                dp[i] = new int[40 * 10 + 1][];
                for (int j = 0; j < 40 * 10 + 1; ++j)
                {
                    dp[i][j] = new int[40 * 10 + 1];
                    for (int k = 0; k < 40 * 10 + 1; ++k)
                    {
                        dp[i][j][k] = 1000000000;
                    }
                }
            }
            dp[0][0][0] = 0;
            for (int i = 0; i < N; ++i)
            {
                var a = Console_.NextInt();
                var b = Console_.NextInt();
                var c = Console_.NextInt();

                for (int j = 0; j <= 40 * 10 - a; ++j)
                {
                    for (int k = 0; k <= 40 * 10 - b; ++k)
                    {
                        dp[i + 1][j][k] = Math.Min(dp[i][j][k], dp[i + 1][j][k]);
                        dp[i + 1][j + a][k + b] = Math.Min(dp[i + 1][j + a][k + b], dp[i][j][k] + c);
                    }
                }
            }
            var ax = Ma;
            var bx = Mb;
            var maxMulti = Math.Min(40 * 10 / Ma, 40 * 10 / Mb);
            var min = 1000000000;
            for (int i = 1; i < maxMulti; ++i)
            {
                if (dp[N][i * ax][i * bx] < min)
                {
                    min = dp[N][i * ax][i * bx];
                }
            }

            Console.WriteLine(min == 1000000000 ? -1 : min);
        }
    }
}


Measured memory_bytes: 44484
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

long long n;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	long long ans = 0;
	for(double i = 1; i <= n; i++)
		ans += (long long)(i / 2 * floor(n / i) * floor(1 + n / i));
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3692
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
class ListOfTopThreeHills
{
	static void Main(string[] args)
	{
		do
		{
			string input = Console.ReadLine();
			if (string.IsNullOrEmpty(input))
			{
				break;
			}
                 string[] inputArr = input.Split(' ');
                 int a = int.Parse(inputArr[0]);
                 int b = int.Parse(inputArr[1]);
                 int sum = a + b;
                 Console.WriteLine(sum.ToString().Length);
		} while (true);
	}
}

Measured memory_bytes: 5640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a<b)swap(a,b);
	if(a<c)swap(a,c);
	if(b<c)swap(b,c);
	int ans=0;
	if((b-c)%2==1)ans=1,c++,a++;
	ans+=(b-c)/2;
	c=b;
	ans+=(a-b);
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long  x,z=0,ans=0;
	cin>>x;
	if(x%11!=0){
		if(x%11<=6) z=1;
		else z=2;
	}
	cout<<x/11*2+z;
	return 0;
}

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

int main(void){
  int i,N,count;
  cin >> N;

  count=0;
  for(int i = 1; i <= N; i++){
	if(1<=i && i<=9){
    count += 1;
    }else if(100<=i && i<=999){
    count += 1;
    }else if(10000<=i && i<=99999){
    count += 1;
    }    
  }
   
  cout << count << endl;
}

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

/* type defnition */
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using Graph = vector<vi>;


//macros
#define __all(v) v.begin(),v.end()


/*  Util Function defnition                  */

inline int ctoi(char c){
    return c - '0';
}

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

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

/*  End Util Function defnition              */



/*  Global Variable defnition                 */

/*  End Global Variable defnition              */



/**/


/**/

void calclation(){
    int N,K;
    cin >> N >> K;
    int res = N;
    set<int> s;
    for(int i = 0;i < K;i++)
    {
        int d;
        cin >> d;
        for(int j = 0;j < d;j++)
        {
            int tmp;
            cin >> tmp;
            auto i = s.insert(tmp);
            if(i.second) res--;
        }
    }
    cout << res << '\n';
}

//main function
int main(int, char**) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    calclation();
    return 0;
}


Measured memory_bytes: 3660
N,K= map(int,input().split())
p = list(map(int,input().split()))
sum1=0.0
for i in range (K):
    sum1=((p[i]+1)/2.0)+sum1
sum2=sum1
for i in range(N-K):
    sum1=sum1+((p[i+K]-p[i])/2.0)
    if sum1>sum2:
        sum2=sum1
print(sum2)

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





int main()
{

	cin >> N;

	cout << N/3;





}



Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;

struct node{
	LL a,b;
}s[200005];
bool cmp(node x,node y){
	if(x.a == 0 && y.a == 0) return x.b < y.b;
	return y.a * (x.b + 1) < x.a * (y.b + 1);
}

LL dp[200005][35];

int main(){
	LL n,T,st,ans = 0;
	cin >> n >> T;
	for(LL i = 1;i <= n;i ++) cin >> s[i].a >> s[i].b;
	st = n + 1; sort(s + 1,s + 1 + n,cmp);
	for(LL i = n;i >= 1;i --) if(s[i].a == 0) st = i;
	
	for(LL i = 0;i <= 31;i ++) dp[0][i] = T + 1;
	dp[0][0] = 0;
	for(LL i = 1;i < st;i ++){
		dp[i][0] = dp[i - 1][0];
		for(LL j = 1;j <= 31;j ++){
			dp[i][j] = min(dp[i - 1][j],(1 + dp[i - 1][j - 1]) * (1 + s[i].a) + s[i].b);
			dp[i][j] = min(dp[i][j],T + 1);
		}
	}
	for(LL j = 0;j <= 31;j ++){
		LL tt = dp[st - 1][j];
		if(tt > T) continue;
		ans = max(ans,j);
		for(LL k = st;k <= n;k ++){
//			cout << tt << ' ' << s[k].b << endl;
			if(tt + s[k].b + 1 > T) break;
			ans = max(ans,(k - st + j + 1));
			tt += (s[k].b + 1);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 58112
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
double V = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

int data_[210][2] = { -2 };

void input(void) {
	
	return;
}


int main(void) {
	double t = 0;
	double y = 0;
	double N_ = 0;

	while (scanf("%lf", &V) != EOF) {
		t = V / 9.8;
		y = 4.9 * t * t;
		N_ = (y + 5) / 5;

		if (N_ == (double)(int)N_) {
			CO (int)N_ E
		}
		else {
			CO (int)N_ + 1 E
		}
	}
	

	return 0;
}

Measured memory_bytes: 3284
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if __name__ == '__main__':
    counter = 0
    N = int(input()) #1行目のNを取得する
    for i in range(N):
        if is_prime(int(input())):
            counter += 1
    print(str(counter))


Measured memory_bytes: 5608
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define oo 1000000
const ll mod = 1e9 + 7;

void ff()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}

//#pragma warning (disable : 4996)
void in_out_txt()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}

int main()
{
	ff();
	//in_out_txt()
	string str;
	cin >> str;
	int c1 = 0, c2 = 0, z = 0, co = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == 'S')
			c1++;
		else
			c1--;
		if (c1 < 0)
			co++, c1 = 0;
		/*if (str[i] == 'S' && z == 0)
			c1++;
		else if (str[i] == 'T')
			c2++, z = 1;
		else if (str[i] == 'S' && z == 1)
		{
			if (c1 >= c2)
				c2 = 0, c1 -= c2;
			else
				co += c2 - c1, c2 = c1 = 0;
			z = 0;
			i--;
		}*/
	}
	cout << co * 2 << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<int> v;
typedef vector<ll> vll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
const int INF = 1001001001;
const int mINF = -1001001001;
const int mod = 1000000007;
// << fixed << setprecision(0) <<
// sort(ALL(),greater<int>());


int main() {
  int n,m;
  cin >> n >> m;
  v a(n);
  double total=0;
  REP(i,n) {
    cin >> a[i];
    total+=a[i];
  }
  sort(ALL(a),greater<int>());
  if(a[m-1]<total/(4*m)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


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

int main(){
    int w,h,n;
    cin>>w>>h>>n;
    int x,y,a,t,r;
    t=0;
    r=0;

    for(int i=0;i<n;i++){
        cin>>x>>y>>a;

        if(a==1){
            t=max(t,x);
        }else if(a==2){
            w=min(w,x);
        }else if(a==3){
            r=max(r,y);
        }else{
            h=min(h,y);
        }
    }
    int ans;
    ans=(w-t)*(h-r);
    if(w-t<0||h-r<0){ans=0;}
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    int a, b;
    cin >> a >> b;
    int x;
    int flag = 0;

    if(b <= 9) {
        x = 10*a + b;
    }
    else if(b == 100) {
        x = 1000*a + 100;
    }
    else {
        x = 100*a + b;
    }

    for(int i = 4; i <= 317; i++) {
        if(x == i*i) {
            flag = 1;
        }
    }

    if(flag == 1) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,k;
    cin>>n>>k;
    cout<<n*n-k<<endl;
    return 0;
}


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

int N;
int A[20010];
int a[20010] = {0},b[20010] = {0};

int main()
{
    scanf("%d",&N);
    for(int i = 1; i <= N; i++)scanf("%d",A + i);

    for(int i = 1; i <= N; i++)
    {
        a[A[i] + 1] += N - i;
        b[A[i] - 1] += N - i;
    }

    a[1]++;
    b[N]++;
    for(int i = 2; i <= N; i++)a[i] += a[i - 1] + 1;
    for(int i = N - 1; i >= 1; i--)b[i] += b[i + 1] + 1;

    for(int i = 1; i <= N; i++)
    {
        printf("%d",a[i]);
        if(i != N)printf(" ");
    }printf("\n");

    for(int i = 1; i <= N; i++)
    {
        printf("%d",b[i]);
        if(i != N)printf(" ");
    }printf("\n");
    return 0;
}


Measured memory_bytes: 896
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np

n = ii()
v = li()

x = sorted(v)

for i in range(n):
    if i>1:
        x[i] = x[i]*(2**(i-1))

print(sum(x)/(2**(n-1)))

Measured memory_bytes: 20456
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



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

	vector <vector <ll> > a(N, vector <ll> (D));
	for (int y = 0; y < N; ++y)
	{
		for (int x = 0; x < D; ++x)
		{
			cin >> a[y][x];
		}
	}

	ll ret = 0;
	for (int i=0;i<N;++i)
	{
		for (int k = i+1; k < N; ++k)
		{
			ll sum = 0;
			for (int d=0;d<D;d++)
			{
				sum += SQ(a[i][d] - a[k][d]);
			}

			if (ISINT(sqrt(sum)))
			{
				ret++;
			}
		}
	}

	cout << ret << endl;

	return 0;
}


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

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

int main() {
	int h, w;
	std::cin >> h >> w;

	std::vector<std::string> g(h);
	for (auto &v : g) {
		std::cin >> v;
	}

	int64_t ans = 0;
	std::vector<std::vector<bool>> used(h, std::vector<bool>(w));
	for (int sy = 0; sy < h; sy++) {
		for (int sx = 0; sx < w; sx++) {
			if (used[sy][sx]) {
				continue;
			}

			std::queue<std::pair<int, int>> que;
			que.emplace(sy, sx);
			used[sy][sx] = true;

			int64_t wCnt = 0, bCnt = 0;
			while (!que.empty()) {
				std::pair<int, int> now = que.front(); que.pop();
				int y = now.first;
				int x = now.second;

				wCnt += g[y][x] == '.';
				bCnt += g[y][x] == '#';
				for (int i = 0; i < 4; i++) {
					int ny = y + dy[i];
					int nx = x + dx[i];

					if (ny < 0 || ny >= h || nx < 0 || nx >= w || used[ny][nx] || g[y][x] == g[ny][nx]) {
						continue;
					}

					que.emplace(ny, nx);
					used[ny][nx] = true;
				}
			}

			ans += wCnt * bCnt;
		}
	}

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


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
    string s;
    cin >> s; 
    int k;
    k = abs(100*(s[0] - '0') + 10 * (s[1] - '0') + (s[2] - '0') -753) ;
    int n;
    int size = s.size();
    for (int i = 0;i < size - 2;i++){
        n = abs((100 * (s[i] - '0') + 10 * (s[i+1] - '0') + (s[i+2] - '0') - 753));
        k = min(k,n);
    }
    cout << k << endl;
}

Measured memory_bytes: 760
import sys

input = sys.stdin.readline

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

total = sum(B)
for i in range(N - 1):
    if A[i] == A[i + 1] - 1:
        total += C[A[i] - 1]

print(total)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

int main() {
    char S[11];
    cin >> S;

    int minDiff = 100000;
    for (int i = 0; S[i+2] != '\0'; i++) {
        int num = (int)(S[i] - '0') * 100
            + (int)(S[i+1] - '0') * 10
            + (int)(S[i+2] - '0');
        minDiff = min(minDiff, abs(num - 753));
    }
    cout << minDiff << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE
vector< int > divisor(int n) {
  vector< int > ret;
  for(int i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
} 
  

void solve(void)
{
  string str;cin>>str;
  int cp = 0;
  for (int i = 0; i < str.size()-1; i++)
  {
    if(str[i] != str[i+1])cp++;
  }
  cout<<cp<<endl;
  

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

#define ARC(i, a, b) for(int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)

template <class T>
T ath(const T &a, const T &b){
	return a > b ? a : b;
}

int n, v[2][120000], av[2], inav[2], aav[2], inaav[2];

int solve(){
	scanf("%d", &n);
	RC(i, n / 2){
		int in;
		scanf("%d", &in);
		++v[0][in];
		if(av[0] < v[0][in]){
			if(inav[0] != in){
				aav[0] = av[0];
				inaav[0] = inav[0];
			}
			av[0] = v[0][in];
			inav[0] = in;
		}else if(aav[0] < v[0][in]){
			aav[0] = v[0][in];
			inaav[0] = in;
		}
		scanf("%d", &in);
		++v[1][in];
		if(av[1] < v[1][in]){
			if(inav[1] != in){
				aav[1] = av[1];
				inaav[1] = inav[1];
			}
			av[1] = v[1][in];
			inav[1] = in;
		}else if(aav[1] < v[1][in]){
			aav[1] = v[1][in];
			inaav[1] = in;
		}
	}
	return n - (inav[0] != inav[1] ? av[0] + av[1] : ath(av[0] + aav[1], av[1] + aav[0]));
}

int main(){
	printf("%d\n", solve());
}


Measured memory_bytes: 896
s = input()
x = int(s[:2])
y = int(s[2:])

if 1 <= x <= 12 and 1 <= y <= 12:
    print("AMBIGUOUS")
elif 1 <= x <= 12 and 0 <= y <= 99:
    print("MMYY")
elif 1 <= y <= 12 and 0 <= x <= 99:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
require 'pp'

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

N = gets_i
a_list = gets_i_list

count_hash = a_list.group_by(&:itself).map{|k,v| [k, v.count] }.to_h

p_count_hash = count_hash.map do |k, v|
  p_count = v * (v - 1) /2
  [k, p_count]
end.to_h
p_count_total = p_count_hash.values.inject(:+)

p_count_hash2 = count_hash.map do |k, v|
  if v >= 2
    p_count = (v - 1) * (v - 2) /2
  else
    p_count = 0
  end
  [k, p_count]
end.to_h


a_list.each do |a|
  puts p_count_total - p_count_hash[a] + p_count_hash2[a]
end


Measured memory_bytes: 84972
n = gets.chomp.to_i
sum = 0

for i in 1..n do
    if (i % 3 == 0 && i % 5 == 0) then
        # puts "FizzBuzz"
    elsif (i % 3 == 0) then
        # puts "Fizz"
    elsif (i % 5 == 0) then
        # puts "Buzz"
    else
        # puts i
        sum += i
    end
end

puts sum

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int n, k;
    cin >> n >> k;
    VI ansv(n, 0);
    REP(i, k) {
        int d;
        cin >> d;
        REP(i, d) {
            int j;
            cin >> j;
            ansv[j-1]++;
        }
    }
    int ans = 0;
    REP(i, n) {
        if (ansv[i] == 0) {
            ans++;
        }
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
using long_t = int64_t;

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		int N, A, B;
		cin >> N >> A >> B;
		cout << ((B-A) & 1 ? "Borys" : "Alice") << endl;
	}
};

int main() {
	Solver().solve();
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int s=0,a,b,c,k,l;
	cin>>a>>b>>c>>k;
	l=k;
	k-=a;
	if(k<0)s+=l;
	else{
		s+=a;
		k-=b;
		if(k>0)s-=k;
	}
	cout<<s;
} 

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
#define INF 1 << 28
using namespace std;
typedef long long ll;

int H, W;

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

void bfs(vector<string> &G, vector<vector<int>> &seen, queue<pair<int, int>> &q) {
    while (!q.empty()) {
        auto now = q.front(); q.pop();
        REP(i, 0, 4) {
            int nh = now.first + dx[i];
            int nw = now.second + dy[i];
            if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
            if (G[nh][nw] == '#' || seen[nh][nw] != -1) continue;
            q.push(make_pair(nh, nw));
            seen[nh][nw] = seen[now.first][now.second] + 1;
        }
    }
}

int main() {
    cin >> H >> W;
    vector<string> G(H);
    REP(i, 0, H) cin >> G[i];

    int ans = 0;
    vector<vector<int>> seen;
    REP(i, 0, H) {
        REP(j, 0, W) {
            if (G[i][j] == '#') continue;
            seen.assign(H, vector<int>(W, -1));
            seen[i][j] = 0;
            queue<pair<int, int>> q;
            q.push(make_pair(i, j));
            bfs(G, seen, q);
            REP(i, 0, H) {
                REP(j, 0, W) {
                    ans = max(ans, seen[i][j]);
                }
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            long N = cin.nextLong();
            Console.WriteLine(N / 2 + N % 2);
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h> 
using namespace std; 
typedef   long long int ll;
int main () {
   ll n,m;cin>>n>>m;
   ll a[n],count=0,sum=0;
   for (ll i=0;i<n;i++) {cin>>a[i];sum+=a[i];}
   for (ll i=0;i<n;i++) {
       if (4*a[i]*m>=sum) count++;
   }
   if (count<m) cout<<"No"<<endl;
   else cout<<"Yes"<<endl;
}

    
    
    

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define IO std::ios::sync_with_stdio(false)
#define ll long long
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
#define INF 0x3f3f3f3f

inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

set<string> st;
int n;
string s;
signed main() {
  IO;
  cin >> n;
  rep(i,1,n){
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << '\n';
  return 0;
}

Measured memory_bytes: 19216