akhauriyash/Code-Regression huggingface dataset:
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 1e9 + 7;
const long long inf = 1e18;
 
using namespace std;
 

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 
ll binomialCoeff(ll n, ll k) 
{ 
	ll C[n + 1][k + 1]; 
	ll i, j; 


	for (i = 0; i <= n; i++) 
	{ 
		for (j = 0; j <= min(i, k); j++) 
		{ 
			
			if (j == 0 || j == i) 
				C[i][j] = 1; 

			else
				C[i][j] = (C[i - 1][j - 1] + 
										C[i - 1][j])%MOD; 
		} 
	} 

	return C[n][k]; 
}
bool compare(const string &a , const string&b){
	
}
 
void solve()
{
	ll n , k ; 
	cin>>n>>k ;
	double ans = 0.0  ;
	for(ll i = 1 ; i<=n;i++){
		double temp  = i;
		int mv = 0 ;
		while(temp<k){
			temp *= 2.0 ; 
			mv++;
		}
		temp = (1<<mv) ;
		ans += 1.0 / temp ;
	}
	double t = n ;
	ans *= (1.0 / t) ;
	cout<<setprecision(20)<<ans<<endl;	
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3776
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()

def b_search_l(B,key):
    #key < B[s]を満たすsの個数
    if key < B[0]:
        return N
    elif key >= B[N-1]:
        return 0
    else:
        left,right = 0,N
        while left < right:
            mid = (left+right)//2
            if B[mid] <= key and key < B[mid+1]:
                return N-(mid+1)
            elif B[mid] > key:
                right = mid
            else:
                left = mid

def b_search_r(B,key):
    #key > B[t]を満たすtの個数
    if B[0] >= key:
        return 0
    elif B[N-1] < key:
        return N
    else:
        left,right = 0,N
        while left < right:
            mid = (left+right)//2
            if B[mid] < key and key <= B[mid+1]:
                return mid+1
            elif B[mid] >= key:
                right = mid
            else:
                left = mid

#b_l:keyより多い奴の個数
#b_r:key未満の奴の個数
ans = 0
for i in range(N):
    b_l,b_r = b_search_l(C,B[i]),b_search_r(A,B[i])
    ans += (b_l)*(b_r)
print(ans)


Measured memory_bytes: 23328
#include<bits/stdc++.h>
using namespace std;
#define int long long 

signed main(){
	int n,a,b;cin>>n>>a>>b;if(a>b) swap(a,b);
	if(a%2==b%2) return printf("%lld\n",abs(a-b)/2)*0;
	printf("%lld\n",min(a-1+(b-(a-1)-1-1)/2+1,n-b+(n-(a+n-b+1))/2+1));
	
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#define N 100005
#define K 200005
#define MOD (int)1e9+7
#define ll long long int
using namespace std;
double dp[305][305][305];

int n;
double dfs(int a,int b,int c)
{
    if(a+b+c==0)
    {
        return 0.0;
    }
    if(dp[a][b][c]>-0.5)
    {
        return dp[a][b][c];
    }
    double ans=0.0;
     double ks=(double)n/(a+b+c);
    if(a)
    {
         double pr=(double)a/(a+b+c);
        ans+=(dfs(a-1,b,c)+ks)*pr;
    }
     if(b)
    {
         double pr=(double)b/(a+b+c);
        ans+=(dfs(a+1,b-1,c)+ks)*pr;
    }
     if(c)
    {
         double pr=(double)c/(a+b+c);
        ans+=(dfs(a,b+1,c-1)+ks)*pr;
    }
    return dp[a][b][c]=ans;
}
int main() {
   
    cin>>n;
    vector<int> cnt(4);
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        cnt[a]++;
    }
     for(int c=n;c>=0;c--)
    {
        for(int b=n;b>=0;b--)
        {
            for(int a=n;a>=0;a--)
            {
                dp[a][b][c]=-1.0;
            }
        }
    }
    double ans=dfs(cnt[1],cnt[2],cnt[3]);
    cout<<setprecision(10)<<fixed<<ans<<endl;
}

Measured memory_bytes: 219392
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<array>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

int dx4[4] = { 1,0,0,-1 };
int dy4[4] = { 0,1,-1,0 };
int dx2[2] = { 1,0 };
int dy2[2] = { 0,1 };

/******************************************************************************************/
typedef tuple<int,int,int> tpl;


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

    set<int> st;
    for (int i = 0; i < 3; i++)
    {
        int c;
        cin >> c;
        st.insert(c);
    }
    
    if(st.size() == 2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    


	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
 os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os << "(" << P.first << "," << P.second << ")";}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif


#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector< pii >


// int mod=1e9+7;
inline int mul(int a,int b, int mod){return (a*1ll*b)%mod;}
inline int add(int a,int b, int mod){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b, int mod){a-=b;if(a<0)a+=mod;return a;}
inline int power(int a,int b, int mod){int rt=1;while(b>0){if(b&1)rt=mul(rt,a, mod);a=mul(a,a, mod);b>>=1;}return rt;}
inline int inv(int a, int mod){return power(a,mod-2, mod);}

int N,M;
const int MAX = 3005;

int ncr[MAX][MAX];
int dp[MAX][MAX];
int two[MAX], two1[MAX];

void pre(){
	int i,j,k;
	two[0] = two1[0] = 1;
	ncr[0][0] = 1;
	for(i=1;i<MAX;i++){
		two[i] = mul(two[i-1], 2, M);
		two1[i] = mul(two1[i-1], 2, M-1);
		for(j=0;j<MAX;j++){
			if(j==0)ncr[i][j]=1;
			else{
				// trace(i,j);
				ncr[i][j] = add(ncr[i-1][j],ncr[i-1][j-1], M);
			}
		}
	}
	dp[0][0]=1;
	for(i=1;i<MAX;i++){
		for(j=1;j<=i;j++){
			dp[i][j] = add(dp[i-1][j-1], mul(j, dp[i-1][j], M), M);
		}
	}
}

void solve(){
	int ans = 0;
	int i,j,k;
	for(i=0;i<=N;i++){
		int cur = ncr[N][i];
		cur = mul(cur, power(2, two1[N-i], M), M);
		int mt = 0;
		for(k=1;k<=i;k++){
			int p1 = power(two[N-i], k-1, M);
			int p2 = mul(p1, two[N-i], M);
			mt = add(mt, mul(dp[i][k], p2, M), M );
			mt = add(mt, mul( mul(dp[i][k], k, M), p1, M), M);
		}
		if(i==0)mt = 1;
		cur = mul(cur, mt, M);
		if(i&1) cur = sub(0, cur, M);

		ans = add(ans, cur, M);
	}
	cout<<ans;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	cin>>N>>M;
	pre();
	// cout<<"ok";
	solve();
}


Measured memory_bytes: 69504
S = input()
S_list = list(S)
odd  = S_list[0::2]
even = S_list[1::2]
flag = "green"

for i in range(len(odd)):
    if odd[i] == "L":
        flag = "red"
for i in range(len(even)):
    if even[i] == "R":
        flag = "red"
if flag == "red":
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
import java.util.*;
class Main{
    public static void main(String[] args){
	final Scanner sc = new Scanner(System.in);
	int a =sc.nextInt();
	long max=-1000000;
	long min=1000000;
	long sum=0;
	long[] data=new long[a];
	for(int i=0;i<a;i++){
	    data[i]=sc.nextInt();
	    if(data[i]>max) max=data[i];
			      
	    if(data[i]<min) min=data[i];
	    sum+=data[i];
	}
	System.out.println(min+" "+max+" "+sum);
    }
}

Measured memory_bytes: 31976
import sys
l,r = map(int, input().split())
if r-l >= 2019:
    print(0)
    sys.exit()
ans = 10 ** 9
for i in range(l,r):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env python3
#ABC113 C

from operator import itemgetter
n,m = map(int,input().split())
py = [list(map(int,input().split())) for _ in range(m)]
for i in range(m):
    py[i].append(i)
py.sort(key = itemgetter(1))
py.sort(key = itemgetter(0))

x = py[0][0]
c = 0
for i in range(m):
    if x != py[i][0]:
        c = 1
        x = py[i][0]
    else:
        c += 1
    py[i].append(c)
py.sort(key = itemgetter(2))
for i in range(m):
    front = '00000'+str(py[i][0])
    back = '00000'+str(py[i][3])
    print(front[-6:]+back[-6:])


Measured memory_bytes: 77272
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y = MAP()

y = (Y-2*X)/2
x = X-y

if 0 <= x and x.is_integer() and 0 <= y and y.is_integer():
	print("Yes")
else:
	print("No")


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

int main()
{
	int n; cin >> n;
	int a[n+1], b[n+1];
	for(int i=0; i<n; i++){
		cin >> a[i] >> b[i];
	}
	bool ok = false;
	for(int i=2; i<n; i++){
		if((a[i] == b[i] && a[i-1] == b[i-1]) && (a[i-2] == b[i-2])) ok = true;
	}
	if(ok) cout << "Yes";
	else cout << "No";

    return 0;
}


Measured memory_bytes: 3616
def fun(A):
    for i in A:
        if i == 0:
            return 0
    ans = 1
    for i in A:
        ans = ans*i
        if(ans > 1000000000000000000):
            return -1
    return ans

N = int(input())
A = list(map(int, input().split()))
print(fun(A))


Measured memory_bytes: 21788
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[21],B[21],C[21];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		cin>>B[i];
	}
	REP(i,N-1){
		cin>>C[i];
	}
	int ans=0;
	REP(i,N){
		ans+=B[A[i]-1];
		if(0<i&&A[i-1]+1==A[i]){
			ans+=C[A[i-1]-1];
		}
		DEB(ans)END
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
  int A,B,C,X;
  cin>>A>>B>>C>>X;
  int ans=0;
  for(int i=0;i<A+1;i++){
    for(int j=0;j<B+1;j++){
      for(int k=0;k<C+1;k++){
        if(500*i+100*j+50*k==X)
          ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{


    ll i,j,k,a,b,c,n,t,m;
    set<ll> v,s,su;
   // set<ll> :: iterator it;
    map<string,ll> ma,sa;
    map<string,ll> :: iterator it;
    string st,et;
    cin>>a;
    for(i=1;i<=a;i++){
        cin>>st;
        ma[st]++;
    }
    cin>>b;
    for(i=1;i<=b;i++){
        cin>>st;
        if(ma[st]!=0){
            ma[st]--;
        }
    }
    a = -99999999;
    for(it=ma.begin();it!=ma.end();it++){
        if(((*it).second)>a){
            a = (*it).second;
        }
    }
    if(a<0){
        cout<<0<<endl;
    }
    else cout<<a<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




using P = complex<double>;
double dot(P a, P b) { return real(conj(a) * b); }
double cross(P a, P b) { return imag(conj(a) * b); }
const double eps = 1e-8;

bool on_seg(P v1, P v2) {
    // cout << abs(cross(v1, v2)) << " " << dot(v1, v2) << endl;
    return (abs(cross(v1, v2)) < eps && dot(v1, v2) <= 0);
}
P intersection(P p0, P p1, P p2, P p3, P s1, P s2) {
    double d1 = abs(cross(s2, p0 - p2));
    double d2 = abs(cross(s2, p1 - p2));
    double t = d1 / (d1 + d2);
    return p0 + (p1 - p0) * t;
}
int main() {
    int query;
    cin >> query;
    while (query--) {
        int p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y;
        cin >> p0x >> p0y >> p1x >> p1y >> p2x >> p2y >> p3x >> p3y;
        P p0 = P(p0x, p0y), p1 = P(p1x, p1y), p2 = P(p2x, p2y), p3 = P(p3x, p3y);
        P s1 = P(p1x - p0x, p1y - p0y), s2 = P(p3x - p2x, p3y - p2y);
        
        if (abs(cross(s1, s2)) < eps) { // 平行
            bool os = (on_seg(p2 - p0, p2 - p1) || on_seg(p3 - p0, p3 - p1) || on_seg(p0 - p2, p0 - p3) || on_seg(p1 - p2, p1 - p3));
            if (os) { // 線分上に頂点乗ってる
                cout << 1 << endl;
            } else {
                cout << 0 << endl;
            }
        } else {
            P r = intersection(p0, p1, p2, p3, s1, s2);
            // cout << real(r) << " " << imag(r) << endl;
            if (on_seg(p0 - r, p1 - r) && on_seg(p2 - r, p3 - r)) {
                cout << 1 << endl;
            } else {
                cout << 0 << endl;
            }
        }
    }
}



Measured memory_bytes: 3080
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <deque>
#include <cmath>
#include <string>

using namespace std;

typedef pair<int,int> P;

int main() {
  int n;
  int ans = 0;
  cin >> n;

  vector<queue<int>> a(n+1);

  for (int i=1; i<n+1; i++) {
    for (int j=0; j<n-1; j++) {
      int ai;
      cin >> ai;
      a[i].push(ai);
    }
  }

  queue<P> games;

  vector<bool> used(n+1,false);
  for (int i=1; i<n+1; i++) {
    if (used[i]) continue;
    int j = a[i].front();
    if (i == a[j].front()) {
      used[i]=true; used[j]=true;
      games.push(P(i,j));
    }
  }

  while(true) {
    if (games.empty()) break;
    ans++;
    queue<P> nextGame;
    while(!games.empty()) {
      P game = games.front();
      games.pop();
      int a1 = game.first;
      int a2 = game.second;

      a[a1].pop();
      a[a2].pop();

      if (!a[a1].empty()) {
        int j = a[a1].front();
        if (a1 == a[j].front()) {
          nextGame.push(P(a1,j));
        }
      }

      if (!a[a2].empty()) {
        int j = a[a2].front();
        if (a2 == a[j].front()) {
          nextGame.push(P(a2,j));
        }
      }
    }
    games = nextGame;  
  }


  for (auto ai : a) {
    if (ai.size() > 0 ) {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int maxABC = max(A, max(B, C));
  int minABC = min(A, min(B, C));
  int midABC = A + B + C - maxABC - minABC;
  int dif1 = maxABC - midABC;
  int dif2 = maxABC - minABC;
  int ans;
  if(dif1 % 2 == 0 && dif2 % 2 == 0){
    ans = dif1/2 + dif2/2;
  } else if (dif1 % 2 == 1 && dif2 % 2 == 1){
    ans = dif1/2 + dif2/2 + 1;
  } else {
    ans = dif1/2 + dif2/2 + 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    char s[3];
    scanf("%s",s);
    int c;
    c=0;
    if(s[0] == s[1]){
        if(s[1] == s[2]){
            c=1;
        }
    }
    if(c==0){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}



Measured memory_bytes: 128
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		Stack<Character> s = new  Stack<>();
		while(true){
			String in = sc.nextLine();
			String pr = "yes";
			if(in.charAt(0) == '.') break;
			for(int i = 0; ; i++){
				char c = in.charAt(i);
				if(c == '.') 
					break;
				else if(c == '(' || c =='[') 
					s.push(c);
				else if(c == ')' || c == ']'){
					if(s.empty()) {pr = "no"; break;}
					else if ((c == ')' &&  s.peek() == '(') 
						|| (c == ']' &&  s.peek() == '[')){
						s.pop();
					}else{
						pr = "no"; break;
					}
				}
			}
			if (!(s.empty())) pr = "no"; 
			System.out.println(pr);
			s.clear();
		}
	}
}

Measured memory_bytes: 46328
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    int count=0;
    for (int i=1;i<=n;i+=2) {
        count++;
    }
    if (count>=k) {
        cout<<"YES"<<endl;
    } else {
        cout<<"NO"<<endl;
    }
}

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

int main(){
  string S;
  cin >> S;
  
  long int num = 0, ans = 0;
  for (int i = 0; i < (int)(S.length()); i++){
    if (S.at(i) == 'W'){
      ans += i - num;
      num++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3748
#include <iostream>
#include <utility>
#include <map>
using namespace std;
typedef pair<int, int> pii;

int n, x[60], y[60], a;
pii k;
map<pii, int> m;

int main(){
	cin >> n;
	for (int i = 0; i < n; ++i){
		cin >> x[i] >> y[i];
	}
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < n; ++j){
			if (i == j) continue;
			k = {x[j] - x[i], y[j] - y[i]};
			if (m.find(k) == m.end()) m.emplace(k, 0);
			m.at(k)++;
		}
	}
	a = 0;
	for (auto it=m.begin(); it!=m.end(); ++it){
		if (a < it->second) a = it->second;
	}
	cout << (n - a);
}

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


template<typename ...> static inline int gc(void) { return getchar(); }
static inline void read(long long int &x){int k;x=0;for(;;){k=gc();if(48<=k&&k<=57){x=k-48;break;}}for(;;){k=gc();if(k<48||k>57)break;x=x*10+k-48;}}

long long N, K, b, i, r, m, n, a[40];
bool f[40];

main(){
    read(N);
    read(K);
    for(i = 0; i < N; ++i){
        read(a[i]);
        if(m < a[i]){
            ++r;
            m = a[i];
        }
        f[i] = (i < K);
    }
    if(r > K){return 0&puts("0");}
    n = 1099511627774;
    do{
        r = 0;
        m = *a;
        for(i = 1; i < N; ++i){
            if(m >= a[i]){
                if(f[i]){
                    ++m;
                    r += m - a[i];
                }
            }else{
                m = a[i];
            }
        }
        n = min(r, n);
    }while(prev_permutation(f, f + N));
    cout << n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
ll mod=1000000007;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> s(n+1);
  rep(i,n) cin >> a[i];
  s[0] = 0;
  rep(i,n){
    s[i+1] = (s[i] + a[i]);
  }
  
  ll ans=0;
  rep(i,n-1){
    ans += a[i] * ((s[n] - s[i+1])%mod);
    ans = ans % mod;
  }
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 6404
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	al = list(IN())
	if n == 2 or n == 3:
		return max(al)
	
	if n % 2 == 0:
		cc = [[0]*n,[0]*n]
		cc[0][0]=al[0]
		cc[1][1]=al[1]
		for i in range(2,n):
			if i%2==0:
				cc[0][i]=cc[0][i-2]+al[i]
			else:
				cc[1][i]=max(cc[1][i-2],cc[0][i-3])+al[i]
		return max(cc[0][-2], cc[1][-1])
		
	else:
		cc = [[0]*n,[0]*n, [0]*n]
		cc[0][0]=al[0]
		cc[1][1]=al[1]
		cc[0][2]=al[2]+al[0]
		cc[2][2]=al[2]
		for i in range(3, n):
			if i % 2 ==1:
				cc[1][i]=max(cc[1][i-2],cc[0][i-3])+al[i]
			else:
				cc[0][i]=cc[0][i-2]+al[i]
				cc[2][i]=max(cc[0][i-4],cc[1][i-3],cc[2][i-2])+al[i]
		return max(cc[0][-3],cc[1][-2],cc[2][-1])
				
	
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 105248
/*
ye mera template hai
apna khud likho bc :P
*/

/*
Author : Sarvagya Agarwal
*/

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

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int32_t main()
{
    fast;
    int a , b , c , d ;
    cin >> a >> b >> c >> d ;
    cout << max(a*b,c*d) << endl ;
    return 0;
}


Measured memory_bytes: 256
import Control.Monad

solver::[(String,String)]->Double
solver = sum.map (\(x,u)->(read x)*(if u == "BTC" then 380000 else 1))

main::IO()
main=do
  n<-return.read=<<getLine
  dat<-forM [1..n] (\_->return.(\(x:y:_)->(x,y)).words=<<getLine)
  print (solver dat)


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int n,m,t;

main(){
  cin>>n>>m>>t;

  vector<int> v(n);

  rep(i,n){
    cin>>v[i];
  }

  int ans=0;
  ans+=max(0LL,v[0]-m);
  ans+=max(0LL,t-v[n-1]-m);

  FOR(i,1,n){
    ans+=max(0LL,v[i]-v[i-1]-2*m);
  }
  cout<<ans<<endl;
}



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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

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

    int ans = 700;
    rep(i, 3) if (s[i] == 'o') ans += 100;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>

int main(){
  int ans = 1;
  int a,b;
  scanf("%d%d",&a,&b);
  if(a==2){
    ans = 0;
  }
  if(b==2){
    ans = 0;
  }
  if(ans==1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
n,a,b,c = gets.split.map(&:to_i)
query = []
n.times do |i|
  s = gets.chomp
  query << s
end
query << ""
ans = []
n.times do |i|
  q = query[i]
  if q == "AB"
    if a == 0 && b == 0
      puts "No"
      exit
    elsif a == 1 && b == 1
      if query[i+1] == "AC"
        a += 1
        b -= 1
        ans << "A"
      else
        b += 1
        a -= 1
        ans << "B"
      end
    elsif a > b
      b += 1
      a -= 1
      ans << "B"
    else
      a += 1
      b -= 1
      ans << "A"
    end
  elsif q == "AC"
    if a == 0 && c == 0
      puts "No"
      exit
    elsif a == 1 && c == 1
      if query[i+1] == "AB"
        a += 1
        c -= 1
        ans << "A"
      else
        c += 1
        a -= 1
        ans << "C"
      end
    elsif a > c
      c += 1
      a -= 1
      ans << "C"
    else
      a += 1
      c -= 1
      ans << "A"
    end
  else
    if b == 0 && c == 0
      puts "No"
      exit
    elsif b == 1 && c == 1
      if query[i+1] == "AB"
        b += 1
        c -= 1
        ans << "B"
      else
        c += 1
        b -= 1
        ans << "C"
      end
    elsif b > c
      c += 1
      b -= 1
      ans << "C"
    else
      b += 1
      c -= 1
      ans << "B"
    end
  end
end
puts "Yes"
puts ans.join("\n")

Measured memory_bytes: 26368
N = int(input())
a = 0
un = 0
no = 0
for i in range(N):
    s = input()
    if s == "A":
        a += 1
    else:
        un += 1
    if un > a:
        print("NO")
        no = 1
        break
if a != un and not no:
    print("NO")
elif not no:
    print("YES")


Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while(cin >> n >> m, n | m) {
    vector<int> scone(n);
    for(auto& i: scone) cin >> i;

    vector<int> sum = {0};
    for(auto i: scone) sum.push_back((sum.back() + (i % m)) % m);

    int answer = 0;
    set<int> used = {m};
    for(int j = 1; j < sum.size(); ++j) {
      answer = max(answer, (sum[j] - *used.lower_bound(sum[j]) + m + m) % m);
      used.insert(sum[j]);
      used.insert(sum[j] + m);
    }
    cout << answer << endl;
  }
}

Measured memory_bytes: 3828
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let S = cin.getStr(), K = cin.getInt();
    let A = [];
    for (let n = 0; n < S.length; n++) {
        for (let m = 1; m <= Math.min(K, S.length - n); m++) {
            A.push(S.substr(n, m));
        }
    }
    A.sort();
    let k = 0, n = 0, s = "";
    while (true) {
        if (s == A[n]) { n++; continue; }
        s = A[n];
        if (++k == K) {
            console.log(s);
            return;
        }
        n++;
    }
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9548
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::Ordering;

fn main() {
    input! {
        A: String,
        B: String,
    }
    let ans = match A.len().cmp(&B.len()) {
        Ordering::Greater => "GREATER",
        Ordering::Less => "LESS",
        Ordering::Equal => match A.cmp(&B) {
            Ordering::Greater => "GREATER",
            Ordering::Less => "LESS",
            Ordering::Equal => "EQUAL",
        },
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std ;
int main () {
  long long x ;
  cin >> x ;
  for (int i = -120 ; i <= 121 ; ++i) {
    for (int j = -120 ; j <= 121 ; ++j) {
      long a = pow(i , 5) ;
      long b = pow(j , 5) ;
      if (a - b == x) {
        cout << i << " " << j ;
        return 0 ;
      }
    }
  }
}


Measured memory_bytes: 4012
#include<bits/stdc++.h>
#define MAX 1000000
#define pb push_back
#define f first
#define s second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
using namespace std;

typedef pair<int, int> pii;
typedef map<int, int> mapint;
typedef vector<int> vi;

int power(int x, int y) 
{ 
    int res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
   
        // n must be even now 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}

int32_t main(){
	fio;
	int n;
	cin>>n;
	int arr[n];
	set<int> s;
	for(int i=0; i<n; i++){
		cin>>arr[i];
		s.insert(arr[i]);
	} 
	vector<int> v;
	v.clear();
	v.assign(s.begin(), s.end());
	sort(v.begin(), v.end());
	int max1 = v[v.size()-1];
	int max2;
	int count = 0;
	for(int i=0; i<n; i++){
		if(arr[i]==max1) ++count;
	}
	if(v.size()==1) max2 = max1;
	else max2 = v[v.size()-2];
	for(int i=0; i<n; i++){
		if(count>1) cout<<max1<<endl;
		else{
			if(arr[i]==max1) cout<<max2<<endl;
			else cout<<max1<<endl;
		}
		
	}
	return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
/*
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>

#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
*/
#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define up_b upper_bound
#define low_b lower_bound
#define lcm(a,b) (a * b) / __gcd(a, b)
#define REVERSE(a, n) reverse(a + 1, a + n + 1);
#define SORT(a, n) sort(a + 1, a + n + 1);
#define rsz resize

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <ll, ll> pll;
typedef map <ll, ll> mll;
typedef set <ll> sl;
typedef set <char> sc;
typedef map <string, ll> msl;
typedef map <string, bool> msb;
typedef map <char, ll> mcl;
typedef map <string, string> mss;
typedef vector <vl> vvl;
const ll mxn = 2e5 + 1;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld eps = 1e-9;
const ld PI = acos(-1);

#define int int64_t
#define FLN "LOL"

//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

inline void joji(bool ok = 0) {naj;if(ok){freopen(FLN".in","r",stdin);freopen(FLN".out","w",stdout);}}

signed main () {
	joji();
	int n, s = 10000;
	cin >> n;
	vvl dp(n + 1, vl(s + 1, -inf));
	vl a(n + 1);
	for(int i = 1; i <= n; i++) cin >> a[i];
	dp[0][0] = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= s; j++) {
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
			if(j >= a[i]) dp[i][j] = max(dp[i][j] * 1ll, dp[i - 1][j - a[i]] + a[i] * 1ll);
		}
	}
	ll ans = -1;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= s; j++) {
			if(dp[i][j] >= 0) {
				if(dp[i][j] % 10 == 0) ans = max(ans, 0ll);
				else ans = max(ans, dp[i][j] * 1ll);
			}
		}
	}
	cout << ans;
	return 0;
}

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

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> cnt(n+1,0);
	rep(i,n) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	sort(cnt.begin(), cnt.end());
	//rep(i,n+1) printf("%lld %d\n", i, cnt[i]);
	int kind = 0;
	rep(i,n+1) if (cnt[i] > 0) kind++;
	int ans = 0;
	if (k < kind) {
		for(int i=n-kind+1;i<=n-k;i++) ans+=cnt[i];
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
	string s;
	while(cin>>s)
	{
		if(s=="Sunny") cout<<"Cloudy"<<endl;
	
	else 	if(s == "Cloudy") cout<<"Rainy"<<endl;
		else 	if(s == "Rainy") cout<<"Sunny"<<endl;


	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e18;
using namespace std;
typedef long long ll;
int main() {
  ll A, B;
  cin >> A >> B;

  cout << max(A + B, max(A - B, A * B));

  return 0;
}

Measured memory_bytes: 256
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}
import java.lang

import scala.collection.mutable.ArrayBuffer
import scala.reflect.ClassTag

object Main {
  def get[T: ClassTag](implicit in: BufferedReader, converter: String => T): T = {
    converter(in.readLine)
  }

  def getArray[T: ClassTag](implicit in: BufferedReader, converter: String => T): Array[T] = {
    get[String].split("\\s+").map[T](converter)
  }

  implicit val idConverter: String => String = s => s
  implicit val intConverter: String => Int = s => Integer.parseInt(s)
  implicit val longConverter: String => Long = s => lang.Long.parseLong(s)

  def get[T1, T2](
                   implicit in: BufferedReader,
                   converter1: String => T1,
                   converter2: String => T2
                 ): (T1, T2) = {
    getArray[String] match {
      case Array(v1, v2) => (converter1(v1), converter2(v2))
    }
  }

  def get[T1, T2, T3](
                       implicit in: BufferedReader,
                       converter1: String => T1,
                       converter2: String => T2,
                       converter3: String => T3
                     ): (T1, T2, T3) = {
    getArray[String] match {
      case Array(v1, v2, v3) => (converter1(v1), converter2(v2), converter3(v3))
    }
  }

  implicit class TimesInt(val n: Int) {
    def times(f: Int => Unit): Unit = {
      for (i <- 0 until n) {
        f(i)
      }
    }
  }

  def primes(n: Long): ArrayBuffer[Long] = {
    val buf = ArrayBuffer.empty[Long]
    val s = Math.sqrt(n).toInt

    var v = n
    for (i <- 2 to s) {
      if (v == 1 || v == 0) {
        return buf
      } else {
        while (v % i == 0) {
          buf.append(i)
          v /= i
        }
      }
    }
    if (v > s) {
      buf.append(v)
    }
    buf
  }

  def main(args: Array[String]): Unit = {
    implicit val in: BufferedReader = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val (n, k) = get[Int, Int]
    var as = getArray[Int]

    k.times { _ =>
      val rs = Array.ofDim[Int](as.length)
      val diffs = Array.ofDim[Int](as.length + 1)

      for (i <- as.indices) {
        diffs(Math.max(0, i - as(i))) += 1
        diffs(Math.min(as.length, i + as(i) + 1)) -= 1
      }
      var d = 0
      for (i <- as.indices) {
        d += diffs(i)
        rs(i) = d
      }

      as = rs
      if (as.forall(_ == n)) {
        out.println(as.mkString(" "))
        out.flush()
        return
      }
    }

    out.println(as.mkString(" "))
    out.flush()
  }
}

Measured memory_bytes: 84336
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if abs(a[0]-a[1])==abs(b[0]-b[1])==abs(c[0]-c[1]) and abs(a[1]-a[2])==abs(b[1]-b[2])==abs(c[1]-c[2])and abs(a[0]-b[0])==abs(a[1]-b[1])==abs(a[2]-b[2]) and abs(b[0]-c[0])==abs(b[1]-c[1])==abs(b[2]-c[2]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
def main():
    n, c = map(int, input().split())
    xv = [list(map(int, input().split())) for _ in range(n)]
    v, left_max, right_max = 0, 0, 0
    gl = [None]*n
    gr = [None]*n
    _2oas = [None]*(n+1)
    _2obs = [None]*(n+1)
    _2oas[0], _2obs[0] = 0, 0
    ans = 0
    for i, (xi, vi) in enumerate(xv):
        v += vi
        left = v - xi
        if left_max < left:
            left_max = left
        gl[i] = left_max
        _2oas[i+1] = v - 2*xi
    v = 0
    for i, (xi, vi) in enumerate(xv[::-1]):
        v += vi
        right = v - c + xi
        if right_max < right:
            right_max = right
        gr[i] = right_max
        _2obs[i+1] = v - 2*(c - xi)
    for i in range(1, n+1):
        ans = max(ans, _2oas[i-1]+gr[-i], _2obs[i-1]+gl[-i])
    print(ans)
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 71640
import collections

def list_count(l):
    return collections.Counter(l)

n=int(input())
res=[]
for i in range(n):
    res.append(input())

res=list_count(res)

print("AC x {0}".format(res["AC"]))
print("WA x {0}".format(res["WA"]))
print("TLE x {0}".format(res["TLE"]))
print("RE x {0}".format(res["RE"]))




Measured memory_bytes: 16620
while True:
  try:
    hit=0
    brow=0
    a = map(int,raw_input().split())
    a1,b1,c1,d1 = a[0],a[1],a[2],a[3]
    b = map(int,raw_input().split())
    a2,b2,c2,d2 = b[0],b[1],b[2],b[3]
    for c in range(4):
      if a[c] == b[c]: hit +=1
      for d in range(4):
        if a[c]==b[d]:
          if c == d:
            break
          brow += 1

    print hit,brow
  except EOFError:
    break

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		n = sc.nextInt();
		int[] dp = new int[100100];
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0] = 0;

		for (int i = 1; i <= n; i++) {
			dp[i] = Math.min(dp[i], dp[i - 1] + 1);
			for (int j = 1; j < n; j++) {
				if(i - Math.pow(6, j) >= 0) dp[i] = Math.min(dp[i], dp[i - (int)Math.pow(6, j)] + 1);
				else break;
			}
			for (int k = 1; k < n; k++) {
				if(i - Math.pow(9, k) >= 0) dp[i] = Math.min(dp[i], dp[i - (int)Math.pow(9, k)] + 1);
				else break;
			}
		}

		System.out.println(dp[n]);
	}
}

Measured memory_bytes: 22228
#include<stdio.h>

int main (){
    
    int A,B,C,temp;
    
    scanf("%d %d",&A,&B);

 if(A % B == 0){
   printf("0"); 	
 }else{
 	printf("1");
 }
	
  
 
	
        return 0;
  
}



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

bool compare_second(pair<string, int> a, pair<string, int> b) {
  if (a.second != b.second)
    return a.second > b.second;
  else
    return a.first < b.first;
}

int main() {
  int n;

  vector<string> s;

  cin >> n;

  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    s.push_back(tmp);
  }

  if (n == 1) {
    cout << s.at(0);
    return 0;
  }

  sort(s.begin(), s.end());

  vector<pair<string, int>> ans;

  int cnt = 1;
  string tmp = s.at(0);

  for (int i = 1; i < n + 1; i++) {
    if (i == n) {
      ans.push_back(make_pair(tmp, cnt));
      break;
    }
    if (s.at(i) == tmp)
      cnt++;
    else {
      ans.push_back(make_pair(tmp, cnt));
      cnt = 1;
      tmp = s.at(i);
    }
  }

  sort(ans.begin(), ans.end(), compare_second);

  int max = ans.at(0).second;

  for (int i = 0; i < (int)ans.size(); i++) {
    if (max == ans.at(i).second)
      cout << ans.at(i).first << endl;
    else
      break;
  }

  return 0;
}

Measured memory_bytes: 18416
package main

import "fmt"

func main() {
	var N int
	var s string
	fmt.Scan(&N)
	fmt.Scan(&s)
	S := []rune(s)
	state := make([]int, N+1)
	state[0] = 0
	for i, v := range S {
		switch v {
		case '(':
			state[i+1] = state[i] + 1
		case ')':
			state[i+1] = state[i] - 1
		}
	}
	min := N
	for i := 0; i <= N; i++ {
		if min > state[i] {
			min = state[i]
		}
	}
	var answer []rune
	for i := 0; i < -min; i++ {
		answer = append([]rune{'('}, answer...)
	}
	answer = append(answer, S...)
	for i := 0; i < state[N]-min; i++ {
		answer = append(answer, ')')
	}
	fmt.Println(string(answer))
}


Measured memory_bytes: 640
#include <iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main() {

	/*int n;cin>>n;
	int oRgArr[n],permArr[n],chk=0;
	for(int i=0;i<n;++i)
		cin>>oRgArr[i];
	for(int j=0;j<n;++j)
			cin>>permArr[j];
	for(int k=0;k<n;++k)
	{
		for(int y=0;y<n;++y)
		{
			if(permArr[k]==oRgArr[y])
				chk++;

		}


	}
	cout<<chk+1<<endl;
	if(chk==n)
		cout<<"yes"<<endl;
	else
		cout<<"no"<<endl;
*/

	string s;
	getline(cin,s);
    if(s=="ARC")
    	cout<<"ABC"<<endl;
    else
    	cout<<"ARC"<<endl;

















    return 0;
}


Measured memory_bytes: 3624