akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    int n;
    cin>>n;
    vector<ll> h(n+1),dp(n+1,INF);
    rep(i,n)cin>>h[i+1];
    dp[0]=1000000;
    dp[1]=0;
    for(int i=2;i<=n;i++){
        // cout<<dp[i]<<" "<<abs(h[i]-h[i-1])<<endl;
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
        // cout<<dp[i]<<endl;
    }
    cout<<dp[n]<<endl;
    

//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 1792
whith1 = list(map(int,input().split()))
whith2 = list(map(int,input().split()))
whith3 = list(map(int,input().split()))
b = whith1 + whith2 + whith3
n = int(input())
num = []
for i in range(n):
    x = int(input())
    if x in b :
        b = [0 if i == x else i for i in b]
if b[0] == b[1] == b[2] or b[3] == b[4] == b[5] == 0 or b[6] == b[7] == b[8] == 0:
    print('Yes')
elif b[0] == b[3] == b[6] or b[1] == b[4] == b[7] == 0 or b[2] == b[5] == b[8] == 0:
    print('Yes')
elif b[0] == b[4] == b[8] or b[2] == b[4] == b[6] == 0 or b[6] == b[7] == b[8] == 0:
    print('Yes')
else :
    print('No')

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int gcd(int a, int b) {
    if (b > a) return gcd(b, a);
    else if (b == 0) return a;
    else return gcd(b, a % b); 
}
 int G1[100010], G2[100010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100100];
    rep(i, N) cin >> A[i];
   
    G1[0] = A[0];
    rep(i, N - 1) {
        G1[i + 1] = gcd(G1[i], A[i + 1]);
        //cout << G1[i] << " " << A[i + 1] << "->" << gcd(G1[i], A[i + 1]) <<  endl;
    }
    G2[N - 1] = A[N - 1];
    RREP(i, N - 2, 0) {
        G2[i] = gcd(G2[i + 1], A[i]);
    }
    int ans = G2[1];
    //rep(i, N) cout << G1[i] << " " << G2[i] << endl;
    rep(i, N - 2) {
        ans = max(ans, gcd(G1[i], G2[i + 2]));
    }
    ans = max(ans, G1[N - 2]);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = (1<<30);
 
int main() {
  string s;
  cin >> s;
  if(s[2] == s[3] & s[4] == s[5])
    cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main() {
  int n, a[100];
  scanf("%d", &n);
  for(int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for(int i = n-1; i >= 0; --i) {
    printf("%d", a[i]);
    if(i != 0) {
      printf(" ");
    } else {
      printf("\n");
    }
  }

  return 0;
}



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

class Myon{
    static void Main(string[] args){
        var myon = new Myon();
    }

    public Myon(){
        int N = int.Parse(Console.ReadLine());
        string[] h = Console.ReadLine().Split(' ');
        int max = 0;
        int count = 0;
        for(int i = 0;i < N;i ++){
            if(int.Parse(h[i]) >= max){
                max = int.Parse(h[i]);
                count ++;
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 11092
package main

import (
	"fmt"
	"math"
)

func main(){
	var x0,y0,r0,x1,y1,r1 int32
	var r_max,r_min int32
	var flag int8
	fmt.Scanf("%d %d %d",&x0,&y0,&r0)
	fmt.Scanf("%d %d %d",&x1,&y1,&r1)

	d := math.Sqrt(float64((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1)))
	if r0>r1 {
		r_max=r0
		r_min = r1
	} else {
		r_max=r1
		r_min = r0
	}
	r_sum := r0+r1
	switch  {
	case d > (float64(r_sum)) :		flag = 4
	case d == (float64(r_sum)) :	flag = 3
	case d < (float64(r_sum)) :	{
		if d+float64(r_min)< float64(r_max){
			flag=0
		}else if d+float64(r_min)== float64(r_max) {
			flag = 1
		}else {
			flag = 2
		}
	}
	default:

	}
	fmt.Println(flag)

}


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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    
    return 0;
}

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

int N;
vector<int> b;

void agc032a() {
  vector<int> res;
  for (int i = 0; i < N; i++) {
    int k = -1;

    for (int j = 0; j < b.size(); j++) {
      if (b[j] == j + 1) {
        k = j;
      }
    }

    if (k == -1) {
      cout << "-1\n";
      return;
    }
    else {
      res.push_back(k + 1);
      b.erase(b.begin() + k);
    }
  }

  for (int i = res.size() - 1; i >= 0; i--) {
    cout << res[i] << "\n";
  }

  return;
}

int main() {
  cin >> N;
  b.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  agc032a();
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<set>
#include<math.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 1e9
#define eps 1e-6
#define PI acos(-1.0)
#define M 10010
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int, int>P;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 10;


int main() {
    IOS;
  //freopen("in.txt", "r", stdin);
  //freopen("out.txt","w",stdout);
  int a,b;
  cin >>a>>b;
  for(int i = 1; i < 4 ; ++i)
    if(i * a * b % 2 ==1) {
        cout << "Yes";
    return 0;
    }
  cout << "No";
  return 0;
}


Measured memory_bytes: 256
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n, k;
    cin>>n>>k;

    vector<double> v(n), psum(n+1);

    for(int i=0;i<n;i++){
        int x;
        cin>>x;

        double d = (double)(x * (x + 1)) / (2 * x);
        v[i] = d;
    }

    for(int i=0;i<n;i++) psum[i+1] = psum[i] + v[i];

    double mx = 0;
    for(int i=k;i<=n;i++){
        mx = max(mx, psum[i] - psum[i - k]);
    }

    cout<<setprecision(10)<<fixed<<mx;
} 

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define pb push_back
#define un unordered_map
#define us unordered_set
#define ll long long
using namespace std;
 bool check(int a, int b, int c){
 return((a<b+c) && (b<a+c) && (c<a+b));
}
 int main()
 {
    
     int n;
     cin>>n;
     vector<ll>v(n);
      for(int i=0; i<n;i++)
       cin>>v[i];
       sort(v.begin(), v.end());
        int count=0;
         for(int i=0; i<n-2; i++)
         {
              for(int j=i+1; j<n-1; j++)
              {
                  for(int k=j+1; k<n; ++k)
                  {
                        if(v[i]!=v[j] && v[i]!=v[k] && v[j]!=v[k])
                        {
                            bool c=check(v[i], v[j], v[k]);
                            if(c==true)
                             count++;
                        }
                  }
              }
         }
          cout<<count<<endl;
       
       return 0;
     
 }
  

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) ((vec).begin(),(vec).end())
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,l,r;
long long s,x[100100],p[100100],tot;
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>s;
	l=1,r=n;
	for(int i=1;i<=n;i++)
		cin>>x[i]>>p[i];
	while(l<=r){
		if(x[l]>=s){
			tot+=(x[r]-s);
			break;
		}
		if(x[r]<=s){
			tot+=(s-x[l]);
			break;
		}
		tot+=x[r]-x[l];
		if(p[l]>=p[r]){//the bus will eventually go left
			//so,the people on the right is now useless
			//so,they can be combined into the left 
			while(p[l]>=p[r]&&l<r){
				p[l]+=p[r];
				r--;
			}
		}
		else{//the bus will eventually go right
			//so,the people on the left is now useless
			//so,they can be combined into the right
			while(p[l]<p[r]&&l<r){
				p[r]+=p[l];
				l++;
			}
		}
	}
	cout<<tot<<endl;
	return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll a, b;
    cin >> a >> b;
    if(a > 0) cout << "Positive";
    else if(b < 0) cout << ((b - a) % 2 ? "Positive" : "Negative");
    else cout << "Zero";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std; 
int a,b,c,d,sum;
int main(){
	cin>>a>>b;
	c=a*b;
	d=a+b;
	sum=a-b;
	c=fmax(c,d);
	cout<<fmax(sum,c);
	
}

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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

void debug_out() { cerr << endl; }

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

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

ll n,x;
ll c[51];
map<pair<ll, ll>, long long> m;
ll ans(ll n, ll x)
{
	//debug(c[n]);
	//debug(n, x);
	if(n == 0 && x) return 1;
	if(n == 1 && x == 1) return 0;
	else if(n == 1 && x == 2) return 1;
	else if(n == 1 && x == 3) return 2;
	else if(n == 1 && x) return 3;
	if(x <= 0) return 0;
	if(x > c[n]) x = c[n];
	if(m[{n, x}]) return m[{n, x}];
	ll temp = c[n-1];
	//debug(temp);
	if(c[n-1] +1 >= x)
	{
		long long flag = ans(n-1, x-1);
		m[{n-1, x-1}] = flag;
		return flag;
	}
	else if(c[n-1] + 1 + 1 >= x)
	{
		ll flag = ans(n-1, x-1);
		m[{n-1, x-1}] = flag;
		return 1 + flag;
	}
	else
	{
		ll flag = ans(n-1, c[n-1]);
		ll flag1 = ans(n-1, x - c[n-1] - 1 - 1);
		m[{n-1, c[n-1]}] = flag;
		m[{n-1, x - c[n-1] - 1 -1 }] = flag1;
		return 1 + flag + flag1;
	}

}

int main()
{
	cin >> n >> x;
	c[0] = 1;
	for(ll i=1;i<=n;i++)
	{
		c[i] = 1 + c[i-1] + 1 + c[i-1] + 1;
	}
	cout << ans(n, x) << "\n";
	return 0;
}

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

#define K(w) sin(w/(180/3.141592653589793238462643383279502884197))
#define L(w) cos(w/(180/3.141592653589793238462643383279502884197))

int main(){
    double a,b,c;
    cin>>a>>b>>c;
    cout<<fixed<<setprecision(50)<<a*K(c)*b/2<<endl;
    cout<<fixed<<setprecision(50)<<sqrt(pow(a*K(c),2)+pow(b-a*L(c),2))+a+b<<endl;
    cout<<fixed<<setprecision(50)<<b*K(c)<<endl;
    return 0;
}

Measured memory_bytes: 1308
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
using namespace std;
int n,k,ans;
int main()
{
	cin>>n>>k;
	while(n)
	{
		n/=k;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a,b;
  int d,r;
  double f;
  cin >>a>>b;
  d=a/b;
  r=a%b;
  f=(double)a/b;
  printf("%d %d %.5f\n",d,r,f);
  return 0;
}
  

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

using namespace std;

template<typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T> p) {
    out << "(" << p.first << "," << p.second << ")";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

struct SegmentTree {
    int n;
    vector<long long> addv;

    void init(int n) {
        this->n = n;
        addv.assign(2 * n - 1, 0);
    }

    template<typename T>
    void buildup(vector<T>& A) {
        n = A.size();
        init(n);

        for (int i = 0; i < n; i++)
            addv[i + n - 1] = A[i];
    }

    void add(int x, int y, long long val) {
        x += n - 1;
        y += n - 1;

        while (x <= y) {
            if (x % 2 == 0) {
                addv[x++] += val;
            } else if (y % 2) {
                addv[y--] += val;
            } else {
                x = (x - 1) / 2;
                y = (y - 1) / 2;
            }
        }
    }

    long long query(int x) {
        x += n - 1;
        long long ans = addv[x];

        while (x) {
            x = (x - 1) / 2;
            ans += addv[x];
        }

        return ans;
    }

    vector<long long> unwind() {
        vector<long long> A(n);
        for (int i = 0; i < n; i++)
            A[i] = query(i);
        return A;
    }
};

SegmentTree segment;

int main() {
    ios::sync_with_stdio(false);
    int n, k, q;
    vector<int> A;
    cin >> n >> k;
    A.resize(n);
    for (int i = 0; i < n; i++)
        A[i] = k;
    segment.buildup(A);
    cin >> q;
    while (q--) {
        int a;
        cin >> a;
        segment.add(0, n - 1, -1);
        segment.add(a - 1, a - 1, 1);
        // cout << segment.unwind() << endl;
    }
    vector<long long> B = segment.unwind();
    // cout << "B: " << B << endl;
    for (int i = 0; i < n; i++) {
        if (B[i] > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>

using namespace std;

long long a[200002];
long long n,i,k,s;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> k >> n;
    for (i=1;i<=n;i++)
        cin >> a[i];
    a[n+1]=k+a[1];
    s=abs(a[1]-a[2]);
    for (i=2;i<n+1;i++)
        s=max(s,abs(a[i]-a[i+1]));
    cout << k-s;
}

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

class Main{
    public static void main(String[] a){
        Integer[] values = new Integer[10];
        Scanner scan = new Scanner(System.in);
        
        for(int i=0; i<10; i++)
            values[i] = scan.nextInt();
 
        Arrays.sort(values, Collections.reverseOrder());

        for(int i=0; i<3; i++)
            System.out.println(values[i]);
    }
}

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

int main() {
  int W,H;
  cin>>W>>H;
  

  if((1<=W&&W<=9)&&(1<=H&&H<=9)){
     cout <<W*H<<endl;  
  }
  else{
    cout <<"-1"<<endl;  
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <vector>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <ctime>

using namespace std;

#define int int64_t

signed main()
{
    //freopen("../input.txt", "r", stdin);
    int x,a,y,b,c;
    cin >> x >> y >> a >> b >> c;

    multiset<int> ps, qs, rs;

    for (int i = 0; i < a; ++i) {
        int v;
        cin >> v;

        ps.insert(v);
        if (ps.size() > x) {
            ps.erase(ps.begin());
        }
    }

    for (int i = 0; i < b; ++i) {
        int x;
        cin >> x;
        qs.insert(x);
        if (qs.size() > y) {
            qs.erase(qs.begin());
        }
    }

    for (int i = 0; i < c; ++i) {
        int x; cin >> x;
        rs.insert(x);
    }

    vector<int> total;
    for (int el : ps) {
        total.push_back(el);
    }

    for (int el : qs) {
        total.push_back(el);
    }

    for (int el : rs) {
        total.push_back(el);
    }

    sort(total.rbegin(), total.rend());

    int sum = 0;

    for (int i = 0; i < x + y; ++i) {
        sum += total[i];
    }

    cout << sum;

    return 0;
}



Measured memory_bytes: 19572
// https://atcoder.jp/contests/agc025/tasks/agc025_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

int getSum(int num) {
    int digit = 0;
    while (num != 0) {
        digit += num % 10;
        num /= 10;
    }
    return digit;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, ans = INT_MAX;
    cin >> N;
    FOR(i, 1, N / 2 + 1) {
        int M = N - i;
        int sum = getSum(i) + getSum(M);
        ans = min(ans, sum);
    }
    cout << ans << endl;

    return 0;
}


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

#define mx 100005

using namespace std;
long long n, a[mx], b[mx], c[mx], ans;

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", a+i);
  for(int i = 0; i < n; i++) scanf("%d", b+i);
  for(int i = 0; i < n; i++) scanf("%d", c+i);
  sort(a, a+n); sort(c, c+n);
  for(int i = 0; i < n; i++){
    ans += (lower_bound(a, a+n, b[i]) - a)*(c+n - upper_bound(c, c+n, b[i]));
  }
  printf("%lld\n", ans);
}

Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#define esp 1e-9
#define INF 0x3f3f3f3f
#define Pi acos(-1.0)
const int maxn = 1e3;
typedef long long ll;
using namespace std;
struct strstrstr
{
    string s;
};
strstrstr t[maxn];
bool cmp(struct strstrstr &a, struct strstrstr &b)
{
    return a.s < b.s;
}
int main()
{
    int n, l;
    cin>>n>>l;
    for(int i=0;i<n;i++)
    {
        string str;
        cin>>str;
        t[i].s = str;
    }
    sort(t, t+n, cmp);
    for(int i=0;i<n;i++)
        cout<<t[i].s;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import math
N = int(input())

f = int(N // 1.1)

ok = False
while True:
  n = math.floor(f * 1.08)
  if n == N:
    ok = True
    break
  elif N < n:
    break
    
  f += 1
  
if not ok:
  print(':(')
else:
  print(f)
  


Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int x=gi();
	    int a=gi();




	   
	    //System.out.print(P[1]+P[0]);

        if (x<a) {
        	System.out.print(0);
        }else {
        	System.out.print(10);
        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35704
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;  
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 5000;

int n, MOD;

int dp[MAXN][MAXN];
int dpsum[MAXN][MAXN];
int dpsumsum[MAXN][MAXN];



void inc(int& a, int b) { if ((a += b) >= MOD) a -= MOD; }
void dec(int& a, int b) { inc(a, MOD - b); }

int calc(int cnt, int q, int lim) {
	if (lim == 0) return q == 0 ? 1 : 0;
	assert(q < n && lim < n);
	if (q <= cnt) return dp[q][lim];
	//printf("calc(%d,%d,%d)\n", cnt, q, lim);
	//printf("TODO\n");
	int ret = dp[q][lim];
	dec(ret, dpsum[q - (cnt + 1)][lim - 1]);
	/*FORE(z, cnt + 1, q) {
		int rem = q - z; assert(rem <= cnt);
		dec(ret, dp[rem][lim - 1]);
	}*/
	return ret;
}
int calcsum(int cnt, int qmx, int lim) {
	if (lim == 0) return 1;
	assert(qmx < n && lim < n);
	if (qmx <= cnt) return dpsum[qmx][lim];
	//printf("calcsum(%d,%d,%d)\n", cnt, qmx, lim);
	//printf("TODO2\n");
	int ret = dpsum[qmx][lim];
	dec(ret, dpsumsum[qmx - (cnt + 1)][lim - 1]);
	/*FORE(z, cnt + 1, qmx) {
		int rem = qmx - z; assert(rem <= cnt);
		dec(ret, dpsum[rem][lim - 1]);
	}*/
	return ret;
}


int solve() {
	if (n == 2) {
		//TODO
	}

	int nl, nr;
	if (n % 2 == 0) {
		nl = n / 2, nr = n / 2 - 1;
	} else {
		nl = (n + 1) / 2, nr = (n - 1) / 2;
	}

	REP(q, n) REP(lim, n) {
		if (lim == 0) { dp[q][lim] = q == 0 ? 1 : 0; continue; }
		dp[q][lim] = 0;
		int mx = q / lim;
		REPE(i, mx) inc(dp[q][lim], dp[q - i * lim][lim - 1]);
	}
	REP(q, n) REP(lim, n) {
		dpsum[q][lim] = dp[q][lim];
		if (q - 1 >= 0) inc(dpsum[q][lim], dpsum[q - 1][lim]);
	}
	REP(q, n) REP(lim, n) {
		dpsumsum[q][lim] = dpsum[q][lim];
		if (q - 1 >= 0) inc(dpsumsum[q][lim], dpsumsum[q - 1][lim]);
	}

	int ret = 0;
	FORE(v, 1, n) {
		int liml = v - 1, limr = n - v;
		REP(qr, v) {
			int mxql = v - qr - 1;
			int lways = calcsum(nl, mxql, liml);
			int rways = calc(nr - n % 2, qr, limr);
			ret = (ret + (ll)lways * rways) % MOD;
		}
	}
	return ret;
}

void run() {
	scanf("%d%d", &n, &MOD);
	printf("%d\n", solve());
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 293248
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    int a = H1 * 60 + M1;
    int b = H2 * 60 + M2;
    cout << b - a - K << endl;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		long a[] = new long[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(str[i]);
		}

		long s[] = new long[n];
		s[0] = a[0];

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

		long ans = Long.MAX_VALUE;
		for (int i = 0; i < n - 1; i++) {
			long left = s[i];
			long right = s[n - 1] - s[i];

			long abs = Math.abs(left - right);
			ans = Math.min(ans, abs);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 48924
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>


typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

map<string, int> memo;


int main() {
	//sort(a.begin(),a.end());
	string s, t;
	cin >> s >> t;
	t = t + s;
	cout << t;
	return 0;
}









Measured memory_bytes: 256
#include<iostream>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  int ans = 0;
  if (K <= A) {
    ans = K;
  } else if (K <= A + B) {
    ans = A;
  } else {
    ans = A - (K - A - B);
  }

  cout << ans << endl;
  return 0;
}


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

int main(){
  string c = "Yay!";
  int a[5];
  for(int i=0;i<5;i++)
    cin >> a[i];
  int k;
  cin >> k;
  for(int i=0;i<5;i++){
    for(int j=i+1;j<5;j++)
    if(k<a[j]-a[i])
      c = ":(";
  }
  cout << c << endl;
}


Measured memory_bytes: 256
n = int(input())
max_cnt = 0
res = 1
for i in range(n,0,-1):
    cnt = 0
    nn = i
    while nn % 2 == 0:
        nn = nn / 2
        cnt += 1
    if cnt > max_cnt:
        max_cnt = cnt
        res = i
print(res)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>


int main() {
	int n, m; std::cin >> n >> m;
	std::vector<std::vector<int>> nodes(n);
	std::vector<std::vector<int>> min_distance(n, std::vector<int>(n, INT_MAX));
	for (auto i = 0; i < m; ++i) {
		int a, b; std::cin >> a >> b; --a; --b;
		nodes[a].push_back(b);
	}
	for (auto i = 0; i < n; ++i) {
		std::queue<int> queue;
		min_distance[i][i] = 0;
		queue.push(i);
		while (!queue.empty()) {
			auto top = queue.front(); queue.pop();
			for (const auto next : nodes[top]) if (min_distance[i][next] == INT_MAX) {
				min_distance[i][next] = min_distance[i][top] + 1;
				queue.push(next);
			}
		}
	}
	int min_from = -1;
	int min_to = -1;
	int min_cycle = INT_MAX;
	for (auto i = 0; i < n; ++i) {
		for (auto j = 0; j < i; ++j) if (min_distance[i][j] != INT_MAX && min_distance[j][i] != INT_MAX) {
			if (min_distance[i][j] + min_distance[j][i] < min_cycle) {
				min_cycle = min_distance[i][j] + min_distance[j][i];
				min_from = i;
				min_to = j;
			}
		}
	}
	if (min_from == -1) {
		std::cout << -1 << std::endl;
		return 0;
	}
	std::vector<int> graph;
	for (int current = min_from; current != min_to; ) {
		graph.push_back(current);
		for (const auto next : nodes[current]) if (min_distance[current][next] != INT_MAX && min_distance[next][min_to] != INT_MAX && min_distance[current][next] + min_distance[next][min_to] == min_distance[current][min_to]) {
			current = next;
			break;
		}
	}
	for (int current = min_to; current != min_from; ) {
		graph.push_back(current);
		for (const auto next: nodes[current]) if (min_distance[current][next] != INT_MAX && min_distance[next][min_from] != INT_MAX && min_distance[current][next] + min_distance[next][min_from] == min_distance[current][min_from]) {
			current = next;
			break;
		}
	}
	std::cout << graph.size() << std::endl;
	for (const auto g : graph) {
		std::cout << g + 1 << '\n';
	}
}


Measured memory_bytes: 4224
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }

int func(int n)
{
	int ans = 0;
	for (int x = 1; x <= 100; x++)
	{
		int cur = x * x;
		if (cur > n) break;
		for (int y = 1; y <= 100; y++)
		{
			int cur2 = cur + y * y + x * y;
			if (cur2 > n) break;
			for (int z = 1; z <= 100; z++)
			{
				int cur3 = cur2 + z * z + x * z + y * z;
				if (cur3 > n) break;

				if (cur3 == n)
				{
					ans++;
				}
			}
		}
	}
	return ans++;
}

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

	for (int i = 1; i <= N; i++)
	{
		int a = func(i);
		cout << a << endl;
	}
}



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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>
#define endl "\n"

const ll INF = 1000000007;

/*
const int max_size = 100001;
int parent[max_size];
int Size[max_size];

int root(int x){
	while(x!=parent[x]){
		parent[x] = parent[parent[x]];
		x = parent[x];
	}
	return x;
}

void sunion(int x,int y){
	int rx = root(x);
	int ry = root(y);
	if(rx != ry){
		if(Size[rx] > Size[ry]){
			parent[ry] = parent[rx];
			Size[rx] += Size[ry];
		}
		else{
			parent[rx] = parent[ry];
			Size[ry] += Size[rx];
		}
	}
}
*/

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc=1;
	//cin >> tc;
	while(tc--){
		int d,t,s;
		cin >> d >> t >> s;
		if (d<= s*t) cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int main(void){
	int W, H, x, y;
	cin >> W >> H >> x >> y;
	double res = (double) W * H / 2.0;
	bool b = (2*x == W and 2*y == H);

	cout << fixed <<  setprecision(9) << res << ' ' << b << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
int main(){
    double a, b, c, d;
    double x, y, n;
    cin >> a >> b >> c >> d;
    
    x = a - c;
    y = b - d;
    
    x = pow(x, 2);
    y = pow(y, 2);
    
    n = x + y;
    n = sqrt(n);
    
    cout << fixed;
    cout << setprecision(6) << n;
}



Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
 
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
 
int cnt[20];
signed main(){
    int N;cin>>N;
    vint A(N);
    rep(i,N)cin>>A[i];
 
 
    for(int i=0;i<N;i++){
        for(int j=400;j<5555;j+=400){
            if(A[i]<j){
                cnt[j/400-1]++;
                break;
            }
        }
    }
 
    int ans=0;
    for(int i=0;i<8;i++)ans+=(cnt[i]!=0);
    int tmp=accumulate(cnt+8,cnt+20,0ll);
    cout<<ans+(ans==0&&tmp!=0)<<" "<<ans+tmp<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,d,x;
  cin>>n>>d>>x;
  int a;
  int choco=0;
  for(int i=0;i<n;i++){
    cin>>a;
    int cnt=0;
    while(cnt<d){
      cnt+=a;
      choco++;
    }
  }
  cout<<x+choco<<endl;
  return 0;
}

Measured memory_bytes: 256
#?±±???(?????????)?????\???
deck = input()
#????????????(-)????±±????????\?????????????????§??????
while deck != "-":
    #?????°?????\???
    times = int(input())
    #????????????????????????
    shuffle = list(deck)
    #?????????????????????????´?
    deck_length = len(deck)
    #times????????°???????????£?????????
    for i in range(times):
        #????????§?????????????????\????????????????????§?????£?????????
        val = int(input())
        shuffle = shuffle[val:] + shuffle[:val]
    #???????????????
    print("".join(shuffle))
    #?¬?????±±????????\???
    deck = input()

Measured memory_bytes: 7624
# -*- coding:utf-8 -*-

def solve():
    N, L = list(map(int, input().split()))
    all_taste = 0
    eat_taste = float("inf")
    for i in range(1, N+1):
        all_taste += L+i-1
        eat_taste = min(eat_taste, abs(L+i-1))
    
    if all_taste > 0:
        ans = all_taste - eat_taste
    else:
        ans = all_taste + eat_taste
    print(ans)



if __name__ == "__main__":
    solve()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, mx;
  cin >> N;
  int sum = 0;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  
  mx = *max_element(vec.begin(), vec.end());
  
  for (int i = 0; i < N; i++){
    sum += vec.at(i);
  }
  if((sum - mx) > mx) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;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 all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	vector<int>tenmod(200010,0);
	tenmod[0]=1;
	for(int i=1;i<200003;i++){
		tenmod[i]=tenmod[i-1]*10;
		tenmod[i]%=2019;
	}
	string s;
	int legth;
	ll ans=0LL;
	int mod=2019;
	cin >>s;
	legth=s.size();
	vector<int>dp(s.size()+2,0);
	map<int,ll>ing;
	dp[0]=s[legth-1]-'0';
	ing[dp[0]]+=0;
	ing[dp[0]]++;
	for(int i=1;i<legth;i++){
		dp[i]=dp[i-1]+(((s[legth-i-1]-'0')*tenmod[i])%mod);
		dp[i]%=mod;
		ing[dp[i]]+=0;
		ing[dp[i]]++;
	//	clog<<dp[i]<<endl;
	}
	for(auto itr=ing.begin();itr!=ing.end();itr++){
	//	clog<<(itr->F)<<" "<<(itr->S)<<endl; 
			if(itr->F==0){
				ans+=(itr->S)*((itr->S)+1)/2;
			}else{
			// 2 ->1 (1)
			// 3-> 3 (1+2)
			//4 -> 6 (1+2+3) -> 4*3/2
			ans+=(itr->S)*((itr->S)-1)/2;
			}
		
	}
	cout<<ans<<endl;
}
/*
 s[n]=0 -> ans[n]=ans[n-1]*2;
 s[n]=A 0> sum[n]=sum[n-1]*10+A ( sum[n-1]+(sum[n-1]*)+A))
 mod 2019==0 -> sum[n]mod2019== 0 -> ( sum[n-1]+(sum[n-1]*)+A)%2019)==2019n
*/

/*
1817  [0][3]=0
18171-> 1817+202=0  8171 ->95 [0][4]=[0][3]+1 =1
181718 -> 0+8=8    81718 -> 95+95*9+1= 200   1718 [0][5]=[0][4]+0=1


*/
// 2019 + 2019*9+9 = 10^6

/*
dp[st][en] => value%2019
init:[st][st+4] (st; 0 to |s|-4)=0, all =0
find: dp[0][|s|]
transition: dp[st][en]=dp[st-1][en]+value(dp[st-1][en]+s[st]^lngth(en-st+1)%2019)

*/

/*
1817181712114
2114 -> 95  [9][12]=0
12114 -> 95+1*10^4 -> 95+1924 ->0 [8][12]=1;
712114 -> 0+7*10^5 -> 1426 [7][12]=1;
1712114 -> 1426+ 10^6 -> 1429+595 = 5 [8][12]=1;
81712114 -> 5* 8*10^7 -> 5+1270 -> 1275 [7][12]=1;
181712114 -> 1275 + 1*10^8 = 1275 + 949 = 205
*/

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

const int N=10;
const int T=1<<N;
int A,B,C,n,a[N],sum[T],cnt[T];

int lowbit(int x)
{
	return x&(-x);
}
void init()
{
	int i;
	scanf("%d%d%d%d",&n,&A,&B,&C);

	for(i=0;i<n;++i) scanf("%d",&a[i]);
	for(i=0;i<n;++i) sum[1<<i]+=a[i];
	
	int S,mxS=1<<n;
	for(S=1;S<mxS;++S) sum[S]=sum[S^lowbit(S)]+sum[lowbit(S)];
	for(S=1;S<mxS;++S) cnt[S]=cnt[S>>1]+(S&1);
}

void work()
{
	int mxS=1<<n;
	int S,T,U,ans=1e9+7;
	for(S=1;S<mxS;++S)
		for(T=1;T<mxS;++T)
			for(U=1;U<mxS;++U)
			{
				if((S&T)||(T&U)||(S&U)) continue;
				ans=min(ans,abs(sum[S]-A)+cnt[S]*10-10+
				abs(sum[T]-B)+cnt[T]*10-10+
				abs(sum[U]-C)+cnt[U]*10-10);
			}
	printf("%d\n",ans);
}

int main()
{
	init();work();
	return 0;
}

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

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0;
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define fastio          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define file_io         freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#define ld_io           cout << setprecision(10) << fixed;

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 1e6 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;
const ll LOG   = 32;      // log2(1e9)
const ll BLOCK = 320;     // sqrt(1e5)

ll n , m , dp[MAXN] , par[MAXN];
string s;
set<pll> st;
vector<ll> ans;

int main() {
    fastio

    fill(dp , dp + MAXN , INF);
    cin >> n >> m >> s;
    dp[n] = 0;

    st.insert({0 , n});
    for(ll i = n - 1 ; i >= 0 ; i--){
        st.erase({dp[i + m + 1] , i + m + 1});
        if(s[i] == '1')   continue;
        if(st.size() == 0)  continue;
        pll A = *st.begin();
        dp[i] = A.X + 1;
        par[i] = A.Y;
        st.insert({dp[i] , i});
    }

    if(dp[0] == INF)    kill(-1);
    ll x = 0;
    while(x != n){
        ans.push_back(par[x] - x);
        x = par[x];
    }
    for(ll i : ans) cout << i << sep;

    return 0;
}



Measured memory_bytes: 14080
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N, K;
    cin >> N >> K;

    int res = 0;
    while(N/K > 0) {
        res++;
        N /= K;
    }
    if(N) res++;

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  int A[3][3];
  int i, j, k;
  for(i=0; i<3; i++)
    for(j=0; j<3; j++)
      cin >> A[i][j];

  int N;
  cin >> N;
  int b[N];
  for(i=0; i<N; i++)
    cin >> b[i];

  for(i=0; i<3; i++){
    for(j=0; j<3; j++)
      for(k=0; k<N; k++)
	if(A[i][j] == b[k])
	  A[i][j] = 0;
  }

  for(i=0; i<3; i++)
    if(A[0][i] == 0 && A[1][i] == 0 && A[2][i] == 0){
      cout << "Yes" << endl;
      return 0;
    }
  for(i=0; i<3; i++)
    if(A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0){
      cout << "Yes" << endl;
      return 0;
    }

  if(A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0){
      cout << "Yes" << endl;
      return 0;
  }
  if(A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0){
      cout << "Yes" << endl;
      return 0;
  }

  cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define PI 3.14159265359
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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;}
template <class T> using V=vector<T>;
const int INF = 1e9;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    vi h(n); rep(i,n) cin >> h[i];
    sort(all(h));
    int res = INF;
    rep(i,n-k+1) {
        res = min(h[i+k-1]-h[i],res);
    }
    cout << res << "\n";
}

Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    vl A(N);
    ll plus=0;
    rep(i,N){
        cin >> A[i];
        if(A[i]>0){
            plus+=A[i];
        }
    }
    vl sum(N-K+1);
    vl sump(N-K+1);
    rep(i,K){
        sum[0]+=A[i];
        if(A[i]>0){
            sump[0]+=A[i];
        }
    }
    rep(i,N-K){
        sum[i+1]=sum[i]+A[K+i]-A[i];
        sump[i+1]=sump[i]+max(0LL,A[K+i])-max(0LL,A[i]);
    }
    ll ans=-INF;
    rep(i,N-K+1){
        ll res=plus-sump[i];
        res+=max(0LL,sum[i]);
        //cout << res << '\n';
        chmax(ans,res);
    }
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 5532