akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <set>
#include <cstring>
#include <queue>
using namespace std;

const int N = 100007;
int p[N], grpsize[N];
int par(int x){ return p[x] == x ? x : (p[x] = par(p[x])); }
void merge(int a, int b){
    a = par(a);
    b = par(b);
    if(a == b) return;
    grpsize[b] += grpsize[a];
    grpsize[a] = 0;
    p[a] = b;
}

vector<int> fadj[N];
unordered_set<int> badj[N];

int main(){
    int n, m, k, a, b;
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++){
        p[i] = i;
        grpsize[i] = 1;
    }
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        a--; b--;
        fadj[a].push_back(b);
        fadj[b].push_back(a);
        merge(a, b);
    }
    for(int i = 0; i < k; i++){
        cin >> a >> b;
        a--; b--;
        badj[a].insert(b);
        badj[b].insert(a);
    }
    for(int i = 0; i < n; i++){
        int ans = grpsize[par(i)]-1;
        ans -= fadj[i].size();
        for(auto& j : badj[i]){
            if(par(j) == par(i)) ans--;
        }
        cout << ans << ' ';
    }
    cout << '\n';
}


Measured memory_bytes: 23672
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (4) << f << endl; Prints x.xxxx

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

ll inv[100003],mult[100003],invmult[100003];
ll gcd(ll a,ll b){
	while(b!=0){
		
		a=a%b;
		swap(a,b);
	}
	return a;
}

ll extend_gcd(ll a,ll b,ll &x,ll &y){
	if(b==0){
		x=1;
		y=0;
		return a;
	}
	ll x1,y1;
	ll ans =extend_gcd(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;

	return ans;
}
ll combination(ll n,ll r){
	if(r==0)
		return 1;
	if(n<r)
		return 0;
	ll ans=1;
	ans*=mult[n];
	ans%=mod;
	ans*=invmult[r];
	ans%=mod;
	ans*=invmult[n-r];
	ans%=mod;
	return ans;
}

ll initcombi(){
	int i;
	f(i,1,100001){
		ll x,y;
		ll val=extend_gcd(mod,i,x,y);
		if(y>0)
			inv[i]=y%mod;
		else{
				inv[i]=(y+mod)%mod;
		}
	}
	mult[0]=1;
	f(i,1,100001){
		mult[i]=mult[i-1]*i;
		mult[i]%=mod;
	}
	invmult[0]=1;
	f(i,1,100001){
		invmult[i]=invmult[i-1]*inv[i];
		invmult[i]%=mod;
	}
	return 0;
}


// do initcombi();
vi vec;
int a[123456],cou[123456];
int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int i;
	initcombi();
	rep(i,n+1){
		cin>>a[i];
		cou[a[i]]++;
		

	}
	rep(i,n+1){
		if(cou[a[i]]==2){
			vec.pb(i);
		}
	}
	ll ans=0;
	f(i,1,n+2){
		int k=i;
		ans=combination(n-1,i);
		ans+=2*combination(n-1,k-1);
		ans-=combination(n-vec[1]+vec[0],k-1);
		ans+=combination(n-1,k-2);
		ans%=mod;
		ans+=mod;
		ans%=mod;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 4352
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long h = long.Parse(input[0]);
		long w = long.Parse(input[1]);
		long answer = long.MaxValue;

    if(h % 3 == 0) answer = 0;
    else answer = Math.Min(answer, w);

    if(w % 3 == 0) answer = 0;
    else answer = Math.Min(answer, h);

    for(long i = 1; i < w; i++)
    {
      if(h % 2 == 0)
      {
        answer = Math.Min(answer, Math.Abs(h*i - (h/2)*(w-i)));
      }else
      {
        answer = Math.Min(answer, 
        Math.Max(Math.Abs(h*i - (h/2)*(w-i)), Math.Abs(h*i - (h/2+1)*(w-i))));
      }
    }

    for(long i = 1; i < h; i++)
    {
      if(w % 2 == 0)
      {
        answer = Math.Min(answer, Math.Abs(w*i - (w/2)*(h-i)));
      }else
      {
        answer = Math.Min(answer, 
        Math.Max(Math.Abs(w*i - (w/2)*(h-i)), Math.Abs(w*i - (w/2+1)*(h-i))));
      }
    }
    
		Console.WriteLine(answer);
	}
}


Measured memory_bytes: 11092
fun main(args:Array<String>):Unit {
    while(true){
        val (n, m) = (readLine() ?: return).trim().split(' ').map(String::toInt)
        val maximizeByVocal = Array(m + 1){0}
        val maximizeByDance = Array(m + 1){0}
        val maximizeByLooks = Array(m + 1){0}
        repeat(n){
            readLine()
            val (c, v, d, l) = readLine()!!.trim().split(' ').map(String::toInt)
            val by = Bydol(c, v, d, l)
            for (j in 0 .. (m - by.cost)){
                if (maximizeByVocal[j + by.cost] < maximizeByVocal[j] + by.vocal)
                    maximizeByVocal[j + by.cost] = maximizeByVocal[j] + by.vocal
                if (maximizeByDance[j + by.cost] < maximizeByDance[j] + by.dance)
                    maximizeByDance[j + by.cost] = maximizeByDance[j] + by.dance
                if (maximizeByLooks[j + by.cost] < maximizeByLooks[j] + by.looks)
                    maximizeByLooks[j + by.cost] = maximizeByLooks[j] + by.looks
            }
        }
        println(listOf(maximizeByVocal.max()!!, maximizeByDance.max()!!, maximizeByLooks.max()!!).max())
    }
}
data class Bydol(val cost:Int, val vocal:Int, val dance:Int, val looks:Int)


Measured memory_bytes: 87728
# include <cmath>
# include <iostream>
# include <queue>
# include <set>
# include <stack>
# include <string>
# include <vector>


using namespace std;


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

    if (n == m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 888
#include <iostream>
#include <map>
using namespace std;
using ll = long long int;

int main()
{
	int n;
	cin >> n;
	auto m = map<int, int>();
	ll ans = 0LL;
	for(int i = 0; i < n; ++i){
		int a;
		cin >> a;
		++m[a];
		ans += a;
	}
	int q;
	cin >> q;
	for(int i = 0; i < q; ++i){
		int b, c;
		cin >> b >> c;
		ans += ((c - b) * m[b]);
		m[c] += m[b];
		m[b] = 0;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7904
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<pair<char,ll>> a(q);
  for(int i = 0;i < q;i++){
    char dir;
    cin >> a[i].first >> dir;
    if(dir == 'L')a[i].second = -1;
    else a[i].second = 1;
  }
  ll res = 0;
  
  //左に到達するか
  ll l = -1;
  ll r = n;
  while(1){
    if(r - l <= 1)break;
    ll mid = (r + l) / 2;
    ll now = mid;
    bool left = false;
    for(int i = 0;i < q;i++){
      if(a[i].first == s[now])now += a[i].second;
      if(now >= n)break;
      if(now < 0){
        left = true;
        break;
      }
    }
    if(left)l = mid;
    else r = mid;
  }
  res += r;
  //cout << l << " " << r << endl;
  
  //右に到達するか
  l = -1;
  r = n;
  while(1){
    if(r - l <= 1)break;
    ll mid = (r + l) / 2;
    ll now = mid;
    bool right = false;
    for(int i = 0;i < q;i++){
      if(a[i].first == s[now])now += a[i].second;
      if(now < 0)break;
      if(now >= n){
        right = true;
        break;
      }
    }
    //cout << "right" << " " << mid << " " << right << endl;
    if(right)r = mid;
    else l = mid;
  }
  res += n - r;
  //cout << l << " " << r << endl;
  
  cout << n - res << endl;
}

Measured memory_bytes: 6828
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long b = 0;
        Map<Long, Long> set = new HashMap<>();
        while (true) {
            long tmp = (long) Math.pow(b , 5);
            set.put(tmp, b);
            if (set.containsKey(x + tmp)) {
                System.out.println(set.get(x+tmp) + " " + b);
                break;
            }

            tmp = (long) Math.pow(-b , 5);
            set.put(tmp, -b);
            if (set.containsKey(x + tmp)) {
                System.out.println(set.get(x+tmp)+" "+(-b));
                break;
            }

            b++;
        }
    }
}

Measured memory_bytes: 39076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
const int MAXN=1e5+10;
int n,h[MAXN],t[MAXN],ans=0;
int main()
{
	n=read();
	for(int i=1;i<=n;++i)
		h[i]=read();
	for(int i=n;i>=1;--i)
	{
		if(i==n)
			t[i]=0;
		else
			t[i]=(h[i]>=h[i+1])?t[i+1]+1:0;
		ans=max(ans,t[i]);
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        sum += ((i % 2 == 0) ? 1 : -1) * A[i];
    }
    vector<int> ans(N);
    ans[0] = sum;
    for(int i = 1; i < N; i++) {
        ans[i] = 2 * (A[i - 1] - ans[i - 1] / 2);
    }

    for (int i = 0; i < N; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9

typedef long long ll;

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+5;
int a[N];

int main()

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

    int n, b, c, d;

    cin >> n >> b >> c >> d;

    a[n]++, a[b]++, a[c]++, a[d]++;

    if (a[1] && a[9] && a[7] && a[4]) cout << "YES";
    else cout << "NO";

    return 0;
}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n; cin >> n;
  int a = n/4;
  int b = n/7;
  loop(i,0,a+1) {
    loop(j,0,b+1) {
      if (4*i+7*j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
#define int long long

signed main(){
    int N;
    cin >> N;
    
    int s[N];
    int sum = 0;
    for(int i=0;i<N;i++){
        cin >> s[i];
        sum += s[i];
    }
    
    sort(s,s+N);
    if(sum%10!=0){
        cout << sum << endl;
        return 0;
        
    }else{
        for(int i=0;i<N;i++){
            if(s[i]%10!=0){
                cout << sum-s[i] <<endl;
                return 0;
            }
        }
    }
    
    cout << 0 << endl;
    
    return 0;
}


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

int main(){

	int n,k;
	cin>>n;
	int ori = n;
	cin>>k;
	int a;

	int count = 0;

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

	if(n==k){
		count++;
	}
	else{
		n=n-k;
		count++;
		while(n>=k-1){
			n=n-k+1;
			count++;
		}
		if(n>0){
			count++;
		}
	}

	cout<<count<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    cin>>n>>k;
    ll ans=9e18;
    ll x[n],y[n],a[n+1][n+1],c[n],d[n];
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)a[i][j]=0;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        c[i]=x[i];
        d[i]=y[i];
    }
    sort(c,c+n);
    sort(d,d+n);
    map<ll,ll> e,f;
    for(int i=0;i<n;i++){
        e[c[i]]=i+1;
        f[d[i]]=i+1;
    }
    for(int i=0;i<n;i++)a[e[x[i]]][f[y[i]]]++;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)a[i][j]+=a[i][j-1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            a[i][j]+=a[i-1][j];
        }
    }
    ll maki,niko;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int z=0;z<i;z++){
                for(int m=0;m<j;m++){
                    if(a[i][j]-a[z][j]-a[i][m]+a[z][m]>=k){
                        maki=c[i-1]-c[z];
                        niko=d[j-1]-d[m];
                        ans=min(ans,maki*niko);
                    }
                }
            }
        }
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 256
var str = readLine()!
for num in 0...3 {
  let a = str.index(str.startIndex, offsetBy: num)
  let b = str.index(str.startIndex, offsetBy: num+1)
  
   if str [a]==str [b] {
    print("Bad")
     break
   }
  else if num==3 {
    print("Good")
  }
}
  


Measured memory_bytes: 7668
import sys
def query(i):
    print(i)
    sys.stdout.flush()
    s=input()
    if s=="Vacant":
        exit()
    return s=="Male"

def main():
    N=int(input())
    al=ar=query(0)
    l,r=0,N
    while True:
        m=(l+r)//2
        am=query(m)
        if al==am and (m-l)%2==1 or al!=am and (m-l)%2==0:
            r,ar=m,am
        else:
            l,al=m,am

if __name__ == "__main__":
    main()

Measured memory_bytes: 3660
import collections
N=int(input())

#指定された数の素数をリスト形式で表示する関数
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime_list=prime_factorize(N)
prime_dict=collections.Counter(prime_list)
ans=0

for k,v in prime_dict.items():
    cnt=1
    if v <= 2:
        ans += 1
    else:
        while (cnt <= v):
            v = v - cnt
            cnt += 1
            ans += 1

print(ans)

Measured memory_bytes: 9464
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,x,key=0;
    scanf("%d",&n);
    int a[210000];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    for(i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            printf("NO");
            break;
        }
    }
    if(i==n-1){
        printf("YES");
    }
    return 0;
}



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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, double> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &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);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

int main() {
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB") {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;

int main(){
    cin>>a>>b;
    for(int  i=0;i<a-1;i++){
        for(int u=0;u<31;u++){
            if(a==u)ans++;
        }
    }
    if(b>=a)ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 384
import itertools

N = int(input())
F = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]

ans = -10 ** 10
for f in itertools.product([0, 1], repeat=10):
    if f == (0,) * 10:
        continue
    p = 0
    for i in range(N):
        p += P[i][sum([F[i][j] * f[j] for j in range(10)])]
    ans = max(ans, p)

print(ans)


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

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

    int n;
    cin >> n;

    vector<double> prob(n+1);
    for(int i = 1; i <= n; i++) cin >> prob[i];
    vector<vector<double>> dp(n+1,vector<double>(n+1));
    dp[0][0] = 1;

    for(int i = 1; i <= n; i++){
        for(int j = 0 ; j <= i; j++){
            dp[i][j] += dp[i-1][j] * (1.0 - prob[i]);
            if(j - 1 >= 0) dp[i][j] += dp[i-1][j-1] * prob[i];
        }
    }
    double ans = 0.0;

    for(int i = 0; i <= n; i++){
        if(i >= (n+1)/2) ans += dp[n][i];
    }
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 70784
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int[] dist = new int[n];
        for(int i = 0; i < n; i++){
            if(i != n-1){
                dist[i] = a[i+1] - a[i];
            } else {
                dist[i] = a[0]+k - a[i];
            }
        }
        Arrays.sort(dist);
        System.out.print(k - dist[n-1]);
    }
}

Measured memory_bytes: 76432
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;

const int N = 1e5 + 5;
const int Mod = 1e9 + 7;


int n;
vector<int> g[N];
int dp[N][2];

int dfs(int u, int p, int col) {
  int& r  = dp[u][col];
  if(r != -1) return r;
  r = 1;
  for(int v : g[u]) {
    if(v != p) {
      if(col == 0) { // b
        r = (1LL * r * dfs(v, u, 1)) % Mod;
      } else { // w
        r = (1LL * r * (dfs(v, u, 0) + dfs(v, u, 1))) % Mod;
      }
    }
  }
  return r;
}

int main()
{
  cin >> n;
  for(int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].pb(y);
    g[y].pb(x);
  }
  memset(dp, -1, sizeof dp);
  cout << (dfs(0, -1, 1) + dfs(0, -1, 0)) % Mod << endl;
  return 0;
}


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

int main() {
  long long n;
  long long k;
  cin>>n>>k;
  long long x=n%k;
    if(x<0){
      x=x*-1;
    }
  long long y=n%k-k;
   if(y<0){
     y=y*-1;
   }
     
  if(x<=y){
    cout<<x<<endl;
  }
  else{
    cout<<y<<endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int ans[100000];
int a[100000], b[100000];
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)
	{
		int z;
		scanf("%d", &z);
		z--;
		ans[z] = i;
	}
	a[0] = b[0] = 500000000;
	for (int i = 1; i < num; i++)
	{
		if (ans[i] - ans[i - 1]>0)
		{
			a[i] = a[i - 1] + ans[i] - ans[i - 1] + 1;
			b[i] = b[i - 1] - 1;
		}
		else
		{
			a[i] = a[i - 1] + 1;
			b[i] = b[i - 1] + ans[i] - ans[i - 1] - 1;
		}
	}
	for (int i = 0; i < num; i++)printf("%d ", a[i]); printf("\n");
	for (int i = 0; i < num; i++)printf("%d ", b[i]); printf("\n");
}

Measured memory_bytes: 768
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] dishes = new int[5];
		int[] dishes_v = new int[5];
		int sum = 0;
		int minrestidx = 0, minrest = 10;
		for(int i = 0;i < 5;i ++) {
			int v = sc.nextInt();
			dishes[i] = v;
			int rest = v % 10;
			if(rest < minrest && rest != 0) {
				minrest = rest;
				minrestidx = i;
			}
			if(rest != 0) v = v + (10 - rest);
			dishes_v[i] = v;
			sum += v;
		}
		sum = sum + dishes[minrestidx] - dishes_v[minrestidx];
		System.out.println(sum);
	}
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< int, i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dij geo2

signed main()
{
    int2(n, m);
    vvi data(n, vi(m));
    rep(i, n) {
        rep(j, m) {
            cin >> data[i][j];
        }
    }

    int l = 0, r = n+1;
    while (r - l > 1) {
        int targ = (l + r) / 2;
        //Rep(targ, n+1) {

        bool clear = false;
//        cout << "targ === " << targ << endl;
        vb used(m, true);
        while (1) {
            vb isOk(n, false);
            vi cnt(m, 0);

            rep(j, m) { // 優先順位
                rep(i, n) {
                    if (!isOk[i]) {
                        if (used[data[i][j]-1]) {
                            isOk[i] = true;
                            cnt[data[i][j]-1]++;
                        }
                    }
                }
            }
            bool state = true;
            rep(i, n) {
                if (!isOk[i]) {
                    state = false;
                    break;
                }
            }
            if (!state) {
                break;
            }

            /*
               std::cout << "====cnt====" << std::endl;
               rep(i, m) {
               std::cout << cnt[i] << " ";
               }cout << endl;
               std::cout << "===========" << std::endl;
               */

            int ptr = 0;
            Rep(i, m) {
                if (cnt[ptr] < cnt[i]) {
                    ptr = i;
                }
            }
            //cout << "ptr" << ptr << endl;
            if (cnt[ptr] > targ) {
                used[ptr] = false;
            } else {
                clear = true;
                break;
            }
        }

        if (clear) {
            r = targ;
            //cout << targ << endl;
            //return 0;
        } else {
            l = targ;
        }
    }
    cout << r << endl;


    return 0;
    }


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

int main() {
  int n, i;
  cin >> n;
  
  vector<long long> l(100);
  l.at(0) = 2;
  l.at(1) = 1;
  for(i = 2; i <= n; i++){
    l.at(i) = l.at(i - 1) + l.at(i - 2);
  }
  
  cout << l.at(n) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void CodeFes2016qC_B();

#if 1
int main()
{
	CodeFes2016qC_B();
	fflush(stdout);
	return 0;
}
#endif

static void CodeFes2016qC_B()
{
	int K, T;
	getint(K, T);
	
	std::vector<int> an(T, 0);
	for (int i = 0; i < T; i++) {
		getint(an[i]);
	}

	std::sort(an.begin(), an.end());

	int others = 0;
	for (int i = 0; i < T - 1; i++) {
		others += an[i];
	}
	printf("%d\n", std::max(0, an[T - 1] - others - 1));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        string s;
        int a[26] = {};
        in >> s;
        for (auto c : s) {
            a[c - 'a']++;
        }
        bool ok = true;
        for (int i = 0; i < 26; i++) {
            ok &= a[i] % 2 == 0;
        }
        out << (ok ? "Yes" : "No") << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


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

#define ll long long

const int maxn = 1e5+50;

int a[maxn];
int u[maxn];
int rk[maxn];

int get_u(int x)
{
    if (x == u[x]) return x;
    return get_u(u[x]);
}

void unite(int x, int y)
{
    int a = get_u(x), b = get_u(y);
    if (rk[a] < rk[b]) 
        u[a] = b;
    else
    {
        u[b] = a;
        if (rk[a] == rk[b]) rk[a] ++;
    }
}

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i) 
    {
        u[i] = i;
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < m; ++i)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        int fx = get_u(x), fy = get_u(y);
        if (fx != fy) unite(fx, fy);
    }  
    int ans = 0;
    for (int i = 1; i <= n; ++i)
    {
        int x = get_u(i), y = get_u(a[i]);
        if (x == y) ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1408
_, x = tuple(int(x) for x in input().split())
a_lst = [int(a) for a in input().split()]

cnt = 0

for i in range(0, len(a_lst) - 1):
    if a_lst[i] > x:
        d = a_lst[i] - x
        cnt += d
        a_lst[i] -= d

    if a_lst[i] + a_lst[i + 1] > x:
        d = a_lst[i] + a_lst[i + 1] - x
        cnt += d
        a_lst[i + 1] -= d

print(cnt)

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

using namespace std;

int main()
{
	int x;
	cin >> x;
	int pp = 1;
	for (int i = 2; i <= (int)sqrt(x); i++)
	{
		int power = (int)(log2(x)/log2(i));
		pp = max(pp, (int)pow(i, power));
	}
	cout << pp << endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

bool row[6];
bool col[6];
int H, W, K;

ll judge(vector<vector<char>> &vec){
    ll cnt = 0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(row[i]==true && col[j]==true && vec[i][j]=='#'){
                cnt++;
            }
        }
    }
    if(cnt==K){
        return 1;
    }else{
        return 0;
    }
}

ll full_search(int h, int w, vector<vector<char>> &vec){
    ll ret=0;
    if(h==H){
        if(w==W){
            return judge(vec);
        }else{
            col[w]=true;
            ret+=full_search(h,w+1,vec);
            col[w]=false;
            ret+=full_search(h,w+1,vec);
        }
    }else{
        row[h]=true;
        ret+=full_search(h+1,w,vec);
        row[h]=false;
        ret+=full_search(h+1,w,vec);
    }
    return ret;
}

int main(){
    
    cin >> H >> W >> K;

    vector<vector<char>> vec(H,vector<char>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> vec[i][j];
        }
    }

    cout << full_search(0,0,vec) << endl;
}

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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 

    int N, W;
    cin >> N >> W;
    vector<pair<int, int>> items;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        items.push_back({a, b});
    }

    // first is weight, second is value
    ll dp[N+1][W+1];
    memset(dp, 0, sizeof(dp));
    // dp[i][w] -> max value reaching the index i
    // with weight w

    for (int i = 0; i < N; i++) {
        for (int w = 0; w <= W; w++) {
            int w2 = w + items[i].first;
            if (w2 <= W) 
                dp[i+1][w2] = max(dp[i+1][w2], dp[i][w] + items[i].second);
            dp[i+1][w] = max(dp[i+1][w], dp[i][w]);
        }
    }

    ll ans = 0;
    for (int w = 0; w <= W; w++) 
        ans = max(ans, dp[N][w]);

    cout << ans << endl;

    return 0; 
}



Measured memory_bytes: 82480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll K, A, B; cin >> K >> A >> B;
	if (1 + A >= B)
		std::cout << K + 1 << std::endl;
	else
	{
		ll res{1};
		while (K)
		{
			if (res < A || K <= 1)
			{
				++res;
				--K;
			}
			else
			{
				res += B - A;
				K -= 2;
			}
		}
		std::cout << res << std::endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int bs(int l,int r, int ans);
vector<int> lot;
int n,x;
int main(){
  while(cin >>n,n){
    lot.clear();
    for(int i=0,a; i<n; i++){cin >>a;lot.push_back(a);}
    cin >>x;
    cout <<bs(0,n-1,0)<<endl;
  }
  return 0;
}
int bs(int l, int r, int ans){
  int mid = (l+r)/2;
  if(l>r) return ans;
  if(lot[mid] == x) return ans+1;
  if(lot[mid] > x) return bs(l,mid-1,ans+1);
  return bs(mid+1,r,ans+1);
}

Measured memory_bytes: 1216
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a=sc.nextInt()*sc.nextInt();
	int b=sc.nextInt()*sc.nextInt();
	System.out.println(Math.max(a,b));
	sc.close();
  }
}


Measured memory_bytes: 35604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <utility>
typedef long long lint;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define INF 1e18

signed main()
{
	int R,G,B,N,K;
	cin >> R>>G>>B>>N ;


int count = 0;
/*
	for (int r = 0; r <= R; r++) {
		for (int g = G; g >= 0; g--) {
			if (r + g > N) continue;
			else if (r + g + B < N) continue;
			else {
				count += (N - r - g - B);

			}
		}
	}
	*/
	for (int r = 0; r <= N; r++) {
		if (R * r > N) break;
		for (int g = 0; g <= N; g++) {
			if (G * g > N) break;
			/*
			for (int b = 0; b <= N; b++) {
				if (R * r > N) break;
				if (R * r + G * g + B * b == N) count++;
			}
			*/
		if (N >= (G*g + R*r) && (N - G*g - R*r) % B == 0) {
			count++;
		//	cout << "(" << r << "," << g << ")" << endl;
		}
	}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int ans=0;
  while(n>0){
    n/=k;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=205;
char s[N][N];int f[N][N][N],g[N][N][N],row[N][N],col[N][N];
int sa[N][N][N],sb[N][N][N],n,m;
inline int max(R int x,R int y){return x>y?x:y;}
inline int min(R int x,R int y){return x<y?x:y;}
void init(){
	fp(i,1,n)fd(j,m,1)
		row[i][j]=(s[i][j]==s[i][j+1]?row[i][j+1]:0)+1;
	fd(i,n,1)fp(j,1,m)
		col[i][j]=(s[i][j]==s[i+1][j]?col[i+1][j]:0)+1;
	fp(i,1,n)fp(j,1,m){
		f[i][j][j]=col[i][j];
		fp(k,j+1,m)f[i][j][k]=min(f[i][j][k-1],s[i][k-1]==s[i][k]?col[i][k]:0);
	}
	fp(i,1,m)fp(j,1,n){
		g[i][j][j]=row[j][i];
		fp(k,j+1,n)g[i][j][k]=min(g[i][j][k-1],s[k-1][i]==s[k][i]?row[k][i]:0);
	}
}
void solve(){
	fp(i,1,n)fp(j,1,m)fp(k,j,m){
		f[i][j][k]+=f[i+f[i][j][k]][j][k];
		if(f[i][j][k])cmax(sa[j][i][i+f[i][j][k]-1],k-j+1);
	}
	fp(i,1,m)fp(j,1,n)fp(k,j,n){
		g[i][j][k]+=g[i+g[i][j][k]][j][k];
		if(g[i][j][k])cmax(sb[j][i][i+g[i][j][k]-1],k-j+1);
	}
	fp(i,1,n)fp(j,1,m)fd(k,m,j)cmax(f[i][j][k],max(f[i][j][k+1],sb[i][j][k]));
	fp(i,1,m)fp(j,1,n)fd(k,n,j)cmax(g[i][j][k],max(g[i][j][k+1],sa[i][j][k]));
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	fp(i,1,n)scanf("%s",s[i]+1);
	init();
	R int res=0;
	while(f[1][1][m]<n)++res,solve();
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 129024
#include<iostream>
#include<string>
#include<set>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();++it)
#define FOREACH(t,p,tit) for(t::iterator tit=p.begin();tit!=p.end();++tit)

using namespace std;
string ss;
typedef set<int> pp;


pp solve(int f,int l)
{
    pp ans;
    bool ope=false;
    int bo=0;
    for(int i=f;i<l+1;i++)
    {
        if(ss[i]=='(') bo++;
        if(ss[i]==')') bo--;

        if((ss[i]=='+'||ss[i]=='-'||ss[i]=='*'||ss[i]=='/')&&(bo==0))
        {
            ope = true;
            pp ansl = solve(f,i-1);
            pp ansr = solve(i+1,l);
            FOREACH(pp,ansl,lit)FOREACH(pp,ansr,rit)
            {
                if(ss[i]=='+') ans.insert((*lit)+(*rit));
                if(ss[i]=='-') ans.insert((*lit)-(*rit));
                if(ss[i]=='*') ans.insert((*lit)*(*rit));
                if(ss[i]=='/') if((*rit)!=0)
                    ans.insert((*lit)/(*rit));
            }
        

        }

    }
    if(ope)return ans;
    if(ss[f]=='(')return solve(f+1,l-1);
    int p= atoi((ss.substr(f,l-f+1)).c_str());
    ans.insert(p);
    return ans;
}

int main()
{
    while(cin >> ss &&(ss!="#"))
    {
        pp tans = solve(0,ss.size());
        cout << tans.size() << endl;
        //foreach(pp,tans) cout << *it << endl;
        
    }
    return 0;
}

Measured memory_bytes: 0
#import<cstdio>
int main(){int a,c=3,r=1;for(char d[]="123546",s[9];a=scanf("%s",s),*s>60;r+=*d%8)*s%6-4?a=*s%5+*s%2*2+c&3,d[++a]=*d,*d=d[a=++a%4+1],d[a]=d[5],d[5]=55-*d:c+=*s+3;~-r&&printf("%d\n",r);~a&&main();}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long a[n];
  int i;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a,a+n);
  int j = 0;
  int b[n]={};
  b[0] = 1;
  for(i=1;i<n;i++){
    if(a[i] == a[i-1])b[j]++;
    else{
      j++;
      b[j]++;
    }
  }
  int cnt = 0;
  for(i=0;i<n;i++){
    if(b[i]%2==1)cnt++;
  }
  cout << cnt;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>

int main()
{
  int N, P;
  std::string S;
  std::cin >> N >> P >> S;
  std::vector<int> modP(P, 0);

  long long tmp, ans = 0, now = 0, dig10 = 1;
  if (P == 2 || P == 5)
  {
    for (int i = S.size()-1; i >= 0; i--)
    {
      now = S[i] - '0';
      if (now % P == 0) ans += i+1;
    }
  }
  else
  {
    for (int i = S.size()-1; i >= 0; i--)
    {
      tmp = (S[i] - '0') * dig10;
      now += tmp;
      now %= P;
      if (now == 0) ans++;
      ans += modP.at(now);
      modP.at(now)++;
      dig10 *= 10;
      dig10 %= P;
    }
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ff first
#define ss second
#define INF (int)2e9
#define pb push_back
#define PI 3.14159265
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<double,pii> pt;
const int SZ=105;
pii arr[SZ];
vector<pt> v;
int n;
ll dist(ll x, ll y){
	return x*x+y*y;
}
ll max(ll x, ll y){
	return x>y?x:y;
}
double mytheta(int x, int y){
	if(x==0) return y>0? PI/2:-PI/2;
	return x>0?atan((double)y/(double)x):atan((double)y/(double)x)+PI;
}
int main(void){
	ios::sync_with_stdio(false); cin.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++){
		int x,y; cin>>x>>y;
		arr[i]={x,y};
		v.pb({mytheta(x,y),{x,y}});
	}
	sort(v.begin(),v.end());
	long long ans=0;
	for(int i=0;i<n;i++){
		int x=0,y=0;
		for(int j=0;j<n;j++){
			x+=v[(i+j)%n].ss.ff;
			y+=v[(i+j)%n].ss.ss;
			ans=max(ans,dist(x,y));
		}
	}
	cout.precision(15);
	cout<<sqrtl((long double)ans);
	return 0;
}


Measured memory_bytes: 384
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let mut a = vec![vec![]; k];
    for i in 0..k {
        input! {
            d:usize,
            t:[u64;d],
        }
        a[i] = t;
    }

    //println!("{:?}", a);
    let mut dic = HashSet::new();
    for i in 0..k {
        for j in 0..a[i].len() {
            dic.insert(a[i][j]);
        }
    }
    println!("{}", n - dic.len());
}


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

int main(){
    vector<int> data(3);
    cin >> data.at(0) >> data.at(1) >>data.at(2);
    sort(data.begin(), data.end());//小さい順に並べる
    reverse(data.begin(), data.end());//リバース
    cout << data.at(0)*10+data.at(1)+data.at(2) << endl;
}

Measured memory_bytes: 3616
#include <math.h>
#include <assert.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <array>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define rep(i, a, b) for (int i=a; i<(b); i++)
#define forn(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define ford(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define int long long
#define ii pair<int,int>
#define ar array
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define sz(x) ((int)(x).size())
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;
//const int N = 3e5+7 ;
int a[4] ;
void solve(){
	forn(i,4) cin >> a[i] ;
	int ans = -INF ;
	forn(i,2){
		rep(j,2,4){
			ans = max(ans,a[i]*a[j]) ;
		}
	}
	cout << ans ;
}


int32_t main(){
    FAST_IO ;
    int t = 1 ;
//    cin >> t ;
    while(t--){
        solve() ;
    }
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	vector<pair<int, int>> A( N );
	for( int i = 0; i < N; ++i ) {
		cin >> A[i].first;
		A[i].second = i+1;
	}

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

	for( int i = 0; i < N; ++i ) {
		cout << A[i].second << (i < N-1 ? ' ' : '\n');
	}

	return 0;
}


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

int a, b;


void init(){
	string s;
	cin >> a >> s >> b;
	if(s == "+"){
		cout << a + b;
	}
	else {
		cout << a - b;
	}
}

int main(){
	
	init();
	return 0;
}

Measured memory_bytes: 256
N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

totalVotes = 0
for i in range(len(A)):
	totalVotes += A[i]

selected = 0
for i in range(len(A)):
	if A[i] >= totalVotes/(4*M):
		selected +=1 

if selected >= M:
	print("Yes")
else: 
	print("No")

Measured memory_bytes: 3064
// Problem : 
// 			B - Making Triangle
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)           (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)        cout << #x << " = " << x << endl
#define trace(x)        cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void babuBhaiya()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	int n; cin>>n;
	vi v(n); fo(i,n) cin>>v[i];
	//sort(all(v));
	int cnt = 0;
	for(int i = 0;i<n;i++){
		for(int j = i+1;j<n;j++){
			for(int k =j+1;k<n;k++){
				if(v[i] != v[j] and v[j]!=v[k] and v[k]!=v[i]){
					int x = v[i]+v[j];
					int y = v[j] + v[k];
					int z = v[i] + v[k];
					if(x>v[k] and y>v[i] and z>v[j]) cnt++;
				}
				else continue;
			}
		}
	}
	cout<<cnt;
}

 
int32_t main()
{
    babuBhaiya();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
 
int main(){
  int a,b,c;
  std::cin >> a >> b >> c;
  if((a==b) && (b==c)) std::cout << "No" << std::endl;
  else if(a==b) std::cout << "Yes" << std::endl;
  else if(b==c) std::cout << "Yes" << std::endl;
  else if(a==c) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int N; cin >> N;
  vector<int> L(N); cin >> L;
  sort(L.begin(), L.end());

  int sum = 0;
  for (int i = 0; i < N - 1; ++i) sum += L[i];
  if (sum > L[N-1]) cout << "Yes" << endl;
  else              cout << "No" << endl;
}


Measured memory_bytes: 3600
/*{{{*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
using namespace std;
typedef pair<int, int> PP;
typedef long long LL;
#define pb push_back
#define fr first
#define sc second
#define bitcnt __builtin_popcount
#define all(x) x.begin(), x.end()
inline int ri() {int x; scanf("%d", &x); return x;}
#define rep2(i, n, ...) for (int i = 0; i < (n); i ++) 
#define rep3(i, a, b, ...) for (int i = (a); i < (b); i ++)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define drep2(i, n, ...) for (int i = (n) - 1; i >= 0; i --)
#define drep3(i, a, b) for (int i = (a) - 1; i >= (b); i --)
#define drep(...) GET_MACRO(__VA_ARGS__, drep3, drep2)(__VA_ARGS__)
template<typename T>inline bool smax(T&a, T b){if(a<b){a=b;return true;}return false;} 
template<typename T>inline bool smin(T&a, T b){if(a>b){a=b;return true;}return false;} 
/*}}}*/


int l[200010], r[200010], a[200010], pos[200010];


int find(int *p, int x) {
  return x == p[x] ? x : p[x] = find(p, p[x]);
}

void add(int i) {
  l[i] = find(l, i - 1);
  r[i] = find(r, i + 1);
}

int main() {
  #ifdef _TEST_
  freopen("input.txt", "r", stdin);
  //freopen("out.txt", "w", stdout);
  #endif
  LL n, res = 0;
  cin >> n;
  rep(i, 1, n + 1) {
    cin >> a[i]; 
    pos[a[i]] = i;
    l[i] = r[i] = i;
  }
  l[n + 1] = r[n + 1] = n + 1;

  for (int i = n; i >= 1; i --) {
    int s = pos[i];
    add(s);
    LL R = find(r, s), L = find(l, s);
    //cout << L << ' ' << R << ' ' << i << endl;
    res += (R - s) * (s - L) * i;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3456
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (a >= b)
    puts("delicious");
  else if (b - a < x + 1)
    puts("safe");
  else
    puts("dangerous");
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
"use strict";
let input = require("fs").readFileSync("/dev/stdin", "utf8");
const n = input.split(" ").map(e => Number(e));
const output = Math.max(n[0] + n[1], n[0] - n[1], n[0] * n[1]);
console.log(output === -0 ? 0 : output);

Measured memory_bytes: 7372