akhauriyash/Code-Regression huggingface dataset:
M, K = map(int, input().split())

if M == 0:
	if K == 0:
		print(0, 0)
	else:
		print(-1)
	exit()

if M == 1:
	if K == 0:
		print(0, 0, 1, 1)
	else:
		print(-1)
	exit()

N = 2 ** M
if N <= K:
	print(-1)
	exit()

ans = []
ans.append(K)

for i in range(N):
	if i == K:
		continue
	ans.append(i)

ans.append(K)

for i in range(N-1, -1, -1):
	if i == K:
		continue
	ans.append(i)

for i in ans:
	print(i, end=' ')

Measured memory_bytes: 19504
x, y = gets.chop.split.map(&:to_i)

array = []
if x >= y
  array << x
  x2 = x - 1
  if x2 >= y
    array << x2
  else
    array << y
  end
else
  array << y
  y2 = y - 1
  if y2 >= x
    array << y2
  else
    array << x
  end
end

p array.inject(:+)


Measured memory_bytes: 1916
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
const int mod7=1e9+7;
const int mod=1e9+7;
const int maxn=0x3fffffff;
const double pi=3.14159265357;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0') if(ch=='-') d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9') a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0') if(ch=='-') d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9') a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
struct note
{
    int next;
    int to;
    int dis;
}edge[N];
int num=0,dis[N],head[N],ans[N];
bool vis[N];
void add(int from,int to,int dis)
{
    edge[++num].next=head[from];
    edge[num].to=to;
    edge[num].dis=dis;
    head[from]=num;
    edge[++num].next=head[to];
    edge[num].to=from;
    edge[num].dis=dis;
    head[to]=num;
}
struct node
{
    int dis;
    int pos;
    bool operator < (const node &x) const
    {
        return x.dis<dis;
    }
};
priority_queue <node> q;
inline void dijkstra(int st,int n)
{
    for(register int i=1;i<=n;i++) dis[i]=maxn;
    dis[st]=0;
    q.push((node){0,st});
    while(!q.empty())
    {
        node x=q.top();
        q.pop();
        int d=x.dis;
        int p=x.pos;
        if(vis[p])
            continue;
        vis[p]=true;
        for(register int i=head[p];i;i=edge[i].next)
        {
            int t=edge[i].to;
            if(dis[t]>dis[p]+edge[i].dis)
            {
                dis[t]=dis[p]+edge[i].dis;
                if(!vis[t])
                {
                    ans[t]=p;
                    q.push((node){dis[t],t});
                }
            }
        }
    }
}
int main()
{
    int n,m;
    read(n);read(m);
    for(re int i=1;i<=m;i++)
    {
        int a,b;
        read(a);read(b);
        add(a,b,1);
    }
    dijkstra(1,n);
    bool f=1;
    for(re int i=2;i<=n;i++) if(dis[i]==0x3fffffff) f=0;
    if(f)
    {
        puts("Yes");
        for(re int i=2;i<=n;i++)
        {
            int k=i;
            printf("%d\n",ans[k]);
        }
    }
    else puts("No");
    return 0;
}

Measured memory_bytes: 10040
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	i64 n, k;
	cin >> n >> k;
	map<i64, i64> mp;
	REP(i, n)
	{
		i64 a, b;
		cin >> a >> b;
		mp[a] += b;
	}

	i64 ans = 0;
	REPIT(mp)
	{
		if (k > (*it).second)
		{
			k -= (*it).second;
		}
		else
		{
			ans = (*it).first;
			break;
		}
	}

	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main (){
    int a, b, c; cin >> a >> b >> c;
    int cnt=0;
    for(int i=a; i<=b; i++){
        if(c%i==0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3104
inp = list(map(int, input().split()))
a, b, c = sorted(inp)

ans = 0

d1 = (c - a) // 2
ans += d1
a += d1 * 2

d2 = (c - b) // 2
ans += d2
b += d2 * 2

a, b, c = sorted([a, b, c])
if a == b and b < c:
    ans += 1
elif a < b and b == c:
    ans += 2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            {for(ll i=0;i<size;i++) cout<<w[i]<<" ";cout<<"\n";}
#define print(a)                cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,val)               lower_bound(all(v),val)-v.begin()
#define ub(v,val)               upper_bound(all(v),val)-v.begin()
#define SS                      stringstream
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

ll poww(ll b,ll e){if(e==0)return 1;else if(e%2==0){ll a=pow(b,e/2);return a*a;}else {ll a=pow(b,e/2);return b*a*a;}}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a,ll m=MOD){if(m==1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}

int main()
{
	fastIO
	ll n;
	cin>>n;
	ll flag=1;
	ll a;
	rep(i,0,n-1,1)
	{
		cin>>a;
		if(((a%3!=0)&&(a%5!=0))&&(a%2==0))
		{
			flag=0;
		}
	}
	
	cout<<(flag==1?"APPROVED":"DENIED");
	
	return 0;
}




Measured memory_bytes: 256
use std::collections::BTreeSet;

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n, ) = input!(u16);
    let mut bts = BTreeSet::new();

    for i in 1..10 {
        for j in 1..10 {
            bts.insert(i * j);
        }
    }

    if bts.contains(&n) {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    solve();
}


Measured memory_bytes: 4352
#include<stdio.h>
int main()
{
  int a,b,tmp,c;
  scanf("%d %d",&a,&b);
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  c= a % b;
  while(c!=0){
    a = b;
    b = c;
    c = a % b;
  }
  printf("%d\n", b);
 
  return 0;
}

Measured memory_bytes: 592
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Main  {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer = new StringTokenizer(input.readLine());
        int a = Integer.parseInt(tokenizer.nextToken());
        int b = Integer.parseInt(tokenizer.nextToken());

        List<List<Integer>> lists = Arrays.asList(Arrays.asList(1,3,5,7,8,10,12), Arrays.asList(4,6,9,11), Arrays.asList(2));

        for (int i = 0; i < 3; i++) {
            if (lists.get(i).contains(a) && lists.get(i).contains(b)){
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }

}


Measured memory_bytes: 20948
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;

int main() {
    int q, x;
    char com[20];
    list<int> iList;
    cin >> q;
    for ( int i = 0; i < q; i++ ) {
        cin >> com;
        if ( com[0] == 'i' ) {
            cin >> x;
            iList.push_front( x );
        } else if ( com[6] == 'L' ) {
            iList.pop_back();
        } else if ( com[6] == 'F' ) {
            iList.pop_front();
        } else if ( com[0] == 'd' ) {
            cin >> x;
            for ( list<int>::iterator it = iList.begin(); 
                  it != iList.end(); it++ ) {
                if ( *it == x ) {
                    iList.erase( it );
                    break;
                }
            }
        } else {
            ;
        }
    }
    
    int i = 0;
    for ( list<int>::iterator it = iList.begin(); it != iList.end(); it++ ) {
        if ( i++ ) cout << " ";
        cout << *it;
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 34344
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    string n;
    cin >> n;
    if ( n[0] == n[1] && n[1] == n[2] || n[1] == n[2] && n[2] == n[3] ) cout << "Yes" << endl;
    else                                                                cout << "No" << endl; 
//    char tmp_num;
//    int cnt = 0;
//    rep(i, n.length()) {
//        if ( i == 0 ) {
//            tmp_num = n[i];
//            ++cnt;
//        }
//        else if ( i == 1 ) {
//            if ( tmp_num == n[i] ) {
//                ++cnt;
//                continue;
//            }
//            else {
//                tmp_num = n[i];
//                cnt = 1;
//            }
//        }
//        else if ( i == 2 ) {
//            if ( tmp_num == n[i] ) {
//                ++cnt;
//                continue;
//            }
//            else {
//                break;
//            }
//        }
//        else if ( i == 3 ) {
//            if ( tmp_num == n[i] ) {
//                ++cnt;
//            }
//            else {
//                break;
//            }
//        }
//    }
//    if ( cnt >= 3 ) cout << "Yes" << endl;
//    else            cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
C, S, F = [[0]*n for i in range(3)]
for i in range(1, n):
    c, s, f = map(int, input().split())
    C[i], S[i], F[i] = c, s, f

ans = [0]*(n+1)
for i in range(1, n):
    t = S[i]+C[i]
    for j in range(i+1, n):
        t = S[j]+C[j]+[0, -(-(t-S[j])//F[j])*F[j]][S[j] < t]
    ans[i] = t

print(*(x for x in ans[1:]), sep="\n")

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    int c;
    int x;
    int d;
    cin >> a >> b >> c;
    if (a < b) {
        x = a;
        d = b;
    } else {
        x = b;
        d = a;
    } if (x < c) {
        if (d < c) {
            cout << x << " " << d << " " << c << endl;
        } else {
            cout << x << " " << c << " " << d << endl;
        }
    } else {
        cout << c << " " << x << " " << d << endl;
    }
return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, m, v, p;
vector <int> a;

bool check(int idx){
    int tar = a[idx] + m;
    if(tar < a.back()) return 0;
    ll sum = 0;
    for(int i = idx + 1 ; i < n ; i++){
        sum += tar - a[i];
    }
    if(sum - 1LL * m * (v - (idx + 1)) < 0) return 0;
    return 1;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> v >> p;
    a.resize(n);
    for(auto &i : a) cin >> i;
    sort(a.begin(), a.end());
    int ans = 0;
    for(int i = 0 ; i < p - 1 ; i++){
        ans++;
        v--;
        a.pop_back();
    }
    n = a.size();
    int l = 0, r = n - 1;
    while(l <= r){
        int mid = (l + r) / 2;
        if(check(mid)) r = mid - 1;
        else l = mid + 1;
    }
    ans += n - l;
    cout << ans << endl;
}


Measured memory_bytes: 640
n = int(input())
values = list(map(int, input().split()))
minv = min(values)+1
print(1)
i = 2
ng_value = [1]*minv
while i < minv:
    if not 0 in [1 if values[k] % i == 0 else 0 for k in range(n)]:
        print(i)
    else:
        for j in range(i, minv, i):
            ng_value[j] = 0
    b = True
    for j in range(i+1, minv):
        if ng_value[j]:
            i = j
            b = False
            break
    if b: break

Measured memory_bytes: 17412
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
//        string[] input = ReadLine().Split(' ');
/*        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int b = int.Parse(input[2]);*/
//        string temp = ReadLine();
        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
        int b = a/10;
        a = a%1000;
        if(a%111==0 || b%111==0){
            WriteLine("Yes");
        }else{
            WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;

const int mod1 = 1e9 + 7;
const int mod2 = 998244353;

struct Combination
{
	using ll = int_fast64_t;

	int mod;
	vector<ll> mfact, rfact;

	Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod)
	{
		mfact[0] = 1LL;
		for (int i = 1; i < sz + 1; i++)
		{
			mfact[i] = mfact[i - 1] * i % mod;
		}

		rfact[sz] = inv(mfact[sz]);

		for (int i = sz - 1; i >= 0; i--)
		{
			rfact[i] = rfact[i + 1] * (i + 1) % mod;
		}
	}

	ll fact(int k) const
	{
		return mfact[k];
	}

	ll pow(ll x, ll n) const
	{
		ll ret = 1LL;
		while (n > 0)
		{
			if (n & 1)
				(ret *= x) %= mod;
			(x *= x) %= mod, n >>= 1;
		}
		return ret;
	}

	ll inv(ll x) const
	{
		return pow(x, mod - 2);
	}

	ll Perm(int n, int r) const
	{
		if (r < 0 || n < r)
			return 0LL;
		return mfact[n] * rfact[n - r] % mod;
	}

	ll Binom(int p, int q) const
	{
		if (q < 0 || p < q)
			return 0LL;
		return mfact[p] * rfact[q] % mod * rfact[p - q] % mod;
	}
};

int main()
{
	int K;
	string s;
	cin >> K >> s;
	ll ans = 0;
	int N = s.size();

	Combination Comb(N + K, mod1);

	for (int i = 0; i <= K; i++)
	{
		(ans += (Comb.pow(26, K - i) * Comb.pow(25, i) % mod1) * Comb.Binom(i + N - 1, N - 1)) %= mod1;
	}

	cout << ans << "\n";
}

Measured memory_bytes: 35632
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = parseInt(args[0][0], 10)
	const b = parseInt(args[0][1], 10)
	console.log(a * b / 2)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        for(int i = 0;i < n.length();i++){
            char s = n.charAt(i);

            if(s == '1'){
                s = '9';
                System.out.print(s);
            }else{
                s = '1';
                System.out.print(s);
            }
        }
    }
}

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

int main(void){
  int N;
  cin >> N;
  char s;
  int a;
  int S[14]={0},H[14]={0},C[14]={0},D[14]={0};
  for(int i=0;i<N;i++){
    cin >> s >> a;
    if(s=='S')S[a]=1;
    else if(s=='H')H[a]=1;
    else if(s=='D')D[a]=1;
    else if(s=='C')C[a]=1;
  }

  for(int i=1;i<=13;i++){
    if(S[i]!=1)cout << 'S' << ' ' << i << endl;
  }

  for(int i=1;i<=13;i++){
    if(H[i]!=1)cout << 'H' << ' ' << i << endl;
  }

  for(int i=1;i<=13;i++){
    if(C[i]!=1)cout << 'C' << ' ' << i << endl;
  }

  for(int i=1;i<=13;i++){
    if(D[i]!=1)cout << 'D' << ' ' << i << endl;
  }
  return 0;
}

Measured memory_bytes: 3064
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void){
    int N, K;
    cin >> N >> K;
    int p[N];
    long sum = 0;
    long max;
    for(int i = 0; i < N; i++){
        cin >> p[i];
        p[i]++;
    }
    for(int i = 0; i < K; i++){
        sum += p[i];
    }
    max = sum;
    for(int i = 0; i < N-K; i++){
        sum += (p[i+K]-p[i]);
        if(sum > max){
            max = sum;
        }
    }
    cout << to_string(max*0.5) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
int k;
cin>>k;
int total;
if(k%2==0){
	total = k*k/4;
	cout<< total<<endl;
}
else{
	total = k/2*((k+1)/2);
	cout<< total <<endl;
}
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace _5_A
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x[0] == 0 && x[1] == 0)
                {
                    break;
                }
                int a = x[0];
                int b = x[1];
                for(int a1=1;a1<=a; a1++)
                {
                    for(int b1 = 1; b1 <= b; b1++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine("");
            }
        }
    }
}

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

int main()
{
    int s;
    cin >> s;
    int L = s / 100;
    int R = s % 100;

    if (1 <= L && L <= 12)
    {
        if (1 <= R && R <= 12)
        {
            cout << "AMBIGUOUS" << endl;
        }
        else
        {
            cout << "MMYY" << endl;
        }
    }
    else
    {
        if (1 <= R && R <= 12)
        {
            cout << "YYMM" << endl;
        }
        else
        {
            cout << "NA" << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

long long x;

long long count(long long n) {
  long long sum = 0;
  if (n != -1) sum = n / x + 1;
  else sum = 0;
  return sum;
}

int main() {
  long long a, b;

  cin >> a >> b >> x;

  cout << (count(b) - count(a - 1)) << endl;

  return 0;
}


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
int main(){
    char c;
    cin >> c;
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e'|| c == 'o' ){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}

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

int main(void){
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0;i < n;i++)
		cin >> v[i];
	// dp[i] - TRUE if current player wins 
	vector<bool> dp(k+1, false);
	for(int i = 0;i <= k;i++){
		for(int a : v){
			if(i + a <= k && !dp[i]){
				dp[i+a] = true;
			}
			// if(i >= a && !dp[i-a]){
			// 	dp[i] = true;
			// }
		}
	}
	puts(dp[k] ? "First" : "Second");
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
       PROGRAM-ID. HELLO.

       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.

           SELECT STDIN ASSIGN TO KEYBOARD ORGANIZATION LINE SEQUENTIAL.


       DATA DIVISION.


       FILE SECTION.

           FD STDIN.
           01 LN PIC X(65535) USAGE DISPLAY.
             88 EOF VALUE HIGH-VALUES.

       WORKING-STORAGE SECTION.

           01 N PIC 9 USAGE COMP.
           
           01 OUT PIC X(65535) USAGE DISPLAY.

       PROCEDURE DIVISION.

           INITIALIZE LN, OUT.

           MAIN-PROCEDURE.

             OPEN INPUT STDIN
             READ STDIN
               AT END SET EOF TO TRUE
             END-READ
             CLOSE STDIN
             
             ADD FUNCTION NUMVAL(LN(1:1)) TO N
             ADD FUNCTION NUMVAL(LN(2:1)) TO N
             ADD FUNCTION NUMVAL(LN(3:1)) TO N

             DISPLAY N

             STOP RUN.

       END PROGRAM HELLO.


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(vec) vec.begin(), vec.end()
using namespace std;

int main(){
  int a;
  cin >> a;
  vector<int> enemy(a + 1);
  rep(i, a + 1) cin >> enemy.at(i);
  vector<int> hero(a);
  rep(i, a) cin >> hero.at(i);
  int64_t ans = 0;
  rep(i, a){
    if (hero.at(i) <= enemy.at(i)) ans += hero.at(i);
    else{
      ans += enemy.at(i);
      hero.at(i) -= enemy.at(i);
      if (hero.at(i) < enemy.at(i + 1)){
        ans += hero.at(i);
        enemy.at(i + 1) -= hero.at(i);
      }
      else{
        ans += enemy.at(i + 1);
        enemy.at(i + 1) = 0;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
  int n,k,m,i,j;
  long long t,l,res=0;
  vector<long long> v;
  decltype(v)::iterator it,ed;
  size_t pos;
  cin >> n >> k;
  for(i=0;i<n;i++){
    cin >> t;
    v.push_back(t);
  }
  for(i=0;i<n-1;i++){
    t=v[i];
    for(j=i+1;j<n;j++){
      t+=v[j];
      v.push_back(t);
    }
  }
  sort(v.begin(),v.end(),greater<long long>());
  m=(int)log2(v[0]);
  l=(long long)1<<m;
  ed=v.end();
  for(;m>=0;m--){
    it=upper_bound(v.begin(),ed,res+l,greater<long long>());
    pos=distance(v.begin(),it);
    if(pos>=k){
      res+=l;
      ed=it;
    } else {
      for(i=0;i<pos;i++)
        v[i]-=l;
      sort(v.begin(),ed,greater<long long>());
    }
    l>>=1;
  }
  cout << res << endl;
  return 0;
}


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

using namespace std;

# define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;

# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)

const int MAXN = 100 * 1000 + 10;
int t[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, c, k;
	cin >> n >> c >> k;
	for (int i = 0; i < n; i ++)
		cin >> t[i];

	sort(t, t + n);

	int cp = 0, lt, ans = 0;;
	for (int i = 0; i < n; i ++)
	{
		if (!cp || lt > t[i] + k || lt < t[i])
		{
			ans ++;
			lt = t[i] + k;
			cp = c;
		}
		cp --;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(N)]
    mi = 0
    idx = 0
    for a, b in A:
        if mi < a:
            mi = a
            idx = b
    print(mi + idx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21172
#include<stdio.h>

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

  int i,a[110],g0=0,gn=0;
  for(i=0;i<m;i++){
    scanf("%d",&a[i]);
    if(a[i]<x)
      g0++;
    else if(a[i]>x)
      gn++;
  }

  if(g0<gn)
    printf("%d\n",g0);
  else
    printf("%d\n",gn);

  return 0;
}

Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)

int main()
{
  ll x;
  cin >> x;
  ll i = 100, cnt = 0;
  while (i < x)
  {
    i = i + (i * 0.01);
    cnt++;
  }
  cout << cnt << endl;
}



Measured memory_bytes: 3624
n=int(input())
if(n>=400 and n<=599):
    print(8)
if(n>=600 and n<=799):
    print(7)
if(n>=800 and n<=999):
    print(6)
if(n>=1000 and n<=1199):
    print(5)
if(n>=1200 and n<=1399):
    print(4)
if(n>=1400 and n<=1599):
    print(3)
if(n>=1600 and n<=1799):
    print(2)
if(n>=1800 and n<=1999):
    print(1)

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

int main() {
  int N;
  scanf("%d", &N);
  string S;
  cin >> S;
  int counta = 0;
  int countb = 0;
  int countc = 0;
  int max = N;

  for (int i = 0; i < N; ++i){
    if(S[i]=='#') ++counta;
  }

  for (int i = 0; i < N; ++i){
    if(S[i]=='.') ++countb;
  }

  if(counta<max) max = counta;
  if(countb<max) max = countb;

  for (int i = 0; i < N; ++i){
    if(S[i]=='#') ++countb;
    else --countb;
    if(countb<max) max = countb;
  }


  cout << max << endl;

}

Measured memory_bytes: 640
n,m = gets.chomp.split(" ").map(&:to_i)
temp = Array.new
mul = Array.new
ans = Array.new(n, 0)

n.times do
	str = gets.chomp.split(" ").map(&:to_i)
	temp.push(str)
end

m.times do
	str = gets.chomp.to_i
	mul.push(str)
end

for i in 0...n do
	for j in 0...m do
		ans[i] += temp[i][j] * mul[j]
	end
end

puts ans.join("\n")

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

int main(void)
{
  string s;
  cin >> s;
  
  bool flag = true;
  
  for(int i = 0; i < s.size(); ++i){
    if(i%2==0){
      if('L'==s[i]){
        flag = false;
        break;
      }
    }else{
      if('R'==s[i]){
        flag = false;
        break;
      }
    }
  }
  
  cout << (flag ? "Yes" : "No") << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		int[] mojicountR = new int[26];
		int[] mojicountL = new int[26];
		int len;
		int tmax = 0,max = 0;
		String str = new String();
		Scanner scan = new Scanner(System.in);

		for(int i = 0;i < 26;i++) {
			mojicountR[i] = 0;
			mojicountL[i] = 0;
		}

		len = scan.nextInt();
		str = scan.next();

		for(int i = 0;i < len;i++) {
			mojicountR[str.charAt(i) - 97]++;
		}

		for(int i = 0;i < len;i++) {

			if(--mojicountR[str.charAt(i) - 97] == 0) {
				tmax--;
			}
			if(++mojicountL[str.charAt(i) - 97] == 1) {
				tmax++;
			}

			max = getmax(max,tmax);
		}

		System.out.println(max);

		scan.close();

	}

	public static int getmax(int x,int y) {
		return x > y ? x : y ;
	}

	public static int getmin(int x,int y) {
		return x > y ? y : x;
	}

}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int h,n,sum=0,t;
	cin>>h>>n;
	for(int i=0;i<n;++i)
	{
		cin>>t;
		sum+=t;
	}
	if(sum>=h) cout<<"Yes\n";
	else cout<<"No\n"; 
	return 0;
} 

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

using namespace std;

void printdpTable(vector<vector<int> > a){
    cout << "- dp table -" << endl;
    for(int i = 0; i < a.size(); i++){
        for(int j = 0; j < a[0].size(); j++){
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    cout << "- dp table -" << endl;
}

//すべての最長部分文字列をの長さ出力する
void printLcs(string x, string y){
    int n = x.length();
    int m = y.length();
    vector<vector<int> > a(n+1, vector<int>(m+1, 0));
    x = ' ' + x;
    y = ' ' + y;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(x[i] == y[j]){
                a[i][j] = a[i-1][j-1]+1;
            }else{
                a[i][j] = max(a[i-1][j], a[i][j-1]);
            }
        }
    }
    cout << a[n][m] << endl;
}

int main(void){
    int n;
    cin >> n;
    string x, y;
    for(int i = 0; i < n; i++){
        cin >> x >> y;
        printLcs(x,y);
    }
    return 0;
}


Measured memory_bytes: 6852
import java.util.*;
class Main {
  public static void main (String[] args) throws Exception {
    
    Scanner sc = new Scanner(System.in);
    
    long p = sc.nextLong();
    long l = sc.nextLong();
    
    long ans =1;
    
    long first = l;
    
    long count=0;
    
    if(p==1)ans=l;
    else{
    	for(long i=2; i<=Math.sqrt(l);i++){
          if(i==l && l==first)break;
       
          if(l%i == 0){
            while (l%i==0){
              count++;
              l=l/i;
            }
          if(count >=p){
            for(int j=1;j<=count/p;j++){
        		ans=ans*i; 
        	 }
         }
         count =0;
         }
         
     }
    } 
       System.out.println(ans);

  }
}


Measured memory_bytes: 23124
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

const int MOD = 1e9 + 7;

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    int res = 0;
    for (int i = 1; i * i <= m; i++) {
        if (m % i == 0) {
            if (1LL * n * i <= m) {
                res = max(res, i);
            }
            if (1LL * n * (m / i) <= m) {
                res = max(res, m / i);
            }
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
<?php
list($N, $M) = array_map(function ($n) {
    return (int)$n;
}, explode(' ', fgets(STDIN)));

$H = array_map(function ($n) {
    return (int)$n;
}, explode(' ', fgets(STDIN)));

$roads_from_node = [];
for ($i = 0; $i < $M; $i++) {
    list($A, $B) = array_map(function ($n) {
        return (int)$n - 1;
    }, explode(' ', fgets(STDIN)));
    if (!array_key_exists($A, $roads_from_node)) {
        $roads_from_node[$A] = [];
    }
    if (!array_key_exists($B, $roads_from_node)) {
        $roads_from_node[$B] = [];
    }
    $roads_from_node[$A][] = $B;
    $roads_from_node[$B][] = $A;
}

$memo = [];
for ($i = 0; $i < $N; $i++) {
    $next_nodes = $roads_from_node[$i];
    $h_i = $H[$i];
    if ($next_nodes) {
        if (!array_key_exists($i, $memo)) {
            foreach ($next_nodes as $next_node) {
                if ($h_i < $H[$next_node]) {
                    $memo[$i] = false;
                    break;
                } elseif ($h_i === $H[$next_node]) {
                    $memo[$i] = false;
                    $memo[$next_node] = false;
                    break;
                } else {
                    $memo[$next_node] = false;
                }
            }
        }
    }
}

echo $N - count($memo);

Measured memory_bytes: 62072
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x = sc.nextLong();
		double n = 100;
		int i = 0;
		while (x > n) {
			n = n * 1.01;
			n = Math.floor(n);
			i++;
			//System.out.println(n);

		}
		System.out.println(i);

	}

}


Measured memory_bytes: 35860
//8 may 2020
//count of solved problems : 2
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;

int n;

int main(){
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++)sum+=i;
		cout<<sum;
}



Measured memory_bytes: 256
/**
Code by Nitin1184
**/
# include <bits/stdc++.h>
# define ll long long
# define pi 3.14159265358979323846
# define M 1000000007
# define pb push_back
# define mp make_pair
# define ff first
# define ss second
 
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    ll a[n],x=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        x=(x^a[i]);
    }
    for(int i=0;i<n;i++)
        cout<<(x^a[i])<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep1(i, n) for(ll i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> buc(100001);
  rep(i,n){
    ll a,b;
    cin >> a >> b;
    buc[a] += b;
  }
  vector<ll> sum(100001);
  rep1(i,100000){
    if(i == 1) sum[i] = buc[i];
    else sum[i] = sum[i-1] + buc[i];
  }
  cout << lower_bound(all(sum),k)-begin(sum) << endl;
}

Measured memory_bytes: 4828
#include<iostream>
#include<climits>
#define ll long long 
using namespace std;

int main(){
  int a,b;
  ll c,time=0;

  cin>>a>>b>>c;
  
  while(1){
    if(c>=INT_MAX){
      c=-1;
      break;
    }
    time+=a;
    if(time>=c) break;
    time+=b;
    if(time>=c) c+=60; 
  }

  cout<<c<<endl;
  
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>

using namespace std;

int main(){
  char a, b;
  cin >> a >> b;
  
  bool atco, tpco;
  if(a == 'H') atco = true;
  else atco = false;
  if(b == 'H') tpco = true;
  else tpco = false;
  
  if(atco == tpco) cout << 'H';
  else cout << 'D';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using graph = vector<vector<int>>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)


int main() {
  int n;cin>>n;
  vector<int> v(n+2,0);
  int sum=0;
  rep(i,n){
    cin>>v[i+1];
    sum+=abs(v[i+1]-v[i]);
  }
  sum+=abs(v[n]);
  //cout<<sum;
  rep(i,n){
    int a=abs(v[i+1]-v[i])+abs(v[i+2]-v[i+1])-abs(v[i+2]-v[i]);
    cout<<sum-a<<endl;
  }
}
   

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

int main() {
    int n, t, a;
    cin >> n >> t >> a;
    int h[n];
    for (int i = 0; i < n; i++)
        cin >> h[i];
    
    pair<double, int> ans(DBL_MAX,0);
    for (int i = 0; i < n; i++) {
        double temp = abs(a-(t-h[i]*0.006));
        if (temp < ans.first) {
            ans.first = temp;
            ans.second = i+1;
        }
    }

    cout << ans.second << endl;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>

int dp[10000];
int num[10]={0,2,5,5,4,5,6,3,7,6};

int Max(int a, int b){
    return a>b?a:b;
}

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int a[9];
    int i,j;
    for(i=0;i<m;i++){
        scanf("%d",&a[i]);
    }
    for(i=1;i<m;i++){
        for(j=i;j>0;j--){
            if(a[j]>a[j-1]){
                int tmp=a[j-1];
                a[j-1]=a[j];
                a[j]=tmp;
            }else{
                break;
            }
        }
    }
    for(i=0;i<=n;i++){
        dp[i]=-1e9;
    }
    dp[0]=0;
    for(i=1;i<=n;i++){
        for(j=0;j<m;j++){
            if(i-num[a[j]]<0)continue;
            dp[i]=Max(dp[i],dp[i-num[a[j]]]+1);
        }
    }

    int idx=n;
    while(idx){
        for(i=0;i<m;i++){
            if(idx-num[a[i]]>=0){
                if(dp[idx]==dp[idx-num[a[i]]]+1){
                    printf("%d",a[i]);
                    idx-=num[a[i]];
                    break;
                }
            }
        }
    }
    puts("");
    return 0;
}


Measured memory_bytes: 256
def solve():
    N, K, Q = map(int, input().split())
    point = [K for _ in range(N)]
    
    for _ in range(Q):
        answer = int(input()) - 1
        point[answer] += 1
    
    for i in range(N):
        if point[i] > Q:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    solve()

Measured memory_bytes: 6616
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;
int n,m;
int a[16][16];
bool A[16],B[16];
int CNT(int x)
{
    int ans=0;
    while(x)
    {
        ans+=x&1;
        x>>=1;
    }
    return ans;
}
bool check(int x)
{
    for(int i=1;i<=n;i++)
    {
        
        if(x&(1<<(i-1)))
        {
            A[i]=1;
            for(int j=1;j<=n;j++)
            {
                if(a[i][j]==1)A[j]=1;
                if(a[i][j]==0)B[j]=1;
            }
        }
        else B[i]=1;
    }
    for(int i=1;i<=n;i++)
    {
        if(A[i]&&B[i])return 0;
    }
    return 1;
}
int main()
{
    memset(a,-1,sizeof(a));
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>m;
        int tx,ty;
        for(int j=1;j<=m;j++)
        {
            cin>>tx>>ty;
            a[i][tx]=ty;
        }
    }
    
    
    int ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        memset(A,0,sizeof(A));
        memset(B,0,sizeof(B));
        if(check(i))
        {
            ans=max(ans,CNT(i));
        }
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

const int INF = 1000000000;
const double eps = 1e-8;

int main(void) {
  string tb[] = {"",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
  int sz[]={0,5,3,3,3,3,3,4,3,4};
  int n;cin>>n;
  REP(i,n){
    string s;
    cin>>s;
    int cnt = 0;
    int ochar = 0;
    REP(j,s.size()){
      if(s[j]=='0'){
        if(ochar!=0)
          cout<<tb[ochar][cnt%sz[ochar]];
        ochar = 0;
        cnt=0;
      }else{
        if(ochar==(s[j]-'0'))
          cnt++;
        else{
          cnt=0;
          ochar=s[j]-'0';
        }
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;
static const double eps = 1e-10;
bool equals(double a, double b)
{
	return(fabs(a - b) < eps);
}

class Point
{
public:
	double x, y;
	Point(double x = 0, double y = 0) : x(x), y(y){}

	Point operator + (Point p){ return(Point(x + p.x, y + p.y)); }
	Point operator - (Point p){ return(Point(x - p.x, y - p.y)); }
	Point operator * (double a){ return(Point(a * x, a * y)); }
	Point operator / (double a){ return(Point(x / a, y / a)); }

	double abs(){ return(sqrt(norm())); }
	double norm(){ return(x * x + y * y); }

	bool operator < (const Point& p) const
	{
		return(x != p.x ? x < p.x : y < p.y);
	}

	bool operator == (const Point& p) const
	{
		return(fabs(x - p.x) < eps && fabs(y - p.y) < eps);
	}
};
typedef Point Vector;

struct Segment
{
	Point p1, p2;
};
typedef Segment Line;

class Circle
{
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r){}
};

double dot(Vector a, Vector b)
{
	return(a.x * b.x + a.y * b.y);
}

double cross(Vector a, Vector b)
{
	return(a.x * b.y - a.y * b.x);
}

Point project(Segment s, Point p)
{
	Vector base = s.p2 - s.p1;
	double r = dot(p - s.p1, base) / base.norm();
	return(s.p1 + base * r);
}

Point reflect(Segment s, Point p)
{
	return(p + (project(s, p) - p) * 2.0);
}

bool isOrthogonal(Vector a, Vector b)
{
	return(equals(dot(a, b), 0.0));
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2)
{
	return(isOrthogonal(a1 - a2, b1 - b2));
}

bool isOrthogonal(Segment s1, Segment s2)
{
	return(equals(dot(s1.p2 - s2.p1, s2.p2 - s2.p1), 0.0));
}

bool isParallel(Vector a, Vector b)
{
	return(equals(cross(a, b), 0.0));
}

bool isParallel(Point a1, Point a2, Point b1, Point b2)
{
	return(isParallel(a1 - a2, b1 - b2));
}

bool isParallel(Segment s1, Segment s2)
{
	return(equals(cross(s1.p1 - s1.p1, s2.p2 - s2.p1), 0.0));
}

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int q;
	cin >> q;
	for (int i = 0; i < q; ++i)
	{
		Point p[4];
		for (int j = 0; j < 4; ++j)
		{
			cin >> p[j].x >> p[j].y;
		}
		if (isParallel(p[0], p[1], p[2], p[3]))
		{
			cout << "2" << endl;
		}
		else if (isOrthogonal(p[0], p[1], p[2], p[3]))
		{
			cout << "1" << endl;
		}
		else
		{
			cout << "0" << endl;
		}
	}
}

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

Measured memory_bytes: 1228
{-# LANGUAGE BangPatterns, FlexibleContexts #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
-- import Data.Array
import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST
import Data.Char

import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
readInt = fst . fromJust . B.readInt
readInts = map readInt . B.words <$> B.getLine :: IO [Int]
readIntegers = map (fst . fromJust . B.readInteger) . B.words <$> B.getLine :: IO [Integer]
read2dInts = map (map (fst . fromJust . B.readInt) . B.words) . B.lines <$> B.getContents
readVInts = map (fst . fromJust . B.readInt) . B.lines <$> B.getContents
readVTuple = map ((\(a:b:_) -> (readInt a, readInt b)) . B.words) . B.lines <$> B.getContents :: IO [(Int, Int)] 

main :: IO ()
main = do
  (n:q:_) <- map read . words <$> getLine :: IO [Int]
  buff <- readVTuple :: IO [(Int, Int)]
  let (abs, pxs) = splitAt (n-1) buff
  putStrLn . unwords . map show $ solve' n q abs pxs
    
solve' n q abs pxs = elems dfs
  where
    tree = foldl' f (Map.singleton 1 []) abs :: Map.Map Int [Int]
    f t (a, b) = Map.insertWith (++) a [b] $ Map.insertWith (++) b [a] t
    countMap = foldl' g (IntMap.empty) pxs
    g counts (p, x) =  IntMap.insertWith (+) p x counts

    dfs :: UArray Int Int 
    dfs = runSTUArray $ do
      c <- newArray (1, n) 0 :: ST s (STUArray s Int Int)
      let 
        loop current parent point = do
          let p = point + case (IntMap.lookup current countMap) of 
                Nothing -> 0 
                Just v -> v
          writeArray c current p
          forM_ (tree Map.! current) $ \next -> 
            if next == parent then return () else loop next current p

      loop 1 0 0
      return c

Measured memory_bytes: 159612
import sys
input=sys.stdin.readline
n,a,b=map(int,input().split())
v_list=list(map(int,input().split()))
v_list.sort(reverse=True)
x=v_list[a-1]
print(sum(v_list[:a])/a)
import math
if v_list[0]==x:
    count=0
    for i in range(n):
        if v_list[i]==x:
            count+=1
    ans=0
    for i in range(a,min(b,count)+1):
        ans+=math.factorial(count)//(math.factorial(i)*math.factorial(count-i))
    print(ans)
else:
    counta=0
    for i in range(a):
        if v_list[i]==x:
            counta+=1
    count=0
    for i in range(n):
        if v_list[i]==x:
            count+=1
    ans=math.factorial(count)//(math.factorial(counta)*math.factorial(count-counta))
    print(ans)


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;

    for (int i = 1; i <= n; i++)
    {
        string s;
        s = to_string(i);
        int sum = 0;
        rep(j, s.size()) sum += s[j] - '0';
        if (a <= sum && sum <= b)
            ans += i;
    }
    OP(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

ll gcd(ll a,ll b){
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b,a%b);
    }
}

ll lcm(ll x, ll y) {
    return x*y / gcd(x,y);
}

int main(void)
{
    IOS
    ll a,b; cin >> a >> b;
    ll g = gcd(a,b);
    int ans = 1;
    ll g2 = g;
    for (ll i = 2; i <= 1e6 && g2 != 1; i++) {
        if (g2 % i == 0) {
            ans++;
            while(g2 % i == 0) g2 /= i;
        }
    }
    if (g2 != 1) ans++;

    cout << ans << endl;

    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    sort(A.begin(), A.end(), [](int a, int b){
        return abs(a) > abs(b);
    });
    for(int i = 0; i < N - 1; ++i) {
        if(A[i] < 0) {
            A[i] = -A[i];
            A[i + 1] = -A[i + 1];
        }
    }
    cout << accumulate(A.begin(), A.end(), 0LL) << '\n';
    return 0;
}


Measured memory_bytes: 640