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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	int k; cin>>k;
	for (int i=0; i<k; i++) {
		if (a>=b) b*=2;	
		else {
		if (b>=c) c*=2;
		}
	}
	cout<<(a<b&&b<c?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 3604
s = list(input())
t = list(input())
s.sort()
t.sort(reverse=True)
for i in range(min(len(s), len(t))):
    if ord(s[i]) < ord(t[i]):
        print("Yes")
        exit()
    elif ord(s[i]) > ord(t[i]):
        print("No")
        exit()
print("Yes" if len(s) < len(t) else "No")

Measured memory_bytes: 9016
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var k = cin.ReadInt;
            var s = cin.ReadInt;

            var ans = 0;
            for (int x = 0; x <= k; x++)
            {
                for (int y = 0; y <= k; y++)
                {
                    if (s - (x + y) >= 0 && s - (x + y) <= k)
                    {
                        ans++;
                    }
                }
            }

            WriteLine(ans);
        }
    }

    public static class Extensions
    {
        
    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }

        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }

        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        public double[] ReaddoubleArray(long N) { var ret = new double[N]; for (long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    ll a,b;
    cin >> a >> b;
    
    cout << (ll)(a / __gcd(a, b) * b);

    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define ll long long
#define L long
#define endl "\n"
#define mset(x, val) memset(x, val, sizeof(x))
#define For(i, init, n) for (ll int i = init; i < n; i++)
#define ___ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const double PI = acos(-1.0), E = exp(1.0), EPS = DBL_EPSILON;
const ll int MOD = (ll int)1e9 + 7, N = (ll int)1e5;

int main()
{   
#ifdef MY_PREPROCESSOR
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ___
    
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
    {
        cout<< 'x';
    }
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> v(n);
	while (q--) {
		int a;
		cin >> a;
		a--;
		v[0]++;
		if (a < v.size()) {
			v[a]--;
		}
		if (a + 1 < v.size()) {
			v[a + 1]++;
		}
	}
	int sum = 0;
	for (int i = 1; i < v.size(); i++) {
		v[i] += v[i - 1];
	}
	for (int i = 0; i < v.size(); i++) {
		if (v[i] >= k) {
			cout << "No\n";
		}
		else {
			cout << "Yes\n";
		}
	}
	// cout << "Yes";
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024
import sys
import bisect
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    minus, plus, zero = [], [], 0
    for i in range(n):
        if a[i] < 0:
            minus.append(a[i])
        elif a[i] > 0:
            plus.append(a[i])
        else:
            zero += 1
    
    minus_count = len(minus) * len(plus)
    zero_count = zero * (zero - 1) // 2 + zero * (len(minus) + len(plus))

    minus.sort()
    plus.sort()

    if k <= minus_count:
        l, r = -int(1e18), 0
        while r-l > 1:
            value = (r + l) // 2
            count = 0
            border = 0
            for v in minus:
                while border < len(plus) and v * plus[border] > value:
                    border += 1 
                count += len(plus) - border

            if count >= k:
                r = value
            else:
                l = value

        ans = r

    elif k <= zero_count + minus_count:
        ans = 0
        
    else:
        l, r = 0, int(1e18)
        count_default = minus_count + zero_count
        while r-l > 1:
            value = (r + l) // 2
            count = 0
            
            border = 0
            for v in minus:
                while border < len(minus) and v * minus[-border-1] <= value:
                    border += 1
                count += border
                if border > 0 and v >= minus[-border]:
                    count -= 1
            
            border = 0
            for v in plus:
                while border < len(plus) and v * plus[-border-1] > value:
                    border += 1
                count += len(plus) - border
                if border < len(plus) and v <= plus[-border-1]:
                    count -= 1

            count //= 2
            count += count_default

            if count >= k:
                r = value
            else:
                l = value
        ans = r
        
    print(ans)

    
if __name__ == "__main__":
    main()


Measured memory_bytes: 105664
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

n = ii()
a = li()
ans = []

while 1:
    rem = 0
    for i in range(len(a), 0, -1):
        if a[i - 1] == i:
            ans.append(i)
            del a[i - 1]
            rem = 1
            break
    if not rem: break

if a:
    print(-1)
else:
    print(*ans[::-1], sep='\n')

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

int main() {
  string a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "<" << endl;
  }
  else if (a > b) {
    cout << ">" << endl;
  }
  else {
    cout << "=" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll  long long
#define ull unsigned long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd double
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
using namespace std;

int main(){ 
    ll n;
	cin>>n;
    n%=10;
    if(n==2 or n==4 or n==5 or n==7 or n==9) cout<<"hon";
    if(n==0 or n==1 or n==6 or n==8) cout<<"pon";
    if(n==3) cout<<"bon";
	
	  	  
    
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);


	ll a, b;

	cin >> a >> b;

	if (min(a, b) == 1)
		cout << 1 << '\n';
	else
		cout << (a * b + 1) / 2 << '\n';


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back


int main()
{
    ll N, M;
    cin >> N >> M;
    vec x(M), y(M);
    REP(i,0,M) {
        cin >> x[i] >> y[i];
        --x[i]; --y[i];
    }

    vec B(N, 1);
    vector<bool> F(N, false);
    F[0] = true;

    REP(i,0,M) {
        if(F[x[i]]) {
            if(B[x[i]] == 1) F[x[i]] = false;
            F[y[i]] = true;
        }
        --B[x[i]];
        ++B[y[i]];
    }

    ll cnt = 0;
    REP(i,0,N) cnt += F[i];
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 5520
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.length();i++){
    if(s[i]=='1'){
      cout<<'9';
    }else if(s[i]=='9'){
      cout<<'1';
    }else{
      cout<<s[i];
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll K;
  cin >> K;
  string S;
  cin >> S;
  if (S.size() <= K) {
    cout << S << "\n";
  }
  else {
    for (ll i = 0; i < K; ++i) {
      cout << S[i];
    }
    cout << "..." << "\n";
  }
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;
  cin>>a>>b;
  cout<<max({a+a-1,a+b,b+b-1})<<endl;
  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin>>str;
  int len=str.size();
  if(str.substr(0,len/2)==str.substr(len/2+1,len/2)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return(0);
}


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

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

  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  vector<ll> l;
  l.push_back(A[0]);
  
  for (int i = 1; i < N; i++) {
    auto p = lower_bound(l.begin(), l.end(), A[i]);
    if (p == l.end()) {
      l.push_back(A[i]);
    } else {
      l.erase(p);
      auto p = upper_bound(l.begin(), l.end(), A[i]);
      l.insert(p, A[i]);
    }
  }

  cout << l.size() << "\n";
  return 0;
}


Measured memory_bytes: 4620
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <cstdlib>
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define INF 100000000
#define _INF -100000000
#define INFLL (long long)1e14
#define _INFLL (long long)-1e14
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> P;

class self_made_pq {
public:
	vi heap;
	int n, inf;
	bool ord; //true????????§??????????????????pop
	bool comp(int a, int b){
		if (ord) return a > b;
		else return a < b;
	}
public:
	self_made_pq(int N, bool b) {
		heap.resize(N * 2 - 1);
		ord = b;
		if (ord) inf = INT_MIN;
		else inf = INT_MAX;
		fill(heap.begin(), heap.end(), inf);
		n = 0;
	}
	void ins(int a) {
		heap[n] = a;
		n++;
		int k1 = n - 1, k2 = n - 1;
		while (k2 > 0) {
			k2 = (k1 - 1) / 2;
			if (comp(heap[k1], heap[k2])) swap(heap[k1], heap[k2]);
			else break;
			k1 = k2;
		}
	}
	int pop() {
		if (n == 0) return inf;
		int ret = heap[0];
		heap[0] = heap[n - 1];
		heap[n - 1] = inf;
		n--;
		int k1 = 0, k2 = 0;
		while (true) {
			k2 = k1 * 2 + 1;
			if (comp(heap[k2], heap[k1])) {
				if (comp(heap[k2 + 1], heap[k2])) {
					swap(heap[k2 + 1], heap[k1]);
					k1 = k2 + 1;
				}
				else {
					swap(heap[k2], heap[k1]);
					k1 = k2;
				}
			}
			else if (comp(heap[k2 + 1], heap[k1])) {
				swap(heap[k2 + 1], heap[k1]);
				k1 = k2 + 1;
			}
			else break;
		}
		return ret;
	}
};



int main() {
	self_made_pq pq(2e6, true);
	while (true) {
		string s; cin >> s;
		if (s == "end") break;
		else if (s == "extract") cout << pq.pop() << endl;
		else {
			int x; cin >> x;
			pq.ins(x);
		}
		int t = 1;
	}
	return 0;
}

Measured memory_bytes: 18188
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int N,L;
  cin>>N>>L;
  int A[210];
  int B[210];
  for (int i=0; i<N; i++) A[i]=L+i;
  for (int i=0; i<N; i++) B[i]=abs(A[i]);
  sort(B,B+N);
  int D=B[0];
  int sum=0;
  for (int i=0; i<N; i++) sum+=A[i];
  if (L+N-1<=-1) cout<<sum+D<<endl;
  else cout<<sum-D<<endl;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int l=0,a[100010]={0},u=0,v=0;
	bool L=false;
	while(v!=s.size())
	{
		if(!L)
		{
			u=s.find('L',l);
			v=s.find('R',u);
			if(v==-1)
			{
				v=s.size();
			}
			if((v-l)%2==0)
			{
				a[u]+=(v-l)/2;
				a[u-1]+=(v-l)/2;
			}
			else
			{
				if((v-u)>(u-l))
				{
					a[u-1]+=(v-l-1)/2;
					a[u]+=(v-l-1)/2+1;
					if((v-u)%2==0)
					{
						int temp;
						temp=a[u-1];
						a[u-1]=a[u];
						a[u]=temp;
					}
				}
				else
				{
					a[u]+=(v-l-1)/2;
					a[u-1]+=(v-l-1)/2+1;
					if((u-l)%2==0)
					{
						int temp;
						temp=a[u-1];
						a[u-1]=a[u];
						a[u]=temp;
					}
				}
			}
			L=true;
			l=u; 
		}
		else
		{
			u=s.find('R',l);
			L=false;
			l=u;
		}
	}
	for(int j=0;j<s.size();j++)
	{
		cout<<a[j]<<" ";
	}
	return 0;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename T>
struct cumulative_sum {
    int n;
    T ZERO;
    std::vector<T> data;
    template<typename I> cumulative_sum(I begin, I end, T ZERO = T())
        : n(end - begin), ZERO(ZERO), data(n + 1, ZERO) {
        std::copy(begin, end, data.begin() + 1);
        for (int i = 0; i < n; i++) { data[i + 1] += data[i]; }
    }
    T get_sum(int l, int r) const {
        if (l >= r || l > n || r < 0) { return ZERO; }
        if (l < 0) { l = 0; }
        if (r > n) { r = n; }
        return data[r] - data[l];
    }
};

int N;
int A[220000];
signed main() {
    cin >> N;
    rep(i, N) { cin >> A[i]; }
    cumulative_sum<int> cs(A, A + N);
    int ans = LLONG_MAX;
    for (int i = 1; i < N; i++) {
        chmin(ans, abs(cs.get_sum(0, i) - cs.get_sum(i, N)));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  ll n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  sort(all(a));
  vector<P> p;
  reps(i,1,n-1){
    if(a[i]<0){
      p.push_back(P(a[n-1],a[i]));
      a[n-1]-=a[i];
    }else{
      p.push_back(P(a[0],a[i]));
      a[0]-=a[i];
    }
  }
  p.push_back(P(a[n-1],a[0]));
  cout<<a[n-1]-a[0]<<endl;
  rep(i,n-1){
    cout<<p[i].first<<" "<<p[i].second <<endl;
  }
}

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

int main(void){
    char s[200200],t[200200];
    scanf("%s%s",s,t);
    long cnt = 0;
    long slen = strlen(s);
    for(long i = 0;i < slen;i++)if(s[i] != t[i])cnt++;
    printf("%ld",cnt);
}

Measured memory_bytes: 2124
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n,temp;
    vector<int>ans;
    scanf("%d%d",&n,&temp);
    ans.push_back(temp);
    while(n--){
        scanf("%d",&temp);
        if(temp>ans.back())ans.push_back(temp);
        else *lower_bound(ans.begin(),ans.end(),temp)=temp;
    }
    printf("%d\n",ans.size());
}

Measured memory_bytes: 3000
S = list(input())
S.reverse()

c = [0 for _ in range(len(S))]
l_start_index = 0
l_end_index = -1
r_start_index = -1
r_end_index = -1

# def count():
#     s = r_end_index - l_start_index + 1
#     if s % 2 == 0:
#         c[l_end_index] = s // 2
#         c[r_start_index] = s // 2
#     else:
#         if l_end_index % 2 == 0:
#             c[l_end_index] = s // 2 + 1
#             c[r_start_index] = s // 2
#         else:
#             c[l_end_index] = s // 2
#             c[r_start_index] = s // 2 + 1


def count2():
    for i in range(l_start_index, r_end_index + 1):
        if (r_start_index - i) % 2 == 0:
            c[r_start_index] += 1
        else:
            c[l_end_index] += 1


for i in range(len(S) - 1):
    if S[i] == 'L' and S[i + 1] == 'R':
        l_end_index = i
        r_start_index = i + 1
    if S[i] == 'R' and S[i + 1] == 'L':
        r_end_index = i
        count2()
        l_start_index = i + 1
else:
    r_end_index = i + 1
    count2()

c.reverse()
for i in c:
    print(i)


Measured memory_bytes: 5552
import numpy as np
N = int(input())
A = np.zeros([2, N], dtype=int)
A[0] = list(map(int, input().split()))
A[1] = list(map(int, input().split()))

B = A.cumsum(axis=1)
ans = 0
for i in range(N):
    b1 = B[0][i]
    if i == 0:
        b2 = B[1][-1]
    else:
        b2 = B[1][-1] - B[1][i-1]
    ans = max(ans, b1+b2)
print(ans)

Measured memory_bytes: 12420
T = [int(input()) for _ in range(5)]
T.sort(key=lambda x:x % 10 if x % 10 != 0 else 10)

ans = 0
ans += T[0]
for i in range(1,5):
  ans += T[i]
  if T[i] % 10 != 0:
    ans += 10 - T[i] % 10
print(ans)


Measured memory_bytes: 8968
while 1:
    n = int(input())
    if n == 0:break
    md = [0,0,0]
    for i in range(n):
        p = list(map(int,input().split()))
        if md[1]+md[2] < p[1]+p[2]:
            md = p
    print(md[0],str(md[1]+md[2]))

        
        

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

using namespace std;

int n, k, *w;

bool f(int p)
{
	int c = k, total = 0;
	int i = 0;
	while (c--)
	{
		total = 0;
		while (i < n && total + w[i] <= p)
		{
			total += w[i];
			i++;
		}
	}
	if (i < n)
	    return false;
	else
	    return true;
}

int main(void)
{
	int i, sum = 0;
	scanf("%d %d", &n, &k);
	w = new int[n];
	for (i = 0; i < n; i++)
	{
		scanf("%d", &w[i]);
		sum += w[i];
	}
	int left = w[0];
	int right = sum;
	int mid;
	while (left < right)
	{
		mid = (left + right) / 2;
		if (f(mid))
		    right = mid;
		else
		    left = mid + 1;
	}
	printf("%d\n", right);
}


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

#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=305;
int a[N][N],h[N],c[N];

int main()
{
	//freopen("1.in","r",stdin);
	int n,m;
	cin>>n>>m;
	rep(i,1,n)
	rep(j,1,m)scanf("%d",a[i]+j);
	rep(i,1,n)++c[a[i][h[i]=1]];
	int ans=n;
	rep(tmp,1,m)
	{
		int mj=1;
		rep(j,2,m)
		if(c[j]>c[mj])mj=j;
		ans=min(ans,c[mj]);
		c[mj]=-1;
		rep(i,1,n)
		{
			--c[a[i][h[i]]];
			while(c[a[i][h[i]]]<0)++h[i];
			++c[a[i][h[i]]];
		}
	}
	cout<<ans;
}

Measured memory_bytes: 640
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp;
  writefln("%s%s%s", s[0], s.length - 2, s[$-1]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

// abc128b
bool comparation(pair<pair<string, int>, int> a, pair<pair<string, int>, int> b){
    if (a.first.first != b.first.first){
        return a.first.first < b.first.first;
    }else{
        return a.first.second > b.first.second;
    }
}
int main(){
    int n;
    cin >> n;
    vector<pair<pair<string, int>, int>> sp;
    rep(i, n){
        string s;
        int p;
        cin >> s >> p;
        sp.push_back(make_pair(make_pair(s, p), i));
    }
    sort(sp.begin(), sp.end(), comparation);
    rep(i, n){
        cout << sp[i].second+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int INF = 1000000000;
int di[] = {1, 0, -1, 0};
int dj[] = {0, 1, 0, -1};

int main() {
    int H, W; cin >> H >> W;
    int Ch, Cw; cin >> Ch >> Cw;
    int Dh, Dw; cin >> Dh >> Dw;
    Ch--, Cw--, Dh--, Dw--;
    vector<string> S(H);
    for (int i = 0; i < H; i++) cin >> S[i];

    vector<vector<int>> D(H, vector<int>(W, INF));
    deque<P> q;
    D[Ch][Cw] = 0;
    q.push_back({Ch, Cw});
    while(!q.empty()) {
        int i = q.front().first;
        int j = q.front().second;
        int d = D[i][j];
        q.pop_front();
        for (int idx = 0; idx < 4; idx++) {
            int ni = i + di[idx], nj = j + dj[idx];
            if (ni < 0 || nj < 0 || H <= ni || W <= nj) continue;
            if (S[ni][nj] == '#') continue;
            if (D[ni][nj] <= d) continue;
            D[ni][nj] = d;
            q.push_front({ni, nj});
        }
        for (int ai = -2; ai <= 2; ai++) {
            for (int aj = -2; aj <= 2; aj++) {
                int ni = i + ai, nj = j + aj;
                if (ni < 0 || nj < 0 || H <= ni || W <= nj) continue;
                if (S[ni][nj] == '#') continue;
                if (D[ni][nj] <= d + 1) continue;
                D[ni][nj] = d + 1;
                q.push_back({ni, nj});
            }
        }
    }
    int ans = D[Dh][Dw];
    if (ans == INF) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 9532
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
typedef long long ll;
const int INF = 1e+9+7;
using ipair= pair<int,int>;
bool operator>(const ipair a,const ipair b){return a.first > b.first;};

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> P(M),Y(M);
    vector<priority_queue<ipair,vector<ipair>,greater<ipair>>> V(N);
    rep(i,M){
        cin >> P[i] >> Y[i];
        V[P[i]-1].push({Y[i],i});
    }

    ipair p;
    vector<ipair> ans(M);
    int x;
    rep(i,N){
        x=0;
        while(!V[i].empty()){
            x++;
            p = V[i].top();
            ans[p.second].first=(i+1);
            ans[p.second].second=x;
            V[i].pop();
        }
    }

    rep(i,M){
        printf("%06d%06d\n",ans[i].first,ans[i].second);
    }

    


}


Measured memory_bytes: 9344
import java.util.Scanner;

public class Main {
	final static String zero = "0000000";

	public static void main(String[] args) {
		int[] num = { 077, 06, 0133, 0117, 0146, 0155, 0175, 047, 0177, 0157 };
		int n;
		Scanner in = new Scanner(System.in);
		while ((n = in.nextInt()) != -1) {
			int now = 0;
			int next;
			while (n-- > 0) {
				next = num[in.nextInt()];
				final String binaryString = Integer.toBinaryString(now ^ next);
				System.out.print(zero.substring(binaryString.length()));
				System.out.println(binaryString);
				now = next;
			}
		}
	}

}

Measured memory_bytes: 20712
package main

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

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, K, A := nextInt(), nextInt(), []int{}
	for i := 0; i < N; i++ {
		A = append(A, nextInt())
	}

	fmt.Printf("%d\n", JSC2019QualB(K, A))
}

// JSC2019QualB ...
func JSC2019QualB(K int, A []int) int {
	cnt1, cnt2 := 0, 0
	for i := 0; i < len(A); i++ {
		for j := 0; j < len(A); j++ {
			if A[i] > A[j] {
				cnt1++
				if i < j {
					cnt2++
				}
			}
		}
	}

	mod := 1000000007
	cmb := K * (K - 1) / 2 % mod

	return (cnt2*K + cmb*cnt1) % mod
}


Measured memory_bytes: 1876
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 30;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n, m;
int dp[ 16 ][ 16 ];
int _array[ 16 ][ 16 ];
VI can_start;

int solve( int now, int x ) {
	if ( now >= m ) {
		return 1;
	}
	if ( _array[ now ][ x ] == 1 ) {
		return 0;
	}
	if ( now >= m - 1 ) {
		return 1;
	}
	if ( dp[ now ][ x ] >= 0 ) {
		return dp[ now ][ x ];
	}
	int res = 0;
	if ( _array[ now ][ x ] == 2 ) {
		res += solve( now + 2, x );
	}
	else {
		for ( int i = 0; i < 3; i++ ) {
			if ( x + dx[ i ] < 0 || x + dx[ i ] >= n || ( now + 1 != m && _array[ now + 1 ][ x + dx[ i ] ] == 2 && dx[ i ] != 0 ) ) {
				continue;
			}
			res += solve( now + 1, x + dx[ i ] );
		}
	}
	return dp[ now ][ x ] = res;
}

int main() {
	while ( ~scanf( "%d %d", &n, &m ) && n != 0 && m != 0 ) {
		for ( int i = 0; i < m; i++ ) {
			for ( int j = 0; j < n; j++ ) {
				scanf( "%d", &_array[ i ][ j ] );
				if ( i == 0 && _array[ i ][ j ] == 0 ) {
					can_start.push_back( j );
				}
			}
		}
		NCLR( dp );
		int ans = 0;
		for ( int i = 0; i < can_start.size(); i++ ) {
			ans += solve( 0, can_start[ i ] );
		}
		printf( "%d\n", ans );
		can_start.clear();
	}
	return 0;
}

Measured memory_bytes: 1208
k = gets.split.map(&:to_i).pop
X,Y,Z = 3.times.map{ gets.split.map(&:to_i).sort.reverse }
YZ = Y.product(Z).map{|y,z| y + z }.sort.reverse
puts (YZ.size > k ? YZ.shift(k) : YZ).product(X).map{|x,yz| x + yz}.sort.reverse.shift(k)

Measured memory_bytes: 286160
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	LL ans = 0;
	LL ama = 0;
	LL A;
	for(int i=1;i<=N;++i){
		cin >> A;
		if( ama && A ){
			++ans;
			ama = 0;
			A -= 1;
		}
		ans += A/2;
		ama = A&1;
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
import numpy as np

H,W = map(int,input().split())
use = np.zeros((H,W),dtype=int)
for i in range(H):
    s = input()
    for j,st in enumerate(s):
        if st == ".":
            use[i][j] = 10**10
        else:
            use[i][j] = 0

for i in range(1,H):
    use[i,:] = np.minimum(use[i,:],use[i-1,:]+1)
for i in reversed(range(H-1)):
    use[i,:] = np.minimum(use[i,:],use[i+1,:]+1)
for j in range(1,W):
    use[:,j] = np.minimum(use[:,j],use[:,j-1]+1)
for j in reversed(range(W-1)):
    use[:,j] = np.minimum(use[:,j],use[:,j+1]+1)

print(np.max(use))

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll digsum(ll n){
    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main()
{
    ll a,b;
    cin >> a >> b;
    cout << ((a % b == 0)?0:1) << endl;
    return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,a[100001],b,ans;

signed main() {
    cin >> n;
    rep(i,n+1) cin >> a[i];
    rep(i,n) {
        cin >> b;
        ans += min(b,a[i]);
        b -= min(b,a[i]);
        ans += min(b,a[i+1]);
        a[i+1] -= min(b,a[i+1]);
    }
    cout << ans << endl;
}





Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define inn ll arr[n]; for(int i=0;i<n;i++) cin>>arr[i];
#define fora(i,n); for(ll i=0;i<n;i++)
#define forb(i,a,n); for(int i=a;i<n;i++)
#define mod 1000000007

int main()
{

//THIS CODE IS CREATED BY ANSHJAIN18
ll n,k,s;
cin>>n>>k>>s;
for(ll i=0;i<k;i++)
    cout<<s<<" ";
if(s!=1000000000)
{
    for(ll i=k;i<n;i++)
        cout<<s+1<<" ";
}
else for(ll i=k;i<n;i++)
    cout<<1<<" ";



return 0; }

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,e,k;
  
  
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  cin >> k;
  
  
  if (e-a <= k){
    cout <<"Yay!"<<endl;
  }
  else{
    cout << ":("<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long int a,b,i=1;
    cin>>a>>b;
    if(a>b){
        swap(a,b);
    }
    for(;;){
        if(a*i%b==0){
            break;
        }else{
            i++;
        }
    }
    cout<< a*i <<endl;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  ll N, M, K; cin >> N >> M >> K;
  rep(i, N + 1) rep(j, M + 1) {
    if (i * M + j * N - 2 * i * j == K) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 10000

int main(){
  short *A,*B;
  int C[MAX+1];
  int n,i;

  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  for(i=0; i<=MAX; i++) C[i] = 0;

  for(i=0; i<n; i++){
    scanf("%d",&A[i+1]);
    C[A[i+1]]++;
  }

  for(i=1; i<=MAX; i++) C[i] = C[i]+C[i-1];

  for(i=n; i>0; i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }

  for(i=1; i<=n-1; i++){
    printf("%d ",B[i]);
  }

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


Measured memory_bytes: 9548
import sys
from math import sqrt
from bisect import bisect

inf = 1<<30

def solve():
    primes = eratos(2 * 10**5)

    while 1:
        N, P = map(int, sys.stdin.readline().split())

        if N == P == -1:
            return

        j = bisect(primes, N)

        lprimes = primes[j:j + 100]

        made = []

        for i in range(100):
            for j in range(i, 100):
                made.append(lprimes[i] + lprimes[j])

        made.sort()

        ans = made[P - 1]

        print(ans)


def eratos(n):
    s = [True] * n
    s[0] = s[1] = False

    for p in range(2, int(sqrt(n)) + 1):
        if s[p]:
            for q in range(p*p, n, p):
                s[q] = False

    return [i for i in range(2, n) if s[i]]

if __name__ == '__main__':
    solve()

Measured memory_bytes: 9548
H,W = map(int,input().split())
ans = 1000000000000
if H >= 3:
    if H % 3 == 0:
        ans = 0
    else:
        ans = min(ans,W)
if W >= 3:
    if W % 3 == 0:
        ans = 0
    else:
        ans = min(ans,H)

A = H // 2
B = H - A
for i in range(1,W):
    ans = min(ans, max(H*i,A*(W-i),B*(W-i))-min(H*i,A*(W-i),B*(W-i)))

A = W // 2
B = W - A
for i in range(1,H):
    ans = min(ans, max(W*i,A*(H-i),B*(H-i))-min(W*i,A*(H-i),B*(H-i)))
print(ans)


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

typedef long long LL;

const int N=200000;

int n,a[N+9],b[N+9];

void into(){
  scanf("%d",&n);
  for (int i=1;i<=n;++i)
	scanf("%d",&a[i]);
  for (int i=1;i<=n;++i)
	scanf("%d",&b[i]);
}

struct state{
  int x,v;
  state(int X=0,int V=0){x=X;v=V;}
  bool operator < (const state &p)const{return v<p.v;}
};
priority_queue<state>q;
int vis[N+9];
LL ans;

bool Check(int p){
  if (vis[p]) return 0;
  int l=p==1?n:p-1,r=p==n?1:p+1,s=b[l]+b[r];
  return s<=b[p]-a[p];
}

void Get_ans(){
  for (int i=1;i<=n;++i)
	if (b[i]>a[i]) vis[i]=1,q.push(state(i,b[i]));
    else if (b[i]<a[i]) {ans=-1;return;}
  for (;!q.empty();){
	int p=q.top().x;q.pop();
	vis[p]=0;
	int l=p==1?n:p-1,r=p==n?1:p+1;
	int s=b[l]+b[r],t=(b[p]-a[p])/s;
	ans+=t;b[p]-=t*s;
	if (Check(l)) vis[l]=1,q.push(state(l,b[l]));
	if (Check(r)) vis[r]=1,q.push(state(r,b[r]));
  }
  for (int i=1;i<=n;++i)
	if (b[i]>a[i]) ans=-1;
}

void work(){
  Get_ans();
}

void outo(){
  printf("%lld\n",ans);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 7260
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
ll N, A[200000];

ll cost(ll a, ll k) {
  if (k == 0 || k == 4) {
    return a;
  } else if (k == 1 || k == 3) {
    return a < 2 ? 2 - a : a % 2;
  } else {
    return a < 1 ? 1 - a : (a + 1) % 2;
  }
}

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> A[i];

  vector<vector<ll>> dp(N + 1, vector<ll>(5, INF));
  REP(i, 0, 5) dp[0][i] = 0;

  REP(i, 0, N) {
    REP(j, 0, 5) {
      REP(k, 0, j + 1) {
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][k] + cost(A[i], j));
      }
    }
  }

  ll ans = INF;
  REP(i, 0, 5) ans = min(ans, dp[N][i]);
  cout << ans << endl;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<(int64)n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}
 
int main(){
	//in_o();
 	int64 l,r,ans=INT_MAX;
 	cin>>l>>r;	
 	r=min(r,l+2019);
 	FOR(i,l,r+1){
 		FOR(j,i+1,r+1){
 			ans=min(ans,i*j%2019);
 		}
 	}
 	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int n;

  cin >> n;

  vector<int> a(n + 1);

  for (int i = 1; i < n + 1; i++) {
    int tmp;
    cin >> tmp;
    a[tmp] = i;
  }

  for (int i = 1; i < n + 1; i++) {
    cout << a[i] << " ";
  }

  return 0;
}

Measured memory_bytes: 1152
H,W = map(int,input().split())
if W%2 == 0:
  ans = H*(W//2)
else:
  wi = W//2 +1
  #print(wi)
  if H%2 == 0:
    ans =(2*wi - 1)*(H//2)
  else:
    ans = (2*wi - 1)*((H-1)//2) + wi
if H == 1 or W == 1:
  ans = 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<vector<long long int>> v(n);
    for(int i = 0; i < n; i++){
        if(i == n - 1){
            for(int j = 0; j < 3; j++){
                v[i].push_back(0);
            }
        }else{
            for(int j = 0; j < 3; j++){
                long long int x;
                cin >> x;
                v[i].push_back(x);
            }
        }
    }
    vector<long long int> ans;
    for(int k = 0; k <= n - 2; k++){
        long long int t =  v[k][1] + v[k][0];
        for(int i = k + 1; i <= n - 2; i++){
            if(t <= v[i][1]){
               t += (v[i][1] - t) + v[i][0];
            }
            else if(t % v[i][2] == 0){
                t += v[i][0];
            }
            else{
                t += v[i][2] - t % v[i][2] + v[i][0];
            }
        }
        ans.push_back(t);
    }
    for(int i = 0; i < n; i++){
        if(i == n - 1){
            cout << 0 << "\n";
        }else{
            cout << ans[i] << "\n";
        }
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,j;
  int M, N, Q;
  int p,q;
  int **LR;
  int acc;
  scanf("%d %d %d", &N, &M, &Q);
  LR = new int*[N];
  for (i=0 ; i<N; i++){
    LR[i] = new int[N-i]();
  }
  
  for (i=0; i<M; i++){
    scanf("%d %d", &p, &q);
    LR[p-1][q-p] += 1;
  }

  for (i=N-2; 0<=i; i--){
    acc = 0;
    for (j=0; j<N-i; j++){
      acc += LR[i][j];
      LR[i][j] = acc + LR[i+1][j-1];
    }
  }
  
  for (i=0 ; i<Q; i++){
    scanf("%d %d", &p, &q);
    printf("%d\n", LR[p-1][q-p]);
  }
  return 0;
}

Measured memory_bytes: 1408
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
// defines
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define invrep(i,b,a) for(int i = b; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
#define ff first
#define ss second
// typedefs
typedef pair<int,int> ii;
typedef unsigned long long int ull;
typedef long long int ll;
// -------------------------------
int main() {
    ios::sync_with_stdio(false); 
    cin.tie(0);
    int N, K; cin >> N >> K;
    vector<int> values(N), accL(N), accR(N);
    rep(i,0,N) cin >> values[i];
    int ans = 0;    
    rep(l,0,min(N,K)+1) {
        rep(r,0,min(N,K)-l+1) {
            int sum = 0;
            priority_queue<int> q;
            rep(i,0,l) {
                sum += values[i];
                if (values[i] < 0) q.push(-values[i]);
            }
            rep(i,0,r) {
                sum += values[N-i-1];
                if (values[N-i-1] < 0) q.push(-values[N-i-1]);
            }
            int k = K - l - r;
            while (q.size() and k--) {
                sum += q.top(); q.pop();
            }
            ans = max(ans, sum);
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,A[200001];
    cin>>n;
    rep(i,n-1) cin>>A[i];
    ll num[200001]={0};
    rep(i,n-1) num[A[i]]++;
    rep(i,n) cout<<num[i+1]<<"\n";
}


Measured memory_bytes: 6760