akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define mod1 998244353
#define timepass 1073741824
#define MAXN 200000 + 5
#define LOGN 20
#define over ((1ll << 32))
using namespace std;
#define N 2005
 
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define int ll 
#define all(arr) arr.begin() , arr.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i , a , n) for(int i = a ; i < n ; i++)
#define rrep(i , n , a) for (int i = n - 1 ; i >= a ; i--)
#define ms(arr , val) memset(arr , val , sizeof(arr))
#define sp(a , x) cout << fixed << setprecision(a) << x << endl; 
#define siz(temp) (ll)temp.size()
#define len(temp) (ll)temp.length()
#define s(arr) sort(all(arr))
#define r(arr) reverse(all(arr))
#define rs(arr) s(arr) ; r(arr)
#define pi acos(-1)
#define con continue
#define endl "\n"
#define w(q) while(q--)
 
//debug
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace7(a, b, c, d, e, f , g) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | "<< #g <<": "<<g<<endl
#define trace8(a, b, c, d, e, f , g , h) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | " << #g <<": "<< g <<" | "<<#h<< ": " << h << endl
 
typedef pair<int , int> pii;
typedef pair<int , pii> piii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;



signed main()
{
    int a , b;
    cin >> a >> b;
    int g =__gcd(a , b);
    //cout << g << endl;
    int ans = 1;
    for (int i = 2 ; i * i <= g ; i++)
    {
        int fl = 0;
        while(g % i == 0)
        {
            fl = 1;
            g /= i;
        }
        if (fl)
            ans++;
        //trace3(i , g , ans);
    }
    if (g > 1)
        ans++;
    cout << ans << endl;
    return 0;
}

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

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

int main(){
  string str;
  cin >> str;
  int a, x;
  x=0;
    for (char c : str) {
      a=ctoi(c);
  //    cout << a << endl;
		x += a;
  //         cout << x << endl;
  }
//  cout << x << endl;
 // cout << x % 9 << endl;
  if(x %9 ==0)
  cout << "Yes" << endl;
  else
      cout << "No" << endl;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pii = pair<int, int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1; i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
template <class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = INT_MAX;
const int MOD = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    vi p(M);
    vs S(M);
    rep(i, M) cin >> p[i] >> S[i];
    vb AC(N+1, false);
    vi WA(N+1, 0);
    int ac, wa;
    rep(i, M) {
        if (AC[p[i]]) continue;
        if (S[i] == "AC") {
            ac++;
            wa += WA[p[i]];
            AC[p[i]] = true;
        } else {
            WA[p[i]]++;
        }
    }
    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 6528
N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]

B = [0] * (N + 1)
B[1] = A[0] - K
for i in range(1, N):
    A[i] += A[i - 1]
    B[i + 1] = A[i] - K * (i + 1)

tmp = sorted(B)

dic = dict()
for index, x in enumerate(tmp):
    dic[x] = index


N = len(B)
bit = [0] * (N + 1)
def total(i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= i & -i
    return s

def add(i, x):
    while i <= N:
        bit[i] += x
        i += i & -i
    return

ans = 0
for b in B:
    # print (b)
    n = dic[b]
    ans += total(n + 1)
    # print (b, ans)
    # print ()
    add(n + 1, 1)

print (ans)
# print (B)
# print (dic)
# print (bit)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////
void answer(){
    string S;
    cin>>S;

    S = S + 'R';
    int len = S.length();
    vector<int> answer(len-1, 0);
    int l_count = 0;
    int r_count = 0;
    int r_index = 0;
    int l_index = 0;
    for(int i=0; i<len-1; ++i){
        if(S[i] == 'R'){
            r_count++;
        }
        if(S[i] == 'L'){
            l_count++;
        }
        if(S[i] == 'R' && S[i+1] == 'L'){
            r_index = i;
            l_index = i+1;
        }
        if(S[i] == 'L' && S[i+1] == 'R'){
            answer[r_index] = int(ceil(r_count / 2.0)) + l_count / 2;
            answer[l_index] = int(ceil(l_count / 2.0)) + r_count / 2;
            l_count = 0;
            r_count = 0;
        }
    }

    for(auto x : answer){
        cout<<x<<" ";
    }
    cout<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 3856
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

vector<vector<int>> G(10);
int N, M, ans=0;

void bfs(int u, int visited){
    
    for(int i=0; i<G[u].size(); i++){
        int v = G[u][i];
        if((1<<v)&visited) continue;
        bfs(v,visited+(1<<v));
    }
    
    rep1(i,N){
        if((1<<i)&visited) continue;
        return;
    }
    ans++;
}

int main() {
    
    cin>>N>>M;
    
    rep(i,M){
        int a,b; cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    bfs(1,1<<1);
    cout1(ans);
}

Measured memory_bytes: 256
n = gets.to_i
num = []
n.times{ num << gets.split&.map(&:to_i)}

l_num = []
r_num = []


num.map do |n|
  l_num << n[0]
  r_num << n[1]
end

def middle(array)
  sa = array.sort
  if sa.size.even?
   sa[sa.size/2] + sa[sa.size/2 - 1] 
  else
    sa[sa.size/2]
  end
end

l_num_middle = middle(l_num)
r_num_middle = middle(r_num)

if n.even?
  p r_num_middle - l_num_middle + 1
else
  p r_num_middle - l_num_middle + 1
end
  


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

int d, s;

int main() {
	while (scanf("%d",&d) != EOF) {
		s = 0;
		for (int i = d; i <= 600-d; i += d) s += i*i*d;
		printf("%d\n",s);
	}
}


Measured memory_bytes: 3176
#include <stdio.h>


int main(void)
{	
	int h, w, i, j, flag;
	
	for( ; ; ){
		scanf(" %d %d", &h, &w );
		if(h==0 && w==0) break;
//		flag = 0;
		for(i=0; i<h; i++){
			flag=0;
			for(j=0; j<w; j++){
			if(i%2==0){
				if( flag==0 ) {
					printf("#");
					flag = 1;
				}else{
					printf(".");
					flag = 0;
				}
			}else{
				if( flag==1 ) {
					printf("#");
					flag = 0;
				}else{
					printf(".");
					flag = 1;
				}
			}
				
			}
			printf("\n");
		}
		printf("\n");
	
	}
	
	//getchar();
	//getchar();
	return 0;
}

Measured memory_bytes: 572
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
  
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int A = 111;
            while (true)
            {
                if(A < N)
                {
                    A += 111;
                }
                if (A >= N)
                {
                    break;
                }
            }
            Console.WriteLine(A);
        }
    }
}

Measured memory_bytes: 13140
/**
 * File    : B.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-6 21:47:06
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N, M, X;
int A[110];

int main()
{
  cin >> N >> M >> X;
  for (auto i = 0; i < M; i++)
  {
    cin >> A[i];
  }
  int P = 0;
  int Q = 0;
  for (auto i = 0; i < M; i++)
  {
    if (A[i] < X)
    {
      P++;
    }
    else
    {
      Q++;
    }
  }
  cout << min(P, Q) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
int main() {
    int N;
    cin >> N;
    int cost=0;
    int minmum_cost;
    vector<int> X(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
    }
    for(int i=1;i<=100;i++){
        cost = 0;
        for(int j=0;j<N;j++){
            cost = cost + (X[j]-i)*(X[j]-i);
        }
        if(i==1){
            minmum_cost = cost;
        }
        else{
            if(cost < minmum_cost){
                minmum_cost = cost;
            }
        }
    }
    cout << minmum_cost << endl;
}

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

using namespace std;

struct DATA{
  string name;
  int x1, y1, x2, y2;
  set<int> next;
};

void ConvertData(string&, vector<DATA>&, int);
void ConvertDataInner(const string, string, DATA&);
int AtoiString(const string);
int TouchPanel(int, int, int, vector<DATA>&);

int main(){
  int i, j, n, x, y, ans;
  string str;

  while(1){
    cin >> n;
    if(n == 0) break;

    cin >> str;
    vector< vector<DATA> > data;
    while(!str.empty()){
      vector<DATA> onedata(1);
      ConvertData(str, onedata, 0);
      data.push_back(onedata);
    }

    for(i=0; i<n; ++i){
      cin >> x >> y;
      for(j=0; j<data.size(); ++j){
	ans = TouchPanel(x, y, 0, data[j]);
	if(ans != -1){
	  cout << data[j][ans].name << " " << data[j][ans].next.size() << endl;
	  break;
	}
      }
      if(ans == -1) cout << "OUT OF MAIN PANEL 1" << endl;
    }
  }
  return 0;
}

void ConvertData(string& str, vector<DATA>& data, int x){
  DATA _data;
  string::iterator i, j;

  i = find(str.begin(), str.end(), '>');
  j = find(i+1, str.end(), '<');

  const string name(str.begin()+1, i);
  string info(i+1, j);
  ConvertDataInner(name, info, data[x]);
  str.erase(str.begin(), j);

  while(1){
    i = find(str.begin(), str.end(), '>');
    const string name(str.begin()+1, i);
    if(name == "/" + data[x].name){
      str.erase(str.begin(), i+1);
      return;
    }
    data.push_back(_data);
    data[x].next.insert(data.size()-1);
    ConvertData(str, data, data.size()-1);
  }
}

void ConvertDataInner(const string name, string str, DATA& data){
  string::iterator i, j, k;

  i = find(str.begin(), str.end(), ',');
  j = find(i+1, str.end(), ',');
  k = find(j+1, str.end(), ',');

  const string x1(str.begin(), i);
  const string y1(i+1, j);
  const string x2(j+1, k);
  const string y2(k+1, str.end());

  data.name = name;
  data.x1 = AtoiString(x1);
  data.y1 = AtoiString(y1);
  data.x2 = AtoiString(x2);
  data.y2 = AtoiString(y2);
  data.next.clear();
}

int AtoiString(const string s){
  int i, x, d;
  for(i=s.size()-1, x=0, d=1; i>=0; --i, d*=10)
    x += ((s[i] - 48) * d);
  return x;
}

int TouchPanel(int x, int y, int n, vector<DATA>& data){
  if(data[n].x1 <= x && x <= data[n].x2 && data[n].y1 <= y && y <= data[n].y2){
    int m;
    set<int>::iterator i;
    for(i=data[n].next.begin(); i!=data[n].next.end(); ++i){
      m = TouchPanel(x, y, *i, data);
      if(m != -1) return m;
    }
    return n;
  }else{
    return -1;
  }
}

Measured memory_bytes: 1256
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        final int N = Integer.parseInt(sc.next());
        int[] v = new int[N];
        for (int i = 0; i < N; i++) {
            v[i] = Integer.parseInt(sc.next());
        }
        
        Arrays.sort(v);
        double ans = (v[0] + v[1]) / 2.0;
        for (int i = 2; i < N; i++) {
            ans = (ans + v[i]) / 2.0;
        }
        
        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 21716
(|>) :: a -> (a -> b) -> b
infixl 1 |>
x |> f = f x

($>) :: (Functor m) => m a -> (a -> b) -> m b
infixl 1 $>
x $> f = fmap f x

getNums = getLine $> words $> map read

main = do
  list <- getNums :: IO [Float]
  list |> sum |> (/ 2) |> ceiling |> print

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;

set<string> S;

int main() {
	fastio;
	int n; cin >> n;
	string t;
	FOR(i, n) {
		cin >> t;
		S.insert(t);
	}
	cout << S.size();
}

Measured memory_bytes: 19244
import java.io.*;
import java.util.*;

public class Main {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    private static StringTokenizer st;

    private static int readInt() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Integer.parseInt(st.nextToken());
    }

    public static void main(String[] args) throws IOException {
        long D = readInt();
        long T = readInt();
        long S = readInt();

        if ( T * S >= D) pw.println("Yes");
        else pw.println("No");
        pw.close();
    }
}


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


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0;i<n;i++) {
        cin >> a[i];
    }
    int m=0;
    vector<int> box(n);
    for (int i=n/2;i<n;i++) {
        box[i]=a[i];
        m+=box[i];
    }
    for (int i=n/2-1;i>=0;i--) {
        int t=0;
        for (int j=2*(i+1); j<=n; j+=i+1) {
            t+=box[j-1];
        }
        box[i]=(t+a[i])%2;
        m+=box[i];
    }

    cout << m << endl;
    for (int i=0;i<n;i++) {
        if (box[i]==1) cout << i+1 << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long n, d, power[17]; pair<long long, long long>a[30];
vector<pair<long long, long long> > vec1, vec2, c1, c2;

// ------ RMQ Class ------ //
template<typename Type>
class RMQ {
private:
	int size_; std::vector<Type> dat;
public:
	RMQ() : size_(0), dat(std::vector<Type>()) {};
	RMQ(int size__) {
		for (size_ = 1; size_ < size__; ) size_ <<= 1;
		dat.resize(size_ << 1, std::numeric_limits<Type>::max());
	}
	template<class T>
	RMQ(T begin_, T end_) {
		int n = end_ - begin_;
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, std::numeric_limits<Type>::max());
		for (int i = 0; i < n; i++) dat[i + size_] = *(begin_ + i);
		for (int i = size_ - 1; i > 0; i--) dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	inline unsigned size() { return size_; }
	inline void update(unsigned i, Type x) {
		i += size_; dat[i] = x;
		while (i > 1) {
			i >>= 1;
			dat[i] = std::min(dat[i << 1], dat[i << 1 | 1]);
		}
	}
	inline Type query(unsigned l, unsigned r) {
		Type ret = std::numeric_limits<Type>::max();
		l += size_; r += size_;
		while (l != r) {
			if (l & 1) ret = std::min(ret, dat[l++]); l >>= 1;
			if (r & 1) ret = std::min(ret, dat[--r]); r >>= 1;
		}
		return ret;
	}
};
int main() {
	cin >> n >> d;
	for (int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
	int Mid = n / 2; sort(a, a + n);
	for (int i = 0; i < Mid; i++)vec1.push_back(make_pair(a[i].first, a[i].second));
	for (int i = Mid; i < n; i++)vec2.push_back(make_pair(a[i].first, a[i].second));
	power[0] = 1; for (int i = 1; i < 17; i++)power[i] = power[i - 1] * 3;
	for (int i = 0; i < power[vec1.size()]; i++) {
		if (i % 48 == 1)continue;
		long long Ax = 0, Bx = 0, Ay = 0, By = 0;
		for (int j = 0; j < vec1.size(); j++) {
			int Y = (i / power[j]) % 3;
			if (Y == 0) { Ax += vec1[j].first; Ay += vec1[j].second; }
			if (Y == 1) { Bx += vec1[j].first; By += vec1[j].second; }
		}
		c1.push_back(make_pair(Ax - Bx, Ay - By));
	}
	for (int i = 0; i < power[vec2.size()]; i++) {
		if (i % 48 == 1)continue;
		long long Ax = 0, Bx = 0, Ay = 0, By = 0;
		for (int j = 0; j < vec2.size(); j++) {
			int Y = (i / power[j]) % 3;
			if (Y == 0) { Ax += vec2[j].first; Ay += vec2[j].second; }
			if (Y == 1) { Bx += vec2[j].first; By += vec2[j].second; }
		}
		c2.push_back(make_pair(Ax - Bx, Ay - By));
	}
	sort(c1.begin(), c1.end());
	sort(c2.begin(), c2.end());
	RMQ<long long> seg(c2.size());
	for (int i = 0; i < c2.size(); i++)seg.update(i, c2[i].second);
	long long minx = 1LL << 62, pos1 = c2.size(), pos2 = c2.size();
	for (int i = 0; i < c1.size(); i++) {
		while (pos1 > 0 && c2[pos1 - 1] > make_pair(-c1[i].first - d, -1LL << 62))pos1--;
		while (pos2 > 0 && c2[pos2 - 1] > make_pair(-c1[i].first + d + 1, -1LL << 62))pos2--;
		if (pos1 < pos2) {
			long long pos3 = seg.query(pos1, pos2);
			minx = min(c1[i].second + pos3, minx);
		}
	}
	cout << -minx << endl;
	return 0;
}

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

int main(){

  int n, s;
  int soi[10][101] = {};
	
	soi[1][0] = 1;
	
	for(int i=1; i<=9; i++){
		for(int j=i; j>0; j--){
			for(int k=0; k<=100; k++){
				if(soi[j][k] != 0){
					soi[j+1][k + i] += soi[j][k];
				}
			}
		}
		soi[1][i] = 1;
	}
	
	while(1){
		cin >> n >> s;
		if(n == 0 && s == 0) break;
		
		cout << soi[n][s] << endl;
		
	}

  return 0;

}

Measured memory_bytes: 1164
//
//  Road2Master.cpp
//  Road2Master
//
//  Created by Rakhman Abdirashov on 12/14/19.
//  Copyright © 2019 Rakhman Abdirashov. All rights reserved.
//
 
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
 
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define no_answer {cout << "NO"; exit(0);}
#define FOR(i, start, finish, k) for(llong i = start; i <= finish; i += k)
 
const long long MXN = 1e6 + 10;
const long long MNN = 1e4 + 520;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9;
 
typedef long long llong;
typedef unsigned long long ullong;
 
using namespace std;
 
llong n, k, pr[MXN];
llong ans, sum;
map<int, int> mp;

int main(){
    ios;
    cin >> n >> k;
    mp[0] = 1;
    for(int i = 1; i <= n; i++){
        llong x;
        cin >> x;
        pr[i] = pr[i - 1] + x;
        llong last = i - k;
        if(last > -1) {
            mp[(pr[last] - last) % k]--;
        }
        ans += mp[(pr[i] - i) % k];
        mp[(pr[i] - i) % k]++;
    }
    cout << ans;
}


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

int main(){
	
	int n,s[1000]={},sum=0;
	
	while(1){
		cin >> n ;
		if( n==0 ) break;
		
		for( int i=0 ; i<n ; i++ ) cin >> s[i] ;
		
		sort( s , s+n ) ;
		sum=0;
		
		for( int i=1 ; i<n-1 ; i++ ) sum += s[i] ;
		
		cout << sum / (n-2) << endl;
	}
	
return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
#define ll long long
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int N,M;
    cin>>N>>M;
    vector<int> cntships(N,0);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        if(a==1||a==N){
            cntships[b-1]++;
        }else if(b==1||b==N){
            cntships[a-1]++;
        }
        if(cntships[a-1]==2||cntships[b-1]==2){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 3932
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int max = a+b;
        if(max<=a-b){
            max = a-b;
        }
        if(max<=a*b){
            max = a*b;
        }
        System.out.println(max);
    
        
    }
}

Measured memory_bytes: 23380
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next(),t="CODEFESTIVAL2016";
		int count=0;
		for(int i=0;i<s.length();i++) {
			if(!s.substring(i, i+1).equals(t.substring(i, i+1)))count++;
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 23252
#include<stdio.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
const int maxn = 2e5 + 5;
map<int,int>dp[maxn];
vector<int>ve[maxn];
int n;
int ans[maxn];
int dfs2(int x,int ba,int v) {
if(dp[x].count(v)) return dp[x][v];
int sm = 1;
for(int y:ve[x]) {
if(y==ba) continue;
if(y<v) sm += dfs2(y,x,v);
}
return dp[x][v] = sm;
}
void dfs1(int x,int ba,int pr,int cc) {
cc += dfs2(x,ba,max(ba,pr));
if(pr>x) cc -= dfs2(x,ba,pr);
ans[x] = cc;
for(int y:ve[x]) {
if(y==ba) continue;
dfs1(y,x,max(pr,ba),cc);
}
}
int main() {
scanf("%d",&n);
for(int i=1;i<n;i++) {
int x,y; scanf("%d%d",&x,&y);
ve[x].push_back(y);
ve[y].push_back(x);
}
for(int y:ve[1]) {
dfs1(y,1,1,0);
}
for(int i=2;i<=n;i++) printf("%d ",ans[i]);
}


Measured memory_bytes: 53888
import java.io.*;
import java.util.*;

public class Main
{
	static Scanner scan = new Scanner(System.in);
	public static void solve() throws Exception
	{
		//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//StringTokenizer tk = new StringTokenizer(in.readLine());
		int n = scan.nextInt();
		long[] nums = new long[n];
		long sum = 0;
		HashMap<Long,Long> map = new HashMap<>();
		for(int i=0;i<n;i++)
		{
			nums[i]=scan.nextLong();
			sum+=nums[i];
			if(map.containsKey(nums[i]))
			{
				map.replace(nums[i],map.get(nums[i])+1);
			}
			else
				map.put(nums[i],(long)1);
		}
		long q=scan.nextLong();
		while(q-->0)
		{
			long a = scan.nextLong();
			long b = scan.nextLong();
			if(map.get(a)==null)
				System.out.println(sum);
			else
			{
				long num = map.get(a);
				sum = sum+b*num-a*num;
				map.remove(a);
				if(map.containsKey(b))
				{
					map.replace(b,map.get(b)+num);
				}
				else
					map.put(b,num);
				System.out.println(sum);
			}
			//System.out.println(map);
		}
	}
	public static void main(String[] args) throws Exception
	{
		if(scan.hasNext())
		{
			//int t= scan.nextInt();
			int t= 1;
			while(t-->0)
			{	
				solve();
			}
		}
	}
}

Measured memory_bytes: 77212
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
ll H, W;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> H >> W;
    if(H == 1 || W == 1){
        cout << 1 << endl;
        return 0;
    }
    cout << (H*W+1)/2 << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge { int to; int to2; int cost; };

signed main() {
	int a[5];
	rep(i, 4)cin >> a[i];
	sort(a, a + 4);
	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
		puts("YES");
	}
	else puts("NO");
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main()
{
    char str[1001];
    char order[8];
    char input[1001];
    char output[1001];
    char tmp;
    int q, a, b, i, j, k;
    
    scanf("%s", str);
    scanf("%d", &q);
    
    for(i = 0; i < q; i++)
    {
        scanf("%s %d %d", order, &a, &b);
        
        if(strcmp(order, "print") == 0)
        {
            for(j = 0, k = a; k <= b; j++, k++)
            {
                output[j] = str[k];
            }
            output[j] = '\0';
            printf("%s\n",output);
        }
        else if(strcmp(order, "reverse") == 0)
        {
            for(j = a, k = b; j < k; j++, k--)
            {
                tmp = str[j];
                str[j] = str[k];
                str[k] = tmp;
            }
        }
        else if(strcmp(order, "replace") == 0)
        {
            scanf("%s", input);
            for(j = 0, k = a; j < strlen(input); j++, k++)
            {
                str[k] = input[j];
            }
        }
    }
    
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

class UnionFind{
public:
	vector<int> p;  // 親
	vector<int> sz; // サイズ
	UnionFind(int n){
		p.resize(n, -1);
		sz.resize(n, 1);
	}

	int root(int x){
		if(p[x] == -1)return x;
		else return p[x] = root(p[x]);
	}

	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y)return;
		sz[y] += sz[x];
		p[x] = y;
	}

	int size(int x){ //xが属すグループのサイズ
		return sz[root(x)];
	}
	bool same(int x, int y){
		return (root(x) == root(y));
	}
};

void solve()
{
	int n, m, k;
	cin >> n >> m >> k;
	
	UnionFind ab(n);
	vector<int> fr(n, 0);
	vector< vector<int> > cd(n);

	for(int i = 0; i < m; ++i)
	{
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		++fr[a];
		++fr[b];
		ab.unite(a, b);
	}

	for(int i = 0; i < k; ++i)
	{
		int c, d;
		cin >> c >> d;
		--c;
		--d;

		cd[c].push_back(d);
		cd[d].push_back(c);
	}


	for(int i = 0; i < n; ++i)
	{
		int ans = ab.size(i) - fr[i] - 1;
		for(int c : cd[i])
		{
			if (ab.same(i, c))--ans;
		}
		cout << ans << " ";
	}

}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 7552
package main

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

var sc *bufio.Scanner
var c int


func nextInt() int {
  sc.Scan()
  i, _ := strconv.Atoi(sc.Text())
  return i
}

func isEven(num int) bool {
  return num % 2 == 0
}

func check(num int) {
  if isEven(num) {
    r := num / 2
    c++
    check(r)
  } else {
    return
  }
}

func main() {
  sc = bufio.NewScanner(os.Stdin)
  c = 0
  sc.Split(bufio.ScanWords)
  
  n := nextInt()
  
  for i := 0; i < n; i++ {
    num := nextInt()
    check(num)
  }
  res := fmt.Sprintf("%d", c)
  fmt.Println(res)
}


Measured memory_bytes: 768
#include<stdio.h>
#define INTFY 10000000
#define MAX 2000000

int H,A[MAX+1];

void maxHeapify(int i){
  int l,r,largest,swap;
  l=2*i;
  r=2*i+1;
  if(l<=H&&A[l]>A[i]){
    largest=l;
  }
  else{
    largest=i;
  }
  if(r<=H&&A[r]>A[largest]){
    largest=r;
  }
  if(largest!=i){
    swap=A[largest];
    A[largest]=A[i];
    A[i]=swap;
    maxHeapify(largest);
  }
}
int heapExactMax(){
  int max;
  if(H<1)return -INTFY;
  max=A[1];
  A[1]=A[H];
  H--;
  maxHeapify(1);

  return max;
}

void heapIncreaseKey(int i,int key){
  int chg;
  if(key<A[i])return;
  A[i]=key;
  while (i>1&&A[i/2]<A[i]) {
    chg=A[i];
    A[i]=A[i/2];
    A[i/2]=chg;
    i=i/2;
  }
}

void insert(int key){
  H++;
  A[H]=-INTFY;
  heapIncreaseKey(H,key);
}
int main(){
  int key;
  char com[10];

  while (1) {
    scanf("%s\n",com);
    if(com[0]=='e'&&com[1]=='n')break;
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",heapExactMax());
    }
  }
  return  0;
}



Measured memory_bytes: 5636
//新幹線からAC

#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
using namespace std;
    
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
    
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
    
class fact {
public:
    int fmod = 1e9+7;
    vector<int> fac, inv;
    fact (int n, int Mod = 1e9+7) {
        fmod = Mod;
        fac = vector<int>(n,0);
        inv = vector<int>(n,0);
        fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
        for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
    }
    ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
    ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};
    
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return (a / GCD(a,b)) * b;}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}

bool solve() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	int A = a+b;
	int B = c+d;
	if (A > B) cout << "Left" << endl;
	else if (A < B) cout << "Right" << endl;
	else cout << "Balanced" << endl;
}

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

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

int main(){
    int n,k,r,s,p;
    cin>>n>>k;
    cin>>r>>s>>p;
    string t;
    cin>>t;

    int ans = 0;

    for(int i=0; i<k; i++){
        vector<int> dp(3,0);
        for(int j=i; j<n; j += k){
            vector<int> cur(3);
            if(t[j] == 's') cur[0] = r;
            if(t[j] == 'p') cur[1] = s;
            if(t[j] == 'r') cur[2] = p;

            vector<int> add(3,0);

            for(int m=0; m<3; m++){
                for(int n=0; n<3; n++){
                    if(m != n) add[m] = max(add[m],dp[n]+cur[m]);
                }
            }

            for(int m=0; m<3; m++) dp[m] = add[m];
        }
        ans += *max_element(dp.begin(),dp.end());
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

int main(){
  
  int a,b,c,d; cin>>a>>b>>c>>d;
  if(a+b>c+d)cout<<"Left"<<endl;
  else if(a+b<c+d)cout<<"Right"<<endl;
  else cout<<"Balanced"<<endl;
}



Measured memory_bytes: 3588
X, Y = input().split()
dic = {'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15}
if dic[X] > dic[Y]:
  print('>')
elif dic[X] == dic[Y]:
  print('=')
else:
  print('<')
  


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * BMI
 */
public class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			StringTokenizer st = new StringTokenizer(line, ",");
			String i = st.nextToken();
			int w = (int) (Double.parseDouble(st.nextToken()) * 10000);
			int h = (int) (Double.parseDouble(st.nextToken()) * 100);

			if (w / (h * h) >= 25) {
				System.out.println(i);
			}
		}

	}

}

Measured memory_bytes: 16900
# Binary Indexed Tree (Fenwick Tree)
from collections import defaultdict
class BIT:
  def __init__(self, n):
    self.n = n
    self.data = [0]*(n+1)
    self.el = [0]*(n+1)
  def sum(self, i):
    s = 0
    while i > 0:
      s += self.data[i]
      i -= i & -i
    return s
  def add(self, i, x):
    # assert i > 0
    self.el[i] += x
    while i <= self.n:
      self.data[i] += x
      i += i & -i
  def get(self, i, j=None):
    if j is None:
      return self.el[i]
    return self.sum(j) - self.sum(i-1)

def solve():
  ans = 0
  N = int(input())
  bit = BIT(N)
  A = list(map(int, input().split()))
  dic = {a:i+1 for i,a in enumerate(sorted(A))}
  for i in range(N):
    A[i] = dic[A[i]]
  for i in range(N):
    ans += i - bit.sum(A[i])
    bit.add(A[i],1)
  return ans
print(solve())


Measured memory_bytes: 42256
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

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

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s, t; cin >> s >> t;
    int n = s.size(), m = t.size();

    int result = INT_MAX;
    for (int i = 0; i < n-m+1; i++)
    {
        int cnt = 0;
        for (int j = 0; j < m; j++)
            cnt += (s[i+j] != t[j]);
        result = min(result, cnt);
    }

    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int main() {
	int x;

	cin >> x;

	if (x < 1200)cout << "ABC" << endl;
	else cout << "ARC" << endl;






	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  long long int n,k;
  long long int all[300006];
  long long int attackTimes=0;
  cin>>n>>k;
  for(long long int i = 0;i<n;i++)
  	cin>>all[i];
  sort(all,all+n);
   //cout<<all[0]<<endl;
  long long int t=n-k;
 if(k>=n)
 {
   cout<<attackTimes<<endl;
   return 0;
 }
  else
  {
    for(long long int i =0;i<t;i++)
      attackTimes+=all[i];
  }
  cout<<attackTimes<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define all(a) (a).begin(),(a).end()
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);

    int n ;
    cin >> n;

    const int hell = 1e9 + 7;

    auto binpow = [&](int a,int b){
        int res = 1;
        while(b){
            if(b&1) (res *= a) %= hell;
            ( a *= a )%= hell;
            b = b/2;
        }
        return res;
    };

    if(n == 1){
        cout << 0 << endl;
    }else{
        cout << ( 3* hell + binpow(10,n) - 2*binpow(9,n) + binpow(8,n) ) % hell << endl;
    }

    return 0;
}


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

int main() {
	int n;
	scanf("%d", &n);
	if (__builtin_popcount(n) == 1) {
		puts("No");
		return 0;
	}
	puts("Yes");
	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2, n + 2, n + 3);
	for (int i = 4; i < n; i += 2) {
		printf("1 %d\n", i);
		printf("%d %d\n", i, i + n + 1);
		printf("1 %d\n", i + 1);
		printf("%d %d\n", i + 1, i + n);
	}
	if ((n & 1) == 0) {
		for (int i = 2; i <= n; ++i) {
			int j = i ^ n ^ 1;
			if (i != 3 && j != 3 && j <= n) {
				printf("%d %d\n%d %d\n", i, n, j, 2 * n);
				break;
			}
		}
	}
}

Measured memory_bytes: 3788
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        FastScanner sc = new FastScanner();

        int n = sc.nextInt();
        int k = sc.nextInt();

        int dp[][] = new int[n][2];

        for(int i = 0;i < n;i++){
            dp[i][1] = Integer.MAX_VALUE - 100;
        }

        dp[0][0] = sc.nextInt();
        dp[0][1] = 0;

        for(int i = 1;i < n;i++){
            dp[i][0] = sc.nextInt();
            for(int j = Math.min(k,i);j > 0 ;j--){
                dp[i][1] = Math.min(dp[i][1],dp[i-j][1] + Math.abs(dp[i-j][0] - dp[i][0]));
//                System.out.println(dp[i-j][1] + Math.abs(dp[i-j][0] - dp[i][0]));
            }
//            System.out.println(dp[i][1]);
        }
        System.out.println(dp[n-1][1]);




    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 24888
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
A.reverse()
B.reverse()
C.reverse()

data=[]

for i in range(0,X):
  if i+1>K: break
    
  for j in range(0,Y):
    if (i+1)*(j+1)>K: break
    
    for k in range(0,Z):
      if (i+1)*(j+1)*(k+1)>K: break
      data.append(int(A[i]+B[j]+C[k]))
        
    
data.sort()
data.reverse()

for l in range(K):
  print(data[l])


Measured memory_bytes: 8708
package main

import (
	"bufio"
	"fmt"
	"os"
)

var writer = bufio.NewWriter(os.Stdout)

func main() {
	var K, A, B int
	fmt.Scan(&K, &A, &B)

	ret := 1
	if B-A <= 2 {
		ret += K
	} else {
		yen := 0
		for i := 0; i < K; i++ {
			if yen >= 1 {
				ret += B
				yen--
				continue
			}
			if ret >= A && K-i > 1 {
				ret -= A
				yen++
				continue
			}

			ret++
		}
	}

	fmt.Fprintf(writer, "%d\n", ret)
	writer.Flush()
}


Measured memory_bytes: 640
use std::collections::{HashMap, VecDeque};
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
struct Main {
    n: usize,
    a: Vec<i32>,
}
impl Main {
    fn invoke(&mut self) {
        let mut m: HashMap<i32, i64> = HashMap::new();
        for &a_one in self.a.iter() {
            match m.get(&a_one).cloned() {
                None => {
                    m.insert(a_one, 1);
                }
                Some(v) => {
                    m.insert(a_one, v + 1);
                }
            }
        }
        let mut all = 0;
        for (_, &v) in m.iter() {
            all += v * (v - 1) / 2
        }
        for i in 0..self.n {
            let tg = self.a[i];
            let v = m.get(&tg).cloned().unwrap();
            let minus = v * (v - 1) / 2;
            let plus = (v - 1) * (v - 2) / 2;
            let res = all - minus + plus;
            println!("{}", res);
        }
    }
}
fn main() {
    let n: usize = read();
    let mut a: Vec<i32> = vec![0; n];
    for i in 0..n {
        a[i] = read();
    }
    Main { n: n, a: a }.invoke()
}


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

int main(){
	int n, a;
	cin >> n >> a;
	int x[n];
	for(int i = 0; i < n; i++){
		cin >> x[i];
		x[i] -= a;
	}
	map<int, int64_t> m;
	m[0] = 1;
	for(int i = 0; i < n; i++){
		map<int, int64_t> next;
		for(auto p:m){
			next[p.first] += p.second;
			next[p.first + x[i]] += p.second;
		}
		m = next;
	}
	cout << m[0] - 1 << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<40;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

main(){
  ll n,a,b,c,ans=1e9;
  string s,t;
  cin>>s>>t;
  cin>>a>>b;
  string u;
  cin>>u;
  if(s==u)a--;
  if(t==u)b--;
  cout<<a<<" "<<b;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int LL
#define sqr(x) ((x)*(x))
using namespace std;
typedef long long LL;
const int MAX_N=1000005;
int n;
int C;
int h[MAX_N];
int dp[MAX_N];
int q[MAX_N];
int l=1,r=1;
double f(int i,int j)
{
    return 1.0*(dp[i]-dp[j]+sqr(h[i])-sqr(h[j]))/(2*(h[i]-h[j]));
}
signed main()
{
    cin>>n>>C;
    for(int i=1;i<=n;i++)cin>>h[i];
    dp[1]=0;
    q[1]=1;
	for(int i=2;i<=n;i++)
    {
        while(l<r && f(q[l],q[l+1])<=h[i])l++;
        int j=q[l];
        dp[i]=dp[j]+sqr(h[i]-h[j])+C;
        while(l<=r && f(q[r-1],q[r])>=f(q[r],i))r--;
        q[++r]=i;
    }
    cout<<dp[n]<<endl;
    return 0;
}

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

using namespace std;

int main(void) {
    long int n, k;
    long int min, max;
    long int sum = 0;
    cin >> n >> k;
    for(long int i = k; i <= n + 1; i++){
        min = i * (i - 1) / 2;
        max = ((n - i + 1) + n) * i / 2;
        sum += max - min + 1;
        //cout << "min = " << min << " max = " << max << endl;
    }

    cout << sum % 1000000007 << endl;
    return 0;
}


Measured memory_bytes: 3604
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	n, m, k := scanInt(), scanInt(), scanInt()
	a := make([]int, n+1)
	for i := 1; i <= n; i++ {
		a[i] = scanInt() + a[i-1]
	}
	b := make([]int, m+1)
	for i := 1; i <= m; i++ {
		b[i] = scanInt() + b[i-1]
	}

	ans := 0
	p := len(b) - 1
	for i := range a {
		if a[i] > k {
			break
		}
		for j := p; j >= 0; j-- {
			if a[i]+b[j] <= k {
				p = j
				ans = max(ans, i+j)
				break
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7824