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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,m;
  cin>>n>>m;
  vector<pair<int,string>> ps(m);
  rep(i,m){
    cin>>ps[i].first>>ps[i].second;
    ps[i].first--;
  }

  vector<int> isAC(n,0);
  vector<int> isWA(n,0);
  rep(i,m){
    int p;
    string s;
    tie(p,s) = ps[i];
    if(s=="AC")isAC[p]=1;
    else if(s=="WA"&&isAC[p]==0)isWA[p]++;
  }
  int a=0,b=0;
  rep(i,n){
    a += isAC[i];
    if(isAC[i]==1)b += isWA[i];
  }
  cout<<a<<" "<<b<<endl;

}

Measured memory_bytes: 7296
//解説コピー
//テスト用　自力では無い

#include <bits/stdc++.h>

using namespace std;
using ll=long long;
const ll mod = 1e9 + 7;
const ll INF = 1LL<<60;

int main() {
    int N,M;
    cin>>N>>M;
    vector<pair<int,ll>> tonari[1001];
    for(int i = 0; i < M; ++i) {
        int a,b; ll w;
        cin>>a>>b>>w;
        tonari[a-1].push_back({b-1,-w});
    }

    bool heikei=false;
    vector<ll> dist(N,INF);
    dist[0]=0;
    for(int i=0;i< 2*N ;i++){
        for(int v=0;v<N;v++) {
            if (dist[v] == INF) continue;
            for (auto next:tonari[v]) {
                if (dist[next.first] > dist[v] + next.second) {
                    dist[next.first] = dist[v] + next.second;
                    if (next.first == N - 1 &&i >= N) heikei=true;
                }
            }
        }
    }
    if(heikei) cout<<"inf"<<endl;
    else cout<<-dist[N-1]<<endl;

    return 0;
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	vl dp(3);
	while (n--) {
		vl a(3), ndp(3);
		FOR(i,0,3) cin >> a[i];
		
		FOR(i,0,3) FOR(j,0,3) if (i != j) ndp[j] = max(ndp[j], a[j] + dp[i]);
		dp = ndp;
	}
	cout << *max_element(all(dp)) << endl;
}



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

int main()
{
  string s,t;
  int f=0;
  cin>>s>>t;
  for(int i=0;i<s.size();i++)
  {
    char h=s.at(s.size()-1);
    for(int j=s.size()-1;j>=1;j--)
    {
      s.at(j)=s.at(j-1);
    }
    s.at(0)=h;
    if(s==t)
    {
      f=1;
      break;
    }
  }
  if(f==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(void)
{
    int a,b,c,d,e,f,g,h,i,j,z;
	scanf("%d %d %d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);
	z=a+b+c+d+e+f+g+h+i+j;
	printf("%d\n",z);
	return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;
ll dx[] = { 1,0 };
ll dy[] = { 0,1 };

int main() {

    ll N, M;
    cin >> N >> M;

    vector <ll> A;

    ll tmp;

    rep(i, N) {
        cin >> tmp;
        A.push_back(tmp);
    }

    vector<p> cb;
    rep(i, M) {
        ll b, c;
        cin >> b >> c;
        cb.emplace_back(c, b);
    }

    sort(A.begin(), A.end(), greater<>());
    sort(cb.begin(), cb.end(), greater<>());
    
    cb.emplace_back(0, 1);

    ll id1 = 0, id2 = 0, cnt = 0;
    vector<ll> x;

    while(cnt < N) {
        if (A[id1] > cb[id2].first) {
            x.push_back(A[id1]);
            cnt++;
            id1++;
        }
        else {
            rep(i, cb[id2]. second) {
                x.push_back(cb[id2].first);
                cnt++;
            }
            id2++;
        }
    }

    ll ans = 0;

    rep(i, N) {
        ans += x[i];
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 8688
#include <iostream>
#include <numeric>
#include <vector>

int main() {
  int l, k;
  std::cin >> l >> k;
  std::vector<long long> black(l + 1), white(l + 1);
  white[0] = 1;
  for (int li = 0; li < l; ++li) {
    black[li + 1] += white[li];
    if (li + k <= l) {
      black[li + k] += white[li];
    }
    white[li + 1] += black[li];
  }
  std::cout << std::accumulate(black.begin(), black.end(), 0LL) << std::endl;
  return 0;
}

Measured memory_bytes: 3124
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<double> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    double sum=0;
    for(int i=0;i<n;i++){
        sum+=1/a[i];
    }
    cout<<1/sum;
    return 0;
}

Measured memory_bytes: 256
'use strict'
function main(input) {
    const tmp = input.split("\n");
    const N = parseInt(tmp[0], 10);
    let tasks = [];

    for (let i = 1; i <= N; i++) {
        let tmp2 = tmp[i].split(" ");
        let task = { A: parseInt(tmp2[0], 10), B: parseInt(tmp2[1], 10) };
        tasks.push(task);
    }

    tasks = tasks.sort((pair1, pair2) => pair1.B - pair2.B);

    let now = 0;
    let keepingDeadline = true;

    for (let task of tasks) {
        now += task.A

        if (now > task.B) {
            keepingDeadline = false;
            break;
        }

    }
    if (keepingDeadline) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 63868
def main():
    A, B, K = map(int, input().split())

    ans = list()

    ans.extend(range(A, A+K))
    ans.extend(range(B, B-K, -1))

    ans = list(set(ans))
    ans.sort()
    for a in ans:
        if A <= a <= B:
            print(a)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		double[][]	aMatrix = null;

		while((aMatrix = parseMatrix()) != null) {
			calcMatrix(aMatrix);
		}
	}

	private static double[][] parseMatrix() {
		double[][]	aMatrix = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					aMatrix = new double[2][3];
	
					String[]	as   = line.split(" ");
					double		d11 = Double.parseDouble(as[0]);
					double		d12 = Double.parseDouble(as[1]);
					double		d13 = Double.parseDouble(as[2]);
					double		d21 = Double.parseDouble(as[3]);
					double		d22 = Double.parseDouble(as[4]);
					double		d23 = Double.parseDouble(as[5]);
	
					aMatrix[0][0] = d11;
					aMatrix[0][1] = d12;
					aMatrix[0][2] = d13;
					aMatrix[1][0] = d21;
					aMatrix[1][1] = d22;
					aMatrix[1][2] = d23;
				}
			}
		}
		catch (NumberFormatException e) {}
		catch (IOException e) {}

		return aMatrix;
	}

	private static void calcMatrix(double[][] aMatrix) {
		int nFinRow = 0;
		int nActRow = -1;

		for(int nCols = 0; nCols < aMatrix[0].length - 1; nCols++) {
			nActRow = -1;

			// 全ての行のnCols番目の列の要素が1になるように行の要素を除算する
			for(int nRols = 0; nRols < aMatrix.length; nRols++) {
				if ((nFinRow & 1 << nRols) != 0) {
					continue;
				}

				if (aMatrix[nRols][nCols] != 0.0) {
					if (nActRow == -1) {
						nActRow = nRols;
						nFinRow = nFinRow | 1 << nRols;
					}

					for(int nLoop = aMatrix[0].length - 1; nLoop >= nCols; nLoop--) {
						aMatrix[nRols][nLoop] /= aMatrix[nRols][nCols];
					}
				}
			}

			// 全ての列の要素から最初に要素を1にした列の要素を減算する
			for(int nRols = 0; nRols < aMatrix.length; nRols++) {
				if (aMatrix[nRols][nCols] != 0.0 && nRols != nActRow) {
					for(int nLoop = aMatrix[0].length - 1; nLoop >= nCols; nLoop--) {
						double	dWork = aMatrix[nRols][nCols] * aMatrix[nActRow][nLoop];
						aMatrix[nRols][nLoop] -= dWork;//aMatrix[nActRow][nLoop];
					}
				}
			}
		}

		System.out.printf("%.3f %.3f\n", aMatrix[0][2], aMatrix[1][2]);
	}
}

Measured memory_bytes: 17088
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr int A_MAX = 200000;

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    ll n, k;
    cin >> n >> k;
    vector<int> a(n), idx[A_MAX+1];
    for(int i=0;i<n;++i){
        cin >> a[i];
        idx[a[i]].push_back(i);
    }

    int cur = 0;
    vector<ll> dists;
    vector<int> continue_pos;
    do {
        auto itr = upper_bound(idx[a[cur]].begin(), idx[a[cur]].end(), cur);
        if(itr == idx[a[cur]].end()) {
            itr = idx[a[cur]].begin();
            dists.push_back(*itr + n - cur + 1);
        } else {
            dists.push_back(*itr - cur + 1);
        }
        cur = ((*itr) + 1) % n;
        continue_pos.push_back(cur);
    } while(cur != 0);

    for(int i=1;i<dists.size();++i) {
        dists[i] += dists[i-1];
    }

    ll cnt = n*k;
    int i = 0;
    if(cnt >= dists.back()) {
        cnt %= dists.back();
    }
    auto itr = upper_bound(dists.begin(), dists.end(), cnt);
    if(itr != dists.begin()) {
        --itr;
        cnt -= *itr;
        i = continue_pos[itr - dists.begin()];
    }
    deque<int> que;
    vector<bool> used(A_MAX+1, false);
    while(cnt > 0) {
        if(used[a[i]]) {
            while(!que.empty() && que.back() != a[i]) {
                used[que.back()] = false;
                que.pop_back();
            }
            if(!que.empty()) {
                used[que.back()] = false;
                que.pop_back();
            }
        } else {
            auto itr = upper_bound(idx[a[i]].begin(), idx[a[i]].end(), i);
            if(itr == idx[a[i]].end()) {
                itr = idx[a[i]].begin();
            }
            ll d = ((*itr) - i + n) % n;
            if(d == 0) d = n;
            if(d < cnt) {
                i = (i+d+1) % n;
                cnt -= d+1;
            } else {
                que.push_back(a[i]);
                used[a[i]] = true;
                i = (i+1) % n;
                --cnt;
            }   
        }
    }

    while(!que.empty()) {
        cout << que.front() << " ";
        que.pop_front();
    }
    cout << endl;
}


Measured memory_bytes: 16628
N = int(input())
S = list(input())

W = [0 for _ in range(N)]
cnt = 0
for i in range(N):
    if S[i] == "#":
        cnt += 1
    W[i] = cnt
cnt = 0

B = [0 for _ in range(N)]
for i in range(N)[::-1]:
    if S[i] == ".":
        cnt += 1
    B[i] = cnt

X = [W[i] + B[i+1] for i in range(N-1)]
X.append(W[N-1])
X.append(B[0])

print(min(X))


Measured memory_bytes: 22336
/*L - Little Mario and Points*/

#include <bits/stdc++.h>
using namespace std;

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	long long points;
	long long dist;
	long long ans = 0;
	long long x, y;

	cin >> points >> dist;

	dist *= dist;

	for (int i = 0; i < points; ++i)
	{	
		cin >> x >> y;

		if( (x*x) + (y * y) <= dist)
			ans++;
	}

	cout << ans;
	

	return 0;
}

Measured memory_bytes: 3620
#include <cstdio>

using namespace std;

inline void sort(int* a, int n) {
    for (int i = 0; i < n; i ++) {
        for (int j = i; j < n; j ++) {
            if (a[i] < a[j]) {
                int tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
            }  
        }
    }
}

int main() {
    int a[10];
    for (int i = 0; i < 10; i ++) {
        scanf("%d", &a[i]);
    }
    sort(a, 10);

    for (int i = 0; i < 3; i ++) {
        printf("%d\n", a[i]);
    }

}


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

int main(){
    int D, N;
    cin >> D >> N;
    int a=1, n=1;
    
    for(int i=0; i<D; i++){
        a *= 100;
    }
    n = a * N;
    
    if(N==100)
        n += a;
    
    cout << n << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
#define mp make_pair
#define pb push_back
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
#define Sort(v) sort(all(v))
#define Rev(v) reverse(all(v))
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 998244353;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n,k; cin >> n >> k;
    vector<ll> l(k), r(k);
    rep(i, k) cin >> l[i] >> r[i];
    vector<ll> dp(n+1); // dp[i] = iへ行くルート数
    vector<ll> s(n+2);
    dp[1] = 1; s[2] = dp[1];
    rep(i, 2, n+1) {
        rep(j, k) {
            int L = i - r[j], R = i - l[j] + 1;
            if(R <= 1) continue;
            chmax(L, 1);
            dp[i] = (dp[i] + s[R] - s[L] + mod)%mod;
        }
        s[i+1] = (s[i] + dp[i])%mod;
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 6372
import java.util.*;

public class Main {
    static long MOD = 1000000007;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        n--;
        long[] x = new long[n];
        for (int i = 0; i < n; i++) {
            x[i] = array[i+1] - array[i];
        }
        
        array = new long[m];
        for (int i = 0; i < m; i++) {
            array[i] = sc.nextInt();
        }
        m--;
        long[] y = new long[m];
        for (int i = 0; i < m; i++) {
            y[i] = array[i+1] - array[i];
        }
        
        long[] sumx = new long[n+1];
        for (int i = 0; i < n; i++) {
            sumx[i+1] = sumx[i] + x[i];
            sumx[i+1] %= MOD;
        }
        // System.out.println(Arrays.toString(sumx));
        long sum_x = 0;
        for (long num : sumx) {
            sum_x += num;
            sum_x %= MOD;
        }
        
        long ans_x = 0;
        for (int i = 0; i < n; i++) {
            ans_x += sum_x;
            ans_x %= MOD;
            
            sum_x -= x[i] * (n-i);
            sum_x %= MOD;
            if (sum_x < 0) sum_x += MOD;
        }
        // System.out.println(ans_x);
        
        sumx = new long[m+1];
        for (int i = 0; i < m; i++) {
            sumx[i+1] = sumx[i] + y[i];
            sumx[i+1] %= MOD;
        }
        // System.out.println(Arrays.toString(sumx));
        sum_x = 0;
        for (long num : sumx) {
            sum_x += num;
            sum_x %= MOD;
        }
        
        long ans_y = 0;
        for (int i = 0; i < m; i++) {
            ans_y += sum_x;
            ans_y %= MOD;
            
            sum_x -= y[i] * (m-i);
            sum_x %= MOD;
            if (sum_x < 0) sum_x += MOD;
        }
        // System.out.println(ans_y);
        
        long ans = (ans_x * ans_y) % MOD;
        System.out.println(ans);
    }
}


Measured memory_bytes: 63364
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo


@mt
def slv(N, M, AB):
    AB.sort(key=lambda x: x[0], reverse=True)
    from heapq import heappop, heappush
    q = []
    ans = 0
    for i in range(1, M+1):
        while AB and AB[-1][0] <= i:
            _, b = AB.pop()
            heappush(q, -b)
        if q:
            ans += -heappop(q)
    return ans



def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 72408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007

void fast_io(){ios_base::sync_with_stdio(false); cin.tie(NULL);}
void test_here(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);}

double solve_coins_bu(double p[], int n, int req)
{
	double dp[n+1][req+1];

	dp[0][0]=1.0;
	for(int x=1;x<=req;x++) dp[0][x]=0.0;
	for(int x=1;x<=n;x++) dp[x][0]=1.0;

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=req;j++)
		{
			dp[i][j]= p[i-1]*dp[i-1][j-1] + (1-p[i-1])*dp[i-1][j];
		}
	}
	return dp[n][req];
}



void qIcoins()
{
	int n; cin>>n;
	double p[n];
	for(int i=0;i<n;i++) cin>>p[i];
	
	int req=(n/2)+1;
	vector< vector<double> > dp(n+1, vector<double>(req+1,-1));
	cout<<fixed<<setprecision(10)<<solve_coins_bu(p,n,req);//,dp);
}


int main()
{
	qIcoins();
}

Measured memory_bytes: 73740
def f():
  N,M=map(int,input().split())
  *A,=map(int,input().split())
  l=[]
  for a in A:
      k=a
      while k>=1:
          l+=[k-k//2]
          k=k//2
  print(sum(A)-sum(sorted(l)[-M:]))
if __name__=="__main__":
  f()

Measured memory_bytes: 150076
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS
string s;

int main() {
	cin >> s;
	int nowB = 0;
	LL ans = 0;
	for (int i = 0; i < s.size();i++) {
		if (s[i]=='B') {
			nowB++;
		}
		else {
			ans += nowB;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>


int main(void) {

	int W,H,x,y,r;
    scanf("%d %d %d %d %d", &W,&H,&x,&y,&r);

	if(x>=r && x<=W-r && y>=r && y<=H-r){
      printf("Yes\n");
	}else{
	  printf("No\n");
    }
   return 0;

}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w,n;
    cin>>h>>w>>n;
    if(n%max(h,w)==0){
      cout<<n/max(h,w)<<endl;
    }else{
      cout<<n/max(h,w)+1<<endl;
    }
    return 0;
}

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

int main() {
    int h, n;
    scanf("%d%d", &h, &n);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int x;
        scanf("%d", &x);
        ans += x;
    }
    if (ans >= h) {
        printf("Yes\n");
        return 0;
    } else {
        printf("No\n");
        return 0;
    }
    return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
count_ac = [0]
output = []

count = 0
for i in range(N-1):
  if S[i]+S[i+1] == "AC": 
    count += 1
    count_ac.append(count)
  else:
    count_ac.append(count)

for _ in range(Q):
  l, r = map(int, input().split())
  output.append(count_ac[r-1]-count_ac[l-1])

print(*output, sep="\n")


Measured memory_bytes: 11892
#include <iostream>
using namespace std;
#define ll long long
ll n, p, num1 = 0, num0 = 0, x, xx;
ll f(ll num, ll x){
	ll sum = 1;
	for(ll i = 1; i <= x; ++i){
		sum = sum*num/i;
		num--;
	}
	return sum;
}
int main(){
	scanf("%lld%lld", &n, &p);
	for(int i = 0; i < n; ++i){
		scanf("%lld", &x);
		if(x&1) num1++;
		else num0++;
	}
	ll sum = 0;
	for(ll i = 1; i <= num1; i += 2){
		sum += f(num1, i);
	}
	ll xx = (1LL<<num0)*sum;
	if(p == 1){
		printf("%lld\n", xx);
	}else{
		printf("%lld\n", (1LL<<n)-xx);
	}
	return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int h, w;
	while (cin >> h >> w) {
		if (h == 0 && w == 0)
			break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (i % 2 == 0 && j % 2 == 0 || i % 2 && j % 2)
					cout << '#';
				else
					cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3076
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#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 rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 50;

int main(void){
    ll N;
    ll p[N];
    ll cnt = 0;

    cin >> N;
    rep(i, N) cin >> p[i];
    rep(i, N) if (p[i] != i + 1) cnt ++;
    if (cnt <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> A(N), X(N, 0);
    rep(i, N) cin >> A[i];

    if (A[0] != 0) {
        cout << -1 << '\n';
        return;
    }

    rep2(i, 1, N) {
        if (A[i] - A[i - 1] > 1) {
            cout << -1 << '\n';
            return;
        }
    }

    ll ans = 0;
    reverse(A.begin(), A.end());
    rep(i, N - 1) {
        ll a = A[i];
        if (i != 0 && a + 1 == A[i - 1]) continue;
        ll tmp = a;
        if (i + a >= N) {
            cout << -1 << '\n';
            return;
        }
        ans += a;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> a(n+2);
  a[0] = 0;
  for(int i=1;i<=n;i++) cin >> a[i];
  a[n+1] = 0;

  ll sum = 0;
  for(int i=0;i<=n;i++){
    sum += abs(a[i]-a[i+1]);
  }

  for(int i=1;i<=n;i++){
    ll ans = sum;
    ans -= abs(a[i]-a[i+1]);
    ans -= abs(a[i]-a[i-1]);
    ans += abs(a[i-1]-a[i+1]);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1664
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) 
	{
		Scanner s = new Scanner(System.in);		
		int taskCost[] = new int[3];
		for(int i = 0; i< 3 ; i++)
		{
			taskCost[i] = s.nextInt();
		}
		int minCost = 0;
		Arrays.sort(taskCost);
		for(int i = 1; i>= 0; i--)
		{
			minCost = minCost + Math.abs(taskCost[i+1]-taskCost[i]);
		}
		System.out.println(minCost);

	}

}


Measured memory_bytes: 22228
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n, k);
    vc<bool> a(n);
    Rep(k){
        Cin(int, d);
        Rep(d){
            Cin(int, x);
            a[x-1] = true;
        }
    }
    int ans = 0;
    For(i, n) if(!a[i]) ans ++;
    Cout(ans);
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define FOR(i, a, b) for(int i=a; i<b; i++);
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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 namespace std;

int H;
ll A[500010];

// 指定したノードと左右の子ノードについてmaxヒープを生成する
void max_heapify(ll *A, int i) {
    int l = 2 * i + 1;
    int r = 2 * i + 2;
    int largest = i;
    if (l <= H && A[l] > A[i]) largest = l;
    if (r <= H && A[r] > A[largest]) largest = r;
    if (largest != i) {
        swap(A[i], A[largest]);
        max_heapify(A, largest);
    }
}

// 与えられた配列からmaxヒープを生成
void build_max_heap(ll *A) {
    for (int i=(H-1)/2; i>=0; i--) {
        max_heapify(A, i);
    }
}


int main() {
    cin >> H;
    rep(i, H) cin >> A[i];
    build_max_heap(A);
    for (int i=0; i<H; i++) cout << " " << A[i];
    cout << endl;
}



Measured memory_bytes: 6988
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  
  using T = tuple<string, Int, Int>;
  vector<T> vp;
  for(Int i=0;i<n;i++){
    string s;
    Int p;
    cin>>s>>p;
    vp.emplace_back(s,-p,i);
  }
  sort(vp.begin(),vp.end());

  for(Int i=0;i<n;i++)
    cout<<get<2>(vp[i])+1<<endl;
  
  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  int64_t x;
  mint(int64_t x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(int64_t t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  //for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

const int N = 1e5+10;

//head

int n;
vi G[N];
pair<mint, mint> dfs(int i, int j) {
  mint resw(1), resb(1);
  for(int ne:G[i]) if(ne != j) {
    mint prew, preb;
    tie(prew, preb) = dfs(ne, i);
    resw *= prew + preb;
    resb *= prew;
  }
  return make_pair(resw, resb);
}

template<typename T>
T wa(pair<T, T> pp) {return pp.first + pp.second;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  cout << wa(dfs(0, -1)) << endl;
}

Measured memory_bytes: 14532
N=gets.to_i
count=0
count_a=0
count_b=0
count_ab=0
N.times do
    s=gets.chomp
    (0..(s.length-2)).each do |i|
        count+=1 if s[i] == "A" && s[i+1] == "B"
    end
    if s[-1] == "A"
        if s[0] == "B"
            count_ab+=1
        else
            count_a+=1
        end
    else
        if s[0] == "B"
            count_b+=1
        end
    end
end
if count_ab > 0
    if count_a > 0
        if count_b > 0
            count+=(count_ab+1)
            count += (count_a > count_b ? count_b-1 : count_a-1)
        else
            count+=count_ab
        end
    else
        if count_b > 0
            count+=count_ab
        else
            count+=(count_ab-1)
        end
    end
else
    count += (count_a > count_b ? count_b : count_a)
end
puts count


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

int main()
{
    int n, k, q;  cin >> n >> k >> q;
    vector<int> con(n, k);
    vector<int> a(q);

    rep(i,q) {
        cin >> a[i];
        con[a[i] - 1] += 1;
    }

    rep(i,n) {
        if (con[i] - q <= 0)  cout << "No" << endl;
        else  cout << "Yes" << endl;
    }
}

Measured memory_bytes: 1408
import java.util.Scanner;
public class Main{
    public static void main(String args[])
    {
        Scanner sc= new Scanner(System.in);
        String a = sc.nextLine();
        int max=0,count=0;
        for(int i=0;i<a.length();i++)
        {
            
             if(a.charAt(i)=='R')
             {
                count=0;
                 while(a.charAt(i)!='S' && i<a.length())
                 {
                     count++;
                     
                     i++;
                     if(i==a.length())
                     {
                         break;
                     }
                     
                 }
                 if(max<count)
                 {
                     max=count;
                 }
                
             }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35664
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
#include <map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

long long pow_mod(long long x, long long n, long long mod_num) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) { res = (res * x) % mod_num; }
        x = (x * x) % mod_num;
        n = (n >> 1);
    }
    return res;
}
 
class Combi_Num {
    public:
    long long mod_num;
    std::vector<long long> fac, den;
    Combi_Num() {}
    Combi_Num(const int n, const int mod_num_in) {
        mod_num = mod_num_in;
        fac.resize(n+1, 0);
        den.resize(n+1, 0);
        fac[0] = 1;
        den[0] = 1;
        for (int i = 1; i <= n; i++) {
            fac[i] = (fac[i-1] * i) % mod_num;
            den[i] = (den[i-1] * pow_mod(i, mod_num - 2, mod_num)) % mod_num;
        }
    }

    long long calc(const int n, const int r) {
        return (fac[n] * ((den[r] * den[n-r]) % mod_num)) % mod_num;
    }
};

const long long MAX_H = 100010;
const long long MOD = 1000000007;
long long H, W, A, B;

Combi_Num combi_num = Combi_Num(MAX_H*2, MOD);

long long path_num(long long h1, long long w1, long long h2, long long w2) {
    return combi_num.calc(h2 - h1 + w2 - w1, h2 - h1);
}
 
int main(void){
    std::cin >> H >> W >> A >> B;

    long long all = path_num(1, 1, H, W);

    long long res = 0;
    for (int i = 0; i < A; i++) {
        res = res + path_num(1, 1, H - i, B) * path_num(H - i, B + 1, H, W);
        res = res % MOD;
    }
    
    std::cout << (all - res + MOD) % MOD <<  std::endl;
    
    return 0;
}

Measured memory_bytes: 3328
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	pa := make([]interface{}, 0, n)
	for i := range a {
		pa = append(pa, &a[i])
	}
	fmt.Scan(pa...)

	var ans int
	for _, v := range a {
		if isPrime(v) {
			ans++
		}
	}
	fmt.Println(ans)
}

func isPrime(v int) bool {
	for k := 2; k <= int(math.Pow(float64(v), 0.5)); k++ {
		if v%k == 0 {
			return false
		}
	}
	return true
}



Measured memory_bytes: 1412
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
 
const ll INF = 100000000001;
 
bool order(const P &p0, const P &p1) {
	return p0.second > p1.second;
}
 
int main()
{
	int n, k;
	cin >> n >> k;
	ll t[100001], d[100001];
	P p[100001];
    ll b[100001];
    for(int i = 0; i < n; i++){
        b[i] = INF;
    }
	for (int i = 0; i < n; i++) {
		cin >> t[i] >> d[i];
        t[i]--;
		p[i] = P(t[i], d[i]);
	}
	sort(p, p + n, order);
    ll var = 0;
    ll sum = 0;
    for(int i = 0; i < n; i++){
        if(b[p[i].first] == INF){
            b[p[i].first] = p[i].second;
            p[i].second = 0;
            var++;
            sum += b[p[i].first];
            k--;
        }
        if(k == 0){
            break;
        }
    }
    sort(b, b + n);
    sort(p, p + n, order);
    for(int i = 0; i < k; i++){
        sum += p[i].second;
    }
    ll ans = sum + var * var;
    for(int i = 0; i < var; i++){
        sum += p[i + k].second;
        sum -= b[i];
        var--;
        if(ans < sum + var * var){
            ans = sum + var * var;
        }
        else{
            cout << ans << endl;
            return 0;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
#define debug(x) (cout << "#x = " << (x) << endl)
#define lowbit(x) (x & -x)
#define Set(x, i) memset(x, i, sizeof x)
#define R register
#define For( i, j, k ) for(R int i = (j); i <= (k); ++i)
#define Rep( i, j, k ) for(R int i = (j); i >= (k); --i)
#define Cross( i, j, k ) for(R int i = (j); i; i = (k))
typedef long long ll;
using namespace std;
const ll N = 100011;
const ll INF = 5e16;

namespace IO {

	#define dd ch = getchar()
	inline ll read() {
		ll x = 0; bool f = 0; char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar ( x % 10 | 48 );
	}

	inline void wrn ( ll x ) { write(x); putchar (' '); }

	inline void wln ( ll x ) { write(x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x); wln (y); }

}

using namespace IO;

namespace Cesare {
	
	int main() {
		ll A = read();
		ll B = read();
		return wln(max(A + B, max(A - B, A * B))), 0;
	}
	
}

int main()
{
	return Cesare::main();
}

/*

*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	int n,m,k;
	cin >> n >> m >> k;
	vector <lli> a(n + 1),b(m + 1);
	for(int i = 0;i < n;++i){
		int t;
		cin >> t;
		a[i + 1] = a[i] + t;
	}
	for(int j = 0;j < m;++j){
		int t;
		cin >> t;
		b[j + 1] = b[j] + t;
	}
	int maxx = -1;
	for(int i = 0,j = m;i <= n;++i){
		if(a[i] > k) break;
		while(j >= 0 and a[i] + b[j] > k) --j;
		maxx = max(maxx,i + j);
	}
	cout << maxx << newl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


Measured memory_bytes: 6292
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<int,int> mii;
typedef map<string, int> msi;
typedef map<int,pair<int,int> > miii;
typedef complex<double> point;
typedef pair<int, ii> iii;
typedef vector<iii> viii;
#define X real()
#define Y imag()
#define FileIn(file) freopen(file".txt", "r", stdin)
#define FileOut(file) freopen(file".txt", "w", stdout)
#define Fill(ar, val) memset(ar, val, sizeof(ar))
#define PI 3.1415926535897932385
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define bit(n) (1<<(n))
#define Last(i) (i & -i)
#define INF 500000000
#define maxN 10000010
#define VISITED 1
#define UNVISITED -1
#define P(p) const point &p
#define L(p0, p1) P(p0), P(p1)

int main()
{
    ios::sync_with_stdio(0);
    //cin.tie(0);
    //FileIn("in");
    //FileOut("out");
    int n;
    cin>>n;
    bool nine = false;
    int temp;
    while(n>0)
    {
        temp = n%10;
        if(temp==9){
            nine = true;
            break;
        }
        n/=10;
    }
    if(nine)
        cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


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

const int MAX_N = 100000;

int MOD;
std::vector<int> neighbours[1 + MAX_N];
std::vector<int> children[1 + MAX_N];
std::vector<int> prefProd[1 + MAX_N];
std::vector<int> suffProd[1 + MAX_N];

int countDownwards[1 + MAX_N];
int countUpwards[1 + MAX_N];
int answer[1 + MAX_N];

int mul(int a, int b) {
  return (long long)a * b % MOD;
}

void mulSelf(int &a, int b) {
  a = (long long)a * b % MOD;
}

int add(int a, int b) {
  a += b;
  if (a >= MOD)
    a -= MOD;
  return a;
}

void addSelf(int &a, int b) {
  a += b;
  if (a >= MOD)
    a -= MOD;
}
void dfsBottomUp(int v, int p = -1) {
  countDownwards[v] = 1;
  for (int c : neighbours[v]) {
    if (c != p) {
      dfsBottomUp(c, v);
      children[v].push_back(c);
      mulSelf(countDownwards[v], add(countDownwards[c], 1));
    }
  }
}

void dfsTopDown(int v, int p = -1) {
  for (int i = 0; i < (int)children[v].size(); i++) {
    int c = children[v][i];
    countUpwards[c] = countUpwards[v];
    if (i - 1 >= 0)
      mulSelf(countUpwards[c], prefProd[v][i - 1]);
    if (i + 1 < (int)children[v].size())
      mulSelf(countUpwards[c], suffProd[v][i + 1]);
    addSelf(countUpwards[c], 1);
    dfsTopDown(c, v);
  }
}

int main() {
  int n;
  scanf("%d%d", &n, &MOD);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    neighbours[u].push_back(v);
    neighbours[v].push_back(u);
  }
  dfsBottomUp(1);
  for (int v = 1; v <= n; v++) {
    int prod = 1;
    for (int c : children[v]) {
      mulSelf(prod, add(countDownwards[c], 1));
      prefProd[v].push_back(prod);
    }
    std::reverse(children[v].begin(), children[v].end());
    prod = 1;
    for (int c : children[v]) {
      mulSelf(prod, add(countDownwards[c], 1));
      suffProd[v].push_back(prod);
    }
    std::reverse(children[v].begin(), children[v].end());
    std::reverse(suffProd[v].begin(), suffProd[v].end());
  }
  countUpwards[1] = 1;
  dfsTopDown(1);
  /*
  for (int v = 1; v <= n; v++) {
    printf("%d ", countDownwards[v]);
  }
  printf("\n");
  for (int v = 1; v <= n; v++) {
    printf("%d ", countUpwards[v]);
  }
  printf("\n");//*/
  for (int v = 1; v <= n; v++) {
    answer[v] = mul(countDownwards[v], countUpwards[v]);
    printf("%d\n", answer[v]);
  }
  return 0;
}


Measured memory_bytes: 28672
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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 main()
{
  string s ;
  cin >> s ;
  int n = SZ(s) ;
  int a ;
  bool flag = false ;
  
  REP(i,n){
    if(s.at(i)=='C'){
      a = i+1 ;
      flag = true ;
      break ;
    }
  }
  
  if(flag){
    FOR(i,a,n){
      if(s.at(i)=='F'){
        cout <<"Yes"<<endl ;
        return 0 ;
      }
    }
  }
  
  cout <<"No"<<endl ;
    


  return 0 ;
}




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

int main() {
	// your code goes here
	int W;
	int H;
	int x;
	int y;
	int r;
	int jadge;//0=No, 1=YES
	
	cin >> W;
	cin >> H;
	cin >> x;
	cin >> y;
	cin >> r;
	
	if(0<=x-r && x+r<=W && 0<=y-r && y+r<=H) {
		jadge = 1;
		cout << "Yes" <<endl;
	}
	else if(0>x-r || x+r>W || 0>y-r || y+r>H){
		jadge = 0;
		cout << "No" << endl;
	}
	
	return 0;
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int r = 0, ans = 0;
  rep(i,n) if (s[i] == 'R') r++;
  rep(i,r) if (s[i] == 'W') ans++;
  cout << ans << endl;
}

Measured memory_bytes: 3732