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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

string culc(string a, string b) {
	string res;
	if (a.size() > b.size()) swap(a, b);
	int la = a.size(), lb = b.size(); // la <= lb
	int pos = 0, c = 0;
	
	while (pos < la) {
		c = a[la - pos - 1] - '0' + b[lb - pos - 1] - '0' + c;
		res.push_back(c % 10 + '0');
		c /= 10;
		pos++;
	}
	while (pos < lb) {
		c = b[lb - pos - 1] - '0' + c;
		res.push_back(c % 10 + '0');
		c /= 10;
		pos++;
	}
	if (c != 0) res.push_back(c + '0');
	
	reverse(res.begin(), res.end());
	return res;
}

int main() {
	string str;
	while (cin >> str) {
		vector<string> v;
		
		int ans = -1;
		REP(i, 10) {
			string tmp = str;
			REP(j, tmp.size()) {
				if (tmp[j] == 'X') tmp[j] = i + '0';
				else if (tmp[j] == '=') tmp[j] = '+';
			}
			
			v.clear();
			int pos = 0;
			while (pos < tmp.size()) {
				v.push_back("");
				int c = v.size() - 1;
				
				while (pos < tmp.size() && tmp[pos] != '+') {
					v[c].push_back(tmp[pos++]);
				}
				pos++;
			}
			
			bool f = false;
			REP(j, v.size())
				if (v[j].size() > 1 && v[j][0] == '0') f = true;
			if (f) continue;
			
			FOR(j, 1, v.size() - 1) {
				v[j] = culc(v[j - 1], v[j]);
			}
			
			if (v[v.size() - 2] == v[v.size() - 1]) ans = i;
		}
		
		if (ans != -1) cout << ans << endl;
		else puts("NA");
	}
	return 0;
}

Measured memory_bytes: 1200
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <map>
#include <unordered_map>
#include <string>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;

int main()
{   int N;
string a;
vector<string> records;
cin>>N;
for(int i=0;i<N;++i){cin>>a;records.push_back(a);}
vector<string> res;
unordered_map<string, int> m;
for(auto &word:records){
    m[word]++;
}
int max_ = INT_MIN;
for(auto&p:m)max_=max(max_, p.second);
for(auto&p:m)if(p.second==max_)res.push_back(p.first);
sort(res.begin(), res.end());
for(auto&r:res)cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 27376
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstdlib>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#define fi first
#define se second
#define pb push_back
#define me(a,b) memset(a,b,sizeof(a))
#define INIT() std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int MAX_N=10000000+5;
const int INF=0x7fffffff;
const int inf=100000;
const double EPS=1e-6;
const ull base=123;
const ll mod=1e9+7;
const double pi=4*atan(1.0);
int main(void)
{
    string s[4]={"AC","WA","TLE","RE"};
    int n;
    cin>>n;
    int sum[4]={0};
    while(n--)
    {
        string c;
        cin>>c;
        int i;
        for(i=0;i<4;i++)
            if(c==s[i])
            sum[i]++;
    }
    for(int i=0;i<4;i++)
    {
        cout<<s[i]<<' '<<'x'<<' '<<sum[i]<<endl;
    }
}


Measured memory_bytes: 3628
#include<iostream>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<queue>
#define f first
#define s second
using namespace std;
int main(){
  pair<int,int> now;
  int a[101];
  int n;
  int cnt=0;
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];
  now.f=a[0];
  for(int i=0;i<n;i++){
    if(a[i]!=now.f){
      now.f=a[i];
      cnt+=now.s/2;
      now.s=0;
    }
    now.s++;
  }
  cnt+=now.s/2;
  cout<<cnt<<endl;
  return 0;
}

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

int main(void){
    int n, k, h[100010], min = 1000000100;
    cin >> n >> k;
    for(int i=0;i<n;++i) cin >> h[i];
    sort(h, h+n);
    for(int i=0;i<=n-k;++i){
        int sa = h[i+k-1] - h[i];
        if(sa < min) min = sa;
    }
    cout << min << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 1000000000
#define mod 1000000007
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N;
	cin>>N;
	vector<int>v(100000);
	vector<int>a(N);
	REP(i,100000)v[i]=0;
	REP(i,N){;
		cin>>a[i];
		v[a[i]-1]++;
	}
	int ma=0,maa=0,mak=0,mk=0;
	REP(i,100000){
		if(ma<=v[i]){
			ma=v[i];
			maa=i+1;
		}
	}
	REP(i,100000){
		if(mak<v[i] && v[i]<=ma && i+1!=maa){
			//cout<<mk<<endl;
			mak=v[i];
			mk=i+1;
			//cout<<mk<<endl;
		}
	}
	int co=0,coo=0;
	for(int i=0;i<N-1;i+=2){
		if(a[i]!=maa)co++;
		if(a[i+1]!=mk)co++;
		if(a[i]!=mk)coo++;
		if(a[i+1]!=maa)coo++;
	}
	cout<<min(co,coo)<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define D(x) cerr << #x << " = " << (x) << '\n'
using ll = long long;

const int maxn = 200123;
ll dp[maxn][3], a[maxn], n;

ll solve(int idx, int skips) {
	if(idx >= n) {
		return skips <= 1 ? 0 : -1e18;
	}
	ll &res = dp[idx][skips];
	if(~res) return res;
	res = a[idx] + solve(idx + 2, skips);
	for(int i = 1; i <= skips; ++ i) res = max(res, solve(idx + i, skips - i));
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; ++ i) cin >> a[i];
	memset(dp, -1, sizeof dp);
	cout << solve(0, 1 + n % 2) << '\n';
}


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

int fiboArray[44] = {0};
int fibonacci(int anySection) {
	if (anySection == 0 || anySection == 1)
		return (fiboArray[anySection] = 1);

	if (fiboArray[anySection] == 0) { //?¨?????????????????????????
		fiboArray[anySection] = fibonacci(anySection - 1) + fibonacci(anySection - 2);
		return fiboArray[anySection];
	}
	else //?????§????¨?????????????????????????
		return fiboArray[anySection];
}

int main() {
	int anySection;
	cin >> anySection;

	int answer = fibonacci(anySection);

	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>

#define N 100000
#define Q 50000
#define E 1000000000

int binarysearch(int key);
int S[N];
int n=0;

main() {
  
  int q=0;
  int T[Q];
  int C=0;
  int i=0,j=0;
  
  scanf("%d",&n);
  
  if(n < 0 || N < n){
    return 0;
  }
  
  for(i=0;i < n;i++){
    scanf("%d",&S[i]);

    if(S[i] < 0 || E < S[i]){
      return 0;
    }
  }
  
  scanf("%d",&q);
  
  if(q < 0 || Q < q){
    return 0;
  }
  
  for(i=0;i < q;i++){
    scanf("%d",&T[i]);

     if(T[i] < 0 || E < T[i]){
      return 0;
    }
    j = binarysearch(T[i]);
    C = C+j;
  }

  printf("%d\n",C);
  
  return 0;
}

int binarysearch(int key){
  int left=0; 
  int right=n;  
  int mid; 
  
  while(right > left) {
    mid = (left+right)/2; 
    if(key == S[mid]) return 1;
    if(key > S[mid]) left = mid+1;
    else if(key < S[mid]) right = mid;
  }
  return 0;
}

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

//#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

#define LL long long


LL n;
LL inp[100];

int main() {
	#define int LL
	cin >> n;
	for(int i=0;i<n;i++) {
		cin >> inp[i];
	}

	int rup = 1000;
	int stocks = 0;

	int ans = rup;

	stocks = rup/inp[0];
	rup = rup%inp[0];

	for(int i=1;i<n;i++) {
		if(inp[i] > inp[i-1]) {
			//sell
			rup = rup + stocks * inp[i];
			ans = max(ans, rup);
			stocks = 0;

			//buy again
			stocks = rup/inp[i];
			rup = rup%inp[i];
		} 
		else if(inp[i] < inp[i-1]) {
			//buy here instead of last
			rup = rup + stocks * inp[i-1];
			stocks = 0;

			//buy again
			stocks = rup/inp[i];
			rup = rup%inp[i];
		}
	} 

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <sstream>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

ll power(ll x, ll m){
    if(m <= 0) return 1;
    if(m == 1) return x;
    if(m % 2 == 0){
        return power(x*x,m/2);
    }else{
        return power(x*x,m/2)*x;
    }
}

ll rec(string s){
    ll n = s.size();
    if(n == 0) return 0;
    if(n == 1) return s[0] - '0';
    if(n == 2) return stoll(s) + s[0] - '0' + s[n-1] - '0';
    ll sum = 0;
    REP(i,1,n+1){
        sum += stoll(s.substr(0,i))*power(2,n-i-1) + rec(s.substr(i, n-i));
    }
    return sum;
}

int main(){
    string s; cin >> s;
    ll n = s.size();
    cout << rec(s) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int a, b, c;

int main() {
    scanf("%d%d%d", &a, &b, &c);
    puts((b + c) % 2 == 1 ? "Borys" : "Alice");
    return 0;
}


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

using namespace std;

#define ll long long int

int main()
{
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
              ll n,k,i;
              cin>>n>>k;
              vector<ll>A(n);
              for(i=0;i<n;i++)
              {
                  cin>>A[i];
              }
              for(i=0;i+k<n;i++)
              {
                  if(A[i]<A[i+k])
                    cout<<"Yes\n";
                  else
                    cout<<"No\n";
              }
              return(0);
}


Measured memory_bytes: 4776
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,K;

int ans[100010];
vector<int> g[100010];
bool used[100010];
int dist[100010];

vector<int> rg[100010];

void dfs(int now,int len){
    used[now]=true;
    dist[now]=len;
    for(int i=0;i<g[now].size();i++){
        int next=g[now][i];
        if(used[next]) continue;

        dfs(next,len+1);
    }
    return;
}

/*void setAns(int now,int len){
    used[now]=true;
    if(len==0) ans[now]=0;
    for(int i=0;i<g[now].size();i++){
        int next=g[now][i];
        if(used[next]) continue;

        dfs(next,(len+1)%K);
    }
    return;
}*/

int rdfs(int now,int len){
    used[now]=true;
    if(len==K-1) return now;
    for(int i=0;i<rg[now].size();i++){
        int next=rg[now][i];
        if(used[next]) continue;

        return rdfs(next,len+1);
    }
    return -1;
}

void visit(int now){
    used[now]=true;
    for(int i=0;i<g[now].size();i++){
        int next=g[now][i];
        if(used[next]) continue;

        if(dist[next]>dist[now]) visit(next);
    }
    return;
}

int main(){
  cin>>N>>K;
  int a[N+1]={};
  for(int i=0;i<N;i++){
      cin>>a[i];
      a[i]--;
      ans[i]=a[i];
      if(i>0){
          g[a[i]].push_back(i);
          rg[i].push_back(a[i]);
      }
  }
  ans[0]=0;

  dfs(0,0);

  priority_queue<pair<int,int>> PQ;
  for(int i=0;i<N;i++){
      used[i]=false;
      PQ.push(make_pair(dist[i],i));
  }
  while(!PQ.empty()){
      pair<int,int> tp=PQ.top();
      PQ.pop();
      int now=tp.second;
      if(used[now]) continue;

      int x=rdfs(now,0);
      if(x!=-1){
          ans[x]=0;
          visit(x);
      }
  }
  /*for(int i=0;i<N;i++){
      if(used[i]) continue;
      if(dist[i]==K+1) setAns(i,0);
  }*/

  int res=0;
  for(int i=0;i<N;i++){
      if(ans[i]!=a[i]) res++;
      //cout<<ans[i]+1<<" ";
  }
  cout<<res<<endl;


  return 0;
}


Measured memory_bytes: 18300
N=int(input())
global key
key="abcdefghij"
def normal(N):
    if N==1:
        return ["a"]
    else:
        new=[]
        lis=normal(N-1)
        for s in lis:
            i=0
            while key[i] in s:
                new.append(s+key[i])
                i+=1
            new.append(s+key[i])
    return new
lis=normal(N)
for s in lis:
    print(s)

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

#define endl "\n"
#define ar array
#define INF 1e18;
#define ll long long
const int N=2e5+5;


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int a=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R')
            a+=1;

    }
    int ans=0;
    for(int i=0;i<a;i++){
        if(s[i]=='W')
            ans++;
    }
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 3764
#include <iostream>

using namespace std;

int main() {
    int N, X[110], sum = 0, P = 0, ans = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> X[i];
        sum += X[i];
    }
    P = (int) (1.0 * sum / N + 0.5);
    for (int i = 0; i < N; i++) {
        ans += (X[i] - P) * (X[i] - P);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
extern crate proconio;

use proconio::*;

fn main() {
    input! {
        k: i32,
        a: i32,
        b: i32,
    }
    for i in { 0..=1000 } {
        if a <= i * k && i * k <= b {
            println!("OK");
            return;
        }
    }
    println!("NG");
}


Measured memory_bytes: 2128
#include <iostream>
#include <vector>
#include <string>

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

enum Face{
	TOP,
	SOUTH,
	EAST,
	WEST,
	NORTH,
	BOTTOM,
};

class Dice{
private:
	std::vector<int> faces_;	

public:
	Dice(const std::vector<int> &labels);

	~Dice();

	void roll_north();

	void roll_east();

	void roll_west();

	void roll_south();

	void roll_to(char d);

	int get_cur_top_label();
};

Dice::Dice(const std::vector<int> &labels) : faces_(labels){
	return;
}

Dice::~Dice(){
	return;
}

void Dice::roll_north(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[SOUTH];
	faces_[SOUTH] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[NORTH];
	faces_[NORTH] = tmp;
	return;
}

void Dice::roll_east(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[WEST];
	faces_[WEST] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[EAST];
	faces_[EAST] = tmp;
	return;
}

void Dice::roll_west(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[EAST];
	faces_[EAST] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[WEST];
	faces_[WEST] = tmp;
	return;
}

void Dice::roll_south(){
	int tmp = faces_[TOP];
	faces_[TOP] = faces_[NORTH];
	faces_[NORTH] = faces_[BOTTOM];
	faces_[BOTTOM] = faces_[SOUTH];
	faces_[SOUTH] = tmp;
	return;
}

void Dice::roll_to(char d){
	switch(d){
	case 78:
		roll_north();
		break;
	case 69:
		roll_east();
		break;
	case 87:
		roll_west();
		break;
	case 83:
		roll_south();
		break;
	default:
		break;
	}
	return;
}

int Dice::get_cur_top_label(){
	return faces_[TOP];
}

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int num_faces = 6;
	std::vector<int> labels(num_faces, 0);
	Dice *dice = NULL;
	std::string operations;

	for(int i = 0; i < num_faces; i++){
#if INPUT_FROM_FILE
		ifs >> labels[i];
#else
		std::cin >> labels[i];
#endif;
	}

	dice = new Dice(labels);

#if INPUT_FROM_FILE
	ifs >> operations;
#else
	std::cin >> operations;
#endif;

	for(unsigned int i = 0; i < operations.size(); i++){
		dice->roll_to(operations.at(i));
	}

	std::cout << dice->get_cur_top_label() << std::endl;	
	delete dice; dice = NULL;
	return 0;
}

Measured memory_bytes: 3128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int plug=A;
		int ans=1;

		if(B==1) {
			ans=0;
			System.out.println(ans);
			return;
		}

		while(true) {
			if(B<=plug) {
				break;
			}
			plug+=A-1;
			ans++;
		}
		System.out.println(ans);
	}
}

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

int main(){
    int nn,n = 0,m = 0;
    string s;
    cin >> nn >> s;
    rep(i,s.size()){
        if (s[i] == 'I'){
            n++;
            if(n > m)m = n;
        }
        else n--;
    }
    cout << m;
}

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

const int P = 1e9 + 7;
map < int , vector < int > > ball; int N , X , Y , fac[200003] , ifac[200003];
int poww(long long a , int b){int tms = 1; while(b){if(b & 1) tms = tms * a % P; a = a * a % P; b >>= 1;} return tms;}

int main(){
	cin >> N >> X >> Y;
	for(int i = 1 ; i <= N ; ++i){int C , W; cin >> C >> W; ball[C].push_back(W);}
	fac[0] = 1; for(int i = 1 ; i <= N ; ++i) fac[i] = 1ll * fac[i - 1] * i % P;
	ifac[N] = poww(fac[N] , P - 2); for(int i = N - 1 ; ~i ; --i) ifac[i] = ifac[i+ 1] * (i + 1ll) % P;
	if(ball.size() == 1){puts("1"); return 0;}
	int mn1 = 1e9 , mn2 = 1e9;
	for(auto &t : ball){
		sort(t.second.begin() , t.second.end());
		if(mn1 > t.second[0]){mn2 = mn1; mn1 = t.second[0];}
		else mn2 = min(mn2 , t.second[0]);
	}
	int all = 0 , tms = 1;
	for(auto &t : ball)
		if(t.second[0] + (mn1 == t.second[0] ? mn2 : mn1) <= Y){
			int p = upper_bound(t.second.begin() , t.second.end() , X - t.second[0]) - t.second.begin() , num = p;;
			auto it = upper_bound(t.second.begin() , t.second.end() , X - t.second[0]);
			while(it != t.second.end() && *it + (mn1 == t.second[0] ? mn2 : mn1) <= Y){
				++it; ++num;
			}
			all += num; tms = 1ll * tms * ifac[num] % P;
		}
	cout << 1ll * tms * fac[all] % P;
	return 0;
}


Measured memory_bytes: 17024
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	var s string
	fmt.Scan(&s)

	max, count, right := 0, 0, 0
	for left := 0; left < n; {
		// move right until 0
		for right < n {
			if s[right:right+1] == "0" && count == k {
				break
			}

			if s[right:right+1] == "0" {
				for right < n && s[right:right+1] == "0" {
					right++
				}
				count++
			} else {
				right++
			}
		}

		if max < right - left {
			max = right - left
		}

		// move left over 1st 0
		for left < n && s[left:left+1] != "0" {
			left++
		}
		for left < n && s[left:left+1] == "0" {
			left++
		}
		count--
	}

	fmt.Println(max)
}


Measured memory_bytes: 1280
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define MP make_pair
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;i++) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

double dp[3000];

int main()
{jizz
	int n;
	double a,b,ans=0;
	cin >> n,dp[0]=1;
	for(int i=1;i<=n;++i)
	{
		cin >> a;
		for(int j=n/2;j>0;--j)
			dp[j]=dp[j-1]*(1-a)+dp[j]*a;
		dp[0]*=a;
	}
	for(int i=n/2;i>=0;--i)
		ans+=dp[i];
	cout << fixed << setprecision(10) << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i < (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b)
    {
        return b;
    }
    return a; 
}

template<class T>
bool chmin(T &a, const T &b) {
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0; 
}

int main() {
    ull l, r;
    cin >> l >> r;

    if (r-l >= 2019) 
    {
        cout << 0 << endl;
        return 0;
    }

    ull mini = 1e9 + 2;
    for (ull i = l; i < r; i++)
    {
        for (ull j = i+1; j <= r; j++)
        {
            /* code */
            mini = min(mini, (i*j)%2019);
        }
    }
    // n = (m + n)/2;
    cout << mini << endl;
    return 0;
}

Measured memory_bytes: 256
/*--------- Hongjie ----------*/
/**
 *　　　　　　　　┏┓　　　┏┓+ +
 *　　　　　　　┏┛┻━━━┛┻┓ + +
 *　　　　　　　┃　　　　　　　┃
 *　　　　　　　┃　　　━　　　┃ ++ + + +
 *　　　　　　 ████━████ ┃+
 *　　　　　　　┃　　　　　　　┃ +
 *　　　　　　　┃　　　┻　　　┃
 *　　　　　　　┃　　　　　　　┃ + +
 *　　　　　　　┗━┓　　　┏━┛
 *　　　　　　　　　┃　　　┃
 *　　　　　　　　　┃　　　┃ + + + +
 *　　　　　　　　　┃　　　┃　　　　Code is far away from bug with the animal protecting
 *　　　　　　　　　┃　　　┃ + 　　　　神兽保佑,代码无bug
 *　　　　　　　　　┃　　　┃
 *　　　　　　　　　┃　　　┃　　+
 *　　　　　　　　　┃　 　　┗━━━┓ + +
 *　　　　　　　　　┃ 　　　　　　　┣┓
 *　　　　　　　　　┃ 　　　　　　　┏┛
 *　　　　　　　　　┗┓┓┏━┳┓┏┛ + + + +
 *　　　　　　　　　　┃┫┫　┃┫┫
 *　　　　　　　　　　┗┻┛　┗┻┛+ + + +
 */

// #include<bits/stdc++.h>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<cmath>
#include<cstdio>
#include<bitset>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;
typedef pair<int ,int> P;

const int INF  = 0x3f3f3f3f;
const int MAXN = 1e6+7;


int main(){
        // freopen("../in.txt","r",stdin);
        // freopen("../out.txt","w",stdout);
        ios::sync_with_stdio(0);
        cin.tie(0);
        int a,b,c;
        while(cin>>a>>b>>c)
                if(a-b>=c)      cout<<0<<endl;
                else            cout<<b+c-a<<endl;

        return 0;
}


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

int main() {
	// your code goes here
	int a,b,c,ans=0;
	cin>>a>>b>>c;
	for(int i=a;i<=b;i++){
		if(c%i==0) ans++;
		
		
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

vector<ll>a(50),p(50);
ll f(ll x, ll y){
  if(!x){
    if(y>0) return 1;
    else return 0;
  }
  else if(y<=a[x-1]+1) return f(x-1,y-1);
  else if(y==a[x-1]+2) return p[x-1]+1;
  else if(y==2*a[x-1]+3) return 2*p[x-1]+1;
  else return p[x-1]+1+f(x-1,y-2-a[x-1]);
}

void solve(){
  ll n,x; cin >>n >>x;
  a[0]=1; p[0]=1;
  for(int i=1; i<n; i++){
    a[i]=2*a[i-1]+3;
    p[i]=2*p[i-1]+1;
  }
  cout <<f(n,x);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3572
#include <cmath>
#include <queue>
#include <cstdio>
#include <map>
#include <vector>
#include <iostream>
#include <stack>
#include <climits>
#include <assert.h>
#include <set>
#include <queue>
#include <algorithm>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;


typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
const int N = 100001;
const int MOD = 1e9 + 7;

int main(int argc, const char * argv[]) {
    
    int n;
    cin>>n;
    vector<string> vec1;
    vector<string> vec2;

    for(int i = 0; i < n; i++){
        string a;
        cin>>a;
        vec1.push_back(a);
        vec2.push_back(a);
        
    }
    string t;
    cin>>t;
    /*
    int count = 0;
    int count2 = 0;
    
    for(int i = 0; i < n; i++){
        bool smallerthant = false;
        bool largerthant = false;
        
        for(int j = 0; j < t.size() && j < vec[i].size(); j++){
            if(vec[i][j] < t[j] && vec[i][j] != '?'){
                smallerthant = true;
            }
            if(vec[i][j] > t[j] && vec[i][j] != '?'){
                largerthant = true;
            }
            if(vec[i][j] == '?'){
                if(!largerthant && !smallerthant){
                    
                }
            }
        }
        
        
    }*/
    
    //cout<<count<<" "<<count2<<endl;
    
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < vec1[i].size(); j++){
            if(vec1[i][j] == '?'){
                vec1[i][j] = 'a';
                vec2[i][j] = 'z';
            }
        }
    }
    
    sort(vec1.begin(), vec1.end());
    sort(vec2.begin(), vec2.end());
    
    int lowerbound = -1;
    int upperbound = n;
    for(int i = 1; i <= n; i++){
        
        if(vec1[i-1] > t){
            upperbound = i-1;
            break;
        }
        
        
    }
    
    for(int i = 1; i <= n; i++){
        
        if(vec2[i-1] >= t){
            lowerbound = i-1;
            break;
        }
        
        
    }
    
    

    //cout<<lowerbound<<" "<<upperbound<<endl;
    if(lowerbound == -1){
        cout<<n+1<<endl;
        return 0;
    }
    
    
    for(int i = lowerbound+1; i < upperbound + 1; i++){
        cout<<i<<" ";
    }
    cout<<upperbound+1<<endl;
    
    return 0;
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int n;
vector<double> a;
vector<vector<double>>dp(3000 + 1, vector<double>(3000 + 1, -1));

double solve(int i, int heads)
{
	//base case

	if (i > n) //if coins are over and no of heads>k return 1 else return 0
	{
		if (heads >= (n + 1) / 2)
			return 1.0;
		else
			return 0.0;
	}

	if (dp[i][heads] != -1)
		return dp[i][heads];

	//first coin can have two choice head or tail if head increase cnt of head otherwise dont increase
	//multiply their probabilities also

	return 	dp[i][heads] = a[i] * solve(i + 1, heads + 1) + (1.0 - a[i]) * solve(i + 1, heads);
}

int32_t main()
{
	FIO();
	cin >> n;

	a.resize(n + 1);

	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
	}

	int k = (n + 1) / 2; //i need k heads

	double ans = solve(1, 0); //index of first coin and no of heads

	cout << ps(ans, 10) << '\n';

	return 0;
}

Measured memory_bytes: 74488
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

const int mod=1000000007;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N,ans=1;
	cin>>N;
	int a[100003]={0};
	REP(i,N){
		int b;
		cin>>b;
		if(b!=0)
		a[b]++;
	}
	REP(i,100003){
		if(a[i]%2==1){
			cout<<"0"<<endl;
			return 0;
		}
	}
	FOR(i,1,N/2+1)
		ans=ans*2%mod;
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
map<int,bool>switches;
vector<int> v[15];
int k[11];
int bulb[11];
int ans;
int n,m;

void dfs(int x)
{
    int res = 1, cnt = 0;
    if(x == n){
        for(int i = 0; i < m; i++){
            cnt = 0;
            for(int j = 0; j < k[i]; j++){
                if(switches[v[i][j] - 1]) cnt++;
            }
            if(cnt % 2 != bulb[i]) res = 0;
        }
        ans += res;
    }
    else{
        switches[x] = true;
        dfs(x+1);
        switches[x] = 0;
        dfs(x+1);
    }
}

int main()
{
    /*
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    */
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            int x;
            cin >> x;
            v[i].push_back(x);
        }
    }

    for(int i = 0; i < m; i++) cin >> bulb[i];

   dfs(0);

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

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Linq;
using static System.Math;

namespace AC
{
   public class shiokara
   {
      static void Main(string[] args)
      {
          long[] n = ReadLine().Split(' ').Select(long.Parse).ToArray();
          long k = n[2] - n[1] - n[0];

          if(k > 0 && k * k > 4 * n[0] * n[1]) WriteLine("Yes");
          else WriteLine("No");
      }
   }
}

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

int main() {
	int n;

	scanf("%d", &n);

	//３の倍数または１０で割ったときのあまりが３または３が含まれている
	for (int i = 1; i <= n; i++) {
		if (i % 3 == 0) printf(" %d", i);
		else if (i % 10 == 3) printf(" %d", i);
		else if ((i / 10) % 10 == 3) printf(" %d", i);
		else if (((i / 10) / 10) % 10 == 3) printf(" %d", i);
		else if ((((i / 10) / 10) / 10) % 10 == 3) printf( " %d", i);
	}

	printf("\n");

	return 0;

}


Measured memory_bytes: 3208
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <sstream>
#include <utility>
#include <bitset>

using namespace std;

#define MP make_pair 
#define PB push_back 
#define INF (1000000007) 
#define eps 1e-8
#define MOD (1000000007)

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

ll sum;
ll s[200005],a[200005],mi;
int n;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		s[i]=s[i-1]+a[i];
		sum+=a[i];
		
	}
//	if(n==1) mi=a[1];
	mi=1e18+7;
	for(int i=1;i<n;i++)
	{
//		cout<<s[i]<<" "<<sum-s[i]<<endl;
		mi=min(mi,abs(s[i]-(sum-s[i])));
	}
	cout<<mi;
	return 0;
}

Measured memory_bytes: 3328
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")

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

#define FIO ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
typedef long long ll;

int32_t main() {
	FIO;
	ll n, m, k, temp;
	cin >> n >> m >> k;
	vector <ll> a(n), b(m);
	for (int i=0;i<n; ++i) {
		if (!i) cin >> a[i];
		else {
			cin >> temp;
			a[i] = a[i-1]+temp;
		}
	}
	for (int i=0;i<m; ++i) {
	   	if (!i) cin >> b[i];
    	else {
    		cin >> temp;
    		b[i] = b[i-1]+temp;
		}
	}
	int ans = 0;
	for (int i=0; i<n; ++i) {
		if (k < a[i]) break;
		int p = upper_bound(b.begin(), b.end(), k-a[i]) - b.begin();
		ans = max(ans, i+1+p);
	}
	for (int i=0; i<m; ++i) {
		if (k < b[i]) break;
		int p = upper_bound(a.begin(), a.end(), k-b[i]) - a.begin();
		ans = max(ans, i+1+p);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 6356
import math
 
def main():
    a, b, h, m = [int(x) for x in input().split()]
    theta_a = (60 * h + m) / 720 * (2 * math.pi)
    theta_b = (m / 60) * (2 * math.pi)
    xh = a * math.cos(theta_a)
    yh = a * math.sin(theta_a)
    xm = b * math.cos(theta_b)
    ym = b * math.sin(theta_b)
    ans = math.sqrt((xh - xm)**2 + (yh - ym)**2)
    return ans
 
if __name__ == '__main__':
    print(main())

Measured memory_bytes: 9500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

ll mod_pow(ll a, ll b) {
    if (b == 0) return 1;
    if (b & 1) return (a * mod_pow(a, b - 1));
    ll t = mod_pow(a, b / 2);
    return (t * t);
}

int main() {
    int n, m;
    cin >> n >> m;
    ll t = (n - m) * 100 + m * 1900;
    ll prob = mod_pow(2, m);
    ll ans = t * prob;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x, y;
  cin >> x >> y;

  string x_group, y_group;

  if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12){
    x_group = "a";
  }
  else if (x == 4 || x == 6 || x == 9 || x == 11){
    x_group = "b";
  }
  if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12){
    y_group = "a";
  }
  else if (y == 4 || y == 6 || y == 9 || y == 11){
    y_group = "b";
  }

  if (x == y || x_group == y_group){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
/*
    @uthor: Amit Kumar
    user --> CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;
//#define ln mp::cpp_int;
#define ll    long long
#define ld    double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"\Case #"<<x<<"\:"

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}


void virus(){
        ll n;
        cin>>n;
        ll ck = n%10;
        if(ck==2 or ck==4 or ck==5 or  ck==7 or ck==9) cout<<"hon";
        else if(ck==0 or ck==1 or ck==6 or ck==8) cout<<"pon";
        else cout<<"bon";
}


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

    ll t = 1;
    //cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 3656
#include <cstddef>
#include <iostream>
#include <vector>

class DisjointSet {
 private:
  class Node {
    friend DisjointSet;

    std::size_t parent;
    std::size_t size;

    Node(const std::size_t parent, const std::size_t size) : parent(parent), size(size) {}
  };

  std::vector<Node> nodes;

 public:
  DisjointSet(const std::size_t n) : nodes(n, Node(n, 1)) {}

  std::size_t size() const { return nodes.size(); }

  std::size_t root(const std::size_t x) {
    if (nodes[x].parent == size()) return x;
    return nodes[x].parent = root(nodes[x].parent);
  }

  bool is_same(const std::size_t x, const std::size_t y) { return root(x) == root(y); }

  std::size_t size(const std::size_t x) { return nodes[root(x)].size; }

  bool unite(const std::size_t x, const std::size_t y) {
    std::size_t rx = root(x), ry = root(y);
    if (rx == ry) return false;
    if (nodes[rx].size < nodes[ry].size) std::swap(rx, ry);
    nodes[rx].size += nodes[ry].size;
    nodes[ry].parent = rx;
    return true;
  }
};

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int N, Q;
  std::cin >> N >> Q;
  DisjointSet ds(N);
  for (int i = 0; i < Q; i++) {
    int t, u, v;
    std::cin >> t >> u >> v;
    switch (t) {
      case 0:
        ds.unite(u, v);
        break;
      case 1:
        if (ds.is_same(u, v)) {
          std::cout << 1 << '\n';
        } else {
          std::cout << 0 << '\n';
        }
        break;
    }
  }
  return 0;
}


Measured memory_bytes: 6276
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

  temp = *x;
  *x = *y;
  *y = temp;
}




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}





/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int n;
  scanf("%d",&n);
  int ans=(n-3)*n/2+n;
  ans-=n/2;
  printf("%d\n",ans);
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      if(i+j==n+1 && n%2==0){
        continue;
      }
      if(i+j==n && n%2==1){
        continue;
      }

      printf("%d %d\n",i,j);
    }
  }
}

Measured memory_bytes: 1704
n, k = map(int, input().split())
s = list(input())
a, b, happy = 0, 0, 0
for i in range(n):
    if i < n-1:
        if s[i] == "R" and s[i+1] == "L": a += 1
        if s[i] == "L" and s[i+1] == "R": b += 1
    if i > 0 and s[i] == "L" and s[i-1] == "L": happy += 1
    if i < n-1 and s[i] == "R" and s[i+1] == "R": happy += 1
print(happy + min(k, min(a,b))*2 + max(0, min(k, max(a,b))-min(a,b)))


Measured memory_bytes: 4084
#include <stdio.h>
int main(void)
{
	int n, no, a, i, j;
	char m;
	int x[4][13] ={{0}};
	scanf("%d",&n);
	while(n > 0){
		scanf(" %c",&m);
		scanf("%d",&no);
		
		if(m == 'S'){
			a = 0;
		}
		if(m == 'H'){
			a = 1;
		}
		if(m == 'C'){
			a = 2;
		}
		if(m == 'D'){
			a = 3;
		}
		x[a][no - 1] = 1;
		n--;
		}

    for(i = 0; i < 4; i++){
    	for(j = 0; j < 13; j++){
    		if(x[i][j] == 0){
    			if(i == 0){
    				m = 'S';
    			}
    			if(i == 1){
    				m = 'H';
    			}
    			if(i == 2){
    				m = 'C';
    			}
    			if(i == 3){
    				m = 'D';
    			}
    			printf("%c %d\n", m, j + 1);
    			}
    		}
    	}
    	
    	
    	return 0;
}

Measured memory_bytes: 596
//  Copyright 2020 Nikita Golikov

#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;
using ui64 = uint64_t;

template <class A, class B>
bool smin(A &x, B &&y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}

template <class A, class B>
bool smax(A &x, B &&y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

int main() {
#ifdef GOLIKOV
  assert(freopen("in", "rt", stdin));
  auto _clock_start = chrono::high_resolution_clock::now();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  string s;
  cin >> s;
  int ans = 0;
  int c = 0;
  for (int i = 0; i < 3; ++i) {
    if (s[i] == 'S') {
      c = 0;
    } else {
      ++c;
      smax(ans, c);
    }
  }
  cout << max(ans, c) << '\n';

#ifdef GOLIKOV
  cerr << "Executed in " << chrono::duration_cast<chrono::milliseconds>(
      chrono::high_resolution_clock::now()
          - _clock_start).count() << "ms." << endl;
#endif
  return 0;
}


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

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int A,B;
        cin >> A >> B;

        int ans = 0;
        for(int i = 0; i < 2; ++i){
            if(A > B){
                ans += A;
                A--;
            }else{
                ans += B;
                B--;

            }
        }
        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  string S; cin >> S;
  int ans = 0;
  for(int i = 1; i < S.size(); ++i) {
    if(S[i] != S[i - 1]) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main() {
    int n; cin >> n;
    long long arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            ans += arr[i]/2;
            arr[i] %= 2;
        } else {
            ans += (arr[i]+arr[i-1])/2;
            arr[i] = (arr[i] > 0) ? (arr[i]+arr[i-1])%2 : 0;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1024
Ia = input().split()
n = int(Ia[0])
m = int(Ia[1])

a = [[0 for midx in range(m)] for nidx in range(n)]
for nidx in range(n):
    A = input().split()
    for midx in range(m):
        a[nidx][midx] = int(A[midx])

b = m * [0]
for bidx in range(m):
    b[bidx] = int(input())

c = n * [0]
for i in range(n):
    for j in range(m):
        c[i] += a[i][j] * b[j]

for i in range(n):
    print(c[i])

Measured memory_bytes: 7952
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();

		while (true) {
			double d = Math.sqrt((double) n);
			String str = String.valueOf(d);
			if(str.endsWith(".0")){
				System.out.println(n);
				break;
			}
			n--;
		}

	}

}


Measured memory_bytes: 28336
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include<cstdio>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, X;
  cin >> N;
  cin >> X;
  
  vector<int> l(N);
  for ( int i = 0; i < N; ++i ) cin >> l.at(i) ;
  
  vector<int> d(N+1);
  d.at(0) = 0;

  int cnt = 1;
  
  for ( int i = 1; i < N + 1; ++i ) {
    int x = d.at(i - 1) + l.at(i - 1);
    d.at(i) = x;
    if (x <= X) ++cnt ;
  }
  
  cout << cnt;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())

ans = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = 500*i + 100*j + 50*k
            if sum == X:
                ans += 1

print(ans)

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

ll gcd(ll A,ll B){
  ll a=max(A,B),b=min(A,B),r=a%b;
  
  if(r==0)
    return b;
  else
    return gcd(b,r);
}

ll lcm(ll A,ll B){
  return A/gcd(A,B)*B;
}


int main(){
  int N;
  cin>>N;
  vector<ll>T(N);
  for(int i=0;i<N;i++)
    cin>>T.at(i);
  
  ll res=T.at(0);
  
  for(int  i=1;i<N;i++)
    res=lcm(res,T.at(i));
  
  cout<<res;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
using namespace std;
#define MS0(I) memset(I, 0, sizeof(I));
#define MS1(I) memset(I, -1, sizeof(I));
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, s, n) for(int i = (s); i < (n); ++i)
#define per1(i, a, b) for(int i = a; i >= b; --i)
#define DRI(A) int A; scanf("%d", &A);
#define DRII(A, B) int A, B; scanf("%d %d", &A, &B);
#define DRIII(A, B, C) int A, B, C; scanf("%d %d %d", &A, &B, &C);
#define SZ(X) ((int)X.size() )
#define MP make_pair 
#define pb push_back
#define F first
#define S second
#define ALL(I) (I).begin(), (I).end()
typedef const void CV;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LDB;
typedef pair<int, int> PII; 
const double eps = 1e-7;
const double PI = acos(-1);
const LL INFF = (LL)1e18;
const int INF = (int)1e8;
const int mod = (int)1e9+7;
const int MAX = (int)2e5+7;
int st[MAX];
#define ls pos<<1
#define rs pos<<1|1
struct node{
	int l, r;
	int mid(){
		return (l+r)>>1;
	}
	int v;
}sg[MAX<<2];
void build(int l, int r, int pos){
	sg[pos].l = l; sg[pos].r = r;
	if(l == r){
		sg[pos].v = st[l];
		return ;
	}
	int mid = (l+r)>>1;
	build(l, mid, ls);
	build(mid+1, r, rs);
	if(sg[ls].v == -1 || sg[rs].v == -1) sg[pos].v = -1;
	else if(sg[ls].v & sg[rs].v) sg[pos].v = -1;
	else sg[pos].v = sg[ls].v | sg[rs].v;
	return ;
}
int query(int l, int r, int pos){
	if(sg[pos].l == l && sg[pos].r == r) return sg[pos].v;
	int mid = sg[pos].mid();
	if(r <= mid) return query(l, r, ls);
	else if(l > mid) return query(l, r, rs);
	else{
		int ll = query(l, mid, ls);
		int rr = query(mid+1, r, rs);
		if(ll == -1 || rr == -1) return -1;
		else if(ll & rr) return -1;
		else return ll | rr;
	}
}
int main(void){
	DRI(n);
	rep1(i, 1, n+1) scanf("%d", st + i);
	build(1, n, 1);
	LL ans = 0;
	rep1(i, 1, n+1){
		int l = i+1, r = n, res = i;
		while(l <= r){
			int mid = (l+r)>>1;
			int v = query(i+1, mid, 1);
			if(v == -1 || v & st[i]) r = mid - 1;
			else l = mid+1, res = mid;
		}
		ans += res - i + 1;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 9216
import java.util.*;

class Main{
  public static void main(String[] args){
    try(Scanner sc = new Scanner(System.in)){
      double a = sc.nextDouble();
      double b = sc.nextDouble();
      double ave = (a + b) / 2;
      System.out.println((int)Math.ceil(ave));
    }
  }
}
      
    

Measured memory_bytes: 24916
#include<stdio.h>

int main(){
 int d,i;
 int S;

 while(scanf("%d",&d)!=EOF){

  S=0;
  for(i=1;i<=(600/d-1);i++)
    S+=(i*d)*(i*d)*d;
    
  printf("%d\n",S);

 }

 return 0;
}


Measured memory_bytes: 1984
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();

    stdin.read_line(&mut buf).unwrap();
    let n: usize = buf.trim().parse().unwrap();
    buf.clear();

    stdin.read_line(&mut buf).unwrap();
    let s = buf.trim();

    if n % 2 != 0 {
        println!("No");
        return
    }

    let m = n / 2;

    let former = &s[..m];
    let latter = &s[m..];
        
    if former == latter {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main()
{
	long n, k, m;
	cin >> n;
	m = n;
	k = ceil(sqrt((double)n));
	vector<char> vA(k+1, 0);
	vector<long> vP;
	vP.reserve(100);
	for(int i = 2; i <= k; ++i){
		if( vA[i] == 0 ){
			vA[i] = 1;
			for(int j = 2; j * i <= k; ++j)
				vA[i * j] = 2;
			if(0 == n % i)
				vP.push_back(i);
			while( 0 == m % i)
				m = m / i;
		}
	}

	if( 1 != m)
		vP.push_back(m);

	double c = n;
	for(int i = 0; i < vP.size(); ++i)
		c *= (1.0 - 1.0 / (double)vP[i]);
	int a = int(c + 0.001);
	cout << a << "\n";
	return 0;
}

Measured memory_bytes: 1244