akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;   // 宣言時ポインタにはNULL(0x0)が入っているため, 木の根が設定されていなければroot == NILとなる.

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    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;
        }
    }
}

Node * find(Node *u, int k) {
    while (u != NIL && k != u->key) {
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void deleteNode(int k) {
    Node *x;
    Node *y;
    Node *z = find(root, k);
    if (z->left == NIL && z->right == NIL) {
        if (z->parent->left == z) z->parent->left = NIL;
        else z->parent->right = NIL;
        free(z);
    } else if (z->left != NIL && z->right == NIL) {
        if (z->parent->left == z) z->parent->left = z->left;
        else z->parent->right = z->left;
        z->left->parent = z->parent;
        free(z);
    } else if (z->left == NIL && z->right != NIL) {
        if (z->parent->left == z) z->parent->left = z->right;
        else z->parent->right = z->right;
        z->right->parent = z->parent;
        free(z);
    } else {
        y = z->right;
        while (y->left != NIL) y = y->left;
        x = y->right;
        z->key = y->key;
        if (y->parent->left == y) y->parent->left = x;
        else y->parent->right = x;
        free(y);
    }
}

void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u) {
    if (u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main() {
    int n, i, x;
    string com;

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        cin >> com;
        if (com == "insert") {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        } else if (com == "find") {
            scanf("%d", &x);
            Node *t = find(root, x);
            if (t != NIL) printf("yes\n");
            else printf("no\n");
        } else {
            scanf("%d", &x);
            deleteNode(x);
        }
    }

    return 0;
}


Measured memory_bytes: 22004
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>

#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define mod %1000000007
#define ld long double
bool less_vectors(const vector<int>& a,const vector<int>& b) 
{
  return a.size() > b.size();
}
class dc
{
    public:
bool operator()(pair<int,ll> p1,pair<int,ll>  p2)
{
    return p1.ss>p2.ss;
}

};
class comp
{
    public:
bool operator()(pair<int,pair<ll,ll> > p1,pair<int,pair<ll,ll> > p2)
{
    if(p1.ss.ff!=p2.ss.ff)
     return p1.ss.ff>p2.ss.ff;
     else
          return p1.ss.ss>p2.ss.ss;
}

};
int gcd(int a,int b)
{
if(a%b==0)
     return b;
     else
          return gcd(b,a%b);
}
ll fastexpo(ll a,ll b)
{
  
      ll res=1;
      while(b>0)
      {
        if(b%2==1)
          res=((res)mod*(a)mod)mod;
        a=((a)mod*(a)mod)mod;
        b/=2;
      }
      return res;
}
ll fastexpom(ll a,ll b,ll m)
{
  ll res=1;
      while(b>0)
      {
        if(b%2==1)
          res=(((res)%m)*((a)%m))%m;
        a=(((a)%m)*((a)%m))%m;
        b/=2;
      }
      return res;
}
ll modinv(ll a, ll m=1000000007)
{
  return fastexpom(a,m-2,m);
}
bool comparator(pair<int,int> p1,pair<int,int> p2)
{
  if(p1.ff!=p2.ff)
  {
    return p1.ff<p2.ff;
  }
  else
    return p1.ss<p2.ss;
}
int main()
{
     IOS;
   /*  #ifndef ONLINE_JUDGE
     freopen("int.txt","r",stdin);
     freopen("out.txt","w",stdout);
     #endif*/
     int n;
     cin>>n;
     ll k=1;
     for(int i=0;i<n;i++)
      k=k*3;
    vi v(n);
    for(int i=0;i<n;i++)
    {
      cin>>v[i];
    }
    ll kk=1;
    for(int i=0;i<n;i++)
    {
      if(v[i]%2==0)
        kk*=2;
      else
        kk*=1;
    }
    cout<<k-kk;


     return 0;
} 

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

a = []
b = []

for i in range(n):
  x, y = map(int, input().split())
  a.append(x)
  b.append(y)

max_a = max(a)

ans = 0
for x in reversed(sorted(filter(lambda x: x >= max_a, b))):
  h -= x
  ans += 1
  if h <= 0: break

ans += max(0, (h + max_a - 1) // max_a)
print(ans)



Measured memory_bytes: 65880
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(pair<LL, LL>& a, pair<LL, LL>& b) {
	if (a.first == b.first) {
		return a.second<b.second;
	}
	return a.first < b.first;
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	LL N, W;
	cin >> N >> W;
	vector<LL> ans(W + 1, 0);

	//v,w
	vector<pair<LL, LL>>  nimotu(N);

	REP(i, N) {
		LL a, b;
		cin >> a >> b;
		nimotu[i] = make_pair(a, b);
	}

	FOR(i,1, W + 1) {
		ans[i] = ans[i - 1];
		REP(j, N) {
			if (i >= nimotu[j].second) {
				if (nimotu[j].first +ans[i- nimotu[j].second]> ans[i]) {
					ans[i] = nimotu[j].first + ans[i - nimotu[j].second];
				}
			}
		}
	}

	cout << ans[W] << endl;
}

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

using namespace std;
long long dp[305][305][305],l,r,x,n,m,mod;
vector<pair<int,int> > a[305];
long long dq(int i,int v1,int v2,int v3)
{
    if (dp[v1][v2][v3]!=-1) return dp[v1][v2][v3];
    bool kt=true;
    int l,mau;
    for (int j=0;j<a[i-1].size();++j)
    {
        l=a[i-1][j].first;
        mau=a[i-1][j].second;
        if (v1>=l) mau--;
        if (v2>=l) mau--;
        if (v3>=l) mau--;
        if (mau!=0) {kt=false;break;}
    }
    if (!kt) return dp[v1][v2][v3]=0;
    if (i>n) return 1;

    long long k=(dq(i+1,i,v2,v3)+dq(i+1,v1,i,v3)+dq(i+1,v1,v2,i))%mod;
    return dp[v1][v2][v3]=k;

}
int main()
{
   
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>m;mod=1000000007;
    for (int i=1;i<=m;++i)
    {
        cin>>l>>r>>x;
        a[r].push_back({l,x});
    }
    memset(dp,-1,sizeof(dp));
    cout<<dq(1,0,0,0);

    return 0;
}


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

int main() {
  int n,k,q;
  cin>>n>>k>>q;
  vector<int> a(n,k-q);
  for(int i=0;i<q;i++){
    int x;
    cin>>x;
    x--;
    a[x]++;
  }
  for(int i=0;i<n;i++){
    if(a[i]>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
int n,m,w;
int a[500005];
int temp[500005];
bool check(int cm)
{
	for(int i=1;i<=2*n-1;i++)
	{
		temp[i]=0;
		if(a[i]>cm)
		{
			temp[i]=1;
		}
	}
	for(int i=0;i<n;i++)
	{
		if(temp[n+i]==temp[n+i+1])
		{
			return temp[n+i];
		}
		else if(temp[n-i]==temp[n-i-1])
		{
			return temp[n-i];
		}
	}
	if(n%2==1)
	{
		return temp[n];
	}
	else
	{
		return 1-temp[n];
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;i++)
	{
		scanf("%d",&a[i]);
	}
	int l=1,r=2*n-1;
	while(l<r)
	{
		int mid=(l+r)/2;
		if(check(mid)) l=mid+1;
		else r=mid;
	}
	printf("%d",l);
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>

using namespace std;
string S;

int main(void)
{
	cin >> S;
	
	int i;
	for(i = S.size()/2-1; i >= 1; i--){
		if(S.substr(0, i) == S.substr(i, i)) break;
	}
	
	cout << i * 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#!python3

from time import perf_counter
limit = 1.91
tick = perf_counter()

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from random import randrange

def resolve():
    G = 26
    it = map(int, sys.stdin.read().split())
    D = next(it)
    C = [next(it) for i in range(G)]
    S = [[next(it) for i in range(G)] for i in range(D)]
    T = [0] * D
    L = [-1] * 26

    U = 7
    def calc(i, j):
        score = S[i][j]
        for k in range(G):
            u = k - L[k]
            score -= C[k] * (u + u + U) * U // 2
        score += C[k] * U * (i-L[j])
        return score

    def fullscore():
        score = 0
        last = [-1] * G
        rate = [0] * G
        for i, ti in enumerate(T):
            score += S[i][ti]
            x = i - last[ti]
            rate[ti] += x * (x-1) // 2
            last[ti] = i

        for i, (l, r) in enumerate(zip(last, rate)):
            x = D - l
            x = x * (x-1) // 2
            score -= C[i] * (r + x)

        return score

    for di in range(D):
        i, score = 0, calc(di, 0)
        for qi in range(1, G):
            x = calc(di, qi)
            if x > score:
                i, score = qi, x
        L[i] = di
        T[di] = i

    t = num = 0
    #s0 = fullscore()
    back_t = dict()
    #from collections import defaultdict; CC = defaultdict(int); CC2 = defaultdict(int)
    while t < limit:
        ab = randrange(0, 100)
        if ab > 50:
            di, qi = randrange(0, D), randrange(0, G)

            if not di in back_t:
                back_t[di] = T[di]
            T[di] = qi
        else:
            di = randrange(0, D-1)
            dj = randrange(di+1, D)

            for i in (di, dj):
                if not i in back_t:
                    back_t[i] = T[i]

            T[di], T[dj] = T[dj], T[di]

        sc = fullscore()
        t = perf_counter() - tick
        rate = t / limit
        if sc > score:
            score = sc
            back_t = dict()

            #CC[num] += 1
            #num = 0
        elif rate * score > sc:
            for k, v in back_t.items():
                T[k] = v
            #CC2[num] += 1
            back_t = dict()
            #num = 0
        else:
            #num += 1
            pass


    for k, v in back_t.items():
        T[k] = v

    print(*(i+1 for i in T), sep="\n")
    #print(s0, score, fullscore());print(*CC.items());print(*CC2.items())

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 94928
#include <algorithm>
#include <iostream>
using namespace std;
using ll = long long;
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
const ll MOD = 1000000007;
pair<int, int> a[10], b[10];
int main() {
	int a, b;
	cin >> a >> b;
	a = a * 3 + b;
	cout << a / 2 << endl;
	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (auto&& e : h) cin >> e;
  h[0]--;
  string ans = "Yes";
  for (int i = 1; i < n; i++) {
    if (h[i - 1] == h[i]) continue;
    if (h[i - 1] < h[i]) {
      h[i]--;
      continue;
    } else {
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
//ritik_patel05

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#include <bits/stdc++.h>
using namespace std;

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
// const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&

void solve(){
    int x, n;
    cin >> x >> n;
    set<int> s;
    for(int i = 0, X; i < n; ++i){
        cin >> X; s.insert(X);
    }
    int mn = INT_MAX;
    int ans = 205;
    for(int num = -200; num <= 200; ++num){
        if(!s.count(num)){
            if(abs(num - x) < mn){
                mn = abs(num - x);
                ans = num;
            }
        }
    }
    cout << ans << '\n';
}


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        // brute();
        solve();
    }
    return 0;
}

/*
Sample inp
*/

Measured memory_bytes: 3676
#include<cstdio>
int main(){
	int d,n,t=1;
	scanf("%d%d",&d,&n);
	while(1){
		int z=0;
		for(int x=t; x%100==0; x/=100)
			z++;
		if(z == d){
			--n;
			if(n==0)break;
		}
		t++;
	}
	printf("%d\n",t);
	return 0;
}


Measured memory_bytes: 128
/**
 *      purpose : ABC 115 A
 *      author  : kyomukyomupurin
 *      created : 
**/

#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(__null);
    
    int d; cin >> d;
    if (d == 25) print("Christmas");
    else if (d == 24) print("Christmas Eve");
    else if (d == 23) print("Christmas Eve Eve");
    else print("Christmas Eve Eve Eve");
    
    return 0;
}

Measured memory_bytes: 256
let cnt = ref 0
let (g : int list ref) = ref []

let insertion_sort (a : int array) n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j+g) <- v
    else begin
      a.(j+g) <- a.(j);
      incr cnt;
      insert (j - g) v
    end in
  let rec doit i =
    if i < n then begin
      insert (i - g) a.(i);
      doit (i + 1)
    end in
  doit g

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  g := generate_g n;
  List.iter (fun g -> insertion_sort a n g) !g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  shell_sort a n;
  print_int (List.length !g); print_newline ();
  List.iteri (fun i n -> if i <> 0 then print_string " "; print_int n) !g;
  print_newline ();
  print_int !cnt; print_newline ();
  Array.iter (fun n -> print_int n; print_newline ()) a

Measured memory_bytes: 12476
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
 
int main(void){
    int N, *a, i, j, dif;
    unsigned long sum, min=ULONG_MAX;
    scanf("%d", &N);
    a = (int *)malloc(N*sizeof(int));
    for(i = 0; i < N; i++){
        scanf("%d", a+i);
    }
    for(i = (-100); i <=100 ; i++){
        sum = 0;
        for(j = 0; j < N; j++){
            dif = a[j]-i;
            sum += (unsigned long)(dif*dif);
        }
        if(min > sum) min = sum;
    }
    printf("%lu\n", min);
    free(a);
    return 0;
}

Measured memory_bytes: 128
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        r: usize,
    }
    
    let ans = match r {
        0 ..=1199 => "ABC",
        1200..=2799 => "ARC",
        _ => "AGC" 
    };

    println!("{}", ans)
}


Measured memory_bytes: 2100
#include <stdio.h>
int main(void){
    int H ,W;
    int i, j;
    while(1){scanf("%d %d" ,&H ,&W);
    if(H == 0 && W == 0) break;
    for ( i = 0; i < H; i++ ){
        for ( j = 0; j < W; j++ ){
            if(j==0||j==W-1||i==0||i==H-1){
                printf("#");
                
            }
            else
            {
                printf(".");
                
            }
            
        }
        printf("\n");
        
    }
    puts("");
        
    }
    return 0;
    
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int w, h, n; cin >> w >> h >> n;
	int p = 0, q = w, r = 0, s = h;
	for( int i = 0; i < n; ++i ){
		int x, y, a; cin >> x >> y >> a;
		if( a == 1 ){
			p = max(p, x);
		} else if( a == 2 ){
			q = min(q, x);
		} else if( a == 3 ){
			r = max(r, y);
		} else {
			s = min(s, y);
		}
	}
	if( p > q || r > s ){
		cout << 0 << endl;
	} else {
		cout << (p-q)*(r-s) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(12); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> S(1 << N);
    rep(i, 1 << N) cin >> S[i];

    sort(all(S), greater<int>());

    vector<priority_queue<int, vector<int>>> h_pr(N);
    h_pr[0].push(S[0]);

    bool ans = true;
    rep(i, 1, 1 << N) {
        bool ok = false;

        for (int h = 0; h < N; ++h) {
            if (h_pr[h].empty() || S[i] >= h_pr[h].top()) continue;
            
            if (h != N - 1) {
                h_pr[h + 1].push(h_pr[h].top());
                h_pr[h + 1].push(S[i]);
                h_pr[h].pop();
            }
            else {
                h_pr[h].pop();
            }

            ok = true;
            break;
        }

        if (!ok) {
            ans = false;
            break;
        }
    }

    write(ans ? "Yes" : "No");
}

Measured memory_bytes: 2492
#include <iostream>
#include <fstream>
#include <queue>
//#define LOCAL
using namespace std;
typedef long long ll;
const int mx=1e3+10;
queue<ll>que[mx];
int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll n, q;
cin>>n>>q;
for(ll i=1;i<=q;i++){
    ll qn, sub, value;
 //   int sub, que, value;
    cin>>qn;
    switch(qn){
        case 0: cin>>sub>>value;
                que[sub].push(value);
                break;
        case 1: cin>>sub;
                if(!que[sub].empty()) cout<<que[sub].front()<<endl;
                break;
        case 2: cin>>sub;
                if(!que[sub].empty()) que[sub].pop();
    }
}


#ifdef LOCAL
fin.close();
#endif // LOCAL
}




Measured memory_bytes: 5252
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(input())
sosu=[0]*(n+1)
for i in range(2,n+1):
    tmp=i
    for j in range(2,i+1):
        while tmp%j==0:
            sosu[j]+=1
            tmp//=j

def num(n):
    return len(list(filter(lambda x: x>=n-1, sosu)))

print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) 
+ num(5)*(num(5)-1)*(num(3)-2)//2)

Measured memory_bytes: 38896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

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

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

ll mod(ll val, ll M) {
    ll res = val % M;
    if(res < 0) {
        res += M;
    }
    return res;
}

template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int D,T,S;
    cin >> D >> T >> S;
    if(S * T >= D) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int	n;	cin >> n;
  map<string,int>	data;
  for(int i=0;i<n;i++){
    string s;	cin >> s;
    data[s]++;
  }
  cout << "AC x " << data["AC"] << endl;
  cout << "WA x " << data["WA"] << endl;
  cout << "TLE x " << data["TLE"] << endl;
  cout << "RE x " << data["RE"] << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main(){
long long int x,y,z,k;
  cin >>x >> y >> z >> k;
  long long int a[x],b[y],c[z];
   vector<long long int>st,ans;
  for(int i=0;i<x;i++)cin >>a[i];
  for(int i=0;i<y;i++)cin >>b[i];
  for(int i=0;i<z;i++)cin >>c[i];
  for(int i=0;i<x;i++){
    for(int j=0;j<y;j++){
      st.push_back(a[i]+b[j]);
    }
  }
  sort(st.begin(),st.end());
  reverse(st.begin(),st.end());
  for(int i=0;i<min(k,x*y);i++){
    for(int j=0;j<z;j++)ans.push_back(st[i]+c[j]);
  }
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  for(int i=0;i<k;i++)cout <<ans.at(i)<<endl; 
}

Measured memory_bytes: 43364
package main

import "fmt"

var m map[int]int

func main() {
	var N, r int
	fmt.Scan(&N)
	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}
	for i := 0; i < len(arr); i++ {
		r += arr[i] - 1
	}
	fmt.Println(r)
}

Measured memory_bytes: 640
q = int(input())
mod = 10**9+7

for _ in range(q):
    x, y = sorted(map(int, input().split()))

    ma = 0
    i, j = 1, 1
    while j <= x and i+j <= y:
        i, j = j, i+j
        ma += 1
    if x == 1 or y <= 2:
        print(1, x*y % mod)
    else:
        ans = 0
        if x >= i:
            ans += max(0, (y-j) // i+1)
        if y >= i:
            ans += max(0, (x-j) // i+1)
        i, j = 1, 1
        for c in range(ma-1):
            k, l = j, i+j*2
            for _ in range(ma-c-1):
                k, l = l, k+l
            if x >= k:
                ans += max(0, (y-l) // k+1)
            if y >= k:
                ans += max(0, (x-l) // k+1)
            i, j = j, i+j
        print(ma, ans % mod)


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

int main(void)
{
	int N, i, j = 0, m = 0;;
	int A[100];

	cin >> N;

	for (i=1; i <= N; i++) {
		cin >> A[i];
		if (A[i] % 2 == 0) {
			if (A[i] % 3 != 0  && A[i] % 5 != 0) {
				cout << "DENIED\n";
				break;
			}
		}
	}

	if (i > N) {
		cout << "APPROVED\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    stack<int> data;
    
    int x;
    int y;
    char s[100];

    while( scanf("%s", s) != EOF ){
        if ( s[0] == '+' ){
            y = data.top();
            data.pop();
            x = data.top();
            data.pop();
            data.push(x+y);
        } else if ( s[0] == '-' ){
            y = data.top();
            data.pop();
            x = data.top();
            data.pop();
            data.push(x-y);

        } else if ( s[0] == '*' ){
            y = data.top();
            data.pop();
            x = data.top();
            data.pop();
            data.push(x*y);

        } else {
            data.push(atoi(s));
        }
  }
  printf("%d\n",data.top());

  return 0;
}

   


Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define nikal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC";
    else
        cout<<"ABC";
    return 0;
}


Measured memory_bytes: 3484
N = int(input())
S = input()
ans_list = []
for i in range(1, N):
    tmp = 0
    A = list(set(S[0:i]))
    B = list(set(S[i:N]))
    for k in A:
        if k in B:
            tmp += 1   
    ans_list.append(tmp)
print(max(ans_list))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
 
const int MX = 100005;
 
int main(){
  ll n;
  cin >> n;
  vector<ll> cnt(MX);
  rep(i,n){
    int a;
    cin >> a;
    cnt[a]++;
  }
  ll tot = 0;
  rep(i,MX)tot += i*cnt[i];
  //変化量で計算
  int q;
  cin >> q;
  rep(i,q){
    int b, c;
    cin >> b >> c;
    tot += (c-b)*cnt[b];
    cnt[c] += cnt[b];
    cnt[b] = 0;
    cout << tot << endl;
  }
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n,z;

int main(){
	fast_io();
	string s;
	int n,k;
	cin >> n  >> k >> s;
	--k;
	s[k] += ('a' - 'A');
	cout << s << '\n';
}


Measured memory_bytes: 256
using System;
using static System.Console;

namespace A
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var angle = int.Parse(ReadLine());
            WriteLine(Solve(angle));
        }

        private static double Eps = .000001;

        static int Solve(int rot)
        {
            (double, double y, double currentDegree) pos = (0, 0, rot);
            var p = Move(pos, rot);
            var k = 1;

            while (!(Math.Abs(p.x) <= Eps && Math.Abs(p.y) <= Eps))
            {
                p = Move(p, rot);
                k++;
            }

            return k;
        }

        static (double x, double y, double currentDegree) Move((double x, double y, double currentDegree) p, int rot)
        {
            var movedPos = (p.x, p.y, p.currentDegree);
            var rad = Math.PI * p.currentDegree / 180.0;
            movedPos.x += Math.Cos(rad);
            movedPos.y += Math.Sin(rad);
            movedPos.currentDegree += rot;
            return movedPos;
        }
    }
}

Measured memory_bytes: 27756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;


int main ()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i] >> b[i];
    }
    vector<pair<int, int>> ab(n);
    // cout << "aaaaa" << endl;
    for (int i = 0; i < n; ++i)
    {
        // cout << i << endl;
        ab[i] = make_pair(a[i], b[i]);
    }

    // cout << "aaaaa" << endl;
    sort(ab.begin(), ab.end(), [](const pair<int, int> &item1, const pair<int, int> &item2){
        return (item1.second < item2.second);
    });

    // cout << "aaaaa" << endl;
    bool flg = true;
    int sum_time = 0;
    for (int i = 0; i < n; ++i)
    {
        sum_time += ab[i].first;
        if (sum_time > ab[i].second)
        {
            flg = false;
            break;
        }
    }
    string ans = (flg ? "Yes": "No");
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3456
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	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;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int n,sum[30][500010],a[500010];
inline int lowbit(int x){return x&-x;}
inline void change(int p,int x,int k)
{
	while(x<=n)
	{
		sum[p][x]+=k;
		x+=lowbit(x);
	}
}
inline int getsum(int p,int x)
{
	int ans=0;
	while(x>=1)
	{
		ans+=sum[p][x];
		x-=lowbit(x);
	}return ans;
}
char ss[500010],s[2];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    n=read();
    scanf("%s",ss+1);
    for(int i=1;i<=n;i++)
    {
    	int uf=ss[i]-'a'+1;
    	change(uf,i,1);a[i]=uf;
    }
    int Q=read();
    while(Q--)
    {
    	int id=read();
    	if(id==1)
    	{
    		int p=read();scanf("%s",s+1);
    		int uf=s[1]-'a'+1;
    		change(a[p],p,-1);
    		a[p]=uf;
    		change(a[p],p,1);
    	}
    	else
    	{
    		int l=read(),r=read(),ans=0;
    		for(int i=1;i<=26;i++)
    		{
    			if(getsum(i,r)!=getsum(i,l-1))ans++;
    		}pr2(ans);
    	}
    }
    return 0;
}

Measured memory_bytes: 55552
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

class node{
public:
	int id;
	vector<int> children;
	int parent;
	int depth;
};

bool operator<=(node a, node b) {
	return a.id <= b.id;
}
bool operator<(node a, node b) {
	return a.id < b.id;
}

int main() {
	int  n,tmp,tmp2,index_root;
	cin >> n;
	node* nod = new node[n];
	bool* root = new bool[n];
	for (int i = 0;i < n;i++) {
		cin >> nod[i].id;
		cin >> tmp;
		for (int j = 0;j < tmp;j++) {
			cin >> tmp2;
			nod[i].children.push_back(tmp2);
		}
		root[i] = true;
	}
	sort(nod, nod + n);
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < nod[i].children.size();j++) {
			root[nod[i].children[j]] = false;
		}
	}
	for (int i = 0;i < n;i++) {
		if (root[i]) {
			index_root = i;
			break;
		}
	}
	nod[index_root].depth = 0;
	nod[index_root].parent = -1;
	queue<node*> q;
	q.push(&nod[index_root]);
	node* work_node;
	while (!q.empty()) {
		work_node = q.front();
		q.pop();
		for (int i = 0;i < work_node->children.size();i++) {
			nod[work_node->children[i]].parent = work_node->id;
			nod[work_node->children[i]].depth = work_node->depth + 1;
			q.push(nod + work_node->children[i]);
		}
	}
	for (int i = 0;i < n;i++) {
		cout << "node " << i << ": parent = " << nod[i].parent << ", depth = " << nod[i].depth << ", ";
		if (nod[i].depth == 0) {
			cout << "root, ";
		}
		else if (nod[i].children.size() == 0) {
			cout << "leaf, ";
		}
		else {
			cout << "internal node, ";
		}
		cout << "[";
		for (int j = 0;j < nod[i].children.size();j++) {
			cout << nod[i].children[j];
			if (j != nod[i].children.size() - 1) {
				cout << ", ";
			}
		}
		cout << "]" << endl;
	}


}




Measured memory_bytes: 8272
#include<bits/stdc++.h>
using namespace std;
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
//order_of_key(k)= # of items strictly smaller than 'k'  //find_by_order(x)= iterator to x'th largest element (counting from ZERO) //erase("iterator") [log(n)] //end(<name>)
//os.find_by_order(os.order_of_key(x)=iterator to 'x' in the rb tree
template<class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("O3")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef priority_queue<ll> pq;                                        //min-heap-> multiply the values by '-1'
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define forr(i,a,b) for (ll i = a; i < b; i++)
#define test ll t;cin>>t;while(t--)
#define summ(a,n) accumulate(a,a+n,0)
#define bsrch(v,n) lower_bound(v.begin(), v.end(), n)
#define minindex(v) distance(v.begin(),min_element(v.begin(),v.end()))         //returns index of minimum(/max) element in the vector
#define bp(x) _builtin_popcount(x)
#define inf 1000000000000
#define PI = 3.1415926535897932384626
#define mod 1000000007

int main()
{
    ll n; cin>>n;
  	ll a[n], dp[n];
  	forr(i,0,n) cin>>a[i];
  
  	dp[0]=0, dp[1]=abs(a[0]-a[1]);
  	forr(i,2,n) dp[i]=min(abs(a[i]-a[i-1])+dp[i-1], abs(a[i]-a[i-2])+dp[i-2]);
  	cout<<dp[n-1];
}

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

int main() {
  int n,x;
  cin >> n >> x;
  int sum = 0;
  int min = 10000;
  int argmin = 0;
  int* m = new int[n];
  for(int i = 0;i < n; i++){
  	cin >> m[i];
    sum += m[i];
    if(m[i] < min){
    	min = m[i];
    }
  }
  x -= sum;
  int result = x / min + n;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;

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

typedef bitset<100> Panels;

int W, H, field[10][10];
vector<Panels> carpets[10][10];
int dp[10][10];

bool canCover(int x, int y, int s)
{
	for(int i=y; i<y+s; i++)
	for(int j=x; j<x+s; j++)
		if(field[j][i] == 0) return false;

	return true;
}

Panels calcCovered(int x, int y, int s)
{
	Panels res;
	for(int i=y; i<y+s; i++)
	for(int j=x; j<x+s; j++) {
		res.set(j + i * W, 1);
	}

	return res;
}

pair<Panels, int> calcInit(Panels& flawless)
{
	int num = 0;
	Panels res = flawless;

	int cnt[100] = {0};
	for(int i=0; i<H; i++)
	for(int j=0; j<W; j++) {
		if(carpets[j][i].size() == 0) continue;
		for(int k=0; k<100; k++)
			if(carpets[j][i][0][k]) cnt[k]++;
	}

	for(int i=0; i<H; i++)
	for(int j=0; j<W; j++) {
		if(carpets[j][i].size() == 0) continue;
		for(int k=0; k<100; k++) {
			if(carpets[j][i][0][k] && cnt[k] == 1) {
				res |= carpets[j][i][0];
				carpets[j][i].clear();
				++num;
				break;
			}	
		}
	}

	return make_pair(res, num);
}


void remove(int x, int y)
{
	if(carpets[x][y].size() == 0) return;

	int S = (int)sqrt(carpets[x][y][0].count());
	for(int i=y; i<y+S; i++)
	for(int j=x; j<x+S; j++) {
		if(j == x && i == y) continue;
		if(carpets[j][i].size() == 0) continue;

		int T = (int)sqrt(carpets[j][i][0].count());
		if(x + S >= j + T && y + S >= i + T) {
			carpets[j][i].clear();
		}
		
	}
}

int ans;
void dfs(int x, int y, int u, Panels f)
{
	if(f.count() == W*H) {
		ans = u;
		return;
	}

	if(u + 1 >= ans) return;

	if(y == H) return;

	int tx = x + 1;
	int ty = y;

	if(tx == W) { tx = 0; ty++; }
	int S = carpets[x][y].size();

	if(f[x + y * W]) dfs(tx, ty, u, f);
	
	for(int i=0; i<S; i++) {
		Panels& c = carpets[x][y][i];
		Panels t = f;
		t |= c;

		if(t != f) {
			dfs(tx, ty, u + 1, t);
		}
		else break;
	}
}

int main()
{
	while(cin >> W >> H, (W||H)) {
		Panels init;
		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++) {
			cin >> field[j][i];
			carpets[j][i].clear();
			dp[j][i] = 1;

			if(field[j][i] == 0) init.set(j + i * W, 1);
		}

		int S = min(W, H);
		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++) {
			int M = 1;
			for(int k=0; k<3; k++) {
				int tx = j + dx[k] , ty = i + dy[k];
				if(tx < 0 || ty < 0) continue;
				dp[j][i] = max(dp[j][i], dp[tx][ty] - 1);

				if(carpets[tx][ty].size() != 0) 
				dp[j][i] = max(dp[j][i], (int)sqrt(carpets[tx][ty][0].count()) - 1);
			}
			for(int k=S; k>=dp[j][i]; k--) {
				if(i + k > H || j + k > W) continue;
				if(canCover(j, i, k)) {
					carpets[j][i].push_back(calcCovered(j, i, k));
					break;
				}
			}
		}

		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++) {
			remove(j, i);
		}

		pair<Panels, int> in = calcInit(init);
		
		init = in.first;
		ans = (1<<24);
		dfs(0, 0, in.second, init);

		cout << ans << endl;


	}
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll x, y;
    cin >> x >> y;

    ll group[13] {1919, 0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};

    if(group[x] == group[y]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int x, n, r;
    cin >> x;
    n = x / 100;
    r = x % 100;
    if(r<=n*5)cout<<1<<endl;
    else cout<<0<<endl;
    // REP(i, 1, pow(2,6)){
    //     tmp=0;
    //     j=i;
    //     if(j%2==1)tmp+=100;
    //     j/=2;
    //     if(j%2==1)tmp+=101;
    //     j/=2;
    //     if(j%2==1)tmp+=102;
    //     j/=2;
    //     if(j%2==1)tmp+=103;
    //     j/=2;
    //     if(j%2==1)tmp+=104;
    //     j/=2;
    //     if(j%2==1)tmp+=105;
    //     j/=2;
    //     if(tmp==x){
    //         cout<<1<<endl;
    //         return 0;
    //     }
    // }    
    // cout<<0<<endl;
}


Measured memory_bytes: 256
<?php
  
  fscanf(STDIN,"%s",$S);
$count01 = 0;
$count10 = 0;
for($i=0;$i<strlen($S);$i++){
  if($i%2==0){
    if($S[$i] != 0){
         $count01++;
    }else{
      	$count10++;
    }
  }
  
  if($i%2!=0){
    if($S[$i] != 1){
          $count01++;
    }else{
      $count10++;
    }
  }
}
  



echo min($count01,$count10)."\n";

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N; cin >> N;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    sort(ALL(A));
    cout << A[N-1] - A[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll dp[50];
bool used[50][2501];
bool usedn[50];

struct ab {
  int node, a, b;
  ab(int n, int aa, int bb) {node = n; a = aa; b = bb;}
};
vector<ab> nei[50];
P cd[50];

struct cell {
  int node, money; ll t;
  cell(int n, int m, ll tt) {node = n; money = m; t = tt;}
};
bool compare(cell& c1, cell& c2) {
  return c1.t > c2.t;
}

int main() {
  int n, m, s;
  cin >> n >> m >> s;
  rep(i, 50) rep(j, 2501) used[i][j] = true;
  rep(i, 50) usedn[i] = true;
  
  rep(i, m) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--; v--;
    nei[u].push_back(ab(v, a, b));
    nei[v].push_back(ab(u, a, b));
  }
  rep(i, n) {
    int c, d;
    cin >> c >> d;
    cd[i].first = c; cd[i].second = d;
  }
  /*rep(i, n) {for (auto edge : nei[i]) {
    cout << edge.node << " " << edge.a << " " << edge.b << " ";
  } cout << endl;}
  rep(i, n) cout << cd[i].first << " " << cd[i].second << endl;*/

  priority_queue<cell, vector<cell>, decltype(&compare)> que(compare);
  que.push(cell(0, min(s, 2500), 0));
  int cnt = 0;
  while(cnt < n) {
    int node = que.top().node, money = que.top().money;
    ll t = que.top().t;
    que.pop();

    if (usedn[node]) {dp[node] = t; usedn[node] = false; cnt++;}
    if (used[node][money]) {
      used[node][money] = false;
      que.push(cell(node, min(money + cd[node].first, 2500), t + cd[node].second));
      for (auto edge : nei[node]) {
        int neighbor = edge.node, a = edge.a, b = edge.b;
        if ((money >= a) && used[neighbor][money - a]) {
          que.push(cell(neighbor, money-a, t+b));
        }
      }
    }
  }

  rep(i, n-1) cout << dp[i+1] << endl;
  
  return 0;
}


Measured memory_bytes: 7492