akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
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; }

int main()
{
  //input
  int N; cin >> N;

  //main
  vector<int> d(N);
  int sum = 0;
  int square = 0;
  for(int i=0; i<N; i++){ 
    cin >> d[i];
    sum += d[i];
    square += d[i]*d[i];
  }
  
  // output
  int ans = (sum*sum-square)/2;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include <string>
#include <typeinfo>
using namespace std;
 
int main() {
   string s;
  int ans(0);
  cin >> s;
  for(int i = 0;i < 3;i++){
    if(s.at(i) == 'R'){
      ans=1;
    }
  }
  if(s.at(0) == 'R' && s.at(1) == 'R' && s.at(2) == 'R')ans=3;
  else if(s.at(1) == 'R' && s.at(2) == 'R')ans=2;
   else if(s.at(1) == 'R' && s.at(0) == 'R')ans=2;
  
  cout << ans;

} 


Measured memory_bytes: 3564
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
using ll = long long;
 
const int nax = 10123;
char k[nax];
const int mod = 1e9 + 7;
 
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
 
int modder(int x, int moddi)
{
	while (x >= moddi) x -= moddi;
    return x;
}
 
int main() {
    scanf("%s", k);
    int D;
    scanf("%d", &D);
    int len = strlen(k);
    vector<array<int,2>> dp(D, array<int,2>{});
    vector<array<int,2>> new_dp(D, array<int,2>{});
    // dp[sum][smaller_already] - the number of ways to choose digits so far
    // such that the sum of digits modulo D is 'sum' and 'smaller_already'
    // says whether we already chosen some digit smaller than in K
    dp[0][0] = 1;
    for(int where = 0; where < len; ++where) {
        fill(new_dp.begin(), new_dp.end(), array<int,2>{});
        for(int sum = 0; sum < D; ++sum) {
            int sum2 = sum % D;
            for(bool sm_already : {false, true}) {
                for(int digit = 0; digit < 10; ++digit) {
                    if(digit > k[where] - '0' && !sm_already) {
                        break;
                    }
                    add_self(new_dp[modder(sum2+digit,D)][sm_already || (digit < k[where]-'0')],
                        dp[sum][sm_already]);
                }
            }
        }
        swap(dp, new_dp);
    }
    int answer = (dp[0][false] + dp[0][true]) % mod;
    --answer;
    if(answer == -1) {
        answer = mod - 1;
    }
    printf("%d\n", answer);
}

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

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

#define ll long long

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

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

  rep(i,n){
    auto it = lower_bound(dp.rbegin(), dp.rend(), a[i]);
    if(it==dp.rbegin())dp.push_back(a[i]);
    else{
      it--;
      *it = a[i];
    }
  }

  cout<<dp.size();

  return 0;
}

Measured memory_bytes: 2168
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i in range(n):
  if B[i] <= A[i]:
    count += B[i]
  else:
    if B[i] <= A[i] + A[i + 1]:
      count += B[i]
      A[i + 1] -= B[i] - A[i]
    else:
      count += A[i] + A[i + 1]
      A[i + 1] = 0
print(count)

Measured memory_bytes: 18476
#!/usr/bin/env python3
import sys


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()
    ans = 0
    for i in range(N):
        if i % 2 == 0 and A[i] % 2 == 1:
            ans += 1
    print(ans)


# oj t -c "pypy3 main.py"
# acc s main.py -- --guess-python-interpreter pypy
main()


Measured memory_bytes: 61784
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define INF (1LL<<60)
typedef long long Int;
inline void update(Int &a, Int b) { if(a>b) a=b; }

int N, M, L, K[2048], S[200000];
Int sum[200000], dp[2048][2048];

inline Int f(int l, int r) { return (sum[K[r]+1]-sum[K[l]])/L; }

int main() {
    scanf("%d%d%d", &N, &M, &L);
    rep(i, N) scanf("%d", K+i);
    rep(i, N) K[i]--;
    rep(i, M) scanf("%d", S+i);
    rep(i, M) sum[i+1] = sum[i] + S[i];
    sort(K, K+N);
    rep(i, 2048) rep(j, 2048) dp[i][j] = INF;
    dp[0][1] = f(0, 1);
    for(int k=1; k<N-1; k++) rep(i, k) {
        update(dp[i][k+1], dp[i][k]+f(k, k+1));
        update(dp[k][k+1], dp[i][k]+f(i, k+1));
    }
    Int ans = INF;
    rep(i, N-1) update(ans, dp[i][N-1]+f(i, N-1));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 33000
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int res=0;
    //組める限り組んでいく
    for(int i=0;i<n-1;i++){
        res+=a[i]/2;
        if(a[i]%2==1&&a[i+1]){
            res++;
            a[i+1]--;
        }
    }
    res+=a[n-1]/2;
    cout<<res<<endl;
}

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author bcools
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();

            out.write(String.valueOf(Math.min(a, b) + Math.min(c, d)));
        }

    }
}



Measured memory_bytes: 21716
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
int gcd(int a, int b);
int main()
{
	int n, k, num[100001], i, temp = 1;
	scanf("%d %d", &n, &k);
	for (i = 0; i < n; i++)
		scanf("%d", &num[i]);
	sort(num, num + n);
	if (num[n - 1] < k)
		printf("IMPOSSIBLE");
	else {
		temp = num[0];
		for (i = 1; i < n; i++)
			temp = gcd(temp, num[i]);
		if (k % temp == 0)
			printf("POSSIBLE");
		else
			printf("IMPOSSIBLE");
	}
	return 0;
}
int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a%b);
 }


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 100010;

ll ret;
int N;
ll A[MN];

int main() {
	cin >> N;
	ll pre = 0;

	rep(i, N) {
		cin >> A[i];

		if (A[i] == 0) {
			pre = A[i];
			continue;
		}

		if (pre) {
			++ret;
			--A[i];
		}

		ret += A[i] / 2;
		pre = A[i] & 1;
	}

	cout << ret << endl;

	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = n;
    rep(i, n - 1) {
        if(s[i] == s[i + 1]) ans--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int check(string S);
int main()
{
    string S;
    cin >> S;
    if (check(S) == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

int check(string S)
{
    int N = S.length();
    for (int i = 0; i < N / 2; i++)
    {
        if (S[i] != S[N - i - 1])
        {
            return 1;
        }
    }
    for (int i = 0; i < ((N - 1) / 2) / 2; i++)
    {
        if (S[i] != S[(N - 1) / 2 - i - 1])
        {
            return 1;
        }
    }
    for (int i = (N + 3) / 2 - 1; i < (N - (N + 3) / 2) / 2; i++)
    {
        if (S[i] != S[N - i - 1])
        {
            return 1;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <climits>
#define LIM 1000007
#define ll long long
using namespace std;
int main() {
  string ans;
  ans = "";
  string s;
  cin >> s;
  for (auto c : s) {
    if (c == 'B') {
      if (ans.size() >= 1) {
        ans = ans.substr(0, ans.size()-1);
      }
    } else {
      ans += c;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var a = Input.NextInt();
            var b = Input.NextInt();
            var c = Input.NextInt();

            Console.WriteLine((a * 100 + b * 10 + c) % 4 == 0 ? "YES" : "NO");
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

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

using namespace std;
using ll = long long;


int main()
{
    string s;
    cin >> s;
    int n = s.size();

    if(n & 1) {
        cout << (s[0] == s[n - 1] ? "Second" : "First") << endl;
    } else {
        cout << (s[0] == s[n - 1] ? "First" : "Second") << endl;
    }
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  vector<ll> t(n);
  ll sum = 0;
  REP(i, n) cin >> t[i], sum += t[i];
  ll m;
  cin >> m;
  vector<ll> ans(m);
  REP(i, m){
    ll p, x;
    cin >> p >> x;
    p--;
    ans[i] = sum - t[p] + x;
  }
  REP(i, m) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h> 
//#include<string.h>
//#include<math.h>
int main(){
	char s[5];
	int i,sum[92]={0},c=0;
	gets(s);
	for(i=0;i<4;i++){
		sum[s[i]]++;
	}
	for(i=65;i<92;i++){
		if(sum[i]==2)
			c++;
	}
	if(c==2) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
import Foundation

class Scanner {
    static func readInt() -> Int {
        return Int(readLine()!)!
    }
    
    static func readIntArr() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    static func readM(_ n: Int) -> [[Int]] {
        var res = [[Int]]()
        for _ in 0..<n {
            res.append(readIntArr())
        }
        return res
    }
    
    static func readUknownIntMat() -> [[Int]] {
        var res = [[Int]]()
        while let line = readLine() {
            res.append(line.split(separator: " ").map { Int($0)! })
        }
        return res
    }
    
    static func readString() -> String {
        return readLine()!
    }
}

class Printer {
    static func printIntArray(_ arr: [Int]) {
        print(arr.map { String($0) }.joined(separator: " "))
    }
}


class Solution {
    
    func streamline(_ arr: [Int], _ n: Int) -> Int {
        guard n < arr.count else {
            return 0
        }
        /*
         n = 2, take first one
         */
        let arr = arr.sorted()
        var dist = [Int]()
        var res = 0
        for i in stride(from: 0, to: arr.count-1, by: 1) {
            dist.append(arr[i+1]-arr[i])
            res += dist.last!
        }
        dist.sort(by: { $0 > $1 })
        for i in stride(from: 0, to: n-1, by: 1) {
            res -= dist[i]
        }
        return res
    }
}


let nm = Scanner.readIntArr()
let arr = Scanner.readIntArr()
print(Solution().streamline(arr, nm[0]))


Measured memory_bytes: 18716
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;
ll mod = 1e+9 + 7;

int main(){
    int L;
    cin >> L;

    double x = (double)L/3;

    double a = x, b = x, c = x;

    double ans = a*b*c;
    
    printf("%.10lf", ans);

    return 0;
}


Measured memory_bytes: 3704
//God's Grace
#include <iostream>
#include <map>
#include <algorithm>
#include <queue>
#include <list>
#include <string>
#include <cmath>
#include <stack>
#include <cstdio>
#include <fstream>
#include <climits>
#include <set>
#include <vector>
#include <tuple>
#include <cstring>
#include <functional>
#include <utility>
#include <iomanip>

using namespace std;

#define endl '\n'
#define f(k,a,b) for(int k=(a);k<(b);k++)
#define vi vector <int>
#define vvi vector <vector <int> >
#define vii vector <pair <int, int > >
#define int long long
#define lli long long
#define pii pair <int,int>
#define piii pair< pair<lli,lli>, lli >
#define fsd fflush(stdout);
#define pb(x) push_back(x)
#define all(x) x.begin(),x.end()
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
//#define tdef typedef
#define ret return
const int fix = (int)1e9 + 7;

int po2(lli a){double temp = a;if(log2(temp)==(int)log2(temp))return log2(temp);return -1;}
void tc(int i){cout<<"Case #"<<i+1<<": ";}
void yes(){cout<<"YES"<<endl;}
void no(){cout<<"NO"<<endl;}
void impb(){cout<<"IMPOSSIBLE"<<endl;}
int ct(){int t;scanf("%lld",&t);return t;}
int gcd(int a, int b) {if (b == 0)return a;return gcd(b, a % b);}
int pwr(int a, int b){ int x=1, y=a; while(b>0){if(b%2) x = (x*y)%fix; y=(y*y)%fix; b/=2;} return x;}
void error(){cerr<<"Here!"<<endl;}

/*
lli modinv(lli a, lli m){
	lli m0 = m;
	lli y = 0, x = 1;

	    if (m == 1)
	      return 0;

	    while (a > 1)
	    {
	        // q is quotient
	       lli q = a / m;
	       lli t = m;

	        // m is remainder now, process same as
	        // Euclid's algo
	        m = a % m, a = t;
	        t = y;

	        // Update y and x
	        y = x - q * y;
	        x = t;
	    }

	    // Make x positive
	    if (x < 0)
	       x += m0;

	    return x;

}

*/

int pmodinv(int a){
	return pwr(a,fix-2);
}

//int arr[(int)5e5+5];
const int N = 5e5+5;
list <int> adj[N];
queue <int> q;

int comanc(int u, int v,int parent[]){
	while(u^v){
		if(u==1||v==1)
			return 1;
		u = parent[u];
		v = parent[v];
	}

	return u;
}
int x;

int max(int a, int b){
	if (a>b)
		return a;
	return b;
}

vector <int> factorial((int)4002);

int nCr(int n, int k){
	return (factorial[n]*((pmodinv(factorial[k])*pmodinv(factorial[n-k]))%fix))%fix;
}





int32_t main() {




	int t=1;
	//t=ct();


	f(ii,0,t){
		int n=ct();
		vi dp(n+1,INT_MAX);
		vi h(n+1);
		f(j,1,n+1)cin>>h[j];
		dp[1]=0;
		dp[2] = abs(h[2]-h[1]);
		f(j,3,n+1){

			dp[j] = min(dp[j], min(dp[j-2] + abs(h[j]-h[j-2]),dp[j-1] + abs(h[j]-h[j-1])));
		}

		printf("%lld\n",dp[n]);
	}
	ret 0;
}


Measured memory_bytes: 16908
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n = int(input())
  b = input_list()
  sb = list(sorted(list(set(b)), reverse=True))
  a = []
  def get(sb, b):
    for x in sb:
      if x > len(b):
        continue
      if b[x-1] == x:
        return x-1
    return -1
  for i in range(n):
    index = get(sb, b)
    if index == -1:
      print(-1)
      exit(0)
    a.append(b[index])
    del b[index]
  
  for v in a[::-1]:
    print(v)
      
  
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int arr[n], sum = 0;
  for(auto&q:arr){
    cin >> q;
    sum += q;
  }
  sort(arr, arr+n);
  reverse(arr, arr+n);
  bool ans = true;
  int can = sum / (4*m);
  if(sum % (4*m) != 0)
    can++;
  for(int i = 0; i < m; i++){
    if(arr[i] < can)
      ans = false;
  }
  if(ans)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  string s;
  cin >> s;
  int k;
  cin >> k;
  vector<string> subs;
  for(int i = 0; i < s.length(); i++){
    for(int j = i; j < s.length() && j-i < k; j++){
      string sub = s.substr(i, j-i+1);
      subs.push_back(sub);
    }
  }
  sort(subs.begin(), subs.end());
  subs.erase(unique(subs.begin(), subs.end()), subs.end());
  int count = 0;
  string last = "";
//  for(int i = 0; i < subs.size(); i++) cout << subs[i] << endl;
  for(int i = 0; i < subs.size(); i++){
    if(last != subs[i]){
      last = subs[i];
      count++;
    }
    if(count == k){
      cout << last << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1660
package main

import (
	"fmt"
	"strings"
)

const mod int = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)

	memo := make([]map[string]int, n+1)
	for i := 0; i < n+1; i++ {
		memo[i] = make(map[string]int)
	}

	var dfs func(i int, tmp string) int
	dfs = func(i int, tmp string) int {
		if i == n {
			return 1
		}

		if c, ok := memo[i][tmp]; ok {
			return c
		}

		cnt := 0
		for _, c := range "AGCT" {
			t := string(c)
			if !isOK(tmp + t) {
				continue
			}
			s := tmp + t
			if 3 < len(s) {
				s = s[1:]
			}

			cnt += dfs(i+1, s)
			cnt %= mod
		}

		memo[i][tmp] = cnt
		return cnt
	}

	ans := dfs(0, "")
	fmt.Println(ans)
}

func isOK(s string) bool {
	ngs := []string{"AGC", "GAC", "ACG"}
	for _, ng := range ngs {
		if strings.Contains(s, ng) {
			return false
		}
	}

	if len(s) == 4 {
		t1 := string([]byte{s[0], s[2], s[3]}) // A*GC
		t2 := string([]byte{s[0], s[1], s[3]}) // AG*C
		if t1 == "AGC" || t2 == "AGC" {
			return false
		}
	}

	return true
}


Measured memory_bytes: 2788
from math import ceil
N, A, B = map(int, input().split())
H = sorted([int(input()) for i in range(N)])
C = A - B

lo, hi = -1, 10**9
while hi - lo > 1:
    X = (hi + lo) // 2
    H2 = [max(0, h - (X * B)) for h in H]
    need = sum([ceil(h / C) for h in H2])
    if need > X:
        lo = X
    else:
        hi = X

print(hi)


Measured memory_bytes: 15736
import java.util.Scanner;

public class Main {
    void run(String[] args){
        Scanner scan=new Scanner(System.in);
        String line=scan.nextLine();
        String str;
        String[] lines=line.split("");
        if(lines[lines.length-1].equals("s")){
            str=line+"es";
        }
        else{
            str=line+"s";
        }
        System.out.println(str);
    }
    public static void main(String args[]){
        Main printer = new Main();
        printer.run(args);
    }
}

Measured memory_bytes: 38528
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;



int g[15][15];
int n,m;

int intercost[33000];
int maxcost[15][33000];
int cost[15][33000];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b, c; cin >> a >> b >> c; a--; b--;
        g[a][b] = g[b][a] = c;
    }

    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            intercost[(1<<i) | (1<<j)] += g[i][j];
        }
    }

    for (int i = 0; i < n; i++) {
        for (int bm = 0; bm < (1<<n); bm++) {
            if (bm & (1<<i)) intercost[bm] += intercost[bm ^ (1<<i)];
            maxcost[i][bm] = -1;
        }
    }

    int all = (1<<n)-1;
    maxcost[0][1] = 0;

    for (int bm = 0; bm < (1<<n); bm++) {
        for (int cur = 0; cur < n; cur++) if (maxcost[cur][bm] != -1) {
            for (int nxt = 0; nxt < n; nxt++) if (!(bm & (1<<nxt)) && g[cur][nxt]) {
                //cout << cur << " " << bm << " --> " << nxt << " " << (bm | (1<<nxt)) << " " << maxcost[cur][bm] + g[cur][nxt] << endl;
                maxcost[nxt][bm | (1<<nxt)] = max(maxcost[nxt][bm | (1<<nxt)], maxcost[cur][bm] + g[cur][nxt]);
            }

            int combm = all ^ bm;
            for (int sub = combm; sub > 0; sub = (sub-1) & combm) {
                //cout << cur << " " << bm << " " << maxcost[cur][bm] << " -> " << (bm | sub) << " " << intercost[sub | cur] + maxcost[cur][bm] << endl;
                maxcost[cur][bm | sub] = max(maxcost[cur][bm | sub], intercost[sub | (1<<cur)] + maxcost[cur][bm]);
            }
        }
    }

    //cout << maxcost[n-1][(1<<n)-1] << endl;
    cout << intercost[(1<<n)-1] - maxcost[n-1][(1<<n)-1] << endl;
    return 0;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

bool sieve[100000];
int prime[10000];

int main() {
    sieve[0] = sieve[1] = true;
    int idx = 0;
    FOR(i, 2, 100000) {
        if (sieve[i]) continue;
        prime[idx] = i;
        idx++;
        for (int j = i+i; j < 100000; j += i) {
            sieve[j] = true;
        }
    }

    int m, a, b;
    while (cin >> m >> a >> b, m|a|b) {
        int ma = 0;
        int P, Q;
        REP(i, idx) {
            ll p = prime[i];
            if (p < m) {
                int B = b*p/a;
                FOR(j, i, idx) {
                    ll q = prime[j];
                    if (q <= B && p*q <= m) {
                        if (ma < p*q) {
                            ma = p*q;
                            P = p;
                            Q = q;
                        }
                    } else {
                        break;
                    }
                }
            } else {
                break;
            }
        }
        printf("%d %d\n", P, Q);
    }
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

// Verified: ABC135F
vector<int> FindAllByRollingHash(const vector<int64>& s, const vector<int64>& key) {
  if (s.size() < key.size()) return {};

  constexpr int64 P1 = 1000000007;
  constexpr int64 P2 = 999999937;
  constexpr int64 B = 257;

  int m = key.size();
  int64 bm1 = 1;
  int64 bm2 = 1;
  for (int i = 0; i < m; i++) {
    bm1 = bm1 * B % P1;
    bm2 = bm2 * B % P2;
  }
  int64 kh1 = 0;
  int64 kh2 = 0;
  for (int i = 0; i < m; i++) {
    kh1 = (kh1 * B + key[i]) % P1;
    kh2 = (kh2 * B + key[i]) % P2;
  }

  vector<int> positions;
  int64 h1 = 0;
  int64 h2 = 0;
  for (int i = 0; i < m; i++) {
    h1 = (h1 * B + s[i]) % P1;
    h2 = (h2 * B + s[i]) % P2;
  }

  if (h1 == kh1 && h2 == kh2) {
    positions.push_back(0);
  }

  for (int i = 1; i + m <= s.size(); i++) {
    h1 = (h1 * B + s[i + m - 1]) % P1;
    h1 = (h1 + P1 - (bm1 * s[i - 1] % P1)) % P1;
    h2 = (h2 * B + s[i + m - 1]) % P2;
    h2 = (h2 + P2 - (bm2 * s[i - 1] % P2)) % P2;
    if (h1 == kh1 && h2 == kh2) {
      positions.push_back(i);
    }
  }
  return positions;
}

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

  int n;
  cin >> n;
  vector<int64> xs(n);
  vector<int64> ys(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> ys[i];
  }

  vector<int64> as(2 * n);
  vector<int64> bs(n);
  for (int i = 0; i < 2 * n; i++) {
    as[i] = xs[(i + 1) % n] ^ xs[i % n];
  }
  for (int i = 0; i < n; i++) {
    bs[i] = ys[(i + 1) % n] ^ ys[i % n];
  }
  auto ps = FindAllByRollingHash(as, bs);
  for (int p : ps) {
    if (p < n) cout << p << " " << (xs[p] ^ ys[0]) << "\n";
  }
}

Measured memory_bytes: 12148
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
 
  int64_t n,x;
  cin>>n>>x;

  vector<int64_t> a(n+1);


  for(int i=0;i<n;i++){
      cin>>a.at(i);
  }
  a.at(n)=x;
  sort(a.begin(),a.end());


  int64_t gcd_wk;
  if(n==1){
    gcd_wk=a.at(1)-a.at(0);
  }
  else{
    gcd_wk=gcd(a.at(1)-a.at(0),a.at(2)-a.at(1));
    for(int i=2;i<n;i++){
      gcd_wk=gcd(a.at(i+1)-a.at(i),gcd_wk);
    }
  }

  cout<<gcd_wk<<endl;

	return 0;
}

Measured memory_bytes: 3888
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n;
	cin >> n;
	vector < pii > v(n);
	for (auto &el: v) {
		cin >> el.second >> el.first;
	}
	sort(all(v));
	ll ctr = 0;
	for (int i = 0; i < n; ++i) {
		if (ctr + v[i].second > v[i].first) {
			cout << "No\n";
			return;
		}
		ctr += v[i].second;
	}
	cout << "Yes\n";
}

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

int main() {
  int n;
  cin >> n;
  int a[n][n - 1];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < (n - 1); j++) {
      cin >> a[i][j];
    }
  }

  int total_games = n * (n - 1) / 2;
  int games = 0;
  int day = 1;
  int last_day[n];
  int played_count[n];
  for (int i = 0; i < n; i++) {
    last_day[i] = 0;
    played_count[i] = 0;
  }

  while (games < total_games) {
    int todays_games = 0;
    for (int i = 0; i < n; i++) {
      if (last_day[i] < day && played_count[i] < (n - 1)) {
        int j = a[i][played_count[i]] - 1;
        if (last_day[j] < day && (a[j][played_count[j]] - 1) == i) {
          last_day[i] = day;
          last_day[j] = day;
          played_count[i] += 1;
          played_count[j] += 1;
          todays_games += 1;
        }
      }
    }
    if (todays_games == 0) {
      day = 0;
      break;
    } else {
      games += todays_games;
    }
    day += 1;
  }
  cout << (day - 1);
}


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

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


}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(a,b) for(int a=0; a<b; ++a)
#define ran(a,b) for(auto &a:b)
#define all(v) v.begin(),v.end()
using namespace std;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vector<T>,greater<T>>;
template<typename T>
using vec = vector<T>;

using ll = long long;
using pi = pair<int,int>;
using ti = tuple<int,int,int>;
using tup = tuple<string,int,int>;

ll MOD=1000000007;

struct UnionFind{
	vec<int> data;
	
	UnionFind(int sz){
		data.assign(sz,-1);
	}
	
	bool unite(int x,int y){
		x=find(x),y=find(y);
		if(x==y) return false;
		if(data[x]>data[y]) swap(x,y);
		data[x]+=data[y];
		data[y]=x;
		return true;
	}
	
	int find(int k){
		if(data[k]<0) return k;
		return (data[k]=find(data[k]));
	}
	
	int size(int k){
		return -data[find(k)];
	}
};

int main(){
	int N,M; cin>>N>>M;
	vec<ll> a(N); rep(i,N) cin>>a[i];
	UnionFind uf(N);
	rep(i,M){
		int x,y; cin>>x>>y;
		uf.unite(x,y);
	}
	ll ans=0;
	vec<vec<ll>> v(N);
	rep(i,N) v[uf.find(i)].emplace_back(a[i]);
	pq<pi> pq1;
	rep(i,N){
		if(v[i].size()>0) pq1.emplace(v[i].size(),i);
	}
	vec<rpq<ll>> mat;
	while(!pq1.empty()){
		pi pi1=pq1.top(); pq1.pop();
		rpq<ll> rpq1;
		ran(e,v[pi1.second]) rpq1.emplace(e);
		mat.emplace_back(rpq1);
	}
	int c=mat.size();
	for(int i=1; i<c; ++i){
		if(mat[0].empty()){
			cout<<"Impossible"<<endl; return 0;
		}
		ll t1=mat[0].top(); mat[0].pop();
		ll t2=mat[i].top(); mat[i].pop();
		ans+=t1+t2;
		while(!mat[i].empty()){
			ll t3=mat[i].top(); mat[i].pop();
			mat[0].emplace(t3);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  map<char, int> m;
  m['D']=0;m['H']=1;
  char a,b;cin>>a>>b;
  int x=m[a];int y=m[b];
  if((x^y))cout<<"D";
  else cout<<"H";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0286
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = RArInt();
            Dictionary<int, int>[] persons = new Dictionary<int, int>[nm[0]];
            for (int i = 0; i < persons.Length; i++) persons[i] = new Dictionary<int, int>();

            while (true)
            {
                int[] vs = RArInt();
                if (vs.Sum() == 0) break;

                if (!persons[vs[0] - 1].ContainsKey(vs[1] - 1)) persons[vs[0] - 1].Add(vs[1] - 1, 0);
                persons[vs[0] - 1][vs[1] - 1] += vs[2];
            }

            int l = RInt();
            for (int i = 0; i < l; i++)
            {
                int[] unitPrices = RArInt();
                Console.WriteLine(WAr(persons.Select(x => x.Sum(y => unitPrices[y.Key] * y.Value))));
            }
        }
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



Measured memory_bytes: 44748
import java.util.Arrays;
import java.util.Scanner;

// 参考:KEYENCE Programming Contest 2019 参加記録＆解説（A～E） - ARMERIA https://betrue12.hateblo.jp/entry/2019/01/14/023707
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = sc.nextInt();
	static int M = sc.nextInt();
	static int[] A = new int[N+1];
	static int[] B = new int[M+1];
	static final int MOD = 1_000_000_007;
	public static void main(String[] args) {
		A[0] = -1;
		B[0] = -1;
		for (int i = 1; i <= N; i++) {
			A[i] = sc.nextInt();
		}
		for (int i = 1; i <= M; i++) {
			B[i] = sc.nextInt();
		}
		// グリッド内で重複があったらアウト
		if (Arrays.stream(A).distinct().count() < A.length
				|| Arrays.stream(B).distinct().count() < B.length) {
			System.out.println(0);
			return;
		}
		Arrays.sort(A);
		Arrays.sort(B);
		long ans = 1;
		int a_placed = 0;
		int b_placed = 0;
		for (int i = N*M; i >= 1; i--) {
			if (A[N-a_placed] == i && B[M-b_placed] == i) {
				a_placed++;
				b_placed++;
			} else if (A[N-a_placed] == i) {
				a_placed++;
				ans = mul(ans, b_placed);
			} else if (B[M-b_placed] == i) {
				b_placed++;
				ans = mul(ans, a_placed);
			} else {
				ans = mul(ans, a_placed*b_placed - (N*M-i));
			}
			if (ans == 0) {
				break;
			}
		}
		System.out.println(ans);
	}
	static long mul(long a, long b) {
		return a*b%MOD;
	}
}


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

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String y = br.readLine();
		int a = Integer.parseInt(x);
		int b = Integer.parseInt(y);

		System.out.println(a * a - b);
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	int n ,l= 0,o =0;string s, t, u, k, v;cin >> n >> s >> t;
	if (s == t) {
		cout << n << endl;
		return 0;
	}
	for (int i = 0;i < n;i++) {
		k = s.substr(i);
		u = t.substr(0, n - i);
		if (k == u) {
			o = u.size();break;
		}
	}
	cout << 2 * n - o << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VVI ncr;
VI pw;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  const in mx=15;
  ncr.resize(mx,VI(mx));
  pw.resize(mx);
  forv(i,ncr){
    ncr[i][i]=ncr[i][0]=1;
    for(in j=1;j<i;++j)
      ncr[i][j]=ncr[i-1][j-1]+ncr[i-1][j];
  }
  pw[0]=1;
  for(in i=1;i<mx;++i)
    pw[i]=pw[i-1]*10;
  in sm=0;
  string s;
  cin>>s;
  VI v;
  forv(i,s)
    v.PB(s[i]-'0');
  in n=sz(v);
  forn(i,n){
    for(in pp=0;pp<=n-1-i;++pp){
      sm+=v[i]*pw[pp]*(1LL<<i)*(1LL<<max(0LL,n-2-i-pp));
    }
  }
  cout<<sm<<endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    int X, Y, Z, K;
    scanf("%d%d%d%d", &X, &Y, &Z, &K);
    std::vector<long long> A(X);
    rep(i, X) scanf("%lld", &A[i]);
    std::vector<long long> B(Y);
    rep(i, Y) scanf("%lld", &B[i]);
    std::vector<long long> C(Z);
    rep(i, Z) scanf("%lld", &C[i]);
    std::priority_queue<long long, std::vector<long long>, std::greater<long long>> AB;
    rep(i, X) {
        rep(j, Y) {
            AB.push(A[i] + B[j]);
            if(AB.size() > K) AB.pop();
        }
    }
    std::priority_queue<long long, std::vector<long long>, std::greater<long long>> ABC;
    while(!AB.empty()) {
        long long ab = AB.top();
        AB.pop();
        rep(i, Z) {
            ABC.push(ab + C[i]);
            if(ABC.size() > K) ABC.pop();
        }
    }
    std::vector<long long> ans(K);
    rep(i, K) {
        ans[i] = ABC.top();
        ABC.pop();
    }
    for(int i = K - 1; i >= 0; i--) {
        printf("%lld\n", ans[i]);
    }
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int main() {
    unsigned long long n, m;
    cin >> n >> m;
    vector<vector<unsigned long long>> aisle(n);
    for (unsigned long long i = 0; i < n; ++i) aisle[i] = vector<unsigned long long>();
    for (unsigned long long i = 0; i < m; ++i) {
        unsigned long long a, b;
        cin >> a >> b;
        aisle[a - 1].push_back(b - 1);
        aisle[b - 1].push_back(a - 1);
    }

    vector<long long> light(n, -1);
    vector<bool> enable(n, false);
    queue<long long> que;

    light[0] = 0;
    enable[0] = true;
    que.push(0);

    while (!que.empty()) {
        auto v = que.front();
        que.pop();

        for (const auto nv : aisle[v]) {
            if (light[nv] != -1) continue;
            light[nv] = v + 1;
            enable[nv] = true;
            que.push(nv);
        }
    }

    bool can = true;
    for (unsigned long long i = 1; i < n; ++i) {
        if (!enable[i]) {
            can = false;
            break;
        }
    }
    if (can) {
        cout << "Yes" << endl;
        for (unsigned long long i = 1; i < n; ++i) {
            cout << light[i] << endl;
        }
    }
    else {
        cout << "No" << endl;
    }

    return EXIT_SUCCESS;
}

Measured memory_bytes: 12848
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  ll a,b;
  cin>>a>>b;
  ll A=0,B=0;
  ll ten=1;
  for(int i=0;i<b;i++){
    A+=ten*a;
    ten*=10;
  }
  ten=1;
  for(int i=0;i<a;i++){
    B+=ten*b;
    ten*=10;
  }
  cout<<max(A,B)<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

double L;

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

  double d = L / 3;
  double ans = pow(d, 3);

  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];
    vector<int> dpa(n, -INF);
    vector<int> dpb(n, -INF);
    vector<int> dpc(n, -INF);
    dpa[0] = a[0];
    dpb[0] = b[0];
    dpc[0] = c[0];
    for (int i = 1; i < n; i++) {
        chmax(dpb[i], dpa[i - 1] + b[i]);
        chmax(dpb[i], dpc[i - 1] + b[i]);
        chmax(dpa[i], dpb[i - 1] + a[i]);
        chmax(dpa[i], dpc[i - 1] + a[i]);
        chmax(dpc[i], dpa[i - 1] + c[i]);
        chmax(dpc[i], dpb[i - 1] + c[i]);
    }
    cout << max(dpa[n - 1], max(dpb[n - 1], dpc[n - 1]));
    return 0;
}

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

int main(){
    ll n, m; cin >> n >> m;
    ll ans = 0;

    if(n > m) swap(n,m);
    if(n == 1 && m == 1){
        put(1);
    }else if(n == 1){
        put(m - 2);
    }else if(n == 2){
        put(0);
    }else{
        put((n-2)*(m-2));
    }
}

Measured memory_bytes: 256