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

#define MAX 1400
int H, W;
int c[MAX][MAX];
int ans = 0, DP[MAX][MAX];

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			DP[i][j] = (c[i][j] + 1) % 2;
			ans = max(ans, DP[i][j]);
		}
	}
	for (int i = 1; i < H; i++) {
		for (int j = 1; j < W; j++) {
			if (c[i][j]) {
				DP[i][j] = 0;
			} else {
				DP[i][j] = min(DP[i - 1][j - 1], min(DP[i - 1][j], DP[i][j - 1])) + 1;
				ans = max(ans, DP[i][j]);
			}
		}
	}
	cout << ans * ans << endl;
	return 0;
}



Measured memory_bytes: 18404
n = int(input())
a = list(str(n))
m = int(a[0])*100 + int(a[0])*10 + int(a[0]) 
o = (int(a[0])+1)*100 + (int(a[0])+1)*10 + (int(a[0])+1)
if m < n: 
 print(o)
else:
 print(m)




Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MAX_N 100000
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-48);
}
int n; lnt l, c[MAX_N+5];
lnt a[MAX_N+5], b[MAX_N+5];
lnt sl[MAX_N+5], sr[MAX_N+5];
lnt f[2][MAX_N+5], g[2][MAX_N+5];
int main() {
	read(n), read(l);
	for (int i = 1; i <= n; i++)
		read(a[i]), b[i] = l-a[i], read(c[i]);
	for (int i = 1; i <= n; i++) sl[i] = sl[i-1]+c[i];
	for (int i = n; i >= 1; i--) sr[i] = sr[i+1]+c[i];
	for (int i = 1; i <= n; i++)
		f[0][i] = max(f[0][i-1], sl[i]-a[i]), 
		f[1][i] = max(f[1][i-1], sl[i]-2*a[i]);
	f[0][n+1] = f[0][1], f[1][n+1] = f[1][1];
	for (int i = n; i >= 1; i--)
		g[0][i] = max(g[0][i+1], sr[i]-b[i]), 
		g[1][i] = max(g[1][i+1], sr[i]-2*b[i]);
	g[0][0] = g[0][1], g[1][0] = g[1][1];
	lnt mx = 0;
	for (int p = 0, q = 1; p <= n; p++, q++)
		mx = max(mx, f[0][p]+g[1][q]), 
		mx = max(mx, f[1][p]+g[0][q]);
	return printf("%lld\n", mx), 0;
}


Measured memory_bytes: 7296
X, N = map(int, input().split())
ans = X
if N>0:
  P = list(map(int, input().split()))
  P.sort()
  if X in P:
    ans = 0
    x = P.index(X)
    i = 1
    a = x-1
    b = x+1
    m = min(P[N-1]-X, X-P[0])
    for i in range(1,m+2):
      if a < 0:
        a = 0
      if b > N-1:
        b = N-1
      if X-i != P[a]:
        ans = X-i
        break
      elif X+i != P[b]:
        ans = X+i
        break
      else:
        a -= 1
        b += 1
print(ans)

Measured memory_bytes: 9232
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int x1,y1,x2,y2,x3,y3,x4,y4;
    int dx, dy;
    cin >> x1 >> y1 >> x2 >> y2;
    dx = x2 - x1;  //(dx, dy) 始点1終点2のベクトル
    dy = y2 - y1;
    x3 = x2 - dy; //(-dy, dx) 
    y3 = y2 + dx;
    x4 = x3  -dx; //(-dx, -dy)
    y4 = y3 - dy;
    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4; 
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main(){
    int a,b,h; cin >> a >> b >> h;
    print((a + b) * h / 2);
}

Measured memory_bytes: 256
// コピペ元
// https://www.creativ.xyz/segment-tree-entrance-999/
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
using namespace std;
#define int long long
constexpr int UNIT = 0;
constexpr int N_ALP = 'z' - 'a' + 1;
constexpr int alp2int(char c) { return c - 'a'; };

int N; // 葉の数

void update(int i, int x, vector<int> &value)
{
    // i 番目の葉の値を x に変える
    i += N - 1; // i 番目の葉のノード番号
    value[i] = x;
    while (i > 0)
    {
        i = (i - 1) / 2; // ノード i の親ノードの番号に変える
        value[i] = value[i * 2 + 1] +
                   value[i * 2 + 2]; // 左右の子の min を計算しなおす
    }
}

int query(int a, int b, int k, int l, int r, vector<int> &value)
{
    // [a, b) の区間に対するクエリについて
    // ノード k （区間 [l, r) 担当）が答える
    if (r <= a || b <= l)
        return UNIT; // 区間が被らない場合は UNIT を返す
    if (a <= l && r <= b)
        return value[k]; // ノード k の担当範囲がクエリ区間 [a, b)
                         // に完全に含まれる
    else
    {
        int c1 = query(a, b, 2 * k + 1, l, (l + r) / 2, value); // 左の子に値を聞く
        int c2 = query(a, b, 2 * k + 2, (l + r) / 2, r, value); // 右の子に値を聞く
        return c1 + c2;                                         // 左右の子の値の min を取る
    }
}

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

    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;

    array<vector<int>, N_ALP> trees;
    N = 1;
    while (N < n)
        N *= 2; // 葉の数を計算（n以上の最小の2冪数

    for (auto &&i : trees)
        i = vector<int>(2 * N - 1, UNIT);

    for (int i = 0; i < n; i++)
    {
        update(i, 1, trees[alp2int(s[i])]);
    }

    for (int i = 0; i < q; i++)
    {
        int op;
        cin >> op;
        if (op == 1)
        {
            int j;
            char c;
            cin >> j >> c;
            j--;

            if(c==s[j])
                continue;

            update(j, 1, trees[alp2int(c)]);
            update(j, 0, trees[alp2int(s[j])]);
            s[j] = c;
        }
        else
        {
            int l, r;
            cin >> l >> r;
            l--;

            int count = 0;
            for (auto &&t : trees)
            {
                int q = query(l, r, 0, 0, N, t);
                if (q > 0)
                    count++;
            }

            cout << count << "\n";
        }
    }
}


Measured memory_bytes: 214044
// Gaurav Aggarwal
 
/*
useful stl
array<ll,size> ar;         //size(),front(),back(),fill(),empty()
deque<ll> d                //push_back(),push_front(),pop_front(),pop_back()
vector<ll> v(size,val);    //push_back(),*max_element(v.begin(),v.end()),accumulate(v.begin(),v.end(),0)
stack<ll> g;               //push(),pop(),top(),size(),empty()         LIFO
queue<ll> q;               //push(),size(),front(),back(),empty()      FIFO
priority_queue<ll> pq
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}

ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

    ll a,b,c,d;

    cin>>a>>b>>c>>d;

    ll numc = b/c - (a-1)/c;
    ll numd = b/d - (a-1)/d;

    ll gc = __gcd(c,d);
    ll lc = (c*d)/gc;
    // cout<<(c*d)/gc<<"\n";

    ll f = b/lc - (a-1)/lc;

    ll ans = (b - a + 1) + f - numc - numd;
    cout<<ans<<"\n"; 

    return 0;
}   

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

int main(){
  ll n;
  cin>>n;
  ll X[n], Y[n], H[n];
  vector<tuple<ll, ll, ll>> vec(n);
  
  tuple<ll, ll, ll> g = make_tuple(-1, -1, -1);
  for(ll i=0;i<n;i++){
    cin>>X[i] >>Y[i] >>H[i];
    if(H[i]>0)g = make_tuple(X[i], Y[i], H[i]);
  }
  
  for(ll x=0;x<=100;x++)for(ll y=0;y<=100;y++){
    ll h = max(get<2>(g) + abs(get<0>(g) - x) + abs(get<1>(g) - y), 0ll);
    bool ok = true;
    for(ll i=0;i<n;i++){
      ll hi = max(h - abs(X[i]-x) - abs(Y[i]-y), 0ll);
      if(H[i]!=hi)ok=false;
    }
    if(ok){
      cout<<x<<" "<<y<<" "<<h<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll n, k;

int main() {
	cin >> n;
	vector<ll> s(n);
	REP(i, n)cin >> s[i];
	sort(ALL(s));
	cout << s[n / 2] - s[n / 2 - 1];
}


Measured memory_bytes: 1024
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = input[0][0];

  return N === N.split("").reverse().join("") ? "Yes" : "No";
};

console.log(main(read()));


Measured memory_bytes: 29700
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}


int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    
    return ret;
}


int main(){
    int N,Q;
    string S;
    cin >>N>>Q>> S;
    int l[Q],r[Q];

    FOR(i,Q){
        cin >> l[i]>>r[i];
    }

    int cs[N+1];
    cs[0]=0;
    bool tmp=false;
    for(int i=0;i<N;i++){
        
        if(S[i]=='C'&&tmp){
            cs[i+1]=cs[i]+1;
            tmp=false;
        }else if(S[i]=='A'){
            tmp=true;
            cs[i+1]=cs[i];
        }else{
            tmp=false;
            cs[i+1]=cs[i];
        }
    }
   
    FOR(i,Q){
        cout << cs[r[i]]-cs[l[i]] <<endl;
    }

    //std::cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	int n,a,b;
	cin>>n;
	if(n==1)cout<<"Hello World"<<endl;
	else
	{
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}

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

p = sorted([v - (i + 1) for i, v in enumerate(A)])

if len(p) >= 3:
    res = min(sum(map(abs, [i - p[N//2] for i in p])), sum(map(abs, [i - p[N//2-1] for i in p])), sum(map(abs, [i - p[N//2+1] for i in p])))
elif len(p) >= 2:
    res = min(sum(map(abs, [i - p[0] for i in p])), sum(map(abs, [i - p[1] for i in p])))
else:
    res = 0
print(int(res))

Measured memory_bytes: 27632
//file_name:ABC74_C.cpp
#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 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 sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#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 vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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


    int ans = 0;

    ans = n*n-m;

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
# coding: utf-8
import string

n = int(input())
a = list(map(int,input().split()))
res = 1
for i in range(n):
    res *= a[i]
    if(res>pow(10,18)):
      	break

if(res<=pow(10,18)):
    print(res)
elif(0 in a):
    print(0)
else:
    print(-1)


Measured memory_bytes: 23080
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
from operator import attrgetter, itemgetter

# import math

# from numba import jit
# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    s = input()
    first = int(s[0:2])
    second = int(s[2:4])

    mm = [False] * 2

    if 1 <= first <= 12:
        mm[0] = True

    if 1 <= second <= 12:
        mm[1] = True

    if mm[0] and mm[1]:
        print("AMBIGUOUS")
    elif mm[0]:
        print("MMYY")
    elif mm[1]:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const ll INF = 	922337203685477580;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始
ll dp[100010];

int main(){
  int k,t;
  cin>>k>>t;
  int a[t];
  for(int i = 0; i < t; i++) cin>>a[i];
  sort(a,a+t);
  reverse(a,a+t);
  int mx_cnt=a[0];
  int other = k-mx_cnt;
  int ans;
  ans = max(mx_cnt-1-other,0);
  // if(mx_cnt%(other+1)!=0){
  //   ans=mx_cnt/(other+1);
  // }
  // else{
  //   ans=mx_cnt/(other+1)-1;
  // }
  cout<<ans<<endl;
  return 0;
}


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

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
using vi  = vector<int>;
using vvi = vector<vi>;

int main(){
  int n, m, t, p;
  while(cin >> n >> m >> t >> p, n){
    vvi paper(600, vi(600));
    rep(i,n) rep(j,m) paper[i][j] = 1;

    int x = 0, y = 0;
    rep(_,t){
      int d, c;
      cin >> d >> c;
      if(d == 1){
	FOR(i,x,x+c) FOR(j,y,y+m){
	  paper[(x+c)+(x+c-1-i)][j] += paper[i][j];
	}
	x += c;
      }else{
	FOR(i,x,x+n) FOR(j,y,y+c){
	  paper[i][(y+c)+(y+c-1-j)] += paper[i][j];
	}
	y += c;
      }
    }

    rep(_,p){
      int xq, yq;
      cin >> xq >> yq;
      cout << paper[x+xq][y+yq] << endl;
    }
  }
}


Measured memory_bytes: 4132
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


X = read_a_int()
# 買うことのできる値段はXは100*N<=X<=105*Nのはず。
for n in range(1000):
    if 100 * n <= X <= 105 * n:
        print(1)
        exit()
else:
    print(0)


Measured memory_bytes: 3064
#if os(Linux)
    import Glibc
#else
    import Foundation
    import Darwin
#endif

#if swift(>=4.0)
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

prefix operator *
prefix func * <T> (a: [T]) -> (T, T) { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T) { return (a[0], a[1], a[2]) }
#else
func readInts() -> [Int] {
    return readLine()!.split(" ").map { Int($0)! }
}

prefix operator * {}
prefix func * <T> (a: [T]) -> (T, T) { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T) { return (a[0], a[1], a[2]) }

extension String: CollectionType {}
#endif


let (A, B) = *readInts()

print(max(A + B, A - B, A * B))


Measured memory_bytes: 4208
N,M=map(int,input().split())
d = [list(map(int,input().split())) for _ in range(M)]

d.sort(key=lambda x:x[1])
ans=0
c=0
for i in range(M):
    a,b=d[i]
    if a>=c:
        ans+=1
        c=b
print(ans)



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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    st s ;

    cin >> s ;

    if ( s == "SUN")
    {
        cout << 7 ;
    }
    else if ( s == "MON")
    {
        cout << 6 ;
    }
    else if ( s == "TUE")
    {
        cout << 5 ;
    }
    else if (s == "WED")
    {
        cout << 4 ;
    }
    else if ( s == "THU")
    {
        cout << 3 ;

    }
    else if (s == "FRI")
    {
        cout << 2 ;
    }
    else if (s == "SAT")
    {
        cout << 1 ;
    }


    return 0 ;
}



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

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	vector<int> b(n);
	for(int i=n-1;i>=0;i--){
		int c=0;
		for(int j=2*(i+1);j<=n;j+=(i+1)){
			if(b[j-1])c^=1;
		}
		if(a[i]!=c)b[i]=1;
	}
	vector<int> ans;
	for(int i=0;i<n;i++){
		if(b[i])ans.push_back(i+1);
	}
	cout << ans.size() << endl;
	for(int i=0;i<ans.size();i++){
		cout << ans[i] << " " ; 
	}
	cout << endl;
}

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

#define MAX 100

double gaiseki( double x1, double y1, double x2, double y2, double xp, double yp )
{
        double vector_P_1_x = xp - x1;
        double vector_P_1_y = yp - y1;
        double vector_P_2_x = xp - x2;
        double vector_P_2_y = yp - y2;

        return vector_P_1_x*vector_P_2_y - vector_P_1_y*vector_P_2_x;
}

int main()
{
        double x1, x2, x3, xp, y1, y2, y3, yp;
        double a, b, c;
        while ( scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp ) != EOF )
        {
                a = gaiseki( x1, y1, x2, y2, xp, yp );
                b = gaiseki( x2, y2, x3, y3, xp, yp );
                c = gaiseki( x3, y3, x1, y1, xp, yp );
                if ( ( ( a > 0 ) && ( b > 0 ) && ( c > 0 ) ) || ( (a < 0 ) && ( b < 0 ) && ( c < 0 ) ) )
                {
                        fprintf( stdout, "YES\n");
                }
                else
                {
                        fprintf( stdout, "NO\n");
                }
        }

        return 0;
}

Measured memory_bytes: 608
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

using namespace std;

int main() {

	long n, m, count = 0;


	cin >> n >> m;

	n = n - 1;
	m = m - 1;
	if (m % n != 0)count++;


	cout << count + m / n << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main(){
	int N , M;
	cin >> N >> M;
	vector<P> PY(M),py(M);
	for(int i=0;i<M;i++){
		cin >> PY[i].first >> PY[i].second;
		py[i] = PY[i];
	}
	sort(py.begin(),py.end());
	map<P , int> ans;
	int pre = py[0].first;
	int index = 0;
	for(int i=0;i<M;i++){
		if(pre == py[i].first){
			index++;
			ans[py[i]] = index;
		}else{
			index = 1;
			pre = py[i].first;
			ans[py[i]] = index;
		}
	}
	for(int i=0;i<M;i++)printf("%06d%06d\n",PY[i].first , ans[PY[i]]);
	return 0;
}


Measured memory_bytes: 9344
from itertools import chain, islice
 
R = lambda: map(int, input().split())
n, k = R()
v = list(R())
a = sorted((x, i) for i, x in enumerate(v) if x < 0)
ans = max(sum(v[m] for m in chain(range(i - j), range(n - j, n))) -
          sum(islice((x for x, m in a if m < i - j or m >= n - j), k - i))
          for i in range(1, min(n, k) + 1) for j in range(i))
print(ans)


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>
using namespace std;


#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define ALL(x) (x).begin(),(x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(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;
		}
	}
	bool findSet(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)];
	}
};

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll digitsum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
int getdigit(ll a) {
	return to_string(a).size();
}
int countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}



int main() {
	IOS;
	int n;
	cin >> n;
	deque<ll> que;
	REP(i, n) {
		ll s;
		cin >> s;
		if (i % 2 == 0) {
			que.push_front(s);
		}
		else {
			que.push_back(s);
		}
	}
	if (n % 2 == 0)reverse(ALL(que));
	REP(i, que.size()) {
		if (i)cout << ' ';
		cout << que[i];
	}
	cout << endl;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
const long inf = 2e9;
int n, m, k;
long a[200001];
long b[200001];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int j = 0; j < m; ++j) cin >> b[j];
  a[n] = inf;
  b[m] = inf;
  
  int j = 0;
  long sum = 0;
  while (sum + b[j] <= k) {
    sum += b[j];
    ++j;
  }
  
  int mx = j;
  for (int i = 0; i < n; ++i) {
    sum += a[i];
    while (sum > k && j > 0) {
      --j;
      sum -= b[j];
    }
    if (sum > k) break;
    mx = max(mx, i + 1 + j);
  }
  cout << mx << endl;
}

Measured memory_bytes: 6688
#include <bits/stdc++.h>
using namespace std;
char s[2005][2005];
int h[2005][2005];
int w[2005][2005];
int main(void){
	int H,W;
	cin >> H >> W;
	for(int i=0;i<H;i++)cin >> s[i];
	int ans = 0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(s[i][j]=='.'&&h[i][j]==0){
				h[i][j]++;
				int nx = i + 1;
				while(s[nx][j]=='.'){
					h[i][j]++;
					nx++;
				}
				for(int k=i;k<nx;k++){
					h[k][j]=h[i][j];
				}
			}
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(s[i][j]=='.'&&w[i][j]==0){
				w[i][j]++;
				int ny = j + 1;
				while(s[i][ny]=='.'){
					ny++;
					w[i][j]++;
				}
				for(int k=j;k<ny;k++){
					w[i][k]=w[i][j];
				}
			}
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(s[i][j]=='.')ans=max(ans,w[i][j]+h[i][j]);
		}
	}
	cout << ans-1 << endl;
}

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

int main() {
    int n,T,x,m,a;
    cin >> n >> T;
    vector<int> t(n);
    for(int i =0; i < n; i++) cin >> t[i];
    m = T; a = x = 0;
    if(n == 1) {
        cout << T << endl;
        return 0;
    }
    for(int i = 1; i < n; i++) {
        if(t[i] <= m) {
            m = t[i] + T; 
            if(i == n-1) x += m - a;
        }
        else {
            x += m - a;
            a = t[i] ;
            m = t[i] + T;
            if(i == n-1) x += T;
            
        }
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n; cin >> n;
    VI a(n); cin >> a;

    VI x(n, 0);
    ll ans = 0; bool ng = false;
    rFOR(i, 0, n) {
        if (i < a[i])ng = true;
        if (i != n - 1)x[i] = x[i + 1] - 1;
        if (a[i] < x[i])ng = true;
        if (chmax(x[i], a[i]))ans += a[i];
    }
    cout << (ng ? -1 : ans) << "\n";
}

Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lim 200005
#define pb push_back
#define S second
#define pb push_back
#define mp make_pair
#define INF 1e18
#define fr(i,j,k) for(ll i=j;i<=k;i++)
#define frd(i,j,k) for(ll i=j;i>=k;i--)
#define F first
#define sd(n) scanf("%lld",&n)
#define pd(n) printf("%lld\n",n)
#define db double
#define mod 1000000007
#define pii pair<ll,ll>
ll getans(ll n,ll k)
{  if(k==1)
  return n+1;  
  ll ans=n;
  for(ll i=0;i<=(k-2);i++)
    ans*=(n-i);
  return ans;
}
int main()
{
  char a,b;
  cin>>a>>b;
  if(a=='H')
  {
    cout<<b;
  }
  else
  {
    if(b=='H')
      cout<<"D";
    else cout<<"H";
  }
}

Measured memory_bytes: 256
N=int(input())
A=[]
for i in range(N):
  x,y=map(int, input().split())
  A.append((x,y))

def c(P1, P2, P3):
    x1, y1 = P1; x2, y2 = P2; x3, y3 = P3
    a = 2*(x1 - x2); b = 2*(y1 - y2); p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2*(x1 - x3); d = 2*(y1 - y3); q = x1**2 - x3**2 + y1**2 - y3**2
    det = a*d - b*c
    x = d*p - b*q; y = a*q - c*p
    if det < 0:
        x = -x; y = -y; det = -det
    if det!=0:
      x /= det; y /= det
    r = ((x - x1)**2 + (y - y1)**2)**0.5
    return x,y,r
  
ans=(200000)**2
for i in range(N-1):
  for j in range(i+1,N):
    f=0
    x1,y1=A[i][0],A[i][1]
    x2,y2=A[j][0],A[j][1]
    x,y=(x1+x2)/2,(y1+y2)/2
    r=((x1-x)**2+(y1-y)**2)**0.5
    for a,b in A:
      d=((a-x)**2+(b-y)**2)**0.5
      if d>r:
        f=1
        break
    if f==0:
      ans=min(ans,r)
f=0

if N>2:
  for i in range(N-2):
    for j in range(i+1,N-1):
      for k in range(j+1,N):
        f=0
        x,y,r=c(A[i],A[j],A[k])
        for a,b in A:
          d=((a-x)**2+(b-y)**2)**0.5
          if d>r:
            f=1
            break
        if f==0:
          ans=min(ans,r)
print(ans)


Measured memory_bytes: 9720
n, m = map(int, input().split())
X = list(map(int, input().split()))

if m <= n:
    print(0)
    exit()

X.sort()
Y = []
for i in range(m-1):
    y = X[i+1]-X[i]
    Y.append(y)
Y.sort()
#print(Y)
ans = sum(Y[0:m-(n-1)-1])
print(ans)


Measured memory_bytes: 90868
/* * * * * * * * * * * **
*                      *
*	   saurabh8522	   *
*	  I will handle	   *
*		   IT.		   *
*                      *
* * * * * * * * * * * **/
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ld long double
#define zero(a) memset((a),0,sizeof((a)))
#define one(a) memset((a),1,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)))
#define all(g) g.begin(),g.end()
#define ppb pop_back
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll numdigit(ll n){return floor(log10(n)) + 1;}
bool isPowerTwo (ll x) { return x && (!(x&(x-1))); } 
int  main(){
	// FastRead;
	ll t=1;
	// cin>>t;
	while(t--){
		ll n;
		cin>>n;
		int a[4];
		zero(a);
		for(int i=0;i<n;i++){
			int b;
			cin>>b;
			a[b]++;
		}
		double dp[n+5][n+5][n+5];
		zero(dp);
		for(int i=0;i<=n;i++){
			for(int j=0;j<=n;j++){
				for(int k=0;k<=n;k++){
					if(i!=0) dp[i][j][k]+= (double)i/(i+j+k)*dp[i-1][j+1][k];
					if(j!=0) dp[i][j][k]+= (double)j/(i+j+k)*dp[i][j-1][k+1];
					if(k!=0) dp[i][j][k]+= (double)k/(i+j+k)*dp[i][j][k-1];
					if(i+j+k!=0) dp[i][j][k]+=(double)n/(i+j+k);
					// cout<<i<<" "<<j<<" "<<k<<endl;
				}

			}
		}
		cout<<std::setprecision(16)<<dp[a[3]][a[2]][a[1]]<<endl;
	}
}

Measured memory_bytes: 221952
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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


int stoia(string a){
	int ret = 0;
	int sc = 1;
	rep(i,a.size()){
		ret += (a[a.size()-1-i]-'0')*sc;
		sc*=10;
	}
	return ret;
}

int main(){
	
	int n;
	cin>>n;
	
	rep(lp, n){
		string a;
		cin>>a;
		
		sort(a.begin(),a.end());
		
		string b = a;
		
		reverse(a.begin(),a.end());
		
		string c = a;
		
		printf("%d\n",stoia(c)-stoia(b));
	}
	
}

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

int main() {
	double n;
	cin >> n;
	vector<double> vec(n);
	for (int i = 0; i < n; i++) cin >> vec.at(i);
	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());
	stack<double> nabe;
	for (int i = 0; i < n; i++) nabe.push(vec.at(i));
	while (nabe.size() > 1) {
		double a, b;
		a = nabe.top();
		nabe.pop();
		b = nabe.top();
		nabe.pop();
		nabe.push((a + b) / 2);
	}
	cout << nabe.top() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int A; // 500yen
	int B; // 100yen
	int C; //  50yen 
	int X;

	cin >> A >> B >> C >> X;
	
	int equal_X_count = 0;

	for (int i = 0 ; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			for (int k = 0; k <= C; k++) {

				if (500 * i + 100 * j + 50 * k == X) {
					equal_X_count++;
				}
			}
		}
	}
	
	cout << equal_X_count << endl;
	return 0;
}

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

using namespace std;

int main(){
	string X,Y;
	
	cin >> X >> Y;
	
	if(X==Y)	cout << "=" << endl;
	if(X>Y)		cout << ">" << endl;
	if(X<Y)		cout << "<" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
using namespace  std;

struct StCst
{
  int m_nNo;
  int m_nSeq;
  bool m_bDone;

  static bool AsdNo(const StCst &cnroLeft, const StCst &cnroRight) 
  { return cnroLeft.m_nNo < cnroRight.m_nNo; }
};

void fnInput(vector<StCst> &rvoSort)
{
  int nMaxSiz, nCnt = 0;
  cin >> nMaxSiz;

  rvoSort.resize(nMaxSiz);
  for (int i = 0; i < nMaxSiz; i++)
  {
    cin >> rvoSort[i].m_nNo;
    rvoSort[i].m_nSeq = nCnt++;
  }
}

void fnMinCostSort(vector<StCst> &rvoSort, int &rnSwpCnt)
{
  sort(begin(rvoSort), end(rvoSort), StCst::AsdNo);
  int nMinNo = rvoSort[0].m_nNo;

  int nCost;
  for (int i = 0; i < rvoSort.size(); i++)
  {
    if (rvoSort[i].m_bDone)  continue;

    int nTotal  = rvoSort[i].m_nNo;
    int nCurMin = rvoSort[i].m_nNo; 
    int nCurSize = 1;
    rvoSort[i].m_bDone = true;

    int j = rvoSort[i].m_nSeq;
    while  (rvoSort[j].m_nNo != rvoSort[i].m_nNo)
    {
      nTotal += rvoSort[j].m_nNo;
      nCurSize++;
      rvoSort[j].m_bDone = true;
      j = rvoSort[j].m_nSeq;
    }

    if (nCurSize == 1)
        nCost = 0;
    else
        nCost = min(nTotal + (nCurSize - 2) * nCurMin, 
                    nTotal + nCurMin + (nCurSize + 1) * nMinNo);
    rnSwpCnt += nCost;
  }
}

void fnResult(int nSwpCnt)
{
  cout << nSwpCnt << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<StCst> voSort;

  fnInput(voSort);

  int nSwpCnt = 0;
  fnMinCostSort(voSort, nSwpCnt);

  fnResult(nSwpCnt);
  return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>   
using namespace std;
#define N 3005   
#define REP(i, n) for(int i=0; i<n; i++)
long n;
long a[100000];
long ans,en;
long cou;
long gcd(long i,long j){
   if(i<j){
    int tmp = i;
    i = j;
    j = tmp;
  }
 
  /* ユークリッドの互除法 */
  long r = i % j;
  while(r!=0){
    i = j;
    j = r;
    r = i % j;
  }
   return j;
}
int main(){
    cin >> n;
    REP(i,n){
        cin >>a[i];
    }
    sort(a,a+n);
    ans=gcd(a[0],a[1]);
    for(int i=2;i<n;i++){
        ans=gcd(a[0],a[i]);
        if(ans==1)break;
    }
    printf("%ld",ans);
}




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

class Main{
	public static void main(String args[]) throws Exception{
		FScanner sc=new FScanner();
		int[] arg=sc.readIntL();
		int n=arg[0];
		int t=arg[1];
		
		int[][] path=new int[n][2];
		int[] buf=new int[2];
		for(int i=0; i<n; i++){
			buf=sc.readIntL();
			path[i][0]=buf[0];
			path[i][1]=buf[1];
		}
		
		int mx=1001;
		
		for(int i=0; i<n; i++){
			if(path[i][0]<mx && path[i][1]<=t){
				mx=path[i][0];
			}
		}
		System.out.println((mx==1001)? "TLE": mx);
	}
	
	static void solve(int cur, int nx, int en, int hld){}

	static void disp(int[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
	
	static void disp(String[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%s ",data[i]);
		}
			System.out.println();
	}
	
	static void disp(long[] data){
		for(int i=0; i<data.length; i++){
				System.out.printf("%d ",data[i]);
		}
			System.out.println();
	}
	
	static class FScanner{
		BufferedReader read=null;
		StringTokenizer tok=null;
		Scanner sc;
		FScanner() throws FileNotFoundException{
			sc=new Scanner(System.in);
		}
		boolean hasNextLine(){
			boolean has=true;
			if(!sc.hasNextLine()){
				has=false;
			}
			return has;
		}
		int readInt(){
			String buf=sc.nextLine();
			return Integer.parseInt(buf);
		}
		long readLong(){
			long i=Long.parseLong(sc.nextLine());
			return i;
		}
		int[] readIntL(){
			String[] buf=sc.nextLine().split(" ");
			int[] num=new int[buf.length];
			for(int i=0; i<buf.length; i++){
				num[i]=Integer.parseInt(buf[i]);
			}
			return num;
		}
		
		String readString(){
			return sc.nextLine();
		}
		String[] readStringL(String dlm){
			String[] s=sc.nextLine().split(dlm);
			return s;
		}
	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int N,Y;
    cin >> N >> Y;
    int a,b,c;
    for(a = 0; a < N+1; a++){
        for(b = 0; b < (N+1-a); b++){
            c = N - a - b;
                if(Y == a*10000+b*5000+c*1000){
                    cout << a << " " << b << " " << c << endl;
                    return 0;
                }
            }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

if S[0] == "A":
    count = 0
    for c in S[2:-1]:
        if c == "C":
            count += 1

    if count == 1:
        count = 0
        for c in S:
            if str(c).isupper():
                count += 1
        
        if count == 2:
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[200010][3],n,d,ans=0;
int main(){
	cin>>n>>d;
	for(int i=1;i<=n;i++) cin>>a[i][1]>>a[i][2];
	for(int i=1;i<=n;i++){
		double x,y,z;
		x=a[i][1];
		y=a[i][2];
		z=sqrt(x*x+y*y);
		if(z<=d) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5992
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k:usize,
        mut a:[usize;n],
    }
    a.sort();

    let mut l = 0;
    let mut r = a[n-1];

    while l+1 < r{
        let mid = (l+r)/2;
        
        let mut tmp = 0;
        for e in &a{
            tmp += (*e - 1)/mid;
        }

        if tmp > k{
            l = mid;
        }else{
            r = mid;
        }
    }
    println!("{}",r);
}


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


#define int long long int
#define ff first
#define ss second
#define pb push_back

#define N 1010

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    int ans = 1e18;
    for(int i = 2; i <= sqrt(n); ++i)
    {
    	if(n % i == 0)
    	{
    		ans = min(ans, n / i + i);
    	}
    }
    if(ans == 1e18)
    	cout << n - 1 << "\n";
    else
    	cout << ans - 2 << "\n";
    return 0;	
}

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

int main() {
  string N;
  cin >> N;
  
  if ( (N[1] == N[2]) && ( (N[0] == N[1]) || (N[3] == N[1]) ) ) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n,m; cin >> n >> m;
    vvl v(m,vl(2)); rep(i,m) rep(j,2) cin >> v[i][j];
    rep(i,1000){
        string s = to_string(i);
        if(s.size()!=n) continue;
        bool flag = true;
        rep(j,m) if(s[v[j][0]-1] - '0' != v[j][1]) flag = false;
        if(flag){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>

struct tree: std::vector<std::vector<size_t>> {
  tree(size_t n): std::vector<std::vector<size_t>>(n) {}

  void connect_with(size_t src, size_t dst) {
    (*this)[src].push_back(dst);
    (*this)[dst].push_back(src);
  }
};

std::vector<intmax_t> nya(const tree& g, intmax_t mod) {
  size_t n = g.size();
  std::vector<size_t> parent(n, -1);
  std::vector<std::vector<intmax_t>> dp0(n), dp1(n);
  std::vector<intmax_t> dp(n);
  for (size_t i = 0; i < n; ++i) {
    dp0[i].resize(g[i].size()+1, 1);
    dp1[i].resize(g[i].size()+1, 1);
  }

  std::function<intmax_t (size_t, size_t)> dfs0 = [&](size_t v, size_t p) {
    intmax_t res = 1;
    for (size_t i = 0; i < g[v].size(); ++i) {
      size_t u = g[v][i];
      if (u == p) {
        parent[v] = i;
        continue;
      }
      intmax_t tmp = (dfs0(u, v) + 1) % mod;
      (res *= tmp) %= mod;
      dp0[v][i+1] = tmp;
      dp1[v][i] = tmp;
    }
    return res;
  };
  dfs0(0, -1);

  std::function<void (size_t, size_t, size_t)> dfs1 = [&](size_t v, size_t p, size_t pi) {
    if (v != 0) {
      intmax_t tmp = (dp0[p][pi] * dp1[p][pi+1] + 1) % mod;
      dp0[v][parent[v]+1] = tmp;
      dp1[v][parent[v]] = tmp;
    }
    {
      for (size_t i = 1; i < dp0[v].size(); ++i)
        (dp0[v][i] *= dp0[v][i-1]) %= mod;
      for (size_t i = dp1[v].size()-1; i--;)
        (dp1[v][i] *= dp1[v][i+1]) %= mod;
      dp[v] = dp1[v][0];
    }
    for (size_t i = 0; i < g[v].size(); ++i) {
      size_t u = g[v][i];
      if (u != p) dfs1(u, v, i);
    }
  };
  dfs1(0, -1, -1);

  return dp;
}

int main() {
  size_t N;
  intmax_t M;
  scanf("%zu %jd", &N, &M);

  tree g(N);
  for (size_t i = 1; i < N; ++i) {
    size_t x, y;
    scanf("%zu %zu", &x, &y);
    --x;
    --y;
    g.connect_with(x, y);
  }

  auto dp = nya(g, M);
  for (size_t i = 0; i < N; ++i)
    printf("%jd\n", dp[i]);
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define repd(i,a,b) for (ll i = (a); i < (b); i++)
#define INF LLONG_MAX
#define mod 1000000007
typedef long long ll;

int main(void)
{
	int N, M;
	cin >> N >> M;
	int s[M];
	int c[M];
	int a[N];
	rep(i, N) a[i] = -1;
	rep(i, M)
	{
		cin >> s[i] >> c[i];
		s[i]--;
	}

	rep(i, M)
	{
		if(a[s[i]]!=-1)
		{
			if(a[s[i]]!=c[i])
			{
				cout << -1 << endl;
				return 0;
			}
		}
		a[s[i]] = c[i];
	}

	if(N==1 && (a[0]==-1 || a[0]==0))
	{
		cout << 0 << endl;
		return 0;
	}
	if(a[0]!=0)
	{
		if(a[0]==-1) a[0] = 1;
		repd(i, 1, N) if(a[i]==-1) a[i] = 0;
	}
	else
	{
		cout << -1 << endl;
		return 0;
	}

	rep(i, N) cout << a[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

N = int(input())
s = [0, 4, 7, 8, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ]
if N in s:
    print("Yes")
else:
    print("No")


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

int main(){
  int N;
  cin>>N;
  
  int A[N];
  for(int i=0;i<N;++i)cin>>A[i];
    
  string ans="APPROVED";
  for(int i=0;i<N;++i){
    int testnum=A[i];
    if(testnum % 2==0){
      if(!((testnum % 3==0) || (testnum % 5==0))){
        ans="DENIED";
      }
    }
  }

  
  
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define MOD 1000000007 
#define INF 1000000000000000000
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <ll> A(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
		A[i] += A[i - 1];
	}
	ll ans = INF;
	int lo, hi, p;
	ll sum;
	auto diff = [&] (int x, ll c) {
		return abs((A[x] - c) - (sum - (A[x] - c)));
	};
	for (int i = 2; i <= n - 2; i++) {
		ll mn = INF, mx = 0;
		auto update = [&] (ll x) {
			mn = min(mn, x);
			mx = max(mx, x);
		};
		// part from 1...i
		lo = 1, hi = i - 1;
		sum = A[i];
		p = -1;
		while(lo <= hi) {
			int mid = (lo + hi) / 2;
			if(diff(mid, 0) <= diff(mid + 1, 0)) {
				p = mid;
				hi = mid - 1;
			}
			else {
				lo = mid + 1;
			}
		}
		update(A[p]);
		update(A[i] - A[p]);
		// part from i + 1 .... n
		lo = i + 1, hi = n - 1;
		sum = A[n] - A[i];
		p = -1;
		while(lo <= hi) {
			int mid = (lo + hi) / 2;
			if(diff(mid, A[i]) <= diff(mid + 1, A[i])) {
				p = mid;
				hi = mid - 1;
			}
			else {
				lo = mid + 1;
			}
		}
		update(A[p] - A[i]);
		update(sum - (A[p] - A[i]));
		ans = min(ans, mx - mn);
	}
	cout << ans;
}


Measured memory_bytes: 1792