akhauriyash/Code-Regression huggingface dataset:
#pragma warning(disable:4996)

#include<iostream>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_map>
#include<fstream>
#include<iomanip>
#include<string>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<sstream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include <assert.h>
#define pb push_back
#define INF 0x3F3F3F3F //int 下较大值
#define inf 0x3F3F3F3F3F3F3F3F  // ll 下较大值 
#define moD 1000000003
#define pii pair<ll,ll>
#define eps 1e-10
#define equals(a,b) (fabs(a-b)<eps)
#define bug puts("bug")
#define re  register
#define fi first
#define se second
typedef  long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll Mod = 998244352;
const int maxn = 2e6 + 10;
const double Inf = 10000.0;
const double PI = acos(-1.0);
using namespace std;


int bitcount(int x) {
    return x == 0 ? 0 : bitcount(x / 2) + (x & 1);
}


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

ll quickPower(ll a, ll b, ll m) {
    ll base = a;
    ll ans = 1ll;
    while (b) {
        if (b & 1) ans = mul(ans, base, m);
        base = mul(base, base, m);
        b >>= 1;
    }
    return ans;
}

ll ksm(ll a, ll b, ll m) {
    ll base = a % m;
    ll ans = 1ll;
    while (b) {
        if (b & 1) ans *= base, ans %= m;
        base *= base, base %= m;
        b >>= 1;
    }
    return ans;
}



ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll Lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int readint() {
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

ll readll() {
    ll x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

ull readull() {
    ull x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

void Put(ll x) {
    if (x < 0) putchar('-'), x *= -1;
    if (x > 9) Put(x / 10);
    putchar(x % 10 + '0');
}

int main() {
    ll a, b, c, d;
    a = readll(), b = readll();
    c = readll(), d = readll();
    ll res1 = a * c;
    ll res2 = max(res1, a * d);
    ll res3 = max(res2, b * c);
    ll res4 = max(res3, b * d);
    cout << res4;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int maxn = 1000005;

void solve() {
	int n;
	cin >> n;
	vector<pair<int,string>>v;
	f(n) {
		string s;
		cin >> s;
		v.pb({s.size(), s});
	}
	sort(all(v));
	ll ans = 0;
	map<ll,int>mp;
	for (auto &i : v) {
		int n = i.F;
		string s = i.S;
		s = " " + s;
		int pre[n + 5] = {};
		for (int i = 1 ; i <= n ; i++) {
			pre[i] = (pre[i - 1] | (1<<(s[i]-'a')));
		}
		ll h = 0;
		for (int i = n ; i > 1 ; i--) {
			if (mp.count(h)) {
				ans += __builtin_popcount(pre[i] & mp[h]);
			}
			h *= 37;
			h += (s[i]);
		}
		mp[h] |= (1<<(s[1]-'a'));
	}
	cout << ans << '\n';
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        solve();
    }
}


Measured memory_bytes: 19496
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, X;
	cin >> n >> X;
	vector<int> x(n);
	rep(i, n) cin >> x[i];
	x.push_back(X);
	sort(all(x));
	int ans = x[1] - x[0];
	for (int i = 2; i <= n; ++i) {
		ans = gcd(ans, x[i] - x[i - 1]);
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string S;
  cin >> S;
  bool bl = false;
  rep(i, 3) {
    if (S[i] == S[i+1]) bl = true;
  }
  puts(bl ? "Bad" : "Good");
  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int n;
    cin >> n;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    vector<int>ans;
    while(!v.empty())
    {
        int temp=v.size();
        int cnt=v.size();
        for(auto it=v.rbegin();it!=v.rend();it++)
        {
            if(*it==cnt)
            {
                ans.push_back(*it);
                auto a=v.begin();
                a=a+cnt-1;
                v.erase(a);
                break;
            }
            cnt--;
        }
        int ttemp=v.size();
        if(temp==ttemp)
        {
            cout<<-1<<endl;
            return 0;
        }
    }
    reverse(ans.begin(),ans.end());
    for(auto c:ans)
        cout<<c<<endl;
}

Measured memory_bytes: 3568
// https://atcoder.jp/contests/abc159/tasks/abc159_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    unordered_map<int, int> mp;
    REP(i, N) {
        int t;
        cin >> t;
        A[i] = t;
        mp[t]++;
    }
    int sum = 0;
    for (auto &x : mp) {
        sum += x.second * (x.second - 1) / 2;
    }
    REP(i, N) {
        int t = mp[A[i]];
        int diff = 0;
        if (t >= 2) {
            int u1 = t * (t - 1) / 2;
            int u2 = (t - 1) * (t - 2) / 2;
            diff = u1 - u2;
        }

        cout << sum - diff << "\n";
    }

    return 0;
}


Measured memory_bytes: 9160
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int n;
  cin >> n;

  if (n < 1000) cout << "ABC" << endl;
  else if (n >=1000) cout << "ABD" << endl;
}


Measured memory_bytes: 3584
from bisect import bisect_left

N,A,c = int(input()),[],[]
for i in range(N):
	A.append(int(input()))
A.reverse()

for x in A:
	p = bisect_left(c, x+1)
	if p == len(c):
		c.append(x)
	else:
		c[p] = x
print(len(c))

Measured memory_bytes: 84876
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast_io std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;
#define trace3(x,y,z) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;
#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(),(v).end()
using namespace std;
///////////////////////////////////////////////////////
bool wayToSort(ll i, ll j) { return i > j; }
#define PI 3.14159265
// sorting vector of pairs
bool sortinrev(const pair<ll,ll> &a, const pair<ll,ll> &b)	{    return (a.first > b.first);	}
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b)	{   return (a.second < b.second);		}	
bool sortbysecdesc(const pair<ll,ll> &a,const pair<ll,ll> &b)	{    return a.second>b.second;	}
/* First number in array a which is greater than x
ll * p = std::upper_bound( a, a+n, x );
ll j = p - a;    // index
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////

int main()
{	
	fast_io;
	int n;	cin>>n;
	ll a[n+10];
	map<ll,int> count;
	map<ll,bool> flag;
	REP(i,n)
	{
		cin>>a[i];
		count[a[i]]++;
		flag[a[i]] = true;
	}
	sort(a,a+n, wayToSort);
	ll ans = 1;
	int cnt = 0;
	REP(i,n-1)
	{	
		if(cnt == 2)	break;
		if(a[i] == a[i+1])
		{
			ans *= a[i];
			i++;
			cnt++;
		}
	}
	if(cnt == 2)	cout<<ans<<endl;
	else	cout<<0<<endl;
	return 0;
	
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  ll a, b, cnt=1, ans=1;
  cin >> a >> b;
  if(b > a)swap(a, b);
  vector<ll> ret;
  for(ll i = 1; i*i <= a; i++){
    if(a % i == 0){
      if(b % i == 0)ret.push_back(i);
      if(i * i != a && b % (a/i) == 0)ret.push_back(a/i);
    }
  }
  sort(all(ret));
  for(ll i = 1; i < ret.size(); i++){
    if(__gcd(cnt, ret.at(i)) == 1) {
      cnt*=ret.at(i);
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 384
from collections import defaultdict, deque

def main():
    N, M = tuple(int(c) for c in input().split(' '))
    H = [0] + [int(c) for c in input().split(' ')]
    path = defaultdict(set)
    for _ in range(M):
        a, b = tuple(int(c) for c in input().split(' '))
        path[a].add(b)
        path[b].add(a)

    def tansaku(dai):
        #print(f'---traversing {dai}')
        #print(f'stack: {stack}, traversed: {traversed}')
        reachable = path[dai]
        #print(f'reachable[{i}]: {reachable}')
        if len(reachable) == 0:
            return 1
        else:
            for j in reachable:
                if H[dai] <= H[j]:
                    return 0
            else:
                return 1 

    cnt = 0
    for dai in range(1, N+1):
        cnt += tansaku(dai)

    print(cnt)

if __name__ == "__main__":
    main()

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

using namespace std;

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

const int MOD = 1e9 + 7;

typedef long long li;

int main()
{
    int n, k;
    cin >> n >> k;
    
    int m = 0;
    int g = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        g = __gcd(g, x);
        m = max(m, x);
    }
    
    if ((g == 0 || k % g == 0) && k <= m)
        cout << "POSSIBLE\n";
    else
        cout << "IMPOSSIBLE\n";
    
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int INTINF = 2147483647;
const int MOD = 1000000007;

int main() {
  int N, K; cin >> N >> K;
  int x[N]; rep(i,N) cin >> x[i];

  int result = 0;
  for(auto i: x) result += min(i, K-i) * 2;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++)
#define reset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define off 250555

string s;

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin>>s;
    int n=s.size();
    For(i,0,n-1) if(s[i]==s[i+1])
    {
        cout<<i+1<<' '<<i+2;return 0;
    }
    For(i,0,n-2) if(s[i]==s[i+2])
    {
        cout<<i+1<<' '<<i+3;return 0;
    }
    cout<<"-1 -1";
}


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

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

	cin >> N;
	ll ans = 0;

	for (int i = 0; i < N; i++)
	{
		if((i+1)%3!=0&&(i+1)%5!=0)ans+=i+1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
#define A 20
Node root;
 
Node treeMinimum(Node x){
 
 
}
 
Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
  }
  else{
    return treeSearch(u->right,k);
  }
}
 
Node treeSuccessor(Node x){
 
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
 
 
}
 
void insert(int j){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = j;
  z->left = NIL;
  z->right = NIL;
 
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
    if(y==NIL){
      root=z;
    }
    else if(z->key<y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
 
 

 
int main(){
  int m, i, x;
  char com[A];
  scanf("%d", &m);
 
  for ( i = 0; i < m; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}
void inorder(Node u){
  if (u->left != NIL){
    inorder(u->left);
  }
  printf(" %d", u->key);
  if (u->right != NIL){
    inorder(u->right);
  }
}
void preorder(Node u){
  printf(" %d",u->key);
  if (u->left != NIL){
    preorder(u->left);
  }
  if (u->right != NIL){
    preorder(u->right);
  }
}
 

Measured memory_bytes: 19364
#include<stdio.h>

int main(void){
  int K = 0,N = 0;
  int a[200000];
  int *p;
  int max = 0,def = 0;
  p = a;

  scanf("%d %d\n",&K,&N );
  scanf("%d",p);
  for(int i = 1;i < N; i++ ){
    scanf(" %d",(p+i) );
    if((*(p + i) - *(p + i -1)) > max){
      max = *(p + i) - *(p + i -1);
    }
  }
  if(((*p - 0) + (K - *(p+N-1))) > max){
    max = (*p - 0) + (K - *(p+N-1));
  }
  def = K - max;
  printf("%d\n",def );
  return 0;
}

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

int main()
{
    int n,m,k;
    cin>>n>>m>>k;

    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i*(m-j)+j*(n-i)==k)
            {
                cout<<"Yes";
                return 0;
            }
        }

    }
    cout<<"No";
    return 0;
}


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

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++)
        cin >> l[i];
    sort(l.begin(), l.end());
    int ans = 0;
    for (int i = 2; i < n; i++) {
        for (int k = 1; k < i; k++) {
            int diff = l[i] - l[k];
            if (l[k-1] <= diff)
                continue;
            int idx = upper_bound(l.begin(), l.end(), diff) - l.begin();
            ans += k - idx;
        }
    }
    cout << ans;
    return 0;
}

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


int gcd(int a, int b) {
    if (b > a) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

template <typename T, typename E>
struct SegmentTree {
private:
    typedef function<T(T, T)> F;
    typedef function<T(T, E)> G;
    int n;
    F merge_func;
    G update_func;
    T identity_item;
    vector<T> nodes;

public:
    SegmentTree(int n_, F merge_func, G update_func, T identity_item, const vector<T>& v=vector<T>()) {
        this->merge_func = merge_func;
        this->update_func = update_func;
        this->identity_item = identity_item;
        nodes_init(n_);
        if (n_ == (int)v.size()) build(n_, v);
    }

    void nodes_init(int n_) {
        n = 1;
        while (n < n_) n *= 2;
        nodes.clear();
        nodes.resize(2 * n - 1, identity_item);
    }

    void build(int n_, const vector<T>& v) {
        for (int i = 0; i < n_; i++) {
            nodes.at(i + n - 1) = v.at(i);
        }
        for (int i = n - 2; i >= 0; i--) {
            nodes.at(i) = merge_func(nodes.at(i * 2 + 1), nodes.at(i * 2 + 2));
        }
    }

    void update(int idx, E value) {
        int node_idx = idx + n - 1;
        nodes.at(node_idx) = update_func(nodes.at(node_idx), value);
        int current_idx = node_idx;
        while (current_idx) {
            current_idx = (current_idx - 1) / 2;
            nodes.at(current_idx) = merge_func(nodes.at(2 * current_idx + 1), nodes.at(2 * current_idx + 2));
        }
    }

    T query(int query_left, int query_right, int cur_idx, int cur_left, int cur_right) {
        if (cur_right <= query_left || query_right <= cur_left) return identity_item;
        if (query_left <= cur_left && cur_right <= query_right) return nodes.at(cur_idx);
        T value_from_left = query(query_left, query_right, 2 * cur_idx + 1, cur_left, (cur_left + cur_right) / 2);
        T value_from_right = query(query_left, query_right, 2 * cur_idx + 2, (cur_left + cur_right) / 2, cur_right);
        return merge_func(value_from_left, value_from_right);
    }

    T query(int query_left, int query_right) {
        return query(query_left, query_right, 0, 0, n);
    }
};


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

    int N;
    cin >> N;
    vector<int> A_list;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        A_list.emplace_back(tmp);
    }
    SegmentTree<int, int> range_gcd(
        N,
        [](int a, int b) {return gcd(a, b);},
        [](int a, int b) {return b;},
        0,
        A_list);

    int max_gcd = range_gcd.query(0, N - 1);
    for (int ignore_idx = 0; ignore_idx < N - 1; ignore_idx++) {
        max_gcd = max(
            max_gcd,
            gcd(range_gcd.query(0, ignore_idx), range_gcd.query(ignore_idx + 1, N))
        );
    }
    cout << max_gcd << "\n";
}


Measured memory_bytes: 1784
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    vector<bool> era(10000000,true);
    for(int i=2;i<=sqrt(10000000);i++){
        if(era[i]){
            for(int j=i*i;j<=10000000;j+=i){
                era[j]=false;
            }
        }
    }
    int n;
    for(;;){
        scanf("%d",&n);
        if(n==0) break;
        for(int i=n;i>=13;i--){
            if(era[i]&&era[i-2]&&era[i-6]&&era[i-8]){
                printf("%d\n",i);
                break;
            }
        }
    }
}

Measured memory_bytes: 2020
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
	//return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	ll g = gcd(a, b);
	return a / g * b; // Be careful not to overflow
	//return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
//vector<vector<int>> data(3, vector<int>(4));

int main() {
	ll mod = 1e9 + 7;
	ll ans = 1;
	ll N;cin >> N;
	vector<ll>A(N + 1);
	vector<ll>sum(N + 1);
	A[0] = 9999999999999;
	for (ll i = 1;i <= N;i++)cin >> A[i];
	sort(all(A));
	for (ll i = 0;i < N;i++) {
		sum[A[i]]++;
	}
	if (N % 2 != 0) {
		for (ll i = 0;i < N;i += 2) {
			if (sum[i] <= 2)ans *= sum[i];
			else ans *= 0;
			ans %= mod;
		}
		if (sum[0] >= 2)ans *= 0;
	}
	if (N % 2 == 0) {
		for (ll i = 1;i < N;i += 2) {
			if (sum[0] != 0)ans *= 0;
			if (sum[i] <= 2)ans *= sum[i];
			else ans *= 0;
			ans %= mod;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>  
#include<cstdio>  
#include<fstream>  
#include<iomanip>
#include<algorithm>  
#include<cmath>  
#include<deque>  
#include<vector>  
#include<assert.h>
#include<bitset>
#include<queue>  
#include<string>  
#include<cstring>  
#include<map>  
#include<stack>  
#include<set>
#include<functional>
#define pii pair<int, int>
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define eps 0.00000001
#define mst(a,i) memset(a,i,sizeof(a))
#define all(n) n.begin(),n.end()
#define lson(x) ((x<<1))  
#define rson(x) ((x<<1)|1) 
#define inf 0x3f3f3f3f
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int r, c;
class T {
public:
    int mode, v, ope;
    bool operator<(const T&a)
    {
        return v < a.v;
    }
};
int getnum(int x, int y)
{
    if (y == 0)
        return x;
    else if (x == 0)
        return c+r + r + c + c - y;
    else if (x == c)
        return x + y;
    else if (y == r)
        return r + c + c - x;
    else return -1;
}

vector<T>a;
stack<int>sve;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int i, j, k, m, n;
    int x1, x2, y1, y2;
    cin >> r >> c >> n;
    int tempa, tempb;
    for (int i = 1; i <= n; ++i)
    {
        cin >> y1 >> x1 >> y2 >> x2;
        tempa = getnum(x1, y1);
        tempb = getnum(x2, y2);
        if (tempb == -1 || tempa == -1)continue;
        if (tempb < tempa)swap(tempa, tempb);
        a.push_back({ 1,tempa,tempb });
        a.push_back({ 2,tempb,tempa });
    }
    sort(all(a));
    for (int i = 0; i < a.size(); ++i)
    {
        if (a[i].mode == 1)
            sve.push(a[i].ope);
        else if (sve.top() == a[i].v)
                sve.pop();
        else
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 4980
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
        
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
        cout << *it << " = " << a <<" , ";
        err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;string str;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    const string yes="YES\n";
    const string no="NO\n";
    int main()
    {
        boost vars
        //freopen("input.txt","r",stdin);
        //freopen("input.txt","w",stdout);
        cin>>a>>b>>c;
        if(b*c>=a)cout<<"Yes";
        else cout<<"No";
    }

Measured memory_bytes: 3636
#include <iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<ctime>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<tuple>
#include<cassert>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<iomanip>
#include<climits>
#include<typeinfo>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
double pi = 3.141592653589793238;
using ll = long long;
using namespace std;

ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpcombination[10000][10000];

ll modi = 1000000007;
ll combination(ll n, ll r) {
	if (n == r) { return dpcombination[n][n] = 1; }
	else if (r == 0) { return dpcombination[n][0] = 1; }
	else if (r == 1) { return dpcombination[n][1] = n; }
	else if (dpcombination[n][r]) { return dpcombination[n][r]; }
	else { return dpcombination[n][r] = combination(n - 1, r - 1) % modi + combination(n - 1, r) % modi; }
}

void clockman(int time1) {

	cout << 1.0*(clock() - time1) / CLOCKS_PER_SEC << endl;
	return;
}
//cout << fixed << setprecision(10)

void printVec(std::vector<int> &vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

int main() {

	char s;
	cin >> s;
	if (s <= 'Z'&&s >= 'A')cout << "A" << endl;
	else cout << "a" << endl;
	
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n,cnt;
int main()
{
	cin >> n;
	for(int i = 1;i <= n - 1;i++)
		for(int j = 1;j <= n - 1;j++)
		{
			if(i * j < n) cnt++;
			if(i * j > n) break;
		}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3584
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  def gcd(a,b):
    if a < b:
      a, b = b, a
    while b > 0:
      a, b = b, a % b
    return a

  
  def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  

  a,b = map(int, input().split())

  max_gcd = gcd(a,b)

  ans = set(prime_factorize(max_gcd))

  print(len(ans)+1)

  
if __name__ == '__main__':
  solve()

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

int main() {
  int N, X;
  cin >> N >> X;
  
  vector<int> L(N + 1);
  L.at(0) = 0;
  for (int i = 1; i < N + 1; i++) {
    cin >> L.at(i);
  }
  
  int count = 0;
  int sumD = 0;
  
  for (int j = 1; j < N + 1; j++) {
    count++;
    sumD += L.at(j);
    if (sumD > X) {
      cout << count << endl;
      return 0;
    }
  }
  count++;
  cout << count << endl;
}

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

int main(){
  string S,T;
  cin >> S >> T;
  if (S.size() == T.size() - 1){
    for (int i=0; i<S.size(); i++){
      if (S.at(i) != T.at(i)){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
#define _cTime (chrono::system_clock::now())
#define progress (chrono::duration_cast<chrono::milliseconds>(_cTime-_sTime).count())
#define reset _sTime=_cTime
auto reset;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll an,bn,q,x;
	cin>>an>>bn>>q;
	vl a(an),b(bn);
	rep(i,an)cin>>a[i];
	rep(i,bn)cin>>b[i];
	rep(i,q){
		cin>>x;
		vl s,t;
		auto sit=lower_bound(all(a),x);
		if(sit==a.end())sit--;
		s.push_back(*sit);
		if(sit!=a.begin()){
			sit--;
			s.push_back(*sit);
		}
		auto tit=lower_bound(all(b),x);
		if(tit==b.end())tit--;
		t.push_back(*tit);
		if(tit!=b.begin()){
			tit--;
			t.push_back(*tit);
		}
		ll ans=LINF;
		for(auto p:s){
			for(auto q:t){
				ll tmp=0;
				if((p-x)*(q-x)<0){
					tmp=abs(p-q);
					tmp+=min(abs(p-x),abs(q-x));
				}
				else{
					tmp=max(abs(p-x),abs(q-x));
				}
				chmin(ans,tmp);
			}
		}
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		insertionSort(A);

	}

	private static void insertionSort(int[] A) {
		for (int i = 0; i < A.length; i++ ) {
			int v = A[i];
			int j = i - 1;

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

			}

			A[j+1] = v;

			for (int k = 0; k < A.length; k++ ) {
				System.out.print(A[k]);
				if(k < A.length -1) {
					System.out.print(" ");
				}

			}
			System.out.println();


		}

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

}



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

int main() {
  int n, m;
  cin >> n >> m;
  cout << n * (n - 1) / 2 + m*(m -1 )/2 << endl;
}



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

using namespace std;
using ll = long long int;

int main() {
    ll A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
icase=0
if icase==0:
    n=int(input())
    if n<2:
        print(1)
    elif n<4:
        print(2)
    elif n<8:
        print(4)
    elif n<16:
        print(8)
    elif n<32:
        print(16)
    elif n<64:
        print(32)
    else:
        print(64)
            
    

Measured memory_bytes: 2940
import re  # 正規表現, findall('正規表現', 文字列), search('正規表現', 文字列)
import sys # プログラム終了：sys.exit()
# sys.setrecursionlimit(10**6) # 再帰呼び出しの上限を上げる

def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))
# 文字列のまま受け取りたいときはinput()

n, a, b = s_input()

i_sum = 0
for i in range(n + 1):
    str_i = str(i)
    j_sum = 0
    for j in str_i:
        j_sum += int(j)

    if j_sum >= a and j_sum <= b:
        i_sum += i

print(i_sum)

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

void solve(int N, const vector< int >& x, int L) {
	vector< vector< int > > par_L(N, vector< int >(25, -1));
	vector< vector< int > > par_R(N, vector< int >(25, -1));
	
	for_(i,0,N) {
		// par L
		int lb = -1, ub = i-1;
		while (ub - lb > 1) {
			int med = (ub + lb) / 2;
			if (x[i] - x[med] > L) lb = med;
			else ub = med;
		}
		par_L[i][0] = ub;
		
		// par R
		lb = i + 1; ub = N;
		while (ub - lb > 1) {
			int med = (ub + lb) / 2;
			if (x[med] - x[i] > L) ub = med;
			else lb = med;
		}
		par_R[i][0] = (lb == N ? -1 : lb);
	}
	
	for_(k,1,25) for_(i,0,N) {
		int pL = par_L[i][k - 1];
		if (pL != -1) par_L[i][k] = par_L[pL][k - 1];
		int pR = par_R[i][k - 1];
		if (pR != -1) par_R[i][k] = par_R[pR][k - 1];
	}
	
	int Q;
	cin >> Q;
	
	for_(q,0,Q) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		
		if (a < b) {
			int day = 0, cur = a, k = 24;
			while (cur < b) {
				while (k > 0 && (par_R[cur][k] == -1 || par_R[cur][k] > b)) --k;
				day += (1 << k);
				cur = par_R[cur][k];
			}
			printf("%d\n", day);
		} else {
			int day = 0, cur = a, k = 24;
			while (cur > b) {
				while (k > 0 && (par_L[cur][k] == -1 || par_L[cur][k] < b)) --k;
				day += (1 << k);
				cur = par_L[cur][k];
			}
			printf("%d\n", day);			
		}
	}
}

int main() {
	int N;
	cin >> N;
	
	vector< int > x(N);
	for_(i,0,N) cin >> x[i];
	
	int L;
	cin >> L;
	
	solve(N, x, L);
}

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

int main()
{
    ll n;
    cin >> n;

    // 素因数分解
    ll limit = n;
    map<ll, int> mp;
    for (ll i = 2; i * i < n; i++)
    {
        ll x = 0;
        // 割り切れるなら
        while (n % i == 0)
        {
            n /= i;
            x++;
        }
        mp[i] = x;
    }
    if (n != 1)
    {
        mp[n]++;
    }

    int ans = 0;
    for (auto myPair : mp)
    {
        int count = myPair.second;
        int iter = 1;
        while (count >= iter)
        {
            count -= iter;
            iter++;
            ans++;
        }
    }

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

Measured memory_bytes: 66124
#include <stdio.h>

int main(void)
{
	int A, B;
	
	scanf("%d %d", &A, &B);
	
	if(A<=8 && B<=8){
		if(A+B<=16){
			printf("Yay!\n");
		}else{
			printf(":(\n");
		}
	}else{
		printf(":(\n");
	}
	
	return 0;
}


Measured memory_bytes: 128
fn func(input_str: &str) -> u32 {
    let mut iter = input_str.split_whitespace();
    let a: u32 = iter.next().unwrap().parse().unwrap();
    let b: u32 = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();
    let c = std::cmp::min(a, b);
    (1..c+1).rev().filter(|x| a % x + b % x == 0).nth(k-1).unwrap()
}

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    println!("{}", func(&buf[..]));
}

Measured memory_bytes: 4352
class Node:
  def __init__(self, v):
    self.v = v
    self.p = None
    self.n = None
  
  def delete(self):
    if self.p:
      self.p.n = self.n
    if self.n:
      self.n.p = self.p

N = int(input())
pp = list(map(int, input().split()))
nn = dict()
prev = None
for i, p in enumerate(pp):
  n = Node(i)
  if prev:
    prev.n = n
    n.p = prev
  nn[p] = n
  prev = n
s = 0
for x in range(1, N):
  c = nn[x]
  ci = c.v
  pi = c.p.v if c.p else -1
  ni = c.n.v if c.n else N
  if c.p:
    ppi = c.p.p.v if c.p.p else -1
    s += x * (pi - ppi) * (ni - ci)
  if c.n:
    nni = c.n.n.v if c.n.n else N
    s += x * (ci - pi) * (nni - ni)
  c.delete()
print(s)

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

const double pi = 3.14159265358979323846;

int main(){
  double r;
  cin >> r;
  cout << fixed << setprecision(6);
  cout << pi*r*r << " " << 2*pi*r << endl;

  return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

int n;
string l;
v2<int> dp;

const int MOD = 1e9+7;

int f(int index, bool edge){
    if(index==n) return 1;
    if(dp[index][edge] != -1) return dp[index][edge];

    if(edge){
        if(l[index]=='0'){
            dp[index][edge] = f(index+1, true);
        }
        else{
            dp[index][edge] = (2LL*f(index+1, true) + f(index+1, false))%MOD;
        }
    }
    else{
        dp[index][edge] = (3LL*f(index+1, false))%MOD;
    }

    return dp[index][edge];
}

void solve(){
    cin >> l;
    n = l.length();
    dp = fill(n, 2, -1);
    int ans = 0;
    if(l[0]=='0'){
        ans = f(1, true);
    }
    else{
        ans = (2LL*f(1, true) + f(1, false))%MOD;
    }
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 13504
#![allow(unused_imports)]
#![allow(dead_code)]

use std::thread;
use std::io::{ self, Read };
use std::iter::Iterator;
use std::cmp::*;
use std::collections::*;
use std::str;

#[derive(Default)]
struct Input {
    buf: Vec<String>
}

impl Input {
    fn new() -> Input {
        Input { buf: Vec::new() }
    }

    fn next(&mut self) -> String {
        while self.buf.is_empty() {
            let mut s = String::new();
            let _res = io::stdin().read_line(&mut s);
            self.buf = s.split_whitespace().map(|s| s.to_owned()).collect::<Vec<_>>();
            self.buf.reverse();
        }
        self.buf.pop().unwrap()
    }

    fn next_int(&mut self) -> i64 {
        self.next().parse::<i64>().unwrap()
    }

    fn next_int_n(&mut self, n: usize) -> Vec<i64> {
        let mut v = Vec::<i64>::new();
        for _ in 0..n { v.push(self.next_int()); }
        v
    }
}

fn run() {
    let mut input = Input::new();
    let a = input.next_int();
    let b = input.next_int();
    println!("{}", if a * b % 2 == 0 { "Even" } else { "Odd" });
}

fn main() {
    let _ = thread::Builder::new()
        .stack_size(10 * 1024 * 1024)
        .spawn(run).unwrap()
        .join();
}

Measured memory_bytes: 8572
n,a,b=map(int,input().split())
H=[0]*n
for i in range(n):
  H[i]=int(input())
ng=-1
ok=10**9+5
while ok-ng>1:
  mid=(ng+ok)//2
  c=0
  for i in range(n):
    c=c+(max(0,H[i]-b*mid+a-b-1)//(a-b))
  if c>mid:
    ng=mid
  else:
    ok=mid
print(ok)

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

#define int long long
#define F first
#define S second
#define pb push_back
#define pii pair <int,int>

using namespace std;

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int x=__gcd(n,360LL);
    cout<<360/x;
    return 0;
}


Measured memory_bytes: 3608
a,b,c=map(int,input().split())
if a==b and b==c:
    if a%2==0:
        print(-1)
    else:
        print(0)
    exit()

l=[a,b,c]
ans=0
for i in range(30):
    if l[0]%2!=0 or l[1]%2!=0 or l[2]%2!=0:
        break
    a=(l[1]+l[2])//2
    b=(l[0]+l[2])//2
    c=(l[0]+l[1])//2
    ans+=1
    l=[a,b,c]
print(ans)


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

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

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

  int a, b;
  cin >> a >> b;

  if (a % 2 == 0 || b % 2 == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
S = str(input())
if int(S[:2]) > 12:
    if 0 < int(S[2:]) < 13:
        print('YYMM')
    else:
        print('NA')
elif int(S[2:]) > 12:
    if 0 < int(S[:2]) < 13:
        print('MMYY')
    else:
        print('NA')
elif 0 < int(S[:2]) <= 12:
    if 0 < int(S[2:]) <= 12:
        print('AMBIGUOUS')
    elif int(S[2:]) == 0:
        print('MMYY')
elif 0 < int(S[2:]) <= 12:
    print('YYMM')
else:
    print("NA")

Measured memory_bytes: 38384
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (998244353)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
ll inv[300003],mult[300003],invmult[300003],a[300003],coun[300003];
ll gcd(ll a,ll b){
	while(b!=0){		
		a=a%b;
		swap(a,b);
	}
	return a;
}

ll extend_gcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x=1;
		y=0;
		return a;
	}
	ll x1,y1;
	ll ans =extend_gcd(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;

	return ans;
}
ll combination(ll n,ll r){
	if(r==0)
		return 1;
	if(n<r)
		return 0;
	ll ans=1;
	ans*=mult[n];
	ans%=mod;
	ans*=invmult[r];
	ans%=mod;
	ans*=invmult[n-r];
	ans%=mod;
	return ans;
}

ll initcombi(){
	int i;
	f(i,1,300001){
		ll x,y;
		ll val=extend_gcd(mod,i,x,y);
		if(y>0)
			inv[i]=y%mod;
		else{
				inv[i]=(y+mod)%mod;
		}
	}
	mult[0]=1;
	f(i,1,300001){
		mult[i]=mult[i-1]*i;
		mult[i]%=mod;
	}
	invmult[0]=1;
	f(i,1,300001){
		invmult[i]=invmult[i-1]*inv[i];
		invmult[i]%=mod;
	}
	return 0;
}
// do initcombi(); 

int main(){
	//std::ios::sync_with_stdio(false);
	ll n,a2,b,k,x,y,val,res=0,x1,y1,x2,y2,k1,a1,b1,j,i;
	//cin>>n>>a2>>b>>k;
	scanf("%lld%lld%lld%lld",&n,&a2,&b,&k);
	val=gcd(a2,b);
	if(k%val){
		printf("0\n");
		return 0;
	}
	if(k==0){
		printf("1\n");
		return 0;
	}
	initcombi();
	rep(i,n+1){
		j=(k-(i*a2));
		//cout<<i<<" "<<j<<endl;
		if(j>=0&&j%b==0&&j/b<=n&&j/b>=0){
			val=combination(n,i);
			val*=combination(n,j/b);
			val%=mod;
		//	cout<<"hi"<<" "<<val<<endl;
			res+=val;
			res%=mod;
		}
	}
	cout<<res<<endl;
} 
	

Measured memory_bytes: 7936
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
 
int main(){
  int n;
 
  cin >> n;
  int a[n];
  for(int i = 0 ; i < n ; i++){
    cin >> a[i];
  }
 
  ll dp[n];
  fill(dp,dp+n,INF);
 
  for(int i = 0 ; i < n ; i++){
    *lower_bound(dp,dp+n,a[i]) = a[i];
  }
  cout << lower_bound(dp,dp+n,INF) - dp << endl;
 
  return 0;
}

Measured memory_bytes: 2332
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    n , m = map(int , input().split())
    if n % 2 == 0:
        n -= 1
    k = (n + 1) // 2
    j = 1

    while j < k and m > 0:
        print(j , k)
        j += 1
        k -= 1
        m -= 1

    j = (n + 1) // 2 + 1
    k = n

    while j < k and m > 0:
        if k <= n:
            print(j , k)
            m -= 1
        j += 1
        k -= 1
    
    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 9268
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,ara[85],d[85],sum=1000,c=0,count=0;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>ara[i];
    sum=1000;
    for(i=0;i<n;i++)
    {
        if(i==0)
        {
            d[count]=ara[i];
            count++;
        }
        else if(ara[i]!=ara[i-1])
        {
            d[count]=ara[i];
            count++;
        }
    }
    for(i=0;i<count;i++)
    {
        if(i==0)
        {
            if(d[i]<d[i+1])
            {
                c=c+sum/d[i];
                sum=sum%d[i];
            }
        }
        else if(i==count-1)
        {
            if(c>0)
            {
                sum=sum+c*d[i];
                c=0;
            }
        }
        else
        {
            if(d[i]<d[i-1] && d[i]<d[i+1])
            {
                c=c+sum/d[i];
                sum=sum%d[i];
            }
            else if(d[i]>d[i-1] && d[i]>d[i+1])
            {
                if(c>0)
                {
                    sum=sum+c*d[i];
                    c=0;
                }
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  while(true) {
    c -= b;
    if(c <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    a -= d;
    if(a <= 0) {
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3640