akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { std::cin >> first; Scan(rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#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<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define IN(a, x, b) (a<=x && x<=b)
#define IN2(a0, y, a1, b0, x, b1) (a0<=y && y<a1 && b0<=x && x<b1)
#define SHOW(d) {std::cout << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cout << #v << "\t:";for(const auto& i : v){std::cout << i << " ";}std::cout << "\n";}
#define SHOWVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout << j << " ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout<<'('<<j.first<<", "<<j.second<<") ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& i:v){std::cout<<'('<<i.first<<", "<<i.second<<") ";}std::cout<<"\n";}
#define CHECKTIME(state) {auto start=std::chrono::system_clock::now();state();auto end=std::chrono::system_clock::now();auto res=std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count();std::cerr<<"[Time:"<<res<<"ns  ("<<res/(1.0e9)<<"s)]\n";}

//#define int ll
using ll = long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000001;
constexpr int MOD = 1000000007;

signed main() {
	INIT;
	VAR(int, a, b);
	if (a <= 0 && b >= 0) {
		OUT("Zero")BR;
	}
	else if(b<0 && (b-a)%2==0) {
		OUT("Negative")BR;
	}
	else {
		OUT("Positive")BR;
	}
	return 0;
}

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

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> h(n);
    for(int i = 0; i < n; i++){
        std::cin >> h.at(i);
    }

    std::reverse(h.begin(),h.end());
    int ans = 0;
    int cnt = 0;

    for(int i = 0; i < n-1; i++){
        if(h.at(i) <= h.at(i+1)){
            cnt++;
        }
        else{  
               cnt = 0;
        }
        ans = std::max(ans, cnt);
    }
    std::printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>

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

    int i, A[100];
    for(i = 0; i < N; ++i)
    {
        scanf("%d", &A[i]);
    }

    int v, j, k; 
    for(i = 0; i < N; ++i)
    {
        v = A[i];
        j = i - 1;

        while(j >= 0 && A[j] > v)
        {
            A[j + 1] = A[j];
            j--;
        }

        A[j + 1] = v;

        for(k = 0; k < N; ++k)
        {
            printf("%d%s", A[k], k != N - 1 ? " " : "\n");
        }
    }

    return 0;
}

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

typedef vector<int> vi;

const int INF = (int)1e+7 - 1;
int H, W;
vector<string> S;
vector<vi> cost;
vi d;
vector<bool> used;
int V;

void input_init(void) {
	cin >> H >> W;
	S.resize(H);
	for (int j = 0; j < H; ++j)
		cin >> S[j];
	V = H * W;
}

void make_graph(void) {
	cost.resize(V, vi(V, INF));
	for (int j = 0; j < H - 1; ++j) {
		for (int i = 0; i < W; ++i) {
			int s = W * j + i;
			int t = W * (j + 1) + i;
			if (S[j][i] == '.' && S[j + 1][i] == '.')
				cost[s][t] = cost[t][s] = 1;
		}
	}
	for (int j = 1; j < H; ++j) {
		for (int i = 0; i < W; ++i) {
			int s = W * j + i;
			int t = W * (j - 1) + i;
			if (S[j][i] == '.' && S[j - 1][i] == '.')
				cost[s][t] = cost[t][s] = 1;
		}
	}
	for (int i = 0; i < W - 1; ++i) {
		for (int j = 0; j < H; ++j) {
			int s = W * j + i;
			int t = W * j + (i + 1);
			if (S[j][i] == '.' && S[j][i + 1] == '.')
				cost[s][t] = cost[t][s] = 1;
		}
	}
	for (int i = 1; i < W; ++i) {
		for (int j = 0; j < H; ++j) {
			int s = W * j + i;
			int t = W * j + (i - 1);
			if (S[j][i] == '.' && S[j][i - 1] == '.')
				cost[s][t] = cost[t][s] = 1;
		}
	}
}

void dijkstra(int s) {
	d.clear();
	d.resize(V, INF);
	used.clear();
	used.resize(V, false);
	d[s] = 0;

	while (true) {
		int v = -1;
		for (int u = 0; u < V; u++) {
			if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
		}
		if (v == -1) break;
		used[v] = true;
		for (int u = 0; u < V; u++) {
			d[u] = min(d[u], d[v] + cost[v][u]);
		}
	}
}

int solve(void) {
	int max_d = -INF;
	for (int j = 0; j < H; ++j) {
		for (int i = 0; i < W; ++i) {
			if (S[j][i] == '.') {
				int s = W * j + i;
				dijkstra(s);
				for (int k = 0; k < V; ++k) {
					if (d[k] != INF)
						max_d = max(d[k], max_d);
				}
			}
		}
	}
	return max_d;
}

int main(void) {
	input_init();
	make_graph();
	int ans = solve();
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n,a,b;
int main() {
    scanf("%d%d%d",&n,&a,&b);
    if ((b-a)%2) printf("Borys\n");
    else printf("Alice\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
#define eb emplace_back

const int MAX_N = 2e6+10;
int N, A[MAX_N];

void solve()
{
	ll ans = 0;
	ll hei = 0;
	for(int i=0;i<N;++i){
		if(A[i]<hei){
			ans+=hei-A[i];
		}
		hei=max(hei,(ll)A[i]);
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> N;
	for(int i=0;i<N;++i) cin >> A[i];
	solve();
	return 0;
}

Measured memory_bytes: 4424
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int arr[1000000],arr1[1000000];
long long v = 0;
int main(){
    long long a,b,c,i,n;
    //cin>>n>>a;
    cin>>n;
    cout<<(n*(n-1))/2;

}


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

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int a[n],b[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    int tmp=a[0];
    for(int i = 0; i < n; i++) {
        tmp+=b[i];
    }
    int ref=tmp;
    for(int i = 1; i < n; i++) {
        tmp+=a[i];
        tmp-=b[i-1];
        ref=max(ref,tmp);
    }
    cout << ref << "\n";
    return 0;
}

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

int A[20000001], B[20000001];
int C[10000];
int n;

int main() {
	cin >> n;
	for (int i = 0; i < 10000; i++)
		C[i] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
		C[A[i]]++;
	}
	for (int i = 1; i < 10000; i++)
		C[i] += C[i - 1];
	for (int i = n; i > 0; i--) {
		B[C[A[i]]] = A[i];
		C[A[i]]--;
	}
	for (int i = 1; i < n; i++)
		cout << B[i] << " ";
	cout << B[n] << endl;
	return 0;
}



Measured memory_bytes: 18752
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<ll,ll> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const ll INF=100000000000000;

int main(){
	string s;
	cin>>s;
	ll n=s.size()-1,ans=0;
	REP(Bit,1<<n){
		ll sum=0;
		string t;
		t+=s[0];
		DEB(t)END
		REP(i,n){
			if(Bit&(1<<i)){
				if(!t.empty())sum+=stoll(t);
				t="",t+=s[i+1];
			}
			else{
				t+=s[i+1];
			}
			DEB(t)DEB(sum)END
		}
		DEB(t)END
		if(!t.empty())sum+=stoll(t);
		ans+=sum;
		DEB(sum)cerr<<bitset<2>(Bit)<<" ";END
	}
	cout<<ans<<endl;
	return 0;
}//125

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	aStr := nextString()
	bStr := nextString()

	a, _ := new(big.Int).SetString(aStr, 10)
	b, _ := new(big.Int).SetString(bStr, 10)
	// fmt.Println(a)
	// fmt.Println(b)

	c := big.NewInt(0).Quo(a, b)
	// fmt.Println(big.NewInt(0).Quo(a, b))
	fmt.Println(c)
}



Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main(){
    int w,h,n;
    cin>>w>>h>>n;
    vi x(n),y(n),a(n);
    rep(i,n)cin>>x[i]>>y[i]>>a[i];
    int rx=w,by=h,lx=0,sy=0;
    rep(i,n){
        if(a[i]==1){
            if(lx<x[i])lx=x[i];
            }
        else if(a[i]==2){
            if(rx>x[i])rx=x[i];
            }
        else if(a[i]==3){
            if(sy<y[i])sy=y[i];
            }
        else {
            if(by>y[i])by=y[i];
            }
        if(by<=sy||rx<=lx){cout<<"0"<<endl; return 0;}
    }
    cout<<(by-sy)*(rx-lx)<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

typedef long long ll;

const int MOD = 1e9 + 7;

int add(int a, int b) {
	return (a + b) % MOD;
}

int mul(int a, int b) {
	return ((ll)a * b) % MOD;
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (auto &t : a) {
		cin >> t;
	}	
	cerr << -1 << endl;
	vector<int> less;
	vector<int> gr;
	for (int i = 0; i < n; i++) {
		if (a[i] < 0) {
			less.push_back(a[i]);
		} else {
			gr.push_back(a[i]);
		}
	}
	cerr << less.size() << endl;
	if ((k % 2 == 1 && (int)less.size() == n) || (k == n && less.size() % 2 == 1)) {
		sort(a.begin(), a.end(), [&](int i, int j) {
			return abs(i) < abs(j);
		});
		int ans = 1;
		for (int i = 0; i < k; i++) {
			ans = mul(ans, a[i] + MOD);
		}
		cout << ans << endl;
		exit(0);
	}
	cerr << "hr " << endl;
	sort(less.begin(), less.end());
	sort(gr.rbegin(), gr.rend());
	if ((int)less.size() & 1) less.pop_back();
	vector<pair<int, int>> tk;
	for (int i = 0; i + 1 < (int)less.size(); i += 2) {
		tk.push_back({less[i] * less[i + 1], -(i + 2)});
	}
	cerr << "hr " << endl;
	// if ((k & 1) && gr.size() % 2 == 0) gr.pop_back();
	for (int i = 0; i + 1 + (k & 1) < (int)gr.size(); i += 2) {
		tk.push_back({gr[i] * gr[i + 1], (i + 2)});
	}
	sort(tk.rbegin(), tk.rend());
	int mx = 0;
	int ans = 1;
	for (auto t : tk) {
		if (k > 1) {
			ans = mul(ans, t.first % MOD);
			mx = max(mx, t.second);
			k -= 2;
		}
	}
	if (k) {
		ans = mul(ans, gr[mx]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 9536
def solve():
    N, T = map(int, input().split())
    c, t = [0] * N, [0] * N
    for i in range(N):
        c[i], t[i] = map(int, input().split())

    ans = 2000
    for i in range(N):
        if t[i] <= T:
            ans = min(ans, c[i])
    if ans == 2000:
        print('TLE')
    else:
        print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3060
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    string S;
    cin >> S;
    char buf = S[0];
    for (int i = 1; i < 4; ++i)
    {
        if (S[i] == buf)
        {
            cout << "Bad" << "\n";
            return 0;
        }
        buf = S[i];
    }

    cout << "Good" << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,x=1,a=0;
    int i = 1;
    scanf("%d",&n);

    do{
        x = i;
        if (x % 3 == 0){
            printf(" %d",i);
            a = 1;
        }
        if (a==0){
            do{
                if (x % 10 == 3){
                	printf(" %d",i);
                    break;
                }
                x /= 10;

            } while (x);
        }
        else{
            a = 0;
        }
    } while (++i<=n);
    printf("\n");
    return 0;
}



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

struct Group{
	int indx, num;
	Group(){}
	Group(int indx_c, int num_c){
		indx = indx_c; num = num_c;
	}
};

int main(){
	int table[17] = {}, ans[100];
	queue<Group> q;
	for(int t = 0;; t++){
		for(int i = 0; i < 17; i++) table[i]--;
		
		if(t%5 == 0 && t/5 < 100){
			q.push( Group(t/5, ( (t/5)%5 == 1 ) ? 5 : 2 ) );
		}
		if( t/5 >= 100 && q.empty() ) break;
		
		while( !q.empty() ){
		
		Group front_group = q.front();
		int space_cnt = 0;
		bool was_pop = false;
		for(int i = 0; i < 17; i++){
			if( table[i] <= 0) space_cnt++;
			else space_cnt = 0;
			if(space_cnt >= front_group.num){
				for(int j = 0; j < space_cnt; j++){
					table[i-j] = 17*(front_group.indx%2)+3*(front_group.indx%3)+19;
				}
				ans[front_group.indx] = t - front_group.indx*5;
				q.pop();
				was_pop = true;
				break;
			}
		}
		
		if(was_pop == false) break;
		}
	}
	
	int N;
	while(cin >> N){
		printf("%d\n", ans[N]);
	}
	
	return 0;
}

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

using namespace std;
using ll = long long;

template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_V(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_M(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}

int main() {
    int N, M;
    cin>>N>>M;
    cout<<N*(N-1)/2+M*(M-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

double x, y;
vector<PD> vpd;
vector<double> vdis;

int main(){
	while (scanf("%lf,%lf", &x, &y) != EOF){
		vpd.push_back(PD(x, y));
	}
	vpd.pop_back();
	double sum = 0;
	REP(i, vpd.size()-1){
		double a = sqrt(pow(x - vpd[i].fi, 2) + pow(y - vpd[i].se, 2)),
			c = sqrt(pow(x - vpd[i + 1].fi, 2) + pow(y - vpd[i + 1].se, 2)),
			b = sqrt(pow(vpd[i].fi - vpd[i + 1].fi, 2) + pow(vpd[i].se - vpd[i + 1].se, 2));
		double z = (a + b + c) / 2;
		sum += sqrt(z*(z - a)*(z - b)*(z - c));
	}
	printf("%.10lf\n", sum);
}

Measured memory_bytes: 1240
while(h,w=gets.split.map &:to_i)!=(x,y=0,0);f=[];m=(1..h).map{f.push [1]*w;gets};b=1;while(?.<c=m[y][x])&&0<b=f[y][x]do;f[y][x]=0;c[?v]?y+=1:c[?^]?y-=1:c[?<]?x-=1:x+=1;end;puts ["LOOP","#{x} #{y}"][b]end

Measured memory_bytes: 6152
using System;
class Program {
    static void Main() {
        string[] str =  Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);

        if(a < b && b < c) {
            Console.WriteLine("Yes");
        }
        else {
            Console.WriteLine("No");
        }
        
    }
}

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

int main()
{
  int n, t;
  cin >> n >> t;
  int c = numeric_limits<int>::max();
  for (auto i = 0; i < n; i++) {
    int cc, tt;
    cin >> cc >> tt;
    if (tt <= t && cc < c) {
      c = cc;
    }
  }
  cout << (c == numeric_limits<int>::max() ? "TLE" : to_string(c)) << endl;
}


Measured memory_bytes: 256
#B問題
S=list(str(input()))
mae=S[0]+S[1]
ato=S[2]+S[3]
intmae=int(mae)
intato=int(ato)
if intmae >= 13 and intato >= 13:
    print("NA")
elif intmae <= 12 and intato <= 12:
    if intmae > 0 and intato > 0:
        print("AMBIGUOUS")
    elif intmae == 0 and intato == 0:
        print("NA")
    elif intmae == 0:
        print("YYMM")
    elif intato == 0:
        print("MMYY")
else:
    if intmae <= 12:
        if intmae != 0:
            print("MMYY")
        else:
            print("NA")
    else:
        if intato != 0:
            print("YYMM")
        else:
            print("NA")
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>    
using namespace std;
 
#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) int a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

typedef long long ll ;

int N , M ;
int P [100000] , Y [100000];
vector < int > yd [100001];
int main ()
{
    scanf ("%d%d " ,&N ,& M );
    rep (i,M) scanf ("%d%d" ,& P[i ] ,& Y[ i ]) , yd [ P[ i ]]. push_back ( Y[ i ]);
    rep (i,N) sort ( yd[ i +1]. begin () , yd[ i +1]. end ());
    rep (i,M) printf ("%012lld\n" , ll ( P[ i ])*1000000+ int ( lower_bound ( yd [ P[ i ]].
    begin() , yd [ P[ i ]]. end () , Y[ i ]) - yd [ P[ i ]]. begin())+1);
}


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

using namespace std;

void Main() {
    string s;
    cin >> s;
    int ng = 0;
    int np = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == 'g') {
            ++ng;
        }
        else {
            ++np;
        }
    }

    int ans = s.size() / 2 - np;
    cout << ans << endl;
}

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


Measured memory_bytes: 3764
n=int(input())
a=[int(input()) for i in range(n)]
a.sort()
x=0;y=0
if n%2==0:
  for i in range(n):
    if i<n//2-1:
      x-=a[i]*2
    elif i==n//2-1:
      x-=a[i]
    elif i==n//2:
      x+=a[i]
    else:
      x+=a[i]*2
  print(x)
else:
  for i in range(n):
    if i<n//2:
      x-=a[i]*2
    elif i==n//2:
      x+=a[i]
    elif i==n//2+1:
      x+=a[i]
    else:
      x+=a[i]*2
  for i in range(n):
    if i<n//2-1:
      y-=a[i]*2
    elif i==n//2-1:
      y-=a[i]
    elif i==n//2:
      y-=a[i]
    else:
      y+=a[i]*2
  print(max(x,y))

Measured memory_bytes: 7404
# import sys
# sys.setrecursionlimit(10 ** 6)
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, M, pSs):
    result = [0] * (N + 1)
    penalty = [0] * (N + 1)
    for p, S in pSs:
        if S == 'AC':
            result[p] = 1
        else:
            if result[p] == 0:
                penalty[p] += 1
    print(sum(result), sum([result[i] * penalty[i] for i in range(N + 1)]))


if __name__ == '__main__':
    N, M = map(int, input().split())
    pSs = []
    for _ in range(M):
        x = input().split()
        x[0] = int(x[0])
        pSs.append(x)
    solve(N, M, pSs)


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define INF 1000000000

#define loop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n, m;
    cin >> n >> m;

    vector<int> ans(n);
    vector<int> value(n, INF);
    vector<bool> flag(n, false);

    vector<vector<int>> l(n);
    loop(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        l[a].push_back(b);
        l[b].push_back(a);
    }

    // cout << "----------------------" << endl;
    loop(i, n){
        if(l[i].size() == 0){
            cout << "No" << endl;
            return 0;
        }
        // loop(j, l[i].size()){
        //     cout << l[i][j] << " ";
        // }
        // cout << endl;
    }

    // cout << "----------------------" << endl;

    cout << "Yes" << endl;

    queue<P> que;
    que.push(P(0, 0));
    flag[0] = true;
    int count = 0;
    while(que.size()){
        P p = que.front(); que.pop();

        for(auto v : l[p.first]){
            if(!flag[v]){
                flag[v] = true;
            // cout << "count:" << count << " " << v << endl;
                ans[v] = p.first+1;
                que.push(P(v, p.second+1));
            }
        }
        count++;
    }
    // cout << "----------------------" << endl;

    for(int i = 1;i < n;i++){
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 10784
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;


int main() {
  int n,x;
  cin >> n >> x;
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  int ans=1;
  int now=0;
  for(int i=0;i<n;i++){
    if(now+vec.at(i)<=x){
    now+=vec.at(i);
    ans++;
    }
    else{
      break;
    }
  }
  
    cout << ans << endl;
  
}

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

int		main()
{
	int		N, M, A;
	int	 sum = 0, ans;

	scanf("%d %d\n", &N, &M);
	for (int i = 0; i<M;i++)
	{
		scanf("%d ", &A);
		sum += A;
	}
	ans = N - sum;
	if (ans < 0)
		ans = -1;
 	printf("%d\n", ans);
	return (0);
}

Measured memory_bytes: 1732
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <vector>
#include <list>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <climits>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <random>
using namespace std;

void show(vector<int> v) {
	for (int s = 0; s < v.size(); s++)
	{
		cout << v[s];
		cout << " ";
	}
	cout << endl;
}

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

	if (x < 1200) { cout << "ABC" << endl; }
	else { cout << "ARC" << endl; }

	return 0;
}

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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int a = in.nextInt(), b = in.nextInt();
			if (a <= 8 && b <= 8) {
				out.println("Yay!");
			} else {
				out.println(":(");
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 20820
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int A=stdIn.nextInt();
		int B=stdIn.nextInt();
		int C=stdIn.nextInt();
		int ans=A+B;
		if(ans>B+C)
			ans=B+C;
		if(ans>A+C)
			ans=A+C;
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    map<char,int> mp;
    
    for(int i = 0; i < s.size(); i++){
        mp[s[i]]++;
    }

    int abc = s.size() / 3;

    if(min({mp['a'], mp['b'], mp['c']}) < abc){
        if(max({mp['a'], mp['b'], mp['c']}) - min({mp['a'], mp['b'], mp['c']}) < s.size() % 3){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    } else {
        if(max({mp['a'], mp['b'], mp['c']}) - min({mp['a'], mp['b'], mp['c']}) >= 2){
            cout << "NO" << endl;
        } else {
            cout << "YES" << endl;
        }
    }
    
}

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


int prime[1000001]={};

int power(int x, unsigned int y, int p)  
{  
    int res = 1;     
  
    x = x % p; 
   
    if (x == 0) return 0; 
  
    while (y > 0)  
    {  
         
        if (y & 1)  
            res = (res*x) % p;  
  
        
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}  

void pr()
{
  prime[1]=0;

 for(int i=2;i*i<1000001;i++)
  if(prime[i]==0)
  for(int j=i*i;j<1000001;j+=i)
  prime[j]=1;

}

int countSetBits( int n) 
{ 
     int count = 0; 
    while (n) { 
        count += n & 1; 
        n >>= 1; 
    } 
    return count; 
} 
  




int main()
{
   //pr();
  int t;
   //cin>>t;
   t=1;

  while(t--)
{

   int n,m;
    cin>>n>>m;

   int sum=0;

   vector<int> arr;

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

   arr.push_back(a);
   sum+=a;
}

  double th= (double)sum/(4*m);

  int count=0;

  for(int i=0;i<n;i++)
   if(arr[i]>=th)
    count++;

   if(count>=m)
  cout<<"Yes";

  else
  cout<<"No";
   
}




return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
    if(i%k==0)
    {
      cout<<"OK";
      return 0;
    }
  cout<<"NG";
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int in(){int x;cin>>x;return x;}
ll lin(){ll x;cin>>x;return x;}
string sin(){string x;cin>>x;return x;}

int main() {
    int N=in(), M=in();
    vector<int> s[M];
    int k;
    rep(i, M){
        cin>>k;
        rep(j, k){
            s[i].push_back(in()-1);
        }
    }
    int p[M];
    rep(i, M){
        p[i]=in();
    }
    int count=0;
    int check=0;
    int ans=0;
    int bit1;
    for(int bit=0;bit<(1<<N);bit++){
        check=0;
        rep(i, M){
            count=0;
            rep(j, s[i].size()){
                bit1=bit;
                if((bit1>>s[i].at(j))&1){
                    count++;
                }
            }
            if(count%2!=p[i]){
                check=1;
                break;
            }
        }
        if(check==0){
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

int main(){
    string nstr;
    cin >> nstr;
    int sum=0;
    rep(i, (int)nstr.size()){
        sum += (int)nstr[i]-'0';
    }
    if(sum%9==0 || sum==0)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------
string S;

int main() {
  cin >> S;
  int len = S.size();
  for (int i = 2; i <= len; i += 2) {
    bool can = true;
    for (int j = 0; j < (len - i) / 2; ++j) {
      if (S[j] != S[j + (len - i) / 2]) {
        can = false;
        break;
      }
    }
    if (can) {
      cout << len - i;
      return 0;
    }
  }
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

signed main(){
	int sx=read(),sy=read(),gx=read(),gy=read();
	int xBias=sx<=gx?1:-1,yBias=sy<=gy?1:-1;
	sx*=xBias,sy*=yBias,gx*=xBias,gy*=yBias;
	int n=read();
	vector<pi> ps;
	REP(i,n){
		int x=read()*xBias,y=read()*yBias;
		if(sx<=x&&x<=gx&&sy<=y&&y<=gy)
			ps.PB(pi(x,y));
	}
	double dif;
	if(sx==gx||sy==gy)
		dif=(ps.empty()?0.0:M_PI-2);
	else{
		sort(ALL(ps));
		vi lis(ps.size(),inf);
		int len=0;
		for(auto p:ps){
			int i=lower_bound(ALL(lis),p.second)-lis.begin();
			lis[i]=p.second;
			chmax(len,i+1);
		}
		dif=(M_PI/2-2)*len;
		if(len==(gx-sx)+1||len==(gy-sy)+1){
			len--;
			dif=(M_PI/2-2)*len+M_PI-2;
		}
	}
	double base=abs(sx-gx)+abs(sy-gy);
	cout<<fixed<<setprecision(19)<<base*100+dif*10<<endl;
}

Measured memory_bytes: 6512
#include <bits/stdc++.h> 
using namespace std; 
  
// Driver program to test methods of graph class 
int main() 
{ 
    int n;
    cin >> n;
    map<int,int> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        m[a.at(i)] = i % 2;
    }
    
    sort(a.begin(),a.end());
    
    int count = 0;
    for(int i = 0; i < n; i++){
        if(m.at(a.at(i)) != i % 2)count++;
    }
    
    cout << count / 2 << endl;
} 

Measured memory_bytes: 5376
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//↑templete
int main() {
	ll N;
	cin>>N;
	ll ans=N;
	for(ll i=1;i*i<=N;i++){
		if(N%i==0){
			ans=min(ans, i+(N/i)-2);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define rep(i,n) for(int i=0;i<=n;++i)
int main(){int r,n;while(scanf("%d",&n)!=EOF){r=0;rep(a,9)rep(b,9)rep(c,9)rep(d,9)if(a+b+c+d==n)r++;printf("%d\n",r);}}

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

int S;
int h, m, s;

int GetHour(int &S){
	int hour = S / 3600;
	S = S - 3600 * hour;
	return hour;
}

int GetMinute(int &S){
	int minute = S / 60;
	S = S - 60 * minute;
	return minute;
}

int main(void){
	cin >> S;
	h = GetHour(S);
	m = GetMinute(S);
	s = S;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> cake(h);
  for(int i=0;i<h;i++){
    string input;
    cin >> input;
    cake.at(i) = input;
  }
  vector<vector<int>> eater(h,vector<int>(w,0));
  int en = 1;
  vector<bool> alldot(h,1);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(cake.at(i).at(j) == '.'){
        eater.at(i).at(j) = en;
      }else{
        eater.at(i).at(j) = en;
        en++;
        alldot.at(i) = 0;
      }
    }
    int check = w-1;
    while(cake.at(i).at(check) == '.'){
      eater.at(i).at(check)--;
      if(check == 0) break;
      check--;
    }
  }
  for(int i=1;i<h;i++){
    if(alldot.at(i) == 1){
      for(int j=0;j<w;j++){
        eater.at(i).at(j) = eater.at(i-1).at(j);
      }
    }
  }
  for(int i=h-2;i>=0;i--){
    if(alldot.at(i) == 1){
      for(int j=0;j<w;j++){
        eater.at(i).at(j) = eater.at(i+1).at(j);
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout << eater.at(i).at(j);
      if(j!=w-1){
        cout << " ";
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 1280
#include <stdio.h>
int main() {
	int a, b, c, d, e, f;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
	int ansM = 100 * a, ansS = 0;
	for (int i = 0; i <= f / (100 * a); i++) {
		for (int j = 0; j <= f / (100 * b); j++) {
			for (int k = 0; k <= (f / c); k++) {
				for (int l = 0; l <= (f / d); l++) {
					int water = 100 * a * i + 100 * b * j;
					int sugar = c * k + d * l;
					int m = water + sugar;
					if (water == 0 || m > f || water / 100 * e < sugar)
						continue;
					if (ansS * m < sugar * ansM) {
						ansM = m;
						ansS = sugar;
					}
				}
			}
		}
	}
	// printf("%.f\n", pmax);
	printf("%d %d\n", ansM, ansS);
	return 0;
}

Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a,b;
  cin>>a>>b;
  for(int i=1;i<=1250;i++)
    if((int)(i*0.08)==a &&(int)(i*0.1)==b){
      cout<<i<<endl;
      return 0;
    }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <cstdlib>
using namespace std;

const int N = 1e5 + 50;

int n;
int fa[N], a[N], b[N], top;
map <int, int> e[N];

inline int getf(int x) {
  return fa[x] ? fa[x] = getf(fa[x]) : x;
}

inline void Merge(int x, int y) {
  x = getf(x); y = getf(y);
  if (x == y) { puts("NO"); exit(0); }
  if (e[x].size() > e[y].size()) swap(x, y);
  fa[x] = y;
  int t;
  for (auto i : e[x]) {
    t = i.first;
    e[t].erase(x);
    if (e[y].count(t)) {
      if (e[y][t] != i.second) {
        a[++ top] = y; b[top] = t;
        e[y].erase(t);
        e[t].erase(y);
      }
      else {
        puts("NO"); exit(0);
      }
    }
    else {
      e[y][t] = i.second;
      e[t][y] = i.second;
    }
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; i ++) {
    scanf("%d%d", &u, &v);
    e[u][v] = 1; e[v][u] = 1;
  }
  for (int i = 1, x, y; i < n; i ++) {
    scanf("%d%d", &x, &y);
    if (e[x].count(y)) {
      if (e[x][y] == 2) return 0 * puts("NO");
      e[x].erase(y);
      e[y].erase(x);
      a[++ top] = x; b[top] = y;
    }
    else {
      e[x][y] = 2; e[y][x] = 2;
    }
  }
  for (int i = 1; i <= top; i ++) Merge(a[i], b[i]);
  puts(top + 1 == n ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 25088
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

i64 N;
vector<int> V;
vector<int> W;
i64 Q;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> N;
  V.resize(N + 1);
  W.resize(N + 1);
  rep(i,0,N) {
    cin >> V[i + 1] >> W[i + 1];
  }
  i64 L = 1e5 + 1;
  vector<vector<int>> dp((1 << 9) + 1, vector<int>(L, 0));
  for(int i = 1; i < dp.size() && i <= N; i++) {
    vector<int>& next = dp[i];
    next = dp[i >> 1];
    rep(k,W[i],L) {
      next[k] = std::max(next[k], dp[i >> 1][k - W[i]] + V[i]);
      next[k] = std::max(next[k], next[k - 1]);
    }
  }
  
  cin >> Q;
  rep(i,0,Q) {
    i64 v, L;
    cin >> v >> L;
    vector<int> vs;
    while(v >= dp.size()) {
      vs.push_back(v);
      v >>= 1;
    }
    int ans = dp[v][L];
    for(int s = 0;s < (1 << vs.size()); s++) {
      int val = 0;
      int wei = 0;
      rep(j,0,vs.size()) {
        if(s & (1 << j)) {
          val += V[vs[j]];
          wei += W[vs[j]];
        }
      }
      if(L - wei >= 0) {
        ans = std::max(ans, val + dp[v][L - wei]);
      }
    }
    cout << ans << "\n";
  }
}



Measured memory_bytes: 206708
from functools import lru_cache

N = int(input())
X = input()
x = int(X, 2)
y = X.count('1')
if y == 1:
    x2 = 0
else:
    x2 = x % (y-1)
x1 = x % (y+1)

def f(n):
    if n == 0:
        return 0
    return 1 + f(n % bin(n).count('1'))

d = [0] * (2*10**5+5)
for i in range(2*10**5+5):
    d[i] = f(i)

for i in range(N):
    if x >>(N - i - 1) & 1:
        # print(f(x-pow(2, N-i-1)))
        if y - 1 == 0:
            print(0)
        else:
            print(d[(x2 - pow(2, N - i - 1, y-1)) % (y-1)] + 1)
    else:
        # print(f(x+pow(2, N-i-1)))
        print(d[(x1 + pow(2, N - i - 1, y+1)) % (y+1)] + 1)

Measured memory_bytes: 87612
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
   
    int a,b;
    cin>>a>>b;
    
    int h;
    h=0;
    for(int i=1;i<=b-a;i++){
        h+=i;
        
    }
    h=h-b;
    
    cout<<h<<endl;
    

    return 0;
   
}






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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	int x;
	cin >> x;
	for(int i = -200; i <= 200; i++) {
		for(int j = -200; j <= 200; j++) {
			if(pow(i, 5) - pow(j, 5) == x) {
				cout << i << " " << j << "\n";
				return;
			}
		}
	}





	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 4108
import heapq

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = []
heapq.heappush(b,0)
for _ in range(m):
    bm = -b[0]
    if len(a) != 0 and a[-1] > bm:
        am = a.pop()
        am = am // 2
        heapq.heappush(b,-am)
    else:
        bm = -heapq.heappop(b)
        bm = bm // 2
        heapq.heappush(b,-bm)
        
    
print(sum(a)-sum(b))
    

Measured memory_bytes: 65124
#include <stdio.h>

int main(){
	int x,y;
	while(1){
		scanf("%d %d",&x,&y);
		if(x == 0 && y == 0) break;
		for(int i = 0; i < x; i++){   //横のループ
			for(int j = 0; j < y; j++){  //縦のループ
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,M;cin>>N>>M;
  vector<pair<long,long>>A(N);
  for(long i=0;i<N;i++)cin>>A[i].first>>A[i].second;
  sort(A.begin(),A.end());
  long m=0,ans=0;
  long i=0;
  while(m<M){
    ans+=A[i].first*min(M-m,A[i].second);
    m+=A[i].second;
    i++;
  }
  cout<<ans;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
const int N = 1e5 + 10;
int mod = 1e9 + 7;
typedef long long ll;
int rec[N];

int main()  
{
 //  freopen("in.txt", "r", stdin);
   int n;
   while (~scanf("%d", &n))
   {
   		map<int, int>mp;
   		for (int i = 0; i < n; i++)
   		{
   			scanf("%d", rec + i);
   			if (mp.find(rec[i]) == mp.end())
   				mp[rec[i]] = 0;
   			mp[rec[i]] += 1;
   		}
   		sort(rec, rec + n);
   		int a = -1, b = -1;
   		if (mp[rec[n-1]] >= 4)
   		{
   			cout<<((ll)rec[n-1]*rec[n-1])<<endl;
   			return 0;
   		}
   		for (int i = n - 1; i >= 0; i--)
   			if (mp[rec[i]] >= 2)
   			{
   				if (a == -1)
   					a = rec[i];
   				else if (b == -1 && a != rec[i])
   					b = rec[i];
   				if (a !=-1&&b != -1)
   					break;
   			}
   		if (a == -1 || b == -1)
   			puts("0");
   		else
   			cout<<((ll)a*b)<<endl;
   }

    return 0;
}

Measured memory_bytes: 5376
fun main(args: Array<String>) {
    val (n ,m) = readLine()!!.split(' ').map { it.toInt() }
    val (l1, r1) = readLine()!!.split(' ').map { it.toInt() }
    val ans = (1 until m).fold(Pair(l1, r1)) { acc, i ->
        val (l, r) = readLine()!!.split(' ').map { it.toInt() }
        Pair(Math.max(acc.first, l), Math.min(acc.second, r))
    }
    println(Math.max(ans.second - ans.first + 1, 0))
}

Measured memory_bytes: 57232
from sys import maxsize
n = int(input())
L = []
for _ in range(n):
    L.append(int(input()))
minv = L[0] 
maxv = -maxsize
for i in range(1, n):
    maxv = max(maxv, L[i]-minv)
    minv = min(minv, L[i])
print(maxv)


Measured memory_bytes: 13596
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 0;
        for (int i = 1; i <= n; i++) {
            if (!(i % 3 == 0 || i % 5 == 0)) {
                ans += i;
            }
        }
        System.out.println(ans);
    }
}

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

int main() {
  int N, M;
  cin >> N;
  string S[N];
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  cin >> M;
  string T[M];
  for (int i = 0; i < M; i++) {
    cin >> T[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int temp = 0;
    for (int j = 0; j < N; j++) {
      if (S[i] == S[j]) {
        temp++;
      }
    }
    for (int j = 0; j < M; j++) {
      if (S[i] == T[j])
        temp--;
    }
    ans = max(ans, temp);
  }
  cout << ans << endl;
}

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

#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define foreach(i, k, n) for (int i = (k); (i) < (n); ++(i))
#define check(x) cout << #x "=" << x << endl;
#define checkpair(x, y) cout << #x "=" << x << ", " #y "=" << y << endl;

const int INF = 1001001001;

int main()
{
    int a,b;
    cin >> a >> b;
    cout << (a < 10 && b < 10 ? a * b : -1) << endl;
    return 0;
}


Measured memory_bytes: 256