akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


lst sosu;


bool check(int i)
{
	for (auto s : sosu)
	{
		if (sqrt(i) < s) { return true; }
		if (i%s == 0){ return false; }
	}
	return true;
}


bool solve()
{
	int N, P;
	cin >> N >> P;
	if (N == -1)return false;
	
	auto itr1 = sosu.begin();
	while(N >= (*itr1))
	{
		++itr1;
	}

	vec Koho; Koho.reserve(1000);

	for (int i = 0; i <= P; ++i, ++itr1)
	{
		auto itr2 = itr1;
		for (int j = 0; j <= P; ++j, ++itr2)
		{
			Koho.emplace_back((*itr1) + (*itr2));
		}
	}

	sort(Koho.begin(), Koho.end());

	cout << Koho[P-1] << endl;

	return true;
}


int main()
{
	sosu.push_back(2);
	for (int i = 3; i < 500000; ++i)
	{
		if (check(i))
		{
			sosu.push_back(i);
		}
	}

	while(solve())
	{
	}

	return 0;
}


Measured memory_bytes: 4508
#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          int long long 
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          PI acos(-1.0)
#define 		 bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > 
OS ;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int r , g,  ar , ag,c;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
	cin >> r >> g >> ar >> ag >> c;
	multiset<int> str , stg , stc;

	fo(i,0,ar)
	{
		int x;
		cin >> x;
		str.insert(x);
	}
	fo(i,0,ag)
	{
		int x;
		cin >> x;
		stg.insert(x);
	}

	fo(i,0,c)
	{
		int x;
		cin >> x;
		stc.insert(x);
	}
	
	int ans = 0;
	int rr = r , gg = g , cn = r + g;
	while( rr-- ) 
	{
		stc.insert( *str.rbegin() );
		str.erase( str.find( *str.rbegin() ) );
	}

	while( gg-- ) 
	{
		stc.insert( *stg.rbegin() );
		stg.erase( stg.find( *stg.rbegin() ) );
	}

	while( cn-- )
	{
		ans += *stc.rbegin();
		stc.erase( stc.find( *stc.rbegin() ) );
	}

	cout << ans << endl;


}

int32_t main()
{
	//INP(); 
	FAST;     
	int t=1; 
	// cin>>t;
	test(t) go();
}



Measured memory_bytes: 19584
using System;

class Program
{
    static void Main()
    {
      //int N = Int32.Parse(Console.ReadLine());
      string[] sarr = Console.ReadLine().Split(" ",StringSplitOptions.RemoveEmptyEntries);
      
      long A = Int64.Parse(sarr[0]);
      decimal B = Convert.ToDecimal(sarr[1]);
      
      long C = A * (long)(B * 100);
      Console.Write((long)(C / 100));
    }
}

Measured memory_bytes: 27576
package main

import (
	"fmt"
    "sort"
	//"strconv"
)

func main() {
	var N int

	fmt.Scanf("%d",&N)
  
    sli := make([]string,N)
  	
  	m := map[string]int{}
  
  	for i:=0;i<N;i++{
    	fmt.Scanf("%s",&sli[i])
      	m[sli[i]]++
   	}
  max:=0
  for _,v := range m{
    if v>max{
    	max=v
    }
  }
  var sli2 []string
  cnt:=0
  for k,v := range m{
    if v==max{
      	sli2=append(sli2,k)
      	cnt++
    }
  }
  sort.Sort(sort.StringSlice(sli2))
  for i:=0;i<len(sli2);i++{
    fmt.Println(sli2[i])
  }
}

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

int main() {
  int n,cnt=0;
  int a[100];

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

  for (int i = 0; i < n; i++){
  	if(a[i]==a[i+1]){
  		cnt++;
  		i++;
  	}
  }

  cout<<cnt<<endl;
}

Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

class BIT{
  constructor(n){
    this.a = Array(n+1).fill(0);
  }
  add(val,id){
    for(var x=val,i=id;i<this.a.length;i+=i&-i)this.a[i]+=x;
  }
  get(id){
    for(var r=0,i=id;i;i-=i&-i)r+=this.a[i];
    return r;
  }
}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var q = next();
  var c = nexts(n);
  var cc = xArray("[1]",n);
  var bit = new BIT(n+1);
  var map = new Set();
  for(var i = 0; i < n; i++){
    var t = --c[i];
    cc[t].push(i+1);
    if(!map.has(t))map.add(t), bit.add(1,i+1);
  }
  for(var i = 0; i < n; i++){
    cc[i].push(n+1);
  }
  var lr = Array(q);
  for(var i = 0; i < q; i++){
    lr[i] = [next(), next(), i];
  }
  lr.sort((a,b)=>a[0]-b[0]);
  var ans = Array(q), id = 1;
  for(var i = 0; i < q; i++){
    var [l,r,ix] = lr[i];
    while(id < l){
      var cr = c[id-1];
      var idx = ++cc[cr][0];
      bit.add(-1,id);
      bit.add(1,cc[cr][idx]);
      id++;
    }
    ans[ix] = bit.get(r);
  }
  return ans.join("\n");
}


Measured memory_bytes: 352588
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    string c1,c2;
    cin >> c1 >> c2;
    if(c1[0]!=c2[2]){
      cout << "NO";
      return 0;
    }
    if(c1[1]!=c2[1]){
      cout << "NO";
      return 0;
    }
    if(c1[2]!=c2[0]){
      cout << "NO";
      return 0;
    }
    cout << "YES";
    return 0;
}


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

int main(){
	
	std::string Letter;
	int Count[26] = {0};
	
	while(getline(cin, Letter)){
		
		for(int i = 0; i < 26; i++){
			int p = i;
			char alphabet;
			char Alphabet;
			
			if(p == 0 ) alphabet = 'a';
			if(p == 1 ) alphabet = 'b';
			if(p == 2 ) alphabet = 'c';
			if(p == 3 ) alphabet = 'd';
			if(p == 4 ) alphabet = 'e';
			if(p == 5 ) alphabet = 'f';
			if(p == 6 ) alphabet = 'g';
			if(p == 7 ) alphabet = 'h';
			if(p == 8 ) alphabet = 'i';
			if(p == 9 ) alphabet = 'j';
			if(p == 10) alphabet = 'k';
			if(p == 11) alphabet = 'l';
			if(p == 12) alphabet = 'm';
			if(p == 13) alphabet = 'n';
			if(p == 14) alphabet = 'o';
			if(p == 15) alphabet = 'p';
			if(p == 16) alphabet = 'q';
			if(p == 17) alphabet = 'r';
			if(p == 18) alphabet = 's';
			if(p == 19) alphabet = 't';
			if(p == 20) alphabet = 'u';
			if(p == 21) alphabet = 'v';
			if(p == 22) alphabet = 'w';
			if(p == 23) alphabet = 'x';
			if(p == 24) alphabet = 'y';
			if(p == 25) alphabet = 'z';
		
			if(p == 0 ) Alphabet = 'A';
			if(p == 1 ) Alphabet = 'B';
			if(p == 2 ) Alphabet = 'C';
			if(p == 3 ) Alphabet = 'D';
			if(p == 4 ) Alphabet = 'E';
			if(p == 5 ) Alphabet = 'F';
			if(p == 6 ) Alphabet = 'G';
			if(p == 7 ) Alphabet = 'H';
			if(p == 8 ) Alphabet = 'I';
			if(p == 9 ) Alphabet = 'J';
			if(p == 10) Alphabet = 'K';
			if(p == 11) Alphabet = 'L';
			if(p == 12) Alphabet = 'M';
			if(p == 13) Alphabet = 'N';
			if(p == 14) Alphabet = 'O';
			if(p == 15) Alphabet = 'P';
			if(p == 16) Alphabet = 'Q';
			if(p == 17) Alphabet = 'R';
			if(p == 18) Alphabet = 'S';
			if(p == 19) Alphabet = 'T';
			if(p == 20) Alphabet = 'U';
			if(p == 21) Alphabet = 'V';
			if(p == 22) Alphabet = 'W';
			if(p == 23) Alphabet = 'X';
			if(p == 24) Alphabet = 'Y';
			if(p == 25) Alphabet = 'Z';
		
			for(int j = 0; j < Letter.size(); j++){
				if(Letter[j] == alphabet || Letter[j] == Alphabet) Count[i] += 1;
			}
		}
	}
	
	char alphabet[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	for(int i = 0; i < 26; i++){
		cout << alphabet[i] << " : " << Count[i] << endl;
	}
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            long[] A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            Arrays.sort(A);

            long count = 0;
            for (int i = N / 2 + 1; i < N; i++) {
                count += A[i];
            }
            for (int i = N / 2; i < N - 1; i++) {
                count += A[i];
            }
            if (N % 2 == 0) {
                count += A[N / 2];
            }
            System.out.println(count);
        }
    }
}


Measured memory_bytes: 51688
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
ans = [K-Q]*N
for i in range(1,Q+1):
    ans[A[i-1]-1] += 1    
for k in ans:
    if k <= 0:
        print('No')
    else:
         print('Yes')

Measured memory_bytes: 10472
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>

using namespace std;

typedef long long in;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        cin >> a[i];
    sort(a.begin(),a.end());
    vector<int> ct(100001);
    for(int i=0;i<n;i++)
        ct[a[i]]++;
    int ind=n-1;
    for(int i=0;i<n;i++)
        while(ct[a[i]]>2)
            ct[a[i]]-=2;
    for(int i=0;i<n;i++){
        if(ct[a[i]]==2){
            for(;ind>i;ind--){
                if(ct[a[ind]]==2){
                    ct[a[i]]--;
                    ct[a[ind]]--;
                }
                if(ct[a[i]]==1)
                    break;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(ct[a[i]]>1){
            for(int j=n-1;j>=0;j--){
                if(i!=j&&ct[a[j]]==1){
                    ct[a[i]]--;
                    ct[a[j]]--;
                }
                if(ct[a[i]]==1)
                    break;
            }
        }
    }
    int res=0;
    for(int i=0;i<n;i++){
        if(ct[a[i]]==1){
            res++;
            ct[a[i]]=0;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
use std::cmp::min;
//use std::collections::HashSet;

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>();
    let s1: Vec<char> = s.chars().collect();

    let answer = solve(n, &s1);
    println!("{}", answer);
}

fn solve(n: usize, s: &[char]) -> usize {
    let mut v_max = 0;
    for i in 0..n {
        let sub = &s[i..n];
        let z = z_algo(n - i, sub);
        //println!("z: {:?}", z);
        let tmp = get_max(z.len(), &z);
        //println!("tmp: {}", tmp);
        if tmp > v_max {
            v_max = tmp;
        }
        if v_max > (n - i - 1) / 2 {
            break;
        }
    }
    return v_max;
}

fn z_algo(n: usize, s: &[char]) -> Vec<usize> {
    //println!("*** {}, {:?}", n, s);
    let mut z: Vec<usize> = vec![0; n];
    let mut l: usize = 0;
    let mut r: usize = 0;
    for i in 1..n {
        //println!("{}", i);
        if i >= r {
            //println!("   A");
            l = i;
            r = i;
            while r < n && s[r] == s[r - l] {
                r += 1;
            }
            z[i] = r - l;
        //r -= 1;
        } else {
            let k = i - l;
            if z[k] < r - i {
                //println!("   B1");
                z[i] = z[k];
            } else {
                //println!("   B2");
                l = i;
                while r < n && s[r] == s[r - l] {
                    r += 1;
                }
                z[i] = r - l;
            }
        }
    }
    // println!("{:?}", z);
    return z;
}

/**
 * l1 + len <= l2
 *  --> z[i] <= l1
 */
fn get_max(n: usize, z: &[usize]) -> usize {
    let mut v_max: usize = 0;
    for i in 1..n {
        let tmp = min(z[i], i);
        if tmp > v_max {
            v_max = tmp;
        }
    }
    return v_max;
}


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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    for (int x = 1; x <= 10000; ++x) {
        if ((int)(x * 0.08) == A && (int)(x * 0.1) == B) {
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll modulator = pow(10, 9) + 7;
    ll n;
    ll power = 1;
    cin >> n;
    REP(i, n) {
        power = (power * (i + 1)) % modulator;
    }
    cout << power << endl;
    return 0;
}

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

int main() {
  int n;
  cin>>n;
  int a1[n], a2[n];
  for(int i=0;i<n;i++) cin>>a1[i];
  for(int i=0;i<n;i++) cin>>a2[i];
  int sum=0;
  for(int i=0;i<n;i++){
    int temp=0;
    for(int j=0;j<=i;j++) temp+=a1[j];
    for(int j=i;j<=n-1;j++) temp+=a2[j];
    if(temp>sum) sum=temp;
  }
  cout<<sum<<endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> sum(n);
    ll b = 1000000007;
    rep(i,n){
        cin >> a[i];
        if(i==0) sum[i] = a[i];
        else sum[i] = sum[i-1]+a[i];
        sum[i] %= b;
    }

    ll ans = 0;
    for(int i=n-1; i>0; i--){
        ans += (a[i] * sum[i-1]) % b;
        ans %= b;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 6436
#include<stdio.h>
#include<string.h>

int main(void)
{
  char s;
  scanf("%c",&s);
  if(((s=='a' || s=='i')||(s=='u'||s=='e'))||s=='o')
    printf("vowel\n");
  else
    printf("consonant\n");
  return 0;
}


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

#define mp make_pair
#define pb push_back
#define st first
#define nd second

typedef long long ll;
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e5 + 5;

vector < int > V[N];
int W[N],w,n,h,i,j,x,y,mx,t;
char s[N];

int f(int x){
    int h = W[x] & 1;
    W[x] = 0;
    int i, m, mm=0;
    if(s[x] == 'B') m = h ? 2 : 0;
    else m = h ? 0 : 2;
    for(i=0; i<V[x].size(); i++)
        if(W[ V[x][i] ]){
            int tem = f(V[x][i]);
            mx = max(mx , m + mm + tem);
            mm = max(mm , tem);
        }
    return m+mm;
}

int main(){
    cin >> n;
    for(i=1;i<n;i++){
        cin >> x >> y; W[x]++; W[y]++;
        V[x].pb(y); V[y].pb(x);
    }
    cin >> s+1;
    for(i=1;i<=n;i++){
        for(x=i; W[x] == 1 && s[x] == 'B' ; x = y){
            W[x]--;
            for(j=0;j<V[x].size();j++)
                if(W[ V[x][j] ])
                    y = V[x][j];
            W[y]--;
        }
        if(s[i] == 'W') w++;
    }
    if(w == 1){
        cout << 1;
        return 0;
    }

    x = 0;
    for(i=1;i<=n;i++)
        if(W[i]){
            t++;
            x = i;
        }
    if(x == 0){
        cout << 0;
        return 0;
    }

    t = t+t-2;
    for(i=1;i<=n;i++)
        if(W[i]){
            h = W[i] & 1;
            int m=0;
            x = i;
            if(s[x] == 'B') m = h ? 1 : 0;
            else m = h ? 0 : 1;
            t += m;
        }

    f(x);
    cout << t - mx;
    return 0;
}

Measured memory_bytes: 12928
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	string s;
	cin >> s;
	string last = "abcdefghijklmnopqrstuvwxyz";
	reverse(last.begin(), last.end());
	if (s >= last) {
		cout << -1 << endl;
		return 0;
	}
	vector<bool> used(26);
	rep(i, s.size()) {
		used[s[i] - 'a'] = true;
	}
	if (s.size() < 26) {
		cout << s;
		rep(i, 26) {
			if (!used[i]) {
				cout << (char)('a' + i) << endl;
				return 0;
			}
		}
	}
	else {
		for (int i = s.size() - 1; i >= 0; i--) {
			char l = s[i];
			for (int j = l - 'a'; j < 26; j++) {
				if (!used[j]) {
					s[i] = 'a' + j;
					cout << s << endl;
					return 0;
				}
			}
			used[l - 'a'] = false;
			s.pop_back();
		}
	}

}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = ns()
t = ns()

hey = set(list(s))
for c in t:
    if c not in hey:
        print(-1)
        sys.exit(0)

n = len(s)
nex = [[n] * 26 for _ in range(n+1)]
for i in range(n-1,-1,-1):
    for j in range(26):
        nex[i][j] = nex[i+1][j]
    nex[i][ord(s[i])-ord("a")] = i

ans = 0
pos = 0
for i in range(len(t)):
    v = ord(t[i]) - ord("a")
    ne = nex[pos][v]
    ans += ne - pos + 1
    if ne == n:
        ne = nex[0][v]
        ans += ne
    pos = ne + 1
print(ans)


Measured memory_bytes: 73888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
   int n;
   cin>>n;
   int a[n+2];
   for(int i=1;i<=n;i++){
       cin>>a[i];
   }
   a[0]=0;
   a[n+1]=0;
   int kai=0;
   for(int i=0;i<=n;i++){
       kai+=abs(a[i]-a[i+1]);
   }
   int ans;
   for(int i=1;i<=n;i++){
       ans=abs(a[i]-a[i-1])+abs(a[i]-a[i+1])-abs(a[i+1]-a[i-1]);
       cout<<kai-ans<<endl;
   }
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
int n,k,d[52],dp[110][110],ans=0;
int main(){
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&d[i]);
	for(int i=0;i<=k;i++) for(int j=0;i+j<=min(k,n);j++){
		int sum=0,ll=0,fu[52];
		for(int l=1;l<=i;l++){
			sum+=d[l];
			if(d[l]<0) fu[++ll]=d[l];
		}
		for(int l=1;l<=j;l++){
			sum+=d[n-l+1];
			if(d[n-l+1]<0) fu[++ll]=d[n-l+1];
		}
		sort(fu+1,fu+ll+1);
		int c=k-i-j;
		for(int l=1;l<=min(c,ll);l++) sum-=fu[l];
		ans=max(ans,sum);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
  /*文字列を入力*/
  int H,W;
  scanf("%d %d",&H,&W);

  char s[H][W];
  for(int i=0;i<H;i++) scanf("%s",s[i]);

  /*行列をcheck*/
  int comph[101] = {0}, compw[101] = {0};

  for(int i=0;i<H;i++) {
    int tmp = 0;
    for(int j=0;j<W;j++) {
      if(s[i][j] == '#') tmp++;
    }
    if(tmp==0) comph[i] = 1;
  }
  
  for(int j=0;j<W;j++) {
    int tmp = 0;
    for(int i=0;i<H;i++) {
      if(s[i][j] == '#') tmp++;
    }
    if(tmp==0) compw[j] = 1;
  }
  
  /*出力*/
  for(int i=0;i<H;i++) {
    if(comph[i]==1) continue;
    for(int j=0;j<W;j++) {
      if(compw[j]==1) continue;
      printf("%c",s[i][j]);
    }
    printf("\n");
  }
  return(0);
}


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

int gcd(int p, int q){
  if(p % q == 0) return q;
  return gcd(q, p % q);
}

int main (){
  int k,a_b;
  long long ans = 0;
  cin >> k;
  for(int a = 1; a <= k; a++){
    for(int b = 1; b <= k; b++){
      a_b = gcd(a, b);
      for(int c = 1; c <= k; c++){
        ans += gcd(a_b, c);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
l = list(map(int,input().split(' ')))
x_1 = l[0]
x_0 = l[1]
x_neg = l[2]
K = l[3]
if (K<=x_1):
  print(K)
elif (K-x_1<=x_0):
  print(x_1)
else :
  print(x_1 -(K-x_1-x_0))
  


Measured memory_bytes: 9128
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
Scanner sc = new Scanner(System.in);
// 2つの文字の固まりを整数値と想定して読み込む
int a = sc.nextInt();
int b = sc.nextInt();
if (a < b) {
System.out.println("a < b");
} else if (a > b){
System.out.println("a > b");
}else if (a == b){
System.out.println("a == b");
}
}
}


Measured memory_bytes: 26196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>
#include <ios>
#include <iomanip>

#define INF 200000000
#define MOD 1000000007

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    vector<int> c;
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        c.push_back(tmp);
    }
    int ans = 0;
    for(int i = 0;i<n;i++)
    {
        if(v[i] - c[i]>0)
        {
            ans += (v[i] - c[i]);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n, m = (int(i) for i in input().split())

a = []
b = []
for i in range(n):
    a.append(input())

for i in range(m):
    b.append(input())
     
for i in range(n - m + 1):
    if b[0] in a[i]:
        pos = a[i].find(b[0])
        flag = 0
        for j in range(m):
            if a[i+j][pos:pos+m] == b[j]:
                pass
            else:
                flag = -1
                break
        if flag == 0:
            print("Yes")
            exit(0)
     
print("No")


Measured memory_bytes: 3064
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

N=intput()
if N%2!=0:
    print(0)
else:
    N//=2
    ans=0
    while N>0:
        N//=5
        ans+=N
    print(ans)

Measured memory_bytes: 69164
#include <cstdio>
#include <set>
#include <utility>
#include <algorithm>

using ll_t = long long;
const int MAXN = 1e5;

struct Node {
  int value, pos;
  Node(int v = 0, int p = 0) : value(v), pos(p) {}
};
Node p[MAXN];
std::set<int> st;

ll_t solve(int n) {
  std::sort(p, p + n, [](const Node &a, const Node &b) {
    return a.value > b.value;
  });
  st.emplace(-1);
  st.emplace(n);
  ll_t res = 0;
  for (int i = 0; i < n; ++i) {
    int pos = p[i].pos;
    int l1 = -1, l2, r1, r2 = n;
    auto iter = st.lower_bound(pos);
    if (*iter == n) {
      r1 = n;
      --iter;
      l2 = *iter;
      if (iter != st.begin()) l1 = *(--iter);
    } else {
      auto iter2 = iter;
      r1 = *iter;
      ++iter;
      r2 = *iter;
      --iter2;
      l2 = *iter2;
      if (iter2 != st.begin()) l1 = *(--iter2);
    }
    // printf("pos = %d value = %d\n", pos, p[i].value);
    // printf("l1 = %d l2 = %d r1 = %d r2 = %d\n", l1, l2, r1, r2);
    ll_t num = (ll_t)(l2 - l1) * (r1 - pos) + (ll_t)(pos - l2) * (r2 - r1);
    res += num * p[i].value;
    st.emplace(pos);
  }
  return res;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0, value; i < n; ++i) {
    scanf("%d", &value);
    p[i] = Node(value, i);
  }
  printf("%lld\n", solve(n));
  return 0;
}



Measured memory_bytes: 5760
N= int(input())
a=[0]*N
ans=0
b=list(map(int,input().split()))

for i in range(N):
    if max(a)<=b[i] and 0<=b[i]:
        ans +=1
        a[i]=b[i]
    else:
        a[i]=b[i]
print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>

using namespace std;

#define rep(i, l, r) for(int i=l; i<=r; i++)
#define dow(i, l, r) for(int i=l; i>=r; i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr(x, c) memset(x,c,sizeof(x))
#define lowbit(x) (x)&(-(x))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;

inline int read() {
    int x=0,f=0; char ch=getchar();
    while (ch<'0' || '9'<ch) f|=ch=='-', ch=getchar();
    while ('0'<=ch && ch<='9') x=x*10+ch-'0', ch=getchar();
    return f?-x:x;
}

#define maxn 200009

// int s[maxn];
// inline int sum(int x) {int sum=0; while (x) sum+=s[x], x-=lowbit(x); return sum;}
// inline void add(int x) {while (x<=n) s[x]+=1, x+=lowbit(x);}

// struct edge {int x, y, c; edge *n;} e[maxm], *fir[maxn], *pt=e;
// inline void addEdge(int x, int y, int c) {
//     pt->x = x; pt->y = y; pt->c = c; pt->n = fir[x]; fir[x] = pt++;
//     pt->x = y; pt->y = x; pt->c = c; pt->n = fir[y]; fir[y] = pt++;
// }
// #define travel(x) for(edge *p=fir[x]; p; p=p->n)

// #define Q 1000000007

// inline int pow(int x, int t) {
//     int g = 1;
//     while (t) {
//         if (t&1) g = 1LL*g*x%Q;
//         x = 1LL*x*x%Q;
//         t >>= 1;
//     }
//     return g;
// }

struct node{int x,y,id;} p[maxn];
bool cmp(node a, node b) {return a.x<b.x || (a.x==b.x && a.y<b.y);}
int ans[maxn];

int main() {
    int n = read();
    rep(i, 1, n) p[i].x=read(), p[i].y=read(), p[i].id=i;
    sort(p+1, p+1+n, cmp);
    int pre=0, mx=0;
    rep(i, 1, n) {
        mx=max(mx, n+1-p[i].y);
        if (i==mx) {
            int tmp=i-pre;
            while (pre<i) ans[p[++pre].id]=tmp;
        }
    }
    rep(i, 1, n) printf("%d\n", ans[i]);
    return 0;
}

Measured memory_bytes: 6824
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		
		if(a < b && b < c && a < c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}

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

using namespace std;
 
long long X, Y, Z, K, A[1001], B[1001], C[1001];

vector<long long>vec;
 
int main() {
	cin >> X >> Y >> Z >> K;
	for (int i = 0; i < X; i++) cin >> A[i]; sort(A, A + X, greater<long long>());
	for (int i = 0; i < Y; i++) cin >> B[i]; sort(B, B + Y, greater<long long>());
	for (int i = 0; i < Z; i++) cin >> C[i]; sort(C, C + Z, greater<long long>());
	
	for (int i = 0; i < X; i++) {
		for (int j = 0; j < Y; j++) {
			for (int k = 0; k < Z; k++) {
				if ((i + 1) * (j + 1) * (k + 1) <= K) vec.push_back(A[i] + B[j] + C[k]);
				else break;
			}
		}
	}
  
	sort(vec.begin(), vec.end(), greater<long long>());
	for (int i = 0; i < K; i++) cout << vec[i] << endl;
  
	return 0;
}

Measured memory_bytes: 1400
#include <stdio.h>
int main(void) {
	int cnt = 0;
	char t1[3], t2[3];
	scanf("%s", t1);
	scanf("%s", t2);
	for (int i = 0; i < 3; i++) {
		if (t1[i] == t2[i]) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,x[100050],a[100050],p[100050],s[100050],cnt,k;
int be[100050],num[100050];
bool vis[100050]={0};
vector<int>q[100050];
void dfs(int x,int dep){
	num[x]=dep,vis[x]=1,be[x]=cnt;
	q[cnt].push_back(x);
	if(!vis[p[x]]) dfs(p[x],dep+1);
}
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%lld",&x[i]);
	}
	for(int i=1;i<n;i++){
		s[i]=x[i+1]-x[i];
	}
	cin>>m>>k;
	for(int i=1;i<n;i++) p[i]=i;
	for(int i=1;i<=m;i++){
		scanf("%lld",&a[i]);
		swap(p[a[i]],p[a[i]-1]);
	}
	for(int i=1;i<n;i++){
		if(!vis[i]){
			cnt++;
			dfs(i,0);
		}
	}
	cout<<x[1]<<endl;
	int now=x[1];
	for(int i=1;i<n;i++){
		now+=s[q[be[i]][(num[i]+k)%q[be[i]].size()]];
		cout<<now<<endl;
	}
	return 0;
}

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

int main(){
	int A, B, C, X, Y;
	cin>>A>>B>>C>>X>>Y;

	int res = X * A + Y * B;
	for(int i = 1; i <= max(X, Y); i ++){
		res = min(res, max((X - i), 0) * A + max((Y - i), 0) * B + 2 * i * C);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
    }

    let ans = std::cmp::min(b / a, c);

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>

int main(void) {
	long long int n, k,a,b;

	scanf("%lld %lld", &n, &k);

	a = n % k;
	b = a - k;

	if (b < 0) {
		b *= -1;
	}

	if (a > b) {
		printf("%lld", b);
	}
	else {
		printf("%lld", a);
	}
}

Measured memory_bytes: 1732
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long A = sc.nextInt();
		long B = sc.nextInt();
		int[] p = new int[N + 1];
		p[N] = N;
		for (int i = 0; i < N; i++) {
			p[i] = sc.nextInt() - 1;
		}
		int[] lessToLeft = new int[N + 1];
		for (int i = 0; i < N + 1; i++) {
			for (int j = i + 1; j < N + 1; j++) {
				if (p[i] < p[j]) lessToLeft[j]++;
			}
		}
		long[] tabla = new long[N + 1];
		for (int i = 0; i <= N; i++) {
			int total = p[i];
			int fromLeft = lessToLeft[i];
			tabla[i] = fromLeft * A + (total - fromLeft) * B;
			int less = 0;
			for (int j = i; j >= 0; j--) if (p[j] < p[i]) {
				total = p[i] - p[j] - 1;
				fromLeft = lessToLeft[i] - lessToLeft[j] - 1 - less;
				tabla[i] = Math.min(tabla[i], tabla[j] + fromLeft * A + (total - fromLeft) * B);
				less++;
			}
		}
		
		out.println(tabla[N]);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 24276
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

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

int main(){
  ll n,k,s;
  cin >> n >> k >> s;
  ll a[n];
  if(s != 1000000000){
    for(int i=0;i<n;i++){
      if(i < k) a[i] = s;
      else a[i] = 1000000000;
    }
  }
  else{
    for(int i=0;i<n;i++){
      if(i < k) a[i] = s;
      else a[i] = 1;
    }
  }
  for(int i=0;i<n;i++){
    cout << a[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
int main ()
{
    int height[1000];
    int i, j, a, n;
    n=10;
    for (i=0; i<n; ++i)
    scanf("%d", &height[i]);
    for (i = 0; i < n; ++i)
    {
        for (j = i + 1; j < n; ++j)
        {
            if (height[i] < height[j])
            {
                a = height[i];

                height[i] = height[j];

                height[j] = a;
            }
        }
    }
    for (i = 0; i < 3; ++i)
    {
        printf("%d\n", height[i]);
    }
    return 0;
}

Measured memory_bytes: 604
/*
ID: Barry Wang
LANG: C++11
TASK: 
*/
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
#define X first
#define Y second
#define Chtolly return 0
/*---define types---*/
typedef long long ll;
typedef list<int> li;
typedef queue<int> qi;
typedef deque<int> dqi;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef unsigned int uint;
/*---define variables---*/
const int inf=(1<<29);
int n;
int a[200005];
/*---define function---*/

/*---main code---*/
int main(){
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=1;i<n;++i){
		if(a[i]==a[i-1]){
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, q, k;
	cin >>n;
	VL a(n);
	rep(i, n) cin >> a[i];

	map<ll, int> mp;
	rep(i, n) mp[a[i]]++;

	ll cnd1 = 0, cnd2 = 0;
	for(auto z: mp){
		if(z.second < 2) continue;
		if(z.first > cnd1){
			if(z.second>3) cnd1=cnd2=z.first;
			else{
				cnd2 = cnd1;
				cnd1 = z.first;
			}
		}else if(z.first > cnd2){
			cnd2 = z.first;
		}
	}
	cout << cnd1 * cnd2 <<"\n";
	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++) cin >> a[i];
    ll mon = 1000;
    ll cnt = 0;
    bool first = false;
    for(ll i = 0; i < n-1; i++){
        //cout << mon << endl;
        if(a[i] >= a[i+1] && first){//売る
            mon += cnt*a[i];
            cnt = 0;
            first = false;
        } 
        else if(a[i] >= a[i+1]) continue;
        else if(a[i] < a[i+1] && !first){//買う
            first = true;
            cnt = mon/a[i];
            mon -= cnt*a[i];
        }
    }
    if(cnt > 0){
        mon += cnt*a[n-1];
    }
    cout << mon << endl;
    return 0;
}

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

int main()
{
	char A[4];
	int B[4],a,b;
	cin>>A;
	for(int i=0;i<4;i++)
		B[i]=A[i]-48;
	a=B[0]*10+B[1];
	b=B[2]*10+B[3];
	if(a>=1 && a<=12)
	{
		if(b>=1 && b<=12)
			cout<<"AMBIGUOUS\n";
		else
			cout<<"MMYY\n";
	}
	else
	{
		if(b>=1 && b<=12)
			cout<<"YYMM\n";
		else
			cout<<"NA\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;


int main(void){
  int X;
  cin >> X;
  if(X == 3 || X == 5 || X == 7){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class program
{
    static public int mod = 1000000007;
    static void Main()
    {
        var s = rstr();
        if (s[2] == s[3] && s[4] == s[5]) Write("Yes");
        else Write("No");
    }

    static int pow(int a, int b) { string binary = Convert.ToString(b, 2); int bileng = binary.Length; long a_power = a; long value = 1; for (int i = bileng - 1; i >= 0; i--) { if (binary[i] == '1') { value = value * a_power % mod; } a_power = a_power * a_power % mod; } return (int)value; }
    static string rstr() { return ReadLine(); }
    static int rint() { return int.Parse(ReadLine()); }
    static long rlong() { return long.Parse(ReadLine()); }
    static string[] stra() { return ReadLine().Split(' '); }
    static char[] chara() { string[] a = stra(); string b = ""; for (int i = 0; i < a.Length; i++) { b += a[i]; } return b.ToCharArray(); }
    static int[] inta() { string[] read_str_array = ReadLine().Split(' '); int[] return_int_array = new int[read_str_array.Length]; for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_int_array[countup_i] = int.Parse(read_str_array[countup_i]); } return return_int_array; }
    static long[] longa() { string[] read_str_array = ReadLine().Split(' '); long[] return_long_array = new long[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_long_array[countup_i] = long.Parse(read_str_array[countup_i]); } return return_long_array; }
    static double[] doublea() { string[] read_str_array = ReadLine().Split(' '); double[] return_double_array = new double[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_double_array[countup_i] = double.Parse(read_str_array[countup_i]); } return return_double_array; }
    static long GCD(long a, long b) { if (a < b) { long temp = a; a = b; b = temp; } if (a % b == 0) { return b; } else { long temp = b; b = a % b; a = temp; return GCD(a, b); } }
    static long LCM(long a, long b) { return a * b / GCD(a, b); }
    static void WriteArray2(int[,] a, int b, int c) { for (int i = 0; i < b; i++) { for (int j = 0; j < c; j++) { if (j != 0) Write(" "); Write(a[i, j]); } WriteLine(); } }
    static void WriteArray(int[] a, int b) { for (int i = 0; i < b; i++) { Write(" "); Write(a[i]); } WriteLine(); }
}


Measured memory_bytes: 25716
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

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

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
}
void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("story.in", "r", stdin);*/
#endif
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 2e3 + 15;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };

int n, x, y;
vector<int> gr[nn];
map<int, int> cntShortest;
void BFS(int u)
{
	queue<ii> qq;
	qq.push(mk(u, 0));
	int dis[nn];
	memset(dis, -1, sizeof dis);
	dis[u] = 0;
	while (!qq.empty())
	{
		int cur = qq.front().first;
		int dep = qq.front().second;
		qq.pop();
		for (auto it : gr[cur])
		{
			if (dis[it] == -1)
			{
				dis[it] = dep + 1;
				qq.push(mk(it, dep + 1));
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		if (i == u)
			continue;
		cntShortest[dis[i]]++;
	}
}
int main()
{
	fast();
	//File();
	cin >> n >> x >> y;
	for (int i = 1; i < n; i++)
	{
		gr[i].push_back(i + 1);
		gr[i + 1].push_back(i);
	}
	gr[x].push_back(y);
	gr[y].push_back(x);
	for (int i = 1; i <= n; i++)
		BFS(i);
	for (int i = 1; i < n; i++)
		cout << cntShortest[i] / 2 << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
#define FORR(i,n,m) for(ll i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K

int main(){
    ll a,b,x;
    cin >> a >> b >> x;
    if(a<=x&&a+b>=x){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int str = sc.nextInt();

        if(str <= 111){
            System.out.println("111");
        }else if(str <= 222){
            System.out.println("222");
        }else if(str <= 333){
            System.out.println("333");
        }else if(str <= 444){
            System.out.println("444");
        }else if(str <= 555){
            System.out.println("555");
        }else if(str <= 666){
            System.out.println("666");
        }else if(str <= 777){
            System.out.println("777");
        }else if(str <= 888){
            System.out.println("888");
        }else {
            System.out.println("999");
        }
        
    }
}

Measured memory_bytes: 22608
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll n;
  cin>>n;
  ll ans = -1;
  rep(i,1,100000){
    ll a = i;
    a *= 108;
    a /= 100;
    if(a==n){
      ans = i;
    }
  }
  if(ans==-1){
    cout << ":(" << endl;
  }
  else{
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
ls = map(int, input().split())
a = []
b = 0
for i in ls:
    if i % 2 == 0:
        a.append(i)
    else:
        continue
for j in a:
    if (j % 3 == 0) or (j % 5 == 0):
        b += 1
    else:
        continue
if b == len(a):
    print('APPROVED')
else:
    print('DENIED')
         


Measured memory_bytes: 3060