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

using ll = long long;

class UnionFind {
public:
    std::vector<int> data;
 	UnionFind(int size) : data(size, -1) { }
 	bool connect(int x, int y) {
  		x = root(x); y = root(y);
  		if (x != y) {
   			if (data[y] < data[x]) swap(x, y);
        data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    UnionFind Uni(N);
    for(int i = 0;i < M;i++){
        Uni.connect(A[i] - 1, B[i] - 1);
    }
    int ans = 0;
    for(int i = 0;i < N;i++){
        ans = max(ans, Uni.size(i)); 
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 7240
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int n,k;cin>>n>>k;
	int g ;cin>>g;
	int ma =g;
	rep(i,n-1){
		int a;cin>>a;
		g = __gcd(g,a);
		ma=max(ma,a);
		if(a==k){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	if(ma<k){
		cout<<"IMPOSSIBLE"<<endl;
	}
	else if(k%g==0){
		cout<<"POSSIBLE"<<endl;
	}
	else{
		cout<<"IMPOSSIBLE"<<endl;
	}
	
}

Measured memory_bytes: 256
/*    FAILING IS AN ART
       AND 
     I HAVE MASTERED IT
*/
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
#define ld long double
using namespace std;

ll bin_exp(ll a,ll b)
{
    ll ans=1;
    if(a==0)
        ans=1;

    while(b>0)
    {
        if(b&1)
            ans*=a;

        a*=a;
        b>>=1;
    }
    return ans;
}

ll fun(ll x)
{
    if(x==1)
        return 1;
    if(x%2) x--;
    return 1+2*fun(x/2);

}

int main()
{ 

    fast;

    ll h;
    cin>>h;

    if(h==1)
    {
        cout<<1<<endl;
        return 0;
    }

    else if(h==2 or h==3)
    {
        cout<<3<<endl;
    }

    else
    {
        cout<<fun(h)<<endl;

    }

  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
#define int long long

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}
 
template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

template <typename T> ostream &operator << (ostream &cout, vector <T> x) {
	for(auto it = x.begin(); it != x.end(); ++it) {
		if(it == x.begin())
			cout << "{" << *it;
		else
			cout << ", " << *it;
	}
	cout << "}";
	return cout;
}

template <typename T> ostream &operator << (ostream &cout, set <T> x) {
	for(auto it = x.begin(); it != x.end(); ++it) {
		if(it == x.begin())
			cout << "{" << *it;
		else
			cout << ", " << *it;
	}
	cout << "}";
	return cout;
}

const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int N = 2e5 + 15;
const int K = 26;
int n;
string s;

vector <int> ord[K];
bool used[N];

int q[N], ql, qr;
int p[N];

main() {
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> s;
	n = s.size();
	for(int i = 0; i < n; ++i)
		ord[s[i] - 'a'].pb(i);
	q[ql = qr = 0] = -1;
	while(ql <= qr) {
		int v = q[ql++];
		for(int i = 0; i < 26; ++i) {
			vector <int>::iterator it = upper_bound(ord[i].begin(), ord[i].end(), v);
			if(it == ord[i].end()) {
				string t = "";
				t += char(i + 'a');
				while(v != -1) {
					t += s[v];
					v = p[v];
				}
				reverse(t.begin(), t.end());
				cout << t << endl;
				return 0;
			}
			if(!used[*it]) {
				q[++qr] = *it;
				used[*it] = true;
				p[*it] = v;
			}
		}
	}
	return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

i64 n;

int solve(i64 now, bool is3, bool is5, bool is7) {
  if (now > n) return 0;
  int ret = (is3 && is5 && is7);
  ret += solve(now*10 + 3, true, is5, is7);
  ret += solve(now*10 + 5, is3, true, is7);
  ret += solve(now*10 + 7, is3, is5, true);
  return ret;
}

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

  cin >> n;
  cout << solve(0, false, false, false) << "\n";

  return 0;
}

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

int main() {
  int N, Y;
  cin >> N >> Y;
  int res10000 = -1, res5000 = -1, res1000 = -1;
  for (int a = 0; a <= N; ++a) {  // 10000円の枚数を 0 〜 N で調べる
    for (int b = 0; b + a <= N; ++b) {  // 5000円の枚数を 0 〜 N-a で調べる
      int c = N - a - b;  // 1000円の枚数は決まる
      int total = 10000*a + 5000*b + 1000*c;
      if (total == Y) {  // 答えが見つかったら
        res10000 = a;
        res5000 = b;
        res1000 = c;
      }
    }
  }

  // 答えを出力 (見つかっていなくても -1 -1 -1 になるので OK です)
  cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=2e5+7;
struct A
{
    int l,k,r;
}a[N];
int cmp(A a,A b)
{
    return a.k<b.k;
}


int main()
{
    int t,n;
    cin>>t;
    while(t--)
    {
        priority_queue<int,vector<int>,greater<int> >que;
        ll sum=0;
        ll now=0;
        int cnt=0;
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
            scanf("%d%d%d",&a[i].k,&a[i].l,&a[i].r);
        }
        sort(a+1,a+n+1,cmp);
        int j=1;
        for(int i=1;i<=n;i++)
        {
            while(j<=n&&a[j].k<=i)
            {
                if(a[j].l>=a[j].r)
                {
                    sum+=a[j].r;
                    que.push(a[j].l-a[j].r);
                }
                 j++;
            }
            while(que.size()>i)
            {
                que.pop();
            }
        }
        while(que.size())
        {
            sum+=que.top();
            que.pop();
        }
        j=n;
        for(int i=n;i>0;i--)
        {
            while(a[j].k>=i&&j)
            {
                if(a[j].r>a[j].l)
                {
                    sum+=a[j].l;
                    que.push(a[j].r-a[j].l);
                }
                j--;
            }

            while(que.size()>n-i)
                que.pop();
        }
        while(que.size())
		{
			sum+=que.top();
			que.pop();
		}
		cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 6320
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
#include <map>
using namespace std;

long long N, A, B, p[300009];

int main() {
	cin >> N >> A >> B;
	for (int i = 0; i <= N - B; i++) {
		long long L = A - i; if (L <= 0) continue;
		long long R = N - i;
		if (R > L*B || R < L + (B - 1)) continue;
		
		for (int j = 0; j < i; j++) p[j] = j + 1;
		int cx = N;
		for (int j = N - B; j <= N - 1; j++) { p[j] = cx; cx--; }
		int res = N - B - (L - 1);
		cx = N - B;
		for (int j = L - 2; j >= 0; j--) {
			long long G = res; if (G >= B - 1) G = B - 1;
			res -= G;
			int F = cx - 1;
			for (int k = cx - (G + 1); k <= cx - 1; k++) { p[k] = F + 1; F--; }
			cx -= (G + 1);
		}
		for (int j = 0; j < N; j++) {
			if (j) cout << " "; cout << p[j];
		}
		cout << endl;
		return 0;
	}
	cout << "-1" << endl;
	return 0;
}

Measured memory_bytes: 4480
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def gcd(a, b):
    """greatest common divisor"""
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def solve(f):
    t = f.read_int()
    ans = []

    def solve2():
        a, b, c, d = f.read_int_list()

        g1 = gcd(gcd(a, b), d)

        if d < b: return 'No'
        if a < b: return 'No'
        if b <= c+g1: return 'Yes'
        g2 = gcd(b, d)

        lo = ((c+1)-a)%g2
        if lo == 0 or lo + (b-c-1) >= g2: return 'No'

        return 'Yes'

    for _ in xrange(t):
        ans.append(solve2())

    return "\n".join(ans)


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


Measured memory_bytes: 36456
#include<iostream>
#include<iomanip>
#include<limits>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<cmath>


using namespace std;

typedef unsigned long long ull;
typedef long long ll;

#define big ((ll)(1e9)+7)


int main()
{
  int n;
  cin >> n;
  vector<int> x;
  ll sum = 0;
  for(int i = 0;i < n;i++)
  {
    int X;
    cin >> X;
    x.push_back(X);
    sum += X;
  }
  ll ave = sum/n;
  // ave++;
  ll ans = 0;
  for(int i = 0;i < n;i++)
  {
    ans += pow(x[i]-ave,2);
  }
  ll ans_1 = 0;
  ave++;
  for(int i = 0;i < n;i++)
  {
    ans_1 += pow(x[i]-ave,2);
  }
  cout << min(ans,ans_1) << endl;
}


Measured memory_bytes: 256
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)

const int M=1000000007;
const int MM=998244353;


 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e4+5;

ll sp[N];

void fill(){
  for(int i=1;i<N;i++)sp[i]=i;

    for(int i=2;i<N;i++){
      for(int j=i;j<N;j+=i){
        if(sp[j]==j)sp[j]=i;
      }
    }
}

vl f(N,1);


int main()
{ 

IOS;

ll n;cin>>n;

fill();


for(int i=1;i<=n;i++){
  ll cp=i;

  while(cp-1){
    ll x=sp[cp];
    f[x]++;
    cp/=x;
  }

}

ll ans=1;

for(int i=2;i<=n;i++){
  ans=ans*f[i]%M;
}

cout<<ans<<endl;


return 0;
 
}


Measured memory_bytes: 3792
#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 drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  int n,k;
  cin>>n>>k;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  vl v;
  rep(i,n-1){
    ll sum = a[i];
    v.push_back(sum);
    srep(j,i+1,n){
      sum+=a[j];
      v.push_back(sum);
    }
    
  }
  int m = sz(v);
  vi ok(m,1);

  ll ans = 0;
  drep(d,60){
    ll msk = 1LL<<d;
    int cnt=0;
    rep(i,m)if(v[i]&msk && ok[i])cnt++;
    if(k<=cnt){
      ans+=msk;
      rep(i,m)if(!(v[i]&msk)&&ok[i])ok[i]=0;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6260
from itertools import permutations

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

a, b = 0, 0
perms = sorted(permutations(list(range(1, n+1))))
for i, perm in enumerate(perms):
  if p == perm:
    a = i+1
  if q == perm:
    b = i+1
print(abs(a-b))


Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e18;
int main(){
	int M;cin>>M;
	long c,d; long n=0,sum=0;
	rep(i,0,M){
		cin>>d>>c;
		n+=c; sum+=c*d;
    }cout<<n-1+(sum-1)/9<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(x) (x).begin(),(x).end()

void solve(long long N, long long x, std::vector<long long> a){
  sort(ALL(a));
  int count = 0;
  REP(i, N) {
    if(x >= a[i]) {
      x -= a[i];
      if(!((i == (N-1)) && (x > 0))) count++;
    }
  }

  cout << count << endl;
  return;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long x;
  scanf("%lld",&x);
  std::vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
    solve(N, x, std::move(a));
    return 0;
}


Measured memory_bytes: 256
//run: g++ -std=c++14 -o run_sol.exe solution.cpp -DLOCAL_JUDGE
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

int main() {
    #ifdef LOCAL_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    for (int n, m; cin >> n >> m; ) {
        cout << ceil (n * 1.0 / m) << "\n";
    }

return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//#define max(x,y) ((x<y)?y:x)
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,m,k,l;
    cin>>n>>m>>k;
    ll a[200005]={0},b[200005]={0};
    a[0]=0,b[0]=0;
    for(int i=1;i<=n;i++)
    {
        
        cin>>l;
        a[i]=a[i-1]+l;
    }
    for(int i=1;i<=m;i++)
    {
        
        cin>>l;
        b[i]=b[i-1]+l;
    }
    ll j=0,x=m,mx=0;
    for( j=0;j<=n;j++)
    {
        
        while(b[x]+a[j]>k) x--;
        mx=max(mx,j+x);
       // cout<<mx<<endl;
    }
    cout<<mx<<endl;
    return 0;
} 

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

void solve()
{
    ll n,a,i;
    cin >> n;
    a=n%10;
    if(a==2 || a==4 || a==5 || a==7 || a==9)cout << "hon";
    else if(a==0 || a==1 || a==6 || a==8)cout << "pon";
    else cout << "bon";
}

int main()
{
    ll t,i;
    solve();

    return 0;
}



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

int main() {
    int a, b, c, buf;
    cin >> a >> b >> c;
    
    if (a > b) {
        buf = a;
        a = b;
        b = buf;
    }
    
    if (b > c) {
        buf = b;
        b = c;
        c = buf;
    }
    
    if (a > b) {
        buf = a;
        a = b;
        b = buf;
    }
    
    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 3112
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		for(;;){
		String x = scan.next();
		if(x.equals("0"))
			break;
		String b[] = x.split("");
		int i,m,ans;
		ans = 0;
		for(i = 0; i < x.length(); i++){
			for(m = 0; m <= 9; m++){
				Integer num = new Integer(m);
				String str2 = num.toString();
				if(b[i].equals(str2))
					ans += m;
			}
		}
		System.out.println(ans);
		}
		
	}
}

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


using namespace std;

int main()
{
    string x;
    cin>>x;
    int a[26]={};
    int s=0;
    for(int i=0;i<x.size();i++){
        a[x[i]-'a']++;
        if(a[x[i]-'a']==1)
            s++;
    }
    if(s>=26)
        puts("None");
    else{
        for(int i=0;i<26;i++){
            if(a[i]==0){
                char g=i+'a';
                cout<<g<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	
    public static void main(String[] args) {
    	Scanner scan=new Scanner(System.in);
    	int a=scan.nextInt();
    	int b=scan.nextInt();
    	String snuke[][]=new String[a][b];
    	int x=0;
    	int y=0;
    	for(int i=0;i!=a;i++) {
    		for(int j=0;j!=b;j++) {
    			snuke[i][j]=scan.next();
    			if(snuke[i][j].equals("snuke")) {
    				x=i+1;
    				y=j+1;
    			}
    		}
    	}
    	String ans="";
    	switch(y) {
    	case 1:ans="A";break;
    	case 2:ans="B";break;
    	case 3:ans="C";break;
    	case 4:ans="D";break;
    	case 5:ans="E";break;
    	case 6:ans="F";break;
    	case 7:ans="G";break;
    	case 8:ans="H";break;
    	case 9:ans="I";break;
    	case 10:ans="J";break;
    	case 11:ans="K";break;
    	case 12:ans="L";break;
    	case 13:ans="M";break;
    	case 14:ans="N";break;
    	case 15:ans="O";break;
    	case 16:ans="P";break;
    	case 17:ans="Q";break;
    	case 18:ans="R";break;
    	case 19:ans="S";break;
    	case 20:ans="T";break;
    	case 21:ans="U";break;
    	case 22:ans="V";break;
    	case 23:ans="W";break;
    	case 24:ans="X";break;
    	case 25:ans="Y";break;
    	case 26:ans="Z";break;
    	}
    	System.out.println(ans+""+x);
    }
}

Measured memory_bytes: 21844
/* _________________________________________________________________________________________________
  |                                                                                                 |
  |                             Author      : Aditya Ahuja                                          |
  |                             Date        : Mon, 20th Jan 2020                                    |
  |_________________________________________________________________________________________________|
*/
 
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define pb          push_back
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(int i = a; i < (int)b; i++)
#define req(i,a,b)  for(int i = (int)b - 1; i >= a; i--)
#define all(a)      (a).begin(),(a).end()
#define ret(x)      {cout << x << endl; return;}
#define sz(x)       (int)x.size()
#define type(x)     typeid(x).name()

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

int gcd(int a, int b) {return b?gcd(b,a%b):a;}

#ifdef LOCAL
	#define wa(x)       cerr << (#x) << " --- " << (x) << endl
	#define pvi(v)      {for(auto it:v) cerr << it << " "; cerr << endl;}
	#define line1	    cerr << "---------------------------" << endl;
#else
	#define wa //
	#define line1 //
	#define pvi //
	#define printf //
#endif

void solve();
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout << fixed << setprecision(10);

	int t=1; 
	// cin>>t;
	while(t--) solve();
	return 0;
}

//___________________________________________________________________________________________________

void solve() {

	int n;
	cin >> n;

	vector<string> s;
	vi t;

	rep(i,0,n){
		string ss; 
		int tt;
		cin >> ss >> tt;
		s.pb(ss);
		t.pb(tt);
	}

	string a;
	cin >> a;

	int tot = 0;
	int sum = accumulate(all(t), 0ll);

	rep(i,0,n){
		tot += t[i];
		if(s[i] == a) break;
	}

	ret(sum-tot);
}


Measured memory_bytes: 256
#include<iostream>
#include <string>
#include<vector>
typedef long long ll;

using namespace std;

int main()
{
	int n;
	int m;
	cin >>n>> m;
	int kotae = 1;
	
	for (int i = 1; i*i <= m; i++) {
		if (m%i == 0) {
			if (m / i >= n) {
				kotae =kotae>i?kotae:i;
			}
			if(i>=n){
				kotae =kotae> m/i? kotae : m / i;
			}
		}
	}
	cout << kotae;
	return 0;
}


Measured memory_bytes: 256
-- Your code here!
-- Your code here!

import Data.List.Split
import Data.List

-- Your code here!
main :: IO()
main = do
  ls <- getLines
  mapM_ putStrLn $ getMosts ls
  
getMosts :: [String] -> [String]
getMosts l = map (\(a,b) -> a) $ filter (\(a,b) -> b == maxnum) cs 
  where 
   cs = counts l
   maxnum = myMax cs

myMax :: [(String,Int)] -> Int
myMax l = maximum $ map (\(a,b) -> b) l

counts :: [String] -> [(String,Int)]
counts l = map count' es
  where
    es = nub l
    count' e = (e, count e l)

count e l = length $ filter (e==) l

getLines =  do
  s <- getContents
  return $ lines s



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

int main() {
  int N,M;
  cin >> N;
  vector<string> aka(N);
  vector<string> tmpstr;
  vector<int> tmpcount;

  for(int i=0; i<N; i++){
    cin >> aka.at(i);
    
    if(i==0){
      tmpstr.push_back(aka.at(0));
      tmpcount.push_back(1);
    }else{
      bool aflg = false;
      for(int j=0; j<tmpstr.size(); j++){
        if(tmpstr.at(j)==aka.at(i)){
          tmpcount.at(j)++;
          aflg = true;
          break;
        }
      }
      if(!aflg){
        tmpstr.push_back(aka.at(i));
        tmpcount.push_back(1);
      }
    }
  }

  cin >> M;

  for(int i=0; i<M; i++){
    string ao;
    cin >> ao;
    auto itr = find(tmpstr.begin(), tmpstr.end(), ao);
    if( itr != tmpstr.end() ) {
      int tmpindex = itr - tmpstr.begin();
      tmpcount.at(tmpindex)--;
    }
  }
  
  vector<int>::iterator iter = max_element(tmpcount.begin(), tmpcount.end());
  size_t index = distance(tmpcount.begin(), iter);
  int anser = tmpcount.at(index);

  if(anser < 0){
    anser = 0;
  }

  cout << anser << endl;
  
}


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

using ll = long long int;
typedef long double ld;
typedef pair<ll,ll> pll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest element(0-based)=> cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X => cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

#define sz(v) (ll)v.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()

bool is_palline(string s){
	string t=s;
	reverse(all(t));
	return s==t;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	string s;
	cin>>s;
	if(is_palline(s) and is_palline(s.substr(sz(s)/2+1)) and is_palline(s.substr(sz(s)/2+1,sz(s)/2)))cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("test/sample-1.in");

    int N;
    cin >> N;

    vector<int> A(N), B(N), C(N-1);
    for (int i=0; i<N; ++i) cin >> A[i];
    for (int i=0; i<N; ++i) cin >> B[i];
    for (int i=0; i<N-1; ++i) cin >> C[i];

    int sum = 0;
    for (int i=0; i<N; ++i) {
        sum += B[A[i]-1];
        if (i < N-1 && A[i]+1 == A[i+1]) {
            sum += C[A[i]-1];
        }
    }
    cout << sum << endl;

    return 0;
}

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

# define FOR(i,a,b) for (int i=(a);i<(b);i++)
# define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
# define REP(i, n) for (int i = 0; i < (int)(n); i++)
# define RREP(i,n) for (int i=(n)-1;i>=0;i--)

# define int(x) int x; scanf("%d",&x);
# define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;

using namespace std;

namespace utils{
  template <typename T> void print(vector<vector<T>> mat) {
    REP (i, mat.size()) {
      REP (j, mat[0].size()) cout << mat[i][j] << ' ';
      cout << endl;
    }
  }

  template <typename T> void print(vector<T> v) {
    REP (i, v.size())
      if (i >= v.size()-1)
	cout << v[i];
      else
	cout << v[i] << ' ';
    
    cout << endl;
  }

  template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
    int d1, d2;

    d1 = mat.size();
    if (d1 > 0) d2 = mat[0].size();
    else int d2 = 0;
    cout << "(" << d1 << ", " << d2 << ")" << endl;
    return make_pair(0, 0);
  }

  template <typename T> vector<vector<T>> empty(int n, int m) {
    vector<vector<T>> mat(n, vector<T>(m));
    return mat;
  }
}


int main() {
  vint(A,3);

  A[0] *= 100;
  A[1] *= 10;
  A[2] *= 1;

  int ans = A[0] + A[1] + A[2];
  if(ans%4 == 0){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(void){
  int N;
  cin >> N;
  int d[N]={};
  
  int i,j;
  int sum;
  for(i=0;i<N;i++){
    cin >> d[i]; 
  }
  for(i=0;i<N;i++){
    for(j=i+1;j<N;j++){
      sum += d[i]*d[j];
    }
  }
      
  printf("%d",sum); 
      
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[105];
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	double sum=0.0;
	for(int i=0;i<n;i++)
	sum+=1.0/(a[i]*1.0);
	cout<<1.0/sum; 
	return 0;
}


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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

const int ans = 7;

int f(char op, int a, int b) {
	return op == '+' ? a + b : a - b;	
}

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

	string abcd;
	cin >> abcd;

	int a = abcd[0] - '0';
	int b = abcd[1] - '0';
	int c = abcd[2] - '0';
	int d = abcd[3] - '0';

	string op = "+-";
	for (auto op1 : op) {
		for (auto op2 : op) {
			for (auto op3 : op) {
				int num = 0;
				num = f(op1, a, b);
				num = f(op2, num, c);
				num = f(op3, num, d);

				if (num == ans) {
					cout << a << op1 << b << op2 << c << op3 << d << "=" << ans;
					return 0;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int soinx(int in,int x) {
	int cnt=0;
	while(!(in%x)) {
		in/=x;
		cnt++;
	}
	return cnt;
}

int main(void) {
	unsigned long long num2=0,num5=0;
	int in;
	while(1) {
		scanf("%d",&in);
		if(!in) return 0;
		for(;in>0;in--){
			num2+=soinx(in,2);
			num5+=soinx(in,5);
		}
		if(num2>num5) printf("%lld\n",num5);
		else printf("%lld\n",num2);
		num2=num5=0;
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
bool f(int N, int X, int C, int D)
{
    for (long long i = 0; i <= N-1; i++) {
        long long j = N - 1 - i;
        if (i * C - j * D <= X && X <= i * D - j * C) {
            return true;
        }
    }
    return false;
}

int main()
{
    int N, A, B, C, D; cin >> N >> A >> B >> C >> D;
    cout << (f(N, B - A, C, D) ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
import fractions
from functools import reduce
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
    
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
 
 
N, M = map(int,input().split())
A = list(map(int,input().split()))
 
#if gcd(*A) % 2 != 0:
    #print(0)
    #exit(0)
 
#sisu_2 = factorization(A[0])[0][1] 
 
#lcm_a = lcm(*A)
#lcm_a_half = lcm_a // 2
lcm_a = lcm(*A) // 2
 
l = []
sisu_a0 = 0
flag = 0
for i in range(N):
    sisu = 0
    while A[i]%2==0:
        A[i] //= 2
        sisu += 1
    
    if sisu_a0==0:
        sisu_a0 = sisu
    else:
        if sisu_a0!=sisu:
            flag = 1
#if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:
#if factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:
if flag == 1 or lcm_a > M:
    print(0)
    exit(0)
else:
    print(int((M-lcm_a) // (lcm_a*2) + 1))

Measured memory_bytes: 16348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
ll dp[100*1000+5][3];
ll max(ll a, ll b){
	if(a>b) return a;return b;
}

int main(){
	cin>>N;
	ll a, b, c;
	for(int j = 0;j<3;j++)
		cin>>dp[0][j];
	
	for(int i = 1;i<N;i++){
		cin>>a>>b>>c;
		
		dp[i][0] = a + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = b + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = c + max(dp[i-1][0], dp[i-1][1]);
	}
	cout<<max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]))<<endl;
}

Measured memory_bytes: 2560
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>n>>a>>b;
    if(a>=b){
        cout<<"delicious"<<endl;
    }else if(b-a<=n){
        cout<<"safe"<<endl;
    }else{
        cout<<"dangerous"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

void swap(long *x, long *y);

int main(){
	long x, y, temp;
	scanf("%ld", &x);
	scanf("%ld", &y);

	if( x < y ){
		temp = x;
		x = y;
		y = temp;
	}
	else{
		//none
	}

	while(y>0){
		temp = x % y;
		x = y;
		y = temp;
	}

	printf("%ld\n", x);

	return 0;
}

Measured memory_bytes: 592
N=int(input())
A=tuple(map(int,input().split()))
B=list(map(int,input().split()))
from heapq import heappop,heappush
q=[]
a=0
for i,b in enumerate(B):
    heappush(q,(-b,i))
while len(q)>0:
    b,i=heappop(q)
    ba=-b-A[i]
    bb=B[i-1]+B[i+1-N]
    if ba<0:
        a=-1
        break
    elif ba==0:
        continue
    elif -b>bb:
        x,y=divmod(ba,bb)
        if x==0:
            a=-1
            break
        B[i]-=bb*x
        if y>0:
            heappush(q,(-B[i],i))
        a+=x
    else:
        a=-1
        break
print(a)

Measured memory_bytes: 125084
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
 
int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a*b,c*d) << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main()
{
    int N,counter=0;
    cin>>N;
    char *S=new char[N];
    for(int i=0;i<N;i++)
        cin>>S[i];

    for(int i=0;i<=N-3;i++){
        if (S[i]=='A' && S[i+1]=='B' && S[i+2]=='C')
            counter++;
    }
    cout<<counter;

 return 0;
}

Measured memory_bytes: 256
def main():
    s = input()
    n = len(s)
    ret = [0] * n
    for i in range(n-1):
        if s[i:i+2] == "RL":
            for j in range(i, -1, -1):
                if s[j] == "R":
                    ret[i + (i-j) % 2] += 1
                else:
                    break
            for j in range(i+1, n):
                if s[j] == "L":
                    ret[i + (j-i) % 2] += 1
                else:
                    break
    
    print(" ".join(map(str, ret)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 10484
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    ll N;
    cin >> N;
    string S;
    map<string, ll> map;

    for (ll i = 0; i < N; ++i) {
        cin >> S;
        map[S] += 1;
    }
    ll max = 0;

    for(auto v : map){
        if(v.second >= max){
            max = v.second;
        }
    }

    for(auto v : map){
        if(v.second == max){
            cout << v.first << endl;
        }
    }
}

Measured memory_bytes: 17664
N = int(input())
A = list(map(int, input().split()))

B=[]

if(N%2==0):
    for i in range(N-1,-1,-2):
        print(A[i],end=" ")
    for i in range(0,N,2):
        print(A[i],end=" ")
        
else:
    for i in range(N-1,-1,-2):
        print(A[i],end=" ")
    for i in range(1,N,2):
        print(A[i],end=" ")


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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    for i in range(1, N):
        if A[i-1] == A[i]:
            print("NO")
            exit()
    print("YES")


if __name__ == '__main__':
    main()


Measured memory_bytes: 25172
#include <stdio.h>
int main(void){
    
    int a;
    int b;
    int c;
    int max;
    
    scanf("%d%d%d", &a, &b, &c);
    
    max = b / a;
    
    if(c<max){
        
        printf("%d", c);
        
        return 0;
    }
    
    printf("%d", max);
    
    return 0;
    
}

Measured memory_bytes: 128
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    csum = [[0] * 20 for _ in range(N + 1)]
    for i in range(N):
        for j in range(20):
            csum[i + 1][j] = csum[i][j] + (1 if A[i] & (1 << j) else 0)

    def is_ok(l, r):
        res = True
        for j in range(20):
            if csum[r][j] - csum[l][j] > 1:
                res = False
                break
        return res

    ans = 0
    right = 0
    for left in range(N):
        while right < N and is_ok(left, right + 1):
            right += 1

        ans += right - left

        if left == right:
            right += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


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

int main() {
  string s;
  cin>>s;

  set<char> chars;
  for (char c: s) {
    chars.insert(c);
  }
  if (chars.size() == 1) {
    cout<<0<<endl;
    return 0;
  }

  int ans = 100;
  for (char c: chars) {
    string t1(s), t2(s);
    int n = s.length() - 1;
    while (true) {
      bool flag = true;
      for (int i=0; i<n; i++) {
        if (t1[i] == c || t1[i+1] == c) {
          t2[i] = c;
        } else {
          t2[i] = t1[i];
          flag = false;
        }
      }
      if (flag) {
        ans = min(ans, (int)s.length() - n);
        break;
      }
      --n;
      t1 = string(t2);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const ll MN = 200 + 10;
const ll mod = 1e6;


int main()
{
	faster();
	int a , b;
	cin >> a >> b;
	cout << max(max(a * b, a + b), a - b) << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class main{
    public static void Main(String[] args){
        int n = int.Parse(Console.ReadLine());
        List<int> lst = new List<int>();

        for(int i = 0;i < n;i++){
            int x = int.Parse(Console.ReadLine());
            if(primeNumbers(x)){
                lst.Add(x);
            }
        }

        Console.WriteLine(lst.Count);
    }

    internal static bool primeNumbers(int n){
        if(n == 2){
            return true;
        }

        if(n < 2 || n % 2 == 0){
            return false;
        }

        int i = 3;

        while(i <= Math.Sqrt(n)){
            if(n % i == 0){
                return false;
            }
            i += 2;
        }

        return true;
    }
}

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

int main(){
    int k; cin >> k;
    if(k%2 == 0) {
        cout << -1 << endl;
        return 0;
    }
    int a[1000001] = {0};
    a[1] = 7%k;
    for(int i = 2; i <= k; i++) a[i] = (10*a[i-1] + 7)%k;

    for(int i = 1; i <= k; i++) {
        if(a[i] == 0) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

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

int dp[1130][15][200];
bool flg[1130];
vector<int> p;

void mkPrime(void){
	memset(flg,1,sizeof(flg));
	flg[0] = flg[1] = 0;

	REP(i,2,1121){
		if(flg[i]){
			for(int j=i*2;j<=1120;j+=i){
				flg[j] = false;
			}
		}
	}
}

int rec(int n,int k,int idx){
	if(n == 0 && k == 0) return 1;
	if(n < 0 || k < 0) return 0;
	if(dp[n][k][idx]!=-1) return dp[n][k][idx];

	int res = 0;
	for(int i=idx;p[i]<=n;i++){
		res += rec(n-p[i],k-1,i+1);
	}
	return dp[n][k][idx]=res;
}

int main(void){
	memset(dp,-1,sizeof(dp));
	mkPrime();
	rep(i,1130) if(flg[i]) p.push_back(i);

	int n,k;
	while(cin>>n>>k && (n||k)){
		cout<<rec(n,k,0)<<endl;
	}

	return 0;
}

Measured memory_bytes: 13000
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>

typedef long long ll;

using namespace std;

int main(){
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> av;
    vector<ll> bv;
    for(int i = 0; i < n; i++){
        if(i == 0){
           ll x;
           cin >> x;
           av.push_back(x);  
        } else {
            ll x;
            cin >> x;
            av.push_back(x + av[i - 1]);  
        }
    }
    for(int i = 0; i < m; i++){
        if(i == 0){
           ll x;
           cin >> x;
           bv.push_back(x);  
        } else {
            ll x;
            cin >> x;
            bv.push_back(x + bv[i - 1]);
        }
    }

    int cnt = 0;
    int ans = 0;
    
    int av_s = (int)av.size();
    int bv_s = (int)bv.size();

    for(int i = av_s - 1; i >= 0; i--){
         while(bv[cnt] + av[i] <= k){
            ans = max(ans, cnt + i + 2);
            cnt++;
            if(cnt == bv_s) break;
         }
         if(cnt == bv_s) break;
    }
    
    for(int i = 0; i < n; i++){
        if(av[i] <= k) ans = max(ans, i + 1);
    }

    for(int i = 0; i < m; i++){
        if(bv[i] <= k) ans = max(ans, i + 1);
    }
   
    cout << ans << endl;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int par[100001];
vector<int> nodes[100001];
vector<int> come[100001];
bool visited[100001] = {};

void init(){
    rep(i, 100001) par[i] = 0;
}

void toposort(int s, vector<int> &order){
    visited[s] = true;
    for(auto to: nodes[s]){
        if(visited[to]) continue; //探索済み -> スキップ
        toposort(to, order);
    }
    //再帰を抜け出すときにorderに追加
    order.push_back(s);
}

int main(void){
    vector<int> order;
    int N, M; cin >> N >> M;
    rep(i, N-1+M){
        int a, b; cin >> a >> b;
        nodes[a].push_back(b);
        come[b].push_back(a);
    }
    for(int i = 1; i <= N; i++){
        if(!visited[i]) toposort(i, order);
    }
    reverse(order.begin(), order.end());
    rep(i, order.size()){
        for(auto to: nodes[order[i]]){
            par[to] = order[i];
        }
    }
    for(int i = 1; i <= N; i++) cout << par[i] << endl;
    return 0;
}

Measured memory_bytes: 15996
//
//  main.cpp
//  Hello_world
//
//  Created by Anshum Gupta on 19/07/20.
//  Copyright © 2020 Anshum Gupta. All rights reserved.
//

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long ll;
int r, c, k;
const int mxN = 3e3+2;
ll dp[mxN][mxN][4];
ll v[mxN][mxN];
const ll mxx = 1e18;
ll rec(int i, int j, int curRowCount) {
    if(i >= r || j >= c || curRowCount > 3)return -mxx;
    if(i == r-1 && j == c-1) {
        if(curRowCount == 3)return 0;
        return v[i][j];
    }
    if(dp[i][j][curRowCount] != -1) return dp[i][j][curRowCount];
    if(curRowCount == 3) {
        return dp[i][j][curRowCount] = max(rec(i+1, j, 0), rec(i, j+1, 3));
    }
    if(v[i][j] == 0) {
        return dp[i][j][curRowCount] = max(rec(i+1, j, 0), rec(i, j+1, curRowCount));
    }
    ll o1 = rec(i+1, j, 0) + 1LL*v[i][j];
    ll o2 = rec(i, j+1, curRowCount + 1) + 1LL*v[i][j];
    ll o3 = rec(i, j+1, curRowCount);
    return dp[i][j][curRowCount] = max(o1, max(o2, o3));
}
void solve(){
    cin >> r >> c >> k;
    memset(dp, -1, sizeof(dp));
    memset(v, 0, sizeof(v));
    for(int i=0; i<k; i++){
        int x, y, val;
        cin >> x >> y >> val;
        x--; y--;
        v[x][y] = val;
    }
    ll ans = rec(0, 0, 0);
    cout << ans << endl;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(nullptr);
    solve();
    return 0;
}


Measured memory_bytes: 356108
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int digit(int a){
	int ret = 0;
	while(a > 0){
		ret += a % 10;
		a /= 10;
	}
	return ret;
}

int n;

int main(){
	scanf("%d", &n);
	int ans = INF;
	for(int i = 1; i < n; i++){
		ans = std::min(ans, digit(i) + digit(n-i));
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256