akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	LL x;
	cin>>x;
	if(x==1)
	cout<<0;
	else
	cout<<1;
}


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

int cc(long long i)
{
    int ans=0;
    while(i)
    {
        if(i%2)
        ans++;
        i/=2;
    }
    return ans;
}
int main() {
	// your code goes here
int a,b;
cin>>a>>b;
if(a<=8 && b<=8)
cout<<"Yay!"<<endl;
else
cout<<":("<<endl;
return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int x,a,b;
    cin >> x >> a >> b;
    if (b-a >= x+1) {
        cout << "dangerous" << "\n";
    }
    if (b-a <= x && b > a) {
        cout << "safe" << "\n";
    }
    if (b <= a) {
        cout << "delicious" << "\n";
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())
S = [input().rstrip() for _ in range(N)]
cum = [[0] * (M + 1) for _ in range(N + 1)]
for i in range(N):
    for j in range(M):
        cum[i+1][j+1] = int(S[i][j]) + cum[i][j+1] + cum[i+1][j] - cum[i][j]
cumh = [[0] * M for _ in range(N + 1)]
for i in range(N):
    for j in range(M-1):
        cumh[i+1][j+1] = cumh[i][j+1] + cumh[i+1][j] - cumh[i][j]
        if S[i][j] == S[i][j+1] == '1':
            cumh[i+1][j+1] += 1
cumv = [[0] * (M + 1) for _ in range(N)]
for i in range(N-1):
    for j in range(M):
        cumv[i+1][j+1] = cumv[i][j+1] + cumv[i+1][j] - cumv[i][j]
        if S[i][j] == S[i+1][j] == '1':
            cumv[i+1][j+1] += 1
for _ in range(Q):
    x1, y1, x2, y2 = map(lambda x: int(x) - 1, input().split())
    a = cum[x2+1][y2+1] - cum[x2+1][y1] - cum[x1][y2+1] + cum[x1][y1]
    b = cumh[x2+1][y2] - cumh[x1][y2] - cumh[x2+1][y1] + cumh[x1][y1]
    c = cumv[x2][y2+1] - cumv[x2][y1] - cumv[x1][y2+1] + cumv[x1][y1]
    print(a - b - c)

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

map <string, int> M;

int main() {
	int n;
	cin >>n;
	int maxx = 0;
	for (int i=0 ; i<n ; i++) {
		string s;
		cin >>s;
		M[s]++;
		maxx = max(maxx, M[s]);
	}
	for (map<string, int> :: iterator it = M.begin() ; it!=M.end() ; it++) {
		if (it -> second == maxx) {
			cout << it -> first <<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 25216
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <cstdio>

using namespace std;

/**
 * amazingly fast IO
 * NOTE: fread_unlocked does not work on macOS.
 */
const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline void flus() {
  while (getcha() != ' ');
}

int main () {
  int D = getint();
  int N = getint();
  int h = (D == 0) ? 1 : ((D == 1) ? 100 : 10000);

  printf("%d\n", h * (N == 100 ? N + 1 : N));
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;
#define DBG(x) cerr << x << endl;

/*
	
*/
int n, m;
int solve()
{
	return (n - 1) * (m - 1);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
	//freopen("tmp.out", "w", stderr);
#endif
	cin >> n >> m;

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
# -*- coding:utf8 -*-

n, q = map(int, input().split())
l = [input().split() for _ in range(n)]
r = []
t = 0
while len(l) > 0:
    p = l.pop(0)
    pt = int(p[1])
    if pt >= q:
        t += q
        pt -= q
        if pt > 0:
            l.append([p[0], pt])
        else:
            r.append([p[0], t])
    else:
        t += pt
        r.append([p[0], t])
for x in r:
    print(' '.join(map(str, x)))


Measured memory_bytes: 17040
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=I()
A=LI()
B = []
counts = collections.Counter(A)
for count in counts.items():
    if count[1] >= 2:
        B.append(count)
B.sort(reverse=True)
if len(B) ==0:
    print(0)
elif len(B) == 1:
    if B[0][1] >= 4:
        print(B[0][0]**2)
    else:
        print(0)
else:
    if B[0][1] >= 4:
        print(B[0][0]**2)
    else:
        print(B[0][0]*B[1][0])
    

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

using namespace std;

const int MAXN = 2E5;
int nextOcc[MAXN + 1][26];
int dp[MAXN + 1];

int main()
{
    string a;
    cin >> a;
    int n = (int) a.length();
    fill(nextOcc[n], nextOcc[n] + 26, n);
    for (int i = n - 1; i >= 0; i--)
    {
        for (int j = 0; j < 26; j++)
        {
            if (a[i] - 'a' == j)
                nextOcc[i][j] = i;
            else
                nextOcc[i][j] = nextOcc[i + 1][j];
        }
    }
    dp[n] = 1;
    for (int i = n - 1; i >= 0; i--)
    {
        int last = -1;
        for (int j = 0; j < 26; j++)
        {
            last = max(last, nextOcc[i][j]);
        }
        if (last == n)
            dp[i] = 1;
        else
            dp[i] = 1 + dp[last + 1];
    }
    int len = dp[0];
    stringstream ss;
    int ptr = 0;
    while (len--)
    {
        int key = 0;
        while (dp[nextOcc[ptr][key] + 1] != len)
            key++;
        ss << (char) (key + 'a');
        ptr = nextOcc[ptr][key] + 1;
    }
    cout << ss.str() << endl;
    return 0;
}


Measured memory_bytes: 21636
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

const ll MaxN=2010001;

ll f[MaxN], rf[MaxN];
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    REP(i, 1, MaxN) f[i] = (f[i - 1] * i) % mod;
    REP(i, 0, MaxN) rf[i] = inv(f[i]);
}
//---------------------------------------------------------------------------------------------------
ll C(ll n, ll k) {
    ll a = f[n]; // = n!
    ll b = rf[n-k]; // = (n-k)!
    ll c = rf[k]; // = k!

    ll bc = (b * c) % mod;

    return (a * bc) % mod;
}

int main(){
    ll K; cin>>K;
    string S; cin>>S;
    
    init();
    ll memory=1;
    ll ans=0;
    ll M=S.size();
    M+=K;
    rep(i,M-S.size()+1){
        ll f=(C(M,M-i)*memory)%mod;
        memory=(memory*25)%mod;
        ans=(ans+f)%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 35848
/// sultanov      

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()

using namespace std;
using namespace __gnu_pbds;
                                                          
template<typename T> 
using ordered_set = tree<T, null_type,   
less<T>, rb_tree_tag,
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int N = 2e2;
const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n * 2);
    for (int& x : a)
        cin >> x;
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < 2 * n; i += 2)
        ans += min(a[i], a[i + 1]);
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){
  char s[15];
  char t[15];
  char u[15];
  int a,b;
  
  scanf("%s %s",&s,&t);
  scanf("%d %d",&a,&b);
  scanf("%s",&u);
  
  if(strcmp(s,u)==0)
    printf("%d %d",a-1,b);
  else if(strcmp(t,u)==0)
    printf("%d %d",a,b-1);
  else
    printf("%d %d",a,b);
  
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int ui;
typedef string st;
typedef vector<int> vi;
typedef vector <ll> vll;
typedef pair<int, int> pii;
typedef set<int> seti;
#define all(v) ((v).begin()),((v).end())
#define allr(v) v.rbegin(),v.rend()
#define repi(n)  for(int i = 0; i < (int)(n); ++i)
#define repj(n)  for(int j = 0; j < (int)(n); ++j)
#define endl "\n"
#define sz(n) n.size()
#define RT(v) return cout<<v,0
#define watch(x) cout<<#x<<" = { "<<x<<" }\n"
ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }
void run() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
#endif
}
void Ahmed_Meky()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}


int main()
{

	Ahmed_Meky();  		   /*█▀▀▄░░░░░░░░░░░▄▀▀█
						   ░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
						   ░░▀▄░░░▀░░░░░▀░░░▄▀
						   ░░░░▌░▄▄░░░▄▄░▐▀▀
						   ░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
						   ░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
						   ▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
						   █░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
						   ░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
						   ░░░█░░░░░░░░░░░▄▀▄░▀▄
						   ░░░█░░░░░░░░░▄▀█░░█░░█
						   ░░░█░░░░░░░░░░░█▄█░░▄▀
						   ░░░█░░░░░░░░░░░████▀
						   ░░░▀█▄▄▄▀▀▀▀▄▄▄█▀*/
	
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if (k < a){
		cout << k;
	}
	else if (k <= a + b){
		cout << a;
	}
	else {
		cout << a - (k - a - b);
	}
    //system("pause");
    return 0;

}
				


Measured memory_bytes: 3628
#include <stdio.h>
#define N 100

void dfs(void);
void dfs_visit(int);
int m[N][N],n;
int color[N],f[N],d[N],tt;

int main()
{
  int i,j,z,v,k;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    for(j=0;j<n;j++)
    {
      m[i][j]=0;
    }
  }
  for(i=0;i<n;i++)
    {
      scanf("%d %d",&v,&z);
      v--;
      for(j=0;j<z;j++)
	{
	  scanf("%d",&k);
	  k--;
	  m[v][k]=1;
	}
    }

  dfs();
  
 
}

void dfs()
{
  int u;
  for(u=0;u<n;u++)
    color[u]=0;
  tt=0;
  for(u=0;u<n;u++)
    {
      if(color[u]==0)
	{
	  dfs_visit(u);
	}
    }
  for(u=0;u<n;u++)
    {
      printf("%d %d %d\n",u+1,d[u],f[u]);
    }
}

void dfs_visit(int u)
{
  int v;
  color[u]=1;
  d[u]=++tt;
  for(v=0;v<n;v++)
    {
      if(m[u][v]==0)
	continue;
      if(color[v]==0)
	dfs_visit(v);
    }
  color[u]=2;
  f[u]=++tt;
}



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

int digits_sum(int n)
{
    int s = 0;

    do {
        s += n % 10;
        n /= 10;
    } while (n != 0);

    return s;
}

int main(void) {
    int N;
    cin >> N;

    int least = INT_MAX;
    for (int A = 1; A <= N/2; A++) {
        int B = N - A;
        int s = digits_sum(A) + digits_sum(B);
        least = min(least, s);
    }
    cout << least << endl;;
}

Measured memory_bytes: 256
int main()
{
	int A, B;
	char OP;
	//文字入力
	scanf("%d ", &A);
	scanf("%c ", &OP);
	scanf("%d", &B);
	switch (OP) {
	case '+':A += B; break;
	case '-':A -= B; break;
	}
	printf("%d", A);




	return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
multiset<int> S;
int n,a,b,c[2005],cur,smx[2005],smn[2005],tmp_max[2005],tmp_min[2005];
int dabs(int x){
    return x>0?x:-x;
}
int get_max(int j){
    if(j==n)
        return dabs(c[n]-b);
    auto low=S.lower_bound(c[j]),upp=S.upper_bound(c[j]);
    if(low==S.end())
        return dabs(*upp-c[j]);
    if(upp==S.begin())
        return dabs(*low-c[j]);
    return min(dabs(*low-c[j]),dabs(*(--upp)-c[j]));
}
int get_min(int j){
    if(j==n)
        return dabs(c[n]-a);
    return max(dabs(c[j]-smx[j+1]),dabs(c[j]-smn[j+1]));
}
int main(){
    ios::sync_with_stdio(false);
    int i,j,mx_pos,mn_pos;
    cin>>n>>a>>b;
    for(i=1;i<=n;i++)
        cin>>c[i];
    if(n==1)
        cout<<dabs(c[n]-b);
    else
        cout<<max(dabs(c[n]-c[n-1]),dabs(c[n]-b));
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main() {
	int n;
	cin >> n;
	vector<vector<int>> g(200005);
	rep (i, n - 1) {
		int a;
		cin >> a;
		g[a].pb(i);
	}

	for (int i = 1; i <= n; i++) cout << g[i].size() << endl;
	return 0;
}


Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
int N, A, B, C;
int l[10];

int solve(int a, int b, int c, int x, int used){
    int res0 = 1 << 30;
    if(a != 0 && b != 0 && c != 0) res0 = abs(A - a) + abs(B - b) + abs(C - c) + (used - 3) * 10;
    if(x == N) return res0;
    
    int res1 = solve(a + l[x], b, c, x + 1, used + 1);
    int res2 = solve(a, b + l[x], c, x + 1, used + 1);
    int res3 = solve(a, b, c + l[x], x + 1, used + 1);
    int res4 = solve(a, b, c, x + 1, used);
    
    return min({res0, res1, res2, res3, res4});
}


int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> l[i];
    }
    cout << solve(0, 0, 0, 0, 0) << endl;
}

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

stringstream input;

struct complex{
	bool ov;
	int re, im;

	complex( int re_, int im_, bool ov_ = false ):
		re(re_), im(im_), ov(ov_)
		{
			if( !ov ){
				ov = max( abs(re), abs(im) ) > 10000;
			}
		}

	complex operator -(){
		return complex( -re, -im, ov );
	}
	void operator +=( const complex &c ){
		*this = complex( re + c.re, im + c.im, ov | c.ov );
	}
	void operator -=( const complex &c ){
		*this = complex( re - c.re, im - c.im, ov | c.ov );
	}
	void operator *=( const complex &c ){
		*this = complex(
			re * c.re - im * c.im,
			re * c.im + im * c.re,
			ov | c.ov
		);
	}
};
const complex i( 0, 1 );

complex term();
complex factor();
complex expr();

complex expr(){
	complex c = term();
	char ch;
	for(;;){
		if( input.peek() == '+' ){
			input >> ch;
			c += term();
		}
		else if( input.peek() == '-' ){
			input >> ch;
			c -= term();
		}
		else break;
	}
	return c;
}

complex term(){
	complex c = factor();
	char ch;
	while( input.peek() == '*' ){
		input >> ch;
		c *= factor();
	}
	return c;
}

complex factor(){
	char ch;
	if( input.peek() ==  '(' ){
		input >> ch;
		complex c = expr();
		input >> ch;
		return c;
	}
	if( input.peek() == 'i' ){
		input >> ch;
		return i;
	}
	if( input.peek() == '+' ){
		input >> ch;
		return factor();
	}
	if( input.peek() == '-' ){
		input >> ch;
		return -factor();
	}
	
	int val;
	input >> val;
	return complex( val, 0, input.fail() );
}

int main(){
	for( string s; getline( cin, s ); ){
		input.clear();
		input.str(s);
		complex c = expr();

		if( c.ov ) cout << "overflow";
		else{
			if( c.re ){
				cout << c.re;
				if( c.im > 0 ) cout << '+';
			}
			else if( !c.im )
				cout << '0';

			if( c.im ){
				cout << c.im << 'i';
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;

bool solve(char *S, char *T)
{
    int n = strlen(S);
    for (int i = 0; i <= n; ++i)
    {
        char c = S[0];
        for (int i = 0; i < n; ++i)
        {
            S[i - 1] = S[i];
        }
        S[n - 1] = c;
        if (strcmp(S, T) == 0)
            return 1;
        else
        {
            continue;
        }
    }
    return 0;
}

int main()
{
    char S[105], T[105];
    scanf("%s", S);
    getchar();
    scanf("%s", T);
    if (solve(S, T))
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


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

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))


using namespace std;


typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 



int main(){
	string s;
	cin>>s;
	int l = (int)s.size();
	for(int i=0;i<l;i+=2) cout<<s[i];
	cout<<endl;
	return 0; 
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int K;
    cin >> K;
    if(K%2==0){
        cout << K/2 * K/2 << endl;
    } else {
        cout << K/2 * (K/2+1) << endl;
    }

}


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

int main() {
  int h, w;
  cin >> h >> w;
  rep(i, w + 2) {
    cout << "#";
  }
  cout << endl;
  rep(i, h) {
    string s;
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  rep(i, w + 2) {
    cout << "#";
  }
  cout << endl;
}

Measured memory_bytes: 256
<?php
// スペース区切りの整数の入力
fscanf(STDIN, "%d %d %d", $a, $b, $c);

if ($a <= $b) {
  if ($b <= $c) {
    echo ($c * 10 + $b) + $a;
  } else {
    echo ($b * 10 + $c) + $a;
  }
} else {
  if ($a <= $c) {
    echo ($c * 10 + $b) + $a;
  } else {
    echo ($a * 10 + $c) + $b;
  }
}
?>


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

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

    deque<int> deq;
    rep(i, N) {
        int a;
        cin >> a;
        i % 2 ? deq.push_back(a) : deq.push_front(a);
    }

    if(N%2){
        while(!deq.empty()){
            cout << deq.front() << "\n";
            deq.pop_front();
        }
    }
    else{
        while(!deq.empty()){
            cout << deq.back() << "\n";
            deq.pop_back();
        }
    }

    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> players(N, K);
    int x;
    for (int i = 0; i < Q; i++)
    {
        cin >> x;
        x--;
        players[x]++;
    }

    for (int i = 0; i < N; i++)
    {
        players[i] -= Q;
    }

    for (int i = 0; i < N; i++)
    {
        if (players[i] > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }

    return (0);
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

const int mn = 300;
bool isp[mn+1];
void init() {
	fill(isp + 2, isp + mn+1, true);
	Rep1(i, 2, mn) {
		if (!isp[i])continue;
		for (int j = 2 * i; j <= mn; j += i) {
			isp[j] = false;
		}
	}
}
bool testmincase(int n,int m) {
	if (isp[n])return false;
	vector<bool> used(n, false);
	queue<int> q; q.push(0); used[0] = true;
	rep(i, n) {
		if (isp[i + 1])used[i] = true;
	}
	while (!q.empty()) {
		int id = q.front(); q.pop();
		if (id%m) {
			if (!used[id - 1]) {
				used[id - 1] = true; q.push(id - 1);
			}
		}
		if ((id%m) < m - 1 && id < n - 1) {
			if (!used[id + 1]) {
				used[id + 1] = true; q.push(id + 1);
			}
		}
		if (id - m >= 0) {
			if (!used[id - m]) {
				used[id - m] = true; q.push(id - m);
			}
		}
		if (id + m < n) {
			if (!used[id + m]) {
				used[id + m] = true; q.push(id + m);
			}
		}
	}
	return used[n - 1];
}
int a[1 << 18]; int n;
bool can(int x) {
	vector<int> b(2 * n - 1);
	rep(i, 2 * n - 1) {
		if (a[i] < x)b[i] = 0;
		else b[i] = 1;
	}
	int le = 0, ri = 2 * n - 2;
	for (int i = n - 1; i > 0; i--) {
		if (b[i] == b[i - 1]) {
			le = i; break;
		}
	}
	for (int i = n - 1; i < 2 * n - 2; i++) {
		if (b[i] == b[i + 1]) {
			ri = i; break;
		}
	}
	if (b[le] == b[ri])return b[le];
	if (n - 1 - le < ri - (n - 1))return b[le];
	else return b[ri];
}
void solve() {
	
	cin >> n;
	rep(i, 2 * n - 1)cin >> a[i];
	int le = 0, ri = 2 * n;
	while (ri - le > 1) {
		int mid = (ri + le) / 2;
		if (can(mid))le = mid;
		else ri = mid;
	}
	cout << le << endl;
}
int main() {
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 1808
H,W = map(int,input().split())
tile = [[0 for i in range(W)] for i in range(H)]
buf = [[0 for i in range(W+1)] for i in range(H+1)]
maxsquare = 0

for i in range(H):
    tile[i] = list(map(int,input().split()))

for i in range(1,H+1):
    for j in range(1,W+1):
        if tile[i-1][j-1]!=1:
            buf[i][j] = min(buf[i-1][j],buf[i][j-1],buf[i-1][j-1]) + 1

            if buf[i][j] > maxsquare:
                maxsquare = buf[i][j]

print(maxsquare**2)

Measured memory_bytes: 58504
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, C = LI()
    D = []
    c = []
    m0 = collections.defaultdict(int)
    m1 = collections.defaultdict(int)
    m2 = collections.defaultdict(int)
    for _ in range(C):
        D.append(LI())
    for __ in range(N):
        c.append(LI_())
    for row in range(N):
        for col in range(N):
            color = c[row][col]
            if (row + col) % 3 == 0:
                m0[color] += 1
            elif (row + col) % 3 == 1:
                m1[color] += 1
            else:
                m2[color] += 1
    min_cnt = inf
    for c0 in range(C):
        for c1 in range(C):
            for c2 in range(C):
                cnt = 0
                if c0 == c1 or c1 == c2 or c2 == c0:
                    continue

                for orig_c0, num in m0.items():
                    cnt += (D[orig_c0][c0] * num)

                for orig_c1, num in m1.items():
                    cnt += (D[orig_c1][c1] * num)

                for orig_c2, num in m2.items():
                    cnt += (D[orig_c2][c2] * num)
                min_cnt = min(min_cnt, cnt)
    print(min_cnt)
main()



Measured memory_bytes: 8396
#include <cstdio>


int a, b;

bool ly[3001];

int main(){
    for(int i = 0; i <= 3000; i++){
        if(i % 400 == 0){
            ly[i] = true;
            continue;
        }

        if(i % 100 == 0){
            continue;
        }

        if(i % 4 == 0){
            ly[i] = true;
        }
    }

    bool f = false;
    while(scanf("%d %d", &a, &b) != EOF){
        if(a == 0 && b == 0) break;
        if(f) printf("\n");
        else f = true;

        bool j = true;
        for(; a <= b; a++){
            if(ly[a]){
                printf("%d\n", a);
                j = false;
            }
        }

        if(j) printf("NA\n");
    }

    return 0;
}

Measured memory_bytes: 2568
m,d = map(int,input().split())
count=0
for i in range(4,m+1):
  for j in range(22,d+1):
    if i==int(str(j)[0])*int(str(j)[1]) and int(str(j)[1])!=0 and int(str(j)[1])!=1:
      count+=1
print(count)

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

int main(void){
	ll n, q;
	cin >> n >> q;
	Vec s(n), t(n), x(n);
	rep(i, n) cin >> s[i] >> t[i] >> x[i];
	Vec d(q);
	rep(i, q) cin >> d[i];

	rep(i, n) s[i] -= x[i], t[i] -= x[i];

	VecP u(n), v(n);
	rep(i, n) u[i] = {s[i], x[i]};
	rep(i, n) v[i] = {t[i], x[i]};
	sort(all(u));
	sort(all(v));

	map<ll, ll> mp;

	ll p1 = 0, p2 = 0;
	rep(i, q){
		while(p1 < n){
			if(u[p1].fs > d[i]) break;
			mp[u[p1++].sc]++;
		}
		while(p2 < n){
			if(v[p2].fs > d[i]) break;
			mp[v[p2].sc]--;
			if(mp[v[p2].sc] == 0) mp.erase(v[p2].sc);
			p2++;
		}

		auto it = mp.lower_bound(0);
		if(it == mp.end()) co(-1);
		else co((*it).fs);
	}

	return 0;
}


Measured memory_bytes: 26240
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl



int digitsum(int n, int base) {
	int ret = 0;
	while (n > 0) {
		ret += n % base;
		n /= base;
	}
	return ret;
}


signed main() {

	int n, s;
	cin >> n >> s;

	if (n == s) {
		cout << n + 1 << endl;
		return 0;
	}

	for (int b = 2; b * b <= n; b++) {
		if (s == digitsum(n, b)) {
			cout << b << endl;
			return 0;
		}
	}


	// 2桁のとき
	// n = a*base + (s-a), 0<=a<base
	//   = a*(base-1) + s
	int sq;
	for ( sq = 1; sq * sq <= n; sq++);
	sq--;

	for (int a = sq; a>=1; a--) {
		if ((n - s) % a == 0) {
			int b = (n - s) / a + 1;
			if (b>0 && digitsum(n,b)==s) {
				cout << b << endl;
				return 0;
			}
		}
	}



	cout << -1 << endl;

	return 0;
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    int n;
    cin >> n;
    string s[n];
    rep(i,n) cin >> s[i];
    map<string,int> mp;

    for(int i=0;i<n;i++){
        mp[s[i]]++;
    }

    cout << mp.size() << endl;
}


Measured memory_bytes: 25372
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
  int a,b,c,x,t,t2,ans=0;scanf("%d%d%d%d",&a,&b,&c,&x);
  x/=50;
  rep(i,a+1){
    t=x-i*10;
    if(t<0)break;
    rep(j,b+1){
      t2=t-j*2;
      if(t2<0)break;
      if(t2<=c)ans++;
    }
  }printf("%d\n",ans);
}

Measured memory_bytes: 256
local n = io.read("*n")
local rate = {}
for i = 1, n do
  rate[i] = 0
end
local p0 = 1
for i = 1, n do
  local t = io.read("*n")
  for j = n - 1, 1, -1 do
    rate[j + 1] = rate[j + 1] + rate[j] * t
    rate[j] = rate[j] * (1 - t)
  end
  rate[1] = rate[1] + t * p0
  p0 = p0 * (1 - t)
end
local hn = math.ceil(n / 2)
local p = 0
for i = hn, n do
  p = p + rate[i]
end
print(p)


Measured memory_bytes: 376
#include<bits/stdc++.h>
// Useful constants
#define INF  (int)1e9
#define EPS   1e-9
#define MOD 1000000007ll
#define PI 3.14159
// for input-output
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
// iteration macros: have advantage of auto-casting and not recomputing arguments
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
// input macro
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
//output macro
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
// shortcut for data type
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
//--namespace
using namespace std;
//--useful function
ll gcd(ll a, ll b){ll temp;while (b > 0){temp = a%b;a = b;b = temp;} return a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
// --clock funtion
clock_t time_p=clock();
void TimeTaken()
{
    time_p=clock()-time_p;
    cerr<<"Completion time : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
// --solve function
void solve() {

}
//--main function
int main(){
	char c,d;cin>>c;
	d=tolower(c);
	if(c==d){cout<<"a";
	}
	else cout<<"A";
	return 0;

//   TimeTaken();
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int N, X;
    int count=0, D=0;
    int *array;

    scanf("%d %d", &N, &X);

    array = malloc(sizeof(int) * N);

    for(int i=0; i < N; i++) {
        scanf("%d", &array[i]);
    }

    for(int i=0; i < N; i++) {
        if(D <= X) count++;
        D += array[i];
    }
    if(D <= X) count++;

    // 結果の表示
    printf("%d\n", count);

    return 0;
}


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

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>v;
    for(int i=0; i<n; i++)
    {
        int a;
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    int sum=0;
    for(int i=0; i<k; i++)
    {
        sum+=v[i];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3660
#include <iostream>

using namespace std;
int main(void) {
    long long n, a, b;
    cin >> n >> a >> b;
    long long min, max;
    if ((n >= 2) && (a <= b)){
        min = a * (n - 1) + b;
        max = a + b * (n - 1);
        cout << (max-min+1) << endl;
    }else if((n == 1) && (a == b))
        cout << 1 << endl;
    else
        cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {

    string s,t;
    cin>>s>>t;
    t+=t;
    int j=s.size();
    for(int i=0;i<s.size();i++){
        string k=t.substr(i,j);
        if(k==s){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;

#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define inf 2248012
#define mp make_pair
#define F first
#define S second
#define ri(x) scanf("%d",&x)
#define rii(x,y) scanf("%d %d",&x,&y)
#define riii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define lri(x) scanf("%lld",&x)
#define lrii(x,y) scanf("%lld %lld",&x,&y)
#define lriii(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)

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

const int MAXN = 3e2+3; //AREGLAAAAAAAAR!!!!

int a[MAXN][MAXN];

int main(){ 
	int n;
	ri(n);
	FOR(i,0,n) FOR(j,0,n) ri(a[i][j]);
	FOR(i,0,n){
		FOR(j,0,n){
			FOR(k,0,n){
				if(a[i][k]+a[k][j]<a[i][j]){
					printf("-1\n");
					return 0;
				}
			}
		}
	}
	ll ans=0;
	FOR(i,0,n){
		FOR(j,0,n){
			int good=1;
			FOR(k,0,n){
				if(i==k || k==j) continue;
				if(a[i][k]+a[k][j]==a[i][j]){
					good=0;
					break;	
				}
			}
			if(good) ans+=a[i][j];
		}
	}
	printf("%lld\n",ans/2);	

}

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

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll m;
  m = max(a*c,b*c);
  m = max(m,a*d);
  m = max(m,b*d);
  cout << m << endl;
}


Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
from collections import deque

def main():
  h, w, k = map(int, input().split())
  A = [input().rstrip() for _ in range(h)]
  for i, a in enumerate(A):
    if "S" in a:
      sy = i
      sx = a.index("S")
      break

  que = deque()
  D = ((-1, 0), (0, -1), (1, 0), (0, 1))

  def bfs(y, x):
    seen = [0]*h
    seen[y] |= 1 << x
    F = deque()
    F.append((y, x, 0))
    while F:
      ny, nx, cnt = F.popleft()
      que.append((ny, nx, k))
      if cnt == k:
        continue
      for dy, dx in D:
        yy, xx = ny+dy, nx+dx
        if 0 <= yy < h and 0 <= xx < w:
          if A[yy][xx] == "#":
            continue
          if seen[yy] >> xx & 1:
            continue
          seen[yy] |= 1 << xx
          F.append((yy, xx, cnt+1))

  bfs(sy, sx)

  seen = [0]*h
  while que:
    y, x, cnt = que.popleft()
    if y == 0 or y == h-1 or x == 0 or x == w-1:
      ans = -(-cnt // k)
      break
    for dy, dx in D:
      ny, nx = y+dy, x+dx
      if 0 <= ny < h and 0 <= nx < w:
        if seen[ny] >> nx & 1:
          continue
        seen[ny] |= 1 << nx
        que.append((ny, nx, cnt+1))

  print(ans)

if __name__ == "__main__":
  main()

Measured memory_bytes: 124636
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
const LL MOD=1000000007ll;
const LL INF=2000000000ll;

long power(long a,long b){return b?power(a*a%MOD,b/2)*(b%2?a:1)%MOD:1;}
long comb(int N,int K)
{
	long x=1,y=1;
	for(int i=1;i<=K;i++)
	{
		x=x*(N-i+1)%MOD;
		y=y*i%MOD;
	}
	return x*power(y,MOD-2)%MOD;
}

long hcomb(int N, int K){
    return comb(N+K-1, N-1);
}

int main(){
    cout << fixed << setprecision(10);
    int N;
    cin >> N;
    VI x(N), y(N);
    REP(i,N) cin >> x[i] >> y[i];

    VI order(N);
    for (int i = 0; i < N; ++i) order[i] = i;

    vector<vector<long double> > dist(N, vector<long double>(N));
    REP(i,N){
        REP(j,N){
            dist[i][j] = sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
        }
    }

    long double len = 0;
    LL cnt = 0;
    do {
        int temp_dist = 0;
        for (int i = 1; i < N; ++i) {
            len += dist[order[i-1]][order[i]];
        }
        cnt++;
    } while (next_permutation(ALL(order)));

    long double ans = (long double) len/cnt;

    cout << ans << endl;


}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int n, k;
int ans;

int main(){
	scanf("%d %d", &n, &k);
	for(int i=0; i<n; ++i){
		int x;
		scanf("%d", &x);
		ans += std::min(x, k-x)*2;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 128
//by tzupengwang™
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<vector>
#include<queue>
#include<set>
#include<iostream>
using namespace std;

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

int n, m;
ll c[100005];
int pr[100005];
vector<ii> v;
int gp;

int fd(int x) {
  return (pr[x] == x) ? x : (pr[x] = fd(pr[x]));
}

void init() {
  scanf("%d%d", &n, &m);
  gp = n;
  for (int i = 0; i < n; i ++) {
    pr[i] = i;
    scanf("%lld", &c[i]);
    v.push_back(ii(c[i], i));
  }
  for (int i = 0; i < m; i ++) {
    int x, y;
    scanf("%d%d", &x, &y);

    x = fd(x), y = fd(y);
    assert(x != y);
    if (x != y) gp --, pr[y] = x;
  }
}

int got[100005];
void process() {
  sort(v.begin(), v.end());

  ll ans = 0;

  if (gp == 1) {
    printf("0\n");
    return;
  }

  int ng = gp;
  int av = (gp - 1) * 2 - gp;

  for (ii xx : v) {
    ll x = xx.first;
    int y = xx.second;

    int g = fd(y);
    if (got[g] == 0) {
      ng --;
      ans += x;
      got[g] = 1;
    } else {
      if (av) {
        av --;
        ans += x;
      }
    }
  }
  if (av == 0 && ng == 0) printf("%lld\n", ans);
  else puts("Impossible");
}

int main() {
/*
#ifdef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
  int Cases;
  scanf( "%d" , &Cases ) ;
  for ( int cases = 1 ; cases <= Cases ; cases ++ ) {
*/
    init() ;
    process() ;
/*
  }
*/
  return 0 ;
}


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

namespace atcoder_753
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力を受け取る
            int x = int.Parse(Console.ReadLine());
            string result = "YES";

            if (x != 7 && x != 5 && x != 3) result = "NO";

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13140
N = int(input())
P = [int(p) for p in input().split()]

A = [i*(N+1) for i in range(1, N+1)]
B = [0]*N
B[P[0]-1] = 1
for i in range(1, N):
    B[P[i]-1] = A[P[i-1]-1] + B[P[i-1]-1] - A[P[i]-1] + 1

num = min(B)
if num <= 0:
    num = -num+1
    for i in range(N):
        B[i] += num

for i in range(N):
    A[i] = str(A[i])
    B[i] = str(B[i])
print(" ".join(A))
print(" ".join(B))

Measured memory_bytes: 8156
import java.util.*;

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

      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();

      int ans = 0;

if(a+b>=c-1){
//////////////////////////////////////////////
ans = b + ((c-1) +1);
//////////////////////////////////////////////
}
else{
//////////////////////////////////////////////
for(int i=1;i<c;i++){
  if(a+b>=c-1-i){
    ans = ((c-1)+1)-i+b;
    break;
  }
}
//////////////////////////////////////////////
}
      System.out.println(ans);

    }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
signed main(){
	int n;
	cin>>n;
	int a[100];
	int cnt=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]!=i+1){
			cnt++;
		}
	}
	if(cnt==0||cnt==2){
		cout<<"YES"<<endl;
	}
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
x,y=map(int, input().split())
import math
ans=0

def conbi(n,r,mod):
    ue=1
    for i in range(n-r+1,n+1):
        ue*=i
        ue%=mod
 
    sita=1
 
    for i in range(1,r+1):
        sita*=i
        sita%=mod
 
    sita=pow(sita,mod-2,mod)
 
    return (ue*sita)%mod

for a in range(x+1):
    b=(x-a)/2
    if b-int(b)==0:
        b=int(b)
        if y==2*a+b:
            ans+=conbi(a+b,a,10**9+7)

print(ans)

Measured memory_bytes: 9200
#include<stdio.h>
int main(void)
{
  int x;
  scanf("%d",&x);
  int num=x/100;
  //  printf("%d\n",num);
  if(x>=num*100&&x<=num*105){
    puts("1");
  }else{
    puts("0");
  }
  return 0;
}


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

int main() {
  int s1s2s3;
  cin >> s1s2s3;
  int s3 = s1s2s3 % 10;
  int s2 = (s1s2s3 - s3) % 100 / 10;
  int s1 = (s1s2s3 - s3 - s2) % 1000 / 100;
  cout << s3 + s2 + s1 << endl;
}

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

int f(int x){
  if(!x) return 0;
  return f(x / 10) + x % 10;
}

int main(){
  int n;
  cin >> n;
  int ans = 100000;
  for(int i = 1; i <= n - 1; i++){
    ans = min(ans, f(i) + f(n - i));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): any => {
  const N = +lines[0]
  const A = lines[1].split(' ').map(s => +s)
  const obj = { N, A }
  debug(obj)
  return obj
}

// solver
export const solve = (lines: string[]): string => {
  const { A } = parseLines(lines)
  let isOdd = false
  let count = 0
  while (!isOdd) {
    isOdd = A.some((a: number) => a % 2 !== 0)
    if (isOdd) {
      break
    }
    for(let i = 0; i < A.length; i++) {
      A[i] /= 2
    }
    count++
  }
  return `${count}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7756