akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
void ce(void){cerr << '\n';}
template <typename T>
void ce(const T n){cerr << n << '\n';}
template <typename T>
void cesp(const T n){cerr << n << ' ';}
template <typename T>
void ce(initializer_list<T> v){for(T i : v) cesp(i); ce();}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
// constexpr ll MOD = 1e9+7;
constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const double PI = acos(-1);

using CP = complex<double>;

void fft(vector<CP> &a, bool inv){
	int n = a.size();
	if (n == 1) return;
	vector<CP> even(n / 2), odd(n / 2);
	for (int i = 0; i < n / 2; i++) {
		even[i] = a[2 * i];
		odd[i] = a[2 * i + 1];
	}
	fft(even, inv);
	fft(odd, inv);
	CP omega = polar(1.0, (-2 * inv + 1) * 2 * PI / n);
	CP pow_omega = 1.0;
	for (int i = 0; i < n / 2; i++) {
		a[i] = even[i] + pow_omega * odd[i];
		a[i + n / 2] = even[i] - pow_omega * odd[i];
		pow_omega *= omega;
	}
}

void conv(vector<CP> &a, vector<CP> &b){
	int n = a.size() + b.size();
	int N = 1;
	while (N <= n) N <<= 1;

	a.resize(N);
	b.resize(N);

	fft(a, false);
	fft(b, false);

	for (int i = 0; i < N; ++i) {
		a[i] *= b[i] / CP(N);
	}

	fft(a, true);
}

int main(void){
	ll n, m;
	cin >> n >> m;
	Vec a(100001);
	rep(i, n) {
		ll t;
		cin >> t;
		a[t]++;
	}
	vector<CP> b(100001);
	rep(i, 100001) b[i] = CP(a[i], 0);
	vector<CP> c = b;

	conv(b, c);

	ll ans = 0, rest = m;
	repr(i, b.size()) {
		ll t = b[i].real() + 0.5;
		ans += i * min(t, rest);
		rest -= min(t, rest);
		if (!rest) break;
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 20952
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * @author author
 *
 */
public class Main {

  /**
   * @param args
   */
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());

    List<Book> stringList = new ArrayList<>();
    for (int i = 1; i <= n; i++) {
      stringList.add(new Book(i, sc.next(), Integer.parseInt(sc.next())));
    }
    Collections.sort(stringList);
    for (Book book : stringList) {
      System.out.println(book.getId());
    }
    }
  }




class Book implements Comparable<Book> {

  String s;
  int p;
  int id;

  Book(int id, String s, int p) {
    this.s = s;
    this.p = p;
    this.id = id;
  }

  public String getS() {
    return this.s;
  }

  public int getP() {
    return this.p;
  }

  public int getId() {
    return this.id;
  }

  @Override
  public int compareTo(Book o) {
    if (!this.s.equals(o.s)) {
      return this.s.compareTo(o.s);
   }else {
      return o.p - this.p;
   }
  }

}


Measured memory_bytes: 21588
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String buf = br.readLine();
        int x = Integer.parseInt(buf);
        
        x = x * x * x;
        System.out.println(x);
    }
}

Measured memory_bytes: 24404
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b = i_map()

    print('error' if a + b >= 10 else a + b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

/* INCLUDES */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <random>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
using namespace std;

/* TYPES */
#define long int64_t
#define all(v) v.begin(), v.end()
typedef pair<int,int> pii;
typedef pair<int64_t,int> pli;
typedef pair<int64_t,int64_t> pll;
typedef vector<int> vi;
typedef vector<pair<int,int> > vpi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<vector<int64_t> > vvl;

/* CONSTANTS */
const long MOD = 1e9+7, LINF = 1e18 + 1e16;
const int INF = 1e9+1;
const double EPS = 1e-10;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};

/* FUNCTIONS */
template<typename T, typename U> inline void setMin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void setMax(T &x, U y) { if(x < y) x = y; }
template<typename T>
inline T gcd(T a, T b) {
    T c;
    while(b) c = b, b = a % b, a = c;
    return a;
}
template<typename T>
inline T square(T a, T b) { return a*b; }

class TaskB {

    string s;
    vpi segs;
    long ans;

public:
    void solve(istream &cin, ostream &cout) {
        cin >> s;
        for(int i = 0, last = 0; i < s.length() - 1; i++) {
            if(s[i] == 'B' && s[i+1] == 'C') {
                segs.emplace_back(last, i - 1);
                last = i + 2;
            }
        }
        auto getAs = [&] (int l, int r) -> int {
            int ret = 0;
            for(int i = r; i >= l && s[i] == 'A'; i--) {
                ++ret;
            }
            return ret;
        };
        reverse(all(segs));
        long furthest = 1;
        for(pii seg: segs) {
            long As = getAs(seg.first, seg.second);
//            cerr << seg.first << ' ' << seg.second << ' ' << As << ' ' << furthest << endl;
            ans += As * furthest;
            if(As != seg.second - seg.first + 1) furthest = 1;
            else ++furthest;
        }
        cout << ans << endl;
    }
};

class Solver {
public:
    void solve(std::istream& in, std::ostream& out) {
        TaskB *obj = new TaskB();
        obj->solve(in, out);
        delete obj;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    Solver solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}

Measured memory_bytes: 1784
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var n = ReadLong();
            var a = ReadLongs().OrderBy(x => x).ToList();

            var a1 = a.Max();
            if (a1 % 2 == 0)
            {
                var a2_Best = a1 / 2;
                var a2_Better = -1L;
                foreach (var a2 in a.Take((int)n - 1))
                {
                    if (a2 == a2_Best)
                    {
                        return $"{a1} {a2}";
                    }

                    if (Math.Abs(a2_Best - a2) < Math.Abs(a2_Best - a2_Better))
                    {
                        a2_Better = a2;
                    }
                }

                return $"{a1} {a2_Better}";
            }
            else
            {
                var a2_Best1 = a1 / 2;
                var a2_Best2 = a1 / 2 + 1;
                var a2_Better = -1L;
                foreach (var a2 in a.Take((int)n - 1))
                {
                    if (a2 == a2_Best1 || a2 == a2_Best2)
                    {
                        return $"{a1} {a2}";
                    }

                    if (Math.Min(Math.Abs(a2_Best1 - a2), Math.Abs(a2_Best2 - a2))
                        < Math.Min(Math.Abs(a2_Best1 - a2_Better), Math.Abs(a2_Best2 - a2_Better)))
                    {
                        a2_Better = a2;
                    }
                }

                return $"{a1} {a2_Better}";
            }
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 40176
n,*a=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=float("inf")
for i in range(4**n):
  table=[0 for g in range(3) ]
  temp=i
  pre=0

  for j in range(n):

    if temp%4==3:temp//=4;continue
    if table[temp%4]:
      table[temp%4]+=l[j]
      pre+=10
    else:table[temp%4]=l[j]
    temp//=4
  if 0 in table:continue
  for g in range(3):
    pre+=abs(a[g]-table[g])
  ans=min(ans,pre)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, q;
    cin >> n >> q;

    vvll es(n);
    ll a, b;
    REP(i, n - 1){
        cin >> a >> b;
        a--;
        b--;
        es[a].push_back(b);
        es[b].push_back(a);
    }
    vll p(q), x(q);
    REP(i, q){
        cin >> p[i];
        p[i]--;
        cin >> x[i];
    }

    vll res(n);
    REP(i, q){
        res[p[i]] += x[i];
    }
    queue<ll> que;
    vll used(n);
    que.push(0);
    used[0] = 1;
    while(!que.empty()){
        ll u = que.front();
        for(auto t : es[u]){
            if(used[t]) continue;
            res[t] += res[u];
            que.push(t);
            used[t] = 1;
        }
        que.pop();
    }
    REP(i, n) cout << res[i] << endl;
    return 0;
}

Measured memory_bytes: 22640
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
a.sort()
b.sort()
j=0
for i in range(n):
	if a[i]==b[j]:
		j+=1
	if j==m:
		break
if j==m:
	print("YES")
else:
	print("NO")

    

Measured memory_bytes: 35408
#include<iostream>
#include<vector>

using namespace std;

int main(void){

    int n, total = 0, now;
    cin >> n;

    vector<int> A(n), B(n), C(n-1);

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

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

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

    for(int i = 0;i < n;i++){
        total += B[A[i] - 1];
        if(A[i] + 1 == A[i+1]){
            total += C[A[i] - 1];
        }
    }

    cout << total << endl;

    return 0;
}

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

const int Size = 1000;
int dp[Size + 1][Size + 1];
std::string x;
std::string y;

int calc(int m, int n)
{
	int ans = 0;

	if (dp[m][n] != -1) {
		return dp[m][n];
	}

	if (m == 0 || n == 0) {
		return 0;
	}

	if (x[m - 1] == y[n - 1]) {
		ans = calc(m - 1, n - 1) + 1;
		dp[m][n] = ans;
		return ans;
	}

	ans = std::max(calc(m, n - 1), calc(m - 1, n));
	dp[m][n] = ans;
	return ans;
}


int main()
{
	int q;
	std::vector<int> ans;
	std::cin >> q;

	for (int i = 0; i < q; i++) {
		std::cin >> x >> y;
		for (int j = 0; j < Size + 1; j++) {
			for (int k = 0; k < Size + 1; k++) {
				dp[j][k] = -1;
			}
		}
		int temp = calc(x.size(), y.size());
		ans.push_back(temp);
	}

	for (unsigned int i = 0; i < ans.size(); i++) {
		std::cout << ans[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 7144
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n := mustAtoi(sc.Text())
	answer := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		answer[mustAtoi(sc.Text())-1] = strconv.Itoa(i + 1)
	}
	fmt.Print(strings.Join(answer, " "))
}

func mustAtoi(s string) int {
	i, err := strconv.Atoi(s)
	if err != nil {
		panic(err)
	}
	return i
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string a,s,c;
	cin >> a >> s >> c;
	cout << "A" << s[0] << "C" << endl;

	return 0;
}

Measured memory_bytes: 256
fun c103(args: Array<String>) {
    val numList = args[1].split(" ").map { it.toInt() }
    println(numList.map { it - 1 }.sum())
}

fun main(args: Array<String>) {
    c103(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 41352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b,c;
    char d,e;
  	string s;
  	cin>>a>>b;
  
    cout<<a-b+1<<endl;
 
 
 /* else if(a==23)
    cout<<"Christmas Eve Eve"<<endl;
  else
    cout<<"Christmas Eve Eve Eve"<<endl;
  */

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <climits>
using namespace std;

int prim(vector<vector<int> >& A)
{
    int sum = 0;
    bool on[A.size()];
    for (int i = 0; i < A.size(); i++) {
        on[i] = false;
    }

    // pair<cost, node>
    priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > PQ;
    PQ.push(make_pair(0, 0));
    while (!PQ.empty()) {
        pair<int, int> edge = PQ.top();
        PQ.pop();
        if (on[edge.second]) continue;
        on[edge.second] = true;
        sum += edge.first;
        for (int i = 0; i < A.size(); i++) {
            if (on[i] || A[edge.second][i] < 0) continue;
            PQ.push(make_pair(A[edge.second][i], i));
        }
    }
    return sum;
}

int main()
{
    int n;
    cin >> n;
    vector<vector<int> > A(n, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> A[i][j];
        }
    }
    cout << prim(A) << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

int main() {
    int t;
    int a = -1;
    int ans = 0;
    
    rep(i, 5) {
        cin >> t;
        int u = 10 * ceil(t / 10.0);
        ans += u;
        a = max(a, u - t);
    }
    
    cout << ans - a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


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

  if(B-A > 2){
    if(K >= A+1){
      ll ret = 0;
      if((K-(A+1))%2 == 0){
        cout << B + ((B-A) * (K-(A+1)) / 2) << endl;
      }else{
        cout << B + ((B-A) * (K-1-(A+1)) / 2) + 1 << endl;
      }
    }else{
      cout << K+1 << endl;
    }
  }else{
    cout << K+1 << endl;
  }
  
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n;
int A[2000005];

void maxHeapify(int A[],int i)
{
    int l,r,largest;
    l = 2*i;
    r = 2*i+1;
    if(l <= n && A[l] > A[i] )
        largest = l;

    else
        largest = i;
    if(r <= n && A[r] > A[largest])
        largest = r;
    if(largest != i)
    {
        swap(A[i],A[largest]);
        maxHeapify(A,largest);
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&A[i]);
    for(int i=n/2;i>=1;i--)
        maxHeapify(A,i);
    for(int i=1;i<=n;i++)
        printf(" %d",A[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 5100
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>

#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define rep0(i,j) for(int (i)=0;(i)<(j);(i)++)
#define repdown(i, j, k) for(int (i)=(j);(i)>=(k);(i)--)
#define repdown0(i,j) for(int (i)=(j);i>=0;i--)
#define vfor(c,v) for(auto (c): v)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using ll = long long;
using pii = std::pair<int,int>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;

const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
const ll INFL = (1ll << 62) - 1;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};

//_____________________________________Templates_________________________________________//

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}

//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}
//_____________________　following sorce code_________________________//
int n,m,k,x,y;
//vvll dp(400, vll(400));
vll dp(1 << 16, -1e18);
string s;
vvll v(16, vll(16));
vll cost(1 << 16);

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

  IN(n,k);
  vi h(n);
  rep0(i,n)IN(h[i]);
  sort(All(h));
  ll ans = 0;
  rep0(i,n-k){
    ans += h[i];
  }
  OUT(ans);
  return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int n, l;
int main() {
    cin >> n >> l;
    int left = l;
    int right = l + n - 1;
    int sum = (left + right) * n / 2;
    if (left >= 0) {
        cout << sum - l << endl;
    } else if (right <= 0) {
        cout << sum - right << endl;
    } else {
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3588
from collections import deque

def bfs(maze, visited, sy, sx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    ans=0
    while queue:
        y, x = queue.popleft()
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if maze[new_y][new_x] == "." and visited[new_y][new_x]==-1:
                visited[new_y][new_x]=visited[y][x]+1
                ans=max(ans,visited[new_y][new_x])
                queue.append([new_y,new_x])
    return ans
    
def make_wall(maze,h,w):
    maze=deque(maze)
    for i in range(h):
        maze[i]="#"+maze[i]+"#"
    maze.appendleft("#"*(w+2))
    maze.append("#"*(w+2))
    return list(maze)
    
h,w=map(int,input().split())
maze=[input() for _ in range(h)]
maze=make_wall(maze,h,w)
ans=0
for i in range(1,h+1):
    for j in range(1,w+1):
        if maze[i][j]=="#":
            continue
        visited=[[-1]*(w+2) for _ in range(h+2)]
        tmp=bfs(maze, visited, i, j)
        ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	ll n,k;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++)cin>>a[i];
	ll dp[n];
	for(ll i=0;i<n;i++){
		dp[i]=100000000000000;
	}
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(ll i=2;i<n;i++){
		for(ll j=i-1;j>=i-2;j--){
			dp[i]=min(dp[i],dp[j]+abs(a[j]-a[i]));
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<random>
#include<unordered_set>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const int big=1e9-10;
const llint red=0xE869120;
const llint pro=1002001;
const long double pai=3.141592653589793238462643383279;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int main(void){
	int H,W,h,w,i,j;cin>>H>>W>>h>>w;
	//ans[500][500]={0};
	if((H%h)+(W%w)==0){cout<<"No"<<endl;return 0;}
	cout<<"Yes"<<endl;
	int pl=big/(h*w-1);
	int mn=(-pl*(h*w-1))-1;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if((i+1)%h+(j+1)%w==0){cout<<mn<<" ";}
			else{cout<<pl<<" ";}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 2816
/*
  AUTHOR:SOURABH
  CREATED:21:08:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pll , null_type, less< pll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 100000000
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,x,tt,ans;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n>>x>>tt;
        ans=(n/x)*tt;
        if(n%x)
            ans+=tt;
        cout<<ans;
    }
    return 0;
}











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

int main(){
  string s;
  cin >> s;
  queue<char>que;
  ll S = s.size();
  for(int i=0; i<S; i++){
    if(s[i]=='B' && s[i+1]=='C'){
      que.push('Y');
      i++;
    }
    else que.push(s[i]);
  }
  ll ans=0;
  while(que.size()>0){
    ll counta=0;
    ll sizea=0;
    ll ord=0;
    while(que.front()=='A' || que.front()=='Y'){
      ord++;
      ll x = que.front();
      que.pop();
      if(x=='A'){
        counta+=ord;
        sizea++;
      }
    }
    
    while(que.front()=='B' || que.front()=='C') que.pop();
    
    ll count=0;
    for(int i=0; i<sizea; i++){
      count+=ord-i;
    }
    
    ans+=count-counta;
    
  }
  
  cout << ans << endl;
  
}
  
  
  


Measured memory_bytes: 644
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

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

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll X;
    in >> X;
    ll ans = 0;
    long double amount =100;
    while(amount < X) {
        amount *= 1.01;
        amount = floor(amount);
        ans++;
    }
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}



Measured memory_bytes: 3600
var fs = require("fs");
var line = fs.readFileSync("/dev/stdin");
var N = Number(line);
var res = 0;

for (var i = 1; i <= N; i++) {
  var n = Math.floor(N / i);
  res += Math.floor(i * n * (n + 1)) / 2;
}

console.log(res);


Measured memory_bytes: 33184
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	int ret = 0;
	FOR(i, n) {
		int l, r;
		cin >> l >> r;
		ret += (r-l+1);
	}
	cout << ret << endl;
	return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int[] sticks = new int[N];
		
		for (int i = 0; i < N; i++) {
			sticks[i] = sc.nextInt();
		}
		
		Arrays.sort(sticks);
		
		int sum = 0;
		for (int j = N - 1; j > N - 1 -K; j--) {
			sum += sticks[j];
		}
		
		System.out.println(sum);
		
		
	}
}




Measured memory_bytes: 21204
import java.util.*;
// import java.io.*;
// import java.time.*;

public class Main {
    static List<List<Integer>> permutations;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // StringBuilder sb = new StringBuilder();

        int num = sc.nextInt();

        ArrayList<Integer> array = new ArrayList<>();
        for (int i = 0; i < num; i++) {
            array.add(sc.nextInt());
        }

        List<Integer> input = new ArrayList<>(array);
        Collections.sort(array);

        permutations = new ArrayList<List<Integer>>();
        permutation(array, new ArrayList<>());

        List<Integer> before = new ArrayList<>();

        for (int i = 0; i < permutations.size(); i++) {
            if (permutations.get(i).equals(input)) {
                if (i > 0) printListWithWhiteSpace(before);
                printListWithWhiteSpace(permutations.get(i));
                if (i + 1 < permutations.size()) printListWithWhiteSpace(permutations.get(i + 1));
                break;
            }
            before = permutations.get(i);
        }

        // System.out.print(sb);
        
        sc.close();
    }

    public static void permutation(List<Integer> q, List<Integer> ans){
        // Base Case
        if(q.size() <= 1) {
            List<Integer> tmp = new ArrayList<>();
            tmp.addAll(new ArrayList<>(ans));
            tmp.add(q.get(0));
            permutations.add(tmp);
        }
        // General Case
        else {
            for (int i = 0; i < q.size(); i++) {
                List<Integer> new_q = new ArrayList<>();
                new_q.addAll(new ArrayList<>(q.subList(0, i)));
                new_q.addAll(new ArrayList<>(q.subList(i + 1, q.size())));
                List<Integer> new_ans = new ArrayList<>();
                new_ans.addAll(new ArrayList<>(ans));
                new_ans.add(q.get(i));
                permutation(new_q, new_ans);
            }
        }
    }

    public static void printListWithWhiteSpace(List<Integer> list) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            sb.append(list.get(i));
            if (i != list.size() - 1) sb.append(' ');
        }
        System.out.println(sb);
    }
}



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

int main()
{
    int64_t power=1;
    int64_t n;
    int64_t ref = 1000000007;

    cin >> n;

    for(int64_t i=1;i<=n;i++){
        power*=i;
        power%=ref;
    }
    cout << power <<endl;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> que;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        que.push(a);
    }

    for (int i = 0; i < M; i++) {
        int t = que.top(); que.pop();
        if (t == 0) break;
        t /= 2;
        que.push(t);
    }

    long long res = 0;
    while (!que.empty()) {
        res += que.top(); que.pop();
    }

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

Measured memory_bytes: 892
n = int(input())
field = []
for _ in range(2):
    field.append(list(map(int, input().split())))
max_count =0

for i in range(n):
    count = sum(field[0][0:i+1]) + sum(field[1][i:])
    if count > max_count:
        max_count = count

print(max_count)

Measured memory_bytes: 3060
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int RADIX = -2;
        StringBuilder res=new StringBuilder();

        if(N==0){
            System.out.println(0);
        }else {
            while (N != 0) {
                if (N % RADIX < 0) {
                    res.append(1);
                    N = 1 + N / RADIX;
                } else {
                    res.append(N % RADIX);
                    N = N / RADIX;
                }
            }
            System.out.println(res.reverse().toString());
        }
    }
}


Measured memory_bytes: 23764
class Stack():
    def __init__(self):
        self.stack = []

    def isEmpty(self):
        return len(self.stack) == 0
    
    def push(self, item):
        self.stack.append(item)
    
    def pop(self):
        if len(self.stack) != 0:
            return self.stack.pop()

operand = Stack()
ope = input().split()
for i in range(0, len(ope)):
    if ope[i] == "+":
        a = operand.pop()
        b = operand.pop()
        operand.push(a+b)
    elif ope[i] == "-":
        a = operand.pop()
        b = operand.pop()
        operand.push(b-a)
    elif ope[i] == "*":
        a = operand.pop()
        b = operand.pop()
        operand.push(a*b)
    else:
        operand.push(int(ope[i]))

print(operand.pop())


Measured memory_bytes: 5604
sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
ans = ''
for i in range(dx):
    ans+='R'
for j in range(dy):
    ans+='U'
for i in range(dx):
    ans+='L'
for j in range(dy):
    ans+='D'
ans+='D'
for i in range(dx+1):
    ans+='R'
for j in range(dy+1):
    ans+='U'
ans+='LU'
for i in range(dx+1):
    ans+='L'
for j in range(dy+1):
    ans+='D'
ans+='R'
print(ans)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define N 100005
#define mp make_pair
#define pb push_back
#define f first
#define se second
vector<int>adj[N];
vector<bool>vis(N,false);
int cnt=0;
bool prime[1000004];
void dfs(int v)
{   
    vis[v]=true;
    for(auto it:adj[v])
        if(!vis[it])
            dfs(it);
}
bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 
void prime_check() 
{  
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=1000000; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (int i=p*p; i<=1000000; i += p) 
                prime[i] = false; 
        } 
    } 
} 
int main()
{
  ll h,n,sum=0,x;
  cin>>h>>n;
  for(ll i=0;i<n;i++)
  {
       cin>>x;
       sum+=x;
  }
  if(sum<h)
    cout<<"No";
  else
    cout<<"Yes";
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<math.h>
#define NN 10000
using namespace std;

int main(){
  double d,x1[NN],x2[NN],y1[NN],y2[NN],r1[NN],r2[NN];
  int n,i,j;

  cin >> n;
  for(i=0;i<n;i++){
    cin >> x1[i] >> y1[i] >> r1[i] >> x2[i] >> y2[i] >> r2[i];
  }



  for(i=0;i<n;i++){
   

    d=sqrt((x1[i]-x2[i])*(x1[i]-x2[i])+(y1[i]-y2[i])*(y1[i]-y2[i]));

    



    if(d<r1[i]-r2[i])cout << "2" << endl;
    else if(d<r2[i]-r1[i])cout << "-2" << endl;
    else if(d == r1[i]-r2[i] || d == r2[i] - r1[i]) cout << "1" << endl;
    else if(d == r1[i]+r2[i])cout << "1" << endl;
    else if((r1[i]>=r2[i] && r2[i]-r1[i] < d && d < r2[i] + r1[i]) ||(r2[i]>=r1[i] && r1[i]-r2[i] < d && d < r1[i] + r2[i]))cout << "1" << endl;
    else if(d>r1[i]+r2[i])cout << "0" << endl;

  }

}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int q;
  cin >> q;
  int rev = 1;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1)
      rev = -rev;
    else {
      int f;
      cin >> f;
      string c;
      cin >> c;
      if ((f == 1 && rev == 1) || (f == 2 && rev == -1)) {
        s.insert(0, c);
      } else {
        s += c;
      }
    }
  }
  if (rev == -1) reverse(s.begin(), s.end());
  cout << s << '\n';
  return 0;
}

Measured memory_bytes: 3876
'use strict'
function Main(input){
  input=input.trim().split(/\n/);
  var N=input[0]-0;
  var V=input[1].trim().split(/\s+/).map(x=>x-0);
  var C=input[2].trim().split(/\s+/).map(x=>x-0);
  var ans=V.reduce((a,v,i)=>a+((v>C[i])?(v-C[i]):0),0);
  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, M;
	int ans = 1;

	cin >> N >> M;
	ans = 1900 * M + 100 * (N - M);
	rep(i, M) ans <<= 1;
	
	cout << ans << endl;

	return 0;
}


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

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define F first
#define S second
const long long MOD = 1e9+7;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int,int> pii;
typedef long long ll;
// Mod int
// const int MOD = 1000000007;
struct mint{
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  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;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
mint powmod(mint x,ll y){
	mint a(1);
	while(y){
		if(y&1) a=a*x;
		x=x*x;
		y/=2;
	}
	return a;
}
vector<vector<mint>> dp[5];
int main(){
	int n;
	cin>>n;
	vector<pii> v(n);
	bool zero=false;
	rep(i,n) cin>>v[i].F;
	rep(i,n){
		if(v[i].F==0){
			zero=true;
			v[i].S=1;
		}
		else{
			int cnt=0;
			int t=v[i].F;
			while(t){
				t/=10;
				cnt++;
			}
			v[i].S=cnt;
		}
	}
	vint w(5,0);
	rep(i,n){
		w[v[i].S]+=v[i].F;
	}
	int cc[5]={};
	rep(i,n){
		cc[v[i].S]++;
	}
	mint ans[2];
	rep(i,2) ans[i].x=0;
	vector<mint> fun(210,mint(0LL));
	vector<mint> fun_sum(210,mint(0LL));
	fun[0]+=mint(1);
	reep(i,1,210){
		fun[i]=mint(i)*fun[i-1];
	}
	mint combi[210][210];
	rep(i,210) rep(j,210) combi[i][j].x=0LL;
	rep(i,210){
		combi[i][0]=combi[i][i]=mint(1);
		reep(j,1,i){
			combi[i][j]=combi[i-1][j]+combi[i-1][j-1];
		}
	}
	rep(i,210){
		if(i==0){
			fun_sum[0]=mint(1);
			continue;
		}
		rep(j,i+1){
			fun_sum[i]+=combi[i][j]*fun[j];
		}
	}
	rep(o,2){
		if(o){
			if(!zero) continue;
			else cc[1]--;
		}
		rep(i,5) dp[i]=vector<vector<mint>>(1000,vector<mint>(210));
		rep(i,5){
			dp[i][0][0].x=1;
			if(!cc[i]) continue;
			cc[i]--;
			rep(j,5){
				rep(k,cc[j]){
					vector<vector<mint>> tmp=dp[i];
					for(int p=999;p>=0;p--){
						for(int q=209;q>=0;q--){
							if(!tmp[p][q].x) continue;
							dp[i][p+j][q+1]+=tmp[p][q];
						}
					}
				}
			}
			cc[i]++;
		}
		rep(i,5){
			rep(j,1000){
				ll t=0;
				rep(k,210){
					t+=(dp[i][j][k]*fun[k]*fun_sum[n-o-k-1]).x;
				}
				ans[o]+=mint(w[i])*powmod(mint(10),j)*mint(t);
			}
		}
	}
	cout<<(ans[0]-ans[1]).x<<endl;
}

Measured memory_bytes: 11588
#include<stdio.h>
void warshall_floyd(void);
int min(int,int);
int graph[101][101];
int n,c,d;

int main(void){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=(i==j?0:1000000);

    for(i=0;i<k;i++){

      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);
	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }
      else{
	scanf("%d %d",&a,&b);
	if(graph[a][b]<1000000)printf("%d\n",graph[a][b]);
	else printf("-1\n");
      }
    }
  }
  return 0;
}

void warshall_floyd(void){
  int i,j;
  
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
    }
  }
}

int min(int x,int y){
  return (x<y)?x:y;
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

#define rep(i,n) for(int i=0;i<(n);i++)
#define INT(n) int n;scanf("%d",&n);
#define LL(n) long long n;scanf("%lld",&n);
#define pint(n) printf("%d",n);
#define pll(n) printf("%lld",n);
#define psp printf(" ");
#define pln puts("");

int main(){
	INT(n)
	std::vector<long long>A(n);
	rep(i,n)scanf("%lld",&A[i]);
	long long x=0,y=0;
	std::sort(A.begin(),A.end());
	rep(i,n-1){
		if(A[i]==A[i+1]){
			y = x;
			x = A[i];
			i++;
		}
	}
	printf("%lld",x*y);
	pln
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>
int main(void){
char s[200005];
int sum=0;
scanf("%s",s);
for(int i=0;s[i]!='\0';i++){
	sum=sum+s[i]-48;
}
if(sum%9==0){printf("Yes");}
else{printf("No");}
}

Measured memory_bytes: 1884
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n;
ll count1;

//<<-----Implement Functions Here---->>//


//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;
		while(n>0)
		{
			if(n%10==7)count1++;
			n/=10;
		}
		if(count1)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 6016
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

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

typedef long long ll;

bool isprime(int x){
    if (x<=1) return false;
    FOR(i,2,sqrt(x)){
        if (x%i==0)
            return false;
    }
    return true;
}

int main(void) {
    int n;
    cin >> n;
    int ans = 0;
    while(n--){
        int a;
        cin >> a;
        ans += isprime(a);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;
public class Main {
	static int N;
	static int[] A;
	static int[] num;
	
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		A=new int[N-1];
		num=new int[N];
		for(int i=0;i<N;i++) {
			num[i]=0;
		}
		for(int i=0;i<N-1;i++) {
			A[i]=sc.nextInt();
			num[A[i]-1]++;
		}
		for(int i=0;i<N;i++) {
			System.out.println(num[i]);
		}
	}
}


Measured memory_bytes: 61148
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };

signed main() {
  int r; 
  cin >> r;
  cout << r*r << endl;
}

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

public class Main {
	public static void main(String[] args) {
		print();
	}

	private static void print() {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			while (str != null) {

				String[] nums = str.split(" ", 0);

				int x = Integer.parseInt(nums[0]);
				int y = Integer.parseInt(nums[1]);

				int keta = Integer.toString(x+y).length();

				System.out.println(keta);
				str = br.readLine();

			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}

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

const int MOD = 1000000007;
int dp[101][4][4][4];

int main() {
  int n; cin>>n;
  dp[0][3][3][3]=1;
  rep(i, n) {
    rep(c1, 4) {
      rep(c2, 4) {
        rep(c3, 4) {
          rep(new_c, 4) {;
            if (new_c==1&&c1==2&&c2==0) continue;
            if (new_c==2&&c1==1&&c2==0) continue;
            if (new_c==2&&c1==1&&c3==0) continue;
            if (new_c==2&&c1==0&&c2==1) continue;
            if (new_c==2&&c2==1&&c3==0) continue;
            dp[i+1][new_c][c1][c2]+=dp[i][c1][c2][c3];
            dp[i+1][new_c][c1][c2]%=MOD;
          }
        }
      }
    }
  }
  ll ans=0;
  rep(i, 4) {
    rep(j, 4) {
      rep(k, 4) {
        ans+=dp[n][i][j][k];
        ans%=MOD;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256