akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, long long>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

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

  int n; cin >> n;
  int w; cin >> w;

  vector<int> weight(n);
  vector<ll> value(n);
  rep(i, n) {
    cin >> weight[i];
    cin >> value[i];
  }

  ll dp[100001];

  rep(j, 100001) {
    dp[j] = INT_MAX/2;
  }

  dp[0] = 0;

  for(int i=0; i<n; i++) {
    for(int j=100000; j>=0; j--) {
      int pos = j-value[i];
      if (pos >= 0 && dp[pos] >= 0) {
        if (dp[pos] + weight[i] <= w) {
          dp[j] = min(dp[j], dp[pos] + weight[i]);
        }
      }
    }
  }

  for(int j=100000; j>=0; j--) {
    if (dp[j] != INT_MAX/2) {
      cout << j << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using tiii = tuple<int,int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
#define chmax(a,b) a=max(a,b)

/*Coding Space*/
int main(){
  int a,b;  cin >> a >> b;
  cout << lcm(a,b) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define endl '\n'
#define F first
#define S second
typedef pair<int, int> pii;
typedef long long ll;

void C(){
	/**int pass(int m, int k){
		int cnt=0;
		while(m<k){
			m*=2;
			cnt++;
		}
		return cnt;
	}
	int n,k; cin>>n>>k;
	double ans=0;
	for(int i=1; i<=n; i++){
		int x = 1<<pass(i, k);
		double prob = 1.0/(x*1.0);
		ans+=((1.0/n*1.0)*prob);
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;*/
}
const int MAX = 1e5+1;
vector<pii> g[MAX];
bool vis[MAX];
int color[MAX];

void D(){
/**void dfs(pii u){
	vis[u.F] = 1;
	for(auto&x: g[u.F]){
		if(!vis[x.F]){
			if(x.S%2==0){
				if(color[u.F]!=-1)color[x.F]=color[u.F];
				else color[x.F]=color[u.F]=0;
			}
			else color[x.F]=!color[u.F];
			dfs(x);
		}
	}
}*/
}
void bfs(pii u){
	memset(color, -1, sizeof(color));
	queue<pii> q;
	q.push(u);
	while(!q.empty()){
		pii v = q.front();
		q.pop();
		vis[v.F]=true;
		for(auto&x: g[v.F]){
			if(!vis[x.F]){
				vis[x.F]=true;
				if(x.S%2==0){
					if(color[v.F]!=-1)color[x.F]=color[v.F];
					else color[v.F]=color[x.F]=0;
				}
				else{
					//color[v.F]=!color[x.F];
					if(color[v.F]!=-1)color[x.F]=!color[v.F];
					else {color[v.F]=0; color[x.F]=1;}
				}
				q.push(x);
			}
		}
	}
}

int main(){
	int n; cin>>n;
	int u, v, w;
	for(int i=0; i<n-1; i++){
		cin>>u>>v>>w;
		u--; v--;
		g[u].push_back({v, w});
		g[v].push_back({u, w});
	}
	bfs({0,0});
	for(int i=0; i<n; i++){
		cout<<color[i]<<endl;
	}
	return 0;   
}


Measured memory_bytes: 10048
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] L = new int[n];
		for(int i = 0; i < n; i++) {
			L[i] = sc.nextInt();
		}
		int ans = 1;
		int jmp = 0;
		for(int i = 0; i < n; i++) {
			jmp += L[i];
			if(jmp <= x) {
				ans ++;
			}
		}
		System.out.println(ans);
		sc.close();
	}


}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll n,x;
    cin >> n >> x;
    ll cnt = 0;
    vector<ll> a(n);
    for(int i = 0; i < n; i++)
    cin >> a[i];
    for(int i = 0; i < n - 1; i++){
       ll b = a[i] + a[i + 1];
       if(b > x){
           if(a[i + 1] >= (b - x)){
               a[i + 1] -= (b - x);
               cnt += (b - x);
           }
           else
           {
               a[i] -= ((b - x) - a[i + 1]);
               cnt += (b - x - a[i + 1]);
               cnt += a[i + 1];
               a[i + 1] = 0;
           }
       }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

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

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int n, a;
  cin >> n >> a;
  cout << n * n - a;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
 
int main(){
  int n,h;
  cin>>h>>n;
  vector<int>dp(h+1,INF);
  dp[0]=0;
  while(n--){
    int weight,value;
    cin>>value>>weight;
    for(int i=0;i<=h;i++){
      int j=min(h,i+value);
      dp[j]=min(dp[j],dp[i]+weight);
    }
  }
  cout<<dp[h];
  return 0;
}

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

int main(){
  long long n,a,b; cin>>n>>a>>b;
  vector<long long>x(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
  } 
  long long len=0;
  for(int i=0;i<n-1;i++){
    len+=min((x[i+1]-x[i])*a,b);
  }
  cout<<len<<endl;
  return 0;
}

Measured memory_bytes: 1024
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    S,T = LS()
    A,B = LI()
    U = _S()
    print("{} {}".format(A-1,B) if U==S else "{} {}".format(A,B-1))

main()



Measured memory_bytes: 27188
#include <iostream>
#include <queue>

using namespace std;


struct P {
	int x, y;
};

struct data {
	P tp, kp;
	int step;
};

bool used[50][50][50][50] = {0};
int m[50][50];
int W, H;

P move(P p, P d) {
	P next = (P){ p.x+d.x, p.y+d.y };
	if (next.x < 0 || next.x >= W || next.y < 0 || next.y >= H) return p;
	if (m[next.y][next.x]) return p;
	return next;
}

int main() {
	while ( cin >> W >> H, W || H ) {
		int tx, ty; cin >> tx >> ty; --tx, --ty;
		int kx, ky; cin >> kx >> ky; --kx, --ky;
		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				cin >> m[y][x];
			}
		}
		fill(&used[0][0][0][0], &used[0][0][0][0]+50*50*50*50, false);
		queue<data> Q; Q.push( (data){ (P){tx, ty}, (P){kx, ky}, 0} );
		int ans = -1;
		while ( !Q.empty() ) {
			data d = Q.front(); Q.pop();
			P tp = d.tp, kp = d.kp;

			if (tp.x < 0 || tp.x >= W || tp.y < 0 || tp.y >= H) continue;
			if (kp.x < 0 || kp.x >= W || kp.y < 0 || kp.y >= H) continue;
			if (m[tp.y][tp.x]) continue;
			if (m[kp.y][kp.x]) continue;

			if (used[tp.x][tp.y][kp.x][kp.y]) continue;
			used[tp.x][tp.y][kp.x][kp.y] = true;

			if (tp.x == kp.x && tp.y == kp.y) {
				ans = d.step;
				break;
			}

			Q.push( (data){ move(tp, (P){0, 1}), move(kp, (P){0, -1}), d.step+1} );
			Q.push( (data){ move(tp, (P){0, -1}), move(kp, (P){0, 1}), d.step+1} );
			Q.push( (data){ move(tp, (P){1, 0}), move(kp, (P){-1, 0}), d.step+1} );
			Q.push( (data){ move(tp, (P){-1, 0}), move(kp, (P){1, 0}), d.step+1} );
		}
		if (ans < 0) cout << "NA" << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 8560
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long F[N][10], b[10], P[N][11];
  vector<long long> dp(1024);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> P[i][j];
    }
  }
  for (int i = 1; i < 1024; i++) {
    vector<long long> c(N);
    for (int n = i, j = 0; j < 10; n /= 2, j++) {
      b[j] = n%2;
    }
    for (int j = 0; j < 10; j++) {
      for (int k = 0; k < N; k++) {
        c[k] += b[j]*F[k][j];
      }
    }
    for (int j = 0; j < N; j++) {
      dp[i] += P[j][c[j]];
    }
  }
  cout << *max_element(dp.begin()+1,dp.end());
}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void)
{
	int k;
	cin >> k;
	if (k % 2 == 0) {
		print(k*k/4);
	}
	else {
		print((k + 1)*(k-1) / 4);
	}
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] intArray = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        int cnt = 0;
        bool isEven = true;

        while (isEven)
        {
            int cnt2 = 0;
            for (int i = 0; i < intArray.Length; i++)
            {
                if (intArray[i] % 2 == 0)
                {
                    intArray[i] /= 2;
                    cnt2++;
                }
                else
                {
                    isEven = false;
                }
            }

            if (cnt2 == intArray.Length) cnt++;
        }
        
        Console.WriteLine(cnt);
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main(){
    long long a,b;
    cin >> a >> b;
    if(a*b > 0){
        if(a>0){
            cout << "Positive" << endl;
        }
        else{
            if(abs(b-a)%2 == 1){
                cout << "Positive" << endl;
            }
            else{
                cout << "Negative" << endl;
            }
        }
    }
    else{
        cout << "Zero" << endl;
    }
}

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

int main() {
    string s;
    cin >> s;
    bool f[26];

    for (int i = 0; i < 26; i++) {
        f[i] = false;
    }

    int len = s.length();
    for (int i = 0; i < len; i++) {
        f[s[i] - 97] = true;
    }

    bool g = false;
    for (int i = 0; i < 26; i++) {
        if (f[i] == false) {
            printf("%c\n", i + 97);
            g = true;
            break;
        }
    }
    if (!g) {
        cout << "None" << endl;
    }
    
}

Measured memory_bytes: 512
from collections import defaultdict
H,W,M = list(map(int,input().split()))

h = [0] * H
w = [0] * W

hw = defaultdict(set)

for _ in range(M):
    a,b = list(map(int,input().split()))
    h[a - 1] += 1
    w[b - 1] += 1
    hw[a - 1].add(b - 1)
    
hm = max(h)
wm = max(w)

hp = [i for i, v in enumerate(h) if v == hm]
wp = [i for i, v in enumerate(w) if v == wm]

for x in hp:
    for y in wp:
        if y not in hw[x]:
            print(hm + wm)
            exit()
else:
    print(hm + wm - 1)



Measured memory_bytes: 133560
n = int(input())
xy = [tuple(map(int, input().split())) for _ in range(n)]

count = 0
for i in range(n-1):
    for j in range(i+1, n):
        p, q = xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]
        count = max(count, sum((x-p,y-q) in set(xy) for x, y in xy))

print(n - count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    int H, W;
    cin >> H >> W;
    vvint c(10, vint(10)), A(W, vint(W)), d(10, vint(10));
    vector<vector<bool>> flag(10, vector<bool>(10));
    rep(i, 10)
    {
        rep(j, 10)
        {
            cin >> c[j][i]; //iをjに変えるときの必要魔力
            if (i != j)
                d[j][i] = INT_MAX/2;
        }
    }
   
    for (int k = 0; k < 10; k++)
    { // 経由する頂点
        for (int i = 0; i < 10; i++)
        { // 始点
            for (int j = 0; j < 10; j++)
            { // 終点
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }
    ll ans = 0;
    int a = 0;
    rep(y, H)
    {
        rep(x, W)
        {
            cin >> a;
            ans += c[1][a];
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int main()
{
    string s;
    cin >> s;

    int ans;
    for(int i = 0; i < 8; i++){
        int n = s[0] - '0';
        if((i >> 2) & 1)
            n -= (s[1] - '0');
        else
            n += (s[1] - '0');

        if((i >> 1) & 1)
            n -= (s[2] - '0');
        else
            n += (s[2] - '0');

        if(i & 1)
            n -= (s[3] - '0');
        else
            n += (s[3] - '0');

        if(n == 7)
            ans = i;
    }

    cout << s[0];

    if((ans >> 2) & 1)
        cout << '-';
    else
        cout << '+';

    cout << s[1];

    if((ans >> 1) & 1)
        cout << '-';
    else
        cout << '+';

    cout << s[2];

    if(ans & 1)
        cout << '-';
    else
        cout << '+';

    cout << s[3] << "=7\n";
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//



//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k ;
  cin >> n >> k ;
  if((n-1)%(k-1)==0){
    cout <<(n-1)/(k-1)<<endl ;
  }
  else{
    cout <<(n-1)/(k-1)+1<<endl ;
  }
  
  
  
  
  
  
  return 0 ;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn =1e5+5;
vector<int>E[maxn];
int vis[maxn];
int ans[maxn];
void bfs(int x)
{
    vis[x]=1;
    queue<int>q;
    q.push(x);
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        for(auto &v:E[u])
        {
            if(vis[v])
                continue;
            vis[v]=1;
            ans[v]=u;
            q.push(v);
        }
    }
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	while(m--)
    {
        int x,y;
        cin>>x>>y;
        E[x].push_back(y);
        E[y].push_back(x);
    }
    bfs(1);
	int flag=0;
	for(int i=2;i<=n;i++)
    {
        if(ans[i]==0)
        {
            flag=1;
            break;
        }
    }

    if(flag)
        cout<<"No"<<'\n';
    else
    {
        cout<<"Yes"<<'\n';
        for(int i=2;i<=n;i++)
        {
            cout<<ans[i]<<'\n';
        }
    }


}





Measured memory_bytes: 10960
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var KN = Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToArray();
            var K = KN[0];
            var N = KN[1];
            var An = new List<int>(Console.ReadLine().Split(' ').Select(s => int.Parse(s)));

            var max = 0;
            for(var i=1;i<N;i++)
            {
                var tmpMax = An[i] - An[i - 1];
                if (max < tmpMax) max = tmpMax;
            }
            var tm = K - An[N - 1] + An[0];
            if (max < tm) max = tm;
            Console.WriteLine(K-max);
        }
    }
}


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

#define ll long long
#define F first
#define S second

const int mod = 1000000007;
const int M = 100005;

ll dp[105][M];

int main() {
	int T = 1;
	// cin>>T;
	while(T--)
	{
		int n;	cin>>n;
		int W;	cin>>W;
	
		vector<int> wt(n+1);
		vector<int> val(n+1);
		
		for(int i=1; i<=n; i++)	cin>>wt[i]>>val[i];
		
		for(int i=0; i<=n; i++)
		{
			for(int j=0; j<=W; j++)
			{
				if(i==0 || j==0)
					dp[i][j] = 0;
				if(i>0 && j>0)
				{
					dp[i][j] = dp[i-1][j];
					if(j-wt[i]>=0)	dp[i][j] = max(dp[i][j] , dp[i-1][j-wt[i]]+val[i]);
				}
				
			}
		}
		cout<<dp[n][W];
	}
	return 0;
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=1000000000000000;

int main(void){
    long W,a,b;
    cin>>W>>a>>b;
    
    if(abs(a-b)<W){
        cout<<0<<endl;
        return 0;
    }
    cout<<min(abs(a-b+W),abs(a-b-W))<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>

using namespace std;

int limit = 1e6;

int memo(const int cur, vi &dp, const vi &list) {
  if (dp[cur] != limit)
    return dp[cur];
  for (const auto li : list) {
    if (cur - li >= 0) {
      dp[cur] = min(dp[cur], memo(cur - li, dp, list) + 1);
    }
  }
  return dp[cur];
}

int main() {
  vi list, oddList;
  for (int i = 1; i * (i + 1) * (i + 2) / 6 < limit; i++) {
    int num = i * (i + 1) * (i + 2) / 6;
    list.push_back(num);
    if (num % 2 == 1)
      oddList.push_back(num);
  }

  vi dp(1e6, limit), dpOdd(1e6, limit);
  dp[0] = dpOdd[0] = 0;
  FOR(i, 1, 1e6) {
    memo(i, dp, list);
    memo(i, dpOdd, oddList);
  }

  while (true) {
    int k;
    cin >> k;
    if (k == 0)
      break;
    cout << dp[k] << " " << dpOdd[k] << "\n";
  }
  return 0;
}



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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> cnt(100001, 0);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    cnt[a] += b;
  }

  rep(i, 100001) {
    k -= cnt[i];
    if (k <= 0) {
      cout << i << endl;
      return 0;
    }
  }
}


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

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) FOR((i),0,(n))

typedef long long ll;

const ll INF=1e9+7;
ll d[100][2];
ll p[100][2];
int main(){
	int n,m;
	cin>>n>>m;
	rep(i,n)cin>>d[i][0]>>d[i][1];
	rep(i,m)cin>>p[i][0]>>p[i][1];
	rep(i,n){
		int ans=0;
		ll mi=INF*10;
		rep(j,m){
			if(mi>abs(d[i][0]-p[j][0])+abs(d[i][1]-p[j][1])){
				ans=j;
				mi=abs(d[i][0]-p[j][0])+abs(d[i][1]-p[j][1]);
			}
		}
		cout<<ans+1<<endl;
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
#define per(i, a, b) for (int i = a; i >= b; -- i)
const int maxn = 100010;
using namespace std;
int n, k, a[maxn]; ll L[maxn], R[maxn];
int main() {
	scanf("%d%d", &n, &k);
	rep(i, 1, n) scanf("%d", &a[i]);
	rep(i, 1, n) L[i] = L[i - 1] + max(a[i], 0);
	per(i, n, 1) R[i] = R[i + 1] + max(a[i], 0); ll ans = 0, now = 0;
	rep(i, 1, k) now += a[i];
	rep(i, 1, n - k + 1) ans = max(ans, L[i - 1] + max(now, 0LL) + R[i + k]), now += a[i + k] - a[i];
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 2176
n=int(input())
a = list(map(int, input().split()))

a.sort()

absum=0
minabs=10**9
for num in a:
        abnum=abs(num)
        absum+=abnum
        if minabs > abnum:
                minabs=abnum

if a[0] <= 0 and a[-1] >=0:
        print(absum)
else:
        print(absum - 2*minabs)
        num1=a.pop(0)
        num2=a.pop(-1)
        if abs(num1) > abs(num2):
                print(num2,num1)
                a.append(num2-num1)
        else:
                print(num1,num2)
                a.append(num1-num2)
a.sort()
#print(a)

now = a[0]
for i in range(len(a)-2,-1,-1):
        if a[i] > 0:
                print(now, a[i])
                now-=a[i]
#print(now)
a[0]=now

now = a[-1]

for i in range(len(a)-1):
        if a[i] >0:
                break
        print(now,a[i])
        now-=a[i]

Measured memory_bytes: 14008
#include "bits/stdc++.h"

using namespace std;

//int minCostFrom(int curr, const vector<int>& h, int K, vector<int>& memo) {
//    int N = h.size();
//    if (curr == N - 1) {
//        return 0;
//    }
//    if (memo[curr] >= 0) {
//        return memo[curr];
//    }
//
//    int minTemp = 1e9;
//    for (int k = 1; k <= K; ++k) {
//        if (curr + k >= N) {
//            break;
//        }
//        int temp = minCostFrom(curr + k, h, K, memo) + abs(h[curr] - h[curr + k]);
//        minTemp = min(temp, minTemp);
//    }
//    memo[curr] = minTemp;
//    return minTemp;
//}

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> h[i];
    }

    //vector<int> memo(N, -1);
    //int ans = minCostFrom(0, h, K, memo);
    //cout << ans << endl;
    //return 0;

    vector<int> minCost(N, -1);
    minCost[N - 1] = 0;
    minCost[N - 2] = abs(h[N - 1] - h[N - 2]);
    for (int i = N - 3; i >= 0; --i) {
        int tempMin = 1e4 * 1e5;
        for (int j = 1; j <= K; ++j) {
            if (i + j > N - 1) {
                break;
            }
            tempMin = min(tempMin, minCost[i + j] + abs(h[i] - h[i + j]));
        }
        minCost[i] = tempMin;
    }
    cout << minCost[0] << endl;
}

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

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

using namespace std;

int main(){
    string o,e,s="";
    int m,i,mi;
    getline(cin,o);
    getline(cin,e);
    m=max(o.length(),e.length());
    mi=min(o.length(),e.length());
    for(i=0;i<mi;i++){
        s+=o[i];
        s+=e[i];
    }
    for(i=mi;i<m;i++){
        if(o.length()>e.length()){
            s+=o[i];
        }
        else{
            s+=e[i];
        }
    }
    cout<<s;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ss string
#define ll long long int
#define Endl endl
#define u_b upper_bound
#define rep(i,n)         for(int i=0;i<n;i++)
#define ld long double
#define tc long long t;cin>>t;while(t--)
#define fr(i,a,b)        for(long long int i=a;i<=b;i++)
#define E endl
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define V deque<ll>v;
#define aaste long long int n;cin>>n;long long int a[n];for(long long int i=0;i<n;i++)cin>>a[i];
const ll   mod=            1000000007;
const ll   MOD1=           (int)1e9 + 9;
const ll   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
const int   N=                   2e5+5;
 
const int MAXR = 1000005;
ll         tests=          1;
 
using namespace std;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll binarySearch(ll l, ll r,ll k)
{
  if (r >= l) {
    ll mid = l + (r - l) / 2;
    if (mid*(mid+1)==k)
      return 1;
    if (mid*(mid+1)>k)
      return binarySearch( l, mid - 1,k);
    return binarySearch(mid + 1, r, k);
  }
  return 0;
}
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
void swap(ll *p1, ll *p2)
{
   ll temp=*p1;
   *p1=*p2;
   *p2=temp;
}
ll cbratt(ll x)
{
    ll l = 0, r = MAXR;
    while (l != r) {
        ll m = (l + r + 1) / 2;
        if (m * m * m > x)
            r = m - 1;
        else
            l = m;
    }
    return l;
}
int MaxSubArraySumReturn(int a[], int  n) //negative thakle o kaaj korbe in O(n)
{
 
    int sum = 0, best = 0;
   for(ll i=0;i<n;i++)
    {
        sum = max(a[i], a[i] + sum);
        best = max(best, sum);
    }
    return best;
 
}
ll totalDigits(ll n) 
{ 
 
    ll number_of_digits = 0; 
    for (ll i = 1; i <= n; i *= 10) 
        number_of_digits += (n - i + 1); 
  
    return number_of_digits; 
}

int main()
{
  #ifndef ONLINE_JUDGE
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    }
#endif
    ll n;
    cin>>n;
ll a[n+1];
ll ctr=0;
for(ll i=1;i<=n;i++)
{

cin>>a[i];
if(a[i]&1  &&  i&1)
ctr++;
}
cout<<ctr;
}


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int minDist(const vector<string>& plane, char wall, int y1, int x1, int y2, int x2)
{
    int dy[] = {0, 0, -1, 1};
    int dx[] = {-1, 1, 0, 0};

    int h = plane.size();
    int w = plane[0].size();

    queue<pair<int, int> > q;
    vector<vector<bool> > check(h, vector<bool>(w, false));
    q.push(make_pair(y1, x1));
    check[y1][x1] = true;
    int ret = 0;
    while(!q.empty()){
        queue<pair<int, int> > q1;
        while(!q.empty()){
            int y = q.front().first;
            int x = q.front().second;
            q.pop();
            if(y == y2 && x == x2)
                return ret;
            for(int i=0; i<4; ++i){
                int y0 = y + dy[i];
                int x0 = x + dx[i];
                if(0 <= y0 && y0 < h && 0 <= x0 && x0 < w && plane[y0][x0] != wall && !check[y0][x0]){
                    q1.push(make_pair(y0, x0));
                    check[y0][x0] = true;
                }
            }
        }
        ++ ret;
        q = q1;
    }
    return -1;
}

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> s(h);
    int cnt = 0;
    for(int i=0; i<h; ++i){
        cin >> s[i];
        cnt += count(s[i].begin(), s[i].end(), '.');
    }

    int ans = minDist(s, '#', 0, 0, h-1, w-1);
    if(ans != -1)
        ans = cnt - ans - 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m;
ll dp[8005][205];
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll F[16005],R[16005];
void make(){
	F[0] = 1;
	for(int i=1;i<16005;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<16005;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
    return F[a]*R[b]%mod*R[a-b]%mod;
}
ll g[16];
int a[(1<<14)],b[(1<<14)],c[(1<<14)];
void mul(int *a,int *b,int *c,int n){
	if (n<=8){
		memset(g,0,sizeof(g));
		rep(i,n)rep(j,n) g[i+j]+=(ll)a[i]*b[j]%mod;
		rep(i,2*n) c[i]=g[i]%mod;
		return;
	}
	int mid = n/2;
	mul(a,b,c,mid); mul(a+mid,b+mid,c+n,mid);
	int x[mid],y[mid],z[n];
	rep(i,mid){
		x[i]=(a[i]+a[i+mid])%mod; y[i]=(b[i]+b[i+mid])%mod;
	}
	mul(x,y,z,mid);
	rep(i,n) z[i]-=c[i]+c[i+n];
	rep(i,n) c[i+mid]=((c[i+mid]+z[i])%mod+mod)%mod;
}
int main(){
	cin>>n>>m; make();
	dp[0][0] = 1;
	//dp[0][0] -> dp[i+a][j+1] (*coef[i][a] = (i+a+2)!/i!/(a+2)!)
	for(int j=0;j<m;j++){
		rep(q,(1<<14)) a[q]=b[q]=c[q]=0;
		for(int i=0;i<=n;i++){
			ll x = dp[i][j] * R[i] % mod;
			a[i] = x;
			if(i != 0){
				b[i] = R[i+2];
			}
		}
		mul(a,b,c,(1<<13));
		for(int i=0;i<=n;i++){
			dp[i][j+1] = 1LL*c[i]%mod*F[i+2]%mod;
			dp[i][j+1] += dp[i][j]*(C(i+1,2)+1)%mod;
			dp[i][j+1] %= mod;
		}
	}
	ll ans = 0;
	for(int i=0;i<=n;i++){
		ans += dp[i][m] * C(n,i) % mod;
	}
	cout << ans%mod << endl;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
using namespace std;

string in;

int main()
{
	cin.sync_with_stdio(0);		cin.tie(0);		cout.tie(0);

	cin >> in;
	int a = 0;
	int b = 0;
	int c = 0;
	for(int x = 0 ; x < (int)in.size(); x++){
		if(in[x] =='a') a++;
		else if(in[x] == 'b') b++;
		else c++;
	}
	if(a == 1 && b ==1 && c == 1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N;
  cin >> N;
  string c;
  cin >> c;
  int l = 0;
  int count = 0;
  for (int r=N-1; r>l; r--) {
    if (c[r] == 'R') {
      while (c[l] != 'W') {
        if (l == r) break;
        l++;
      }
      if (l != r) {
        swap(c[l], c[r]);
        count++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
long long X[50];
long long Y[50];
int main(){
  int a, b, i, j, k, res, tmp;
  long long p, q;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
      rd(Y[Lj4PdHRW]);
    }
  }
  res = N;
  for(a=0;a<N;a++){
    for(b=a+1;b<N;b++){
      p = X[b] - X[a];
      q = Y[b] - Y[a];
      tmp = N;
      for(i=0;i<N;i++){
        for(j=0;j<N;j++){
          if(X[j]-X[i]==p && Y[j]-Y[i]==q){
            tmp--;
          }
        }
      }
      chmin(res, tmp);
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190609-2 [beta]

// --- original code ---
// int N;
// ll X[50], Y[50];
// {
//   int i, j, k, a, b;
//   int res, tmp;
//   ll p, q;
// 
//   rd(N,(X,Y)(N));
//   res = N;
// 
//   rep(a,N) rep(b,a+1,N){
//     p = X[b] - X[a];
//     q = Y[b] - Y[a];
// 
//     tmp = N;
//     rep(i,N) rep(j,N) if(X[j]-X[i]==p && Y[j]-Y[i]==q) tmp--;
//     res <?= tmp;
//   }
// 
//   wt(res);
// }


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
#include <queue>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;



int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (a == 0) {
        cout << 1 << endl;
        return 0;
    }
    if (b == 0) {
        cout << 2 << endl;
        return 0;
    }
    if (c == 0) {
        cout << 3 << endl;
        return 0;
    }
    if (d == 0) {
        cout << 4 << endl;
        return 0;
    }
    if (e == 0) {
        cout << 5 << endl;
        return 0;
    }
}

Measured memory_bytes: 3616
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
l=[a1[0]]
r=[a2[n-1]]
for i in range(1,n):
    l.append(l[i-1]+a1[i])
    r.append(r[i-1]+a2[n-1-i])
ans=0
r.reverse()
for i in range(n):
    res=l[i]+r[i]
    ans=max(ans,res)
print(ans)

Measured memory_bytes: 3064
def main():
    g = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

    x, y = map(int, input().split())

    for i in range(len(g)):
        if g[i].count(x) == 1 and g[i].count(y) == 1:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9+1;
const int MOD = 2e9 + 9;
const ll LINF = 1e18;
using namespace std;

bool prime(int x) {
	bool flag = 1;
	for (int i = 2; i <= sqrt(x); i++) {
		if (x % i == 0)flag = 0;
	}
	return flag;
}
int main() {
	int x, ans;
	cin >> x;
	for (int i = x; i < 2 * x + 1; i++) {
		if (prime(i) == 1) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{ 
  int N,M;
  vector<int> X;
  vector<int> A;

  cin>>N;
  for(int i = 0;i < N;++i){
    int temp;
    cin>>temp;
    X.push_back(temp);
  }

  cin>>M;
  for(int i = 0;i < M;++i){
    int temp;
    cin>>temp;
    A.push_back(temp);
  }

  for(int e : A){
    int mass = X.at(e - 1);
    if(mass == 2019){
      continue;
    }
    else{
      ++mass;
      if(e == X.size()){
        X[e - 1] = mass;
      }
      else{
        if(X.at(e) != mass){
          X[e - 1] = mass;
        }
      }
    }
  }

  for(int e : X){
    cout<<e<<endl;
  }

  return 0;
}


Measured memory_bytes: 3164
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==5&&b==5&&c==7)
    printf("YES");
    else if(a==5&&b==7&&c==5)
    printf("YES");
    else if(a==7&&b==5&&c==5)
    printf("YES");
    else printf("NO");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>    
#define pb push_back

#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))

typedef long long ll;
const int inf = 2e9;
using namespace std;
ll MOD = 1000000007;
typedef pair<int,int> ii;
typedef struct {int a,b,c;}iii;
typedef vector<int> vi;


void mosA(vector<int> a){
	for(int i=0; i<a.size(); i++) printf("%d ",a[i]);
	printf("\n");
}
void mosP(vector<ii> a){
	for(int i=0; i<a.size(); i++) printf("%d %d\n",a[i].first,a[i].second);
	printf("\n");
}
ll min_especial(ll a, ll b){
  if(a!=-1 && b!=-1) return min(a,b);
  else return max(a,b);
}

bool ord(ll a, ll b){
	return b<a;
}

int k,q,n,m,t,a,b,u,f,l,x,z,y;
ll A[3][1005];
map<ll,bool> M;



int main(){
	scanf("%d%d%d%d",&x,&y,&z,&k);
	FOR(i,x) scanf("%lld",&A[0][i]);
	FOR(i,y) scanf("%lld",&A[1][i]);
	FOR(i,z) scanf("%lld",&A[2][i]);
	sort(A[0],A[0]+x,ord);
	sort(A[1],A[1]+y,ord);
	sort(A[2],A[2]+z,ord);

	ll p1 = 0,p2 = 0, p3 = 0, cual=-1;

	//FOR(i,x) printf("%lld\n",A[0][i]);


	priority_queue<pair<ll,ll>> Q;
	Q.push({A[0][p1]+A[1][p2]+A[2][p3],p1+p2*1000+p3*1000000});

	while(k--){



		pair<ll,ll> m = Q.top();
		ll pos = m.second;

		printf("%lld\n",m.first);
		Q.pop();

		M[pos] = 1;

		p1 = pos%1000;
		p2 = (pos/1000)%1000;
		p3 = pos/1000000;

		//cout<<p1<<" "<<p2<<" "<<p3<<endl;

		if(p1+1<x && !M[p1+1+p2*1000+p3*1000000]){
			Q.push({A[0][p1+1]+A[1][p2]+A[2][p3],p1+1+p2*1000+p3*1000000});
			M[p1+1+p2*1000+p3*1000000] = 1;
		}
		if(p2+1<y && !M[p1+(p2+1)*1000+p3*1000000]){
			Q.push({A[0][p1]+A[1][p2+1]+A[2][p3],p1+(p2+1)*1000+p3*1000000});
			M[p1+(p2+1)*1000+p3*1000000] = 1;
		}
		if(p3+1<z && !M[p1+p2*1000+(p3+1)*1000000]){
			Q.push({A[0][p1]+A[1][p2]+A[2][p3+1],p1+p2*1000+(p3+1)*1000000});
			M[p1+p2*1000+(p3+1)*1000000] = 1;
		}

	}

	return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

void Main(){
    int N,K; cin >> N >> K;
    VI p(N); REP(i,N) cin >> p[i];
    int ans = 0;
    SORT(p);
    REP(i,K) ans += p[i];
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  int n; cin>>n;
  ll ans=0;
  REP(i,1,n) ans+=(n-1)/i;
  out(ans);
}

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


Measured memory_bytes: 3576
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N,A,B; cin>>N>>A>>B;
  vector<ll> X(N); rep(i,N) cin>>X[i];
  
  vector<ll> len(N-1); rep(i,N-1) len[i]=X[i+1]-X[i];
  ll ans=0;
  rep(i,N-1) ans+=(A*len[i]<=B?A*len[i]:B);
  
  cout<<ans<<endl;
  
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    vector<string> S(H);
    rep(y, H) cin >> S[y];

    int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
    rep(y, H)rep(x, W) {
        if (S[y][x] != '#') continue;

        bool res = false;
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if (0 <= ny && ny < H && 0 <= nx && nx < W && S[ny][nx] == '#') {
                res = true;
            }
        }
        if (!res) {
            puts("No");
            return 0;
        }
    }

    puts("Yes");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int n,x,t;
    scanf("%d%d%d",&n,&x,&t);
    int val=(n+x-1)/x;
    int ans=t*val;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3808
import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    if(n>=30)
    {
      System.out.println("Yes");
    }
    else
    {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35600
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STR_MAX		100000									// 最大文字列数
#define D_CHAR_CNT		3										// 文字種類数

// 内部変数
static FILE *szpFpI;											// 入力
static char sc1Str[D_STR_MAX + 5];								// 文字列
static int si1CCnt[D_CHAR_CNT];									// 各文字数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
#endif

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// データ - 初期化
	memset(si1CCnt, 0, sizeof(si1CCnt));						// 各文字数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 文字列 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 各文字数 - 取得
	for (i = 0; ; i++) {
		int liNo = sc1Str[i] - 'a';
		if (0 <= liNo && liNo < D_CHAR_CNT) {
			si1CCnt[liNo]++;
		}
		else {
			break;
		}
	}
	
	// 最大・最小の取得
	int liMax = INT_MIN;
	int liMin = INT_MAX;
	for (i = 0; i < D_CHAR_CNT; i++) {
		if (liMax < si1CCnt[i]) {
			liMax = si1CCnt[i];
		}
		if (liMin > si1CCnt[i]) {
			liMin = si1CCnt[i];
		}
	}

	// 結果 - セット
	if (liMax - liMin > 1) {
		sprintf(lc1Out, "NO\n");
	}
	else {
		sprintf(lc1Out, "YES\n");
	}

	// 結果 - 表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 256