akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb(x) push_back(x)

typedef pair<ll,ll> pp;
int lcm(int a, int b)
{
    int lar = max(a, b);
    int small = min(a, b);
    for (int i = lar; ; i += lar) {
        if (i % small == 0)
            return i;
    }
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b) {
    return (a.second < b.second);
}

ll f(char x, ll r, ll s, ll p){
    if(x == 's') return r;
    else if(x == 'r') return p;
    else return s;
}

void solve(){
    ll n, a, b; cin >> n >> a >> b;
    if(abs(b-a)%2 == 0) cout << (abs(b-a))/2 << endl;
    else {
        cout << min(min(a,b) - 1 + 1 + (abs(b-a)-1)/2, n - max(a,b) + 1 + (abs(b-a)-1)/2) << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //ll t; cin >> t; while(t--)
        solve();
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long long ll;
typedef long double ld;

const ll inf = (long long)1e18 + 100;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 4005;
int n, x;
int a[maxn], s[maxn][maxn];

bool read() {
  if (scanf("%d%d", &n, &x) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

void solve() {
  for (int i = 0; i < n; i++) {
    a[i + n] = a[i];
  }
  for (int i = 0; i < 2 * n; i++) {
    s[i][i + 1] = a[i];
    for (int j = i + 2; j <= 2 * n; j++) {
      s[i][j] = min(s[i][j - 1], a[j - 1]);
    }
  }
  long long ans = inf;
  for (int k = 0; k < n; k++) {
    long long cur = (long long)k * x;
    for (int i = 0; i < n; i++) {
      cur += s[i + n - k][i + n + 1];
    }
    ans = min(ans, cur);
  }
  printf("%lld\n", ans);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen("text.in", "r", stdin));
  assert(freopen("text.out", "w", stdout));
#endif

  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time: %.18f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 45440
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#include <array>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__)
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int dp[61][200000];
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    ll k;
    cin >> n >> k;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    rep(i,n)dp[0][i] = a[i]-1;
    rep(i,60){
        rep(j,n){
            dp[i+1][j] = dp[i][dp[i][j]];
        }
    }
    int now = 0;
    for(int i = 60; i >= 0; i--){
        if(k>>i&1)now = dp[i][now];
    }
    cout << now + 1 << endl;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

const int MAX = 5100000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1]            = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i]  = fac[i - 1] * i % MOD;
        inv[i]  = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
    lint x, y;
    cin >> x >> y;
    COMinit();
    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    } else {
        dd(x, y);
        int s = (-x + 2 * y) / 3, t = (2 * x - y) / 3;
        dd(s, t);
        if (s < 0 or t < 0) {
            cout << 0 << endl;
            return 0;
        } else {
            cout << COM(s + t, t) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 119808
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
    cin>>b[i];
  int sum = 0;
  for(int i=0;i<n;i++)
    sum += max(0,a[i]-b[i]);
  cout<<sum;
  return 0;
}
  

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;
using P = std::pair<int, int>;

ll N;
std::vector<P> ps;

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

  if( N % 2 == 0 )
  {
    rep( i, N )
    {
      repi( j, i+1, N ) if( i != j && i+j != N-1 )
      {
        ps.emplace_back( P( i+1, j+1 ) );
      }
    }
  }
  else
  {
    rep( i, N )
    { 
      repi( j, i+1, N ) if( j == N-1 || i+j != N-2 )
      {
        ps.emplace_back( P( i+1, j+1 ) );
      }
    }
  }

  std::cout << ps.size() << std::endl;

  for( auto p : ps )
    std::cout << p.first << ' ' << p.second << std::endl;

  return 0;
}

Measured memory_bytes: 384
n = int(input())
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append((b,a))
L.sort()    
#print(L)
t = 0
for i in range(n):
    t +=L[i][1]
    #print(t,L[i][0])
    if t > L[i][0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 35252
#include <iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    int ans = 0;
    for(int j = 0; j < S.size(); j++){
        int tmp = 0;
        for(int i = j; i < S.size(); i++){
            if(S[i] ==  'A' || S[i] ==  'G' ||S[i] ==  'C' ||S[i] ==  'T') tmp++;
            else break;
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H-1:
            print("#" * W)
        else:
            print("#" + "." * (W-2) + "#")
    print()


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

void main() {
  long N, K;
  readf("%d %d\n", &N, &K);
  ulong[] cnt = new ulong[100000];
  foreach (i; 0..N) {
    long a, b;
    readf("%d %d\n", &a, &b);
    a--;
    cnt[a] += b;
  }
  foreach (i; 1..cnt.length) {
    cnt[i] += cnt[i-1];
  }
  writeln(search(cnt, K, 0, cast(long)cnt.length-1)+1);
}

long search(ulong[] a, long K, long min, long max) {
  if (min + 1 == max && a[min] < K && a[max] >= K) return max;
  if (min == 0 && a[min] >= K) return min;
  long c = (min + max) / 2;
  if (a[c] < K) return search(a, K, c, max);
  return search(a, K, min, c);
}


Measured memory_bytes: 3068
import sys
sys.setrecursionlimit(10 ** 7)

def dfs(v,p,dist):
    for u,w in tree[v]:
        if u==p:
            continue
        else:
            dist[u]=dist[v]+w
            dfs(u,v,dist)
    
n =int(input())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    u,v,w =map(int, input().split())
    tree[u-1].append((v-1,w))
    tree[v-1].append((u-1,w))
dist =[0]*n
dfs(0,-1,dist)

for num in dist:
    if num % 2==0:
        print("1")
    else:
        print("0")


Measured memory_bytes: 82220
import java.util.Scanner;

public class Main{
	static int ans = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		//int n=sc.nextInt();
		String s=sc.next();
		int count=0;
		//String put="";
		for(int i=0;i<s.length();i++) {
			if(s.substring(i, i+1).equals("A")||s.substring(i, i+1).equals("C")||s.substring(i, i+1).equals("G")||s.substring(i, i+1).equals("T")) {
				count++;
				ans=Math.max(ans, count);
			}else {
				count=0;
			}
		}


		System.out.println(ans);
	}
}


Measured memory_bytes: 22868
from math import gcd
k=int(input())
ans=0
# rangeはk回なのでk+1
for i in range(1,k+1):
    for j in range(1,k+1):
        # シンプルにiとjの最大公約数
        ans_=gcd(i,j)
        for l in range(1,k+1):
            # で一番内側のループ内でgcd(i,j)を計算すると余計に計算することになる
            ans+=gcd(ans_,l)
print(ans)

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

int main() {
    int N; cin >> N;
    int ans=0;
    int count=0;
    for(int i=1; i<N+1; i++){
        if(i%2==1){
            for(int j=1; j<i+1; j++){
                if(i%j==0) count++;
            }
            if(count==8) ans++;
        }
        count=0;
    }
    cout << ans << endl;
}

  


  

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main()
{
	int W, H;
	int x, y, r;
	
	cin >> W >> H >> x >> y >> r;
	
	if ((x - r) < 0 || (x + r) > W || (y - r) < 0 || (y + r) > H){
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;

int search(int a[], int n, int key){
    int i = 0;
    a[n] = key;
    while(a[i] != key) i++;
    return i != n;
}
int main(){
    int n,q,ans = 0;
    cin >> n;
    int s[n+1];
    REP(i,n) cin >> s[i];
    cin >> q;

    REP(i,q){
        int t;
        cin >> t;
        if(search(s,n,t)) ans++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 3136
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int t[100000], a[100000];
	for (int i = 0; i < n; i++)
	{
		cin >> t[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int l[100000], r[100000];
	l[0] = t[0];
	r[0] = t[0];
	for (int i = 1; i < n; i++)
	{
		if (t[i] > t[i - 1])
		{
			l[i] = t[i];
			r[i] = t[i];
		}
		else
		{
			l[i] = 1;
			r[i] = r[i - 1];
		}
	}
	l[n - 1] = max(l[n - 1], a[n - 1]);
	r[n - 1] = min(r[n - 1], a[n - 1]);
	for (int i = n - 2; i >= 0; i--)
	{
		if (a[i] > a[i + 1])
		{
			l[i] = max(l[i], a[i]);
			r[i] = min(r[i], a[i]);
		}
		else
		{
			l[i] = max(l[i], 1);
			r[i] = min(r[i], r[i + 1]);
		}
	}
	long long int ans = 1;
	for (int i = 0; i < n; i++)
	{
		// cout << l[i] << " " << r[i] << endl;
		ans = (ans * (max(0, r[i] - l[i] + 1))) % mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int mochiCount = int.Parse(Reader.ReadLine());
        List<int> moti = new List<int>();
        for (int i = 0; i < mochiCount; i++) {
            moti.Add(int.Parse(Reader.ReadLine()));
        }
        int ans = moti.Distinct().Count();
        Console.WriteLine(ans);
        
    }


    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"



7
50
30
50
100
50
80
30


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13152
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int dx[] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1};
int dy[] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1};
int dz[] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1};
int n,m,p;
int data[8][8][8];
int high[8][8];
int bnum,wnum;
void bpush(int x,int y,int col){
	data[x-1][y-1][high[x-1][y-1]] = col;
	high[x-1][y-1]++;
}

bool inrange(int x,int y,int z){
	return (x>-1&&y>-1&&z>-1&&x<n&&y<n&&z<n);
}
bool subcheck(int x,int y,int z,int col,int num,int d){
	if(num==1) return true;
	else{
		int nx = x+dx[d]; int ny = y+dy[d]; int nz = z+dz[d];
		if(!inrange(nx,ny,nz)) return false;
		if(data[nx][ny][nz]==col) return subcheck(nx,ny,nz,col,num-1,d);
		else return false;
	}
	return true;//dummy
}
void dprint(){
	cout << "----------" << endl;
	REP(i,n){
		REP(j,n){
			REP(k,n){
				if(data[j][k][i]==2) cout << "B ";
				else if(data[j][k][i]==1) cout <<"W ";
				else if(data[j][k][i]==0) cout <<  "X ";
 			}
 			cout << endl;
		}
		cout << endl;
	}
}
void check(){
	REP(i,n){REP(j,n){REP(k,n){
		REP(l,13) if(data[i][j][k]==2) bnum+=subcheck(i,j,k,2,m,l);
	}}}
	REP(i,n){REP(j,n){REP(k,n){
		REP(l,13) if(data[i][j][k]==1) wnum+=subcheck(i,j,k,1,m,l);
	}}}
}
int main(){
	while(1){
		cin >> n >> m >> p;
		if(n==0&&m==0&&p==0) break;
		bnum = 0; wnum = 0;
		REP(i,8){
			REP(j,8){
				REP(k,8) data[i][j][k] = 0;
				high[i][j] = 0;
			}
		}
		bool endflg = false;
		REP(i,p){
			int x,y;
			cin >> x >> y;
			if(i%2==0) bpush(x,y,2);//black
			else bpush(x,y,1);//white

			check();
			//dprint();
			if(!endflg){
				if(bnum!=wnum) endflg = true;
				if(bnum<wnum) cout << "White " << i+1 << endl;
				else if(bnum>wnum) cout << "Black " << i+1 << endl;
			}
		}
		//cout << bnum << " " << wnum << endl;
		if(!endflg) cout << "Draw" << endl;
 	}
 }

Measured memory_bytes: 1164
N = int(input())
H = list(map(int, input().split()))

ans = 0
zero = 0

for h in H:
    if h == 0:
        zero += 1

while zero < N:
    flg = False
    cnt = 0

    for i in range(N):
        if H[i] > 0:
            flg = True
            H[i] -= 1

            if H[i] == 0:
                zero += 1
        else:
            if flg:
                cnt += 1
                flg = False

    if flg:
        cnt  += 1

    ans += cnt


print(ans)


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  ll r;
  cin >> r;
  r *= r;
  r *= 3LL;
  cout << r << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
int main(){
	char s[105000];
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	char cur = s[1];int ans = 0;
	for(int i = 2; i <= n; i++)
		if(cur != s[i]) cur = s[i], ans++;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 508
#include <stdio.h>
int main()
{
	char moji[100];
  	int i;
	scanf("%s",moji);
	for(i=0; moji[i]!='\0'; ++i);
   	if(i==2){
      printf("%c",moji[0]);
      printf("%c",moji[1]);
    }
    if(i==3){
      printf("%c",moji[2]);
      printf("%c",moji[1]);
      printf("%c",moji[0]);
    }
	return 0;
}

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

namespace ITP1_9_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            string line = ReadSt();
            char[] lineAr = line.ToArray();
            int n = ReadInt();

            for (int i = 0 ; i < n ; i++)
            {

                string[] com = ReadStAr();

                int s = int.Parse(com[1]);
                int t = int.Parse(com[2]);

                switch (com[0])
                {
                    case "print":
                        Console.WriteLine(String.Join("",lineAr.Select(x => x.ToString()).ToArray()).Substring(s,t-s+1));
                        break;

                    case "reverse":
                        char[] rev = new char[t-s+1];
                        for (int j = s ; j <= t ; j++)
                        {
                            rev[j-s] = lineAr[t-(j-s)];
                        }
                        for (int j = s ; j <= t ; j++)
                        {
                            lineAr[j] = rev[j-s];
                        }
                        break;

                    case "replace":
                        for (int j = s ; j <= t ; j++)
                        {
                            lineAr[j] = com[3][j-s];
                        }
                        break;
                }
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 18332
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define exact(x) { return (x); }
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl

#define sum(v) accumulate(all(v), 0)
#define stlice(s, l) substr(s, (s) + (l) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define MOD (1e9 + 7)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

// clang-format on

main {
  int n, t;
  cin >> n >> t;
  vi h(n);
  rep(i, n) cin >> h[i];
  int c = t;
  if (n > 1) {
    loop(i, 1, n) { c += min(t, h[i] - h[i - 1]); }
  }
  cout << c << endl;
  bye;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
string s,a,b;
int main()
{
	ios::sync_with_stdio(false);
	cin>>s;
	int ans=0;
	for(int i=0;i<s.size();i++)
	{
		b+=s[i];
		if(b!=a)
		{
			ans++;
			a=b;
			b="";
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h> 
using namespace std; 
 
int main() 
{ 
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double ang_h,ang_m;
    double pi=3.14159265358979323846;
    ang_h=pi*h/6;
    ang_h+=pi*m/360;
    ang_m= m*pi/30;
    ang_h=abs(ang_h-ang_m);
    double ans;
    ans=sqrt(a*a+b*b+-2*a*b*cos(ang_h));
    cout<<fixed<<setprecision(20)<<ans;
}

Measured memory_bytes: 4108
#include <iostream>
#include <vector>

int main(void)
{
    std::vector<int> primes = {2};

    int k;
    std::cin >> k;

    for (int i = 3; primes.back() < k; i+=2)
    {
        bool isprime = true;

        for (int p : primes)
        {
            if (i < p * p) break;

            if (i % p == 0) {
                isprime = false;
                break;
            }
        }

        if (isprime) primes.emplace_back(i);
    }

    std::cout << primes.back() << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

#define EPS 1e-10

typedef pair<string, double> PD;

bool compare(const PD &a, const PD &b){
  if(fabs(a.second - b.second) < EPS) return a.first < b.first;
  return a.second > b.second;
}

int main(){
  int N;
  while(cin >> N, N){
    vector<PD> fruits;
    fruits.clear();
    string L;
    int P, A, B, C, D, E, F, S, M;
    for(int cs = 0 ; cs < N ; cs++){
      cin >> L >> P >> A >> B >> C >> D >> E >> F >> S >> M;
      int ABC = A+B+C;
      int DE = D+E;
      int total_value = S * F * M - P;
      int total_time = ABC + (DE*M);
      double v = (double)((double)total_value / (double)total_time);
      fruits.push_back(PD(L, v));
    }
    sort(fruits.begin(), fruits.end(), compare);
    
    for(int i = 0 ; i < N ; i++){
      cout << fruits[i].first << endl;
    }
    cout << "#" << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		ll M, T, P, R;
		cin>>M>>T>>P>>R;
		if(M == 0 && T == 0 && P == 0 && R == 0) break;
		vector<vector<ll> > wa(T, vector<ll>(P, 0));
		vector<vector<ll> > tm(T, vector<ll>(P, -1));
		REP(i, R) {
			ll m, t, p, j;
			cin>>m>>t>>p>>j;
			--t;
			--p;
			if(j == 0) {
				tm[t][p] = m;
			} else {
				++wa[t][p];
			}
		}
		vector<pair<pair<ll, ll>, ll> > ans(T, pair<pair<ll, ll>, ll>(pair<ll, ll>(0, 0), 0));
		REP(i, T) {
			ans[i].second = i + 1;
		}
		REP(i, T) {
			REP(j, P) {
				if(tm[i][j] != -1) {
					++ans[i].first.first;
					ans[i].first.second -= tm[i][j];
					ans[i].first.second -= wa[i][j] * 20;
				}
			}
		}
		sort(ALL(ans), greater<pair<pair<ll, ll>, ll> >());
		REP(i, T) {
			cout<<ans[i].second;
			if(i + 1 < T && ans[i].first == ans[i + 1].first) {
				cout<<'=';
			} else if(i + 1 < T) {
				cout<<',';
			}
		}
		cout<<endl;
	}
}

Measured memory_bytes: 3124
def gcd(x, y)
  if x < y
    t = x
    x = y
    y = t
  end
  if y == 0
    return x
  else
    r = x % y
    gcd(y, r)
  end
end

x, y = gets.split.map(&:to_i)
puts gcd(x, y)


Measured memory_bytes: 6872
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		if((N-1) % (K-1) == 0)
			System.out.println((N-1)/(K-1));
		else
			System.out.println((N-1)/(K-1)+1);
	}

}

Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N=0,count=0;
    cin >> N;
    vector<long long> ok = {3,5,7};
    while(ok.back() <= N){
        int end = ok.size();
        for(int i=0; i<end; i++){
            ok.push_back(ok.at(i)*10 + 3);
            ok.push_back(ok.at(i)*10 + 5);
            ok.push_back(ok.at(i)*10 + 7);
        }
    }
    sort(ok.begin(), ok.end());
    ok.erase(unique(ok.begin(), ok.end()), ok.end());
    for(int i=0; i<ok.size(); i++){
        long long temp = ok.at(i);
        if(temp > N)continue;
        bool pure=true,has3=false,has5=false,has7=false;
        int x = temp%10;
        if(x!=3 && x!=5 && x!=7)pure=false;
        if(x==3)has3=true;
        if(x==5)has5=true;
        if(x==7)has7=true;
        while(temp >= 10){
            temp /= 10;
            int x = temp%10;
            if(x!=3 && x!=5 && x!=7)pure=false;
            if(x==3)has3=true;
            if(x==5)has5=true;
            if(x==7)has7=true;
        }
        if(pure && has3 && has5 && has7)count+=1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 7280
#include<cstdio>
#include<iostream>
using namespace std;
int visited[101], d[101], adj[101][101];
int n;
const int INFTY = (1<<30);
void prim()
{
  for(int i=0; i<n; i++)
  {
    visited[i] = 0; d[i] = INFTY;
  }
  d[0] = 0;
  while(1)
  {
    int mincost = INFTY; int u= -1;
    for(int i=0; i<n; i++)
    {
      if(mincost > d[i] && visited[i] == 0)
      {
        mincost = d[i];
        u = i;
      }
    }
    if (mincost == INFTY) break;
    visited[u] = 1;
    for(int i=0; i<n; i++)
    {
      if(adj[u][i] != -1 && visited[i] == 0)
      {
        if(d[i] > adj[u][i])
          d[i] = adj[u][i];
      }
    }
  }
  int sum=0;
  for(int i=0; i<n; i++)
  {
    sum += d[i];
  }
  printf("%d\n", sum);
}
int main()
{
  //int n;
  scanf("%d", &n);
  for(int i=0; i<n; i++)
    for(int j=0; j<n; j++)
      scanf("%d", &adj[i][j]);

  prim();
  return 0;
}



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

using namespace std;

const int M = 1e9 + 7;

map<int, int> cnt;
int n, m;
int fact[1000005], factInv[1000005];

int mul(int w, int u) {
    return (long long)w * u % M;
}

int power(int a, int k) {
    if (k == 0) return 1;
    return mul(power(mul(a, a), k / 2), k % 2 ? a : 1);
}

int inv(int w) {
    return power(w, M - 2);
}

int newton(int n, int k) {
    return mul(fact[n], mul(factInv[k], factInv[n - k]));
}

int main() {

    scanf("%d%d", &n, &m);
    fact[0] = 1;
    for (int i = 1; i <= n + 50; i++) fact[i] = mul(fact[i - 1], i);
    factInv[n + 50] = inv(fact[n + 50]);
    for (int i = n + 49; i >= 0; i--) factInv[i] = mul(factInv[i + 1], i + 1);
    for (int i = 2; i * i <= m; i++) {
        while (m % i == 0) {
            cnt[i]++;
            m /= i;
        }
    }
    if (m > 1) cnt[m]++;
    int ans = 1;
    for (auto p : cnt) {
//         cerr << p.second << endl;
        ans = mul(ans, newton(n + p.second - 1, p.second));
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 4736
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,m);
  Vi LV(n);
  VIN(LV)
  RSORT(LV);
  int sum = 0;
  REP(i,m){
    sum += LV[i];
  }
  OUT(sum);
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int A[6];

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

    for(int i=0;i<6;++i){
        std::cin >> A[i];
    }

    int res = (A[0] + A[1] + A[2] + A[3]) - *min_element(A, A+4) + *max_element(&A[4], &A[4]+2);
    std::cout << res << std::endl;
}



Measured memory_bytes: 3220
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

using ll = long long;

int n;
ll a[1234567];

int main(void)
{
	cin >> n;
	for (int i = 0; i < 3 * n; ++i)
	{
		cin >> a[i];
	}
	sort(a, a + 3 * n);
	int index = n * 3 - 2;
	ll ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ans += a[index];
		index -= 2;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4352
import sys
readline = sys.stdin.readline

N, K = map(int, readline().split())
P = list(map(int, readline().split()))
AP = P[:]
for i in range(1, N):
    AP[i] += AP[i-1]
AP = [0] + AP
ans = 0
for st in range(N-K+1):
    en = st+K
    ans = max(ans, AP[en] - AP[st])

print((ans+K)/2)

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

using namespace std;

typedef long long ll;

int main() {
	//No sub撤退しないぞ
	string s;
	cin >> s;
	if (s == "RRR")cout << 3 << endl;
	else if (s == "SRR")cout << 2 << endl;
	else if (s == "RSR")cout << 1 << endl;
	else if (s == "RRS")cout << 2 << endl;
	else if (s == "SSS")cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
#include <memory>
using namespace std;
typedef long long ll;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    ll A,B,N;
    cin >> A >> B >> N;

    ll x = min(N, B - 1);
    cout << ((A * x) / B) - (A * (x / B)) << endl;

    return 0;
}


Measured memory_bytes: 3592
/*
ID: computerbox --> Huseyn Hajiyev
LANG: C++
TASK: target_mode_on
*/
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define _CRT_SECURE_NO_WARNINGS
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#define FAST_READ ios_base::sync_with_stdio(0);/*cin.tie(0); cout.tie(0);*/
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 2000

using namespace std;

#define debug(args...)(Debugger()) , args
class Debugger
{
  public:
  Debugger(const std::string& _separator=", ") :
  first(true),separator(_separator){}
  template<typename ObjectType>
  Debugger& operator,(const ObjectType& v)
  {
        if(!first)cerr<<separator;
        cerr<<v;
        first=false;
        return *this;
  }
  ~Debugger() {cerr<<endl;}      
  private:
    bool first;
    string separator;
};
 
template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
   return os<<"("<<p.first<<", "<<p.second<<")";
}
template<typename T>
inline ostream &operator<<(ostream & os,const vector<T>& v)
{
    bool first=true;
    os<<"[";
    for(unsigned ll i=0;i<v.size();i++)
    {
        if(!first)os<<", ";
        os<<v[i];
        first=false;
    }
        return os<<"]";
}
template<typename T>
inline ostream &operator<<(ostream & os,const set<T>&v)
{
    bool first=true;
    os<<"[";
    for(typename set<T>::const_iterator ii=v.begin();ii!=v.end();++ii)
    {
        if(!first)os<<", ";
        os<<*ii;
        first=false;
    }
    return os<<"]";
}
template<typename T1, typename T2>
inline ostream &operator<<(ostream & os,const map<T1, T2>&v)
{
        bool first=true;
        os<<"[";
        for(typename map<T1,T2>::const_iterator ii=v.begin(); ii!=v.end();++ii)
        {
            if(!first)os<<", ";
            os<<*ii;
            first=false;
        }
        return os<<"]";
}

ll n;

ll sum(ll n)
{
  ll cnt=0;
  while(n>0)
  {
    ll q=n%10;
    cnt+=q;
    n/=10;
  }
  return cnt;
}

int main(){
FAST_READ;
cin.tie(0);
cin>>n;
ll s=sum(n);
//deb(s);
if(n%s==0)
{
  cout<<"Yes"<<endl;
}
else cout<<"No"<<endl;






return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int a,b,c,x,i,j,k,r=0;
	scanf("%d%d%d%d",&a,&b,&c,&x);
	for(i=0;i<=x/500;i++){
		for(j=0;j<=(x-500*i)/100;j++){
			k=x-500*i-100*j;
			r+=k%50==0 && c>=k/50 && a>=i && b>=j;
		}
	}
	printf("%d\n",r);
	return 0;
}



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

int main() {
   	string a,b;
  	int count=0;
    cin >> a >> b ;
  
  	for(int i=0; i<a.size(); i++){
    	if(a[i] != b[i]) count += 1;
    }
  
    if(count != 0) cout << "No";
  	else cout << "Yes";
  
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




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

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   100007
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/




int main()
{

    ll q=0,i,j,a[N],b,k;
    string s;
    cin>>s;
    for(i=0;i<s.length();i++)
    {
        if(s[i]=='+')
            q++;
        else
            q--;

    }
    cout<<q<<endl;
    return 0;

}
































Measured memory_bytes: 256
N = int(input())
csf = [list(map(int, input().split())) for _ in range(N-1)]
ans = [None]*N
ans[-1] = 0
for i in range(N-1):
    now = 0
    for j in range(i,N-1):
        if now <= csf[j][1]:
            now = csf[j][1]
        else:
            t  = (now - csf[j][1] + csf[j][2]-1)//csf[j][2]
            now = csf[j][1] + t*csf[j][2]
        now += csf[j][0]
    ans[i] = now
[print(a) for a in ans]

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

int main(){
    int n,m; cin>>n>>m;
    vector<int> c(m,0);
    for(int i=0;i<n;i++){
        int k; cin>>k;
        for(int j=0;j<k;j++){
            int a; cin>>a;
            a--;
            c[a]++;
        }
    }
    int ans=0;
    for(int i=0;i<m;i++){
        if(c[i]==n){
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; cin>>n;
  map<map<char,int>,int> mp;
  ll ans = 0;
  for (int i=0; i<n; i++) {
    string s; cin>>s;
    map<char,int> freq;
    for (char c: s) freq[c]++;
    ans += mp[freq];
    mp[freq]++;
  }
  out(ans);

  return 0;
}


Measured memory_bytes: 49152
use proconio::input;

fn main() {
    input! {
        n: usize,
    };
    let magic = 1e9 as usize + 7;
    if n <= 1 {
        println!("0");
        return;
    }
    let mut x_all = 100;
    let mut x_ex0 = 81;
    let mut x_ex09 = 64;
    for _ in 3..=n {
        x_all = x_all * 10 % magic;
        x_ex0 = x_ex0 * 9 % magic;
        x_ex09 = x_ex09 * 8 % magic;
    }
    let x_ex9 = x_ex0;
    let x = (x_all + (magic - x_ex0) + (magic - x_ex9) + x_ex09) % magic;
    println!("{}", x);
}


Measured memory_bytes: 2108
x,y = map(int, input().split())
if y==0:
    ans = abs(x) + (x>0)
else:
    ans = abs(abs(x)-abs(y))
    if x>=0 and y>=0:
        if x>y:
            ans +=2
    elif x<0 and y<0:
        if x>y:
            ans += 2
    else:
        ans +=1
print(ans)

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

#define N 100000

int main(void){
    vector<bool> prime(N+1,true);
    prime[0]=prime[1]=false;
    for (size_t i = 2; i*i <= N; i++)
    {
        if (prime[i])
        {
            for (size_t j = 2; i*j <= N; j++)
            {
                prime[i*j]=false;
            }
        }
    }
    int likeCnt[N];
    for (size_t i = 1; i <= N; i++)
    {
        likeCnt[i]=likeCnt[i-1];
        if (i%2==1&&prime[i]&&prime[(i+1)/2])
        {
            likeCnt[i]++;
        }
    }
    /**************************************/
    int q;
    scanf("%d", &q);
    int l,r;
    for (size_t i = 0; i < q; i++)
    {
        scanf("%d%d", &l, &r);
        printf("%d\n", likeCnt[r] - likeCnt[l-1]);
    }
    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  rep(i,n) cin >> a[i];
  VLL sum(n,0);
  sum[0] = a[0];

  map<ll,ll> mp;
  FOR(i,1,n){
    sum[i] += a[i] + sum[i-1] ;
  }

  mp[0] = 1;
  ll ans = 0;
  rep(i,n) {
    ans += mp[sum[i]];
    mp[sum[i]]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 15872
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	vector<int> con;
	int N;
	
	cin>>N;
	
	con.resize(N+1);
	
	for(int i = 1; i * i<= N; i++){
		for(int j = 1; j * j<= N; j++){
			for(int k = 1; k * k <= N; k++){
				int x = i * i + j * j + k * k + i * j + j * k + k * i;
				
				if(x <= N) con[x]++;
			}
		}
	}
	
	for(int i = 1; i <= N; i++){
		cout<<con[i]<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3692
a,b,c,x,y = map(int,input().split())
z = min(x,y)
ans = min((a+b)*z,c*z*2)
if x==y:
    print(ans)
elif x>y:
    ans += min((x-y)*a,(x-y)*c*2)
    print(ans)
else:
    ans += min((y-x)*b,(y-x)*c*2)
    print(ans)

Measured memory_bytes: 3064