akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;


public class Main {
    
         
    static FastReader in;
    static StringBuilder out;

    public  static void main(String[] args) {
        
        in = new FastReader();
        out=new StringBuilder();
        char s[]=in.nextLine().toCharArray();
        if(s[2]==s[3] && s[4]==s[5]){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
     
    
}

Measured memory_bytes: 21204
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def sol():
    N = int(input())
    points = [tuple(map(int, input().split())) for _ in range(N)]
    points.sort(key=itemgetter(2), reverse=True)

    for cx in range(101):
        for cy in range(101):
            bx, by, bh = points[0]
            H = bh + abs(cx - bx) + abs(cy - by)
            for x, y, h in points:
                nowH = max(H - abs(cx - x) - abs(cy - y), 0)
                if h != nowH:
                    break
            else:
                print(cx, cy, H)
                return

sol()

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, m, k, a, c[33], res;

signed main() {
	cin >> n >> m;
	rep(i,n) {
		cin >> k;
		while (k--) {
			cin >> a;
			c[--a]++;
		}
	}
	rep(i,m) if (c[i]==n) res++;
	cout << res << endl;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>=22)cout << "bust" ENDL;
    else cout << "win" ENDL;
    
    return 0;
}

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

int main(){
	int h, w, ans = 0;
	int fanc(int i, int j, vector<string> &s, int h, int w);
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h) cin >> s.at(i);
	rep(i, h){
		rep(j, w){
			if(s.at(i).at(j) == '#') continue;
			ans = max(ans, fanc(i, j, s, h, w));
		}
	}
	
	cout << ans << endl;
	return 0;
}

int fanc(int i, int j, vector<string> &s, int h, int w){
	queue<tuple<int, int, int>> q;
	int ans = 0, di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
	vector<vector<bool>> ch(h, vector<bool>(w, false));
	ch.at(i).at(j) = true;
	q.push(make_tuple(i, j, 0));
	while(!q.empty()){
		auto t = q.front(); q.pop();
		rep(k, 4){
			int y = get<0>(t) + di[k];
			int x = get<1>(t) + dj[k];
			if(y < 0 || y >= h || x < 0 || x >= w) continue;
			int a = get<2>(t) + 1;
			if(ch.at(y).at(x) == false && (s.at(y))[x] == '.'){
				ch.at(y).at(x) = true;
				q.push(make_tuple(y, x, a));
			}
		}
		ans = max(ans, get<2>(t));
	}
	return ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 5e5 + 5;
const ll MOD = 1e9 + 7;
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pis pair<ll,string>
#define F first
#define S second
#define LCM(a,b) ((a*b)/__gcd(a,b))
#define inf 1e15
#define test ll cse;cin>>cse;for(ll _i=1;_i<=cse;_i++)
#define PI 3.14159265
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const double EPS = 1E-9;
typedef vector< vector<double> > matrix;
typedef vector< vector<int> > array_2D;
typedef pair<int, pair<int, int> > ppi;
typedef vector<int> vi;



int main() {


    int a, b, c, d;

    cin >> a >> b >> c >> d;


    // health a, c
    // strenth b, d

    int A = a/d + ((a%d)?1:0);
    int B = c/b + ((c%b)?1:0);


    if(B <= A)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}

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

int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        int ans =0;
        int sum =1;
        while(sum<b)
        {
            sum--;
            sum +=a;
            ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class DCaracalVsMonster {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            long h = s.nextLong();
            long ans = 0;
            for (long cur = 1; h > 0; cur <<= 1, h >>= 1) ans += cur;
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public long nextLong() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }

            while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



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

const int MAX_N = 2e5;
int n;
string s[MAX_N];

void solve() {
    set<string> st;
    for (int i = 0; i < n; i++) {
        st.insert(s[i]);
    }
    cout << st.size() << endl;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    solve();
}

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

class dice
{
    int U, S, E, W, N, L;
public:
    dice(int, int, int, int, int, int);
    void roll(char);
    int upper();
};

dice::dice(int u, int s, int e, int w, int n, int l) : 
U(u), S(s), E(e), W(w), N(n), L(l){}

void dice::roll(char v)
{
    static int i;
    if(v == 'E'){ i = U; U = W; W = L; L = E; E = i; }
    if(v == 'W'){ i = U; U = E; E = L; L = W; W = i; }
    if(v == 'N'){ i = U; U = S; S = L; L = N; N = i; }
    if(v == 'S'){ i = U; U = N; N = L; L = S; S = i; }

    return;
}

int dice::upper()
{
    return U;
}

int main()
{
    int u, s, e, w, n, l;
    cin >> u >> s >> e >> w >> n >> l;
    dice d = dice(u, s, e, w, n, l);

    string route;
    cin >> route;

    for(int i = 0; route[i]; i++){
        d.roll(route[i]);
    }

    cout << d.upper() << endl;

    return 0;
}

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

signed main(){
    //A
    
    int k,a,b;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
    return 0;
    
   //B
   /*
   ll x;
   cin>>x;
   ll p=100;
   int c=0;
   while(p<x){
       p=ll(p+p*0.01);
       c++;
   }
   cout<<c<<endl;
   */
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll                    long long int
#define loop(i ,a,b)           for(int i=(int)a;i<(int)b;++i)
#define rloop(i,a,b)          for(int i=(int)a;i<=(int)b;++i)
#define loopl(i,a,b)          for(ll i=(ll)a;i<(ll)b;++i)
#define loopr(i,a,b)          for(int i=(int)a;i>=(int)b;--i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define eb                    emplace_back
#define ab(a)                 (a<0)?(-1*a):a
#define pc                    putchar_unlocked
#define gc                    getchar_unlocked
#define mset(a,b,c)           loop(i,0,b) a[i]=c
#define F                     first
#define S                     second
#define mp                    make_pair
#define clr(x)                x.clear()
#define MOD                   1000000007
#define MAX                   1e9
#define MIN                   -1e9
#define itoc(c)               ((char)(((int)'0')+c))
#define vi                    vector<int>
#define vvi                   vector<vi>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define max(x,y)              (x>y)?x:y
#define min(x,y)              (x<y)?x:y
#define mid(s,e)              (s+(e-s)/2)
#define mini                  INT_MIN
using namespace std;
const int N = 10000101;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int a,b;
  cin>>a>>b;
  cout<<a*b<<"\n";
  return 0;
}


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

using namespace std;

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

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

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

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

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

int x[mx2], y[mx2], h[mx2];

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

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

    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){

            int H = 1;
            for(int k = 0; k < n; k++){
                if(!h[k])
                    continue;
                H = h[k] + abs(i - x[k]) + abs(j - y[k]);
            }
            int f = 0;
            for(int k = 0; k < n; k++){
                if(h[k] != max(0, H - abs(i - x[k]) - abs(j - y[k])))
                    f = 1;
            }

            if(f)
                continue;
            return cout << i << ' ' << j << ' ' << H << '\n', 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
using namespace std;
long long gcd(long long a,long long b){
    if(b==0)
        return a;
    else return gcd(b,a%b);
}
int main(){
    long long a;
    long long b;
    //cout<<"h"<<endl;
    while(cin>>a>>b){

    cout<<gcd(a,b)<<" ";
        cout<<a/gcd(a,b)*b<<endl;}
    return 0;
}



Measured memory_bytes: 3084
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    
    let answer;
    
    if(N <= 6) {
        answer = 1;
    } else if(N <= 11) {
        answer = 2;
    } else {
        let temp = N % 11;
        answer = (Math.floor(N / 11) * 2) + Math.ceil(temp / 6);
    }

    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

def insertionSort(A, N):
    for i in range(1, N):
        print(" ".join(map(str, A)))
        
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
    
    return A

if __name__ == '__main__':

    N = int(input())
    A = [ int(a) for a in input().split(" ")]

    A = insertionSort(A, N)
    print(" ".join(map(str, A)))


Measured memory_bytes: 5612
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
	int n,a,b;
	scanf("%d",&n);
	if(n==1)	printf("Hello World\n");
	else
	{
		scanf("%d%d",&a,&b);
		printf("%d\n",a+b);
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
int main()
{
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void exchange(char str[1200],int n){
	int i;
	for (i = 0; i < n; i++){
		if (65 <= str[i] && str[i] <= 90)
			str[i] = str[i] + 32;
		else if (97 <= str[i] && str[i] <= 122)
			str[i] = str[i] - 32;
	}
}

int main(void){
	char str[1200];
	int i=0;
	while (1){
		scanf("%c", &str[i]);
		if (str[i] == '\n')
			break;

		i++;
	}
	int n = i;
	exchange(str,n);
	for (i = 0; i < n; i++){
		printf("%c", str[i]);
	}
	putchar('\n');


	return 0;
}


Measured memory_bytes: 2048
let rec iter a b f = if a >= b then () else (f a; iter (a+1) b f)
let () =
  Scanf.scanf "%d %s" @@ fun n s ->
  let w = Array.init n (fun i -> if s.[i] = 'W' then 1 else 0) in
  let e = Array.init n (fun i -> if s.[i] = 'E' then 1 else 0) in
  iter 1 n (fun i -> w.(i) <- w.(i) + w.(i-1));
  iter 1 n (fun i -> e.(n-1-i) <- e.(n-1-i) + e.(n-i));
  Array.init n (fun i ->
    (if i > 0 then w.(i-1) else 0) + (if i+1 < n then e.(i+1) else 0))
  |> Array.fold_left min n |> Printf.printf "%d\n"

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

unsigned euclidean_gcd(unsigned, unsigned);
int main()
{
    int N, M, sum=0;
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M;i++){
        cin >> A.at(i);
        sum += A.at(i);
    }
    if(N-sum>=0){
        cout << N-sum << endl;
    }
    else{
        cout << -1 << endl;
    }

}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int a, b, c; cin >> a >> b >> c;
  if(b-a == c-b){
    cout << "YES" << endl;
  }
  else cout << "NO" << endl;
  system("pause");
}

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

int main()
{
    long long n,x,y,i,c=0;
    cin>>n>>x>>y;
    for(i=x;i<=y;i++)
    {
        if(i%n==0) c++;
    }
    if(c>0)cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
    return 0;
}


Measured memory_bytes: 3592
using System;
class Program
{
	static void Main(string[] args)
	{
        string s = Console.ReadLine();
        string result = "";
        if (s.Length == 6){
            if (equalCheck(s.Substring(2,1),s.Substring(3,1)) == "Yes" && equalCheck(s.Substring(4,1),s.Substring(5,1)) == "Yes"){
                result = "Yes";
            } else {
                result = "No";
            }
        } else {
            result = "No";
        }
        //Console.WriteLine(result.Length);
        Console.WriteLine(result);
	}

    static string equalCheck(string target1,string target2){
        if (target1 == target2){
            return "Yes";
        } else {
            return "No";
        }
    }
}

Measured memory_bytes: 13140
/*
 * atcoder/abc123/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
#include <set>
#include <queue>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

struct Dat {
  ll val; int a, b, c;
  bool operator<(const Dat& o)const{
    if (val != o.val) return val < o.val;
    if (a != o.a) return a < o.a;
    if (b != o.b) return b < o.b;
    return c < o.c;
  }
};

int X, Y, Z, K, L;
vector<ll> A, B, C;
void solve() {
  cin >> X >> Y >> Z >> K;
  L = cbrt(K)+1;
  A.resize(X);B.resize(Y);C.resize(Z);
  loop(n,0,X) cin >> A[n];
  loop(n,0,Y) cin >> B[n];
  loop(n,0,Z) cin >> C[n];
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());

  priority_queue<Dat> Q;
  set<Dat> S;

  Q.push({ A[0] + B[0] + C[0], 0, 0, 0 });
  S.insert({ A[0] + B[0] + C[0], 0, 0, 0 });
  for (int k=0; k<K; k++) {
    Dat dat = Q.top(); Q.pop();
    cout << dat.val << endl;
    if (dat.a < X-1) {
      Dat d = {A[dat.a+1] + B[dat.b] + C[dat.c], dat.a+1, dat.b, dat.c};
      if (!S.count(d)) S.insert(d), Q.push(d);
    }
    if (dat.b < Y-1) {
      Dat d = {A[dat.a] + B[dat.b+1] + C[dat.c], dat.a, dat.b+1, dat.c};
      if (!S.count(d)) S.insert(d), Q.push(d);
    }
    if (dat.c < Z-1) {
      Dat d = {A[dat.a] + B[dat.b] + C[dat.c+1], dat.a, dat.b, dat.c+1};
      if (!S.count(d)) S.insert(d), Q.push(d);
    }
  }
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 896
// G - Longest Path
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
int in(){int x;scanf("%d",&x);return x;}

#define VMAX 100000
vvi V(VMAX);
vi D(VMAX,-1);

int dfs(int p){
	int& a = D[p];
	if(a>-1) return a;
	for(int c:V[p]) a = max(a, dfs(c)+1);
	return a;
}

int main(){
	int N,M; cin>>N>>M;
	while(M--) V[in()-1].push_back(in()-1);
	int a = 0; while(N--) a = max(a, dfs(N)+1);
	cout<< a <<endl;
}

Measured memory_bytes: 8448
#include<iostream>
#include <cstdio>
#include<cctype>
#include<string>

using namespace std;

int main(){
	char ch;
	int cnt[26]={0};
	
	while(cin >> ch){
		if(islower(ch)){
			int num = ch - 'a';
			cnt[num]++;
		}
		else if(isupper(ch)){
			int num = ch - 'A';
			cnt[num]++;
		}
	}
	for(int i = 0; i < 26; i++){
		cout << char(i + 'a')<<" : "<<cnt[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1144
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctype.h>
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}
int search(int x) {

	int k = 0;
	int p = 1;
	while (p * 2 <= max_n)
	{
		p *= 2;
	}
	for (int i = p; i > 0; i /= 2)
	{
		if (i + k < max_n && bit[i + k] < x) {
			x -= bit[i + k];
			k += i;
		}
	}
	return k + 1;
}
void solv() {

	int n;
	cin >> n;
	ll a[10010];
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	int c = 0;
	for (size_t i = 0; i < n; i++)
	{
		bool ok = true;
		for (ll j = 2; j * j<= a[i]; j++)
		{
			if (a[i] % j == 0) ok = false;
		}
		if (ok) c++;
	}
	cout << c << endl;
}
int main() {
	//	COMinit();
	solv();
	return 0;
}



Measured memory_bytes: 3168
#include <iostream>
    #define rep(i,n) for(long i=0;i<(n);++i)
    #include <algorithm>
    using namespace std;
    #define MAX 200001
    int main(){
        long n,m,k;
        long a[MAX];
        long b[MAX];
        cin >> n >> m >> k;
        a[0] = 0;
        rep(i,n) {
            long temp;
            cin >> temp;
            a[i+1] = temp;
            a[i+1] += a[i];
        }
        b[0] = 0;
        rep(i,m) {
            long temp;
            cin >> temp;
            b[i+1] = temp;
            b[i+1] += b[i];
        }
        long num=0,b_num;
        long prev_num=0;
        b_num=m;
        rep(i,n+1){
            prev_num = num;
            long k2 = k - a[i];
            for(long j=b_num;j>=0;j--){
                if(b[j] <= k2) {b_num=j;break;}
            }
            num = b_num+i;
            if(k2 < 0) num = 0;
            //cout << i << b_num<< num << endl;
            num = max(prev_num,num);
        }
        cout << num << endl;
    }

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

typedef long long ll;
typedef pair<int, int> ii;

const int N = 51;
vector<int> edges[N];
ll path[N];
ll info[N];
int n, m, a, b;

void dfs(int par, int u, ll id) {
  path[u] = id;
  for (auto v : edges[u]) {
    if (v == par) continue;
    dfs(u, v, id | (1ll << v));
  }
}

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

  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  dfs(0, 1, 0);

  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    info[i] = path[a] ^ path[b]; // length of path
  }

  ll ans = 0;
  for (int i = 0; i < (1 << m); ++i) {
    ll mask = 0;
    int cnt = 0;
    for (int j = 0; j < m; ++j) {
      if (i & (1 << j)) {
        mask |= info[j];
        ++cnt;
      }
    }
    int fcnt =  n - 1 - __builtin_popcountll(mask);
    ans += pow(2, fcnt) * (cnt & 1 ? -1ll : 1ll);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=100005;
int cnt[maxn],n,a[maxn],vis[maxn];
vector<int> bl[maxn];
inline bool cmp(int x,int y){
	return a[x]>a[y];
}
inline int calc(int x){
	if(vis[x])return a[x];vis[x]=1;
	for(int v:bl[x])calc(v);
	sort(bl[x].begin(),bl[x].end(),cmp);
	int nowcnt=0;
	for(int v:bl[x]){
		nowcnt++;
		a[x]=max(a[x],nowcnt+a[v]);
	}
	return a[x];
}
int main(){
	read(n);
	rep(i,1,n-1){
		int x;read(x);cnt[x]++;
		bl[x].pb(i+1);
	}int ans=0;
	rep(i,1,n)ans=max(ans,calc(i));
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 11264
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    string s;
    cin>>s;
    
    reverse(all(s));
    cout<<s<<endl;
}



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

vector<int> bfs(int src, vector<vector<int>> &adj)
{
    queue<int> q;
    vector<int> dist(adj.size() + 1, 0);
    vector<int> seen(adj.size() + 1, 0);

    q.push(src);
    seen[src] = true;

    while (!q.empty())
    {
        int cur = q.front();
        q.pop();
        for (auto v : adj[cur])
        {
            if (!seen[v])
            {
                q.push(v);
                dist[v] = dist[cur] + 1;
                seen[v] = true;
            }
        }
    }

    return dist;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> adj(n + 1);
    for (int i = 1; i < n; i++)
    {
        adj[i].push_back(i + 1);
        adj[i + 1].push_back(i);
    }
    adj[x].push_back(y);
    adj[y].push_back(x);

    vector<int> distances(n, 0);

    for (int i = 1; i <= n; i++)
    {
        for (auto d : bfs(i, adj))
        {
            distances[d]++;
        }
    }

    for (int i = 1; i < n; i++)
    {
        cout << distances[i] / 2 << '\n';
    }

    cin >> n;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tiii;
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

int main() {
    int a, b;
    cin >> a >> b;
    int sq = a * b;
    int li = 2 * a + 2 * b;
    cout << sq << " " << li << endl;
}



Measured memory_bytes: 3004
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split, n = rd[0].to!size_t, a = rd[1].to!long, b = rd[2].to!long;
  auto x = readln.split.to!(long[]);

  auto ans = 0L;
  foreach (i; 0..n-1)
    ans += min((x[i+1]-x[i])*a, b);

  writeln(ans);
}


Measured memory_bytes: 4404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
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;}

const int nm = 15;
vector<double> x[nm];
double n, d; 

bool isok(int i, int j){
    vector<double> ti = x[i];
    vector<double> to = x[j];
    double tmp = 0.0;
    for(int t=0; t<d; t++){
        tmp += pow(ti[t] - to[t], 2);
    }
    tmp = sqrt(tmp);
    int t2 = (int)tmp;
    if(tmp == (double)t2) return true;
    else return false;
}

int main(){
    cin >> n >> d;
    rep(i, n){
        rep(j, d){
            double t; cin >> t;
            x[i].push_back(t);
        }
    }
    int cnt = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(isok(i, j)) cnt++;
        }
    }
    cout << cnt << endl;

}

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

int main(){
	int n;
	cin>>n;
	vector<long long> a(n),b(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		b[i]=a[i]+(i>0?b[i-1]:0ll);
	}
	long long s=0ll;
	for(int i=0;i<n;i++){
		s+=(a[i]*((b[n-1]-b[i])%1000000007ll))%1000000007ll;
		s=s%1000000007;
	}
	cout<<s<<endl;
}


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

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x;
  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;}

vector<int> to[200005];

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    rep(i, 0, m) cin >> a[i] >> b[i];
    rep(i, 0, m){
        a[i]--; b[i]--;
        to[a[i]].push_back(b[i]);
        to[b[i]].push_back(a[i]);
    }
    map<int, bool> mp;
    queue<int> q;
    int ans = 0;
    rep(i, 0, n){
        if(mp[i]) continue;
        int cnt = 0;
        q.push(i);
        while(!q.empty()){
            int v = q.front(); q.pop();
            for(auto e : to[v]){
                if(mp[e]) continue;
                mp[e] = true;
                q.push(e);
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    if(ans == 0) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 25676
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"

int n;
vector<int> v;
vector<int> dp(100000 , -5);

int compute(int i)
    {
        if(i+1<n && i+2<n){

            if(dp[i+1]!=-5 && dp[i+2]!=-5)
                {
                    dp[i] = min(abs(v[i]-v[i+1]) + dp[i+1] , abs(v[i]-v[i+2]) + dp[i+2]);
                    return dp[i];
                }
            else if(dp[i+1]!=-5)
                {
                    dp[i] = min(abs(v[i]-v[i+1]) + dp[i+1] , abs(v[i]-v[i+2]) + compute(i+2));
                    return dp[i];
                }
            else if(dp[i+2]!=-5)
                {
                    dp[i] = min(abs(v[i]-v[i+1]) + compute(i+1) , abs(v[i]-v[i+2]) + dp[i+2]);
                    return dp[i];
                }
            else
                {
                    dp[i] = min(abs(v[i]-v[i+1]) + compute(i+1) , abs(v[i]-v[i+2]) + compute(i+2));
                     return dp[i];
                }
        }
        else if(i+1<n)
            {
                if(dp[i+1]!=-5)
                    {
                        dp[i] = abs(v[i]-v[i+1]) + dp[i+1];
                        return dp[i];
                    }
                else
                    {
                        dp[i] = abs(v[i]-v[i+1]) + compute(i+1);
                        return dp[i];
                    }
            }
            
        else
        {
            return 0;
        }
        
    }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int x;
    cin>>n;
    for(int i=0;i<n;i++)
        {
            cin>>x;
            v.push_back(x);
        }

    int ans = compute(0);
    cout<<ans;

	return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;

long long MOD = 1000000000 + 7;

vector<double> x,y,c;
vector<pdd> v;
int N,K;
double EPS = 0.0000001;

vector<pdd> getIntersection(double x0, double y0, double r0, double x1, double y1, double r1){
  x1 -= x0;
  y1 -= y0;

  vector<pdd> ret;
  double x_p, x_n, y_p, y_n;

  double a = 2 * x1;
  double b = 2 * y1;
  double c = x1*x1 + y1*y1 - r1*r1 + r0*r0;

  double D = b*b * (a*a*r0*r0 + b * b * r0*r0 - c * c);

  if(D < 0){
    return ret;
  }

  if(b==0){
    x_p = c / a;
    x_n = c / a;
    y_p = r0 * r0 - x_p*x_p;
    y_p = pow(y_p, 0.5);
    y_n = -y_p;
  } else {
    D = pow(D, 0.5);
    x_p = a * c + D;
    x_p /= a*a + b*b;
    x_n = a * c - D;
    x_n /= a*a + b*b;

    y_p = -a * x_p + c;
    y_p /= b;
    y_n = -a * x_n + c;
    y_n /= b;
  }

  pdd tmp1,tmp2;
  tmp1 = make_pair(x_p + x0, y_p + y0);
  tmp2 = make_pair(x_n + x0, y_n + y0);
  ret = {tmp1, tmp2};
  return ret;
}

bool isOK(double t){
  int index = N;
  // cerr << "candidate: " << v.size() << endl;

  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      auto tmp = getIntersection(x[i], y[i], t/c[i], x[j], y[j], t/c[j]);
      if(tmp.size() > 0){
        v[index] = tmp[0];
        v[index+1] = tmp[1];
        index+=2;
      }
    }
  }
  // cerr << "candidate: " << v.size() << endl;

  for(int i = 0; i < index; i++){
    // K個以上の点からの距離がc[i]/t以下ならOK
    double xtmp = v[i].first;
    double ytmp = v[i].second;
    int k = 0;
    for(int i = 0; i < N; i++){
      double d = 0;
      d += (x[i] -xtmp) * (x[i]-xtmp);
      d += (y[i] -ytmp) * (y[i]-ytmp);
      double r = t * t / c[i] / c[i];
      if(d - r < EPS) {
        // cerr << x[i] << " " << y[i] << " " << t / c[i] <<  " " << d << endl;
        k++;
        if(k>=K) return true; 
      }
    }
  }

  return false;

}



int main(){
  cout << setprecision(10);
  cin >> N >> K;
  x.assign(N,0);
  y.assign(N,0);
  c.assign(N,0);
  pdd tmp;
  v.assign(N*N, tmp);
  for(int i = 0; i < N; i++){
    cin >> x[i] >> y[i] >> c[i];
    v[i] = make_pair(x[i], y[i]);
  }

  // cerr << (isOK(7422) ? "OK" : "NG" )  << endl;

  double right = 1000000;
  double left = EPS;
  double mid;
  while((right - left > EPS) || ( (right - left)/right > EPS)){
    // cerr << left << " " << right << endl;
    mid = (right + left) / 2.0;
    if(isOK(mid)){
      right = mid;
    } else { 
      left = mid;
    }
  }
  cout << right << endl;

}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = Console.ReadLine();
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = 0;
        var ok = true;
        for (int i = n.Length-1; i >= 0; i--)
        {
           if(i != 0)
            {
                if(n[i] != '9') ok =false;
                ans += 9;
            }
            else
            {
                if(ok) ans+= int.Parse(n[i].ToString());
                else ans += int.Parse(n[i].ToString()) -1;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27500
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<n;i++)
using namespace std;
int box[100001],red[100001];
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	REP(i,0,n)box[i]=1;
	red[0]=1;
	REP(i,0,m){
		int x,y;
		cin>>x>>y;
		x--;y--;
		box[x]--;box[y]++;
		if(red[x])red[y]=1;
		if(!box[x])red[x]=0;
	}
	int ans=0;
	REP(i,0,n)
	if(red[i])ans++;
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5180
open System
open System.Linq

#nowarn "25"

let inline readLine _ = stdin.ReadLine()
let inline readInt<'a> = readLine >> int
let inline readLong<'a> = readLine >> int64
let inline readFloat<'a> = readLine >> float
let inline readArray _ = readLine().Split ' '
let inline readArrayInt _ = readArray() |> Array.map (int)
let inline charToInt ch = int ch - int '0'

let n = readInt()
let cnt = Array2D.zeroCreate<Int64> 10 10
for i in 1..n do
    let head = (i
        |> string
        |> Enumerable.First
        |> charToInt)
    let tail = i % 10
    cnt.[head, tail] <- cnt.[head, tail] + 1L
Seq.init 10 (fun i ->
    Seq.init 10 (fun j ->
        cnt.[i, j] * cnt.[j, i]))
|> Seq.sumBy (Seq.sum)
|> printfn "%d"


Measured memory_bytes: 18496
N = int(input())
nums = list(map(int, input().split()))

count = 0
flag = True
while flag:
    flag = False
    for j in [N-i for i in range(1, N)]:
        if nums[j] < nums[j-1]:
            nums[j], nums[j-1] = nums[j-1], nums[j]
            flag=True
            count += 1


nums = [str(num) for num in nums]
print(" ".join(nums))
print(count)



Measured memory_bytes: 5604
// Vivek Rai
// Blazer_007

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

#include <bits/stdc++.h>

#define fastio      ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll          long long
#define int         long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define loop(i,a,b)  for(int i=a;i<b;i++)

using namespace std;

void solution()
{
    int h, w, m;
    cin >> h >> w >> m;
    mi row, col;
    mii isPre;
    loop(i,0,m)
    {
        int r, c;
        cin >> r >> c;
        isPre[{r,c}] = 1;
        row[r]++;
        col[c]++;
    }
    vii coll, roww;
    int rowsum = 0 , colsum = 0;
    for(auto ele : row)
    {
        // cout << ele.SS << " " << ele.FF << endl;
        roww.pb({ele.SS, ele.FF});
        rowsum += ele.SS;
    }
    for(auto ele : col)
    {
        // cout << ele.SS << " " << ele.FF << endl;
        coll.pb({ele.SS, ele.FF});
        colsum += ele.SS;
    }
    if (rowsum == colsum and rowsum == (h * w))
    {
        cout << h + w - 1 << endl;
        return;
    }
    sort(all(roww),greater<pii>());
    sort(all(coll),greater<pii>());

    int ans = roww[0].FF + coll[0].FF;

    if (roww[0].FF == w and coll[0].FF == h)
    {
        cout << ans-1 << endl;
        return;
    }
    
    if (isPre.find({roww[0].SS, coll[0].SS}) != isPre.end())
        ans -= 1;
    else
    {
        cout << ans << endl;
        return;
    }
    loop(i,0,sz(roww))
    {
        int curans = roww[i].FF + coll[0].FF;
        if (isPre.find({roww[i].SS, coll[0].SS}) != isPre.end())
            curans -= 1;
        loop(j,1,sz(coll))
        {
            if (coll[j].FF == coll[j-1].FF)
            {
                int curr = roww[i].FF + coll[j].FF;
                if (isPre.find({roww[i].SS, coll[j].SS}) != isPre.end())
                    curr -= 1;
                curans = max(curans, curr);
            }
            else
                break;
        }
        ans = max(ans,curans);
        if (i != sz(roww)-1)
        {
            if (roww[i].FF == roww[i+1].FF)
                continue;
            else
                break;
        }
    }
    // cout << roww[0].SS << " " << coll[0].SS << endl;
    // if (isPre.find({roww[0].SS, coll[0].SS}) != isPre.end())
    //     ans -= 1;
    cout << ans << endl;
}

signed main()
{
    fastio
    ll t = 1;
    // cin >> t;
    loop(i, 1, t + 1)
    {
        //cout<<"Case #"<<i<<": ";
        solution();
    }
}


    

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll dp[110][400] = {0};

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

  int N;
  ll W;
  cin >> N >> W;

  vector<pair<ll, ll>> vec(N);

  ll w, v;
  for(int i = 0; i < N; i++){
    cin >> w >> v;
    vec[i] = make_pair(w, v);
  }

  W = W - vec[0].first * N;
  ll w0 = vec[0].first;
  for(int i = 0; i < N; i++){
    vec[i].first -= w0;
  }

  for(int j = 0; j < 100; j++){
    for(int i = 0; i < 400; i++){
      dp[j][i] = -INF;
    }
  }

  dp[0][0] = 0;

  for(int n = 0; n < N; n++)
  for(int i = 99; i >= 0; i--){
    for(int j = 300; j >= 0; j--){
      if(dp[i][j] >= 0){
        chmax(dp[i+1][j+vec[n].first], dp[i][j] + vec[n].second);
      }
    }
  }

  ll ans = -INF;
  for(int k = 0; k <= N; k++){
    for(int w = 0; w <= min(300LL, W + (N-k) * w0); w++){
      chmax(ans, dp[k][w]);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(A + B >= 24){
            System.out.println((A + B) - 24);
        }else if(A + B < 24){
            System.out.println(A + B);
        }
    }
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i, j;
  //ll n;
  //cin >> n;
  ll a, b, c;
  cin >> a >> b>>c;
  //string s; cin >> s;
  ll result = 0;
  bool judge = true;
  for(i=a;i<=b;i++){
    if(i<=a+c-1||i>=b-c+1){
      cout<<i<<endl;
    }
  }

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++)
    cin >> a[i];
  //for(i=0;<n;i++)
  */





  return 0;
}

Measured memory_bytes: 256