akhauriyash/Code-Regression huggingface dataset:
package main

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

var scanner = bufio.NewScanner(os.Stdin)


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

func swap(ints []int, b int, e int) []int {
	l := e-b
	for i := 0; i < l/2; i++ {
		ints[b+i], ints[e-1-i] = ints[e-1-i], ints[b+i]
	}
	return ints
}

func main() {
	scanner.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt()
	}
	q := nextInt()
	for i := 0; i < q; i++ {
		b := nextInt()
		e := nextInt()
		a = swap(a, b, e)
	}
	for i := range a {
		if i == len(a)-1 {
			fmt.Println(a[i])
		} else {
			fmt.Printf("%d ", a[i])
		}
	}
}


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

int main() {
    int W, H;
    char ch;
    cin >> W >> H >> ch;
    
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if ((i == 0) || (i == (H - 1))) {
                if ((j == 0) || (j == (W - 1))) {
                    cout << '+';
                } else {
                    cout << '-';
                }
            } else {
                if ((j == 0) || (j == (W - 1))) {
                    cout << '|';
                } else {
                    if ((i == (H / 2)) && (j == (W / 2))) {
                        cout << ch;
                    } else {
                        cout << '.';
                    }
                }
            }
            if (j == (W - 1)) cout << endl;
        }
        //if (i == (H - 1)) cout << endl;
    }
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

template<typename T>
bool CompareBySecond(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

void solve() {
  string s; cin >> s;
  int tmp = 0;
  int sz = s.size();
  rep(i,sz) {
    if (i%2 ^ s[i]-'0') ++tmp;
  }
  cout << min(tmp, sz-tmp) << endl;
}

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


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	cout<<n*(n+1)/2<<endl;
}
 
 







Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    c = input()
    if c in "aeiou":
        print("vowel")
    else:
        print("consonant")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#include <cstdio>

using namespace std;

int main()
{
	int sum=0,count=0,line=0;
	for(int a,b;scanf("%d,%d",&a,&b)==2;sum+=a*b,count+=b,line++)
		;
	printf("%d\n%d\n",sum,int((double)count/line+0.5+1e-10));
	
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoders {
	class Program {
		static void Main(string[] args) {
			
          
			var inputArray = retreiveStringArray();

			var inputStr = inputArray[0];
			var ans = string.Empty;
			foreach (var ch in inputStr) {
				ans += 'x';
			}

			//答えの出力
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}



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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef pair<int, int> P;

void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

void preorder(vector<P> &tos, int from, vector<int> &ans) {
    if (from == -1) {
        return;
    }
    ans.push_back(from);
    preorder(tos, tos[from].first, ans);
    preorder(tos, tos[from].second, ans);

}

void inorder(vector<P> &tos, int from, vector<int> &ans) {
    if (from == -1) {
        return;
    }
    inorder(tos, tos[from].first, ans);
    ans.push_back(from);
    inorder(tos, tos[from].second, ans);

}

void postorder(vector<P> &tos, int from, vector<int> &ans) {
    if (from == -1) {
        return;
    }
    postorder(tos, tos[from].first, ans);
    postorder(tos, tos[from].second, ans);
    ans.push_back(from);
}

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

    vector<P> tos(n);

    rep(i, n) {
        int j;
        cin >> j;
        assert(j < n);
        cin >> tos[j].first >> tos[j].second;
    }


    set<int> s;
    rep(i, n) s.insert(i);
    rep(i, n) {
        s.erase(tos[i].first);
        s.erase(tos[i].second);
    }
    int root = *s.begin();


    vector<int> a1;
    vector<int> a2;
    vector<int> a3;

    cout << "Preorder" << endl << ' ';
    preorder(tos, root, a1);
    print_line(a1);

    cout << "Inorder" << endl << ' ';
    inorder(tos, root, a2);
    print_line(a2);

    cout << "Postorder" << endl << ' ';
    postorder(tos, root, a3);
    print_line(a3);

}




Measured memory_bytes: 3168
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;

void printarray(int a[], int n){
	for (int i=0; i<n; i++){
		if (i==n-1){
			cout << a[i] << endl;
		}
		else{
			cout << a[i] << ' ';
		}
	}

}

void insertionsort(int a[], int n){
	for (int i=0; i<n; i++){
		int v = a[i];
		int j = i-1;
		while (j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		printarray(a,n);
	}
}

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

bool prime(int n){
	if (n==2){
		return true;
	}
	else{
		int lim;
		lim = int(pow(n,0.5))+1;
		for (int i=2; i<lim; i++){
			if (n % i == 0){
				return false;
			}
		}
		return true;
	}
}


int main(){
	int n;
	int cnt = 0;
	cin >> n;
	for (int i=0; i<n; i++){
		int m;
		cin >> m;
		if (prime(m)){
			cnt++;
		}

	}
	cout << cnt << endl;


	return 0;
}



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

int power(int x, int k) {
	int res = 1;
	rep(i, k) res *= x;
	return res;
}

int main() {
	int n, A, B, C;
	cin >> n >> A >> B >> C;
	vector<int> l(n);
	rep (i, n) cin >> l[i];
	int ans = 1001001001;
	int mx = power(3, n);
	for(int bit = 1; bit < mx; bit++) {
		vector<int> a, b, c;
		int tmp = bit;
		rep(i, n) {
			if(tmp%3 == 0) {
				a.push_back(l[i]);
			} else if(tmp%3 == 1) {
				b.push_back(l[i]);
			} else {
				c.push_back(l[i]);
			}
			tmp /= 3;
		}
		int na = a.size();
		int nb = b.size();
		int nc = c.size();
		if(na == 0 || nb == 0 || nc == 0) continue;
		// printf("%d %d %d\n", na, nb, nc);
		// rep(i, na) cout << a[i] << ((i == na-1) ? '\n': ' ');
		// rep(i, nb) cout << b[i] << ((i == nb-1) ? '\n': ' ');
		// rep(i, nc) cout << c[i] << ((i == nc-1) ? '\n': ' ');
		// cout << endl;
		int al = 1001001001;
		for(int bit2 = 1; bit2 < (1 << na); bit2++) {
			int nowl = 0;
			int cnt = 0;
			rep(i, na) {
				if((bit2 >> i) & 1) {
					nowl += a[i];
					cnt++;
				}
			}
			int nowmp = abs(A - nowl);
			nowmp += (cnt-1) * 10;
			al = min(al, nowmp);
		}
		int bl = 1001001001;
		for(int bit2 = 1; bit2 < (1 << nb); bit2++) {
			int nowl = 0;
			int cnt = 0;
			rep(i, nb) {
				if((bit2 >> i) & 1) {
					nowl += b[i];
					cnt++;
				}
			}
			int nowmp = abs(B - nowl);
			nowmp += (cnt-1) * 10;
			bl = min(bl, nowmp);
		}
		int cl = 1001001001;
		for(int bit2 = 1; bit2 < (1 << nc); bit2++) {
			int nowl = 0;
			int cnt = 0;
			rep(i, nc) {
				if((bit2 >> i) & 1) {
					nowl += c[i];
					cnt++;
				}
			}
			int nowmp = abs(C - nowl);
			nowmp += (cnt-1) * 10;
			cl = min(cl, nowmp);
		}
		int now = al + bl + cl;
		ans = min(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie(0),cout.tie(0);
	int n;
	scanf("%d",&n);
	double p[n+1];
	for(int i=1;i<=n;i++)
		scanf("%lf",&p[i]);
	double dp[n+1][n+1];
	dp[0][0]=1.0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(!j){
				dp[i][j]=dp[i-1][j]*(1-p[i]);
				continue;
			}
			dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
		}
	}
	double ans=0.0;
	for(int i=(n+1)/2;i<=n;i++)
		ans+=dp[n][i];
	printf("%0.10lf",ans);
}

Measured memory_bytes: 69888
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
typedef long long int ll;
ll u(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll d(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int main(void){
  int n,ans=0;
  scanf("%d",&n);
  int a[n];
  FOR(n)scanf("%d",&a[i]);
  qsort(a,n,sizeof(int),u);
  FOR(n-2)for(int j=i+1;j<n-1;j++)for(int k=j+1;k<n;k++)if(a[i]+a[j]>a[k])ans++;
  PRN(ans);
  return 0;
}


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

signed main(){
  lint N; cin >> N;
  vector<lint> a(N), num(100010), num1(100010);
  for( lint i = 0; i < N; i++ ){
    cin >> a[i];
    if(i % 2 == 0) num[a[i]]++;
    else num1[a[i]]++;
  }
  lint p = max_element(num.begin(), num.end()) - num.begin();
  lint q = max_element(num1.begin(), num1.end()) - num1.begin();
  lint ans;
  if( p != q ){
    ans = N - num[p] - num1[q];
  }
  if( p == q ){
    sort(num.begin(), num.end(), greater<lint>());
    sort(num1.begin(), num1.end(), greater<lint>());
    ans = min(N - num[0] - num1[1], N - num1[0] - num[1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 2688
#if 0
#endif

#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string, int> table;
int main()
{
    string /*入力用*/ word, /*最大頻度*/ frequent, /*最長*/ longest;
    size_t N = 0; /*文字列frequentの頻度*/
    while (cin >> word)
    {
        // table[word]を一つ増やす
        table[word] += 1;
        // table[word]がNより大きければ，Nとfrequentを更新
        if (table[word] > N)
        {
            N = table[word];
            frequent = word;
        }
        // word.size() > longest.size() ならlongest を更新
        if (word.size() > longest.size())
        {
            longest = word;
        }
    }
    //frequent と longest を出力
    cout << frequent << ' ' << longest << endl;
}



Measured memory_bytes: 3156
//
// Created by moono on 2018/10/27.
//

#include <iostream>
#include <string>
using namespace std;


int main(){
    int N, T;
    cin >> N >> T;


    int min_c = 20000, c, t;
    for (int i = 0; i < N; ++i) {
        cin >> c >> t;
//        cout << c << " " << t << " " << T <<  " " << min_c << endl;

        if(t <= T && c < min_c){
            min_c = c;
        }
    }

    if(min_c == 20000){
        cout << "TLE" << endl;

    }else{
        cout << min_c << endl;
    }


    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int N;
  cin >> N;
  int t, x, y;
  int tp = 0, xp = 0, yp = 0;
  bool ok = true;
  for(int i=0; i<N; i++){
    cin >> t >> x >> y;
    if(ok){
      int d = (t - tp) - (abs(x - xp) + abs(y - yp));
      if(!(d >= 0 && d % 2 == 0)){
        ok = false;
      } else {
        tp = t;
        xp = x;
        yp = y;
      }
    }
  }
  if(ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main(){
ll n,k;cin>>n>>k;
vector<ll> v(n);
for(ll i=0;i<n;i++)cin>>v[i];
sort(v.rbegin(),v.rend());
ll sum=0;
for(ll i=k;i<n;i++)sum+=v[i];
cout<<sum;

}

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

int main() {
  int a,number,s1,s2,s3;
  cin >> a;
  s1 = a/100;
  s2 = (a%100)/10;
  s3 = (a%100)%10;
  number = s1+s2+s3;
  cout << number << endl;
}


Measured memory_bytes: 256
import java.util.*;

// UVa 11504

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int a = in.nextInt();
		int b = in.nextInt();
		int h = in.nextInt();
		
		System.out.println((a + b) * h / 2);
	}
}

Measured memory_bytes: 22868
import itertools

n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k:
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    if l[i] + l[j] > l[k] and l[j]+l[k] > l[i] and l[k]+l[i]>l[j]:
                        cnt += 1
print(cnt)

Measured memory_bytes: 9132
#include <stdio.h>
#include <string.h>
void bubbleSort(char c[][3],int n){
    int flag=1,j,i;
    char tmp[3];
    for(i=0;flag;i++){
        flag=0;
        for(j=n-1;j>=i+1;j--){
            if(c[j][1]<c[j-1][1]){
                strcpy(tmp,c[j]);
                strcpy(c[j],c[j-1]);
                strcpy(c[j-1],tmp);
                flag=1;
            }
        }
    }
    for(j=0;j<n;j++){
        printf("%s%s",c[j],(j==n-1?"\n":" "));
    }
} 



void selectionSort(char c[][3],int n){
    int i,minj,j;
    char tmp[3];
    for(i=0;i<n;i++){
        minj=i;
        for(j=i;j<n;j++){
            if(c[j][1]<c[minj][1]){
                minj=j;
            }
        }
        strcpy(tmp,c[i]);
        strcpy(c[i],c[minj]);
        strcpy(c[minj],tmp);
    }
    for(j=0;j<n;j++){
        printf("%s%s",c[j],(j==n-1?"\n":" "));
    }
}

int main(void){
    char c[37][3];
    char c2[37][3];
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",c[i]);
        strcpy(c2[i],c[i]);
        //printf("%s%s",c[i],(i==n-1?"\n":" "));
    }
    bubbleSort(c,n);
    printf("Stable\n");
    selectionSort(c2,n);
    for(i=0;i<n;i++){
        if(c[i][0]!=c2[i][0]){
            printf("Not stable\n");
            return 0;
        }
    }
    
    printf("Stable\n");
    return 0;
}



Measured memory_bytes: 1964
#include <iostream>

using namespace std;

int main() {
    int N;
    int max_p = 0;
    int p;
    int sum = 0;

    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> p;
        if (p > max_p) {
            max_p = p;
        }
        sum += p;
    }
    cout << sum - max_p/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double eps=1e-9;
const ll MOD=1e9+7;
int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int ans=0;
    for(int i=1;i<=100;i++){
        bool f=true;
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=a[j];
            sum-=i;
            if(sum<0){
                f=false;
            }
        }
        if(f)ans=max(ans,i);
    }
    cout<<ans<<endl;
}



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

int main(){
    int n, k; cin >> n >> k;
    double ans; ans = 0;
    double tmp_ans;
    int tmp;
    for(int i=1; i<=n; i++){
        tmp_ans = 1/(double)n;
        tmp = i;
        while(tmp < k){
            tmp *= 2;
            tmp_ans /= 2;
        }
        ans += tmp_ans;
    }
    cout << setprecision(15) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int cnt = n / 2;
        if (n % 2 != 0) {
            cnt++;
        }

        double ans = (double) cnt / n;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23636
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    sort(a.rbegin(), a.rend());
    int tmp = -1;
    long long ans = 0;
    int i = 0;
    while(i < n - 1){
        if(a[i] == a[i+1]){
            if(tmp == -1){
                tmp = a[i];
            }
            else{
                ans = tmp * (long long)a[i];
                break;
            }
            i += 2;
        }
        else{
            ++ i;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int a[] = new int[M];
        int b[] = new int[M];
        int count[] = new int[N];
        for(int i = 0; i < M;i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        for(int i = 0; i < M;i++){
            count[a[i]-1]++;
            count[b[i]-1]++;
        }
        for(int i = 0; i < N;i++){
            System.out.println(count[i]);
        }
	}
}

Measured memory_bytes: 21972
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<utility>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;
using ll = long long;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

const long long MOD = 1e9+7;
const long long MAX = 3e5+1;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string S, T;
    in(S); in(T);
    bool flag=true;
    if (S.size()+1 != T.size()) flag = false;
    for (int i=0; i<S.size(); i++) {
        if (S[i] != T[i]) flag = false;
    }
    cout << ((flag)? "Yes": "No") << endl;



    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int w,q;
	while(cin>>w>>q,w||q){
		int space[w];
		rep(i,w)space[i]=-1;
		char in;
		int id,t;
		rep(i,q){
			cin>>in;
			if(in=='s'){
				cin>>id>>t;
				int cnt=0;
				bool check=true;
				rep(j,w){
					if(space[j]==-1)cnt++;
					else cnt=0;
					if(cnt==t){
						loop(k,j-cnt+1,j+1)space[k]=id;
						cout<<j-cnt+1<<endl;
						check=false;
						break;
					}
				}
				if(check)cout<<"impossible"<<endl;
			}else{
				cin>>id;
				rep(j,w)if(space[j]==id)space[j]=-1;
			}
		}
		cout<<"END"<<endl;
	}
}

Measured memory_bytes: 3060
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;
using llint = long long int;
int n;
vector<int> vx;
vector<int> vsorted;

int main()
{
  cin >> n;
  vx.reserve(n);
  vsorted.reserve(n);
  for (int i = 0; i < n; i++)
  {
    int x;
    cin >> x;
    vx.push_back(x);
    vsorted.push_back(x);
  }

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

  int a, b;
  a = vsorted[n / 2 - 1];
  b = vsorted[n / 2];

  for (int i = 0; i < n; i++)
  {
    if (vx[i] < b)
    {
      cout << b << endl;
    }
    else
    {
      cout << a << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
#include <stdio.h>

int main(void)
{
	int a[5];
	int i, j;

	for (i = 0; i < 5; i++){
		scanf("%d", &a[i]);
	}

	for (i = 0; i < 4; i++){
		for (j = i + 1; j < 5; j++){
			if (a[i] < a[j]){
				a[i] ^= a[j];
				a[j] ^= a[i];
				a[i] ^= a[j];
			}
		}
	}

	for (i = 0; i < 5; i++){
		if (i == 4){
			printf("%d\n", a[i]);
		}
		else {
			printf("%d ", a[i]);
		}
	}

	return (0);
}

Measured memory_bytes: 596
import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List (sortBy)

main :: IO ()
main = do
  [n, k] <- map read <$> words <$> getLine
  solve k <$> replicateM n (readi B.readInt <$> B.getLine) >>= print

solve :: Int -> [Int] -> Int
solve k xs = last xs + 1 - head xs - rt
  where rt = sum . take (k-1) . sortBy (flip compare) . (tail >>= zipWith (\a b -> a - b -1)) $ xs

readi :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> a
readi f s = let Just (n, _) = f s in n



Measured memory_bytes: 35980
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    int sum = ( n&1 ) ? n : n + 1;
    vector<pair<int, int>> ans;
    for ( int i = 1; i <= n; ++i ) {
        for ( int j = i + 1; j <= n; ++j ) {
            if ( i + j == sum ) continue;
                ans.emplace_back(i, j);
        }
    }
    cout << ans.size() << endl;
    for ( auto tmp_ans : ans ) {
        cout << tmp_ans.first << " " << tmp_ans.second << endl;
    }
    return 0;
}


Measured memory_bytes: 384
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	if err := io.writer.Flush(); err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	io := NewIo()
	defer io.Flush()
	N := io.NextInt()
	K := io.NextInt()
	P := make([]int, N)
	for i := 0; i < N; i++ {
		P[i] = io.NextInt()
	}
	sort.Ints(P)
	out := 0
	for i := 0; i < K; i++ {
		out += P[i]
	}
	io.PrintLn(out)
}


Measured memory_bytes: 1808
using System;

namespace ABC147_B_2
{
    class Program
    {
        static void Main(string[] args) {
            string input = Console.ReadLine();
            long ans = 0;

            int length = 0;
            if(input.Length % 2 != 0) {

            }

            for (int i = 0; i < input.Length / 2; i++) {
                string str1 = input.Substring(i, 1);
                string str2 = input.Substring(input.Length - i - 1, 1);
                if (str1 != str2) {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int stone[11][5];
int H;
int remove_impl(int a) {
    int res=0;
    bool f[5]={};
    rep(i,5) {
        int t = stone[a][i];
        int j=i+1;
        while(j!=5) {
            if(t!=stone[a][j]) break;
            j++;
        }
        if(j-i>=3) {
            res += (j-i)*t;
            for(int k=i;k<j;k++) stone[a][k]=0;
        }
    }
    return res;
}

void pack() {
    for(int i=H-2;i>=0;i--) {
        for(int j=4;j>=0;j--) {
            int pos=i;
            while(stone[pos+1][j]==0&&pos!=H-1) pos++;
            if(pos!=i) {
                stone[pos][j]=stone[i][j];
                stone[i][j]=0;
            }
        }
    }
}

int remove() {
    int res=0;
    rep(i,H) res+=remove_impl(i);
    pack();
    return res;
}
void plot() {
    cout<<endl;
    rep(i,H) {
        rep(j,5) cout<<stone[i][j]<<" ";
        cout<<endl;
    }
}

void solve() {
    rep(i,11) rep(j,5) stone[i][j]=0;
    rep(i,H) rep(j,5) cin>>stone[i][j];
    int ans=0;
    int t;
    while(1) {
        t=remove();
        if(t==0) break;
        // plot();
        ans+=t;
    }
    cout<<ans<<endl;

}

int main() {
    while(cin>>H) {
        if(H==0) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] T = new int[N];					
		for(int i = 0; i < N; i++) {
			T[i] = scan.nextInt();
		}		
		
		int M = scan.nextInt();
		int[] P = new int[M];
		int[] X = new int[M];	
		
		for(int i = 0; i < M; i++) {
			P[i] = scan.nextInt();
			X[i] = scan.nextInt();
		}
		
		for(int i = 0; i < M; i++) {
			int sum = 0;
			for(int j = 0; j < N; j++) {
				sum += T[j];
			}
			int num = T[P[i] - 1] - X[i];
			int ans = sum - num;
			System.out.println(ans);
		}
		
	}
}

Measured memory_bytes: 36252
#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>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define 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() {
	int n, i, j;
	cin >> n;
	vl a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll cnt = 0;
	ll out = n;
	bool flag = false;
	while (!flag) {
		for (i = 0; i < n; i++) {
			if (a[i] >= out) {
				ll k = (a[i] - out) / (n + 1) + 1;
				a[i] -= k * (n + 1);
				cnt += k;
				out -= k;
			}
		}
		flag = true;
		for (i = 0; i < n; i++) {
			if (a[i] >= out) {
				flag = false;
				break;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int V[50001];
int C[21];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++) cin>>C[i];
    for(int i=0;i<=50000;i++) V[i]=2000000000;
    V[0]=0;
    for(int i=1;i<=m;i++){
        for(int j=0;j+C[i]<=n;j++){
            V[j+C[i]]=min(V[j+C[i]],V[j]+1);
        }
    }
    cout<<V[n]<<endl;
    return 0;
}



Measured memory_bytes: 3312
import numpy as np
bingo=[]
for i in range(3):
    bingo.append(list(map(int,input().split())))
bingo=np.array(bingo)

n=int(input())
for i in range(n):
    a=int(input())
    bingo[bingo==a]=0

bin=False
for i in range(3):
    bin = bingo[i].sum()==0 or bin
    bin = bingo[:,i].sum()==0 or bin

bin = (bingo[0,0]+bingo[1,1]+bingo[2,2])==0 or bin
bin = (bingo[2,0]+bingo[1,1]+bingo[0,2])==0 or bin

if(bin):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 12504
using System;
using System.Linq;
using System.Collections.Generic;

class MyClass
{
    public static void Main(string[] args)
    {
        var L = int.Parse(Console.ReadLine());
        var A = int.Parse(Console.ReadLine());
        var B = int.Parse(Console.ReadLine());
        var C = int.Parse(Console.ReadLine());
        var D = int.Parse(Console.ReadLine());
        var study = Math.Max((A + C - 1) / C, (B + D - 1) / D);
        Console.WriteLine(L - study);
    }
}


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

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  char str[128], tmp[2];
  char cube[6][9] = { {"..rr...."},
		      {"..rr...."},
		      {"ggyybbww"},
		      {"ggyybbww"},
		      {"..oo...."},
		      {"..oo...."} };

  scanf("%s", str);
  rep(i, strlen(str)){
    switch(str[i]){
    case 'U':
      tmp[0] = cube[2][0]; tmp[1] = cube[2][1];
      REP(j, 2, 8) cube[2][j-2] = cube[2][j];
      cube[2][6] = tmp[0]; cube[2][7] = tmp[1];

      tmp[0] = cube[0][2]; cube[0][2] = cube[1][2]; cube[1][2] = cube[1][3];
      cube[1][3] = cube[0][3]; cube[0][3] = tmp[0];
      break;
    case 'F':
      tmp[0] = cube[2][1]; tmp[1] = cube[3][1];
      cube[2][1] = cube[4][2]; cube[3][1] = cube[4][3];
      cube[4][2] = cube[3][4]; cube[4][3] = cube[2][4];
      cube[3][4] = cube[1][3]; cube[2][4] = cube[1][2];
      cube[1][3] = tmp[0]; cube[1][2] = tmp[1];

      tmp[0] = cube[2][2]; cube[2][2] = cube[3][2];
      cube[3][2] = cube[3][3]; cube[3][3] = cube[2][3]; cube[2][3] = tmp[0];
      break;
    case 'R':
      tmp[0] = cube[0][3]; tmp[1] = cube[1][3];
      REP(j, 2, 6) cube[j-2][3] = cube[j][3];
      cube[4][3] = cube[3][6]; cube[5][3] = cube[2][6];
      cube[3][6] = tmp[0]; cube[2][6] = tmp[1];

      tmp[0] = cube[2][4]; cube[2][4] = cube[3][4]; cube[3][4] = cube[3][5];
      cube[3][5] = cube[2][5]; cube[2][5] = tmp[0];
      break;
    case 'D':
      tmp[0] = cube[3][6]; tmp[1] = cube[3][7];
      for(int j = 5; j >= 0; --j) cube[3][j+2] = cube[3][j];
      cube[3][0] = tmp[0]; cube[3][1] = tmp[1];

      tmp[0] = cube[4][2]; cube[4][2] = cube[5][2]; cube[5][2] = cube[5][3];
      cube[5][3] = cube[4][3]; cube[4][3] = tmp[0];
      break;
    case 'B':
      tmp[0] = cube[0][2]; tmp[1] = cube[0][3];
      cube[0][2] = cube[2][5]; cube[0][3] = cube[3][5];
      cube[2][5] = cube[5][3]; cube[3][5] = cube[5][2];
      cube[5][3] = cube[3][0]; cube[5][2] = cube[2][0];
      cube[3][0] = tmp[0]; cube[2][0] = tmp[1];

      tmp[0] = cube[2][6]; cube[2][6] = cube[3][6]; cube[3][6] = cube[3][7];
      cube[3][7] = cube[2][7]; cube[2][7] = tmp[0];
      break;
    case 'L':
      tmp[0] = cube[4][2]; tmp[1] = cube[5][2];
      for(int j = 3; j >= 0; j--) cube[j+2][2] = cube[j][2];
      cube[0][2] = cube[3][7]; cube[1][2] = cube[2][7];
      cube[3][7] = tmp[0]; cube[2][7] = tmp[1];

      tmp[0] = cube[2][0]; cube[2][0] = cube[3][0]; cube[3][0] = cube[3][1];
      cube[3][1] = cube[2][1]; cube[2][1] = tmp[0];
      break;
    }
  }

  rep(i, 6){
    rep(j, 8) printf("%c", cube[i][j]);
    puts("");
  }

  return 0;
}

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

int main() {
  int N; cin >> N;
  int A[N+1]; for (int i = 0; i <= N; i++) cin >> A[i];
  int B[N]; for (int i = 0; i < N; i++) cin >> B[i];
  long c = 0;
  for (int i = 0; i < N; i++) {
    c += min(B[i], A[i]+A[i+1]);
    if (A[i] < B[i]) A[i+1] = max(0, A[i] + A[i+1] - B[i]);
  }
  cout << c << endl;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int a, b, c, d;

int main(void)
{
	cin >> a >> b >> c >> d;
	if(a+b > c+d) cout << "Left" << endl;
	else if(a+b < c+d) cout << "Right" << endl;
	else cout  << "Balanced" <<endl;
	
	return 0;
}

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

int main()
{
  cin>>N;
  vector<string> s(N);
  for(int i=0; i<N; i++)  cin>>s[i];
  cin>>M;
  vector<string> t(M);
  for(int i=0; i<M; i++)  cin>>t[i];

  vector<int> countT(N, 0);
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      if(s[i]==t[j])  countT[i]--;
    }
  }

  vector<int> countS(N, 0);
  vector<string> tmp = s;
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(s[i]==tmp[j])  countS[i]++;
    }
  }

  vector<int> count(N, 0);
  int max_num = 0;
  for(int i=0; i<N; i++){
    count[i] = countS[i] + countT[i];
    if(count[i]>max_num)  max_num = count[i];
  }

  cout<<max_num<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
char s[1000005],t[1000005];
queue <int> Q;
int n;
bool check()
{
	for(int i=1;i<=n;i++)if(s[i]!=t[i])return 0;
	return 1;
}
int main()
{
	scanf("%d",&n);
	scanf("%s%s",s+1,t+1);
	if(check()){printf("0\n");return 0;}
	int head=1,tail=0;
	int posi=n;
	int ans=0;
	for(int i=n;i>=1;i--)
	{
		if(t[i]==t[i-1])continue;
		posi=min(posi,i);
		while(posi&&t[i]!=s[posi])posi--;
		if(!posi){printf("-1\n");return 0;}
		while(!Q.empty())
		{
			if((int)Q.front()-(int)Q.size()>=i)Q.pop();
			else break;
		}
		Q.push(posi);
		if(i!=posi)ans=max(ans,(int)Q.size());
	}
	printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
#define  p5         100005
#define  p6         1000007
#define  PI         acos(-1)
#define  M          1000000007
#define  sc         scanf
#define  ss         second
#define  ff         first
#define  pf         printf
#define  scin(x)    sc("%d",&x)
#define  scin2(x,y) sc("%d%d",&x,&y)
#define  READ(f)    freopen(f, "r", stdin)
#define  WRITE(f)   freopen(f, "w", stdout)
#define  ll         long long
#define  pp         pair < int, int>
#define  pq         priority_queue
#define  pb         push_back
#define OK          pf("Yes\n")
#define _OK         pf("No\n")
//int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
//int dx[5] = {1, -1, 0, 0 };
//int dy[5] = {0, 0, 1, -1};
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	ll n,i,j,k;
	cin>>n;
	k=sqrt(n);
	ll a,b;
	for(i=1;i<=k;i++){
        if(n%i==0){
            a=i;
            b=n/i;
        }
	}
	ll ans=a-1+b-1;
	cout<<ans<<endl;

	return 0;
}
//https://github.com/me-shaon/bangla-programming-resources


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        long A = sc.nextInt();
        long B = sc.nextInt();
        long C = sc.nextInt();
        long D = sc.nextInt();
        ans = Math.max(A*C,Math.max(A*D,Math.max(B*C,B*D)));//Math.max(,Math.max(,Math.max(,Math.max(,Math.max(,Math.max(,)))))))))
        System.out.println(ans);
    }

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


Measured memory_bytes: 35708
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


N, M = map(int, input().split())

Mlist = make_divisors(M)

ans = 0
for i in Mlist:
    if N * i <= M:
        ans = i
    else:
        break

print(ans)

Measured memory_bytes: 39536
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  int N, A; std::cin >> N >> A;
  std::cout << N*N-A << std::endl;
  return 0;
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            string[] data = Console.ReadLine().Split(' ');
            if (data[0] == "0" && data[1] == "0")
            {
                break;
            }
            int[] answer = new int[2];
            for(int i = 0;i<2;i++){
                answer[i] = int.Parse(data[i]);
            }
            Array.Sort(answer);
            Console.WriteLine("{0} {1}",answer[0],answer[1]);
        }
    }
}

Measured memory_bytes: 5916
var
  a:array[1..100]of int64;
  k,i,j,m,n:longint;
procedure qsort(l,r:longint);
var
  i,j,mid,p:longint;
begin
  i:=l;j:=r;
  mid:=a[(l+r) div 2];
  repeat
    while a[i]<mid do inc(i);
    while a[j]>mid do dec(j);
    if i<=j then
      begin
        p:=a[i];a[i]:=a[j];a[j]:=p;
        inc(i);
        dec(j);
      end;
  until i>j;
  if l<j then qsort(l,j);
  if i<r then qsort(i,r);
end;
begin
  readln(n,m);
  for i:=1 to n do read(a[i]);
  qsort(1,n);
  for i:=1 to n+1 do
  begin
	 if i=n+1 then break;
     if m>=a[i] then m:=m-a[i] else break;
	 inc(k);
  end;
  if (i=n+1)and(m>0) then dec(k);
  writeln(k);
end.

Measured memory_bytes: 128
import java.util.*;
public class Main {
    public static long mini(int a[],int n)
    {
       int dp[]=new int[n];
       dp[0]=0;
       dp[1]=Math.abs(a[1]-a[0]);
       for(int i=2;i<n;i++)
       {
           dp[i]=Math.min(Math.abs(a[i]-a[i-2])+dp[i-2],Math.abs(a[i]-a[i-1])+dp[i-1]);
       }
       return dp[n-1];
    }
    public static void main(String args[]) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=s.nextInt();
        }
        System.out.println(mini(a,n));
    }
}

Measured memory_bytes: 59652
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define N 40

vector<int> a, b, c;

void postOrder(vector<int>::iterator a1, vector<int>::iterator a2, vector<int>::iterator b1, vector<int>::iterator b2)
{
    //printf("%d %d %d %d\n", *a1, *(a2 - 1), *b1, *(b2 - 1));
    vector<int>::iterator itr;
    c.push_back(*a1);
    //printf("%d\n", *a1);
    itr = find(b1, b2, *a1); //itrator of root on inorder tree walk
    int d = itr - b1;
    if (a1 + d + 1 < a2 && itr + 1 < b2)
        postOrder(a1 + d + 1, a2, itr + 1, b2);
    if (a1 + 1 < a1 + d + 1 && b1 < itr)
        postOrder(a1 + 1, a1 + d + 1, b1, itr);
}

int main()
{
    int n, x;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        a.push_back(x);
    }
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        b.push_back(x);
    }

    postOrder(a.begin(), a.end(), b.begin(), b.end());

    for (int i = 0; i < c.size(); i++)
    {
        if (i != 0)
            cout << " ";
        cout << c[c.size() - 1 - i];
    }
    cout << "\n";

    return 0;
}


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

int main(void) {
  long long a;
  cin >> a;
  int x, y, z;
  scanf("%d.%d", &x, &y);
  z = y%10;
  y /= 10;
  
  long long ans = a*x;
  long long x1 = a*y*10 + a*z;
  x1 /= 100;
  ans += x1;
  
  cout << ans << endl;
  
  return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    int i,n;
    string a,b;
    cin>>n>>a>>b;
    rep0(i,n)
    {
        cout<<a[i]<<b[i];
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void){
  int h;
  int n;
  cin>>h;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    h-=a[i];
     }
  if(h<=0){cout<<"Yes"<<endl;}
 else{cout<<"No"<<endl;}
  return 0;
}


Measured memory_bytes: 640
N = int(input())
H = list(map(int, input().split()))


def search(start, end):
    sub_list = []

    index = start
    is_searching = False

    sub = 100
    l = start
    while index <= end:

        if H[index] > 0 and not is_searching: 
            is_searching = True
            l = index

        if H[index] == 0 and is_searching: 
            is_searching = False
            r = index - 1
            sub_list.append((l,r, sub))

        if is_searching:
            sub =  min(sub, H[index])

        index += 1
 
    if is_searching:
        sub_list.append((l, end, sub))


    count = 0
    for l, r, s in sub_list:
        for index in range(l, r + 1):
            H[index] -= s

        count += s
        count += search(l, r)

    return count


        
print(search(0, N -1))




Measured memory_bytes: 38768
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main  {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
		
		if (c>=a && c<=b)
			out.println("Yes");
		else
			out.println("No");
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.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());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 23380