akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*1)

func main() {
	list := getStdinIntArr()
	N := list[0]
	K := list[1]
	d := make([]int, K)
	A := make([][]int, K)
	X := make([]int, N) // すぬけ君
	for i := 0; i < K; i++ {
		d[i] = getStdinInt()
		A[i] = getStdinIntArr()
		for j := 0; j < d[i]; j++ {
			X[A[i][j]-1]++
		}
	}

	ans := 0
	for i := 0; i < N; i++ {
		if X[i] == 0 {
			ans++
		}
	}

	fmt.Printf("%d\n", ans)
}

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}

func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}

func readLine() string {
	buf := make([]byte, 0, 1024*1024*10)
	for {
		l, p, e := sc.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 23780
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
    ll int jhogeo = 1;
    rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
    return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}

int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int N,M; cin>>N>>M;
  vector<string> A(N);
  vector<string> B(M);
  rep(i,0,N) cin>>A[i];
  rep(i,0,M) cin>>B[i];
  int check=0;
  int ans=0;
  rep(i,0,N-M+1){
    rep(j,0,N-M+1){
      rep(k,0,M){
        rep(l,0,M){
          if(B[k][l]!=A[i+k][j+l]) check++;
          
     //     cout<<B[k][l]<<" "<<A[i+k][j+l]<<endl;
        }
      }
      if(!check) ans++;
      check=0;
    }
  }
  cout<<(ans?"Yes":"No");
      
      
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

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

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------

int main() {

  ll X;
  cin >> X;

  for(ll i=-118; i<=119; ++i) {
    for(ll j=-119; j<=118; ++j) {
      ll A = i*i*i*i*i;
      ll B = j*j*j*j*j;
      if(A-B==X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3644
import java.io.*;
import java.util.*;
//import java.util.Map.Entry;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static int gcd(int a, int b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int array[] = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            sum += array[i];
        }
        if (sum % 10 == 0) {
            Arrays.sort(array);
            for (int i = 0; i < array.length; i++) {
                if (array[i] % 10 != 0) {
                    sum -= array[i];
                    break;
                }
            }
        }
        System.out.println(sum % 10 == 0 ? 0 : sum);
        bw.flush();
    }
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//

    static class Pair implements Comparable<Pair> {

        int a, b;

        public Pair(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(Pair p) {
            return a - p.a;
        }
    }

    static void forl_0(int n, int[] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void forl_1(int n, int[] array, Scanner sc) {
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void two_d(int n, int m, int[][] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                array[i][j] = sc.nextInt();
            }
        }
    }

    static boolean isPrime(long n) {
        if (n < 2) {
            return false;
        } else if (n == 2 || n == 3) {
            return true;
        } else if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        long sqrtN = (long) Math.sqrt(n) + 1;
        for (long i = 6L; i <= sqrtN; i += 6) {
            if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                return false;
            }
        }
        return true;
    }
}


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

#define ll  long long

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int main(){
	
	//c_p_c();

	
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b; 
	//ll t;
	//cin>>t;
	//while(t--){

	//}

	return 0;
	}

		

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

using namespace std;

typedef long long int ll;

const ll MOD = 1000000007;

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

  int N;
  cin >> N;
  vector<int> A(N);
  for (auto &a: A) cin >> a;

  vector<int> aSort = A;
  sort(aSort.begin(), aSort.end());
  int firstLargest = aSort[N-1];
  int secondLargest = aSort[N-2];
  vector<int> ans;
  for (auto &a: A) {
    if (a == firstLargest) ans.push_back(secondLargest);
    else ans.push_back(firstLargest);
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}


Measured memory_bytes: 4084
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int, int> P;

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

bool p[100001];
int c[100002];
int main() {

	for (int i = 2; i <= 100000; i++) {
		if (!p[i]) {
			for (int j = 2 * i; j <= 100000; j += i)p[j] = true;
		}
	}
	for (int i = 3; i <= 100000; i += 2) {
		if (!p[i] && !p[(i + 1) / 2])c[i]++;
	}
	for (int i = 3; i <= 100000; i++)c[i] += c[i - 1];
	int n, l[100001], r[100001];
	cin >> n;
	REP(i, n) {
		cin >> l[i] >> r[i];
	}
	REP(i, n) {
		cout << c[r[i]] - c[l[i] - 1] << endl;
	}

}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) (void)0
#endif


using namespace std;

inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define long long long
long  pw(long  x, long  y){long  ans = 1;for(long  i = 0; i < y; i++){ans = ans * x;}return ans;}
long  factorial(long  x){long  ans = 1; for(int i = 1 ;i < x+1; i++){ans = ans *i;}return ans;}

long  permutation(long  x, long  y){return factorial(x)/factorial(x-y);}

//long combination(long x, long y){long ans = 1;if(y == 0){return 1;}	if(x-y < y){return combination(x,x-y);}for(long i = 0; i < y; i++){	ans *= (x-i);}	for(long i = 0; i < y; i++){ans /= (i+1);	}

#define MOD 1000000007
#define INF 1000000000000

template<class T1, class T2>
long Min(T1 a, T2 b){
    return (a > b ? b : a);
}
template<class T1, class T2>
long Max(T1 a, T2 b){
    return (a < b ? b : a);
}

int main(){
  string s;
  cin >> s;
  int n = s.length();
  long ans = 0;
  for(int i = 0; i < n; i++){
    long temp = pw(2,i);
    long flag = 0;
    for(int k = n - 1 - i; k >= 0; k--){
      if(flag == 0){
	flag = 1;
	ans += temp * pw(10,k) * toInt(s.substr(i,1));
      }else{
	
	ans += temp *pw(10,k) * toInt(s.substr(i,1));
	temp = temp * 2;
      }
    }
    dump(ans);
  }
  dump(ans);
  cout << ans << endl;

}


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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
const int sz=100009;
int a[sz];
int main()
{
    int n,m;
    cin>>n>>m;
    int M=m;
    while(m--)
    {
        int x,y;
        cin>>x>>y;
        a[x]++;
        a[y+1]--;
    }
    for(int i=1; i<=n; i++)
    {
        a[i]+=a[i-1];
//        cout<<a[i]<<" ";
    }
//    cout<<endl;
    int cnt=0;
    for(int i=0; i<=n; i++)
    {
        if(a[i]==M)
            cnt++;
    }
    cout<<cnt;

}


Measured memory_bytes: 4020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 25;
int n;
int a[N], b[N], c[N];
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++) cin >> b[i];
    for(int i = 1; i < n; i++) cin >> c[i];
    int ans = 0;
    a[0] = -2;
    for(int i = 1; i <= n; i++) {
        ans += b[a[i]];
        if(a[i] == a[i - 1] + 1) ans += c[a[i - 1]];
    }
    cout << ans;
}


Measured memory_bytes: 256
//Code by : Abhishek Tiwari
//codechef.com/users/devil_within || hackerearth.com/@devil_within
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int 
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define repr(i,a,b) for(int i=(a);i>(b);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pii pair<int,int> 
#define ff first
#define ss second 
#define mod 1000000007
#define inf 1000000000
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(v) (v).begin(),(v).end()
using namespace std;

/*******************************************************************************************/
/*******************************************************************************************/
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { 
    os<<"["; for(int i=0;i<v.size()-1; ++i)os<<v[i]<<", ";os<<v[v.size()-1]<<"]\n"; return os; 
} 
template <typename T> ostream& operator<<(ostream& os, const set<T>& v) { 
    os<<"{"; for(auto it : v) { os<<it; if(it!=*v.rbegin()) os<<", "; } os<<"}\n"; 
    return os; 
}
template <typename T, typename S> ostream& operator<<(ostream& os, const map<T, S>& v) { 
    os<<"{"; for(auto it:v){ os<<"("<<it.first<<" : "<<it.second<<")"; if(it!=*v.rbegin()) os<<", "; } os<<"}\n"; 
    return os; 
}
template <typename T, typename S> ostream& operator<<(ostream& os, const pair<T, S>& v) { 
    os<<"("; os<<v.first<<", "<< v.second<<")"; 
    return os; 
} 
template<typename T> T maxi(T a,T b){return a>b ? a:b;}
template<typename T> T mini(T a,T b){return a<b ? a:b;}
/*******************************************************************************************/
/*******************************************************************************************/
int fpow(int x, int y, int p); 


int32_t main()  
{
#ifndef ONLINE_JUDGE
//freopen("input.txt" , "r" , stdin);freopen("output.txt" , "w" , stdout);freopen("error.txt" , "w" , stderr);
#endif
fio;
int tcases = 1;
//cin>>tcases;
for(int tcase = 1 ; tcase <= tcases ; ++tcase)
{   
    int n, w;
    cin>>n>>w;
    vector<int> v(n) , wt(n);
    rep(i , 0 , n)
        cin>> wt[i] >> v[i];
    int maxv = 0; 
    //cout<<v;
    maxv = 1 + accumulate(v.begin() , v.end() , 0);
    int dp[n+1][maxv];
    rep(i , 0 , maxv)
        dp[0][i] = inf;
    rep(i , 0 , n+1)
        dp[i][0] = 0;

    rep(i , 1 , n+1)
    {
        rep(j , 1, maxv)
        {
            if(j >= v[i-1])
            dp[i][j] = mini(dp[i-1][j] , wt[i-1] + dp[i-1][ j-v[i-1]] );
            else
            dp[i][j] = dp[i-1][j];
        }
    }
    int ans = 0;
    repr( i, maxv-1 , -1 )
    {
        rep(j , 1 , n+1 )
        if( dp[j][ i ] <= w)
        {
            ans = i;
            i = -1;
            break;
        }
    }
    cout<<ans;
    //cout<<"Case #"<<tcase<<": ";
}
return 0;
}



//Functions 

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


Measured memory_bytes: 79232
def solve(size=int(input()), ary=list(map(int, input().split())), max_range=100001):
    even = [0 for _ in range(max_range)]
    odd = [0 for _ in range(max_range)]

    (em, ei), (om, oi) = (0, 0), (0, 0)

    for i in range(size):
        if i % 2 == 0:
            even[ary[i]] += 1
            if even[ary[i]] > em:
                em, ei = even[ary[i]], ary[i]
        else:
            odd[ary[i]] += 1
            if odd[ary[i]] > om:
                om, oi = odd[ary[i]], ary[i]

    if ei == oi:
        even[ei], odd[oi] = 0, 0
        return size - max(max(even) + om, max(odd) + em)
    else:
        return size - (em + om)

print(solve())

Measured memory_bytes: 14268
import java.io.*;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		BigDecimal a = new BigDecimal(scan.next());
		BigDecimal b = new BigDecimal(scan.next());
		BigDecimal c = new BigDecimal(scan.next());
		if(sqrt(a, 50).add(sqrt(b, 50)).compareTo(sqrt(c, 50)) == -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	public static BigDecimal sqrt(BigDecimal a, int scale){

        BigDecimal x = new BigDecimal(Math.sqrt(a.doubleValue()), MathContext.DECIMAL64);
        if(scale < 17){
             x = x.setScale(scale, BigDecimal.ROUND_HALF_EVEN);
             return x;
        }

        BigDecimal b2 = new BigDecimal(2);
        for(int tempScale = 16; tempScale < scale; tempScale *= 2){
            x = x.subtract(
                    x.multiply(x).subtract(a).divide(
                    x.multiply(b2), scale, BigDecimal.ROUND_HALF_EVEN));
        }
        return x;
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<iomanip>
#include<bits/stdc++.h>
using namespace std;

/*define*/
#define rep(i, n) for(int i=0; i<n; ++i)
#define endl "\n"
typedef long long ll;

const long long mod = 1e18;
const long long INF=1e9;
int ci;

//dx[5] = {-1, 0, 1, 0, 0};
//dy[5] = {0, 1, 0, -1, 0};
//1行目を辞書順で繰り返す
//for(int i=0; i<1<<n; ++i){}
//2進数を入力
//for(int j=0; j<n; ++j) g[0][i] = (i>>j)&1==1;

/*unique文字の確認
    set<int> all;
    all.insert(a[i]);
    map<int, int> count;
    count[a[i++]]++;
    if(count[a[j++]]++==0) num++; 
*/
//typedef pair<int, int> P;

//配列
//vector<long long> v(max_n);
//vector<int> v[max_n];
//vector<vector<int>> v(max_n);
//priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> q; 降順;
//priority_queue<pair<int, int>, vector<pair<int, int>>, less<>> q; 昇順;

//tips
//最大値の最小化は２分探索
//printf("IMPOSSIBLE"\n);
//printf("%d%c", opt[i][j], j+1==N? \n : '');

int main(){
    ll n, k;
    cin >> n >> k;
    vector<bool> ans(n);
    vector<double> a(n+1);
    for(int i=0; i<n; ++i){
        cin >> a[i];
//        a[i] = log10(a_temp+2) + a[i-1];
    }
    //
    for(int i=0; i+k<n; ++i){
        if(a[i+k] > a[i]) ans[i]=true;
        else ans[i]=false;
    }
    for(int i=0; i+k<n; ++i){
        if(ans[i]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    cin >> ci;
}


Measured memory_bytes: 4824
#include <iostream>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include<cstdio>
#include <iterator>
#include <sstream>
#include <algorithm>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
#define len(str) (int)(str.length())
int main() {
	int L, R;
	cin >> L >> R;
	vector<vector<bool> > visit(2019, vector<bool>(2019,false));
	int min_ = 1e9;
	for (int i = L; i < R; i++)
	{
		for (int j = i+1; j <= R; j++)
		{
			int modi = i % 2019;
			int modj = j % 2019;
			if (visit[modi][modj]) {
				cout << min_ << endl;
				return 0;
			}
			else {
				visit[modi][modj] = true;
				min_ = min(min_, (modi * modj) % 2019);
			}
		}
	}
	cout << min_ << endl;
}


/*
int N, maxW;
cin >> N >> maxW;
vector<int> V(N,0);
vector<int> W(N,0);
vector<vector<int> > dp(N + 1, vector<int>(maxW+1, 0));
for (int a = 0; a < N; a++)
{
	cin >> V[a];
	cin >> W[a];
}

for (int a = 1; a <=N; a++)
{
	for (int b = 1; b <=maxW; b++)
	{

	}
}
*/


Measured memory_bytes: 896
// proxy

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        System.out.println(postedPattern(n,h,w));
    }
    public static int postedPattern(int n,int h,int w){
        return (n - h + 1) * (n - w + 1); 
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str;
    int m,h;
    
    while(1){
        
        cin >>str >>m;
        if(str == "-")break;
        for(int i=0; i<m; i++){
            cin >>h;
            str = str.substr(h,str.size()-h)+ str.substr(0,h);
        }cout<<str <<endl;
    }return 0;
}


Measured memory_bytes: 3184
#include<stdio.h>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
int bfs1[100000];
int bfs2[100000];
int v1[100000];
int v2[100000];
int A[100000];
int B[100000];
vector<int> g[100000];
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	c--;d--;
	for(int i=0;i<b;i++){
		int e,f;
		scanf("%d%d",&e,&f);
		e--;f--;
		g[e].push_back(f);
		g[f].push_back(e);
	}
	queue<int> Q;
	Q.push(c);
	for(int i=0;i<a;i++)bfs1[i]=bfs2[i]=-1;
	bfs1[c]=0;
	while(Q.size()){
		int at=Q.front();
		Q.pop();
		for(int i=0;i<g[at].size();i++){
			if(!~bfs1[g[at][i]]){
				bfs1[g[at][i]]=bfs1[at]+1;
				Q.push(g[at][i]);
			}
		}
	}
	queue<int> P;
	P.push(d);
	bfs2[d]=0;
	while(P.size()){
		int at=P.front();
		P.pop();
		for(int i=0;i<g[at].size();i++){
			if(!~bfs2[g[at][i]]){
				bfs2[g[at][i]]=bfs2[at]+1;
				P.push(g[at][i]);
			}
		}
	}
	for(int i=0;i<a;i++){
		if(~bfs1[i]){
			A[bfs1[i]]++;
		}
		if(~bfs2[i]){
			B[bfs2[i]]++;
		}
	}
	int dis=bfs1[d];
	long long ret=0LL;
	for(int i=0;i<dis-1;i++){
//		printf("%d %d\n",A[i],B[i]);
		ret+=(long long)A[i]*B[dis-2-i];
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 9820
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

string solve(string s){
    int count=0;
    string ans;
    char keep;
    string keeps;
    char c='0';
    for(int i=0;i<s.size();i++){
        // char k=s[i];
        if(s[i]!='0'){
            count++;
            c=s[i];
        }
        else{
            if(count!=0){
                if(c== '2'){
                    if(count%3==1)ans.append(1,'a');
                    else if(count%3==2)ans.append(1,'b');
                    else ans.append(1,'c');
                }
                else if(c== '3'){
                    if(count%3==1)ans.append(1,'d');
                    else if(count%3==2)ans.append(1,'e');
                    else ans.append(1,'f');
                }
                else if(c== '4'){
                    if(count%3==1)ans.append(1,'g');
                    else if(count%3==2)ans.append(1,'h');
                    else ans.append(1,'i');
                }
                else if(c== '5'){
                    if(count%3==1)ans.append(1,'j');
                    else if(count%3==2)ans.append(1,'k');
                    else ans.append(1,'l');
                }
                else if(c== '6'){
                    if(count%3==1)ans.append(1,'m');
                    else if(count%3==2)ans.append(1,'n');
                    else ans.append(1,'o');
                }
                else if(c== '7'){
                    if(count%4==1)ans.append(1,'p');
                    else if(count%4==2)ans.append(1,'q');
                    else if(count%4==3)ans.append(1,'r');
                    else ans.append(1,'s');
                }
                else if(c== '8'){
                    if(count%3==1)ans.append(1,'t');
                    else if(count%3==2)ans.append(1,'u');
                    else ans.append(1,'v');
                }
                else if(c== '9'){
                    if(count%4==1)ans.append(1,'w');
                    else if(count%4==2)ans.append(1,'x');
                    else if(count%4==3)ans.append(1,'y');
                    else ans.append(1,'z');
                }
                else if(c== '1'){
                    if(count%5==1)ans.append(1,'.');
                    else if(count%5==2)ans.append(1,',');
                    else if(count%5==3)ans.append(1,'!');
                    else if(count%5==4)ans.append(1,'?');
                    else ans.append(1,' ');
                }
                count=0;
            }
        }
    }
    // cout << ans << "%%%%%%%%%%%%%%%%"<<endl;
    return ans;
}

int main(int argc, char const *argv[]) {
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    vector<string>ans;
    for(int i=0;i<n;i++){
        cin >> s;
        ans.push_back(solve(s));
    }
    for(int i=0;i<n;i++){
        cout << ans[i]<<endl;
    }
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 200111

typedef long long ll;
typedef long double ld;

int pre[maxn];
int dp[maxn], b[maxn];
vector<int> v[maxn];

struct segtree{
	int seg[4 * maxn];
	int lazy[4 * maxn];

	void init(){
		memset(seg, 0x3f3f3f3f, sizeof(seg));
		memset(lazy, 0x3f3f3f3f, sizeof(lazy));
	}

	void push(int x, int l, int d){
		seg[x] = min(seg[x], lazy[x]);
		if(l != d){
			lazy[2 * x] = min(lazy[2 * x], lazy[x]);
			lazy[2 * x + 1] = min(lazy[2 * x + 1], lazy[x]);
		}
		lazy[x] = 0x3f3f3f3f;
	}

	void update(int x, int l, int d, int i, int j, int val){
		push(x, l, d);
		if(l > d || l > j || d < i)
			return;

		if(i <= l && d <= j){
			lazy[x] = min(lazy[x], val);
			push(x, l, d);
			return;
		}

		int mid = (l + d) / 2;
		update(2 * x, l, mid, i, j, val);
		update(2 * x + 1, mid + 1, d, i, j, val);
		seg[x] = min(seg[2 * x], seg[2 * x + 1]);
	}

	int query(int x, int l, int d, int i, int j){
		push(x, l, d);
		if(l > d || l > j || d < i)
			return 0x3f3f3f3f;

		if(i <= l && d <= j){
			return seg[x];
		}

		int mid = (l + d) / 2;
		int ret = query(2 * x, l, mid, i, j);
		ret = min(ret, query(2 * x + 1, mid + 1, d, i, j));
		seg[x] = min(seg[2 * x], seg[2 * x + 1]);
		return ret;
	}
} seg;

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%d", b + i);
		pre[i] = pre[i - 1] + (!b[i]);
	}

	int q;
	scanf("%d", &q);
	while(q--){
		int l, d;
		scanf("%d%d", &l, &d);
		v[d].pb(l);
	}

	seg.init();
	memset(dp, 0x3f3f3f3f, sizeof(dp));

	dp[0] = 0;
	seg.update(1, 0, n, 0, 0, 0);
	for(int i = 1; i <= n; i++){
		sort(v[i].begin(), v[i].end());

		dp[i] = dp[i - 1] + b[i];
		seg.update(1, 0, n, i, i, dp[i] - pre[i]);

		for(int j : v[i]){
			int cur = seg.query(1, 0, n, j - 1, j - 1) + pre[i];
			dp[i] = min(dp[i], cur);
			seg.update(1, 0, n, j, i, cur - pre[i]);
		}
	}

	printf("%d\n", dp[n]);
	return 0;
}

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

mina = min(A)
mini = A.index(mina)

ans = []
for i in range(N):
    if i == mini: continue
    ans.append(i+1)
    A[i] -= 1
ans.append(mini + 1)
A[mini] -= 1

for _ in range(K):
    tmpa = 9999
    tmpi = -1
    for i in range(N):
        if i == mini: continue
        if A[i] < tmpa:
            tmpa = A[i]
            tmpi = i
    for i in range(N):
        if i == mini or i == tmpi: continue
        ans.append(i+1)
        A[i] -= 1
        if A[i] < 0:
            print(-1)
            exit()
    ans.append(tmpi + 1)
    A[tmpi] -= 1
    if A[tmpi] < 0:
        print(-1)
        exit()
    mini = tmpi

print(len(ans))
print(*ans)

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
   int x, y, a, b, c;
   cin>>x>>y>>a>>b>>c;
   vector<int> p(a), q(b), r(c);
   rep(i, a) cin>>p[i];
   rep(i, b) cin>>q[i];
   rep(i, c) cin>>r[i];


   priority_queue<int, vector<int>, greater<int>> aet;
   sort(p.rbegin(), p.rend());
   rep(i, x) aet.push(p[i]);
   sort(q.rbegin(), q.rend());
   rep(i, y) aet.push(q[i]);

   sort(r.rbegin(), r.rend());
   queue<int> noc;
   for(int e : r) noc.push(e);

   while(!noc.empty()){
      if(noc.front() > aet.top()){
         aet.pop();
         aet.push(noc.front());
         noc.pop();
      }
      else break;
   }

   ll s=0;
   while(!aet.empty()){
      s+=aet.top();
      aet.pop();
   }

   cout << s << endl;
   return 0;
}


Measured memory_bytes: 5488
//Make a Rectangle

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define nxvarep(n,x,a) ll n,x;cin>>n>>x;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    nvarep(n,a);
    map<ll,ll>m{};
    rep(i,0,n){
        m[a[i]]++;
    }
    vector<ll>o;
    irep(i,m){
        if(i->second>=2)o.pb(i->first);
        if(i->second>=4)o.pb(i->first);
    }
    if(o.size()<2){cout<<0<<nnn;return 0;}
    sort(range(o),greater<ll>());
    cout<<o[0]*o[1]<<nnn;
    return 0;
}

Measured memory_bytes: 7296
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 1e5 + 5;

ll cnt[N];

void solve() {
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        cnt[a[i]] += (ll)b[i];
    }
    int mx = *max_element(all(a));
    for(int i = 1; i <= mx; i++) {
        k -= cnt[i];
        if(k <= 0) {
            cout << i << '\n'; return;
        }
    }
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 4656
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	int H1, M1, H2, M2, K;
	cin >> H1 >> M1 >> H2 >> M2 >> K;

	cout << (H2 - H1) * 60 + M2 - M1 - K << endl;

}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}
 
int main() {
 int n;
 cin>>n;
 vector<int>a(n),b;
 for(int i=0;i<n;i++){
   cin>>a[i];
 }
 for(int i=n-1;i>=0;i--){
   if(i%2==(n-1)%2){b.push_back(a[i]);}
 } 
 for(int i=0;i<n;i++){
   if(i%2!=(n-1)%2){b.push_back(a[i]);}
 } 
 for(int i=0;i<n;i++){
   cout<<b[i];
   if(i<n-1){cout<<" ";}
 }
 cout<<endl;
  return 0;
}

Measured memory_bytes: 5100
input = gets.chomp.split
n = input[0].to_i
m = input[1].to_i

count = 0

if n >= 1
    (1..n-1).each do |i|
        count += i
    end
end

if m >= 2
    (1..m-1).each do |i|
        count += i
    end
end

puts count

Measured memory_bytes: 1916
num = [int(i) for i in input().split()]
number = str(num[0])+str(num[1])
number = int(number)
num1 = []

for i in range(2,number//2):
    if number%i==0:
        num1.append(i)

count = 0
for i in num1:
    if i*i==number:
        count += 1
    
if count > 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
<?php

[$N] = fscanf(STDIN, "%d");
$target = -1;
for($i=1;$i<500;$i++){
    if($i * ($i+1) / 2 === $N){
        $target =$i;
        break;
    }elseif($i * ($i+1) / 2 > $N){
        break;
    }
}
if($target === -1){
    echo "No";
    exit;
}

echo "Yes".PHP_EOL;
echo $target+1 .PHP_EOL;
$list = [];
$max = 1;
for($i=1;$i<=$target + 1; $i++){
    echo $target;
    for($j=1;$j<=$target;$j++){
        if(!isset($list[$j])){
            echo " ".$max;
            $list[$i][] = $max;
            $max++;
        }else{
            echo " ".$list[$j][count($list[$j])-1];
            unset($list[$j][count($list[$j])-1]);
        }
    }
    echo PHP_EOL;
}

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


int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	for(int i=0;i<1000;i++){
		c-=b;
		if(c<=0){
			cout << "Yes" << endl;
			return 0;
		}
		a-=d;
		if(a<=0){
			cout << "No" << endl;
			return 0;
		}
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;

#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
vector<string> mp;
ll h,w;
struct State{
  ll x;
  ll y;
  ll cost;
};

ll rds(){
  queue<State> states;
  states.push(State{0,0,0});
  Vector dx = {1,0,-1,0};
  Vector dy = {0,-1,0,1};
  set<P> st;
  while(states.size()){
    State state = states.front();
    states.pop();
    if(st.count(mkp(state.x,state.y)))continue;
    st.insert(mkp(state.x,state.y));
    if(state.x == w-1 && state.y == h-1)return state.cost;
    rep(i,4){
      ll tx =  state.x + dx[i];
      ll ty =  state.y + dy[i];
      if(tx > -1 && tx < w && ty > -1 && ty < h && mp[ty][tx] == '.'){
        states.push(State{tx, ty, state.cost+1});
      }
    }
  }
  return -1;
}

int main(){
  cin.sync_with_stdio(false);
  cin >> h >> w;
  mp.resize(h);
  rep(i,h)cin >> mp[i];
  ll result = rds();
  ll sum = 0;
  rep(i,h)rep(j,w)if(mp[i][j] == '.')sum++;
  if(result != -1)cout << sum - result -1 << endl;
  else cout << result << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n,k;
    cin>>n>>k;
    ll a[n];
    rep(i,n){cin>>a[i];}
    ll sum[n+1], possum[n+1];
    sum[0]=0;
    possum[0]=0;
    rep(i,n){
        sum[i+1]=sum[i]+a[i];
        possum[i+1]=possum[i]+max(a[i],0LL);
    }
    ll res = 0;
    for(int i=0;i<=n-k;i++){
        ll psum = possum[i]+possum[n]-possum[i+k];
        ll lastsum = sum[i+k] - sum[i];
        DEBUG{cout << "sum : " << psum+max(0LL,lastsum) << endl;}
        res = max(res, psum+max(0LL,lastsum));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X= sc.nextInt();
		int count =0;
		int sum =0;
		while (sum<X) {
			sum +=count;
			count ++;
		}
		System.out.println(count-1);

	}
}

Measured memory_bytes: 35632
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;
}
 
Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key) return u;
  if(k < u->key){ 
    return treeSearch(u->left,k);
  }
  else { 
    return treeSearch(u->right,k);
  }
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL) return treeMinimum(x->right);
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
 
Node treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL || z->right==NIL){ y=z;}//zが子を持たないか、子を1つ持つ場合は入力節点のz
  else {y= treeSuccessor(z);}//zが子を2つ持つ場合はzの次節点
  if(y->left!=NIL){//yの子xを決める
    x=y->left;//yに左の子があれば、xはyの左の子
  }
  else {
    x=y->right;//yに左の子がなければ、xはyの右の子
  }
  if(x!=NIL){ x->parent=y->parent;}//xの親を設定する
  if(y->parent==NIL){ root=x;}
  else if(y==y->parent->left){
    y->parent->left=x;
  }//yがその親の左の子ならば、pの左の子をxとする
  else{
    y->parent->right=x;
  }//yがその親の右の子ならば、pの右の子をxとする
  if(y!=z){//zの次節点が削除された場合
    z->key=y->key;//yのデータをzにコピーする
  }
    return y;
}
 
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  //printf("%d\n",x->key);
  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;
  }//zをyの左の子にする
  else y->right=z;//zをyの右の子にする
}
 
void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}
 
 
int main(){
  
  int n, i, x;
  char com[20];
  
  scanf("%d", &n);
  root=NIL;
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 24036
#include<iostream>
using namespace std;
int main(){
    int n,q,count=0,middle,sup,inf,sp,ip,x;
    int S[100001];
    bool end;
    cin>>n;
    for(int i=0;i<n;i++)cin>>S[i];
    cin>>q;
    for(int i=0;i<q;i++){
        sup=n-1;inf=0;end=false;
        cin>>x;
        while(!end){
            middle=(sup+inf)/2;
            sp=sup; ip=inf;
            if(n!=2&&inf==n-2) middle=n-1;
            if(x>S[middle]) inf=middle;
            else if(x<S[middle]) sup=middle;
            else if(x==S[middle]){end=true; count++;}
            if(sp==sup&&ip==inf) end=true;
        }
        
    }
    cout<<count<<endl;
}



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

bool isPrime(int x) {
	if (x == 2) return true;
	for (int i=2; i*i <= x; ++i) if (x % i == 0) return false;
	return true;
}

int main() {
	int k;
	while (cin >> k, k != 0) {
		if (isPrime(k)) puts("0");
		else {
			int ans = 1, x = k-1;
			while (!isPrime(x)) {
				++ans;
				--x;
			}
			
			x = k+1;
			while (!isPrime(x)) {
				++ans;
				++x;
			}
			
			cout << ans + 1 << endl;
		}
	}
}


Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int memo[555][555],db[555][555];
bool done[555][555];

int dp(int l, int r){
	if(done[l][r]){
		return memo[l][r];
	}
	done[l][r] = true;
	if(l > r){
		memo[l][r] = 0;
		return memo[l][r];
	}
	memo[l][r] = db[l][r] + dp(l+1,r);
	return memo[l][r];
}

int main(void){
	int n,m,q,i,j,l,r;
	fill(db[0],db[555],0);
	fill(done[0],done[555],false);
	cin >> n >> m >> q;
	for(i=0; i<m; ++i){
		cin >> l >> r;
		--l; --r;
		++db[l][r];
	}
	for(i=0; i<n; ++i){
		for(j=0; j<n; ++j){
			db[i][j+1] += db[i][j];
		}
	}
	for(i=0; i<q; ++i){
		cin >> l >> r;
		--l; --r;
		cout << (dp(l,r)) << endl;
	}
	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int A[N];
    int kai=0;
    int min=200;
   for (int i=0 ; i<N ;i++){
       if(kai<min&&i!=0){min=kai;}
       kai=0;
       cin >> A[i];
       while(1){
       if (A[i]%2!=0){ break;}
       A[i]=A[i]/2;
       kai=kai+1;
       }
    }
   cout << min << endl;
        
         
    
return 0;}

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

int main() {
    int N;
    cin >> N;
    map<int, int> A;
    rep(i, N) {
        int tmp;
        cin >> tmp;
        A[tmp] = i + 1;
    }
    rep(i, N) {
        printf("%d ", A[i + 1]);
    }
    return 0;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+23;

int qpow(int a,int b,int mod){
    if(mod<=0) return 0;
    ll ans=1;
    while(b){
        if(b&1) ans=1ll*ans*a%mod;
        b>>=1;
        a=1ll*a*a%mod;
    }
    return ans%mod;
}   

int res1,res2,n;
char s[maxn];
int p1[maxn],p2[maxn];
int main(){
    scanf("%d",&n);
    scanf("%s",s);
    int cnt=0,len=strlen(s);
    for(int i=0;s[i];i++){
        if(s[i]=='1') cnt++;
    }
    p1[0]=p2[0]=1;
    for(int i=1;i<=n;i++){
        p1[i]=p1[i-1]*2%(cnt+1);
        if(cnt>1) p2[i]=p2[i-1]*2%(cnt-1);
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='1'){
            res1+=p1[len-i-1];
            res1%=(cnt+1);
            res2+=p2[len-i-1];
            if(cnt>1) res2%=(cnt-1);
        }
    }
    for(int i=0;i<len;i++){
        if(s[i]=='1'){
            if(cnt==1){
                puts("0");
                continue;
            }
            int now=res2;
            now=(now-p2[len-i-1]+cnt-1)%(cnt-1);
            int res=1;
            while(now){
                now=now%__builtin_popcount(now);
                res++;
            }
            printf("%d\n",res);
        }
        else{
            int now=res1;
            now=(now+p1[len-i-1]+cnt+1)%(cnt+1);
            int res=1;
            while(now){
                now=now%__builtin_popcount(now);
                res++;
            }
            printf("%d\n",res);
        }
    }
}

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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> V(N), C(N);
  REP(i, 0, N) {
    cin >> V[i];
  }
  REP(i, 0, N) {
    cin >> C[i];
  }
  int x = 0, y =0;

  REP(i, 0, N) {
    if (V[i] - C[i] > 0) {
      x += V[i];
      y += C[i];
    }
  }

  cout << x - y << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = 5e15;
int main(){
    ll N;
    cin >> N;
    vector<ll> primes;
    bool po[102] = {};
    for(ll i = 2; i <= N; i++){
        if(po[i]) continue;
        primes.push_back(i);
        for(ll j = 1; i * j <= N; j++) po[i * j] = 1;
    }
    vector<ll> cnt(102);
    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        ll num = i;
        for(ll p : primes){
            if(num < p) break;
            while(num % p == 0){
                num /= p;
                cnt[p]++;
            }
        }
    }
    for(ll id = 0; id < primes.size(); id++){
        ll i = primes[id];
        if(cnt[i] >= 74) ans++;
        for(ll jd = id + 1; jd < primes.size(); jd++){
            ll j = primes[jd];
            if(cnt[i] >= 24 && cnt[j] >= 2) ans++;
            if(cnt[i] >= 2 && cnt[j] >= 24) ans++;
            if(cnt[i] >= 14 && cnt[j] >= 4) ans++;
            if(cnt[i] >= 4 && cnt[j] >= 14) ans++;
            for(ll kd = jd + 1; kd < primes.size(); kd++){
                ll k = primes[kd];
                if(cnt[i] >= 4 && cnt[j] >= 4 && cnt[k] >= 2) ans++;
                if(cnt[i] >= 4 && cnt[j] >= 2 && cnt[k] >= 4) ans++;
                if(cnt[i] >= 2 && cnt[j] >= 4 && cnt[k] >= 4) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> T(N);
	for (int i = 0; i < N; i++) cin >> T[i];

	lint mul = 1;
	for (int i = 0; i < N; i++) {
		mul = mul / gcd(mul, T[i]) * T[i];
	}

	cout << mul << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m;
const int N = 200000 + 5;
map < int, int > mp;
int main(){
	scanf( "%d", &n );
	for( int i = 1, x; i <= n; i++ ) scanf( "%d", &x ), mp[x]++;
	scanf( "%d", &m );
	for( int i = 1, x; i <= m; i++ ){
		scanf( "%d", &x );
		if( mp[x] ) mp[x]--;
		else{
			puts("NO"); return 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 9600