akhauriyash/Code-Regression huggingface dataset:
#import sys
#sys.setrecursionlimit(10 ** 7)
'''
#import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
#sys.setrecursionlimit(10 ** 7)
'''
#inf = 10 ** 20
'''
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]

'''
def main():
    N = int(input())
    dp = [99999999] * (N + 1)
    dp[0] = 0
    for i in range(1, N + 1):
        dp[i] = dp[i - 1] + 1
        k = 6
        while i - k >= 0:
            dp[i] = min(dp[i], dp[i - k] + 1)
            k *= 6
        k = 9
        while i - k >= 0:
            dp[i] = min(dp[i], dp[i - k] + 1)
            k *= 9

    print(dp[N])

if __name__ == '__main__':
    main()


Measured memory_bytes: 40560
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  int N, W;
  std::cin >> N >> W;
  std::vector<int> weight(N);
  std::vector<int> value(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> weight[i] >> value[i];
  }

  std::vector<std::vector<long long>> dp(N + 1, std::vector<long long>(W + 1, 0));
  for (int i = 0; i < N; ++i) {
    for (int w = 0; w <= W; ++w) {
      chmax(dp[i + 1][w], dp[i][w]);
      if (w + weight[i] <= W) {
        chmax(dp[i + 1][w + weight[i]], dp[i][w] + value[i]);
      }
    }
  }
  std::cout << dp[N][W] << std::endl;

  return 0;
}


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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int a = Integer.parseInt(strArr[0]);
            int b = Integer.parseInt(strArr[1]);
            if (a + b > a - b) {
                if (a + b > a * b) {
                    System.out.println(a + b);
                } else {
                    System.out.println(a * b);
                }
            } else {
                if (a - b > a * b) {
                    System.out.println(a - b);
                } else {
                    System.out.println(a * b);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n;
int p[10], q[10];
void solve() {
    cin >> n;
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];

    vector<int> v(n);
    rep(i, n) v[i] = i + 1;
    int pp = 0;
    int qp = 0;
    int now = 0;
    do {
        bool ok = true;
        rep(i, n) if (p[i] != v[i]) { ok = false; break; }
        if (ok) pp = now;

        ok = true;
        rep(i, n) if (q[i] != v[i]) { ok = false; break; }
        if (ok) qp = now;

        ++now;
    } while (next_permutation(v.begin(), v.end()));

    cout << abs(pp - qp) << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
            
	public static void main(String[] args) {
		
           Scanner sc = new Scanner(System.in);                                                                     
           
           int A = sc.nextInt();
           int B = sc.nextInt();
           int C = sc.nextInt();
           int D = sc.nextInt();
           
           if(B <= C || D <= A){
               System.out.println(0);
           }else{
               if(A < C && C < B && B <D){
                   System.out.println(B-C);
               }else if(C <= A && B <=D){
                   System.out.println(B-A);                   
               }else if(A<= C && D<= B){
                   System.out.println(D-C);                                      
               }else if(C < A && A < D && D < B){
                   System.out.println(D-A);                                                         
               }                                                            
               
           }
           
         
        }
        
}       



Measured memory_bytes: 21844
#include <complex>
#include <iostream>

using namespace std;

typedef complex<int> P;

int main(){
	int n;
	while(cin >> n){
		if(!n) break;
		int m0; cin >> m0;
		int x0, y0, x, y;
		cin >> x0 >> y0;
		P P0[10];
		for(int i=1;i<m0;i++) { cin >> x >> y; P0[i-1] = P(x-x0,y-y0);}
		for(int i=0;i<n;i++){
			int m; cin >> m;
			P P1[10], P2[10];
			cin >> x0 >> y0;
			for(int j=1;j<m;j++) { cin >> x >> y; P1[j-1] = P(x-x0,y-y0); }
			if(m != m0) continue;
			bool check = true;
			for(int j=0;j<4;j++){
				bool flag = true;
				for(int k=0;k<m-1;k++) flag &= (P0[k] == P1[k]);
				if(flag) { cout << i+1 << endl; break; check = false;}
				for(int k=0;k<m-1;k++) P1[k] *= P(0,1);
			}
			if(check){
				for(int j=0;j<m-2;j++) P2[j] = P1[m-3-j] - P1[m-2];
				P2[m-2] = P(0,0) - P1[m-2]; 
				for(int j=0;j<4;j++){
					bool flag = true;
					for(int k=0;k<m-1;k++) flag &= (P0[k] == P2[k]);
					if(flag) { cout << i+1 << endl; break; }
					for(int k=0;k<m-1;k++) P2[k] *= P(0,1);
				}
			}
		}
		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 0
#include<iostream>

using namespace std;

int main()
{
	int n;
	int x[20], y[20], s=0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> y[i];
	}

	for (int i = 0; i < n; i++) {
		if (x[i] > y[i])
			s += x[i] - y[i];

	}
	cout << s << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll w, h;
    cin >> w >> h;
    vector<pair<ll, ll>> v;
    rep(i, w) {
        ll tmp;
        cin >> tmp;
        v.push_back(make_pair(tmp, 0));
    }
    rep(i, h) {
        ll tmp;
        cin >> tmp;
        v.push_back(make_pair(tmp, 1));
    }
    sort(all(v));
    ll ans = 0;
    w++; h++;
    rep(i, sz(v)) {
        if (v[i].second == 0) {
            ans += h * v[i].first;
            w--;
        }
        else {
            ans += w * v[i].first;
            h--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
	mint operator+(const mint a) const { return mint(*this) += a;}
	mint operator-(const mint a) const { return mint(*this) -= a;}
	mint operator*(const mint a) const { return mint(*this) *= a;}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod-2);}
	mint& operator/=(const mint a) { return *this *= a.inv();}
	mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
	int n, k;
	cin>>n>>k;
	vector<int> a(n);
	rep(i, n) cin>>a[i];

	rep(i, n) a[i]+=1000000000;
	sort(a.begin(), a.end());

	mint tot;
	mint sc=0, c=1;
	int b=k-2;
	for(int i=k-1, j=1; i<n; i++, j++){
		sc+=c;
		tot+=sc*a[i];
		c*=b+j;
		c/=j;
	}
	sc=0; c=1;
	for(int i=n-k, j=1; i>=0; i--, j++){
		sc+=c;
		tot-= sc*a[i];
		c*=b+j;
		c/=j;
	}

	cout<<tot<<endl;
	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    char c;
    cin >> c;
    if (c == 'A')
        OP("T");
    else if (c == 'T')
        OP("A");
    else if (c == 'G')
        OP("C");
    else if (c == 'C')
        OP("G");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include <set>
#define ll long long
using namespace std;

const int maxs = 2e5+9;
int a[maxs];
int main()
{
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);

    while(k--)
    {
        int b[maxs];
        memset(b,0,sizeof(b));
        for(int i=1;i<=n;i++)
        {
            int l = max(1,i-a[i]);
            int r = min(n,i+a[i]);

            b[l]++;
            b[r+1]--;
        }

        int flag = 1;
        for(int i=1;i<=n;i++)
        {
            a[i] = a[i-1] + b[i];
            if(a[i]!=n) flag = 0;
        }
        if(flag) break;
    }
    for(int i=1;i<=n;i++)
    {
        printf("%d ",a[i]);
    }
    return 0;
}


Measured memory_bytes: 5344
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;

 #define rep(i, a, b) for (int i=a; i<(b); i++)
    
 #define sz(x) (int)(x).size()
 #define mp make_pair
 #define pb push_back
 #define f first
 #define s second
 #define lb lower_bound
 #define ub upper_bound
 #define all(x) x.begin(), x.end()
 

 #define trav(container, it) for(typeof(container.begin()) it=container.begin(); it!=container.end(); it++)
 
 #define PI 3.14159265358979323846264338327950L
const int MOD = 1000000007;
const char nl = '\n';

ll primef(ll n)
{
    vl v;
    ll count=0;
    ll temp = n;
    ll res=0;
    for(ll i=2;i*i<=n;++i)
    {
        count=0;
        if(temp%i == 0)
        {
            while(temp%i == 0)
            {
                temp/=i;
                ++count;
            }          
        //}
        for(int j=1;j<=count;++j)
        {
            res++;
            count-=j;            
        }
    }  
    }
    if(temp>1) res++;
    return res;
}
 
int main() 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;cin>>n;


    ll res = primef(n);

    cout<<res;
}


Measured memory_bytes: 3660
//(c) nupetan 2018
#include<stdio.h>
void separate();
int main(){
	int building_number	=	0;
	int floor_number	=	0;
	int rank			=	0;
	int vacancy			=	0;

	int capacity[4][30]	=  {};
	int i = 0, num = 0, quantity = 0;

	scanf("%d",&num);
	for(i;i<num;i++)
	{
		scanf("%d%d%d%d",&building_number,&floor_number,&rank,&vacancy);
		capacity[building_number-1][(floor_number-1)*10+(rank-1)]	+=	vacancy;
	}

	for(i = 0; i<4; i++)
	{
		if(i)separate();
		for(quantity =	0; quantity < 10; quantity++)
			printf(" %d",capacity[i][quantity]);
			puts("");
		for(quantity = 10; quantity < 20; quantity++)
			printf(" %d",capacity[i][quantity]);
			puts("");
		for(quantity = 20; quantity < 30; quantity++)
			printf(" %d",capacity[i][quantity]);
			puts("");
	}
}

void separate()
	{
		int a = 0;
		for(a;a<20;a++)
		{
			putchar('#');
		}
		putchar('\n');
	}


Measured memory_bytes: 2036
#include<iostream>
using namespace std;
typedef long long int ll;
int main()
{
  ios_base::sync_with_stdio(0);
  ll x;
  cin>>x;
  if(x==1)
    cout<<0<<"\n";
  else if(x==0)
    cout<<1<<"\n";
  return 0;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;
const LL INF = 1e18;

int n, m, k;
LL a[N], b[N];

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i ++ ) scanf("%lld", &a[i]);
	for (int i = 1; i <= m; i ++ ) scanf("%lld", &b[i]);
	a[0] = b[0] = -INF;
	a[n + 1] = b[m + 1] = INF;
	
	while (k -- )
	{
		LL x;
		scanf("%lld", &x);
		
		LL res = INF;
		LL la = a[upper_bound(a, a + n + 2, x) - a - 1];
		LL lb = b[upper_bound(b, b + m + 2, x) - b - 1];
		LL ra = a[lower_bound(a, a + n + 2, x) - a];
		LL rb = b[lower_bound(b, b + m + 2, x) - b];
		
		res = min(res, max(ra, rb) - x);
		res = min(res, x - min(la, lb));
		res = min(res, 2LL * min(ra - x, x - lb) + max(ra - x, x - lb));
		res = min(res, 2LL * min(rb - x, x - la) + max(rb - x, x - la));
		printf("%lld\n", res);
	}
    return 0;
}

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

int main(){
  int h,w;
  cin >> h >> w;
  string s;
  rep(i,h){
    for(char c = 'A';c < 'A'+w;++c){
      cin >> s;
      if(s == "snuke"){
        cout << c << i+1 << endl;
        return 0;
      }
      else s = "";
    }
  }
  return 0;
}


Measured memory_bytes: 256
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 2e5 + 5;

int arr[N], brr[N];

int main() {
    int n = read(), k = read();
    generate_n(arr + 1, n, read);
    int cur = 0;
    for (int i = 1; i <= n; ++i) {
        (cur += arr[i]) %= k;
        brr[i] = (cur - i) % k;
        if (brr[i] < 0) brr[i] += k;
    }
    LL ans = 0;
    map<int, int> mp;
    for (int i = 0; i <= n; ++i) {
        if (i >= k) {
            --mp[brr[i - k]];
        }
        ans += mp[brr[i]];
        ++mp[brr[i]];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
    #include<math.h>
    #include<algorithm> 
    #define rep(i,n) for (int i = 0; i < (n) ; ++i)
    using namespace std;
    using ll = long long ;
    using P = pair<int, int> ;
    #define PI 3.14159265358979323846264338327950
    #define INF 1e18
     
    int main() {
        ll a ;
        double b ; 
        cin >> a >> b ;
        ll c = (ll)(b * 100 + 0.5) ;
        ll ans = a * c / 100;
        cout << ans << endl ;
    } 

Measured memory_bytes: 3716
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊

    let (a, b, x) = (io.read::<i64>(), io.read::<i64>(), io.read::<i64>());

    if a == b {
        io.writeln(if a % x == 0 { 1 } else { 0 });
        return;
    }
    if a == 0 {
        io.writeln(b / x + 1);
        return;
    }
    io.writeln(b / x - (a - 1) / x);
}

static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
using namespace std;
long long dp[100][21];
int main(){
	int n,s[100],w;
	cin>>n;
	for(int i=0;i<n-1;i++)
		cin>>s[i];
	cin>>w;
	for(int i=0;i<n;i++){
		for(int j=0;j<=20;j++){
			dp[i][j]=0;
		}
	}
	dp[0][s[0]]=1;
	for(int i=1;i<n-1;i++){
		for(int j=0;j<=20;j++){
			if(j-s[i]>=0)
				dp[i][j]+=dp[i-1][j-s[i]];
			if(j+s[i]<=20)
				dp[i][j]+=dp[i-1][j+s[i]];
		}
	}
	cout<<dp[n-2][w]<<endl;
	return 0;
}

Measured memory_bytes: 1172
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 100010;
const int INF = 2147483600;
const LL Mod = 1000000007LL;
const LL iv2 = (Mod+1)/2;

int N,Q; 
int a[MAXN+1]; LL f[3010][3010];
inline void Add(LL &x,LL y){ x=(x+y>=Mod?x+y-Mod:x+y); }

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(),Q=read(); LL ret=1;
	for(int i=1;i<=N;i++) a[i]=read();
	for(int i=1;i<=N;i++)
		for(int j=i+1;j<=N;j++){
			if(a[i]>a[j]) f[i][j]=1;
			else if(a[i]<a[j]) f[j][i]=1;
		}
	for(int i=1;i<=Q;i++){
		ret=ret*2%Mod;
		int x=read(),y=read();
		if(x==y) continue;
		for(int j=1;j<=N;j++){
			LL jy=f[j][y],yj=f[y][j],jx=f[j][x],xj=f[x][j];
			if(j!=x) { Add(f[j][x],jy); Add(f[x][j],yj); }
			if(j!=y) { Add(f[j][y],jx); Add(f[y][j],xj); }
		} 
		for(int j=1;j<=N;j++){
			if(j!=x) {
				f[j][y]=f[j][y]*iv2%Mod;
				f[y][j]=f[y][j]*iv2%Mod;
			}if(j!=y) {
				f[j][x]=f[j][x]*iv2%Mod;
				f[x][j]=f[x][j]*iv2%Mod;
			}
		}
		LL s=f[x][y]+f[y][x]; s=s*iv2%Mod;
		f[x][y]=f[y][x]=s%Mod;
	} LL ans=0;
	for(int i=1;i<=N;i++) for(int j=i+1;j<=N;j++) Add(ans,f[i][j]);
	printf("%lld\n",ans*ret%Mod);
	return 0;
}




Measured memory_bytes: 70912
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

		int n = readInt(r);
		String[] numArrayStr = r.readLine().split(" ");

		int[] numArrayInt = convertToInt(numArrayStr);

		selectSort(numArrayInt);
	}

	public static void selectSort(int[] numArrayInt) {
		int count = 0;
		for(int i = 0; i < numArrayInt.length; i++){
			int miny = i;
			for(int y = i; y < numArrayInt.length; y++){
				if(numArrayInt[y] < numArrayInt[miny]){
					miny = y;
				}
			}

			if(miny != i){
				int temp = numArrayInt[i];
				numArrayInt[i] = numArrayInt[miny];
				numArrayInt[miny] = temp;
				count++;
			}

		}
		printBlank(numArrayInt);
		System.out.println(count);
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] convertToInt(String[] numArrayStr){
		int[] numArrayInt = new int[numArrayStr.length];
		for(int i = 0; i < numArrayStr.length; i++){
			numArrayInt[i] = Integer.parseInt(numArrayStr[i]);
		}
		return numArrayInt;
	}

	public static void printBlank(int[] numArrayInt){
		StringBuilder builder = new StringBuilder();
		for(int i = 0; i < numArrayInt.length; i++){
			builder.append(numArrayInt[i]);
			builder.append(" ");
		}

		System.out.println(builder.toString().trim());
	}
}

Measured memory_bytes: 24412
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int D;
    cin >> D;
    switch (D) {
        case 22:
            cout << "Christmas Eve Eve Eve" << endl;
            break;
        case 23:
            cout << "Christmas Eve Eve" << endl;
            break;
        case 24:
            cout << "Christmas Eve" << endl;
            break;
        case 25:
            cout << "Christmas" << endl;
            break;
    }
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
using namespace std;
int h[100];
int main(int argc, const char * argv[])
{
    int n,ans=0,diff=0;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>h[i];
    ans=h[0];
    for(int i=1;i<n;i++)
    {
        diff=h[i]-h[i-1];
        if(diff>0)
            ans+=diff;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
edge = [list(map(int,input().split())) for i in range(N-1)]

graph = [[] for i in range(N)]
for e in edge:
    graph[e[0]-1].append(e[1]-1)

queue = deque()
queue.append(0)

color = [-1 for _ in range(N)]

k = 0

while queue:
    c = 0
    node = queue.popleft()
    for adj in graph[node]:
        if color[node] == c:
            c += 1
        color[adj] = c
        k = max(k,c+1)
        c += 1
        queue.append(adj)
print(k)

for e in edge:
    print(color[e[1]-1]+1)

Measured memory_bytes: 76892
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int h = Integer.parseInt(sa[0]);
		int w = Integer.parseInt(sa[1]);
		char[][] s = new char[h][w];
		for (int i = 0; i < h; i++) {
			s[i] = br.readLine().toCharArray();
		}
		br.close();

		int[][] d = new int[h][w];
		for (int i = 0; i < h; i++) {
			Arrays.fill(d[i], 1000000);
		}

		Queue<Integer> que = new ArrayDeque<>();
		que.add(0);
		if (s[0][0] == '#') {
			d[0][0] = 1;
		} else {
			d[0][0] = 0;
		}
		while (!que.isEmpty()) {
			int cur = que.poll();
			int cx = cur / 1000;
			int cy = cur % 1000;
			if (cx < h - 1) {
				int nx = cx + 1;
				int ny = cy;
				int nd = d[cx][cy];
				if (s[cx][cy] != s[nx][ny]) {
					nd++;
				}
				if (nd < d[nx][ny]) {
					d[nx][ny] = nd;
					que.add(nx * 1000 + ny);
				}
			}
			if (cy < w - 1) {
				int nx = cx;
				int ny = cy + 1;
				int nd = d[cx][cy];
				if (s[cx][cy] != s[nx][ny]) {
					nd++;
				}
				if (nd < d[nx][ny]) {
					d[nx][ny] = nd;
					que.add(nx * 1000 + ny);
				}
			}
		}
		System.out.println((d[h - 1][w - 1] + 1) / 2);
	}
}


Measured memory_bytes: 23252
package main

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

var scanner *bufio.Scanner

func printIt() {
	sNum := make([]bool, 14)
	hNum := make([]bool, 14)
	cNum := make([]bool, 14)
	dNum := make([]bool, 14)

	n := nextInt()
	for i := 0; i < n; i++ {
		cardType := nextString()
		num := nextInt()
		if cardType == "S" {
			sNum[num] = true
		} else if cardType == "H" {
			hNum[num] = true
		} else if cardType == "C" {
			cNum[num] = true
		} else {
			dNum[num] = true
		}
	}
	for i := 1; i <= 13; i++ {
		if !sNum[i] {
			fmt.Println("S", i)
		}
	}
	for i := 1; i <= 13; i++ {
		if !hNum[i] {
			fmt.Println("H", i)
		}
	}
	for i := 1; i <= 13; i++ {
		if !cNum[i] {
			fmt.Println("C", i)
		}
	}
	for i := 1; i <= 13; i++ {
		if !dNum[i] {
			fmt.Println("D", i)
		}
	}

}

func nextInt() int {
	scanner.Scan()
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(1)
	}
	return num
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	printIt()
}



Measured memory_bytes: 1120
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    H,W,N=ii(),ii(),ii()
    if H>W:
        H,W=W,H
    s = 0
    for i in count(1):
        s += W
        if s>=N:
            print(i)
            break


main()


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  bool possible = false;
  for (int i = 0; i < a; i++){
    if ((b * i + c) % a == 0) possible = true;
  }
  cout << (possible ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
        table[i] *= i
    
    return table

n = int(input())
eras = num_divisors_table(n)
  
print(sum(eras))

Measured memory_bytes: 146104
#
# Yet I'm feeling like
# 	There is no better place than right by your side
# 		I had a little taste
# 			And I'll only spoil the party anyway
# 				'Cause all the girls are looking fine
# 					But you're the only one on my mind


import sys
inf = float("inf")
#sys.setrecursionlimit(1000000)


# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod,MOD=1000000007,998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

#from cmath import sqrt
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial,pow,pi,gcd,log10
#from bisect import bisect_left,bisect_right
#import numpy as np

def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

a,b=get_ints()
print(max(a+b,a-b,a*b))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279
 
#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ll INF = LLONG_MAX;
const ll MOD = 1000000007;
#define VEC(type,A,N) vector<type> A(N)
#define VECi(type,A,N,i) vector<type> A(N,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N,vector<type>(M))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N,vector<type>(M,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ll N,K;
    cin>>N>>K;
    
    ll i=0;
    while(N>0){
        i++;
        N-=K;
        if(N<=0)break;
        N++;
    }
    cout<<i;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int x1, x2;
    cin >> x1 >> x2;

    cout << abs(x1-x2) << endl;
    return 0;
}



Measured memory_bytes: 3076
#include<iostream>
#include<vector>
#include<functional>
#include<queue>
#include<algorithm>
using namespace std;
vector<pair<int,int>>x[300000];
int n,m,s,a,b,c,dist[300000],dist2[500][500];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > Q;
void dijkstra(int V,int E,int s) {
	for(int i=0;i<V;i++)dist[i]=999999999;
	dist[s]=0;Q.push(make_pair(0,s));
	while(!Q.empty()){
		int a1=Q.top().first,a2=Q.top().second;Q.pop();
		for(int i=0;i<x[a2].size();i++){
			if(dist[x[a2][i].first]>a1+x[a2][i].second){
				dist[x[a2][i].first]=a1+x[a2][i].second;
				Q.push(make_pair(dist[x[a2][i].first],x[a2][i].first));
			}
		}
	}
}
int main(){
	int s;
	cin>>n>>m;cin>>s;
	for(int i=0;i<m;i++){
		cin>>a>>b>>c;x[a].push_back(make_pair(b,c));
	}
	/*for(int i=0;i<n;i++){
		dijkstra(n,m,i);
		for(int j=0;j<n;j++)dist2[i][j]=dist[j];
	}
	int q;cin>>q;
	for(int i=0;i<q;i++){
		cin>>a>>b;a--;b--;
		if(dist2[a][b]>=999999999)cout<<"-1"<<endl;
		else cout<<dist2[a][b]<<endl;
	}*/
	dijkstra(n,m,s);
	for(int i=0;i<n;i++){
		if(dist[i]==999999999)cout<<"INF"<<endl;
		else cout<<dist[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 17616
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O20")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
using ll = int; using namespace std;

#ifndef __GNUC__
string text =
R"X(50)X";
stringstream iss{text};
#endif

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

	ll N; iss >> N;
	bool ok{false};
	auto qr = div(N, 1);
	for (ll i = 1; i < 10; ++i) {
		qr = div(N, i);
		if (qr.rem == 0 && qr.quot < 10) ok = true;
	}
	cout << (ok ? "Yes" : "No") << "\n";
}


Measured memory_bytes: 3616
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<int> VE;
const ll mod = 1e9 + 7; //10^9+7

ll ncr[10101][10101];

//nCnまで計算
void nCr(int n){
    REP(i,n+1)REP(j,i+1){
            if(j==0)ncr[i][j]=1;
            else ncr[i][j]=ncr[i-1][j]+ncr[i-1][j-1];
        }
}

int main(){
    int n, k;
    cin >> n >> k;
    int zeros = n / k;
    int half_k = 0;
    REP(i, n + 1){
        if(i % k == k / 2)half_k++;
    }
    ll ans = 0;
    if(k % 2){
        ans = pow(zeros, 3);
    }else{
        ans = pow(zeros, 3) + pow(half_k, 3);
    }
    print(ans);
}


Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define MOD 1000000007
using ll=long long;

int main(){
  int N,Q;
  cin>>N;
  vector<int> V(N),W(N);
  for(int i=0;i<N;i++){
    cin>>V[i]>>W[i];
  }
  cin>>Q;
  vector<int> v(Q),L(Q);
  for(int i=0;i<Q;i++){
    cin>>v[i]>>L[i];
    v[i]--;
  }

  vector<vector<int>> dp(min(N,(1<<10)-1),vector<int>(100001,0));
  for(int i=0;i<min(N,(1<<10)-1);i++){
    if(i==0){
      for(int j=100000;j-W.at(i)>=0;j--){
        dp[i][j]=max(dp[i][j],dp[i][j-W[i]]+V[i]);
      }
    }else{
      int x=(i-1)/2;
      for(int j=0;j<=100000;j++){
        dp[i][j]=dp[x][j];
        if(j-W[i]>=0){
          dp[i][j]=max(dp[i][j],dp[x][j-W[i]]+V[i]);
        }
      }
    }
  }

  for(int i=0;i<Q;i++){
    if(v[i]<((1<<10)-1)){
      cout<<dp[v[i]][L[i]]<<endl;
    }else{
      vector<int> pre;
      int x=v[i];
      while(x>=((1<<10)-1)){
        pre.push_back(x);
        x=(x-1)/2;
      }
      int ans=dp[x][L[i]];
      int n=pre.size();
      for(int j=0;j<(1<<n);j++){
        int value=0;
        int weight=0;
        for(int k=0;k<n;k++){
          if(((j>>k)&1)==1){
            value+=V[pre[k]];
            weight+=W[pre[k]];
          }
          if(weight<=L[i]){
            ans=max(ans,value+dp[x][L[i]-weight]);
          }
        }
      }
      cout<<ans<<endl;
    }
  }
}


Measured memory_bytes: 407440
#include <iostream>
#include <algorithm>
#include <cfenv>
#include <cmath>
#include <vector>
using namespace std;
typedef long long ll;
int main(void){
    ll x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x),b(y),c(z);
    for(int i = 0;i < x;i++) cin >> a[i];
    for(int i = 0;i < y;i++) cin >> b[i];
    for(int i = 0;i < z;i++) cin >> c[i];
    vector<ll> ab;
    for(int i = 0;i < x;i++){
        for(int j = 0;j < y;j++) ab.push_back(a[i]+b[j]);
    }
    sort(ab.begin(),ab.end(),greater<ll>());
    ab.resize(k);
    
    vector<ll> abc;
    for(int i = 0;i < k;i++){
        for(int j = 0;j < z;j++) abc.push_back(ab[i]+c[j]);
    }
    sort(abc.begin(),abc.end(),greater<ll>());
    abc.resize(k);
    
    for(int i = 0;i < k;i++) cout << abc[i] << endl;
    return 0;
}


Measured memory_bytes: 43368
# include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
template<typename T>vector<T> make_v(size_t a){ return vector<T>(a); }
template<typename T,typename... Ts>auto make_v(size_t a, Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V>typename enable_if<is_class<T>::value==0>::type fill_v(T &t, const V &v){ t = v; }
template<typename T,typename V>typename enable_if<is_class<T>::value!=0>::type fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
string s;
int cntr, cntb;
int main(){
    INIT;
    cin >> n;
    cin >> s;
    REP(i, n){
        if(s[i] == 'R')cntr++;
        else cntb++;
    }
    if(cntr > cntb){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()), ((v).end())
#define s(n) scanf("%d", &n)
#define sc(n) scanf("%c", &n)
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define ss(n) scanf("%s", n)
#define INF (int)1e9
#define EPS 1e-9
#define bitcount __builtin_popcount
#define gcd __gcd
#define n_mod(a, k) ((a % k) + k) % k
#define mod(a, k) (a % k)
#define sz(v) ((int)((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define rep(i, v) for (int i = 0; i < sz(v); ++i)
#define lp(i, n) for (int i = 0; i < (int)(n); ++i)
#define lpi(i, j, n) for (int i = (j); i < (int)(n); ++i)
#define lpd(i, j, n) for (int i = (j); i >= (int)(n); --i)
#define LSOne(S) (S & (-S))
#define repa(v) lpi(i, 0, sz(v)) lpi(j, 0, sz(v[i]))
#define P(x) cout << #x << " = { " << x << " }\n"
#define PB push_back
#define MP make_pair
#define M_PI 3.14159265358979323846
#define fast_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define file_IO                       \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<string> vs;
int dcmp(double x, double y)
{
    return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}
const int MAX = 1e5 + 10;
const int MAX2 = 1e3 + 10;
int n, k;
ll memo[MAX];
ll arr[MAX];
ll dp(int i)
{
    if (i >= n)
        return INF;
    if (i == n - 1)
    {
        return 0;
    }
    ll &ret = memo[i];
    if (ret != -1)
    {
        return ret;
    }
    ll path = INF;
    for (int kk = 1; kk <= k; kk++)
    {
        path = min(path, dp(i + kk) + abs(arr[i] - arr[i + kk]));
    }
    return ret = path;
}
int main()
{
    // #ifndef ONLINE_JUDGE
    //     file_IO;
    // #else
    //     fast_IO;
    // #endif
   // file_IO;
    fast_IO;
    clr(memo, -1);
    cin >> n >> k;
    lp(i, n)
    {
        cin >> arr[i];
    }
    cout << dp(0) << '\n';
}

Measured memory_bytes: 6528
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	inputList = input.split("\n");
    inputNum = parseInt(inputList[0], 10);
    menuList = [];
    totalList = [];
    takahashiP = 0;
    aokiP = 0;
    
    for (var i = 1; i <= inputNum; i++) {
        row = inputList[i].split(" ").map(str => parseInt(str, 10));
        menuList[i - 1] =  row;
        totalList[i - 1] = [i - 1,row[0] + row[1]];
    }
    sortList = totalList.sort(function(a,b){return(b[1] - a[1]);})
    for (var i = 0; i < inputNum; i++) {
        targetIndex = sortList[i][0];
        if(i == 0 || i % 2 == 0) {
            takahashiP += menuList[targetIndex][0];
        } else {
            aokiP += menuList[targetIndex][1];
        }        
    }
    console.log(takahashiP - aokiP)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define ll long long int
#define endl "\n"
#define mod 1000000007
#define maxN 100005


int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll temp = s.size();
	if (temp <= n) {
		cout << s << endl;
	} else {
		cout << s.substr(0, n) + "..." << endl;
	}

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <vector>
int main()
{
    char x[6];
    int ans = 0;
    std::cin >> x;
    for(int i = 0; i < 6; i++)
    {
        if(x[i] == '1')
        {
            ans++;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

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

#define EPS (1e-10)
#define equals(a, b) (fabs(a) - (b)) < EPS)

using namespace std;

class Point {
public:
	double x, y;

	Point(double x = 0, double y = 0) :x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double s) { return Point(x * s, y * s); }
	Point operator / (double s) { return Point(x / s, y / s); }

	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}

	bool operator < (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}

	bool operator == (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}

};
typedef Point Vector;

double cross(Vector a, Vector b) {
	return a.x * b.y - a.y * b.x;
}

double dot(Vector a, Vector b) {
	return a.x*b.x + a.y * b.y;
}
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

// Calculate the relation of points
int ccw(Point p0, Point p1, Point p2)
{
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if (cross(a, b) < -EPS) return CLOCKWISE;
	if (dot(a, b) < -EPS) return ONLINE_BACK;
	if (a.norm() < b.norm()) return ONLINE_FRONT;
	return ON_SEGMENT;
}

int main() {
	// Input
	double x, y;
	cin >> x >> y;
	Point p0(x,y);
	cin >> x >> y;
	Point p1(x, y);
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> x >> y;
		Point p2(x, y);
		// CCW
		switch (ccw(p0,p1,p2))
		{
		case -1: cout << "CLOCKWISE" << endl;
			break;
		case 1: cout << "COUNTER_CLOCKWISE" << endl;
			break;
		case -2: cout << "ONLINE_FRONT" << endl;
			break;
		case 2: cout << "ONLINE_BACK" << endl;
			break;
		default:
			cout << "ON_SEGMENT" << endl;
			break;
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 3168