akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int inf = 1e9;
const int mod = 1e9+7;
const int maxn = 2e3+3;

typedef pair<int,int> Job;

bool cmp(const Job& a, const Job& b)
{
    if (a.second == b.second)
        return a.first < b.first;
    return a.second < b.second;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        bool good = true;
        vector<Job> A;
        FOR(i,0,n) {
            int a,b; cin >> a >> b;
            const int s = b-a;
            const int t = b;
            A.push_back(Job(s,t));
        }
        sort(ALL(A),cmp);
        int cnt = 0, T = 0;
        FOR(i,0,A.size()) {
            int x,y; x = A[i].first; y = A[i].second;
            if (T > x) 
                good = false;
            T += y-x;
        }
        cout << (good ? "Yes" : "No") << endl;
    }
    return 0;
}


Measured memory_bytes: 2420
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int a, b, c;
	cin >> a >> b >> c;
	
	if((a==7 && b==5 && c==5) || (a==5 && b==7 && c==5) || (a==5 && b==5 && c==7)) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
a,b,c,d,e,f = map(int,input().split())
w = []
for i in range(f//100//a+1):
    for j in range(f//100//b+1):
        w.append(i*100*a + j*100*b)
w = set(w)
s = []
for i in range(f//c+1):
    for j in range(f//d+1):
        s.append(i*c + j*d)
s = set(s)
ans = []
for i in w:
    for j in s:
        if i != 0 and j/(i+j) <= e/(100+e) and i+j <= f:
            ans.append([j/(i+j), j+i, j])
ans.sort()
print(ans[-1][1], ans[-1][2])

Measured memory_bytes: 22548
#![allow(unused_imports)]
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}
impl<T: Iterator> IteratorExt for T {}

fn main() {
    let (n, x, t) = read!(usize, usize, usize);
    println!("{}", t * ((n + x - 1)/x));
}


Measured memory_bytes: 2092
K=int(input())
nums=[i for i in range(1,10)]
for i in range(K):
    a=nums.pop(0)
    if a%10!=0:
        nums.append(a*10 + a%10 - 1)
    
    nums.append(a*10 + a%10)
    
    if a%10!=9:
        nums.append(a*10 + a%10 + 1)

print(a)

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

using namespace std;

#define MAX 200005
int val[MAX], ans[MAX];
vector<int> adj[MAX];
int n;
vector<int> v;
vector<pair<int, int> > change;

void update(int x)
{
    int sz = (int) v.size();
    if(sz == 0 || x > v[sz-1]){
        v.push_back(x);
        change.push_back(make_pair(-1, -1));
        return;
    }
    int iter = lower_bound(v.begin(), v.end(), x) - v.begin();
    change.push_back(make_pair(iter, v[iter]));
    v[iter] = x;
}

void revert()
{
    if(change.back() == make_pair(-1, -1)){
        change.pop_back();
        v.pop_back();
    }
    else {
        int idx = change.back().first;
        int val = change.back().second;
        change.pop_back();
        v[idx] = val;
    }
}

void dfs(int u, int par)
{
    update(val[u]);
    ans[u] = (int) v.size();
    for(int i=0; i<(int)adj[u].size(); i++){
        int v = adj[u][i];
        if(v == par) continue;
        dfs(v, u);
    }
    revert();
}

int main()
{
    //freopen("in.txt", "r", stdin);
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        scanf("%d", &val[i]);
    }
    for(int i=1; i<n; i++){
        int u, v;
        scanf("%d %d", &u, &v);
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1, -1);
    for(int i=1; i<=n; i++){
        cout << ans[i] << endl;
    }
}



Measured memory_bytes: 25992
#include<bits/stdc++.h>
using namespace std;
string s;char ch[3128];
int main(){
    cin>>s;ch['p']='q',ch['q']='p',ch['b']='d',ch['d']='b';
    for(register int i=0;i<s.size();i++) if(s[s.size()-i-1]!=ch[s[i]]) puts("No"),exit(0);
    puts("Yes");
    return 0;
}

Measured memory_bytes: 512
function main()
  lines=readlines()
  H,W=map(x->parse(Int,x),split(shift!(lines)))
  A=zeros(Int,10,10)
  for i=1:10
    t=map(x->parse(Int,x),split(shift!(lines)))
    for j=1:10
      A[i,j]=t[j]
    end
  end
  for k=1:10,i=1:10,j=1:10
    A[i,j]=min(A[i,j],A[i,k]+A[k,j])
  end
  ans=0
  for i=1:H
    t=map(x->parse(Int,x),split(shift!(lines)))
    for j=1:W
      if t[j]!=-1
        ans+=A[t[j]+1,2]
      end
    end
  end
  println(ans)
end
main()

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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
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; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}

/* main */

string a, b, c;
void in(){
    cin >> a >> b >> c;
}

void solve(){

    cout << a[0] << b[1] << c[2] << endl;


}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>

//構造体はデフォルトがpublic
struct UnionFind
{
    std::vector<int> data;
    UnionFind(int n): data(n,-1){}//初期化リスト構文

    int root(int x)
    {
        if(data[x]<0) return x;
        else return data[x]=root(data[x]);
    }

    bool unite(int x,int y)
    {
        int root_x=root(x);
        int root_y=root(y);
        if(root_x==root_y) return false;//xとyは元々同じグループ
        else
        {
            if(data[root_x]<data[root_y])//xの方が大きい
            {
                //xにyを繋げる
                data[root_x]+=data[root_y];
                data[root_y]=root_x;
            }
            else
            {
                data[root_y]+=data[root_x];
                data[root_x]=root_y;
            }
            return true;
        }
    }

    bool is_same(int x,int y){return root(x)==root(y);}
    int size(int x){return -data[root(x)];}
};

int friends[100005];//頂点がもつ友達の数
std::vector<int> hates[100005];//ブロックしている人

int main()
{
    int n,m,k;
    scanf("%d%d%d",&n,&m,&k);

    UnionFind uf(n);
    for(int i=0;i<m;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        a--;b--;
        friends[a]++;
        friends[b]++;
        uf.unite(a,b);
    }
    for(int i=0;i<k;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        a--;b--;
        hates[a].push_back(b);//aはbをブロック
        hates[b].push_back(a);//bはaをブロック
    }
    //各頂点について、(所属しているグループの大きさ-1(自分))-友達の数-(所属しているグループの内、ブロックしている数)
    //を、計算する
    for(int i=0;i<n;i++)
    {
        int ans=uf.size(i)-1-friends[i];
        for(int j:hates[i])
            if(uf.is_same(i,j)) ans--;
        printf("%d%c",ans,i==n-1?'\n':' ');
    }
    return 0;
}

Measured memory_bytes: 8744
def solve(mid):
    set_ = set([])
    memo = {}
    ind = [0] * n
    while True:
        memo = {}
        for i, j in enumerate(ind):
            if a[i][j] not in memo:
                memo[a[i][j]] = [i]
            else:
                memo[a[i][j]].append(i)
        for i in memo:
            if len(memo[i]) > mid:
                tmp = i
                set_.add(i)
                break
        else:
            return True
          
        for i in memo[tmp]:
            index = ind[i]
            while True:
                if index >= m:
                    return False
                if a[i][index] in set_:
                    index += 1
                else:
                    ind[i] = index
                    break


n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

ok = n
ng = 0
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if solve(mid):
        ok = mid
    else:
        ng = mid
print(ok)

Measured memory_bytes: 46556
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 998244353;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template<u32 M = 1000000007>
struct modint{
    u32 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};
using mint = modint<MOD>;

int main() {
    int n, s;
    cin >> n >> s;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    mint ans = 0;
    vector<mint> f(s+1);
    f[0] = 0;
    for (int i = 0; i < n; ++i) {
        f[0] += mint(1);
        for (int j = s-v[i]; j >= 0; --j) {
            f[j+v[i]] += f[j];
        }
        ans += f[s];
    }
    cout << ans.val << "\n";
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<ll> vec;
  vec.push_back(a[0]);
  for (int i = 1; i < n; ++i) {
    if (vec.back() == a[i]) continue;
    vec.push_back(a[i]);
  }
  ll total = 1000, cnt = 0;
  for (int i = 0; i + 1 < vec.size(); ++i) {
    if (vec[i] < vec[i + 1]) {
      cnt = total / vec[i];
      total -= vec[i] * cnt;
      total += vec[i + 1] * cnt;
      cnt = 0;
    }
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3600
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

signed main()
{
    int N;
    cin >> N;
    string s[2];
    cin >> s[0] >> s[1];

    int ans = 3;
    if (N == 1)
    {
        cout << ans << endl;
        return 0;
    }
    bool pre_tate = true;
    int now_index = 1;
    if (s[0][0] == s[0][1])
    {
        ans *= 2;
        pre_tate = false;
        now_index = 2;
    }
    while (now_index < N)
    {
        if (s[0][now_index] == s[0][now_index + 1])
        {
            if (pre_tate)
            {
                ans *= 2;
            }
            else
            {
                ans *= 3;
            }
            now_index += 2;
            ans %= INF;
            pre_tate = false;
        }
        else
        {
            if (pre_tate)
            {
                ans *= 2;
            }
            now_index++;
            ans %= INF;
            pre_tate = true;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    B=[0]*n
    for i in range(n-1,-1,-1):
        x=2*(i+1)
        other=0
        while x<=n:
            other+=B[x-1]
            x+=i+1
        if other%2==A[i]:
            B[i]=0
        else:
            B[i]=1
    print(sum(B))
    print(*[int(i+1) for i,x in enumerate(B) if x==1])

if __name__=='__main__':
    main()

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

int main()
{
    int n, m;
    cin >> n >> m;
    int total = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
        total += a.at(i);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int selected = 0;
    for (int i = 0; i < m; i++)
    {
        if (a.at(i) * 4 * m >= total)
        {
            selected++;
        }
        else
        {
            break;
        }
    }
    if (selected >= m)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
int main(){ 
    int n;
    scanf("%d",&n);
    int m=100000;
    for(int i=0;i<n;i++){
        int d=int(m*0.05);
        d%1000>0?d=d/1000*1000+1000:d=d/1000*1000;
        m+=d;
    }
    printf("%d\n",m);
}

Measured memory_bytes: 2500
#include <iostream>
using namespace std;
#define MOD 1000000007
int n, k;
int a[110];
long long dp[110][100010];
int main () {
	cin >> n >> k;
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}
	dp[0][0] = 1;
	for (int i=1; i<=n; i++) {
		dp[i][0] = 1;
		for (int j=1; j<=k; j++) {
			dp[i][j] = (dp[i][j-1]+dp[i-1][j])%MOD;
			if (j-a[i]-1 >= 0) dp[i][j] = (MOD+dp[i][j]-dp[i-1][j-a[i]-1])%MOD;
		}
	}
	cout << dp[n][k] << endl;
}

Measured memory_bytes: 81752
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int A, B, C;
bool V;

int main(void){
	//IO("test.in", "test.out");
	V = false;
 	scanf("%d%d%d", &A, &B, &C);
 	for(int i = 1; i <= B; i++)
 		if((A * i) % B == C % B) V = true;
 	if(V) printf("YES\n");
 	else printf("NO\n"); 
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define M 5070721
#define NIL (-1)
#define L 14
typedef long long ll;
char H[M][L];

int getChar(char ch){
	if(ch=='A')return 1;
	else if(ch=='C')return 2;
	else if(ch=='G')return 3;
	else if(ch=='T')return 4;
	else return 0;
}

ll getKey(char str[]){
	ll sum=0,p=1,i;
	int len=strlen(str);
	for(i=0;i<len;i++){
		sum+=p*(getChar(str[i]));
		p*=5;
	}
	return sum;
}

int h1(int key){
	return key%M;
}

int h2(int key){
	return 1+(key%(M-1));
}

int find(char str[]){
	ll key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0)return 1;
		else if(strlen(H[h])==0)return 0;
	}
	return 0;
}

int insert(char str[]){
	ll key,i,h;
	key=getKey(str);
	for(i=0;;i++){
		h=(h1(key)+i*h2(key))%M;
		if(strcmp(H[h],str)==0)return 1;
		else if(strlen(H[h])==0){
			strcpy(H[h],str);
			return 0;
		}
	}
	return 0;
}


int main(void){
	int n;
	char str[L],com[9];
	for(int i=0;i<M;i++){
		H[i][0]='\0';
	}
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s %s",com,str);
		if(com[0]=='i'){
			insert(str);
		}else{
			if(find(str)){
				printf("yes\n");
			}else{
				printf("no\n");
			}
		}
	}
	return 0;
}



Measured memory_bytes: 72036
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=n;i++)
		for(int j=0;j<=m;j++)
			if(k==(i*j)+(n-i)*(m-j)) {puts("Yes"); return 0;}
	puts("No");		
	return 0;
}

Measured memory_bytes: 256
K,X = map(int,input().split())
l_up = [i+X-K+1 for i in range(K)]
l_do = [i+X+1 for i in range(K-1)]
l_up.extend(l_do)
for i in range(len(l_up)):
    print(l_up[i] , end=' ')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans=max({a*c,a*d,b*c,b*d});
	cout<<ans;
}


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


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N, M, L;
	cin >> N >> M >> L;
	int C[301][301];
	rep1(j, N) rep1(i, j - 1) C[i][j] = 1e9 + 1;
	rep(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		C[a][b] = c;
		C[b][a] = c;
	}

	rep1(k, N) {
		rep1(j, k - 1) {
			rep1(i, j - 1) {
				chmin(C[i][j], C[i][k] + C[j][k]);
			}
		}
		for (int j = k + 1; j <= N; j++) {
			rep1(i, k - 1) {
				chmin(C[i][j], C[i][k] + C[k][j]);
			}
			for (int i = k + 1; i < j; i++) {
				chmin(C[i][j], C[k][i] + C[k][j]);
			}
		}
	}

	rep1(j, N) rep1(i, j - 1) {
		C[i][j] = (C[i][j] <= L) ? 1 : 1e9;
	}

	rep1(k, N) {
		rep1(j, k - 1) {
			rep1(i, j - 1) {
				chmin(C[i][j], C[i][k] + C[j][k]);
			}
		}
		for (int j = k + 1; j <= N; j++) {
			rep1(i, k - 1) {
				chmin(C[i][j], C[i][k] + C[k][j]);
			}
			for (int i = k + 1; i < j; i++) {
				chmin(C[i][j], C[k][i] + C[k][j]);
			}
		}
	}

	int Q;
	cin >> Q;
	rep(i, Q) {
		int s, t;
		cin >> s >> t;
		if (s > t) swap(s, t);
		if (C[s][t] < 1e9) co(C[s][t] - 1);
		else co(-1);
	}

	Would you please return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

#define PT pair<double, int>

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



	ll X[1002] = {}, Y[1002] = {}, R[1002] = {};
	int xt, yt;
	cin >> X[0] >> Y[0] >> xt >> yt;
	int N;
	cin >> N;
	X[N + 1] = xt;
	Y[N + 1] = yt;
	rep1(i, N) {
		cin >> X[i] >> Y[i] >> R[i];
	}

	vector<PT> E[1002];

	rep(i, N + 2) {
		for (int j = i + 1; j < N + 2; j++) {
			double k = max(0.0, sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])) - R[i] - R[j]);
			E[i].pb(mp(k, j));
			E[j].pb(mp(k, i));
			cesp(i);
			cesp(j);
			ce(k);
		}
	}

	double D[100000];
	rep(i, N + 2) D[i] = 1e18;
	D[0] = 0;

	priority_queue<PT, vector<PT>, greater<PT>> que;

	que.push(mp(0.0, 0));
	while (que.size()) {
		PT p = que.top();
		que.pop();
		int i = p.second;
		if (D[i] != p.first) continue;
		for (PT p2 : E[i]) {
			int j = p2.second;
			double d = D[i] + p2.first;
			if (D[j] > d) {
				D[j] = d;
				que.push(mp(d, j));
			}
		}
	}

	cout << fixed << setprecision(12) << D[N + 1];

	Would you please return 0;
}

Measured memory_bytes: 22640
#include<stdio.h>

int main(void){
  int x1,y1,x2,y2;
  scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
  printf("%d %d %d %d\n",-(y2-y1)+x2,(x2-x1)+y2,-(y2-y1)+x1,(x2-x1)+y1);
}


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

int main() {
    int N;
    cin >> N;
    int sum = 0;
    vector<int> s(N, 0);
    for (int i = 0; i < N; i++) {
        int w;
        cin >> w;
        s[i] = s[i - 1] + w;
        sum += w;
    }

    int res = 1000000000;
    for (int i = 0; i < N; i++) {
        res = min(res, abs(s[i] - (sum - s[i])));
    }
    cout << res << endl;
    return 0;
}

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

    using namespace std;
    #define ull unsigned long long
    #define ll long long
    /*-----------------------------------------------------MATH------------------------------------------------*/
    inline ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
    inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
    inline int pwm(ll xx, ll pow, int MD) { if (pow < 0) { pow = pow % (MD - 1) + MD - 1; } ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; mlt %= MD; } xx *= xx; pow >>= 1; xx %= MD; } return (int)mlt; }
    inline ll gcdex(ll a, ll b, ll &x, ll &y) { if (b == 0) { x = 1; y = 0; return a; }ll xx, yy; ll gc = gcdex(b, a % b, yy, xx); x = xx; y = yy - (a / b) * xx; return gc; }
    inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }
    /*-----------------------------------------------------MATH------------------------------------------------*/

    const int inf = 1e6;
    const int MAXN = 2e5 + 10;
    ll mod =998244353;
    void solve() {
        ll a,b;
        cin>>a>>b;
        ll ans=lcm(a,b);
        cout<<ans;
    }

    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        int n=1;
        for (int i = 0; i < n; i++) solve();
        return 0;
    }

Measured memory_bytes: 256
let input = require('fs').readFileSync('/dev/stdin', 'utf8');
let d = (input.trim()).split("\n");

while(1){
    let n = d.shift() - 0;
    if (n === 0) break;
    let aSum = 0;
    let bSum = 0;
    
    for(i = 0;i < n;++i){
      var arr = ((d.shift()).split(" ").map(Number));
      if(arr[0] > arr[1]){
          aSum += arr[0] + arr[1];
      }
      else if(arr[1] > arr[0]){
          bSum += arr[0] + arr[1]
      }
      else{
          aSum += arr[0];
          bSum += arr[1];
      }
    }
    console.log(aSum + " " + bSum);
}


Measured memory_bytes: 19884
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
	int x,y,z;
	scanf("%d %d %d",&x,&y,&z);
	int ans=(x-z)/(y+z);
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 256
N=int(input())
L = list(map(int,input().split()))

A = 0
for i in range(0,N):
    A = A+L[i]

for i in range(0,N-1):
    if L[i+1]<L[i]:
        L[i+1] = L[i]
    else:
        pass

B = 0
for i in range(0,N):
    B = B+L[i]

print(B-A)

Measured memory_bytes: 32216
/*
      d888888b                         d888888b
   d888    8888b                    d888888   888b
 d88    88  898888b               d8888  888     88b
d8P        88888888b             d88888888888     b8b
88        8888888888             88888888888       88
88       88888888888             8888888888        88
98b     88888888888P             988888888        d8P
 988     888  8888P      _=_      9888898  88    88P
   9888   888888P      q(-_-)p       98888    888P
      9888888P         '_) (_`         9888888P
         88            /__/  \            88
         88          _(<_   / )_          88
        d88b        (__\_\_|_/__)        d88b
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                          
                     saint_coder

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
*/

#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define pb push_back 
#define mp make_pair
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORD(i,a,b) for(int i=(a);i>(b);i--)
#define inp(x) cin>>x
#define inp2(a,b) cin>>a>>b
#define inp3(a,b,c) cin>>a>>b>>c
#define print(x) cout<<x<<" "
#define print2(a,b) cout<<a<<" "<<b<<" "
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define printl(x) cout<<x<<endl
#define WL(t) while(t --)
#define F first
#define S second
#define PQ(type) priority_queue<type>
#define PQD(type) priority_queue<type,vector<type>,greater<type> >
#define SZ(x) ((int)(x).size())
#define inrange(i,a,b) ( ( i>=min(a,b) ) && ( i<=max(a,b) ) )


typedef long long ll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef pair<int,int> pii;

int32_t main(){

	/*int testcases;
	cin>>testcases;

	WL(testcases){
		
		int n;
		cin>>n;

		int a[n];
		FOR(i,n)
			cin>>a[i];		
	}*/	

	double w,h,x,y;
	inp3(w,h,x);
	inp(y);
	
	print(w*h/2);
	
	if(x==w/2 && y==h/2)
		print(1);
	else
		print(0);
	
	return 0;	
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<iostream>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n;cin>>n;
    bool f=0;
    while(n){
        if(n%10==7)f=1;
        n/=10;
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3632
import Control.Applicative
import Data.List (elem)

main = do
  ss <- getLine
  let n = 'N' `elem` ss
      s = 'S' `elem` ss
      w = 'W' `elem` ss
      e = 'E' `elem` ss

  if ((n && s) || (not n && not s)) && ((e && w) || (not e && not w))
    then
      putStrLn "Yes"
    else
      putStrLn "No"


Measured memory_bytes: 508
#include <algorithm>
#include <iostream>
#include <queue>

#define rep(i, n) for (int i = 0; i < n; i++)
#define swap(a, b) ((a != b) && (a ^= b, b ^= a, a ^= b))

struct Puzzle {
    int p[30], depth;
    bool check() {
        int surface[][2] = {{0, 8},   {9, 11},  {12, 14},
                            {15, 17}, {18, 20}, {21, 29}};
        rep(i, 6) {
            if (std::any_of(p + surface[i][0], p + surface[i][1],
                            [&](int x) { return x != *(p + surface[i][0]); }))
                return false;
        }
        return true;
    }
    void operation(int i) {
        switch (i) {
            case 0:
                swap(p[9], p[11]), swap(p[12], p[17]), swap(p[6], p[21]),
                    swap(p[7], p[22]), swap(p[8], p[23]);
                break;
            case 1:
                swap(p[18], p[20]), swap(p[14], p[15]), swap(p[0], p[27]),
                    swap(p[1], p[28]), swap(p[2], p[29]);
                break;
            case 2:
                swap(p[15], p[17]), swap(p[9], p[20]), swap(p[0], p[23]),
                    swap(p[3], p[26]), swap(p[6], p[29]);
                break;
            case 3:
                swap(p[12], p[14]), swap(p[11], p[18]), swap(p[2], p[21]),
                    swap(p[5], p[24]), swap(p[8], p[27]);
                break;
        }
    }
};

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

    std::queue<Puzzle> que;
    Puzzle p;
    rep(i, n) {
        p.depth = 0;
        rep(j, 30) std::cin >> p.p[j];
        que.push(p);

        while (!que.empty()) {
            if (que.front().check()) {
                std::cout << que.front().depth << std::endl;
                break;
            } else {
                rep(j, 4) {
                    p = que.front();
                    p.depth++;
                    p.operation(j);
                    que.push(p);
                }
            }
            que.pop();
        }
        while (!que.empty()) que.pop();
    }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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; }

int main(){
    int n;
    cin >> n;
    ll x[110]={};
    ll y[110]={};
    ll h[110]={};
    rep(i,n) cin >> x[i] >> y[i] >> h[i];
    ll nx,ny,nh;
    rep(i,n)
        if(h[i]!=0) nx=x[i],ny=y[i],nh=h[i];
    rep(tx,101){
        rep(ty,101){
            ll tall = llabs(tx-nx)+llabs(ty-ny)+nh;
            int i;
            for(i=0;i<n;i++){
                bool flag = false;
                if(h[i]==0) flag = true;
                if(flag){
                    if(tall > llabs((ll) tx - x[i]) + llabs((ll) ty - y[i]) + (ll) h[i]){
                        break;
                    }
                }else {
                    if (tall != llabs((ll) tx - x[i]) + llabs((ll) ty - y[i]) + (ll) h[i]) {
                        break;
                    }
                }
            }
            if(i==n){
                cout << tx << " " << ty << " " << tall << endl;
                return 0;
            }

        }
    }
    return 0;
}

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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

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

  int A,B;
  cin>>A>>B;
  cout<<lcm(A,B)<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
a, b, c, k = map(int, input().split())
if abs(a - b) > 10 ** 18:
    print("Unfair")
elif k % 2 == 0:
    print(a - b)
else:
    print(b - a)

Measured memory_bytes: 5176
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,t,h;
int main(){
	scanf("%lld%lld",&n,&t);
	ll pre=0;
	ll max_h = 0; 
	for(int i=1;i<=n;i++){
		scanf("%d",&h);
		max_h = max(max_h, h);
		pre +=  h;
		if(t >= pre){
			
			printf("%lld\n",(t-pre)/max_h  + 2);
			
		}
		else {
			printf("1\n");
	    }
	    
	}
}


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int A[220000], ap[220000];
signed main() {
    cin >> N;
    rep(i, N) {
        cin >> A[i];
        ap[A[i]]++;
    }
    int ans = 0;
    reps(i, N) { ans += ap[i] * (ap[i] - 1) / 2; }
    rep(i, N) {
        cout << ans - (ap[A[i]] - 1) << endl;
    }
}

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

int ord2(long n){
  int cnt=0;
  while(n%2==0){
    cnt++;
    n/=2;
  }
  return cnt;
}

int main(){
  int n,i;
  cin>>n;
  long a[n];
  for(i=0;i<n;i++){
    cin>>a[i];
  }
  int mi=50;
  for(i=0;i<n;i++){
    if(ord2(a[i])<mi){
      mi=ord2(a[i]);
    }
  }
  cout<<mi;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=s.length();
		String ans ="";
		for(int i=0;i<n;i++)ans+='x';
		System.out.println(ans);
	}
}

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

#define       pb                 push_back
#define       sf                 scanf
#define       pf                 printf
#define       mx                 200005
#define       MOD                1000000007
#define 	  optimize           ios::sync_with_stdio(0);cin.tie(0);
#define 	  inf                0x3f3f3f3f
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);

using namespace std;

typedef       long long int      ll;
typedef       vector<int> 	     vi;

int dx[] = {0, 0, +1, -1};
int dy[] = {+1,-1, 0,  0};
/*============GRAPH MOVES==================*/
//const int fx[] = {1, -1, 0, 0};
//const int fy[] = {0, 0, 1, -1};
//const int fx[] = {0, 0, 1, -1, -1, 1, -1, 1};  // Kings move
//const int fy[] = {-1, 1, 0, 0, 1, 1, -1, -1};  // Kings move
//const int fx[] = {-2, -2, -1, -1, 1, 1, 2, 2}; // Knights move
//const int fy[] = {-1, 1, -2, 2, -2, 2, -1, 1}; // Knights move
/*=========================================*/

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
inline ll mod(ll a, ll m){ if(a<0) return m-(abs(a)%m); else if(a<m) return a; else return (a%m); }
inline string tstring(ll a) {stringstream ss; ss << a; string str = ss.str(); return str; }


int main()
{
	int r;

	cin >> r;

	cout << r*r << endl;


    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
//mapの使い方　カウントするとき便利
int main() {
int n,m;cin>>n>>m;
int a[n];
map<int,int> count;
vector<int> num;
rep(i,n){
 cin>>a[i];
 count[a[i]]++;
}
for(auto p:count){
 num.push_back(p.second);
}
sort(all(num));
int ans=0;
if(num.size()>m){
    for(int i=0;i<num.size()-m;i++){
        ans+=num[i];
    }
}
else ans=0;
cout<<ans<<endl;
}

Measured memory_bytes: 11516
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n; long c; readV(n, c);
  long[] x; int[] v; readC(n, x, v);

  auto c1 = new long[](n);
  c1[n-1] = v[n-1] - (c-x[n-1]);
  foreach_reverse (i; 0..n-1)
    c1[i] = c1[i+1] + v[i] - (x[i+1]-x[i]);

  auto mc1 = new long[](n);
  mc1[n-1] = c1[n-1];
  foreach_reverse (i; 0..n-1)
    mc1[i] = max(c1[i], mc1[i+1]);

  auto c2 = new long[](n);
  c2[0] = v[0] - x[0];
  foreach (i; 1..n)
    c2[i] = c2[i-1] + v[i] - (x[i]-x[i-1]);

  auto mc2 = new long[](n);
  mc2[0] = c2[0];
  foreach (i; 1..n)
    mc2[i] = max(c2[i], mc2[i-1]);

  auto ans = max(0L, mc1.reduce!max, mc2.reduce!max);
  foreach (i; 0..n-1) {
    ans = max(ans, c2[i] - x[i] + mc1[i+1]);
    ans = max(ans, c1[n-i-1] - (c-x[n-i-1]) + mc2[n-i-2]);
  }

  writeln(ans);
}


Measured memory_bytes: 7932
import java.util.*;

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

		long[][] queueA = new long[n][m];
		long[][] queueB = new long[m][l];
		long[][] ans = new long[n][l];

		for(int i = 0; i < queueA.length;i++){
			for(int j = 0; j < queueA[i].length; j++){
				queueA[i][j] = sc.nextLong();
			}
		}
		for(int i = 0; i < queueB.length;i++){
			for(int j = 0; j < queueB[i].length; j++){
				queueB[i][j] = sc.nextLong();
			}
		}

		for(int i = 0; i < ans.length; i++){
			for(int j = 0; j < ans[i].length; j++){
				for(int k = 0; k < queueA[i].length; k++){
					ans[i][j] += queueA[i][k]*queueB[k][j];
				}
			}
		}

		for(int i = 0; i < ans.length; i++){
			for(int j = 0; j < ans[i].length; j++){
				if(j == ans[0].length - 1){
					System.out.println(ans[i][j]);
				}else{
					System.out.print(ans[i][j] + " ");
				}
			}
		}
	}
}



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

#define sz 100005
set<int> friendships[sz];

set<int> blocks[sz];
int colors[sz];
int component_size[sz];

void peform_bfs(int start, int color){
    queue<int> bfsQ;
    bfsQ.push(start);
    while(!bfsQ.empty()){
        int front = bfsQ.front(); bfsQ.pop();
        if(colors[front] == 0){
            colors[front] = color; 
            for(auto dest: friendships[front]){
                if(colors[dest] == 0){
                    bfsQ.push(dest);
                }
            }
        }
    }
}

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    for(int i=0; i<M; i++){
        int Ai, Bi;
        cin>>Ai>>Bi;
        friendships[Ai].insert(Bi);
        friendships[Bi].insert(Ai);
    }
    for(int i=0; i<K; i++){
        int Ci, Di;
        cin>>Ci>>Di;
        blocks[Ci].insert(Di);
        blocks[Di].insert(Ci);
    }

    memset(colors, 0, sizeof(colors));
    memset(component_size, 0, sizeof(component_size));

    int current_color = 1;   
    for(int i=1; i<=N; i++){
        if(colors[i] == 0){
            peform_bfs(i, current_color);
            component_size[current_color] = 1;
            current_color += 1;
        }
        else{
            component_size[colors[i]] += 1;
        }
    }

    for(int i=1; i<=N; i++){
        int total = component_size[colors[i]] - 1;
        int blacklisted = 0;
        int immediate = friendships[i].size();
        for(auto dest: blocks[i]){
            if(colors[dest] == colors[i]){
                blacklisted += 1;
            }
        }
        int possible = total - immediate - blacklisted;
        cout<<possible<<" ";
        // cout<<total<<" "<<blacklisted<<" "<<immediate<<"\n";
    }
    cout<<"\n";
    return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[105];

int main()
{
    ll N;
    cin >> N;
    ll s = 0;
    REP(i, N)
    {
        cin >> A[i];
        s += A[i];
    }
    ll min = 0;
    REP(i, N)
    {
        if (abs(A[i] * N - s) < abs(A[min] * N - s))
            min = i;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256