akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

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


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a, b, n, x;
	cin>>a>>b>>n;
	ll ans = 0;
	if(true)
	{
		if(n/b >= 1)
		{
			x = b-1;
		}
		else 
		{
			x = n;
		}

	}
	// else if(a==b)
	// {}
			ans = floor((a*x*1.0)/b) - a*(floor((1.0*x)/b));
			cout<<ans<<endl;
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define int long long
using namespace std;

signed main() {
    int s;
    int ans = 753;
    cin >> s;
    for (; s > 100; s /= 10) {
        int x = s % 1000;
        ans = min(ans, abs(753 - x));
    }
    
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const long long INF = 1LL<<60;

int main() {
    int n,m;
    cin>>n>>m;
    priority_queue<int> q;
    rep(i,n){
        int a;
        cin>>a;
        q.push(a);
    }

    rep(i,m){
        int x=q.top();
        q.pop();
        x/=2;
        q.push(x);
    }

    ll ans=0;
    
    while (!q.empty()) {
      ans+=q.top();
      q.pop();
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (s.size() % 2 == 1) {
    cout << "No" << endl;;
    return 0;
  }
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[i + s.size() / 2]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


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

using namespace std;

int d[501];
vector <int> g[501];
int was[501][501];

void dfs (int v, int c) {
    d[v] = c;
    for (auto to : g[v]) {
        if (d[to] == 0) {
            dfs (to, 3 - c);
        }
    }
}

int main () {
    string s;
    cin >> s;
    for (int i = 0;i < s.size ();i ++) {
        if (s[i] == '?') s[i] = 'D';
    }
    cout << s;
    return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    int x;
    cin >> x;
    int sum = 0, num = 1;
    while (sum < x)
    {
        sum += num;
        num++;
    }
    cout << num - 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
#define ll long long
const int n = 3e5 + 1000;
const int mod = 1e9+7;
int N;
ll a[n], sum[n], p[66];

int main(){
    p[0] = 1;
    for (int i = 1; i <= 60; i++) p[i] = (p[i-1]*2)%mod;
    cin >> N;
    for (int i = 1; i <= N; i++){
        cin >> a[i];
    }
    ll ans = 0;
    for (int i = 0; i<=60; i++){
        sum[0] = 0;
        for (int j = 1; j <= N; j++){
            if ((a[j]>>i)&1) sum[j] = sum[j-1]+1;
            else sum[j] = sum[j-1];
        }
        ll cnt = 0;
        for (int j = 1; j <= N; j++){
            if ((a[j]>>i)&1){
                cnt += N - j - (sum[N] - sum[j]);
            }
            else {
                cnt += sum[N] - sum[j];
            }
        }
        cnt %= mod;
        ans = (ans + 1LL*cnt*p[i]%mod) % mod;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    while(1){
        int H,W;
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                printf("#");
            }
            printf("\n");
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int n;
    while(cin >> n){
        int ans = 0;
        for(int a = 0; a < 10; a++){
            for(int b = 0; b < 10; b++){
                for(int c = 0; c < 10; c++){
                    for(int d = 0; d < 10; d++){
                        ans += (a + b + c + d == n);
                    }
                }
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3012
num = int(input())
input_str_list = input().split()
input_list = []
for i in input_str_list:
	input_list.append(int(i))
input_list.sort(reverse=True)

A = 0
B = 0
A_list = input_list[::2]
B_list = input_list[1::2]
for i in A_list:
	A += i
for i in B_list:
	B += i
print(A-B)
	

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        int N = int.Parse(s[0]);
        int K = int.Parse(s[1]);
        Console.WriteLine(N % K == 0 ? 0 : 1); 
    }
}


Measured memory_bytes: 13140
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 

const int MXN = 2e5 + 5;
//const int MXN = 1e6 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;

//int N, X, Y, dist[2005][2005], cnt[2020];
int K, N;
ll A[MXN];

int main(){ FAST
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");


    /*
    cin >> N >> X >> Y;
    FOR(i,1,N+1){
        FOR(j,i+1,N+1){
            if (i < X && j > Y){
                dist[i][j] = X-i + 1 + j - Y;
            }
            else if (i < X && j <= Y){
                dist[i][j] = min(j-i, X-i+Y-j+1);
            }
            else if (i >= X && j <= Y){
                if (i == X && j == Y){
                    dist[i][j] = 1;
                }
                else if (i == X){
                    dist[i][j] = min(j-i,1+Y-j);
                }
                else if (j == Y){
                    dist[i][j] = min(j-i,1+i-X);
                }
                else{
                    dist[i][j] = min(j-i,1+Y-j);
                }
            }
            else{
                if (i < Y){
                    dist[i][j] = min(i - X + 1 + j - Y, Y-i + j - Y);
                }
                else{
                    dist[i][j] = j - i;
                }
            }
            cnt[dist[i][j]]++;
        }
    }



    FOR(k,1,N){
        cout << cnt[k] << newl;


    }

    */
    cin >> K >> N;
    ll dif = -INF;
    F0R(i,N){
        cin >> A[i];
    }
    F0R(i,N-1){
        dif = max(dif,A[i+1]-A[i]);
    }
    dif = max(dif,K-A[N-1] + A[0]);
    cout << K - dif << newl;










	return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    a, b = mi()
    print('IMPOSSIBLE') if (a + b) % 2 == 1 else print((a + b) // 2)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000007
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
typedef long long lli;
int cmp(const void *a, const void *b) {
    if((*(lli*)b - *(lli*)a) > 0) {
        return 1;
    } else if((*(lli*)b - *(lli*)a) < 0) {
        return -1;
    }
    return 0;
}

int main()
{
    int n, i, k;
    char s[10];
    scanf("%d%s%d",&n,s,&k);
    for(i=0; i<n; i++) {
        if(s[i]!=s[k-1]) {
            s[i] = '*';
        }
    }
    printf("%s",s);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	sort(ALL(A));
	
	int ans = 0;
	
	constexpr int MAX = 2123456;
	vector<int> done(MAX + 1);
	
	REP(i, N) {
		if (i < N && A[i + 1] != A[i]) ans += !done[A[i]];
		
		if (i == 0 || A[i - 1] < A[i]) {
			for (int j = A[i]; j <= MAX; j += A[i]) {
				done[j] = true;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 12296
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define dl double
#define pii pair<int,int>
#define pb push_back
#define all() begin(),end()
#define nl '\n'
#define adm(a,b,m) ((a+b)%m)
#define gum(a,b,m) ((a*1LL*b)%m)
#define lo(i,j,n) for(int i=j;i<n;i++)


int main(){
	int a,b;
	cin>>a>>b;
	if(a<b)swap(a,b);
	if(a-b<=1)
	cout<<"Yay!"<<nl;
	else
	cout<<":("<<nl;
}


Measured memory_bytes: 256
#include<stdio.h>

int a[20],x,y,z,i,k;

int main(){
	while(scanf("%d%d%d",&x,&y,&z)!=EOF){
		for(i=1;i<=10;i++)a[i]=0;k=0;
		a[x]=a[y]=a[z]=1;
		for(i=1;i<=10;i++)if(a[i]==0 && x+y+i<=20)k++;
		printf("%s\n",(k>3)?("YES"):("NO"));
	}
	return 0;
}

Measured memory_bytes: 0
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    string s1,s2,s3;cin>>s1>>s2>>s3;
    cout<<s1[0]<<s2[1]<<s3[2]<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def bitlist(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

#a = list(map(int, input().split()))

a = int(input())
b = int(input())

if(a+b==3):
    print(3)
elif(a+b==4):
    print(2)
else:
    print(1)

Measured memory_bytes: 63852
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; string s; cin >> n >> s;
    int ans = 1;
    FOR(i, 0, n - 1)ans += s[i] != s[i + 1];
    cout << ans << "\n";
}

Measured memory_bytes: 512
function Main(input){
	input = input.split("\n");
  var HW = input.shift().split(" ").map(a=>~~a);
  var hw = input.shift().split(" ").map(a=>~~a);
  
  return HW[0] * HW[1] - HW[0] * hw[1] - HW[1] * hw[0] + hw[0] * hw[1];
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
5 5
2 3
`);

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

using namespace std;

bool vis[100001];
long dp[100001];

void dfs(vector<long> graph[], long i)
{
    vis[i] = true;
    for(long j = 0; j < graph[i].size(); ++j)
    {
        if(!vis[graph[i][j]])
            dfs(graph, graph[i][j]);
        dp[i] = max(dp[i], 1 + dp[graph[i][j]]);
    }
}

int main()
{
	long long n, m, x, y;
    long max_len = 0;
    cin>>n>>m;
    vector<long> graph[n + 1];
    for(int i = 0; i < m; ++i)
    {
        cin>>x>>y;
        graph[x].push_back(y);
    }
    memset(vis, false, sizeof(false));
    memset(dp, 0, sizeof(dp));
    for(long i = 1; i <= n; ++i)
    {
        if(vis[i] == false)
            dfs(graph, i);
    }
    for(int i = 1; i <= n; ++i)
        max_len = max(max_len, dp[i]);
    cout<<max_len;
    return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n;i++){
      cin >> a[i];
      sum += a[i];
    }
    sort(a.begin(), a.end());
    sum-=a[n-1];
    sum-=a[0];
    cout << sum / (n - 2) << endl;
  }
  return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
string s[8];

void fail(){
	cout<<"Impossible"<<endl;
	exit(0);
}

int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>s[i];
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++){
			if(i==0&&j==0){
				if(s[i][j]!='#')
					fail();
				int cnt=0;
				cnt+=s[i+1][j]=='#';
				cnt+=s[i][j+1]=='#';
				if(cnt!=1)
					fail();
			}
			else if(i==n-1&&j==m-1){
				if(s[i][j]!='#')
					fail();
				int cnt=0;
				cnt+=s[i-1][j]=='#';
				cnt+=s[i][j-1]=='#';
				if(cnt!=1)
					fail();
			}
			else if (s[i][j]=='#'){
				int cnt=0;
				if(i>0)
					cnt+=s[i-1][j]=='#';
				if(j>0)
					cnt+=s[i][j-1]=='#';
				if(cnt!=1)
					fail();
				cnt=0;
				if(i<n-1)
					cnt+=s[i+1][j]=='#';
				if(j<m-1)
					cnt+=s[i][j+1]=='#';
				if(cnt!=1)
					fail();
			}
		}
	cout<<"Possible"<<endl;
}


Measured memory_bytes: 256
class binaryTreeNode:
    def __init__(self, x):
        self.val = x
        self.left = None
        self.right = None

n = int(input())
hashMap = {}
rootL = list(range(n))
for index in range(n):
    inputL = list(map(int, input().split()))
    if not inputL[0] in hashMap:
        hashMap[inputL[0]] = binaryTreeNode(inputL[0])
    parent = hashMap[inputL[0]]
    if inputL[1] != -1:
        rootL.remove(inputL[1])
        if not inputL[1] in hashMap:
            hashMap[inputL[1]] = binaryTreeNode(inputL[1])
        parent.left = hashMap[inputL[1]]
    if inputL[2] != -1:
        rootL.remove(inputL[2])
        if not inputL[2] in hashMap:
            hashMap[inputL[2]] = binaryTreeNode(inputL[2])
        parent.right = hashMap[inputL[2]]

root = hashMap[rootL[0]]
print('Preorder')
preL = []
def lookNodePre(node):
    if node != None:
        preL.append(node.val)
        lookNodePre(node.left)
        lookNodePre(node.right)
lookNodePre(root)
print(' '+' '.join(list(map(str, preL))))

print('Inorder')
InL = []
def lookNodeIn(node):
    if node != None:
        lookNodeIn(node.left)
        InL.append(node.val)
        lookNodeIn(node.right)
lookNodeIn(root)
print(' '+' '.join(list(map(str, InL))))

print('Postorder')
postL = []
def lookNodePost(node):
    if node != None:
        lookNodePost(node.left)
        lookNodePost(node.right)
        postL.append(node.val)
lookNodePost(root)
print(' '+' '.join(map(str, postL)))


Measured memory_bytes: 5616
#include<stdio.h>
int main(void){
	int x,i,n,max=1;
	scanf("%d",&x);
	for(i=2;i*i<=x;i++){
		n=1;
		while(n*i<=x){
			n*=i;
		}
		max=max<n?n:max;
	}
	printf("%d",max);
	return 0;
}

Measured memory_bytes: 1728
#include <iostream>

int main()
{
    int N;
    int A[20] = {0};
    int B[20] = {0};
    int C[20] = {0};

    std::cin >> N;
    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        std::cin >> B[i];
    }
    for (int i = 0; i < N-1; i++) {
        std::cin >> C[i];
    }

    int out = 0;
    int prev = -2;
     for (int i = 0; i < N; i++) {
         int curr = A[i] - 1;
        out += B[curr];
        if (prev == curr - 1)
            out += C[prev];
        prev = curr;
    }

    std::cout <<  out << std::endl;

    return 0;
}


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

#define ll long long int
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vl>
#define vvi vector<vi>
#define pb push_back
#define P pair<ll,ll>
#define mp make_pair
#define F first
#define S second
#define rep(i,n) for(ll i=0; i<n; i++)
#define Sort(v) sort(v.begin(), v.end())
#define all(v) v.begin(),v.end()

ll mo = 1000000007;
ll MO = 998244353;

ll modpower(ll a, ll b, ll mod){
	ll ans = 1;
	if(b == 0){
		return 1;
	}
	if(b%2 == 1){
		ans = a;
	}
	ll x = modpower(a,b/2,mod)%mod;
	ans *= (x*x)%mod;
	ans %= mod;
	return ans;
}

void pri(vl a){
	for(auto i:a)
		cout<<i<<" ";
	cout<<endl;
}

//-------------------------------------------------------------------------------
ll n,k;
bool foo(ll m, vl &a){
	ll val = 0;
	rep(i,n){
		ll x = a[i]/m;
		if(a[i]%m == 0) x--;
		val += x;
	}
	if(val>k) return false;
	return true;
}

void solve(){
	cin>>n>>k;
	vl a(n);
	rep(i,n) cin>>a[i];
	ll l = 1, r = 1e9;
	while(l<r){
		ll m = (l+r)/2;
		if(foo(m, a)){
			r = m; continue;
		}
		else{
			l = m+1; continue;
		}
	}
	cout<<r<<endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
	int nt = 1;
	// cin>>nt;
	while(nt--){
		solve();
	}
	return 0;
}

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

int main(){
  
  //Declarations
  int a[110];
  int N;
  int Alice=0;
  int Bob=0;

  //Taking inputs
  cin >> N;
  for(int i =0;i<N;i++)
    cin >> a[i];

  //sort
  sort(a, a+N, greater<int>());
  
  for(int i=0; i<N; i++){
    if(i%2==0){
      Alice+=a[i];
    }else{
      Bob+=a[i];
    }
  }

  cout << Alice-Bob << endl;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin>>n;

    int a,b;
    int arr[n];

    vector<pair<int,int> >vec;

    for(int i=0;i<n;i++){
        cin>>a>>b;
        arr[i] = i;
        vec.push_back(make_pair(a,b));
    }

    double ans = 0.0;
    double cnt = 0.0;

    do{
        cnt++;

        for(int i=0;i<n-1;i++){
            ans+= (   sqrt(   ((vec[arr[i]].first-vec[arr[i+1]].first)*(vec[arr[i]].first-vec[arr[i+1]].first))+((vec[arr[i]].second-vec[arr[i+1]].second)*(vec[arr[i]].second-vec[arr[i+1]].second))  )  );
        }

    }while(next_permutation(arr,arr+n));

    printf("%.10f",ans/cnt);
    cout<<endl;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] array = new double[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        long[] sum = new long[n];
        sum[0] += array[0];
        for (int i = 1; i < n; i++) {
            sum[i] = sum[i - 1] + (long) array[i];
        }
        int startIndex = 0;
        int index = 0;
        while (true) {
            int upperBound = -(Arrays.binarySearch(array, 2 * sum[index] + 0.1)) - 2;
            if (upperBound >= index) {
                if (sum[upperBound] * 2 >= array[n -  1]) {
                    System.out.println(n - startIndex);
                    return;
                }
                if (upperBound > index) {
                    index = upperBound;
                    continue;
                }
            }
            startIndex = index + 1;
            index++;
        }
    }
}

Measured memory_bytes: 50672
#include <stdio.h>

inline static int read_int() {
    int x = 0, k;
    while ((k = getchar_unlocked() - 'L') >= 0) x = x * 10 + k;
    return x;
}

inline static void put_int(int x) {
    int s = 0;
    char f[6] = {'0', '0', '0', '0', '0', '0'};
    if (!x) {
        putchar_unlocked('0');
        return;
    }
    while (x) {
        f[s++] += x % 10;
        x /= 10;
    }

    while (s--) putchar_unlocked(f[s]);
}

int array[100000];

int main() {
    int flag = 0, lastL = -1, lastR = 0, i = 0, tmp;

    while ((tmp = getchar_unlocked() - 'L') >= 0) {
        if (tmp) {
            if (flag) {
                flag = 0;
                lastL = i - 1;
                tmp = i - lastR;
                array[lastR] += (tmp - 1) / 2;
                array[lastR + 1] += tmp / 2;
            }
        } else {
            if (!flag) {
                flag = 1;
                lastR = i - 1;
                tmp = i - lastL;
                array[i - 1] += tmp / 2;
                array[i] += (tmp - 1) / 2;
            }
        }
        i++;
    }

    tmp = i - lastR;
    array[lastR + 1] += tmp / 2;
    array[lastR] += (tmp - 1) / 2;

    put_int(array[0]);
    for (tmp = 1; tmp < i; tmp++) {
        putchar_unlocked(' ');
        put_int(array[tmp]);
    }

    putchar_unlocked('\n');
}


Measured memory_bytes: 768
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

l=[]
for _ in range(M):
   s,t=map(int,input().split())
   l.append([s,t])

for i in range(10**(N-1) if N!=1 else 0,10**N):
    temp=list(str(i))
    judge=True
    for s,t in l:
        if temp[s-1]!=str(t):
            judge=False
    if judge:
        print(i)
        exit()
        
print(-1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  cout << min(min(p + q, p + r), q + r) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a;
    string str;

    cin>>a;
    cin>>str;

    if(a < 3200){
        cout<<"red"<<endl;
    }
    else{
        cout<<str<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
ll a,b,c;
cin>>a>>b>>c;
if(b/a>c)
{
  cout<<c;
}
else cout<<b/a<<"\n";
}

signed main(){
 
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


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

int main() {
	int a, b;
	cin >> a >> b;
	string ans = "Impossible";
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		ans = "Possible";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
	val n = scala.io.StdIn.readInt
	val a = new Array[Long](n)

	for(i<-0 until n){
		a(i) = scala.io.StdIn.readLong
	}

	var ans = 0L
	var sum = 0L

	for(x <- a){
		if(x == 0L){
			ans += sum/2L
			sum = 0L
		}else{
			sum += x
		}
	}

	ans += sum/2L

	println(ans)

}


Measured memory_bytes: 39784
#include <stdio.h>

int main(void){
    long int n,k,i,j,ans=0,max=0,min=0;
    int up[200000];
    
    scanf("%ld",&n);
    scanf("%ld",&k);
    
    for(i=0;i<=n;i++){
        up[i]=i;
    }
    
    
    for(j=0;j<k;j++){
            min=min+up[j];
    }
    
    for(j=n;j>(n-k);j--){
            max=max+up[j];
    }
    
    ans=ans+(max-min+1)%(1000000007);
    
    
    for(i=k;i<=n;i++){
        max=max+up[n-i];
        
        min=min+up[i];
        
        ans=(ans+(max-min+1))%(1000000007);
        
    }
    
    printf("%ld\n",ans);
    
    return 0;
}

Measured memory_bytes: 2924
#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;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll n;
	cin>>n;
	ll sum = 100;
	ll ct = 0;
	while(sum < n){
		sum += sum/100;
		ct++;
	}
	cout<<ct<<endl;
	return 0;
}  


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  a+=b;
  c+=d;
  if(a>c){
    cout<<"Left"<<endl;
  }
  else if(a<c){
    cout<<"Right"<<endl;
  }
  else{
    cout<<"Balanced"<<endl;
  }
  return(0);
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            if (isPalindromeNumber(i)) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean isPalindromeNumber(int x) {
        String s = Integer.toString(x);
        for (int i = 0; i < s.length() / 2; i++) {
            if (s.charAt(i) != s.charAt(s.length() - i - 1)) {
                return false;
            }
        }
        return true;
    }
}

Measured memory_bytes: 26964
N = int(input())
A = list(map(int, input().split()))

L, R = 0, 0
S = A[0]
T = A[0]

answer = 0
while L < N and R < N:
  
  if S == T:
    answer += R - L + 1
    R += 1
    if R > N - 1:
      break
    S += A[R]
    T ^= A[R]
  else:
    S -= A[L]
    T ^= A[L]
    L += 1
  #print(L, R, answer)
print(answer)

Measured memory_bytes: 77772
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) vdeb(da[i]);
    std::cout << std::endl;
}

using namespace std;

const int MAX_N = 200200;

int c[MAX_N];
ll ans[MAX_N], lam[MAX_N], co[MAX_N];

ll cal(ll x){
    return x*(x+1)/2;
}

int dfs2(vector<vector<int>> &da, vector<bool> &used, int now){
    ll tmp = lam[c[now]];
    lam[c[now]] = 0;
    rip(i, da[now].size(),0){
        if(used[da[now][i]]) continue;
        used[da[now][i]] = true;
        co[now] += dfs2(da, used, da[now][i]);
        ans[c[now]] += cal(co[da[now][i]]-lam[c[now]]);
        // cout  << co[da[now][i]] MM lam[c[now]] << endl;
        lam[c[now]] = 0;
    }
    ++co[now];
    lam[c[now]] = tmp + co[now];
    return co[now];
}

int main(){
    ll n; cin >> n;
    rip(i,n,0) cin >> c[i], --c[i];
    vector<vector<int>> da(n, vector<int>(0));
    rip(i,n-1,0){
        int a,b; cin >> a >> b;
        --a;--b;
        da[a].push_back(b);
        da[b].push_back(a);
    }
    vector<bool> used(n, false);
    used[0] = true;
    // used[0] =true;
    dfs2(da, used,0);
    // vdeb(lam);
    // vdeb(co);
    // vdeb(ans);
    rip(i,n,0){
        ans[i] += cal(n - lam[i]);
    }
    rip(i,n,0){
        printf("%lld\n", n*(n+1)/2 - ans[i]);
    }
}

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

int main() {

	string s; cin >> s;
	long long ans = 0, k; cin >> k;

	map<char, int>cnt;
	for (int i = 0; i < s.size(); i++) {
		cnt[s[i]]++;
	}
	if (cnt.size() == 1) {
		ans = (long long)s.size() * k / 2;
	}
	else {
		int cnt = 1;
		for (int i = 1; i < s.size(); i++) {
			if (s[i] == s[i - 1])cnt++;
			else {
				ans += (cnt / 2);
				cnt = 1;
			}
		}
		if (cnt > 1) {
			ans += (cnt / 2);
		}
		ans *= k;
		if (s[0] == s[s.size() - 1]) {
			int a = 0, b = 0;
			for (int i = 1; i < s.size(); i++) {
				if (s[0] == s[i])a++;
			}		
			for (int i = s.size() - 2; i >= 0; i--) {
				if (s[s.size() - 1] == s[i])b++;
			}			
			ans -= (k - 1) * (a / 2 + b / 2 - (a + b) / 2);			
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
N,D=map(int,input().split())
c=0
X=[]
for i in range(N):
  X.append(list(map(int,input().split())))

for j in range(N):
  for k in range(j+1,N):
    tmp=sum([(X[j][l]-X[k][l])**2 for l in range(D)])
    if tmp in [y**2 for y in range(130)]:
      c +=1
print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;

int main(){
  int n;
  cin >> n;
  vector<int> a(n+1), b(n+1);

  int sum = 0;
  for(int i=0;i<=n;i++){
    cin >> a[i];
    sum += a[i];
  }
  if(sum!=n){
    cout << "NO" << endl;
    return 0;
  }

  sum = 0;
  for(int i=0;i<=n;i++){
    cin >> b[i];
    sum += b[i];
  }
  if(sum!=n){
    cout << "NO" << endl;
    return 0;
  }

  priority_queue<pii> q;
  int v = 0;
  for(int i=1;i<=n;i++){
    while(b[i]){
      q.push( pii(i,v++) );
      b[i]--;
    }
  }  

  vector< vector<int> > e(n, vector<int>(n,0));
  v = 0;
  for(int i=n;i>0;i--){
    while(a[i]){
      int cnt = i;
      vector<pii> tmp;
      while(cnt){
	if(q.empty()){
	  cout << "NO" << endl;
	  return 0;
	}

	pii p = q.top(); q.pop();
	e[p.second][v] = 1;
	p.first--;
	if(p.first) tmp.push_back(p);
	cnt--;
      }
    
      for(pii p : tmp) q.push(p);
      v++;
      a[i]--;
    }
  }

  if(not q.empty()){
    cout << "NO" << endl;
    return 0;
  }

  cout << "YES" << endl;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cout << e[i][j] << " \n"[j==n-1];
    }
  }

}

Measured memory_bytes: 3156
#include <stdio.h>
#include <algorithm>
#include <complex>

int main()
{
    int a, b, x;
    scanf("%d%d%d", &a, &b, &x);
    if (x >= a && x <= a + b)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
using namespace std;

long long int gcd(long long int x, long long int y) {
	int r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}

int main() {
	long long int A, B; cin >> A >> B;

	cout << A * B/gcd(A,B) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
void yes() { cout << "Yay!" << endl; }
void no() { cout << ":(" << endl; }
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
struct edge { int to, cost; };
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int n;
int a[214514];
int cnt[224514];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)cnt[a[i]]++;
	int ans = 0;
	rep(i, n + 1)ans += cnt[i] * (cnt[i] - 1) / 2;
	rep(i, n)cout << ans - (cnt[a[i]] - 1) << endl;
	ggr
}


Measured memory_bytes: 5504
# include <bits/stdc++.h>
# define INF 1e9
using namespace std;

int main(){

  int A, B, C, X;
  cin >> A >> B >> C >> X;
  X /= 50;
  int ans = 0;
  for(int i=0; i<A+1; ++i){
    for(int j=0; j<B+1; ++j){
      for(int k=0; k<C+1; ++k){
        if(i*10+2*j+k == X) ans++;
      }
    }
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i <(n); i++)
using namespace std;
using ll = long long;
const int MAX_N = 100000;
const int MAX_Q = 100000;
const int MAX_LOG_N = 20;

vector<int> graph[MAX_N];
int parent[MAX_N][MAX_LOG_N];
int depth[MAX_N];

void dfs(int now, int p, int d)
{
    depth[now] = d;
    for (auto next: graph[now])
    {
        if (next == p) continue;
        dfs(next, now, d + 1);
    }
}

int lca(int u, int v, int log_n)
{
    if (depth[v] > depth[u]) swap(u, v);
    int dif = depth[u] - depth[v];
    for (int i = log_n; i >= 0; i--)
    {
        if ((dif >> i) & 1)
            u = parent[u][i];
    }

    if (u == v) return u;

    for (int i = log_n; i >= 0; i--)
    {
        if (parent[u][i] == parent[v][i])
            continue;
        
        u = parent[u][i];
        v = parent[v][i];
    }
    return parent[u][0];
}

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

    int log_n = 0;
    while ((1 << log_n) < n) log_n++;

    rep(j, log_n)
    rep(i, n)
        parent[i][j] = -1;

    rep(i, n)
    {
        int k, c;
        cin >> k;
        rep(j, k)
        {
            cin >> c;
            parent[c][0] = i;

            graph[i].push_back(c);
            graph[c].push_back(i);
        }
    }

    dfs(0, -1, 0);

    parent[0][0] = -1;
    rep(j, log_n)
    rep(i, n)
    {
        if (parent[i][j] == -1)
            continue;
        else
            parent[i][j + 1] = parent[parent[i][j]][j];
    }

    int q;
    cin >> q;
    rep(_q, q)
    {
        int u, v;
        cin >> u >> v;
        cout << lca(u, v, log_n) << endl;
    }
    return 0;
}


Measured memory_bytes: 21460